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AAW1iQ,GAAW,CAAC,EA8B7B,SAASurQ,EAAInrQ,KAAUwgQ,GAErB,IAAI1zP,EAAKq+P,EAAI2pC,QACb,MAAMnsC,EAAWwC,EAAIxC,SAErB,GAAI3oQ,GAAS,GAAIb,KAAKa,EAAOV,GAAM,CAEjC,MAAMmP,EAAKyF,OAAOlU,EAAMV,IAExBwN,EAAK,GAAI3N,KAAKwpQ,EAAUl6P,GAAMk6P,EAASl6P,GAAM08P,EAAI4pC,OACnD,CAEA,GAAIjoS,EACF,OAAOA,EAAG3N,KAAK+H,KAAMlH,KAAUwgQ,EAEnC,CAOA,OALA2K,EAAIxC,SAAWrG,EAASqG,UAAY,CAAC,EACrCwC,EAAI2pC,QAAUxyC,EAASwyC,QACvB3pC,EAAI4pC,QAAUzyC,EAASyyC,QAGhB5pC,CACT,CCtGA,MAAM6pC,GAAqB,YACrBC,GAAsB,kCACtBC,GAEJ,6DACIC,GAAmB,sBAGnBC,GAAqB,IAAIhlR,QCvB/B,MAAMilR,GAAmB,aCAnBC,GAAe,KCKRC,GAA0B,CACrC,QACA,MACA,SACA,QACA,SACA,QACA,SACA,OACA,OACA,SACA,MACA,SACA,QACA,SACA,OACA,KACA,SACA,QACA,SACA,OACA,KACA,SACA,SACA,QACA,SACA,SACA,SACA,OACA,OACA,MACA,QACA,SACA,QACA,SACA,OACA,SACA,SACA,QACA,QACA,QACA,SACA,MACA,QACA,SACA,OACA,SACA,SACA,QACA,OACA,OACA,SACA,MACA,SACA,SACA,QACA,SACA,MACA,OACA,SACA,SACA,SACA,KACA,SACA,QACA,QACA,SACA,SACA,OACA,QACA,KACA,OACA,QACA,SACA,OACA,MACA,SACA,SACA,QACA,SACA,OACA,OACA,SACA,SACA,OACA,OACA,SACA,QACA,OACA,QACA,MACA,OACA,MACA,OACA,OACA,OACA,QACA,QACA,QACA,SACA,QACA,SACA,MACA,OACA,SACA,MACA,QC1GWC,GAAyB,CACpCC,KAAM,IACNC,MAAO,IACPC,KAAM,IACNC,MAA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T,OAAO,GAAYA,GAGrB,MAAM,IAAIttB,MAAM,gDAEpB,EA0DF,SAAS,GAAYs7P,GACnB,OAMA,SAAenkQ,EAAOiF,EAAOsa,GAC3B,OAAO8rB,QACLw/Q,GAAmB7qT,IACjBmkQ,EAAahlQ,KACX+H,KACAlH,EACiB,iBAAViF,EAAqBA,OAAQ9D,EACpCoe,QAAUpe,GAGlB,CACF,CAQA,SAAS,GAAQ8R,GACf,OAAOo4B,QACLp4B,GACqB,iBAAZA,GACP,SAAUA,GACO,YAAjBA,EAAQ/N,MACR,YAAa+N,GACc,iBAApBA,EAAQq0D,QAErB,CAMA,SAASujP,GAAmB7qT,GAC1B,OACY,OAAVA,GACiB,iBAAVA,GACP,SAAUA,GACV,YAAaA,CAEjB,CCxQO,MAAM+qT,GAAWH,IAKtB,SAAU33S,GACR,MACsB,UAApBA,EAAQq0D,SACY,WAApBr0D,EAAQq0D,SACY,UAApBr0D,EAAQq0D,SACY,WAApBr0D,EAAQq0D,SACY,QAApBr0D,EAAQq0D,SACY,SAApBr0D,EAAQq0D,SACY,WAApBr0D,EAAQq0D,SACY,YAApBr0D,EAAQq0D,SACY,QAApBr0D,EAAQq0D,SACY,UAApBr0D,EAAQq0D,OAEZ,IC9BWwvF,GAAS,CACpB,UACA,UACA,QACA,aACA,OACA,KACA,UACA,SACA,MACA,WACA,KACA,SACA,MACA,MACA,KACA,KACA,aACA,SACA,SACA,OACA,KACA,KACA,KACA,KACA,KACA,KACA,OACA,SACA,SACA,KACA,OACA,SACA,KACA,KACA,UACA,OACA,OACA,MACA,KACA,WACA,SACA,IACA,YACA,MACA,UACA,UACA,QACA,QACA,KACA,KACA,QACA,KACA,KACA,QACA,KACA,KACA,MACA,OC3DW,GAAU,CAErB,SACA,QACA,SACA,YCLWk0J,GAAY,CACvB,OACA,OACA,WACA,SACA,WACA,OACA,OACA,OACA,UACA,WACA,QACA,KACA,SACA,SACA,QACA,WACA,QACA,SCiCI,GAAe,CAAC,EAChBC,GAAgB,G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8nC,cAAc,IAAIsoS,EAAS1jU,MAIrD,GAHA0oB,EAAOmyD,MAAMvnF,SAASgJ,GAAG,eAAe,KACpC2oT,EAAS1zT,MAAQm3B,EAAO0/C,SAAS,IAEjC1/C,EAAOy1F,QAAQrjH,IAAI,aAAc,CACjC,MAAMspU,EAAkB17S,EAAOy1F,QAAQprH,IAAI,aACrCsxU,EAAmB7/T,EAAQ42B,cAAc,IAAIuoS,gBACnDU,EAAiBvvT,UAAY,GAC7BuvT,EAAiBj+T,YAAYg+T,EAAgB9C,mBACjD,CACApvM,GAAQwxM,EAAS1jU,IAAM0oB,EACnBrrB,GAAUqmU,EAAS1jU,KACf3C,GAAUqmU,EAAS1jU,IAAI0oB,EAC3B,IACLkuG,OAAMt7H,IACLE,QAAQF,MAAM,EAAQ,IAE1BooU,EAASz9T,aAAa,iBAAkB,IAAI,IAEhD5S,OAAO6+H,QAAUA,EACrB,CAqCA5+H,SAASkK,iBAAiB,oBAAoB,KAC1C+lU,KAEsB,iBAAXe,QAAuBA,OAAOC,QACrCD,OAAOC,OAAOjxU,UAAUgJ,GAAG,iBAAiB,KAAOinU,IAAe,IAGtE,MAAMx4P,EAAW,IAAI70C,kBAAkB8vC,IACJA,EA/B9B0B,SAAQ,EAAGvB,gBAAiB11E,MAAM8S,KAAK4iE,KACvCz/D,QAAO/G,GAA0B,IAAlBA,EAAK0K,WAgCVpL,SAAQU,IAEjB4jU,GAAc5jU,EAAK,GACnB,IAUA6kU,EAAclxU,SAASmb,KAG7Bs8D,EAAS52D,QAAQqwT,EATO,CACpBztQ,WAAW,EACXyO,SAAS,GAOiC,G","sources":["webpack://django_ckeditor_5/./node_modules/extend/index.js","webpack://django_ckeditor_5/webpack/bootstrap","webpack://django_ckeditor_5/webpack/runtime/define property getters","webpack://django_ckeditor_5/webpack/runtime/hasOwnProperty shorthand","webpack://django_ckeditor_5/webpack/runtime/make namespace object","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/global.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/env.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/fastdiff.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/diff.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/eventinfo.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/spy.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/uid.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/priorities.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/inserttopriorityarray.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/ckeditorerror.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/version.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/emittermixin.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isObject.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/observablemixin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/elementreplacer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/count.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/comparearrays.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/isiterable.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isString.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/createelement.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/getTag.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/tags.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isPrimitive.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isTypedArray.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/object/cloneDeepWith.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isElement.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/config.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/isnode.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/iswindow.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/emittermixin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/getrangefrommouseevent.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/getpositionedancestor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/istext.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/isrange.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/getborderwidths.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/rect.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/resizeobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/setdatainelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/tounit.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/indexof.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/insertat.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/iscomment.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/isvalidattributename.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/isvisible.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isFunction.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/position.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/remove.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/getvisualviewportoffset.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/scroll.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/keyboard.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/toarray.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/mergeWith.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/object/clone.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/function/noop.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/merge.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/translation-service.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/language.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/locale.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/collection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/first.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/focustracker.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/keystrokehandler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/tomap.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/objecttomap.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/splicearray.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/delay.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/parsebase64encodedobject.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/formathtml.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/unicode.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/decodelicensekey.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/componentfactory.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/viewcollection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/template.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/view.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/function/debounce.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/function/debounce.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/tooltipmanager.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/function/throttle.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/badge/badge.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/icon/iconview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/poweredby.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/project-logo.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/evaluationbadge.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/arialiveannouncer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/list/listitemview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenulistitemview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/bindings/clickoutsidehandler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/editorui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/toolbar/normalizetoolbarconfig.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/cancel.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/formheader/formheaderview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/button/buttonlabelview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/button/buttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/focuscycler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/bindings/draggableviewmixin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dialog/dialogactionsview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dialog/dialogcontentview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dialog/dialogview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/placeholder.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/typecheckable.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/node.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/text.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/textproxy.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/viewconsumable.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/matcher.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/toKey.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/toPath.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/get.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/eq.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/isKey.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/set.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/updateWith.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/stylesmap.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/tokenlist.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/element.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/containerelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/editableelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/rooteditableelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/treewalker.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/position.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/range.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/selection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/documentselection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/bubblingeventinfo.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/bubblingemittermixin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/document.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/attributeelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/emptyelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/uielement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/rawelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/documentfragment.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/downcastwriter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/filler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/renderer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/domconverter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/getancestors.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/observer.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/times.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/toInteger.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/toFinite.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/toNumber.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/keysIn.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isLength.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isBuffer.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/assignIn.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/domeventdata.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/domeventobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/keyobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/fakeselectionobserver.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isEqualWith.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isEqualWith.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/function/after.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/mutationobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/focusobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/selectionobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/compositionobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/datatransfer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/inputobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/arrowkeysobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/tabobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/view.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/typecheckable.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/textproxy.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/treewalker.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/position.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/range.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/mapper.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/modelconsumable.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/downcastdispatcher.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/node.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/selection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/liverange.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/text.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/documentselection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/nodelist.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/element.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/conversionhelpers.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/downcasthelpers.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/autoparagraphing.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/upcasthelpers.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/controller/editingcontroller.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/schema.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/upcastdispatcher.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/dataprocessor/basichtmlwriter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/controller/datacontroller.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/conversion/conversion.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/operation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/moveoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/insertoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/splitoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/mergeoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/markeroperation.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/predicate/isEqual.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/attributeoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/nooperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/renameoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/rootattributeoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/rootoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/operationfactory.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/transform.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/liveposition.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/batch.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/differ.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/history.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/rootelement.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/clone.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/document.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isArray.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/markercollection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/operation/detachoperation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/documentfragment.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/writer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/selection-post-fixer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/deletecontent.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/getselectedcontent.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/insertcontent.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/modifyselection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/model.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/model/utils/insertobject.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/clickobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/mouseobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/touchobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/observer/pointerobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/upcastwriter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/styles/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/styles/background.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/styles/border.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/styles/margin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/view/styles/padding.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-engine/src/dev-utils/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-editor-classic/src/classiceditorui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/bodycollection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/editoruiview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/label/labelview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/boxed/boxededitoruiview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/panel/sticky/stickypanelview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/toolbar/toolbarseparatorview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/toolbar/toolbarlinebreakview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dropdown/dropdownpanelview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dropdown/dropdownview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/dropdown-arrow.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dropdown/button/dropdownbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/list/listseparatorview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/list/listitemgroupview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/list/listview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dropdown/button/splitbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/button/switchbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/check.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/button/listitembuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dropdown/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-left.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/bold.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/three-vertical-dots.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/toolbar/toolbarview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/import-export.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/paragraph.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/plus.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/text.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/pilcrow.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/drag-indicator.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/bindings/preventdefault.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenubuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenupanelview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenuview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenulistview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenulistitembuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/button/filedialogbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarmenulistitemfiledialogbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/menubar/menubarview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editableui/editableuiview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-editor-classic/src/classiceditoruiview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/plugin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/command.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/multicommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/commandcollection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/plugincollection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/context.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/contextplugin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/editingkeystrokehandler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-watchdog/src/watchdog.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-watchdog/src/utils/getsubnodes.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-watchdog/src/utils/areconnectedthroughproperties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-watchdog/src/editorwatchdog.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-watchdog/src/contextwatchdog.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/accessibility.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/editor/utils/editorusagedata.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/editor/editor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/crc32.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/isfeatureblockedbylicensekey.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/editor/utils/elementapimixin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/pendingactions.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-editor-classic/src/classiceditor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-utils/src/dom/getdatafromelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-core/src/editor/utils/attachtoform.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/clipboardobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/utils/viewtoplaintext.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/function/identity.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isMatchWith.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/isMatch.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/iteratee.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/matchesProperty.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/has.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/predicate/matches.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/object/cloneDeep.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/property.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/clipboardmarkersutils.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/object/mapValues.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/object/mapValues.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/clipboardpipeline.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/utils/normalizeclipboarddata.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/utils/plaintexttohtml.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/utils/changebuffer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/inserttextcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/inserttextobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/input.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/deletecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/deleteobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/delete.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/typing.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/utils/getlasttextline.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/textwatcher.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/twostepcaretmovement.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/util/toString.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/texttransformation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/utils/findattributerange.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-typing/src/utils/inlinehighlight.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-enter/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-enter/src/entercommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-enter/src/enterobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-enter/src/enter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-enter/src/shiftentercommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-enter/src/shiftenter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/highlightstack.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/drag-handle.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgettypearound/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgettypearound/widgettypearound.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/return-arrow.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/verticalnavigation.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widget.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/previous-arrow.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/next-arrow.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/panel/balloon/contextualballoon.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgettoolbarrepository.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgetresize/resizerstate.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgetresize/sizeview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgetresize/resizer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-widget/src/widgetresize.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/lineview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/dragdroptarget.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/dragdropblocktoolbar.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/dragdrop.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/pasteplaintext.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-clipboard/src/clipboard.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-select-all/src/selectallcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-select-all/src/selectallediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-select-all/src/selectallui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/select-all.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-select-all/src/selectall.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-undo/src/basecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-undo/src/undocommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-undo/src/redocommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-undo/src/undoediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/undo.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/redo.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-undo/src/undoui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-undo/src/undo.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/accessibility.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/dialog/dialog.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/accessibilityhelp/accessibilityhelpcontentview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/editorui/accessibilityhelp/accessibilityhelp.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-upload/src/filereader.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-upload/src/filerepository.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-upload/src/adapters/simpleuploadadapter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-adapter-ckfinder/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-autoformat/src/blockautoformatediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-autoformat/src/inlineautoformatediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-autoformat/src/autoformat.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/attributecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/bold/boldediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/bold/boldui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/italic/italicediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/italic.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/italic/italicui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/underline/underlineediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/underline.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/underline/underlineui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/strikethrough/strikethroughediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/strikethrough.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/strikethrough/strikethroughui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/code/codeediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/code.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/code/codeui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/subscript/subscriptediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/subscript.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/subscript/subscriptui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/superscript/superscriptediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/superscript.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/superscript/superscriptui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-block-quote/src/blockquotecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-block-quote/src/blockquoteediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-block-quote/src/blockquoteui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/quote.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paragraph/src/paragraphcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paragraph/src/insertparagraphcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paragraph/src/paragraph.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-heading/src/headingcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-heading/src/headingediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/model.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-heading/src/headingui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-heading/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/imagetextalternativecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/imagetextalternativeediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/bindings/csstransitiondisablermixin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/formrow/formrowview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/bindings/submithandler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/labeledfield/labeledfieldview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/input/inputbase.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/input/inputview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/inputtext/inputtextview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/inputnumber/inputnumberview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/labeledfield/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/ui/textalternativeformview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/ui/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative/imagetextalternativeui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/text-alternative.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagetextalternative.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/imageloadobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/insertimagecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/replaceimagesourcecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/imageediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagesizeattributes.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/imagetypecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/imageplaceholder.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/imageblockediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/collapsible/collapsibleview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/ui/imageinsertformview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/imageinsertui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/image.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageblock.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image/imageinlineediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinline.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagecaption/toggleimagecaptioncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagecaption/imagecaptionutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagecaption/imagecaptionediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/caption.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagecaption/imagecaptionui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagestyle/imagestylecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-inline.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-inline-left.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-left.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-center.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-inline-right.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-right.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagestyle/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-full-width.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagestyle/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagestyle/imagestyleediting.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/function/identity.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagestyle/imagestyleui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/utils/automaticdecorators.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/linkcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/unlinkcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/utils/manualdecorator.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/linkediting.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/string/upperFirst.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/string/upperFirst.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/unlink.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/pencil.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/link.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/ui/linkpreviewbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/ui/linkformview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/ui/linkprovideritemsview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/ui/linkpropertiesview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/ui/linkbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/linkui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/settings.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/autolink.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/utils/listwalker.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/utils/model.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listindentcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listmergecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listsplitcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listformatting/listitemboldintegration.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listformatting/listitemitalicintegration.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorgrid/colortileview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/color-tile-check.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/bindings/addkeyboardhandlingforgrid.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorgrid/colorgridview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorselector/documentcolorcollection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/color-palette.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/eraser.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorselector/colorgridsfragmentview.js","webpack://django_ckeditor_5/./node_modules/color-name/index.js","webpack://django_ckeditor_5/./node_modules/color-parse/index.js","webpack://django_ckeditor_5/./node_modules/color-convert/conversions.js","webpack://django_ckeditor_5/./node_modules/color-convert/route.js","webpack://django_ckeditor_5/./node_modules/color-convert/index.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorpicker/utils.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/utils/math.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/utils/convert.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/utils/compare.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/utils/dom.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/components/slider.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/components/hue.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/components/saturation.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/styles/color-picker.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/components/color-picker.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/styles/hue.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/styles/saturation.js","webpack://django_ckeditor_5/./node_modules/vanilla-colorful/lib/entrypoints/hex.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorpicker/colorpickerview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorselector/colorpickerfragmentview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorselector/colorselectorview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontfamily/fontfamilycommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontfamily/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontfamily/fontfamilyediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/font-family.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontfamily/fontfamilyui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontfamily.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontsize/fontsizecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontsize/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontsize/fontsizeediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/font-size.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontsize/fontsizeui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontsize.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontcolor/fontcolorcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontcolor/fontcolorediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/colorgrid/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/ui/colorui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontcolor/fontcolorui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/font-color.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontcolor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontbackgroundcolor/fontbackgroundcolorcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontbackgroundcolor/fontbackgroundcolorediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontbackgroundcolor/fontbackgroundcolorui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/font-background.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/fontbackgroundcolor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listformatting/listitemfontsizeintegration.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listformatting/listitemfontcolorintegration.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listformatting/listitemfontfamilyintegration.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listformatting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/utils/view.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/utils/postfixers.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/numbered-list.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/bulleted-list.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list/listui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/resizeimagecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/imageresizeediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/imageresizebuttons.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-size-small.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-size-medium.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-size-large.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-size-custom.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/object-size-full.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/imageresizehandles.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/utils/tryparsedimensionwithunit.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/utils/getselectedimageeditornodes.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/ui/imagecustomresizeformview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/imagecustomresizeui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/utils/getselectedimagewidthinunits.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize/utils/getselectedimagepossibleresizerange.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-alignment/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-alignment/src/alignmentcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-alignment/src/alignmentediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-right.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-center.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-justify.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-alignment/src/alignmentui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/list.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/removeinvalidtablewidth.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/replacemsfootnotes.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/normalizers/mswordnormalizer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/bookmark.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/image.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/table.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/removemsattributes.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/br.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/replacetabswithinprewithspaces.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/normalizers/googledocsnormalizer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/removeboldwrapper.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/normalizers/googlesheetsnormalizer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/removegooglesheetstag.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/removexmlns.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/removestyleblock.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/space.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/mediaembedcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/mediaregistry.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/media-placeholder.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/mediaembedediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/automediaembed.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/ui/mediaformview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/mediaembedui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/media.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/remove-format.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-remove-format/src/removeformatui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-remove-format/src/removeformatcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-remove-format/src/removeformatediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/tableproperties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/utils/common.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablewalker.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/utils/structure.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/upcasttable.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/utils/table-properties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/downcast.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/inserttablecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/insertrowcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/insertcolumncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/splitcellcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/mergecellcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/removerowcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/removecolumncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/setheaderrowcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/setheadercolumncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecolumnresize/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/mergecellscommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/selectrowcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/commands/selectcolumncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/table-layout-post-fixer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/table-cell-paragraph-post-fixer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/table-cell-refresh-handler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/table-headings-refresh-handler.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/table.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/ui/inserttableview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/table-column.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/table-row.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/table-merge-cell.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableselection.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableclipboard.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablekeyboard.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablemouse/mouseeventsobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablemouse.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/utils/ui/widget.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tablepropertycommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tablebackgroundcolorcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tablebordercolorcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tableborderstylecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tableborderwidthcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tablewidthcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tableheightcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/commands/tablealignmentcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/tablepropertiesediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/ui/colorinputview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/utils/ui/table-properties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/ui/tablepropertiesview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/utils/ui/contextualballoon.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties/tablepropertiesui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/table-properties.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/ui/tablecellpropertiesview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-top.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-middle.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/align-bottom.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/tablecellpropertiesui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/table-cell-properties.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellpropertycommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellwidth/commands/tablecellwidthcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellwidth/tablecellwidthediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellpaddingcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellheightcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellborderstylecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellbordercolorcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/commands/tablecellborderwidthcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties/tablecellpropertiesediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indentediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/indent.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/outdent.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indentui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indentblockcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indentcommandbehavior/indentusingoffset.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indentcommandbehavior/indentusingclasses.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indentblock.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-highlight/src/highlightcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-highlight/src/highlightediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-highlight/src/highlightui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/marker.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/pen.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/todolist/checktodolistcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/todolist/todocheckboxchangeobserver.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/todolist/todolistediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/todolist/todolistui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/todo-list.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/codeblockcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/indentcodeblockcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/outdentcodeblockcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/codeblockediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/code-block.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/codeblockui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/liststartcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/utils/style.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/liststylecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/listreversedcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/listpropertiesutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/utils/config.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/listpropertiesediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/ui/listpropertiesview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties/listpropertiesui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-disc.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-circle.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-square.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-decimal.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-decimal-leading-zero.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-lower-roman.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-upper-roman.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-lower-latin.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/list-style-upper-latin.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/source.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-source-editing/src/sourceediting.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/string/words.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/utils.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/string/startCase.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/_internal/normalizeForCase.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/converters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/schemadefinitions.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/dataschema.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/datafilter.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/codeblock.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/dualcontent.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/heading.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/integrationutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/image.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/mediaembed.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/script.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/table.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/style.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/list.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/horizontalline.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/integrations/customelement.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/generalhtmlsupport.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageupload/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageupload/imageuploadui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/image-upload.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageupload/imageuploadprogress.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-ui/src/notification/notification.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageupload/uploadimagecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageupload/imageuploadediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageupload.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/ui/imageinserturlview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinsert/imageinsertviaurlui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/image-url.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinsertviaurl.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecaption/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecaption/toggletablecaptioncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecaption/tablecaptionediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/converters/table-caption-post-fixer.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecaption/tablecaptionui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-word-count/src/utils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/mentioncommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/mentionediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/ui/mentionsview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/ui/domwrapperview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/ui/mentionlistitemview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/mentionui.js","webpack://django_ckeditor_5/./node_modules/bail/index.js","webpack://django_ckeditor_5/./node_modules/is-plain-obj/index.js","webpack://django_ckeditor_5/./node_modules/unist-util-stringify-position/lib/index.js","webpack://django_ckeditor_5/./node_modules/vfile-message/lib/index.js","webpack://django_ckeditor_5/./node_modules/vfile/lib/minpath.browser.js","webpack://django_ckeditor_5/./node_modules/vfile/lib/minproc.browser.js","webpack://django_ckeditor_5/./node_modules/vfile/lib/minurl.shared.js","webpack://django_ckeditor_5/./node_modules/vfile/lib/index.js","webpack://django_ckeditor_5/./node_modules/vfile/lib/minurl.browser.js","webpack://django_ckeditor_5/./node_modules/unified/lib/callable-instance.js","webpack://django_ckeditor_5/./node_modules/unified/lib/index.js","webpack://django_ckeditor_5/./node_modules/trough/lib/index.js","webpack://django_ckeditor_5/./node_modules/ccount/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-character/index.js","webpack://django_ckeditor_5/./node_modules/unist-util-is/lib/index.js","webpack://django_ckeditor_5/./node_modules/unist-util-visit-parents/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-find-and-replace/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-gfm-autolink-literal/lib/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-normalize-identifier/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-gfm-footnote/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-gfm-strikethrough/lib/index.js","webpack://django_ckeditor_5/./node_modules/markdown-table/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/blockquote.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/break.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/code.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-quote.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js","webpack://django_ckeditor_5/./node_modules/micromark-util-classify-character/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/encode-info.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/emphasis.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js","webpack://django_ckeditor_5/./node_modules/unist-util-visit/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-string/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/html.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/image.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/image-reference.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/inline-code.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/link.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/link-reference.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-bullet.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-rule.js","webpack://django_ckeditor_5/./node_modules/mdast-util-phrasing/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/strong.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-strong.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-fence.js","webpack://django_ckeditor_5/./node_modules/longest-streak/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/definition.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/heading.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/list.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/list-item.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/paragraph.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/root.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/text.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js","webpack://django_ckeditor_5/./node_modules/mdast-util-gfm-table/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-gfm-task-list-item/lib/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-chunked/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-combine-extensions/index.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js","webpack://django_ckeditor_5/./node_modules/micromark-factory-space/index.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/blank-line.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-footnote/lib/syntax.js","webpack://django_ckeditor_5/./node_modules/micromark-util-resolve-all/index.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-table/lib/edit-map.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-table/lib/infer.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-table/lib/syntax.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js","webpack://django_ckeditor_5/./node_modules/remark-gfm/lib/index.js","webpack://django_ckeditor_5/./node_modules/micromark-extension-gfm/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-gfm/lib/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-subtokenize/lib/splice-buffer.js","webpack://django_ckeditor_5/./node_modules/micromark-util-subtokenize/index.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/initialize/content.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/initialize/document.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/content.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/initialize/flow.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/initialize/text.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/thematic-break.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/list.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/block-quote.js","webpack://django_ckeditor_5/./node_modules/micromark-factory-destination/index.js","webpack://django_ckeditor_5/./node_modules/micromark-factory-label/index.js","webpack://django_ckeditor_5/./node_modules/micromark-factory-title/index.js","webpack://django_ckeditor_5/./node_modules/micromark-factory-whitespace/index.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/definition.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/code-indented.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/heading-atx.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/setext-underline.js","webpack://django_ckeditor_5/./node_modules/micromark-util-html-tag-name/index.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/html-flow.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/code-fenced.js","webpack://django_ckeditor_5/./node_modules/decode-named-character-reference/index.dom.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/character-reference.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/character-escape.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/line-ending.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/label-end.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/label-start-image.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/attention.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/autolink.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/html-text.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/label-start-link.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/hard-break-escape.js","webpack://django_ckeditor_5/./node_modules/micromark-core-commonmark/lib/code-text.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/constructs.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/create-tokenizer.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/preprocess.js","webpack://django_ckeditor_5/./node_modules/micromark-util-decode-numeric-character-reference/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-decode-string/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-from-markdown/lib/index.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/postprocess.js","webpack://django_ckeditor_5/./node_modules/micromark/lib/parse.js","webpack://django_ckeditor_5/./node_modules/remark-parse/lib/index.js","webpack://django_ckeditor_5/./node_modules/@ungap/structured-clone/esm/types.js","webpack://django_ckeditor_5/./node_modules/@ungap/structured-clone/esm/deserialize.js","webpack://django_ckeditor_5/./node_modules/@ungap/structured-clone/esm/serialize.js","webpack://django_ckeditor_5/./node_modules/@ungap/structured-clone/esm/index.js","webpack://django_ckeditor_5/./node_modules/micromark-util-sanitize-uri/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/footer.js","webpack://django_ckeditor_5/./node_modules/unist-util-position/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/revert.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/list-item.js","webpack://django_ckeditor_5/./node_modules/trim-lines/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/blockquote.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/break.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/code.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/delete.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/emphasis.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/heading.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/html.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/image-reference.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/image.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/inline-code.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/link-reference.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/link.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/list.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/paragraph.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/root.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/strong.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/table.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/table-cell.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/table-row.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/text.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/state.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-hast/lib/index.js","webpack://django_ckeditor_5/./node_modules/remark-rehype/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-newline-to-break/lib/index.js","webpack://django_ckeditor_5/./node_modules/remark-breaks/lib/index.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/schema.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/merge.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/normalize.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/info.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/types.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/defined-info.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/create.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/aria.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/case-sensitive-transform.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/util/case-insensitive-transform.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/html.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/svg.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/xlink.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/xmlns.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/xml.js","webpack://django_ckeditor_5/./node_modules/property-information/index.js","webpack://django_ckeditor_5/./node_modules/property-information/lib/find.js","webpack://django_ckeditor_5/./node_modules/web-namespaces/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-dom/lib/index.js","webpack://django_ckeditor_5/./node_modules/rehype-dom-stringify/lib/index.js","webpack://django_ckeditor_5/./node_modules/html-void-elements/index.js","webpack://django_ckeditor_5/./node_modules/zwitch/index.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/core.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/util/to-hexadecimal.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/util/to-decimal.js","webpack://django_ckeditor_5/./node_modules/character-entities-legacy/index.js","webpack://django_ckeditor_5/./node_modules/character-entities-html4/index.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/constant/dangerous.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/util/to-named.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/util/format-smart.js","webpack://django_ckeditor_5/./node_modules/stringify-entities/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/comment.js","webpack://django_ckeditor_5/./node_modules/comma-separated-tokens/index.js","webpack://django_ckeditor_5/./node_modules/space-separated-tokens/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-whitespace/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/omission/util/siblings.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/omission/omission.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/omission/closing.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/omission/opening.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/element.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/text.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/doctype.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/raw.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/handle/root.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-html/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-parse-selector/lib/index.js","webpack://django_ckeditor_5/./node_modules/hastscript/lib/create-h.js","webpack://django_ckeditor_5/./node_modules/hastscript/lib/svg-case-sensitive-tag-names.js","webpack://django_ckeditor_5/./node_modules/hastscript/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-from-dom/lib/index.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-markdown-gfm/src/markdown2html/markdown2html.js","webpack://django_ckeditor_5/./node_modules/rehype-dom-parse/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-is-element/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-embedded/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-minify-whitespace/lib/block.js","webpack://django_ckeditor_5/./node_modules/hast-util-minify-whitespace/lib/content.js","webpack://django_ckeditor_5/./node_modules/hast-util-minify-whitespace/lib/skippable.js","webpack://django_ckeditor_5/./node_modules/hast-util-minify-whitespace/lib/index.js","webpack://django_ckeditor_5/./node_modules/rehype-minify-whitespace/lib/index.js","webpack://django_ckeditor_5/./node_modules/unist-util-find-after/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-text/lib/index.js","webpack://django_ckeditor_5/./node_modules/trim-trailing-lines/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/code.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/del.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/util/list-items-spread.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/dl.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/em.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/util/drop-surrounding-breaks.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/heading.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/img.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/inline-code.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/util/find-selected-options.js","webpack://django_ckeditor_5/./node_modules/hast-util-has-property/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-is-body-ok-link/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-phrasing/lib/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/li.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/list.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/util/wrap.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/media.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/p.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/q.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/strong.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/table-cell.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/table-row.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/table.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/index.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/comment.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/root.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/text.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/a.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/base.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/blockquote.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/br.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/hr.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/iframe.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/input.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/select.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/textarea.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/handlers/wbr.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/state.js","webpack://django_ckeditor_5/./node_modules/hast-util-to-mdast/lib/index.js","webpack://django_ckeditor_5/./node_modules/rehype-remark/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/configure.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/join.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/unsafe.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/association.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/container-flow.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/indent-lines.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/safe.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/track.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/index.js","webpack://django_ckeditor_5/./node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js","webpack://django_ckeditor_5/./node_modules/remark-stringify/lib/index.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-markdown-gfm/src/html2markdown/html2markdown.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-markdown-gfm/src/gfmdataprocessor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-page-break/src/pagebreakcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-page-break/src/pagebreakediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-page-break/src/pagebreakui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/page-break.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/ui/stylegridbuttonview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/ui/stylegridview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/ui/stylegroupview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/ui/stylepanelview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/styleutils.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/styleui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/stylecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/integrations/list.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/integrations/table.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/integrations/link.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/styleediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-horizontal-line/src/horizontallinecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-horizontal-line/src/horizontallineediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-horizontal-line/src/horizontallineui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/horizontal-line.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/linkimageediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/linkimageui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-embed/src/htmlembedcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-embed/src/htmlembedediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-embed/src/htmlembedui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/html.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/htmlpagedataprocessor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-support/src/fullpage.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/ui/charactergridview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/ui/characterinfoview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/ui/specialcharactersview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/ui/specialcharacterscategoriesview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharacters.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharactersarrows.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharacterstext.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharactersmathematical.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharacterslatin.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharacterscurrency.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-show-blocks/src/showblockscommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-show-blocks/src/showblocksediting.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-show-blocks/src/showblocksui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/show-blocks.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/find-replace.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/ui/findandreplaceformview.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findandreplaceui.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findandreplacestate.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/replacecommandbase.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/replacecommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/replaceallcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findnextcommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findpreviouscommand.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findandreplaceutils.js","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/compat/string/escapeRegExp.mjs","webpack://django_ckeditor_5/./node_modules/es-toolkit/dist/string/escapeRegExp.mjs","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findandreplaceediting.js","webpack://django_ckeditor_5/./static/django_ckeditor_5/src/ckeditor.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-essentials/src/essentials.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-code-block/src/codeblock.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/bold.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/italic.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/underline.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/strikethrough.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/code.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/subscript.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-basic-styles/src/superscript.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-block-quote/src/blockquote.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-heading/src/heading.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/image.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagecaption.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagestyle.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imagetoolbar.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageresize.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/link.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/list.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-alignment/src/alignment.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-autosave/src/autosave.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-font/src/font.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-paste-from-office/src/filters/parse.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-media-embed/src/mediaembed.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-remove-format/src/removeformat.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/table.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tabletoolbar.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecaption.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tableproperties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-table/src/tablecellproperties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-indent/src/indent.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-highlight/src/highlight.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/todolist.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-list/src/listproperties.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-image/src/imageinsert.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-word-count/src/wordcount.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-mention/src/mention.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-markdown-gfm/src/markdown.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-page-break/src/pagebreak.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-style/src/style.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-horizontal-line/src/horizontalline.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-link/src/linkimage.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-html-embed/src/htmlembed.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-icons/theme/icons/special-characters.svg","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-special-characters/src/specialcharactersessentials.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-show-blocks/src/showblocks.js","webpack://django_ckeditor_5/./node_modules/@ckeditor/ckeditor5-find-and-replace/src/findandreplace.js","webpack://django_ckeditor_5/./static/django_ckeditor_5/app.js"],"sourcesContent":["'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * A helper (module) giving an access to the global DOM objects such as `window` and\n * `document`. Accessing these objects using this helper allows easy and bulletproof\n * testing, i.e. stubbing native properties:\n *\n * ```ts\n * import { global } from 'ckeditor5/utils';\n *\n * // This stub will work for any code using global module.\n * testUtils.sinon.stub( global, 'window', {\n * \tinnerWidth: 10000\n * } );\n *\n * console.log( global.window.innerWidth );\n * ```\n */\nlet globalVar; // named globalVar instead of global: https://github.com/ckeditor/ckeditor5/issues/12971\n// In some environments window and document API might not be available.\ntry {\n    globalVar = { window, document };\n}\ncatch {\n    // It's not possible to mock a window object to simulate lack of a window object without writing extremely convoluted code.\n    /* istanbul ignore next -- @preserve */\n    // Let's cast it to not change module's API.\n    // We only handle this so loading editor in environments without window and document doesn't fail.\n    // For better DX we shouldn't introduce mixed types and require developers to check the type manually.\n    // This module should not be used on purpose in any environment outside browser.\n    globalVar = { window: {}, document: {} };\n}\nexport { globalVar as global };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/env\n */\nimport { global } from './dom/global.js';\n/**\n * Safely returns `userAgent` from browser's navigator API in a lower case.\n * If navigator API is not available it will return an empty string.\n *\n * @internal\n */\nexport function getUserAgent() {\n    // In some environments navigator API might not be available.\n    try {\n        return navigator.userAgent.toLowerCase();\n    }\n    catch {\n        return '';\n    }\n}\nconst userAgent = /* #__PURE__ */ getUserAgent();\n/**\n * A namespace containing environment and browser information.\n */\nexport const env = {\n    isMac: /* #__PURE__ */ isMac(userAgent),\n    isWindows: /* #__PURE__ */ isWindows(userAgent),\n    isGecko: /* #__PURE__ */ isGecko(userAgent),\n    isSafari: /* #__PURE__ */ isSafari(userAgent),\n    isiOS: /* #__PURE__ */ isiOS(userAgent),\n    isAndroid: /* #__PURE__ */ isAndroid(userAgent),\n    isBlink: /* #__PURE__ */ isBlink(userAgent),\n    get isMediaForcedColors() {\n        return isMediaForcedColors();\n    },\n    get isMotionReduced() {\n        return isMotionReduced();\n    },\n    features: {\n        isRegExpUnicodePropertySupported: /* #__PURE__ */ isRegExpUnicodePropertySupported()\n    }\n};\n/**\n * Checks if User Agent represented by the string is running on Macintosh.\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is running on Macintosh or not.\n */\nexport function isMac(userAgent) {\n    return userAgent.indexOf('macintosh') > -1;\n}\n/**\n * Checks if User Agent represented by the string is running on Windows.\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is running on Windows or not.\n */\nexport function isWindows(userAgent) {\n    return userAgent.indexOf('windows') > -1;\n}\n/**\n * Checks if User Agent represented by the string is Firefox (Gecko).\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is Firefox or not.\n */\nexport function isGecko(userAgent) {\n    return !!userAgent.match(/gecko\\/\\d+/);\n}\n/**\n * Checks if User Agent represented by the string is Safari.\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is Safari or not.\n */\nexport function isSafari(userAgent) {\n    return userAgent.indexOf(' applewebkit/') > -1 && userAgent.indexOf('chrome') === -1;\n}\n/**\n * Checks if User Agent represented by the string is running in iOS.\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is running in iOS or not.\n */\nexport function isiOS(userAgent) {\n    // \"Request mobile site\" || \"Request desktop site\".\n    return !!userAgent.match(/iphone|ipad/i) || (isMac(userAgent) && navigator.maxTouchPoints > 0);\n}\n/**\n * Checks if User Agent represented by the string is Android mobile device.\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is Safari or not.\n */\nexport function isAndroid(userAgent) {\n    return userAgent.indexOf('android') > -1;\n}\n/**\n * Checks if User Agent represented by the string is Blink engine.\n *\n * @internal\n * @param userAgent **Lowercase** `navigator.userAgent` string.\n * @returns Whether User Agent is Blink engine or not.\n */\nexport function isBlink(userAgent) {\n    // The Edge browser before switching to the Blink engine used to report itself as Chrome (and \"Edge/\")\n    // but after switching to the Blink it replaced \"Edge/\" with \"Edg/\".\n    return userAgent.indexOf('chrome/') > -1 && userAgent.indexOf('edge/') < 0;\n}\n/**\n * Checks if the current environment supports ES2018 Unicode properties like `\\p{P}` or `\\p{L}`.\n * More information about unicode properties might be found\n * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).\n *\n * @internal\n */\nexport function isRegExpUnicodePropertySupported() {\n    let isSupported = false;\n    // Feature detection for Unicode properties. Added in ES2018. Currently Firefox does not support it.\n    // See https://github.com/ckeditor/ckeditor5-mention/issues/44#issuecomment-487002174.\n    try {\n        // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n        isSupported = 'ć'.search(new RegExp('[\\\\p{L}]', 'u')) === 0;\n    }\n    catch {\n        // Firefox throws a SyntaxError when the group is unsupported.\n    }\n    return isSupported;\n}\n/**\n * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).\n *\n * Returns `false` in environments where `window` global object is not available.\n *\n * @internal\n */\nexport function isMediaForcedColors() {\n    return global.window.matchMedia ? global.window.matchMedia('(forced-colors: active)').matches : false;\n}\n/**\n * Checks if the user enabled \"prefers reduced motion\" setting in browser.\n *\n * Returns `false` in environments where `window` global object is not available.\n *\n * @internal\n */\nexport function isMotionReduced() {\n    return global.window.matchMedia ? global.window.matchMedia('(prefers-reduced-motion)').matches : false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/fastdiff\n */\n/**\n * Finds positions of the first and last change in the given string/array and generates a set of changes:\n *\n * ```ts\n * fastDiff( '12a', '12xyza' );\n * // [ { index: 2, type: 'insert', values: [ 'x', 'y', 'z' ] } ]\n *\n * fastDiff( '12a', '12aa' );\n * // [ { index: 3, type: 'insert', values: [ 'a' ] } ]\n *\n * fastDiff( '12xyza', '12a' );\n * // [ { index: 2, type: 'delete', howMany: 3 } ]\n *\n * fastDiff( [ '1', '2', 'a', 'a' ], [ '1', '2', 'a' ] );\n * // [ { index: 3, type: 'delete', howMany: 1 } ]\n *\n * fastDiff( [ '1', '2', 'a', 'b', 'c', '3' ], [ '2', 'a', 'b' ] );\n * // [ { index: 0, type: 'insert', values: [ '2', 'a', 'b' ] }, { index: 3, type: 'delete', howMany: 6 } ]\n * ```\n *\n * Passed arrays can contain any type of data, however to compare them correctly custom comparator function\n * should be passed as a third parameter:\n *\n * ```ts\n * fastDiff( [ { value: 1 }, { value: 2 } ], [ { value: 1 }, { value: 3 } ], ( a, b ) => {\n * \treturn a.value === b.value;\n * } );\n * // [ { index: 1, type: 'insert', values: [ { value: 3 } ] }, { index: 2, type: 'delete', howMany: 1 } ]\n * ```\n *\n * The resulted set of changes can be applied to the input in order to transform it into the output, for example:\n *\n * ```ts\n * let input = '12abc3';\n * const output = '2ab';\n * const changes = fastDiff( input, output );\n *\n * changes.forEach( change => {\n * \tif ( change.type == 'insert' ) {\n * \t\tinput = input.substring( 0, change.index ) + change.values.join( '' ) + input.substring( change.index );\n * \t} else if ( change.type == 'delete' ) {\n * \t\tinput = input.substring( 0, change.index ) + input.substring( change.index + change.howMany );\n * \t}\n * } );\n *\n * // input equals output now\n * ```\n *\n * or in case of arrays:\n *\n * ```ts\n * let input = [ '1', '2', 'a', 'b', 'c', '3' ];\n * const output = [ '2', 'a', 'b' ];\n * const changes = fastDiff( input, output );\n *\n * changes.forEach( change => {\n * \tif ( change.type == 'insert' ) {\n * \t\tinput = input.slice( 0, change.index ).concat( change.values, input.slice( change.index ) );\n * \t} else if ( change.type == 'delete' ) {\n * \t\tinput = input.slice( 0, change.index ).concat( input.slice( change.index + change.howMany ) );\n * \t}\n * } );\n *\n * // input equals output now\n * ```\n *\n * By passing `true` as the fourth parameter (`atomicChanges`) the output of this function will become compatible with\n * the {@link module:utils/diff~diff `diff()`} function:\n *\n * ```ts\n * fastDiff( '12a', '12xyza', undefined, true );\n * // [ 'equal', 'equal', 'insert', 'insert', 'insert', 'equal' ]\n * ```\n *\n * The default output format of this function is compatible with the output format of\n * {@link module:utils/difftochanges~diffToChanges `diffToChanges()`}. The `diffToChanges()` input format is, in turn,\n * compatible with the output of {@link module:utils/diff~diff `diff()`}:\n *\n * ```ts\n * const a = '1234';\n * const b = '12xyz34';\n *\n * // Both calls will return the same results (grouped changes format).\n * fastDiff( a, b );\n * diffToChanges( diff( a, b ) );\n *\n * // Again, both calls will return the same results (atomic changes format).\n * fastDiff( a, b, undefined, true );\n * diff( a, b );\n * ```\n *\n * @typeParam T The type of array elements.\n * @typeParam AtomicChanges The type of `atomicChanges` parameter (selects the result type).\n * @param a Input array or string.\n * @param b Input array or string.\n * @param cmp Optional function used to compare array values, by default `===` (strict equal operator) is used.\n * @param atomicChanges Whether an array of `inset|delete|equal` operations should\n * be returned instead of changes set. This makes this function compatible with {@link module:utils/diff~diff `diff()`}.\n * Defaults to `false`.\n * @returns Array of changes. The elements are either {@link module:utils/diff~DiffResult} or {@link module:utils/difftochanges~Change},\n * depending on `atomicChanges` parameter.\n */\nexport function fastDiff(a, b, cmp, atomicChanges) {\n    // Set the comparator function.\n    cmp = cmp || function (a, b) {\n        return a === b;\n    };\n    // Convert the string (or any array-like object - eg. NodeList) to an array by using the slice() method because,\n    // unlike Array.from(), it returns array of UTF-16 code units instead of the code points of a string.\n    // One code point might be a surrogate pair of two code units. All text offsets are expected to be in code units.\n    // See ckeditor/ckeditor5#3147.\n    //\n    // We need to make sure here that fastDiff() works identical to diff().\n    const arrayA = Array.isArray(a) ? a : Array.prototype.slice.call(a);\n    const arrayB = Array.isArray(b) ? b : Array.prototype.slice.call(b);\n    // Find first and last change.\n    const changeIndexes = findChangeBoundaryIndexes(arrayA, arrayB, cmp);\n    // Transform into changes array.\n    const result = atomicChanges ?\n        changeIndexesToAtomicChanges(changeIndexes, arrayB.length) :\n        changeIndexesToChanges(arrayB, changeIndexes);\n    return result;\n}\n/**\n * Finds position of the first and last change in the given arrays. For example:\n *\n * ```ts\n * const indexes = findChangeBoundaryIndexes( [ '1', '2', '3', '4' ], [ '1', '3', '4', '2', '4' ] );\n * console.log( indexes ); // { firstIndex: 1, lastIndexOld: 3, lastIndexNew: 4 }\n * ```\n *\n * The above indexes means that in the first array the modified part is `1[23]4` and in the second array it is `1[342]4`.\n * Based on such indexes, array with `insert`/`delete` operations which allows transforming first value into the second one\n * can be generated.\n */\nfunction findChangeBoundaryIndexes(arr1, arr2, cmp) {\n    // Find the first difference between passed values.\n    const firstIndex = findFirstDifferenceIndex(arr1, arr2, cmp);\n    // If arrays are equal return -1 indexes object.\n    if (firstIndex === -1) {\n        return { firstIndex: -1, lastIndexOld: -1, lastIndexNew: -1 };\n    }\n    // Remove the common part of each value and reverse them to make it simpler to find the last difference between them.\n    const oldArrayReversed = cutAndReverse(arr1, firstIndex);\n    const newArrayReversed = cutAndReverse(arr2, firstIndex);\n    // Find the first difference between reversed values.\n    // It should be treated as \"how many elements from the end the last difference occurred\".\n    //\n    // For example:\n    //\n    // \t\t\t\tinitial\t->\tafter cut\t-> reversed:\n    // oldValue:\t'321ba'\t->\t'21ba'\t\t-> 'ab12'\n    // newValue:\t'31xba'\t->\t'1xba'\t\t-> 'abx1'\n    // lastIndex:\t\t\t\t\t\t\t-> 2\n    //\n    // So the last change occurred two characters from the end of the arrays.\n    const lastIndex = findFirstDifferenceIndex(oldArrayReversed, newArrayReversed, cmp);\n    // Use `lastIndex` to calculate proper offset, starting from the beginning (`lastIndex` kind of starts from the end).\n    const lastIndexOld = arr1.length - lastIndex;\n    const lastIndexNew = arr2.length - lastIndex;\n    return { firstIndex, lastIndexOld, lastIndexNew };\n}\n/**\n * Returns a first index on which given arrays differ. If both arrays are the same, -1 is returned.\n */\nfunction findFirstDifferenceIndex(arr1, arr2, cmp) {\n    for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) {\n        if (arr1[i] === undefined || arr2[i] === undefined || !cmp(arr1[i], arr2[i])) {\n            return i;\n        }\n    }\n    return -1; // Return -1 if arrays are equal.\n}\n/**\n * Returns a copy of the given array with `howMany` elements removed starting from the beginning and in reversed order.\n *\n * @param arr Array to be processed.\n * @param howMany How many elements from array beginning to remove.\n * @returns Shortened and reversed array.\n */\nfunction cutAndReverse(arr, howMany) {\n    return arr.slice(howMany).reverse();\n}\n/**\n * Generates changes array based on change indexes from `findChangeBoundaryIndexes` function. This function will\n * generate array with 0 (no changes), 1 (deletion or insertion) or 2 records (insertion and deletion).\n *\n * @param newArray New array for which change indexes were calculated.\n * @param changeIndexes Change indexes object from `findChangeBoundaryIndexes` function.\n * @returns Array of changes compatible with {@link module:utils/difftochanges~diffToChanges} format.\n */\nfunction changeIndexesToChanges(newArray, changeIndexes) {\n    const result = [];\n    const { firstIndex, lastIndexOld, lastIndexNew } = changeIndexes;\n    // Order operations as 'insert', 'delete' array to keep compatibility with {@link module:utils/difftochanges~diffToChanges}\n    // in most cases. However, 'diffToChanges' does not stick to any order so in some cases\n    // (for example replacing '12345' with 'abcd') it will generate 'delete', 'insert' order.\n    if (lastIndexNew - firstIndex > 0) {\n        result.push({\n            index: firstIndex,\n            type: 'insert',\n            values: newArray.slice(firstIndex, lastIndexNew)\n        });\n    }\n    if (lastIndexOld - firstIndex > 0) {\n        result.push({\n            index: firstIndex + (lastIndexNew - firstIndex), // Increase index of what was inserted.\n            type: 'delete',\n            howMany: lastIndexOld - firstIndex\n        });\n    }\n    return result;\n}\n/**\n * Generates array with set `equal|insert|delete` operations based on change indexes from `findChangeBoundaryIndexes` function.\n *\n * @param changeIndexes Change indexes object from `findChangeBoundaryIndexes` function.\n * @param newLength Length of the new array on which `findChangeBoundaryIndexes` calculated change indexes.\n * @returns Array of changes compatible with {@link module:utils/diff~diff} format.\n */\nfunction changeIndexesToAtomicChanges(changeIndexes, newLength) {\n    const { firstIndex, lastIndexOld, lastIndexNew } = changeIndexes;\n    // No changes.\n    if (firstIndex === -1) {\n        return Array(newLength).fill('equal');\n    }\n    let result = [];\n    if (firstIndex > 0) {\n        result = result.concat(Array(firstIndex).fill('equal'));\n    }\n    if (lastIndexNew - firstIndex > 0) {\n        result = result.concat(Array(lastIndexNew - firstIndex).fill('insert'));\n    }\n    if (lastIndexOld - firstIndex > 0) {\n        result = result.concat(Array(lastIndexOld - firstIndex).fill('delete'));\n    }\n    if (lastIndexNew < newLength) {\n        result = result.concat(Array(newLength - lastIndexNew).fill('equal'));\n    }\n    return result;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/diff\n */\nimport { fastDiff } from './fastdiff.js';\n// The following code is based on the \"O(NP) Sequence Comparison Algorithm\"\n// by Sun Wu, Udi Manber, Gene Myers, Webb Miller.\n/**\n * Calculates the difference between two arrays or strings producing an array containing a list of changes\n * necessary to transform input into output.\n *\n * ```ts\n * diff( 'aba', 'acca' ); // [ 'equal', 'insert', 'insert', 'delete', 'equal' ]\n * ```\n *\n * This function is based on the \"O(NP) Sequence Comparison Algorithm\" by Sun Wu, Udi Manber, Gene Myers, Webb Miller.\n * Unfortunately, while it gives the most precise results, its to complex for longer strings/arrow (above 200 items).\n * Therefore, `diff()` automatically switches to {@link module:utils/fastdiff~fastDiff `fastDiff()`} when detecting\n * such a scenario. The return formats of both functions are identical.\n *\n * @param a Input array or string.\n * @param b Output array or string.\n * @param cmp Optional function used to compare array values, by default === is used.\n * @returns Array of changes.\n */\nexport function diff(a, b, cmp) {\n    // Set the comparator function.\n    cmp = cmp || function (a, b) {\n        return a === b;\n    };\n    const aLength = a.length;\n    const bLength = b.length;\n    // Perform `fastDiff` for longer strings/arrays (see #269).\n    if (aLength > 200 || bLength > 200 || aLength + bLength > 300) {\n        return diff.fastDiff(a, b, cmp, true);\n    }\n    // Temporary action type statics.\n    let _insert, _delete;\n    // Swapped the arrays to use the shorter one as the first one.\n    if (bLength < aLength) {\n        const tmp = a;\n        a = b;\n        b = tmp;\n        // We swap the action types as well.\n        _insert = 'delete';\n        _delete = 'insert';\n    }\n    else {\n        _insert = 'insert';\n        _delete = 'delete';\n    }\n    const m = a.length;\n    const n = b.length;\n    const delta = n - m;\n    // Edit scripts, for each diagonal.\n    const es = {};\n    // Furthest points, the furthest y we can get on each diagonal.\n    const fp = {};\n    function snake(k) {\n        // We use -1 as an alternative below to handle initial values ( instead of filling the fp with -1 first ).\n        // Furthest points (y) on the diagonal below k.\n        const y1 = (fp[k - 1] !== undefined ? fp[k - 1] : -1) + 1;\n        // Furthest points (y) on the diagonal above k.\n        const y2 = fp[k + 1] !== undefined ? fp[k + 1] : -1;\n        // The way we should go to get further.\n        const dir = y1 > y2 ? -1 : 1;\n        // Clone previous changes array (if any).\n        if (es[k + dir]) {\n            es[k] = es[k + dir].slice(0);\n        }\n        // Create changes array.\n        if (!es[k]) {\n            es[k] = [];\n        }\n        // Push the action.\n        es[k].push(y1 > y2 ? _insert : _delete);\n        // Set the beginning coordinates.\n        let y = Math.max(y1, y2);\n        let x = y - k;\n        // Traverse the diagonal as long as the values match.\n        while (x < m && y < n && cmp(a[x], b[y])) {\n            x++;\n            y++;\n            // Push no change action.\n            es[k].push('equal');\n        }\n        return y;\n    }\n    let p = 0;\n    let k;\n    // Traverse the graph until we reach the end of the longer string.\n    do {\n        // Updates furthest points and edit scripts for diagonals below delta.\n        for (k = -p; k < delta; k++) {\n            fp[k] = snake(k);\n        }\n        // Updates furthest points and edit scripts for diagonals above delta.\n        for (k = delta + p; k > delta; k--) {\n            fp[k] = snake(k);\n        }\n        // Updates furthest point and edit script for the delta diagonal.\n        // note that the delta diagonal is the one which goes through the sink (m, n).\n        fp[delta] = snake(delta);\n        p++;\n    } while (fp[delta] !== n);\n    // Return the final list of edit changes.\n    // We remove the first item that represents the action for the injected nulls.\n    return es[delta].slice(1);\n}\n// Store the API in static property to easily overwrite it in tests.\n// Too bad dependency injection does not work in Webpack + ES 6 (const) + Babel.\ndiff.fastDiff = fastDiff;\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/eventinfo\n */\nimport { spy } from './spy.js';\n/**\n * The event object passed to event callbacks. It is used to provide information about the event as well as a tool to\n * manipulate it.\n */\nexport class EventInfo {\n    /**\n     * The object that fired the event.\n     */\n    source;\n    /**\n     * The event name.\n     */\n    name;\n    /**\n     * Path this event has followed. See {@link module:utils/emittermixin~Emitter#delegate}.\n     */\n    path;\n    /**\n     * Stops the event emitter to call further callbacks for this event interaction.\n     */\n    stop;\n    /**\n     * Removes the current callback from future interactions of this event.\n     */\n    off;\n    /**\n     * The value which will be returned by {@link module:utils/emittermixin~Emitter#fire}.\n     *\n     * It's `undefined` by default and can be changed by an event listener:\n     *\n     * ```ts\n     * dataController.fire( 'getSelectedContent', ( evt ) => {\n     * \t// This listener will make `dataController.fire( 'getSelectedContent' )`\n     * \t// always return an empty DocumentFragment.\n     * \tevt.return = new DocumentFragment();\n     *\n     * \t// Make sure no other listeners are executed.\n     * \tevt.stop();\n     * } );\n     * ```\n     */\n    return;\n    /**\n     * @param source The emitter.\n     * @param name The event name.\n     */\n    constructor(source, name) {\n        this.source = source;\n        this.name = name;\n        this.path = [];\n        // The following methods are defined in the constructor because they must be re-created per instance.\n        this.stop = spy();\n        this.off = spy();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/spy\n */\n/**\n * Creates a spy function (ala Sinon.js) that can be used to inspect call to it.\n *\n * The following are the present features:\n *\n * * spy.called: property set to `true` if the function has been called at least once.\n *\n * @returns The spy function.\n */\nexport function spy() {\n    return function spy() {\n        spy.called = true;\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/uid\n */\n/**\n * A hash table of hex numbers to avoid using toString() in uid() which is costly.\n * [ '00', '01', '02', ..., 'fe', 'ff' ]\n */\nconst HEX_NUMBERS = new Array(256).fill('')\n    .map((_, index) => ('0' + (index).toString(16)).slice(-2));\n/**\n * Returns a unique id. The id starts with an \"e\" character and a randomly generated string of\n * 32 alphanumeric characters.\n *\n * **Note**: The characters the unique id is built from correspond to the hex number notation\n * (from \"0\" to \"9\", from \"a\" to \"f\"). In other words, each id corresponds to an \"e\" followed\n * by 16 8-bit numbers next to each other.\n *\n * @returns An unique id string.\n */\nexport function uid() {\n    // Let's create some positive random 32bit integers first.\n    const [r1, r2, r3, r4] = crypto.getRandomValues(new Uint32Array(4));\n    // Make sure that id does not start with number.\n    return 'e' +\n        HEX_NUMBERS[r1 >> 0 & 0xFF] +\n        HEX_NUMBERS[r1 >> 8 & 0xFF] +\n        HEX_NUMBERS[r1 >> 16 & 0xFF] +\n        HEX_NUMBERS[r1 >> 24 & 0xFF] +\n        HEX_NUMBERS[r2 >> 0 & 0xFF] +\n        HEX_NUMBERS[r2 >> 8 & 0xFF] +\n        HEX_NUMBERS[r2 >> 16 & 0xFF] +\n        HEX_NUMBERS[r2 >> 24 & 0xFF] +\n        HEX_NUMBERS[r3 >> 0 & 0xFF] +\n        HEX_NUMBERS[r3 >> 8 & 0xFF] +\n        HEX_NUMBERS[r3 >> 16 & 0xFF] +\n        HEX_NUMBERS[r3 >> 24 & 0xFF] +\n        HEX_NUMBERS[r4 >> 0 & 0xFF] +\n        HEX_NUMBERS[r4 >> 8 & 0xFF] +\n        HEX_NUMBERS[r4 >> 16 & 0xFF] +\n        HEX_NUMBERS[r4 >> 24 & 0xFF];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Provides group of constants to use instead of hardcoding numeric priority values.\n */\nexport const priorities = {\n    get(priority = 'normal') {\n        if (typeof priority != 'number') {\n            return this[priority] || this.normal;\n        }\n        else {\n            return priority;\n        }\n    },\n    highest: 100000,\n    high: 1000,\n    normal: 0,\n    low: -1000,\n    lowest: -100000\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { priorities } from './priorities.js';\n/**\n * Inserts any object with priority at correct index by priority so registered objects are always sorted from highest to lowest priority.\n *\n * @param objects Array of objects with priority to insert object to.\n * @param objectToInsert Object with `priority` property.\n */\nexport function insertToPriorityArray(objects, objectToInsert) {\n    const priority = priorities.get(objectToInsert.priority);\n    // Binary search for better performance in large tables.\n    let left = 0;\n    let right = objects.length;\n    while (left < right) {\n        const mid = (left + right) >> 1; // Use bitwise operator for faster floor division by 2.\n        const midPriority = priorities.get(objects[mid].priority);\n        if (midPriority < priority) {\n            right = mid;\n        }\n        else {\n            left = mid + 1;\n        }\n    }\n    objects.splice(left, 0, objectToInsert);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/ckeditorerror\n */\n/**\n * URL to the documentation with error codes.\n */\nexport const DOCUMENTATION_URL = 'https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html';\n/**\n * The CKEditor error class.\n *\n * You should throw `CKEditorError` when:\n *\n * * An unexpected situation occurred and the editor (most probably) will not work properly. Such exception will be handled\n * by the {@link module:watchdog/watchdog~Watchdog watchdog} (if it is integrated),\n * * If the editor is incorrectly integrated or the editor API is used in the wrong way. This way you will give\n * feedback to the developer as soon as possible. Keep in mind that for common integration issues which should not\n * stop editor initialization (like missing upload adapter, wrong name of a toolbar component) we use\n * {@link module:utils/ckeditorerror~logWarning `logWarning()`} and\n * {@link module:utils/ckeditorerror~logError `logError()`}\n * to improve developers experience and let them see the a working editor as soon as possible.\n *\n * ```ts\n * /**\n *  * Error thrown when a plugin cannot be loaded due to JavaScript errors, lack of plugins with a given name, etc.\n *  *\n *  * @error plugin-load\n *  * @param pluginName The name of the plugin that could not be loaded.\n *  * @param moduleName The name of the module which tried to load this plugin.\n *  *\\/\n * throw new CKEditorError( 'plugin-load', {\n * \tpluginName: 'foo',\n * \tmoduleName: 'bar'\n * } );\n * ```\n */\nexport class CKEditorError extends Error {\n    /**\n     * A context of the error by which the Watchdog is able to determine which editor crashed.\n     */\n    context;\n    /**\n     * The additional error data passed to the constructor. Undefined if none was passed.\n     */\n    data;\n    /**\n     * Creates an instance of the CKEditorError class.\n     *\n     * @param errorName The error id in an `error-name` format. A link to this error documentation page will be added\n     * to the thrown error's `message`.\n     * @param context A context of the error by which the {@link module:watchdog/watchdog~Watchdog watchdog}\n     * is able to determine which editor crashed. It should be an editor instance or a property connected to it. It can be also\n     * a `null` value if the editor should not be restarted in case of the error (e.g. during the editor initialization).\n     * The error context should be checked using the `areConnectedThroughProperties( editor, context )` utility\n     * to check if the object works as the context.\n     * @param data Additional data describing the error. A stringified version of this object\n     * will be appended to the error message, so the data are quickly visible in the console. The original\n     * data object will also be later available under the {@link #data} property.\n     * @param originalError An optional original error that is being wrapped in the `CKEditorError` instance.\n     */\n    constructor(errorName, context, data, originalError) {\n        super(getErrorMessage(errorName, data, originalError));\n        this.name = 'CKEditorError';\n        this.context = context;\n        this.data = data;\n        // Wrapping an original error in a CKEditorError instance.\n        if (originalError) {\n            // Restore the original stack trace to make the error look like the original one.\n            // See https://github.com/ckeditor/ckeditor5/issues/5595 for more details.\n            this.stack = originalError.stack;\n        }\n    }\n    /**\n     * Checks if the error is of the `CKEditorError` type.\n     */\n    is(type) {\n        return type === 'CKEditorError';\n    }\n    /**\n     * A utility that ensures that the thrown error is a {@link module:utils/ckeditorerror~CKEditorError} one.\n     * It is useful when combined with the {@link module:watchdog/watchdog~Watchdog} feature, which can restart the editor in case\n     * of a {@link module:utils/ckeditorerror~CKEditorError} error.\n     *\n     * @param error The error to rethrow.\n     * @param context An object connected through properties with the editor instance. This context will be used\n     * by the watchdog to verify which editor should be restarted.\n     */\n    static rethrowUnexpectedError(error, context) {\n        if (error.is && error.is('CKEditorError')) {\n            throw error;\n        }\n        /**\n         * An unexpected error occurred inside the CKEditor 5 codebase. This error will look like the original one\n         * to make the debugging easier.\n         *\n         * This error is only useful when the editor is initialized using the {@link module:watchdog/watchdog~Watchdog} feature.\n         * In case of such error (or any {@link module:utils/ckeditorerror~CKEditorError} error) the watchdog should restart the editor.\n         *\n         * @error unexpected-error\n         */\n        throw new CKEditorError('unexpected-error', context, undefined, error);\n    }\n}\n/**\n * Logs a warning to the console with a properly formatted message and adds a link to the documentation.\n * Use whenever you want to log a warning to the console.\n *\n * ```ts\n * /**\n *  * There was a problem processing the configuration of the toolbar. The item with the given\n *  * name does not exist, so it was omitted when rendering the toolbar.\n *  *\n *  * @error toolbarview-item-unavailable\n *  * @param {String} name The name of the component.\n *  *\\/\n * logWarning( 'toolbarview-item-unavailable', { name } );\n * ```\n *\n * See also {@link module:utils/ckeditorerror~CKEditorError} for an explanation when to throw an error and when to log\n * a warning or an error to the console.\n *\n * @param errorName The error name to be logged.\n * @param data Additional data to be logged.\n */\nexport function logWarning(errorName, data) {\n    console.warn(...formatConsoleArguments(errorName, data));\n}\n/**\n * Logs an error to the console with a properly formatted message and adds a link to the documentation.\n * Use whenever you want to log an error to the console.\n *\n * ```ts\n * /**\n *  * There was a problem processing the configuration of the toolbar. The item with the given\n *  * name does not exist, so it was omitted when rendering the toolbar.\n *  *\n *  * @error toolbarview-item-unavailable\n *  * @param {String} name The name of the component.\n *  *\\/\n *  logError( 'toolbarview-item-unavailable', { name } );\n * ```\n *\n * **Note**: In most cases logging a warning using {@link module:utils/ckeditorerror~logWarning} is enough.\n *\n * See also {@link module:utils/ckeditorerror~CKEditorError} for an explanation when to use each method.\n *\n * @param errorName The error name to be logged.\n * @param data Additional data to be logged.\n */\nexport function logError(errorName, data) {\n    console.error(...formatConsoleArguments(errorName, data));\n}\n/**\n * Returns formatted link to documentation message.\n */\nfunction getLinkToDocumentationMessage(errorName) {\n    return `\\nRead more: ${DOCUMENTATION_URL}#error-${errorName}`;\n}\n/**\n * Returns formatted error message.\n */\nfunction getErrorMessage(errorName, data, originalError) {\n    const processedObjects = new WeakSet();\n    const circularReferencesReplacer = (key, value) => {\n        if (typeof value === 'object' && value !== null) {\n            if (processedObjects.has(value)) {\n                return `[object ${value.constructor.name}]`;\n            }\n            processedObjects.add(value);\n        }\n        return value;\n    };\n    const stringifiedData = data ? ` ${JSON.stringify(data, circularReferencesReplacer)}` : '';\n    const documentationLink = getLinkToDocumentationMessage(errorName);\n    const originalErrorMessage = originalError ? `\\nOriginal error: ${originalError.name}: ${originalError.message}` : '';\n    return errorName + stringifiedData + documentationLink + originalErrorMessage;\n}\n/**\n * Returns formatted console error arguments.\n */\nfunction formatConsoleArguments(errorName, data) {\n    const documentationMessage = getLinkToDocumentationMessage(errorName);\n    return data ? [errorName, data, documentationMessage] : [errorName, documentationMessage];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/version\n */\nimport { CKEditorError } from './ckeditorerror.js';\nexport const version = '47.3.0';\n// The second argument is not a month. It is `monthIndex` and starts from `0`.\nexport const releaseDate = new Date(2025, 11, 3);\n/* istanbul ignore next -- @preserve */\nif (globalThis.CKEDITOR_VERSION) {\n    /**\n     * This error is thrown when, due to a mistake in the way CKEditor&nbsp;5 was installed,\n     * imported, or initialized, some of its modules were evaluated and executed twice.\n     * Duplicate modules inevitably lead to runtime errors and increased bundle size.\n     *\n     * # Check dependency versions\n     *\n     * First, make sure that you use the latest version of all CKEditor&nbsp;5 dependencies.\n     * Depending on the installation method, you should check the versions of the `ckeditor5`,\n     * `ckeditor5-premium-features`, or `@ckeditor/ckeditor5-<NAME>` packages. If you cannot update\n     * to the latest version, ensure that all the CKEditor&nbsp;5 packages are\n     * in the same version.\n     *\n     * If you use third-party plugins, make sure to update them, too. If they are incompatible\n     * with the version of CKEditor&nbsp;5 you use, you may need to downgrade the CKEditor&nbsp;5 packages\n     * (which we do not recommend). Ask the plugin's author to upgrade the dependencies,\n     * or fork their project and update it yourself.\n     *\n     * # Check imports\n     *\n     * The next step is to look at how you import CKEditor&nbsp;5 into your project.\n     *\n     * **The {@glink updating/nim-migration/migration-to-new-installation-methods new installation methods}\n     * are designed to prevent module duplication, so if you are not using them yet, you should consider\n     * updating your project**. However, several legacy installation methods are still supported for backward\n     * compatibility, and mixing them may result in module duplication.\n     *\n     * These are the most common import methods of the CKEditor&nbsp;5 packages.\n     *\n     * - **New installation methods (NIM)** &ndash; Imports from the `ckeditor5` and `ckeditor5-premium-features` packages.\n     * - **Optimized build** for the new installation methods &ndash; Imports from the `@ckeditor/ckeditor5-<NAME>/dist/index.js`.\n     * - **Predefined builds** (no longer supported) &ndash; Imports from the `@ckeditor/ckeditor5-build-<NAME>` packages.\n     * - **Default imports** (legacy) &ndash; Imports from the `@ckeditor/ckeditor5-<NAME>` packages (default export).\n     * - **`src`** (legacy) &ndash; Imports from the `@ckeditor/ckeditor5-<NAME>/src/*`.\n     * - **DLL builds** (legacy) &ndash; Imports from the `ckeditor5/build/<NAME>` and `@ckeditor/ckeditor5-<NAME>/build/*`.\n     *\n     * The best way to avoid duplicate modules is to avoid mixing these installation methods. For example, if you use imports\n     * specific to the optimized build, you should use them for all CKEditor&nbsp;5 packages. In addition, since\n     * the DLL builds already include the core of the editor, they cannot be used with other types of imports.\n     *\n     * Here is a matrix showing which installation methods are compatible with each other:\n     *\n     * |                  | NIM | Optimized build | Predefined builds | Default imports | `src` | DLL builds |\n     * |------------------|-----|-----------------|-------------------|-----------------|-------|------------|\n     * | NIM              | ✅  | ✅              | ❌                | ❌              | ❌    | ❌         |\n     * | Optimized builds | ✅  | ✅              | ❌                | ❌              | ❌    | ❌         |\n     * | Predefined build | ❌  | ❌              | ✅                | ❌              | ❌    | ❌         |\n     * | Default imports  | ❌  | ❌              | ❌                | ✅              | ✅    | ❌         |\n     * | `src`            | ❌  | ❌              | ❌                | ✅              | ✅    | ❌         |\n     * | DLL builds       | ❌  | ❌              | ❌                | ❌              | ❌    | ✅         |\n     *\n     * If you use any third-party plugins, make sure the way you import them is compatible with\n     * the way you import CKEditor&nbsp;5.\n     *\n     * <details>\n     * <summary>New installation methods and optimized builds</summary>\n     *\n     * If you use the {@glink updating/nim-migration/migration-to-new-installation-methods new installation methods},\n     * you should only import { code } from the `ckeditor5` and `ckeditor5-premium-features` packages.\n     * Do not import { code } from the `@ckeditor/ckeditor5-<NAME>` packages unless you follow\n     * the {@glink getting-started/setup/optimizing-build-size Optimizing build size} guide and the imports from\n     * the `@ckeditor/ckeditor5-<NAME>` packages end with `/dist/index.js`.\n     *\n     * If you use a CDN, ensure that some files are not included twice in your project.\n     *\n     * Examples of valid and invalid import paths:\n     *\n     * ```js\n     * import { ClassicEditor, Highlight } from 'ckeditor5'; // ✅\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ✅\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ❌\n     * import '@ckeditor/ckeditor5-highlight/build/highlight.js'; // ❌\n     * ```\n     * </details>\n     *\n     * <details>\n     * <summary>(Deprecated) Predefined builds</summary>\n     *\n     * **As of April, 2025 predefined build are no longer supported. Please refer to the\n     * {@glink getting-started/index Quick Start} guide\n     * to choose one of the modern installation and integration methods available**.\n     *\n     * If you use the predefined builds, you cannot import any additional plugins.\n     * These builds already include the editor's core and selected plugins and importing additional\n     * ones will cause some modules to be bundled and loaded twice.\n     *\n     * Examples of valid and invalid import paths:\n     *\n     * ```js\n     * import { ClassicEditor } from '@ckeditor/ckeditor5-build-classic'; // ✅\n     * import { Highlight } from 'ckeditor5'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight'; // ❌\n     * import '@ckeditor/ckeditor5-highlight/build/highlight'; // ❌\n     * ```\n     *\n     * If you are missing some features from the list of plugins, you should switch to the\n     * {@glink updating/nim-migration/migration-to-new-installation-methods new installation methods}\n     * which do not have this limitation.\n     * </details>\n     *\n     * <details>\n     * <summary>(Legacy) Default imports and `src` imports</summary>\n     *\n     * If you use the {@glink getting-started/legacy/installation-methods/quick-start-other legacy customized installation}\n     * method, you should only import { code from the `@ckeditor/ckeditor5-<NAME>` packages. While you can import code } from\n     * the `@ckeditor/ckeditor5-<NAME>/src/*` files, it is not recommended as it can make migration to the new installation\n     * methods more difficult.\n     *\n     * If you use this installation method, you should not import { code } from the `ckeditor5` or `ckeditor5-premium-features` packages.\n     *\n     * Examples of valid and invalid import paths:\n     *\n     * ```js\n     * import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic'; // ✅\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ✅\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ✅ (not recommended)\n     * import { Highlight } from 'ckeditor5'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ❌\n     * import '@ckeditor/ckeditor5-highlight/build/highlight'; // ❌\n     * ```\n     * </details>\n     *\n     * <details>\n     * <summary>(Legacy) DLL builds</summary>\n     *\n     * If you are using the {@glink getting-started/legacy/advanced/alternative-setups/dll-builds legacy DLL builds},\n     * you should not import any non-DLL modules.\n     *\n     * Examples of valid and invalid import paths:\n     *\n     * ```js\n     * import 'ckeditor5/build/ckeditor5-dll.js';// ✅\n     * import '@ckeditor/ckeditor5-editor-classic/build/editor-classic.js';// ✅\n     * import '@ckeditor/ckeditor5-highlight/build/highlight.js';// ✅\n     * import { Highlight } from 'ckeditor5'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ❌\n     * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ❌\n     * ```\n     * </details>\n     *\n     * # Reinstall `node_modules`\n     *\n     * Usually, npm and other package managers deduplicate all packages - for example, `ckeditor5` is only installed once\n     * in `node_modules/`. However, it is known to fail to do so occasionally.\n     *\n     * To rule out this possibility, you can try the following:\n     *\n     * 1. Remove the `node_modules` directory.\n     * 2. Remove the `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml` files (depending on the package manager used).\n     * 3. Run `npm install` to reinstall all packages.\n     * 4. Run `npm ls` to check how many times packages like `@ckeditor/ckeditor5-core` are installed.\n     * If they are installed more than once, verify which package causes that.\n     *\n     * @error ckeditor-duplicated-modules\n     */\n    throw new CKEditorError('ckeditor-duplicated-modules', null);\n}\nelse {\n    globalThis.CKEDITOR_VERSION = version;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/emittermixin\n */\nimport { EventInfo } from './eventinfo.js';\nimport { uid } from './uid.js';\nimport { priorities } from './priorities.js';\nimport { insertToPriorityArray } from './inserttopriorityarray.js';\n// To check if component is loaded more than once.\nimport './version.js';\nimport { CKEditorError } from './ckeditorerror.js';\nconst _listeningTo = Symbol('listeningTo');\nconst _emitterId = Symbol('emitterId');\nconst _delegations = Symbol('delegations');\nconst defaultEmitterClass = /* #__PURE__ */ EmitterMixin(Object);\nexport function EmitterMixin(base) {\n    if (!base) {\n        return defaultEmitterClass;\n    }\n    class Mixin extends base {\n        on(event, callback, options) {\n            this.listenTo(this, event, callback, options);\n        }\n        once(event, callback, options) {\n            let wasFired = false;\n            const onceCallback = (event, ...args) => {\n                // Ensure the callback is called only once even if the callback itself leads to re-firing the event\n                // (which would call the callback again).\n                if (!wasFired) {\n                    wasFired = true;\n                    // Go off() at the first call.\n                    event.off();\n                    // Go with the original callback.\n                    callback.call(this, event, ...args);\n                }\n            };\n            // Make a similar on() call, simply replacing the callback.\n            this.listenTo(this, event, onceCallback, options);\n        }\n        off(event, callback) {\n            this.stopListening(this, event, callback);\n        }\n        listenTo(emitter, event, callback, options = {}) {\n            let emitterInfo, eventCallbacks;\n            // _listeningTo contains a list of emitters that this object is listening to.\n            // This list has the following format:\n            //\n            // _listeningTo: {\n            //     emitterId: {\n            //         emitter: emitter,\n            //         callbacks: {\n            //             event1: [ callback1, callback2, ... ]\n            //             ....\n            //         }\n            //     },\n            //     ...\n            // }\n            if (!this[_listeningTo]) {\n                this[_listeningTo] = {};\n            }\n            const emitters = this[_listeningTo];\n            if (!_getEmitterId(emitter)) {\n                _setEmitterId(emitter);\n            }\n            const emitterId = _getEmitterId(emitter);\n            if (!(emitterInfo = emitters[emitterId])) {\n                emitterInfo = emitters[emitterId] = {\n                    emitter,\n                    callbacks: {}\n                };\n            }\n            if (!(eventCallbacks = emitterInfo.callbacks[event])) {\n                eventCallbacks = emitterInfo.callbacks[event] = [];\n            }\n            eventCallbacks.push(callback);\n            // Finally register the callback to the event.\n            addEventListener(this, emitter, event, callback, options);\n        }\n        stopListening(emitter, event, callback) {\n            const emitters = this[_listeningTo];\n            let emitterId = emitter && _getEmitterId(emitter);\n            const emitterInfo = (emitters && emitterId) ? emitters[emitterId] : undefined;\n            const eventCallbacks = (emitterInfo && event) ? emitterInfo.callbacks[event] : undefined;\n            // Stop if nothing has been listened.\n            if (!emitters || (emitter && !emitterInfo) || (event && !eventCallbacks)) {\n                return;\n            }\n            // All params provided. off() that single callback.\n            if (callback) {\n                removeEventListener(this, emitter, event, callback);\n                // We must remove callbacks as well in order to prevent memory leaks.\n                // See https://github.com/ckeditor/ckeditor5/pull/8480\n                const index = eventCallbacks.indexOf(callback);\n                if (index !== -1) {\n                    if (eventCallbacks.length === 1) {\n                        delete emitterInfo.callbacks[event];\n                    }\n                    else {\n                        removeEventListener(this, emitter, event, callback);\n                    }\n                }\n            }\n            // Only `emitter` and `event` provided. off() all callbacks for that event.\n            else if (eventCallbacks) {\n                while ((callback = eventCallbacks.pop())) {\n                    removeEventListener(this, emitter, event, callback);\n                }\n                delete emitterInfo.callbacks[event];\n            }\n            // Only `emitter` provided. off() all events for that emitter.\n            else if (emitterInfo) {\n                for (event in emitterInfo.callbacks) {\n                    this.stopListening(emitter, event);\n                }\n                delete emitters[emitterId];\n            }\n            // No params provided. off() all emitters.\n            else {\n                for (emitterId in emitters) {\n                    this.stopListening(emitters[emitterId].emitter);\n                }\n                delete this[_listeningTo];\n            }\n        }\n        fire(eventOrInfo, ...args) {\n            try {\n                const eventInfo = eventOrInfo instanceof EventInfo ? eventOrInfo : new EventInfo(this, eventOrInfo);\n                const event = eventInfo.name;\n                let callbacks = getCallbacksForEvent(this, event);\n                // Record that the event passed this emitter on its path.\n                eventInfo.path.push(this);\n                // Handle event listener callbacks first.\n                if (callbacks) {\n                    // Copying callbacks array is the easiest and most secure way of preventing infinite loops, when event callbacks\n                    // are added while processing other callbacks. Previous solution involved adding counters (unique ids) but\n                    // failed if callbacks were added to the queue before currently processed callback.\n                    // If this proves to be too inefficient, another method is to change `.on()` so callbacks are stored if same\n                    // event is currently processed. Then, `.fire()` at the end, would have to add all stored events.\n                    callbacks = callbacks.slice();\n                    for (let i = 0; i < callbacks.length; i++) {\n                        const fn = callbacks[i].callback;\n                        fn.call(this, eventInfo, ...args);\n                        // Remove the callback from future requests if off() has been called.\n                        if (eventInfo.off.called) {\n                            // Remove the called mark for the next calls.\n                            delete eventInfo.off.called;\n                            this._removeEventListener(event, fn);\n                        }\n                        // Do not execute next callbacks if stop() was called.\n                        if (eventInfo.stop.called) {\n                            break;\n                        }\n                    }\n                }\n                // Delegate event to other emitters if needed.\n                const delegations = this[_delegations];\n                if (delegations) {\n                    const destinations = delegations.get(event);\n                    const passAllDestinations = delegations.get('*');\n                    if (destinations) {\n                        fireDelegatedEvents(destinations, eventInfo, args);\n                    }\n                    if (passAllDestinations) {\n                        fireDelegatedEvents(passAllDestinations, eventInfo, args);\n                    }\n                }\n                return eventInfo.return;\n            }\n            catch (err) {\n                // @if CK_DEBUG // throw err;\n                /* istanbul ignore next -- @preserve */\n                CKEditorError.rethrowUnexpectedError(err, this);\n            }\n        }\n        delegate(...events) {\n            return {\n                to: (emitter, nameOrFunction) => {\n                    if (!this[_delegations]) {\n                        this[_delegations] = new Map();\n                    }\n                    // Originally there was a for..of loop which unfortunately caused an error in Babel that didn't allow\n                    // build an application. See: https://github.com/ckeditor/ckeditor5-react/issues/40.\n                    events.forEach(eventName => {\n                        const destinations = this[_delegations].get(eventName);\n                        if (!destinations) {\n                            this[_delegations].set(eventName, new Map([[emitter, nameOrFunction]]));\n                        }\n                        else {\n                            destinations.set(emitter, nameOrFunction);\n                        }\n                    });\n                }\n            };\n        }\n        stopDelegating(event, emitter) {\n            if (!this[_delegations]) {\n                return;\n            }\n            if (!event) {\n                this[_delegations].clear();\n            }\n            else if (!emitter) {\n                this[_delegations].delete(event);\n            }\n            else {\n                const destinations = this[_delegations].get(event);\n                if (destinations) {\n                    destinations.delete(emitter);\n                }\n            }\n        }\n        _addEventListener(event, callback, options) {\n            createEventNamespace(this, event);\n            const lists = getCallbacksListsForNamespace(this, event);\n            const priority = priorities.get(options.priority);\n            const callbackDefinition = {\n                callback,\n                priority\n            };\n            // Add the callback to all callbacks list.\n            for (const callbacks of lists) {\n                // Add the callback to the list in the right priority position.\n                insertToPriorityArray(callbacks, callbackDefinition);\n            }\n        }\n        _removeEventListener(event, callback) {\n            const lists = getCallbacksListsForNamespace(this, event);\n            for (const callbacks of lists) {\n                for (let i = 0; i < callbacks.length; i++) {\n                    if (callbacks[i].callback == callback) {\n                        // Remove the callback from the list (fixing the next index).\n                        callbacks.splice(i, 1);\n                        i--;\n                    }\n                }\n            }\n        }\n    }\n    return Mixin;\n}\n/**\n * Checks if `listeningEmitter` listens to an emitter with given `listenedToEmitterId` and if so, returns that emitter.\n * If not, returns `null`.\n *\n * @internal\n * @param listeningEmitter An emitter that listens.\n * @param listenedToEmitterId Unique emitter id of emitter listened to.\n */\nexport function _getEmitterListenedTo(listeningEmitter, listenedToEmitterId) {\n    const listeningTo = listeningEmitter[_listeningTo];\n    if (listeningTo && listeningTo[listenedToEmitterId]) {\n        return listeningTo[listenedToEmitterId].emitter;\n    }\n    return null;\n}\n/**\n * Sets emitter's unique id.\n *\n * **Note:** `_emitterId` can be set only once.\n *\n * @internal\n * @param emitter An emitter for which id will be set.\n * @param id Unique id to set. If not passed, random unique id will be set.\n */\nexport function _setEmitterId(emitter, id) {\n    if (!emitter[_emitterId]) {\n        emitter[_emitterId] = id || uid();\n    }\n}\n/**\n * Returns emitter's unique id.\n *\n * @internal\n * @param emitter An emitter which id will be returned.\n */\nexport function _getEmitterId(emitter) {\n    return emitter[_emitterId];\n}\n/**\n * Gets the internal `_events` property of the given object.\n * `_events` property store all lists with callbacks for registered event names.\n * If there were no events registered on the object, empty `_events` object is created.\n */\nfunction getEvents(source) {\n    if (!source._events) {\n        Object.defineProperty(source, '_events', {\n            value: {}\n        });\n    }\n    return source._events;\n}\n/**\n * Creates event node for generic-specific events relation architecture.\n */\nfunction makeEventNode() {\n    return {\n        callbacks: [],\n        childEvents: []\n    };\n}\n/**\n * Creates an architecture for generic-specific events relation.\n * If needed, creates all events for given eventName, i.e. if the first registered event\n * is foo:bar:abc, it will create foo:bar:abc, foo:bar and foo event and tie them together.\n * It also copies callbacks from more generic events to more specific events when\n * specific events are created.\n */\nfunction createEventNamespace(source, eventName) {\n    const events = getEvents(source);\n    // First, check if the event we want to add to the structure already exists.\n    if (events[eventName]) {\n        // If it exists, we don't have to do anything.\n        return;\n    }\n    // In other case, we have to create the structure for the event.\n    // Note, that we might need to create intermediate events too.\n    // I.e. if foo:bar:abc is being registered and we only have foo in the structure,\n    // we need to also register foo:bar.\n    // Currently processed event name.\n    let name = eventName;\n    // Name of the event that is a child event for currently processed event.\n    let childEventName = null;\n    // Array containing all newly created specific events.\n    const newEventNodes = [];\n    // While loop can't check for ':' index because we have to handle generic events too.\n    // In each loop, we truncate event name, going from the most specific name to the generic one.\n    // I.e. foo:bar:abc -> foo:bar -> foo.\n    while (name !== '') {\n        if (events[name]) {\n            // If the currently processed event name is already registered, we can be sure\n            // that it already has all the structure created, so we can break the loop here\n            // as no more events need to be registered.\n            break;\n        }\n        // If this event is not yet registered, create a new object for it.\n        events[name] = makeEventNode();\n        // Add it to the array with newly created events.\n        newEventNodes.push(events[name]);\n        // Add previously processed event name as a child of this event.\n        if (childEventName) {\n            events[name].childEvents.push(childEventName);\n        }\n        childEventName = name;\n        // If `.lastIndexOf()` returns -1, `.substr()` will return '' which will break the loop.\n        name = name.substr(0, name.lastIndexOf(':'));\n    }\n    if (name !== '') {\n        // If name is not empty, we found an already registered event that was a parent of the\n        // event we wanted to register.\n        // Copy that event's callbacks to newly registered events.\n        for (const node of newEventNodes) {\n            node.callbacks = events[name].callbacks.slice();\n        }\n        // Add last newly created event to the already registered event.\n        events[name].childEvents.push(childEventName);\n    }\n}\n/**\n * Gets an array containing callbacks list for a given event and it's more specific events.\n * I.e. if given event is foo:bar and there is also foo:bar:abc event registered, this will\n * return callback list of foo:bar and foo:bar:abc (but not foo).\n */\nfunction getCallbacksListsForNamespace(source, eventName) {\n    const eventNode = getEvents(source)[eventName];\n    if (!eventNode) {\n        return [];\n    }\n    let callbacksLists = [eventNode.callbacks];\n    for (let i = 0; i < eventNode.childEvents.length; i++) {\n        const childCallbacksLists = getCallbacksListsForNamespace(source, eventNode.childEvents[i]);\n        callbacksLists = callbacksLists.concat(childCallbacksLists);\n    }\n    return callbacksLists;\n}\n/**\n * Get the list of callbacks for a given event, but only if there any callbacks have been registered.\n * If there are no callbacks registered for given event, it checks if this is a specific event and looks\n * for callbacks for it's more generic version.\n */\nfunction getCallbacksForEvent(source, eventName) {\n    if (!source._events) {\n        return null;\n    }\n    let currentEventName = eventName;\n    do {\n        const event = source._events[currentEventName];\n        if (event && event.callbacks && event.callbacks.length) {\n            return event.callbacks;\n        }\n        const colonIndex = currentEventName.lastIndexOf(':');\n        currentEventName = colonIndex > -1 ? currentEventName.substring(0, colonIndex) : '';\n    } while (currentEventName);\n    return null;\n}\n/**\n * Fires delegated events for given map of destinations.\n *\n * @param destinations A map containing `[ {@link module:utils/emittermixin~Emitter}, \"event name\" ]` pair destinations.\n * @param eventInfo The original event info object.\n * @param fireArgs Arguments the original event was fired with.\n */\nfunction fireDelegatedEvents(destinations, eventInfo, fireArgs) {\n    for (let [emitter, name] of destinations) {\n        if (!name) {\n            name = eventInfo.name;\n        }\n        else if (typeof name == 'function') {\n            name = name(eventInfo.name);\n        }\n        const delegatedInfo = new EventInfo(eventInfo.source, name);\n        delegatedInfo.path = [...eventInfo.path];\n        emitter.fire(delegatedInfo, ...fireArgs);\n    }\n}\n/**\n * Helper for registering event callback on the emitter.\n */\nfunction addEventListener(listener, emitter, event, callback, options) {\n    if (emitter._addEventListener) {\n        emitter._addEventListener(event, callback, options);\n    }\n    else {\n        // Allow listening on objects that do not implement Emitter interface.\n        // This is needed in some tests that are using mocks instead of the real objects with EmitterMixin mixed.\n        (listener._addEventListener).call(emitter, event, callback, options);\n    }\n}\n/**\n * Helper for removing event callback from the emitter.\n */\nfunction removeEventListener(listener, emitter, event, callback) {\n    if (emitter._removeEventListener) {\n        emitter._removeEventListener(event, callback);\n    }\n    else {\n        // Allow listening on objects that do not implement Emitter interface.\n        // This is needed in some tests that are using mocks instead of the real objects with EmitterMixin mixed.\n        listener._removeEventListener.call(emitter, event, callback);\n    }\n}\n","function isObject(value) {\n    return value !== null && (typeof value === 'object' || typeof value === 'function');\n}\n\nexport { isObject };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/* eslint-disable @typescript-eslint/unified-signatures */\n/**\n * @module utils/observablemixin\n */\nimport { EmitterMixin } from './emittermixin.js';\nimport { CKEditorError } from './ckeditorerror.js';\nimport { isObject } from 'es-toolkit/compat';\nconst observablePropertiesSymbol = Symbol('observableProperties');\nconst boundObservablesSymbol = Symbol('boundObservables');\nconst boundPropertiesSymbol = Symbol('boundProperties');\nconst decoratedMethods = Symbol('decoratedMethods');\nconst decoratedOriginal = Symbol('decoratedOriginal');\nconst defaultObservableClass = /* #__PURE__ */ ObservableMixin(/* #__PURE__ */ EmitterMixin());\nexport function ObservableMixin(base) {\n    if (!base) {\n        return defaultObservableClass;\n    }\n    class Mixin extends base {\n        set(name, value) {\n            // If the first parameter is an Object, iterate over its properties.\n            if (isObject(name)) {\n                Object.keys(name).forEach(property => {\n                    this.set(property, name[property]);\n                }, this);\n                return;\n            }\n            initObservable(this);\n            const properties = this[observablePropertiesSymbol];\n            if ((name in this) && !properties.has(name)) {\n                /**\n                 * Cannot override an existing property.\n                 *\n                 * This error is thrown when trying to {@link module:utils/observablemixin~Observable#set set} a property with\n                 * a name of an already existing property. For example:\n                 *\n                 * ```ts\n                 * let observable = new Model();\n                 * observable.property = 1;\n                 * observable.set( 'property', 2 );\t\t\t// throws\n                 *\n                 * observable.set( 'property', 1 );\n                 * observable.set( 'property', 2 );\t\t\t// ok, because this is an existing property.\n                 * ```\n                 *\n                 * @error observable-set-cannot-override\n                 */\n                throw new CKEditorError('observable-set-cannot-override', this);\n            }\n            Object.defineProperty(this, name, {\n                enumerable: true,\n                configurable: true,\n                get() {\n                    return properties.get(name);\n                },\n                set(value) {\n                    const oldValue = properties.get(name);\n                    // Fire `set` event before the new value will be set to make it possible\n                    // to override observable property without affecting `change` event.\n                    // See https://github.com/ckeditor/ckeditor5-utils/issues/171.\n                    let newValue = this.fire(`set:${name}`, name, value, oldValue);\n                    if (newValue === undefined) {\n                        newValue = value;\n                    }\n                    // Allow undefined as an initial value like A.define( 'x', undefined ) (#132).\n                    // Note: When properties map has no such own property, then its value is undefined.\n                    if (oldValue !== newValue || !properties.has(name)) {\n                        properties.set(name, newValue);\n                        this.fire(`change:${name}`, name, newValue, oldValue);\n                    }\n                }\n            });\n            this[name] = value;\n        }\n        bind(...bindProperties) {\n            if (!bindProperties.length || !isStringArray(bindProperties)) {\n                /**\n                 * All properties must be strings.\n                 *\n                 * @error observable-bind-wrong-properties\n                 */\n                throw new CKEditorError('observable-bind-wrong-properties', this);\n            }\n            if ((new Set(bindProperties)).size !== bindProperties.length) {\n                /**\n                 * Properties must be unique.\n                 *\n                 * @error observable-bind-duplicate-properties\n                 */\n                throw new CKEditorError('observable-bind-duplicate-properties', this);\n            }\n            initObservable(this);\n            const boundProperties = this[boundPropertiesSymbol];\n            bindProperties.forEach(propertyName => {\n                if (boundProperties.has(propertyName)) {\n                    /**\n                     * Cannot bind the same property more than once.\n                     *\n                     * @error observable-bind-rebind\n                     */\n                    throw new CKEditorError('observable-bind-rebind', this);\n                }\n            });\n            const bindings = new Map();\n            bindProperties.forEach(a => {\n                const binding = { property: a, to: [] };\n                boundProperties.set(a, binding);\n                bindings.set(a, binding);\n            });\n            return {\n                to: bindTo,\n                toMany: bindToMany,\n                _observable: this,\n                _bindProperties: bindProperties,\n                _to: [],\n                _bindings: bindings\n            };\n        }\n        unbind(...unbindProperties) {\n            // Nothing to do here if not inited yet.\n            if (!(this[observablePropertiesSymbol])) {\n                return;\n            }\n            const boundProperties = this[boundPropertiesSymbol];\n            const boundObservables = this[boundObservablesSymbol];\n            if (unbindProperties.length) {\n                if (!isStringArray(unbindProperties)) {\n                    /**\n                     * Properties must be strings.\n                     *\n                     * @error observable-unbind-wrong-properties\n                     */\n                    throw new CKEditorError('observable-unbind-wrong-properties', this);\n                }\n                unbindProperties.forEach(propertyName => {\n                    const binding = boundProperties.get(propertyName);\n                    // Nothing to do if the binding is not defined\n                    if (!binding) {\n                        return;\n                    }\n                    binding.to.forEach(([toObservable, toProperty]) => {\n                        const toProperties = boundObservables.get(toObservable);\n                        const toPropertyBindings = toProperties[toProperty];\n                        toPropertyBindings.delete(binding);\n                        if (!toPropertyBindings.size) {\n                            delete toProperties[toProperty];\n                        }\n                        if (!Object.keys(toProperties).length) {\n                            boundObservables.delete(toObservable);\n                            this.stopListening(toObservable, 'change');\n                        }\n                    });\n                    boundProperties.delete(propertyName);\n                });\n            }\n            else {\n                boundObservables.forEach((bindings, boundObservable) => {\n                    this.stopListening(boundObservable, 'change');\n                });\n                boundObservables.clear();\n                boundProperties.clear();\n            }\n        }\n        decorate(methodName) {\n            initObservable(this);\n            const originalMethod = this[methodName];\n            if (!originalMethod) {\n                /**\n                 * Cannot decorate an undefined method.\n                 *\n                 * @error observablemixin-cannot-decorate-undefined\n                 * @param {object} object The object which method should be decorated.\n                 * @param {string} methodName Name of the method which does not exist.\n                 */\n                throw new CKEditorError('observablemixin-cannot-decorate-undefined', this, { object: this, methodName });\n            }\n            this.on(methodName, (evt, args) => {\n                evt.return = originalMethod.apply(this, args);\n            });\n            this[methodName] = function (...args) {\n                return this.fire(methodName, args);\n            };\n            this[methodName][decoratedOriginal] = originalMethod;\n            if (!this[decoratedMethods]) {\n                this[decoratedMethods] = [];\n            }\n            this[decoratedMethods].push(methodName);\n        }\n        // Override the EmitterMixin stopListening method to be able to clean (and restore) decorated methods.\n        // This is needed in case of:\n        //  1. Have x.foo() decorated.\n        //  2. Call x.stopListening()\n        //  3. Call x.foo(). Problem: nothing happens (the original foo() method is not executed)\n        stopListening(emitter, event, callback) {\n            // Removing all listeners so let's clean the decorated methods to the original state.\n            if (!emitter && this[decoratedMethods]) {\n                for (const methodName of this[decoratedMethods]) {\n                    this[methodName] = this[methodName][decoratedOriginal];\n                }\n                delete this[decoratedMethods];\n            }\n            super.stopListening(emitter, event, callback);\n        }\n        [observablePropertiesSymbol];\n        [decoratedMethods];\n        [boundPropertiesSymbol];\n        [boundObservablesSymbol];\n    }\n    return Mixin;\n}\n// Init symbol properties needed for the observable mechanism to work.\nfunction initObservable(observable) {\n    // Do nothing if already inited.\n    if (observable[observablePropertiesSymbol]) {\n        return;\n    }\n    // The internal hash containing the observable's state.\n    Object.defineProperty(observable, observablePropertiesSymbol, {\n        value: new Map()\n    });\n    // Map containing bindings to external observables. It shares the binding objects\n    // (`{ observable: A, property: 'a', to: ... }`) with {@link module:utils/observablemixin~Observable#_boundProperties} and\n    // it is used to observe external observables to update own properties accordingly.\n    // See {@link module:utils/observablemixin~Observable#bind}.\n    //\n    //\t\tA.bind( 'a', 'b', 'c' ).to( B, 'x', 'y', 'x' );\n    //\t\tconsole.log( A._boundObservables );\n    //\n    //\t\t\tMap( {\n    //\t\t\t\tB: {\n    //\t\t\t\t\tx: Set( [\n    //\t\t\t\t\t\t{ observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n    //\t\t\t\t\t\t{ observable: A, property: 'c', to: [ [ B, 'x' ] ] }\n    //\t\t\t\t\t] ),\n    //\t\t\t\t\ty: Set( [\n    //\t\t\t\t\t\t{ observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n    //\t\t\t\t\t] )\n    //\t\t\t\t}\n    //\t\t\t} )\n    //\n    //\t\tA.bind( 'd' ).to( B, 'z' ).to( C, 'w' ).as( callback );\n    //\t\tconsole.log( A._boundObservables );\n    //\n    //\t\t\tMap( {\n    //\t\t\t\tB: {\n    //\t\t\t\t\tx: Set( [\n    //\t\t\t\t\t\t{ observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n    //\t\t\t\t\t\t{ observable: A, property: 'c', to: [ [ B, 'x' ] ] }\n    //\t\t\t\t\t] ),\n    //\t\t\t\t\ty: Set( [\n    //\t\t\t\t\t\t{ observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n    //\t\t\t\t\t] ),\n    //\t\t\t\t\tz: Set( [\n    //\t\t\t\t\t\t{ observable: A, property: 'd', to: [ [ B, 'z' ], [ C, 'w' ] ], callback: callback }\n    //\t\t\t\t\t] )\n    //\t\t\t\t},\n    //\t\t\t\tC: {\n    //\t\t\t\t\tw: Set( [\n    //\t\t\t\t\t\t{ observable: A, property: 'd', to: [ [ B, 'z' ], [ C, 'w' ] ], callback: callback }\n    //\t\t\t\t\t] )\n    //\t\t\t\t}\n    //\t\t\t} )\n    //\n    Object.defineProperty(observable, boundObservablesSymbol, {\n        value: new Map()\n    });\n    // Object that stores which properties of this observable are bound and how. It shares\n    // the binding objects (`{ observable: A, property: 'a', to: ... }`) with\n    // {@link module:utils/observablemixin~Observable#_boundObservables}. This data structure is\n    // a reverse of {@link module:utils/observablemixin~Observable#_boundObservables} and it is helpful for\n    // {@link module:utils/observablemixin~Observable#unbind}.\n    //\n    // See {@link module:utils/observablemixin~Observable#bind}.\n    //\n    //\t\tA.bind( 'a', 'b', 'c' ).to( B, 'x', 'y', 'x' );\n    //\t\tconsole.log( A._boundProperties );\n    //\n    //\t\t\tMap( {\n    //\t\t\t\ta: { observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n    //\t\t\t\tb: { observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n    //\t\t\t\tc: { observable: A, property: 'c', to: [ [ B, 'x' ] ] }\n    //\t\t\t} )\n    //\n    //\t\tA.bind( 'd' ).to( B, 'z' ).to( C, 'w' ).as( callback );\n    //\t\tconsole.log( A._boundProperties );\n    //\n    //\t\t\tMap( {\n    //\t\t\t\ta: { observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n    //\t\t\t\tb: { observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n    //\t\t\t\tc: { observable: A, property: 'c', to: [ [ B, 'x' ] ] },\n    //\t\t\t\td: { observable: A, property: 'd', to: [ [ B, 'z' ], [ C, 'w' ] ], callback: callback }\n    //\t\t\t} )\n    Object.defineProperty(observable, boundPropertiesSymbol, {\n        value: new Map()\n    });\n}\n/**\n * A chaining for {@link module:utils/observablemixin~Observable#bind} providing `.to()` interface.\n *\n * @param args Arguments of the `.to( args )` binding.\n */\nfunction bindTo(...args) {\n    const parsedArgs = parseBindToArgs(...args);\n    const bindingsKeys = Array.from(this._bindings.keys());\n    const numberOfBindings = bindingsKeys.length;\n    // Eliminate A.bind( 'x' ).to( B, C )\n    if (!parsedArgs.callback && parsedArgs.to.length > 1) {\n        /**\n         * Binding multiple observables only possible with callback.\n         *\n         * @error observable-bind-to-no-callback\n         */\n        throw new CKEditorError('observable-bind-to-no-callback', this);\n    }\n    // Eliminate A.bind( 'x', 'y' ).to( B, callback )\n    if (numberOfBindings > 1 && parsedArgs.callback) {\n        /**\n         * Cannot bind multiple properties and use a callback in one binding.\n         *\n         * @error observable-bind-to-extra-callback\n         */\n        throw new CKEditorError('observable-bind-to-extra-callback', this);\n    }\n    parsedArgs.to.forEach(to => {\n        // Eliminate A.bind( 'x', 'y' ).to( B, 'a' )\n        if (to.properties.length && to.properties.length !== numberOfBindings) {\n            /**\n             * The number of properties must match.\n             *\n             * @error observable-bind-to-properties-length\n             */\n            throw new CKEditorError('observable-bind-to-properties-length', this);\n        }\n        // When no to.properties specified, observing source properties instead i.e.\n        // A.bind( 'x', 'y' ).to( B ) -> Observe B.x and B.y\n        if (!to.properties.length) {\n            to.properties = this._bindProperties;\n        }\n    });\n    this._to = parsedArgs.to;\n    // Fill {@link BindChain#_bindings} with callback. When the callback is set there's only one binding.\n    if (parsedArgs.callback) {\n        this._bindings.get(bindingsKeys[0]).callback = parsedArgs.callback;\n    }\n    attachBindToListeners(this._observable, this._to);\n    // Update observable._boundProperties and observable._boundObservables.\n    updateBindToBound(this);\n    // Set initial values of bound properties.\n    this._bindProperties.forEach(propertyName => {\n        updateBoundObservableProperty(this._observable, propertyName);\n    });\n}\n/**\n * Binds to an attribute in a set of iterable observables.\n */\nfunction bindToMany(observables, attribute, callback) {\n    if (this._bindings.size > 1) {\n        /**\n         * Binding one attribute to many observables only possible with one attribute.\n         *\n         * @error observable-bind-to-many-not-one-binding\n         */\n        throw new CKEditorError('observable-bind-to-many-not-one-binding', this);\n    }\n    this.to(\n    // Bind to #attribute of each observable...\n    ...getBindingTargets(observables, attribute), \n    // ...using given callback to parse attribute values.\n    callback);\n}\n/**\n * Returns an array of binding components for\n * {@link Observable#bind} from a set of iterable observables.\n */\nfunction getBindingTargets(observables, attribute) {\n    const observableAndAttributePairs = observables.map(observable => [observable, attribute]);\n    // Merge pairs to one-dimension array of observables and attributes.\n    return Array.prototype.concat.apply([], observableAndAttributePairs);\n}\n/**\n * Check if all entries of the array are of `String` type.\n */\nfunction isStringArray(arr) {\n    return arr.every(a => typeof a == 'string');\n}\n/**\n * Parses and validates {@link Observable#bind}`.to( args )` arguments and returns\n * an object with a parsed structure. For example\n *\n * ```ts\n * A.bind( 'x' ).to( B, 'a', C, 'b', call );\n * ```\n *\n * becomes\n *\n * ```ts\n * {\n * \tto: [\n * \t\t{ observable: B, properties: [ 'a' ] },\n * \t\t{ observable: C, properties: [ 'b' ] },\n * \t],\n * \tcallback: call\n * }\n *\n * @param args Arguments of {@link Observable#bind}`.to( args )`.\n */\nfunction parseBindToArgs(...args) {\n    // Eliminate A.bind( 'x' ).to()\n    if (!args.length) {\n        /**\n         * Invalid argument syntax in `to()`.\n         *\n         * @error observable-bind-to-parse-error\n         */\n        throw new CKEditorError('observable-bind-to-parse-error', null);\n    }\n    const parsed = { to: [] };\n    let lastObservable;\n    if (typeof args[args.length - 1] == 'function') {\n        parsed.callback = args.pop();\n    }\n    args.forEach(a => {\n        if (typeof a == 'string') {\n            lastObservable.properties.push(a);\n        }\n        else if (typeof a == 'object') {\n            lastObservable = { observable: a, properties: [] };\n            parsed.to.push(lastObservable);\n        }\n        else {\n            throw new CKEditorError('observable-bind-to-parse-error', null);\n        }\n    });\n    return parsed;\n}\n/**\n * Synchronizes {@link module:utils/observable#_boundObservables} with {@link Binding}.\n *\n * @param binding A binding to store in {@link Observable#_boundObservables}.\n * @param toObservable A observable, which is a new component of `binding`.\n * @param toPropertyName A name of `toObservable`'s property, a new component of the `binding`.\n */\nfunction updateBoundObservables(observable, binding, toObservable, toPropertyName) {\n    const boundObservables = observable[boundObservablesSymbol];\n    const bindingsToObservable = boundObservables.get(toObservable);\n    const bindings = bindingsToObservable || {};\n    if (!bindings[toPropertyName]) {\n        bindings[toPropertyName] = new Set();\n    }\n    // Pass the binding to a corresponding Set in `observable._boundObservables`.\n    bindings[toPropertyName].add(binding);\n    if (!bindingsToObservable) {\n        boundObservables.set(toObservable, bindings);\n    }\n}\n/**\n * Synchronizes {@link Observable#_boundProperties} and {@link Observable#_boundObservables}\n * with {@link BindChain}.\n *\n * Assuming the following binding being created\n *\n * ```ts\n * A.bind( 'a', 'b' ).to( B, 'x', 'y' );\n * ```\n *\n * the following bindings were initialized by {@link Observable#bind} in {@link BindChain#_bindings}:\n *\n * ```ts\n * {\n * \ta: { observable: A, property: 'a', to: [] },\n * \tb: { observable: A, property: 'b', to: [] },\n * }\n * ```\n *\n * Iterate over all bindings in this chain and fill their `to` properties with\n * corresponding to( ... ) arguments (components of the binding), so\n *\n * ```ts\n * {\n * \ta: { observable: A, property: 'a', to: [ B, 'x' ] },\n * \tb: { observable: A, property: 'b', to: [ B, 'y' ] },\n * }\n * ```\n *\n * Then update the structure of {@link Observable#_boundObservables} with updated\n * binding, so it becomes:\n *\n * ```ts\n * Map( {\n * \tB: {\n * \t\tx: Set( [\n * \t\t\t{ observable: A, property: 'a', to: [ [ B, 'x' ] ] }\n * \t\t] ),\n * \t\ty: Set( [\n * \t\t\t{ observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n * \t\t] )\n * \t}\n * } )\n * ```\n *\n * @param chain The binding initialized by {@link Observable#bind}.\n */\nfunction updateBindToBound(chain) {\n    let toProperty;\n    chain._bindings.forEach((binding, propertyName) => {\n        // Note: For a binding without a callback, this will run only once\n        // like in A.bind( 'x', 'y' ).to( B, 'a', 'b' )\n        // TODO: ES6 destructuring.\n        chain._to.forEach(to => {\n            toProperty = to.properties[binding.callback ? 0 : chain._bindProperties.indexOf(propertyName)];\n            binding.to.push([to.observable, toProperty]);\n            updateBoundObservables(chain._observable, binding, to.observable, toProperty);\n        });\n    });\n}\n/**\n * Updates an property of a {@link Observable} with a value\n * determined by an entry in {@link Observable#_boundProperties}.\n *\n * @param observable A observable which property is to be updated.\n * @param propertyName An property to be updated.\n */\nfunction updateBoundObservableProperty(observable, propertyName) {\n    const boundProperties = observable[boundPropertiesSymbol];\n    const binding = boundProperties.get(propertyName);\n    let propertyValue;\n    // When a binding with callback is created like\n    //\n    // \t\tA.bind( 'a' ).to( B, 'b', C, 'c', callback );\n    //\n    // collect B.b and C.c, then pass them to callback to set A.a.\n    if (binding.callback) {\n        propertyValue = binding.callback.apply(observable, binding.to.map(to => to[0][to[1]]));\n    }\n    else {\n        propertyValue = binding.to[0];\n        propertyValue = propertyValue[0][propertyValue[1]];\n    }\n    if (Object.prototype.hasOwnProperty.call(observable, propertyName)) {\n        observable[propertyName] = propertyValue;\n    }\n    else {\n        observable.set(propertyName, propertyValue);\n    }\n}\n/**\n * Starts listening to changes in {@link BindChain._to} observables to update\n * {@link BindChain._observable} {@link BindChain._bindProperties}. Also sets the\n * initial state of {@link BindChain._observable}.\n *\n * @param chain The chain initialized by {@link Observable#bind}.\n */\nfunction attachBindToListeners(observable, toBindings) {\n    toBindings.forEach(to => {\n        const boundObservables = observable[boundObservablesSymbol];\n        let bindings;\n        // If there's already a chain between the observables (`observable` listens to\n        // `to.observable`), there's no need to create another `change` event listener.\n        if (!boundObservables.get(to.observable)) {\n            observable.listenTo(to.observable, 'change', (evt, propertyName) => {\n                bindings = boundObservables.get(to.observable)[propertyName];\n                // Note: to.observable will fire for any property change, react\n                // to changes of properties which are bound only.\n                if (bindings) {\n                    bindings.forEach(binding => {\n                        updateBoundObservableProperty(observable, binding.property);\n                    });\n                }\n            });\n        }\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/elementreplacer\n */\n/**\n * Utility class allowing to hide existing HTML elements or replace them with given ones in a way that doesn't remove\n * the original elements from the DOM.\n */\nexport class ElementReplacer {\n    /**\n     * The elements replaced by {@link #replace} and their replacements.\n     */\n    _replacedElements;\n    constructor() {\n        this._replacedElements = [];\n    }\n    /**\n     * Hides the `element` and, if specified, inserts the the given element next to it.\n     *\n     * The effect of this method can be reverted by {@link #restore}.\n     *\n     * @param element The element to replace.\n     * @param newElement The replacement element. If not passed, then the `element` will just be hidden.\n     */\n    replace(element, newElement) {\n        this._replacedElements.push({ element, newElement });\n        element.style.display = 'none';\n        if (newElement) {\n            element.parentNode.insertBefore(newElement, element.nextSibling);\n        }\n    }\n    /**\n     * Restores what {@link #replace} did.\n     */\n    restore() {\n        this._replacedElements.forEach(({ element, newElement }) => {\n            element.style.display = '';\n            if (newElement) {\n                newElement.remove();\n            }\n        });\n        this._replacedElements = [];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/count\n */\n/**\n * Returns the number of items return by the iterator.\n *\n * ```ts\n * count( [ 1, 2, 3, 4, 5 ] ); // 5;\n * ```\n *\n * @param iterable Any iterable.\n * @returns Number of items returned by that iterable.\n */\nexport function count(iterable) {\n    let count = 0;\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\n    for (const _ of iterable) {\n        count++;\n    }\n    return count;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/comparearrays\n */\n/**\n * Compares how given arrays relate to each other. One array can be: same as another array, prefix of another array\n * or completely different. If arrays are different, first index at which they differ is returned. Otherwise,\n * a flag specifying the relation is returned. Flags are negative numbers, so whenever a number >= 0 is returned\n * it means that arrays differ.\n *\n * ```ts\n * compareArrays( [ 0, 2 ], [ 0, 2 ] );\t\t// 'same'\n * compareArrays( [ 0, 2 ], [ 0, 2, 1 ] );\t\t// 'prefix'\n * compareArrays( [ 0, 2 ], [ 0 ] );\t\t\t// 'extension'\n * compareArrays( [ 0, 2 ], [ 1, 2 ] );\t\t// 0\n * compareArrays( [ 0, 2 ], [ 0, 1 ] );\t\t// 1\n * ```\n *\n * @param a Array that is compared.\n * @param b Array to compare with.\n * @returns How array `a` is related to `b`.\n */\nexport function compareArrays(a, b) {\n    const minLen = Math.min(a.length, b.length);\n    for (let i = 0; i < minLen; i++) {\n        if (a[i] != b[i]) {\n            // The arrays are different.\n            return i;\n        }\n    }\n    // Both arrays were same at all points.\n    if (a.length == b.length) {\n        // If their length is also same, they are the same.\n        return 'same';\n    }\n    else if (a.length < b.length) {\n        // Compared array is shorter so it is a prefix of the other array.\n        return 'prefix';\n    }\n    else {\n        // Compared array is longer so it is an extension of the other array.\n        return 'extension';\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/isiterable\n */\n/**\n * Checks if value implements iterator interface.\n *\n * @param value The value to check.\n * @returns True if value implements iterator interface.\n */\nexport function isIterable(value) {\n    return !!(value && value[Symbol.iterator]);\n}\n","function isString(value) {\n    return typeof value === 'string' || value instanceof String;\n}\n\nexport { isString };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/createelement\n */\nimport { isIterable } from '../isiterable.js';\nimport { isString } from 'es-toolkit/compat';\n/**\n * Creates an HTML or SVG element with attributes and children elements.\n *\n * ```ts\n * createElement( document, 'p' ); // <p>\n * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' } ); // <mask>\n * ```\n *\n * @param doc Document used to create the element.\n * @param name Name of the element.\n * @param attributes Object where keys represent attribute keys and values represent attribute values.\n * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.\n * @returns HTML or SVG element.\n */\nexport function createElement(doc, name, attributes = {}, children = []) {\n    const namespace = attributes && attributes.xmlns;\n    const element = namespace ? doc.createElementNS(namespace, name) : doc.createElement(name);\n    for (const key in attributes) {\n        element.setAttribute(key, attributes[key]);\n    }\n    if (isString(children) || !isIterable(children)) {\n        children = [children];\n    }\n    for (let child of children) {\n        if (isString(child)) {\n            child = doc.createTextNode(child);\n        }\n        element.appendChild(child);\n    }\n    return element;\n}\n","function isPlainObject(object) {\n    if (typeof object !== 'object') {\n        return false;\n    }\n    if (object == null) {\n        return false;\n    }\n    if (Object.getPrototypeOf(object) === null) {\n        return true;\n    }\n    if (Object.prototype.toString.call(object) !== '[object Object]') {\n        const tag = object[Symbol.toStringTag];\n        if (tag == null) {\n            return false;\n        }\n        const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;\n        if (isTagReadonly) {\n            return false;\n        }\n        return object.toString() === `[object ${tag}]`;\n    }\n    let proto = object;\n    while (Object.getPrototypeOf(proto) !== null) {\n        proto = Object.getPrototypeOf(proto);\n    }\n    return Object.getPrototypeOf(object) === proto;\n}\n\nexport { isPlainObject };\n","function getSymbols(object) {\n    return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));\n}\n\nexport { getSymbols };\n","function getTag(value) {\n    if (value == null) {\n        return value === undefined ? '[object Undefined]' : '[object Null]';\n    }\n    return Object.prototype.toString.call(value);\n}\n\nexport { getTag };\n","const regexpTag = '[object RegExp]';\nconst stringTag = '[object String]';\nconst numberTag = '[object Number]';\nconst booleanTag = '[object Boolean]';\nconst argumentsTag = '[object Arguments]';\nconst symbolTag = '[object Symbol]';\nconst dateTag = '[object Date]';\nconst mapTag = '[object Map]';\nconst setTag = '[object Set]';\nconst arrayTag = '[object Array]';\nconst functionTag = '[object Function]';\nconst arrayBufferTag = '[object ArrayBuffer]';\nconst objectTag = '[object Object]';\nconst errorTag = '[object Error]';\nconst dataViewTag = '[object DataView]';\nconst uint8ArrayTag = '[object Uint8Array]';\nconst uint8ClampedArrayTag = '[object Uint8ClampedArray]';\nconst uint16ArrayTag = '[object Uint16Array]';\nconst uint32ArrayTag = '[object Uint32Array]';\nconst bigUint64ArrayTag = '[object BigUint64Array]';\nconst int8ArrayTag = '[object Int8Array]';\nconst int16ArrayTag = '[object Int16Array]';\nconst int32ArrayTag = '[object Int32Array]';\nconst bigInt64ArrayTag = '[object BigInt64Array]';\nconst float32ArrayTag = '[object Float32Array]';\nconst float64ArrayTag = '[object Float64Array]';\n\nexport { argumentsTag, arrayBufferTag, arrayTag, bigInt64ArrayTag, bigUint64ArrayTag, booleanTag, dataViewTag, dateTag, errorTag, float32ArrayTag, float64ArrayTag, functionTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag };\n","function isPrimitive(value) {\n    return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n\nexport { isPrimitive };\n","function isTypedArray(x) {\n    return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n\nexport { isTypedArray };\n","import { getSymbols } from '../compat/_internal/getSymbols.mjs';\nimport { getTag } from '../compat/_internal/getTag.mjs';\nimport { uint32ArrayTag, uint16ArrayTag, uint8ClampedArrayTag, uint8ArrayTag, symbolTag, stringTag, setTag, regexpTag, objectTag, numberTag, mapTag, int32ArrayTag, int16ArrayTag, int8ArrayTag, float64ArrayTag, float32ArrayTag, dateTag, booleanTag, dataViewTag, arrayBufferTag, arrayTag, argumentsTag } from '../compat/_internal/tags.mjs';\nimport { isPrimitive } from '../predicate/isPrimitive.mjs';\nimport { isTypedArray } from '../predicate/isTypedArray.mjs';\n\nfunction cloneDeepWith(obj, cloneValue) {\n    return cloneDeepWithImpl(obj, undefined, obj, new Map(), cloneValue);\n}\nfunction cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = new Map(), cloneValue = undefined) {\n    const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);\n    if (cloned != null) {\n        return cloned;\n    }\n    if (isPrimitive(valueToClone)) {\n        return valueToClone;\n    }\n    if (stack.has(valueToClone)) {\n        return stack.get(valueToClone);\n    }\n    if (Array.isArray(valueToClone)) {\n        const result = new Array(valueToClone.length);\n        stack.set(valueToClone, result);\n        for (let i = 0; i < valueToClone.length; i++) {\n            result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);\n        }\n        if (Object.hasOwn(valueToClone, 'index')) {\n            result.index = valueToClone.index;\n        }\n        if (Object.hasOwn(valueToClone, 'input')) {\n            result.input = valueToClone.input;\n        }\n        return result;\n    }\n    if (valueToClone instanceof Date) {\n        return new Date(valueToClone.getTime());\n    }\n    if (valueToClone instanceof RegExp) {\n        const result = new RegExp(valueToClone.source, valueToClone.flags);\n        result.lastIndex = valueToClone.lastIndex;\n        return result;\n    }\n    if (valueToClone instanceof Map) {\n        const result = new Map();\n        stack.set(valueToClone, result);\n        for (const [key, value] of valueToClone) {\n            result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));\n        }\n        return result;\n    }\n    if (valueToClone instanceof Set) {\n        const result = new Set();\n        stack.set(valueToClone, result);\n        for (const value of valueToClone) {\n            result.add(cloneDeepWithImpl(value, undefined, objectToClone, stack, cloneValue));\n        }\n        return result;\n    }\n    if (typeof Buffer !== 'undefined' && Buffer.isBuffer(valueToClone)) {\n        return valueToClone.subarray();\n    }\n    if (isTypedArray(valueToClone)) {\n        const result = new (Object.getPrototypeOf(valueToClone).constructor)(valueToClone.length);\n        stack.set(valueToClone, result);\n        for (let i = 0; i < valueToClone.length; i++) {\n            result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);\n        }\n        return result;\n    }\n    if (valueToClone instanceof ArrayBuffer ||\n        (typeof SharedArrayBuffer !== 'undefined' && valueToClone instanceof SharedArrayBuffer)) {\n        return valueToClone.slice(0);\n    }\n    if (valueToClone instanceof DataView) {\n        const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);\n        stack.set(valueToClone, result);\n        copyProperties(result, valueToClone, objectToClone, stack, cloneValue);\n        return result;\n    }\n    if (typeof File !== 'undefined' && valueToClone instanceof File) {\n        const result = new File([valueToClone], valueToClone.name, {\n            type: valueToClone.type,\n        });\n        stack.set(valueToClone, result);\n        copyProperties(result, valueToClone, objectToClone, stack, cloneValue);\n        return result;\n    }\n    if (valueToClone instanceof Blob) {\n        const result = new Blob([valueToClone], { type: valueToClone.type });\n        stack.set(valueToClone, result);\n        copyProperties(result, valueToClone, objectToClone, stack, cloneValue);\n        return result;\n    }\n    if (valueToClone instanceof Error) {\n        const result = new valueToClone.constructor();\n        stack.set(valueToClone, result);\n        result.message = valueToClone.message;\n        result.name = valueToClone.name;\n        result.stack = valueToClone.stack;\n        result.cause = valueToClone.cause;\n        copyProperties(result, valueToClone, objectToClone, stack, cloneValue);\n        return result;\n    }\n    if (typeof valueToClone === 'object' && isCloneableObject(valueToClone)) {\n        const result = Object.create(Object.getPrototypeOf(valueToClone));\n        stack.set(valueToClone, result);\n        copyProperties(result, valueToClone, objectToClone, stack, cloneValue);\n        return result;\n    }\n    return valueToClone;\n}\nfunction copyProperties(target, source, objectToClone = target, stack, cloneValue) {\n    const keys = [...Object.keys(source), ...getSymbols(source)];\n    for (let i = 0; i < keys.length; i++) {\n        const key = keys[i];\n        const descriptor = Object.getOwnPropertyDescriptor(target, key);\n        if (descriptor == null || descriptor.writable) {\n            target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);\n        }\n    }\n}\nfunction isCloneableObject(object) {\n    switch (getTag(object)) {\n        case argumentsTag:\n        case arrayTag:\n        case arrayBufferTag:\n        case dataViewTag:\n        case booleanTag:\n        case dateTag:\n        case float32ArrayTag:\n        case float64ArrayTag:\n        case int8ArrayTag:\n        case int16ArrayTag:\n        case int32ArrayTag:\n        case mapTag:\n        case numberTag:\n        case objectTag:\n        case regexpTag:\n        case setTag:\n        case stringTag:\n        case symbolTag:\n        case uint8ArrayTag:\n        case uint8ClampedArrayTag:\n        case uint16ArrayTag:\n        case uint32ArrayTag: {\n            return true;\n        }\n        default: {\n            return false;\n        }\n    }\n}\n\nexport { cloneDeepWith, cloneDeepWithImpl, copyProperties };\n","import { cloneDeepWith as cloneDeepWith$1, copyProperties } from '../../object/cloneDeepWith.mjs';\nimport { argumentsTag, booleanTag, stringTag, numberTag } from '../_internal/tags.mjs';\n\nfunction cloneDeepWith(obj, customizer) {\n    return cloneDeepWith$1(obj, (value, key, object, stack) => {\n        const cloned = customizer?.(value, key, object, stack);\n        if (cloned != null) {\n            return cloned;\n        }\n        if (typeof obj !== 'object') {\n            return undefined;\n        }\n        switch (Object.prototype.toString.call(obj)) {\n            case numberTag:\n            case stringTag:\n            case booleanTag: {\n                const result = new obj.constructor(obj?.valueOf());\n                copyProperties(result, obj);\n                return result;\n            }\n            case argumentsTag: {\n                const result = {};\n                copyProperties(result, obj);\n                result.length = obj.length;\n                result[Symbol.iterator] = obj[Symbol.iterator];\n                return result;\n            }\n            default: {\n                return undefined;\n            }\n        }\n    });\n}\n\nexport { cloneDeepWith };\n","function isObjectLike(value) {\n    return typeof value === 'object' && value !== null;\n}\n\nexport { isObjectLike };\n","import { isObjectLike } from './isObjectLike.mjs';\nimport { isPlainObject } from './isPlainObject.mjs';\n\nfunction isElement(value) {\n    return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);\n}\n\nexport { isElement };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/config\n */\nimport { isPlainObject, isElement, cloneDeepWith } from 'es-toolkit/compat';\n/**\n * Handles a configuration dictionary.\n *\n * @typeParam Cfg A type of the configuration dictionary.\n */\nexport class Config {\n    /**\n     * Store for the whole configuration.\n     */\n    _config;\n    /**\n     * Creates an instance of the {@link ~Config} class.\n     *\n     * @param configurations The initial configurations to be set. Usually, provided by the user.\n     * @param defaultConfigurations The default configurations. Usually, provided by the system.\n     */\n    constructor(configurations, defaultConfigurations) {\n        this._config = Object.create(null);\n        // Set default configuration.\n        if (defaultConfigurations) {\n            // Clone the configuration to make sure that the properties will not be shared\n            // between editors and make the watchdog feature work correctly.\n            this.define(cloneConfig(defaultConfigurations));\n        }\n        // Set initial configuration.\n        if (configurations) {\n            this._setObjectToTarget(this._config, configurations);\n        }\n    }\n    set(name, value) {\n        this._setToTarget(this._config, name, value);\n    }\n    define(name, value) {\n        const isDefine = true;\n        this._setToTarget(this._config, name, value, isDefine);\n    }\n    /**\n     * Gets the value for a configuration entry.\n     *\n     * ```ts\n     * config.get( 'name' );\n     * ```\n     *\n     * Deep configurations can be retrieved by separating each part with a dot.\n     *\n     * ```ts\n     * config.get( 'toolbar.collapsed' );\n     * ```\n     *\n     * @param name The configuration name. Configuration names are case-sensitive.\n     * @returns The configuration value or `undefined` if the configuration entry was not found.\n     */\n    get(name) {\n        return this._getFromSource(this._config, name);\n    }\n    /**\n     * Iterates over all top level configuration names.\n     */\n    *names() {\n        for (const name of Object.keys(this._config)) {\n            yield name;\n        }\n    }\n    /**\n     * Saves passed configuration to the specified target (nested object).\n     *\n     * @param target Nested config object.\n     * @param name The configuration name or an object from which take properties as\n     * configuration entries. Configuration names are case-sensitive.\n     * @param value The configuration value. Used if a name is passed.\n     * @param isDefine Define if passed configuration should overwrite existing one.\n     */\n    _setToTarget(target, name, value, isDefine = false) {\n        // In case of an object, iterate through it and call `_setToTarget` again for each property.\n        if (isPlainObject(name)) {\n            this._setObjectToTarget(target, name, isDefine);\n            return;\n        }\n        // The configuration name should be split into parts if it has dots. E.g. `resize.width` -> [`resize`, `width`].\n        const parts = name.split('.');\n        // Take the name of the configuration out of the parts. E.g. `resize.width` -> `width`.\n        name = parts.pop();\n        // Iterate over parts to check if currently stored configuration has proper structure.\n        for (const part of parts) {\n            // If there is no object for specified part then create one.\n            if (!isPlainObject(target[part])) {\n                target[part] = Object.create(null);\n            }\n            // Nested object becomes a target.\n            target = target[part];\n        }\n        // In case of value is an object.\n        if (isPlainObject(value)) {\n            // We take care of proper config structure.\n            if (!isPlainObject(target[name])) {\n                target[name] = Object.create(null);\n            }\n            target = target[name];\n            // And iterate through this object calling `_setToTarget` again for each property.\n            this._setObjectToTarget(target, value, isDefine);\n            return;\n        }\n        // Do nothing if we are defining configuration for non empty name.\n        if (isDefine && typeof target[name] != 'undefined') {\n            return;\n        }\n        target[name] = value;\n    }\n    /**\n     * Get specified configuration from specified source (nested object).\n     *\n     * @param source level of nested object.\n     * @param name The configuration name. Configuration names are case-sensitive.\n     * @returns The configuration value or `undefined` if the configuration entry was not found.\n     */\n    _getFromSource(source, name) {\n        // The configuration name should be split into parts if it has dots. E.g. `resize.width` -> [`resize`, `width`].\n        const parts = name.split('.');\n        // Take the name of the configuration out of the parts. E.g. `resize.width` -> `width`.\n        name = parts.pop();\n        // Iterate over parts to check if currently stored configuration has proper structure.\n        for (const part of parts) {\n            if (!isPlainObject(source[part])) {\n                source = null;\n                break;\n            }\n            // Nested object becomes a source.\n            source = source[part];\n        }\n        // Always returns undefined for non existing configuration.\n        return source ? cloneConfig(source[name]) : undefined;\n    }\n    /**\n     * Iterates through passed object and calls {@link #_setToTarget} method with object key and value for each property.\n     *\n     * @param target Nested config object.\n     * @param configuration Configuration data set\n     * @param isDefine Defines if passed configuration is default configuration or not.\n     */\n    _setObjectToTarget(target, configuration, isDefine) {\n        Object.keys(configuration).forEach(key => {\n            this._setToTarget(target, key, configuration[key], isDefine);\n        });\n    }\n}\n/**\n * Clones configuration object or value.\n */\nfunction cloneConfig(source) {\n    return cloneDeepWith(source, leaveItemReferences);\n}\n/**\n * A customized function for cloneDeepWith.\n * In case if it's a DOM Element it will leave references to DOM Elements instead of cloning them.\n * If it's a function it will leave reference to actuall function.\n */\nfunction leaveItemReferences(value) {\n    return isElement(value) || typeof value === 'function' ? value : undefined;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/isnode\n */\n/**\n * Checks if the object is a native DOM Node.\n */\nexport function isNode(obj) {\n    if (obj) {\n        if (obj.defaultView) {\n            return obj instanceof obj.defaultView.Document;\n        }\n        else if (obj.ownerDocument && obj.ownerDocument.defaultView) {\n            return obj instanceof obj.ownerDocument.defaultView.Node;\n        }\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/iswindow\n */\n/**\n * Checks if the object is a native DOM Window.\n */\nexport function isWindow(obj) {\n    const stringifiedObject = Object.prototype.toString.apply(obj);\n    // Returns `true` for the `window` object in browser environments.\n    if (stringifiedObject == '[object Window]') {\n        return true;\n    }\n    // Returns `true` for the `window` object in the Electron environment.\n    if (stringifiedObject == '[object global]') {\n        return true;\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/emittermixin\n */\nimport { EmitterMixin, _getEmitterListenedTo, _setEmitterId } from '../emittermixin.js';\nimport { uid } from '../uid.js';\nimport { isNode } from './isnode.js';\nimport { isWindow } from './iswindow.js';\nimport { global } from './global.js';\nconst defaultEmitterClass = /* #__PURE__ */ DomEmitterMixin(/* #__PURE__ */ EmitterMixin());\nexport function DomEmitterMixin(base) {\n    if (!base) {\n        return defaultEmitterClass;\n    }\n    class Mixin extends base {\n        listenTo(emitter, event, callback, options = {}) {\n            // Check if emitter is an instance of DOM Node. If so, use corresponding ProxyEmitter (or create one if not existing).\n            if (isNode(emitter) || isWindow(emitter) || emitter instanceof global.window.EventTarget) {\n                const proxyOptions = {\n                    capture: !!options.useCapture,\n                    passive: !!options.usePassive\n                };\n                const proxyEmitter = this._getProxyEmitter(emitter, proxyOptions) || new ProxyEmitter(emitter, proxyOptions);\n                this.listenTo(proxyEmitter, event, callback, options);\n            }\n            else {\n                // Execute parent class method with Emitter (or ProxyEmitter) instance.\n                super.listenTo(emitter, event, callback, options);\n            }\n        }\n        stopListening(emitter, event, callback) {\n            // Check if the emitter is an instance of DOM Node. If so, forward the call to the corresponding ProxyEmitters.\n            if (isNode(emitter) || isWindow(emitter) || emitter instanceof global.window.EventTarget) {\n                const proxyEmitters = this._getAllProxyEmitters(emitter);\n                for (const proxy of proxyEmitters) {\n                    this.stopListening(proxy, event, callback);\n                }\n            }\n            else {\n                // Execute parent class method with Emitter (or ProxyEmitter) instance.\n                super.stopListening(emitter, event, callback);\n            }\n        }\n        /**\n         * Retrieves ProxyEmitter instance for given DOM Node residing in this Host and given options.\n         *\n         * @param node DOM Node of the ProxyEmitter.\n         * @param options Additional options.\n         * @param options.useCapture Indicates that events of this type will be dispatched to the registered\n         * listener before being dispatched to any EventTarget beneath it in the DOM tree.\n         * @param options.usePassive Indicates that the function specified by listener will never call preventDefault()\n         * and prevents blocking browser's main thread by this event handler.\n         * @returns ProxyEmitter instance bound to the DOM Node.\n         */\n        _getProxyEmitter(node, options) {\n            return _getEmitterListenedTo(this, getProxyEmitterId(node, options));\n        }\n        /**\n         * Retrieves all the ProxyEmitter instances for given DOM Node residing in this Host.\n         *\n         * @param node DOM Node of the ProxyEmitter.\n         */\n        _getAllProxyEmitters(node) {\n            return [\n                { capture: false, passive: false },\n                { capture: false, passive: true },\n                { capture: true, passive: false },\n                { capture: true, passive: true }\n            ].map(options => this._getProxyEmitter(node, options)).filter(proxy => !!proxy);\n        }\n    }\n    return Mixin;\n}\n/**\n * Creates a ProxyEmitter instance. Such an instance is a bridge between a DOM Node firing events\n * and any Host listening to them. It is backwards compatible with {@link module:utils/emittermixin~Emitter#on}.\n * There is a separate instance for each combination of modes (useCapture & usePassive). The mode is concatenated with\n * UID stored in HTMLElement to give each instance unique identifier.\n *\n *                                  listenTo( click, ... )\n *                    +-----------------------------------------+\n *                    |              stopListening( ... )       |\n *     +----------------------------+                           |             addEventListener( click, ... )\n *     | Host                       |                           |   +---------------------------------------------+\n *     +----------------------------+                           |   |       removeEventListener( click, ... )     |\n *     | _listeningTo: {            |                +----------v-------------+                                   |\n *     |   UID+mode: {              |                | ProxyEmitter           |                                   |\n *     |     emitter: ProxyEmitter, |                +------------------------+                      +------------v----------+\n *     |     callbacks: {           |                | events: {              |                      | Node (HTMLElement)    |\n *     |       click: [ callbacks ] |                |   click: [ callbacks ] |                      +-----------------------+\n *     |     }                      |                | },                     |                      | data-ck-expando: UID  |\n *     |   }                        |                | _domNode: Node,        |                      +-----------------------+\n *     | }                          |                | _domListeners: {},     |                                   |\n *     | +------------------------+ |                | _emitterId: UID+mode   |                                   |\n *     | | DomEmitterMixin        | |                +--------------^---------+                                   |\n *     | +------------------------+ |                           |   |                                             |\n *     +--------------^-------------+                           |   +---------------------------------------------+\n *                    |                                         |                  click (DOM Event)\n *                    +-----------------------------------------+\n *                                fire( click, DOM Event )\n */\nclass ProxyEmitter extends /* #__PURE__ */ EmitterMixin() {\n    _domNode;\n    _options;\n    /**\n     * @param node DOM Node that fires events.\n     * @param options Additional options.\n     * @param options.useCapture Indicates that events of this type will be dispatched to the registered\n     * listener before being dispatched to any EventTarget beneath it in the DOM tree.\n     * @param options.usePassive Indicates that the function specified by listener will never call preventDefault()\n     * and prevents blocking browser's main thread by this event handler.\n     */\n    constructor(node, options) {\n        super();\n        // Set emitter ID to match DOM Node \"expando\" property.\n        _setEmitterId(this, getProxyEmitterId(node, options));\n        // Remember the DOM Node this ProxyEmitter is bound to.\n        this._domNode = node;\n        // And given options.\n        this._options = options;\n    }\n    /**\n     * Collection of native DOM listeners.\n     */\n    _domListeners;\n    /**\n     * Registers a callback function to be executed when an event is fired.\n     *\n     * It attaches a native DOM listener to the DOM Node. When fired,\n     * a corresponding Emitter event will also fire with DOM Event object as an argument.\n     *\n     * **Note**: This is automatically called by the\n     * {@link module:utils/emittermixin~Emitter#listenTo `Emitter#listenTo()`}.\n     *\n     * @param event The name of the event.\n     */\n    attach(event) {\n        // If the DOM Listener for given event already exist it is pointless\n        // to attach another one.\n        if (this._domListeners && this._domListeners[event]) {\n            return;\n        }\n        const domListener = this._createDomListener(event);\n        // Attach the native DOM listener to DOM Node.\n        this._domNode.addEventListener(event, domListener, this._options);\n        if (!this._domListeners) {\n            this._domListeners = {};\n        }\n        // Store the native DOM listener in this ProxyEmitter. It will be helpful\n        // when stopping listening to the event.\n        this._domListeners[event] = domListener;\n    }\n    /**\n     * Stops executing the callback on the given event.\n     *\n     * **Note**: This is automatically called by the\n     * {@link module:utils/emittermixin~Emitter#stopListening `Emitter#stopListening()`}.\n     *\n     * @param event The name of the event.\n     */\n    detach(event) {\n        let events;\n        // Remove native DOM listeners which are orphans. If no callbacks\n        // are awaiting given event, detach native DOM listener from DOM Node.\n        // See: {@link attach}.\n        if (this._domListeners[event] && (!(events = this._events[event]) || !events.callbacks.length)) {\n            this._domListeners[event].removeListener();\n        }\n    }\n    /**\n     * Adds callback to emitter for given event.\n     *\n     * @internal\n     * @param event The name of the event.\n     * @param callback The function to be called on event.\n     * @param options Additional options.\n     */\n    _addEventListener(event, callback, options) {\n        this.attach(event);\n        EmitterMixin().prototype._addEventListener.call(this, event, callback, options);\n    }\n    /**\n     * Removes callback from emitter for given event.\n     *\n     * @internal\n     * @param event The name of the event.\n     * @param callback The function to stop being called.\n     */\n    _removeEventListener(event, callback) {\n        EmitterMixin().prototype._removeEventListener.call(this, event, callback);\n        this.detach(event);\n    }\n    /**\n     * Creates a native DOM listener callback. When the native DOM event\n     * is fired it will fire corresponding event on this ProxyEmitter.\n     * Note: A native DOM Event is passed as an argument.\n     *\n     * @param event The name of the event.\n     * @returns The DOM listener callback.\n     */\n    _createDomListener(event) {\n        const domListener = (domEvt) => {\n            this.fire(event, domEvt);\n        };\n        // Supply the DOM listener callback with a function that will help\n        // detach it from the DOM Node, when it is no longer necessary.\n        // See: {@link detach}.\n        domListener.removeListener = () => {\n            this._domNode.removeEventListener(event, domListener, this._options);\n            delete this._domListeners[event];\n        };\n        return domListener;\n    }\n}\n/**\n * Gets an unique DOM Node identifier. The identifier will be set if not defined.\n *\n * @returns UID for given DOM Node.\n */\nfunction getNodeUID(node) {\n    return node['data-ck-expando'] || (node['data-ck-expando'] = uid());\n}\n/**\n * Gets id of the ProxyEmitter for the given node.\n */\nfunction getProxyEmitterId(node, options) {\n    let id = getNodeUID(node);\n    for (const option of Object.keys(options).sort()) {\n        if (options[option]) {\n            id += '-' + option;\n        }\n    }\n    return id;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/getrangefrommouseevent\n */\n/**\n * Returns a DOM range from a given point specified by a mouse event.\n *\n * @param domEvent The mouse event.\n * @returns The DOM range.\n */\nexport function getRangeFromMouseEvent(domEvent) {\n    if (!domEvent.target) {\n        return null;\n    }\n    const domDoc = domEvent.target.ownerDocument;\n    const x = domEvent.clientX;\n    const y = domEvent.clientY;\n    let domRange = null;\n    // Webkit & Blink.\n    if (domDoc.caretRangeFromPoint && domDoc.caretRangeFromPoint(x, y)) {\n        domRange = domDoc.caretRangeFromPoint(x, y);\n    }\n    // FF.\n    else if (domEvent.rangeParent) {\n        domRange = domDoc.createRange();\n        domRange.setStart(domEvent.rangeParent, domEvent.rangeOffset);\n        domRange.collapse(true);\n    }\n    return domRange;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/getpositionedancestor\n */\nimport { global } from './global.js';\n/**\n * For a given element, returns the nearest ancestor element which CSS position is not \"static\".\n *\n * @param element The native DOM element to be checked.\n */\nexport function getPositionedAncestor(element) {\n    if (!element || !element.parentNode) {\n        return null;\n    }\n    if (element.offsetParent === global.document.body) {\n        return null;\n    }\n    return element.offsetParent;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/istext\n */\n/**\n * Checks if the object is a native DOM Text node.\n */\nexport function isText(obj) {\n    return Object.prototype.toString.call(obj) == '[object Text]';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/isrange\n */\n/**\n * Checks if the object is a native DOM Range.\n */\nexport function isRange(obj) {\n    return Object.prototype.toString.apply(obj) == '[object Range]';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/getborderwidths\n */\n/**\n * Returns an object containing CSS border widths of a specified HTML element.\n *\n * @param element An element which has CSS borders.\n * @returns An object containing `top`, `left`, `right` and `bottom` properties\n * with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.\n */\nexport function getBorderWidths(element) {\n    // Call getComputedStyle on the window the element document belongs to.\n    const style = element.ownerDocument.defaultView.getComputedStyle(element);\n    return {\n        top: parseInt(style.borderTopWidth, 10),\n        right: parseInt(style.borderRightWidth, 10),\n        bottom: parseInt(style.borderBottomWidth, 10),\n        left: parseInt(style.borderLeftWidth, 10)\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/rect\n */\nimport { isRange } from './isrange.js';\nimport { isWindow } from './iswindow.js';\nimport { getBorderWidths } from './getborderwidths.js';\nimport { isText } from './istext.js';\nimport { getPositionedAncestor } from './getpositionedancestor.js';\nimport { global } from './global.js';\nconst rectProperties = ['top', 'right', 'bottom', 'left', 'width', 'height'];\n/**\n * A helper class representing a `ClientRect` object, e.g. value returned by\n * the native `object.getBoundingClientRect()` method. Provides a set of methods\n * to manipulate the rect and compare it against other rect instances.\n */\nexport class Rect {\n    /**\n     * The \"top\" value of the rect.\n     *\n     * @readonly\n     */\n    top;\n    /**\n     * The \"right\" value of the rect.\n     *\n     * @readonly\n     */\n    right;\n    /**\n     * The \"bottom\" value of the rect.\n     *\n     * @readonly\n     */\n    bottom;\n    /**\n     * The \"left\" value of the rect.\n     *\n     * @readonly\n     */\n    left;\n    /**\n     * The \"width\" value of the rect.\n     *\n     * @readonly\n     */\n    width;\n    /**\n     * The \"height\" value of the rect.\n     *\n     * @readonly\n     */\n    height;\n    /**\n     * The object this rect is for.\n     *\n     * @readonly\n     */\n    _source;\n    /**\n     * Creates an instance of rect.\n     *\n     * ```ts\n     * // Rect of an HTMLElement.\n     * const rectA = new Rect( document.body );\n     *\n     * // Rect of a DOM Range.\n     * const rectB = new Rect( document.getSelection().getRangeAt( 0 ) );\n     *\n     * // Rect of a window (web browser viewport).\n     * const rectC = new Rect( window );\n     *\n     * // Rect out of an object.\n     * const rectD = new Rect( { top: 0, right: 10, bottom: 10, left: 0, width: 10, height: 10 } );\n     *\n     * // Rect out of another Rect instance.\n     * const rectE = new Rect( rectD );\n     *\n     * // Rect out of a ClientRect.\n     * const rectF = new Rect( document.body.getClientRects().item( 0 ) );\n     * ```\n     *\n     * **Note**: By default a rect of an HTML element includes its CSS borders and scrollbars (if any)\n     * ant the rect of a `window` includes scrollbars too. Use {@link #excludeScrollbarsAndBorders}\n     * to get the inner part of the rect.\n     *\n     * @param source A source object to create the rect.\n     */\n    constructor(source) {\n        const isSourceRange = isRange(source);\n        Object.defineProperty(this, '_source', {\n            // If the source is a Rect instance, copy it's #_source.\n            value: source._source || source,\n            writable: true,\n            enumerable: false\n        });\n        if (isDomElement(source) || isSourceRange) {\n            // The `Rect` class depends on `getBoundingClientRect` and `getClientRects` DOM methods. If the source\n            // of a rect in an HTML element or a DOM range but it does not belong to any rendered DOM tree, these methods\n            // will fail to obtain the geometry and the rect instance makes little sense to the features using it.\n            // To get rid of this warning make sure the source passed to the constructor is a descendant of `window.document.body`.\n            // @if CK_DEBUG // const sourceNode = isSourceRange ? source.startContainer : source;\n            // @if CK_DEBUG // if ( !sourceNode.ownerDocument || !sourceNode.ownerDocument.body.contains( sourceNode ) ) {\n            // @if CK_DEBUG // \tconsole.warn(\n            // @if CK_DEBUG // \t\t'rect-source-not-in-dom: The source of this rect does not belong to any rendered DOM tree.',\n            // @if CK_DEBUG // \t\t{ source } );\n            // @if CK_DEBUG // }\n            if (isSourceRange) {\n                const rangeRects = Rect.getDomRangeRects(source);\n                copyRectProperties(this, Rect.getBoundingRect(rangeRects));\n            }\n            else {\n                copyRectProperties(this, source.getBoundingClientRect());\n            }\n        }\n        else if (isWindow(source)) {\n            const { innerWidth, innerHeight } = source;\n            copyRectProperties(this, {\n                top: 0,\n                right: innerWidth,\n                bottom: innerHeight,\n                left: 0,\n                width: innerWidth,\n                height: innerHeight\n            });\n        }\n        else {\n            copyRectProperties(this, source);\n        }\n    }\n    /**\n     * Returns a clone of the rect.\n     *\n     * @returns A cloned rect.\n     */\n    clone() {\n        return new Rect(this);\n    }\n    /**\n     * Moves the rect so that its upper–left corner lands in desired `[ x, y ]` location.\n     *\n     * @param x Desired horizontal location.\n     * @param y Desired vertical location.\n     * @returns A rect which has been moved.\n     */\n    moveTo(x, y) {\n        this.top = y;\n        this.right = x + this.width;\n        this.bottom = y + this.height;\n        this.left = x;\n        return this;\n    }\n    /**\n     * Moves the rect in–place by a dedicated offset.\n     *\n     * @param x A horizontal offset.\n     * @param y A vertical offset\n     * @returns A rect which has been moved.\n     */\n    moveBy(x, y) {\n        this.top += y;\n        this.right += x;\n        this.left += x;\n        this.bottom += y;\n        return this;\n    }\n    /**\n     * Returns a new rect a a result of intersection with another rect.\n     */\n    getIntersection(anotherRect) {\n        const rect = {\n            top: Math.max(this.top, anotherRect.top),\n            right: Math.min(this.right, anotherRect.right),\n            bottom: Math.min(this.bottom, anotherRect.bottom),\n            left: Math.max(this.left, anotherRect.left),\n            width: 0,\n            height: 0\n        };\n        rect.width = rect.right - rect.left;\n        rect.height = rect.bottom - rect.top;\n        if (rect.width < 0 || rect.height < 0) {\n            return null;\n        }\n        else {\n            const newRect = new Rect(rect);\n            newRect._source = this._source;\n            return newRect;\n        }\n    }\n    /**\n     * Returns the area of intersection with another rect.\n     *\n     * @returns Area of intersection.\n     */\n    getIntersectionArea(anotherRect) {\n        const rect = this.getIntersection(anotherRect);\n        if (rect) {\n            return rect.getArea();\n        }\n        else {\n            return 0;\n        }\n    }\n    /**\n     * Returns the area of the rect.\n     */\n    getArea() {\n        return this.width * this.height;\n    }\n    /**\n     * Returns a new rect, a part of the original rect, which is actually visible to the user and is relative to the,`body`,\n     * e.g. an original rect cropped by parent element rects which have `overflow` set in CSS\n     * other than `\"visible\"`.\n     *\n     * If there's no such visible rect, which is when the rect is limited by one or many of\n     * the ancestors, `null` is returned.\n     *\n     * **Note**: This method does not consider the boundaries of the viewport (window).\n     * To get a rect cropped by all ancestors and the viewport, use an intersection such as:\n     *\n     * ```ts\n     * const visibleInViewportRect = new Rect( window ).getIntersection( new Rect( source ).getVisible() );\n     * ```\n     *\n     * @returns A visible rect instance or `null`, if there's none.\n     */\n    getVisible() {\n        const source = this._source;\n        let visibleRect = this.clone();\n        // There's no ancestor to crop <body> with the overflow.\n        if (isBody(source)) {\n            return visibleRect;\n        }\n        let child = source;\n        let parent = source.parentNode || source.commonAncestorContainer;\n        let absolutelyPositionedChildElement;\n        // Check the ancestors all the way up to the <body>.\n        while (parent && !isBody(parent)) {\n            const isParentOverflowVisible = getElementOverflow(parent) === 'visible';\n            if (child instanceof HTMLElement && getElementPosition(child) === 'absolute') {\n                absolutelyPositionedChildElement = child;\n            }\n            const parentElementPosition = getElementPosition(parent);\n            // The child will be cropped only if it has `position: absolute` and the parent has `position: relative` + some overflow.\n            // Otherwise there's no chance of visual clipping and the parent can be skipped\n            // https://github.com/ckeditor/ckeditor5/issues/14107.\n            //\n            // condition: isParentOverflowVisible\n            // \t\t+---------------------------+\n            //\t\t| #parent\t\t\t\t\t|\n            //\t\t| (overflow: visible)\t\t|\n            //\t\t|\t\t\t\t+-----------+---------------+\n            //\t\t|\t\t\t\t| child\t\t\t\t\t\t|\n            //\t\t|\t\t\t\t+-----------+---------------+\n            //\t\t+---------------------------+\n            //\n            // condition: absolutelyPositionedChildElement && parentElementPosition === 'relative' && isParentOverflowVisible\n            // \t\t+---------------------------+\n            //\t\t| parent\t\t\t\t\t|\n            //\t\t| (position: relative;)\t\t|\n            //\t\t| (overflow: visible;)\t\t|\n            //\t\t|\t\t\t\t+-----------+---------------+\n            //\t\t|\t\t\t\t| child  \t\t\t\t\t|\n            //\t\t|\t\t\t\t| (position: absolute;)\t\t|\n            //\t\t|\t\t\t\t+-----------+---------------+\n            //\t\t+---------------------------+\n            //\n            // condition: absolutelyPositionedChildElement && parentElementPosition !== 'relative'\n            // \t\t+---------------------------+\n            //\t\t| parent\t\t\t\t\t|\n            //\t\t| (position: static;)\t\t|\n            //\t\t|\t\t\t\t+-----------+---------------+\n            //\t\t|\t\t\t\t| child  \t\t\t\t\t|\n            //\t\t|\t\t\t\t| (position: absolute;)\t\t|\n            //\t\t|\t\t\t\t+-----------+---------------+\n            //\t\t+---------------------------+\n            if (isParentOverflowVisible ||\n                absolutelyPositionedChildElement && ((parentElementPosition === 'relative' && isParentOverflowVisible) ||\n                    parentElementPosition !== 'relative')) {\n                child = parent;\n                parent = parent.parentNode;\n                continue;\n            }\n            const parentRect = new Rect(parent);\n            const intersectionRect = visibleRect.getIntersection(parentRect);\n            if (intersectionRect) {\n                if (intersectionRect.getArea() < visibleRect.getArea()) {\n                    // Reduce the visible rect to the intersection.\n                    visibleRect = intersectionRect;\n                }\n            }\n            else {\n                // There's no intersection, the rect is completely invisible.\n                return null;\n            }\n            child = parent;\n            parent = parent.parentNode;\n        }\n        return visibleRect;\n    }\n    /**\n     * Checks if all property values ({@link #top}, {@link #left}, {@link #right},\n     * {@link #bottom}, {@link #width} and {@link #height}) are the equal in both rect\n     * instances.\n     *\n     * @param anotherRect A rect instance to compare with.\n     * @returns `true` when Rects are equal. `false` otherwise.\n     */\n    isEqual(anotherRect) {\n        for (const prop of rectProperties) {\n            if (this[prop] !== anotherRect[prop]) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Checks whether a rect fully contains another rect instance.\n     *\n     * @param anotherRect\n     * @returns `true` if contains, `false` otherwise.\n     */\n    contains(anotherRect) {\n        const intersectRect = this.getIntersection(anotherRect);\n        return !!(intersectRect && intersectRect.isEqual(anotherRect));\n    }\n    /**\n     * Recalculates screen coordinates to coordinates relative to the positioned ancestor offset.\n     */\n    toAbsoluteRect() {\n        const { scrollX, scrollY } = global.window;\n        const absoluteRect = this.clone().moveBy(scrollX, scrollY);\n        if (isDomElement(absoluteRect._source)) {\n            const positionedAncestor = getPositionedAncestor(absoluteRect._source);\n            if (positionedAncestor) {\n                shiftRectToCompensatePositionedAncestor(absoluteRect, positionedAncestor);\n            }\n        }\n        return absoluteRect;\n    }\n    /**\n     * Excludes scrollbars and CSS borders from the rect.\n     *\n     * * Borders are removed when {@link #_source} is an HTML element.\n     * * Scrollbars are excluded from HTML elements and the `window`.\n     *\n     * @returns A rect which has been updated.\n     */\n    excludeScrollbarsAndBorders() {\n        const source = this._source;\n        let scrollBarWidth, scrollBarHeight, direction;\n        if (isWindow(source)) {\n            scrollBarWidth = source.innerWidth - source.document.documentElement.clientWidth;\n            scrollBarHeight = source.innerHeight - source.document.documentElement.clientHeight;\n            direction = source.getComputedStyle(source.document.documentElement).direction;\n        }\n        else {\n            const borderWidths = getBorderWidths(source);\n            scrollBarWidth = source.offsetWidth - source.clientWidth - borderWidths.left - borderWidths.right;\n            scrollBarHeight = source.offsetHeight - source.clientHeight - borderWidths.top - borderWidths.bottom;\n            direction = source.ownerDocument.defaultView.getComputedStyle(source).direction;\n            this.left += borderWidths.left;\n            this.top += borderWidths.top;\n            this.right -= borderWidths.right;\n            this.bottom -= borderWidths.bottom;\n            this.width = this.right - this.left;\n            this.height = this.bottom - this.top;\n        }\n        this.width -= scrollBarWidth;\n        if (direction === 'ltr') {\n            this.right -= scrollBarWidth;\n        }\n        else {\n            this.left += scrollBarWidth;\n        }\n        this.height -= scrollBarHeight;\n        this.bottom -= scrollBarHeight;\n        return this;\n    }\n    /**\n     * Returns an array of rects of the given native DOM Range.\n     *\n     * @param range A native DOM range.\n     * @returns DOM Range rects.\n     */\n    static getDomRangeRects(range) {\n        const rects = [];\n        // Safari does not iterate over ClientRectList using for...of loop.\n        const clientRects = Array.from(range.getClientRects());\n        if (clientRects.length) {\n            for (const rect of clientRects) {\n                rects.push(new Rect(rect));\n            }\n        }\n        // If there's no client rects for the Range, use parent container's bounding rect\n        // instead and adjust rect's width to simulate the actual geometry of such range.\n        // https://github.com/ckeditor/ckeditor5-utils/issues/153\n        // https://github.com/ckeditor/ckeditor5-ui/issues/317\n        else {\n            let startContainer = range.startContainer;\n            if (isText(startContainer)) {\n                startContainer = startContainer.parentNode;\n            }\n            const rect = new Rect(startContainer.getBoundingClientRect());\n            rect.right = rect.left;\n            rect.width = 0;\n            rects.push(rect);\n        }\n        return rects;\n    }\n    /**\n     * Returns a bounding rectangle that contains all the given `rects`.\n     *\n     * @param rects A list of rectangles that should be contained in the result rectangle.\n     * @returns Bounding rectangle or `null` if no `rects` were given.\n     */\n    static getBoundingRect(rects) {\n        const boundingRectData = {\n            left: Number.POSITIVE_INFINITY,\n            top: Number.POSITIVE_INFINITY,\n            right: Number.NEGATIVE_INFINITY,\n            bottom: Number.NEGATIVE_INFINITY,\n            width: 0,\n            height: 0\n        };\n        let rectangleCount = 0;\n        for (const rect of rects) {\n            rectangleCount++;\n            boundingRectData.left = Math.min(boundingRectData.left, rect.left);\n            boundingRectData.top = Math.min(boundingRectData.top, rect.top);\n            boundingRectData.right = Math.max(boundingRectData.right, rect.right);\n            boundingRectData.bottom = Math.max(boundingRectData.bottom, rect.bottom);\n        }\n        if (rectangleCount == 0) {\n            return null;\n        }\n        boundingRectData.width = boundingRectData.right - boundingRectData.left;\n        boundingRectData.height = boundingRectData.bottom - boundingRectData.top;\n        return new Rect(boundingRectData);\n    }\n}\n/**\n * Acquires all the rect properties from the passed source.\n */\nfunction copyRectProperties(rect, source) {\n    for (const p of rectProperties) {\n        rect[p] = source[p];\n    }\n}\n/**\n * Checks if provided object is a <body> HTML element.\n */\nfunction isBody(value) {\n    if (!isDomElement(value)) {\n        return false;\n    }\n    return value === value.ownerDocument.body;\n}\n/**\n * Checks if provided object \"looks like\" a DOM Element and has API required by `Rect` class.\n */\nfunction isDomElement(value) {\n    // Note: earlier we used `isElement()` from lodash library, however that function is less performant because\n    // it makes complicated checks to make sure that given value is a DOM element.\n    return value !== null && typeof value === 'object' && value.nodeType === 1 && typeof value.getBoundingClientRect === 'function';\n}\n/**\n * Returns the value of the `position` style of an `HTMLElement`.\n */\nfunction getElementPosition(element) {\n    return element instanceof HTMLElement ? element.ownerDocument.defaultView.getComputedStyle(element).position : 'static';\n}\n/**\n * Returns the value of the `overflow` style of an `HTMLElement` or a `Range`.\n */\nfunction getElementOverflow(element) {\n    return element instanceof HTMLElement ? element.ownerDocument.defaultView.getComputedStyle(element).overflow : 'visible';\n}\n/**\n * For a given absolute Rect coordinates object and a positioned element ancestor, it updates its\n * coordinates that make up for the position and the scroll of the ancestor.\n *\n * This is necessary because while Rects (and DOMRects) are relative to the browser's viewport, their coordinates\n * are used in real–life to position elements with `position: absolute`, which are scoped by any positioned\n * (and scrollable) ancestors.\n */\nfunction shiftRectToCompensatePositionedAncestor(rect, positionedElementAncestor) {\n    const ancestorPosition = new Rect(positionedElementAncestor);\n    const ancestorBorderWidths = getBorderWidths(positionedElementAncestor);\n    let moveX = 0;\n    let moveY = 0;\n    // (https://github.com/ckeditor/ckeditor5-ui-default/issues/126)\n    // If there's some positioned ancestor of the panel, then its `Rect` must be taken into\n    // consideration. `Rect` is always relative to the viewport while `position: absolute` works\n    // with respect to that positioned ancestor.\n    moveX -= ancestorPosition.left;\n    moveY -= ancestorPosition.top;\n    // (https://github.com/ckeditor/ckeditor5-utils/issues/139)\n    // If there's some positioned ancestor of the panel, not only its position must be taken into\n    // consideration (see above) but also its internal scrolls. Scroll have an impact here because `Rect`\n    // is relative to the viewport (it doesn't care about scrolling), while `position: absolute`\n    // must compensate that scrolling.\n    moveX += positionedElementAncestor.scrollLeft;\n    moveY += positionedElementAncestor.scrollTop;\n    // (https://github.com/ckeditor/ckeditor5-utils/issues/139)\n    // If there's some positioned ancestor of the panel, then its `Rect` includes its CSS `borderWidth`\n    // while `position: absolute` positioning does not consider it.\n    // E.g. `{ position: absolute, top: 0, left: 0 }` means upper left corner of the element,\n    // not upper-left corner of its border.\n    moveX -= ancestorBorderWidths.left;\n    moveY -= ancestorBorderWidths.top;\n    rect.moveBy(moveX, moveY);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/resizeobserver\n */\nimport { global } from './global.js';\n/**\n * A helper class which instances allow performing custom actions when native DOM elements are resized.\n *\n * ```ts\n * const editableElement = editor.editing.view.getDomRoot();\n *\n * const observer = new ResizeObserver( editableElement, entry => {\n * \tconsole.log( 'The editable element has been resized in DOM.' );\n * \tconsole.log( entry.target ); // -> editableElement\n * \tconsole.log( entry.contentRect.width ); // -> e.g. '423px'\n * } );\n * ```\n *\n * It uses the [native DOM resize observer](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)\n * under the hood.\n */\nexport class ResizeObserver {\n    /**\n     * The element observed by this observer.\n     */\n    _element;\n    /**\n     * The callback executed each time {@link #_element} is resized.\n     */\n    _callback;\n    /**\n     * The single native observer instance shared across all {@link module:utils/dom/resizeobserver~ResizeObserver} instances.\n     */\n    static _observerInstance = null;\n    /**\n     * A mapping of native DOM elements and their callbacks shared across all\n     * {@link module:utils/dom/resizeobserver~ResizeObserver} instances.\n     */\n    static _elementCallbacks = null;\n    /**\n     * Creates an instance of the `ResizeObserver` class.\n     *\n     * @param element A DOM element that is to be observed for resizing. Note that\n     * the element must be visible (i.e. not detached from DOM) for the observer to work.\n     * @param callback A function called when the observed element was resized. It passes\n     * the [`ResizeObserverEntry`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry)\n     * object with information about the resize event.\n     */\n    constructor(element, callback) {\n        // **Note**: For the maximum performance, this class ensures only a single instance of the native\n        // observer is used no matter how many instances of this class were created.\n        if (!ResizeObserver._observerInstance) {\n            ResizeObserver._createObserver();\n        }\n        this._element = element;\n        this._callback = callback;\n        ResizeObserver._addElementCallback(element, callback);\n        ResizeObserver._observerInstance.observe(element);\n    }\n    /**\n     * The element observed by this observer.\n     */\n    get element() {\n        return this._element;\n    }\n    /**\n     * Destroys the observer which disables the `callback` passed to the {@link #constructor}.\n     */\n    destroy() {\n        ResizeObserver._deleteElementCallback(this._element, this._callback);\n    }\n    /**\n     * Registers a new resize callback for the DOM element.\n     */\n    static _addElementCallback(element, callback) {\n        if (!ResizeObserver._elementCallbacks) {\n            ResizeObserver._elementCallbacks = new Map();\n        }\n        let callbacks = ResizeObserver._elementCallbacks.get(element);\n        if (!callbacks) {\n            callbacks = new Set();\n            ResizeObserver._elementCallbacks.set(element, callbacks);\n        }\n        callbacks.add(callback);\n    }\n    /**\n     * Removes a resize callback from the DOM element. If no callbacks are left\n     * for the element, it removes the element from the native observer.\n     */\n    static _deleteElementCallback(element, callback) {\n        const callbacks = ResizeObserver._getElementCallbacks(element);\n        // Remove the element callback. Check if exist first in case someone\n        // called destroy() twice.\n        if (callbacks) {\n            callbacks.delete(callback);\n            // If no callbacks left for the element, also remove the element.\n            if (!callbacks.size) {\n                ResizeObserver._elementCallbacks.delete(element);\n                ResizeObserver._observerInstance.unobserve(element);\n            }\n        }\n        if (ResizeObserver._elementCallbacks && !ResizeObserver._elementCallbacks.size) {\n            ResizeObserver._observerInstance = null;\n            ResizeObserver._elementCallbacks = null;\n        }\n    }\n    /**\n     * Returns are registered resize callbacks for the DOM element.\n     */\n    static _getElementCallbacks(element) {\n        if (!ResizeObserver._elementCallbacks) {\n            return null;\n        }\n        return ResizeObserver._elementCallbacks.get(element);\n    }\n    /**\n     * Creates the single native observer shared across all `ResizeObserver` instances.\n     */\n    static _createObserver() {\n        ResizeObserver._observerInstance = new global.window.ResizeObserver(entries => {\n            for (const entry of entries) {\n                const callbacks = ResizeObserver._getElementCallbacks(entry.target);\n                if (callbacks) {\n                    for (const callback of callbacks) {\n                        callback(entry);\n                    }\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/setdatainelement\n */\n/**\n * Sets data in a given element.\n *\n * @param el The element in which the data will be set.\n * @param data The data string.\n */\nexport function setDataInElement(el, data) {\n    if (el instanceof HTMLTextAreaElement) {\n        el.value = data;\n    }\n    el.innerHTML = data;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/tounit\n */\n/**\n * Returns a helper function, which adds a desired trailing\n * `unit` to the passed value.\n *\n * @param unit An unit like \"px\" or \"em\".\n */\nexport function toUnit(unit) {\n    return value => value + unit;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/indexof\n */\n/**\n * Returns index of the node in the parent element.\n *\n * @param node Node which index is tested.\n * @returns Index of the node in the parent element. Returns 0 if node has no parent.\n */\nexport function indexOf(node) {\n    let index = 0;\n    while (node.previousSibling) {\n        node = node.previousSibling;\n        index++;\n    }\n    return index;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/insertat\n */\n/**\n * Inserts node to the parent at given index.\n *\n * @param parentElement Parent element.\n * @param index Insertions index.\n * @param nodeToInsert Node to insert.\n */\nexport function insertAt(parentElement, index, nodeToInsert) {\n    parentElement.insertBefore(nodeToInsert, parentElement.childNodes[index] || null);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/iscomment\n */\n/**\n * Checks whether the object is a native DOM Comment node.\n */\nexport function isComment(obj) {\n    return obj && obj.nodeType === Node.COMMENT_NODE;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/isvalidattributename\n */\nimport { global } from './global.js';\n/**\n * Checks if the given attribute name is valid in terms of HTML.\n *\n * @param name Attribute name.\n */\nexport function isValidAttributeName(name) {\n    try {\n        global.document.createAttribute(name);\n    }\n    catch {\n        return false;\n    }\n    return true;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/isvisible\n */\nimport { isText } from './istext.js';\n/**\n * Checks whether the element is visible to the user in DOM:\n *\n * * connected to the root of the document,\n * * has no `display: none`,\n * * has no ancestors with `display: none`.\n *\n * **Note**: This helper does not check whether the element is hidden by cropping, overflow, etc..\n * To check that, use {@link module:utils/dom/rect~Rect} instead.\n */\nexport function isVisible(element) {\n    if (!element) {\n        return false;\n    }\n    if (isText(element)) {\n        return isVisible(element.parentElement);\n    }\n    if (element.getClientRects) {\n        return !!(element.getClientRects().length);\n    }\n    return false;\n}\n","function isFunction(value) {\n    return typeof value === 'function';\n}\n\nexport { isFunction };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/position\n */\nimport { global } from './global.js';\nimport { Rect } from './rect.js';\nimport { getPositionedAncestor } from './getpositionedancestor.js';\nimport { isFunction } from 'es-toolkit/compat';\n// @if CK_DEBUG_POSITION // const {\n// @if CK_DEBUG_POSITION // \tdefault: RectDrawer,\n// @if CK_DEBUG_POSITION // \tdiagonalStylesBlack,\n// @if CK_DEBUG_POSITION // \tdiagonalStylesGreen,\n// @if CK_DEBUG_POSITION // \tdiagonalStylesRed\n// @if CK_DEBUG_POSITION // } = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' );\n// @if CK_DEBUG_POSITION // const TARGET_RECT_STYLE = {\n// @if CK_DEBUG_POSITION // \toutlineWidth: '2px', outlineStyle: 'dashed', outlineColor: 'blue', outlineOffset: '2px'\n// @if CK_DEBUG_POSITION // };\n// @if CK_DEBUG_POSITION // const VISIBLE_TARGET_RECT_STYLE = {\n// @if CK_DEBUG_POSITION //\t\t...diagonalStylesBlack,\n// @if CK_DEBUG_POSITION //\t\topacity: '1',\n// @if CK_DEBUG_POSITION //\t\tbackgroundColor: '#00000033',\n// @if CK_DEBUG_POSITION //\t\toutlineWidth: '2px'\n// @if CK_DEBUG_POSITION // };\n// @if CK_DEBUG_POSITION // const VIEWPORT_RECT_STYLE = {\n// @if CK_DEBUG_POSITION // \toutlineWidth: '2px',\n// @if CK_DEBUG_POSITION // \toutlineOffset: '-2px',\n// @if CK_DEBUG_POSITION // \toutlineStyle: 'solid',\n// @if CK_DEBUG_POSITION // \toutlineColor: 'red'\n// @if CK_DEBUG_POSITION // };\n// @if CK_DEBUG_POSITION // const VISIBLE_LIMITER_RECT_STYLE = {\n// @if CK_DEBUG_POSITION // \t...diagonalStylesGreen,\n// @if CK_DEBUG_POSITION // \toutlineWidth: '2px',\n// @if CK_DEBUG_POSITION // \toutlineOffset: '-2px'\n// @if CK_DEBUG_POSITION // };\n// @if CK_DEBUG_POSITION // const ELEMENT_RECT_STYLE = {\n// @if CK_DEBUG_POSITION // \toutlineWidth: '2px', outlineColor: 'orange', outlineOffset: '-2px'\n// @if CK_DEBUG_POSITION // };\n// @if CK_DEBUG_POSITION // const CHOSEN_POSITION_RECT_STYLE = {\n// @if CK_DEBUG_POSITION // \topacity: .5, outlineColor: 'magenta', backgroundColor: 'magenta'\n// @if CK_DEBUG_POSITION // };\n/**\n * Calculates the `position: absolute` coordinates of a given element so it can be positioned with respect to the\n * target in the visually most efficient way, taking various restrictions like viewport or limiter geometry\n * into consideration.\n *\n * **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper),\n * `null` is returned.\n *\n * ```ts\n * // The element which is to be positioned.\n * const element = document.body.querySelector( '#toolbar' );\n *\n * // A target to which the element is positioned relatively.\n * const target = document.body.querySelector( '#container' );\n *\n * // Finding the optimal coordinates for the positioning.\n * const { left, top, name } = getOptimalPosition( {\n * \telement: element,\n * \ttarget: target,\n *\n * \t// The algorithm will chose among these positions to meet the requirements such\n * \t// as \"limiter\" element or \"fitInViewport\", set below. The positions are considered\n * \t// in the order of the array.\n * \tpositions: [\n * \t\t//\n * \t \t//\t[ Target ]\n * \t\t//\t+-----------------+\n * \t\t//\t|     Element     |\n * \t\t//\t+-----------------+\n * \t\t//\n * \t\ttargetRect => ( {\n * \t\t\ttop: targetRect.bottom,\n * \t\t\tleft: targetRect.left,\n * \t\t\tname: 'mySouthEastPosition'\n * \t\t} ),\n *\n * \t\t//\n * \t\t//\t+-----------------+\n * \t\t//\t|     Element     |\n * \t\t//\t+-----------------+\n * \t\t//\t[ Target ]\n * \t\t//\n * \t\t( targetRect, elementRect ) => ( {\n * \t\t\ttop: targetRect.top - elementRect.height,\n * \t\t\tleft: targetRect.left,\n * \t\t\tname: 'myNorthEastPosition'\n * \t\t} )\n * \t],\n *\n * \t// Find a position such guarantees the element remains within visible boundaries of <body>.\n * \tlimiter: document.body,\n *\n * \t// Find a position such guarantees the element remains within visible boundaries of the browser viewport.\n * \tfitInViewport: true\n * } );\n *\n * // The best position which fits into document.body and the viewport. May be useful\n * // to set proper class on the `element`.\n * console.log( name ); // -> \"myNorthEastPosition\"\n *\n * // Using the absolute coordinates which has been found to position the element\n * // as in the diagram depicting the \"myNorthEastPosition\" position.\n * element.style.top = top;\n * element.style.left = left;\n * ```\n *\n * @param options The input data and configuration of the helper.\n */\nexport function getOptimalPosition({ element, target, positions, limiter, fitInViewport, viewportOffsetConfig }) {\n    // If the {@link module:utils/dom/position~Options#target} is a function, use what it returns.\n    // https://github.com/ckeditor/ckeditor5-utils/issues/157\n    if (isFunction(target)) {\n        target = target();\n    }\n    // If the {@link module:utils/dom/position~Options#limiter} is a function, use what it returns.\n    // https://github.com/ckeditor/ckeditor5-ui/issues/260\n    if (isFunction(limiter)) {\n        limiter = limiter();\n    }\n    const positionedElementAncestor = getPositionedAncestor(element);\n    const constrainedViewportRect = getConstrainedViewportRect(viewportOffsetConfig);\n    const elementRect = new Rect(element);\n    const visibleTargetRect = getVisibleViewportIntersectionRect(target, constrainedViewportRect);\n    let bestPosition;\n    // @if CK_DEBUG_POSITION // const targetRect = new Rect( target );\n    // @if CK_DEBUG_POSITION // RectDrawer.clear();\n    // @if CK_DEBUG_POSITION // RectDrawer.draw( targetRect, TARGET_RECT_STYLE, 'Target' );\n    // @if CK_DEBUG_POSITION // if ( constrainedViewportRect ) {\n    // @if CK_DEBUG_POSITION //\t\tRectDrawer.draw( constrainedViewportRect, VIEWPORT_RECT_STYLE, 'Viewport' );\n    // @if CK_DEBUG_POSITION // }\n    // If the target got cropped by ancestors or went off the screen, positioning does not make any sense.\n    if (!visibleTargetRect || !constrainedViewportRect.getIntersection(visibleTargetRect)) {\n        return null;\n    }\n    // @if CK_DEBUG_POSITION //\tRectDrawer.draw( visibleTargetRect, VISIBLE_TARGET_RECT_STYLE, 'VisTgt' );\n    const positionOptions = {\n        targetRect: visibleTargetRect,\n        elementRect,\n        positionedElementAncestor,\n        viewportRect: constrainedViewportRect\n    };\n    // If there are no limits, just grab the very first position and be done with that drama.\n    if (!limiter && !fitInViewport) {\n        bestPosition = new PositionObject(positions[0], positionOptions);\n    }\n    else {\n        if (limiter) {\n            const visibleLimiterRect = getVisibleViewportIntersectionRect(limiter, constrainedViewportRect);\n            if (visibleLimiterRect) {\n                positionOptions.limiterRect = visibleLimiterRect;\n                // @if CK_DEBUG_POSITION // RectDrawer.draw( visibleLimiterRect, VISIBLE_LIMITER_RECT_STYLE, 'VisLim' );\n            }\n        }\n        // If there's no best position found, i.e. when all intersections have no area because\n        // rects have no width or height, then just return `null`\n        bestPosition = getBestPosition(positions, positionOptions);\n    }\n    return bestPosition;\n}\n/**\n * Returns intersection of visible source `Rect` with Viewport `Rect`. In case when source `Rect` is not visible\n * or there is no intersection between source `Rect` and Viewport `Rect`, `null` will be returned.\n */\nfunction getVisibleViewportIntersectionRect(source, viewportRect) {\n    const visibleSourceRect = new Rect(source).getVisible();\n    if (!visibleSourceRect) {\n        return null;\n    }\n    return visibleSourceRect.getIntersection(viewportRect);\n}\n/**\n * Returns a viewport `Rect` shrunk by the viewport offset config from all sides.\n */\nexport function getConstrainedViewportRect(viewportOffsetConfig) {\n    viewportOffsetConfig = Object.assign({ top: 0, bottom: 0, left: 0, right: 0 }, viewportOffsetConfig);\n    const viewportRect = new Rect(global.window);\n    viewportRect.top += viewportOffsetConfig.top;\n    viewportRect.height -= viewportOffsetConfig.top;\n    viewportRect.bottom -= viewportOffsetConfig.bottom;\n    viewportRect.height -= viewportOffsetConfig.bottom;\n    viewportRect.left += viewportOffsetConfig.left;\n    viewportRect.right -= viewportOffsetConfig.right;\n    viewportRect.width -= viewportOffsetConfig.left + viewportOffsetConfig.right;\n    return viewportRect;\n}\n/**\n * For a given array of positioning functions, returns such that provides the best\n * fit of the `elementRect` into the `limiterRect` and `viewportRect`.\n */\nfunction getBestPosition(positions, options) {\n    const { elementRect } = options;\n    // This is when element is fully visible.\n    const elementRectArea = elementRect.getArea();\n    const positionInstances = positions\n        .map(positioningFunction => new PositionObject(positioningFunction, options))\n        // Some positioning functions may return `null` if they don't want to participate.\n        .filter(position => !!position.name);\n    let maxFitFactor = 0;\n    let bestPosition = null;\n    for (const position of positionInstances) {\n        const { limiterIntersectionArea, viewportIntersectionArea } = position;\n        // If a such position is found that element is fully contained by the limiter then, obviously,\n        // there will be no better one, so finishing.\n        if (limiterIntersectionArea === elementRectArea) {\n            // @if CK_DEBUG_POSITION //\tRectDrawer.draw( position._rect, CHOSEN_POSITION_RECT_STYLE, [\n            // @if CK_DEBUG_POSITION //\t\tposition.name,\n            // @if CK_DEBUG_POSITION //\t\t'100% fit',\n            // @if CK_DEBUG_POSITION //\t].join( '\\n' ) );\n            return position;\n        }\n        // To maximize both viewport and limiter intersection areas we use distance on _viewportIntersectionArea\n        // and _limiterIntersectionArea plane (without sqrt because we are looking for max value).\n        const fitFactor = viewportIntersectionArea ** 2 + limiterIntersectionArea ** 2;\n        // @if CK_DEBUG_POSITION //\tRectDrawer.draw( position._rect, { opacity: .4 }, [\n        // @if CK_DEBUG_POSITION //\t\tposition.name,\n        // @if CK_DEBUG_POSITION //\t\t'Vi=' +  Math.round( viewportIntersectionArea ),\n        // @if CK_DEBUG_POSITION //\t\t'Li=' + Math.round( limiterIntersectionArea )\n        // @if CK_DEBUG_POSITION //\t].join( '\\n' ) );\n        if (fitFactor > maxFitFactor) {\n            maxFitFactor = fitFactor;\n            bestPosition = position;\n        }\n    }\n    // @if CK_DEBUG_POSITION // if ( bestPosition ) {\n    // @if CK_DEBUG_POSITION // \tRectDrawer.draw( bestPosition._rect, CHOSEN_POSITION_RECT_STYLE );\n    // @if CK_DEBUG_POSITION // }\n    return bestPosition;\n}\n/**\n * A position class which instances are created and used by the {@link module:utils/dom/position~getOptimalPosition} helper.\n *\n * {@link module:utils/dom/position~Position#top} and {@link module:utils/dom/position~Position#left} properties of the position instance\n * translate directly to the `top` and `left` properties in CSS \"`position: absolute` coordinate system\". If set on the positioned element\n * in DOM, they will make it display it in the right place in the viewport.\n */\nclass PositionObject {\n    name;\n    config;\n    _positioningFunctionCoordinates;\n    _options;\n    _cachedRect;\n    _cachedAbsoluteRect;\n    /**\n     * Creates an instance of the {@link module:utils/dom/position~PositionObject} class.\n     *\n     * @param positioningFunction function The function that defines the expected\n     * coordinates the positioned element should move to.\n     * @param options options object.\n     * @param options.elementRect The positioned element rect.\n     * @param options.targetRect The target element rect.\n     * @param options.viewportRect The viewport rect.\n     * @param options.limiterRect The limiter rect.\n     * @param options.positionedElementAncestor Nearest element ancestor element which CSS position is not \"static\".\n     */\n    constructor(positioningFunction, options) {\n        const positioningFunctionOutput = positioningFunction(options.targetRect, options.elementRect, options.viewportRect, options.limiterRect);\n        // Nameless position for a function that didn't participate.\n        if (!positioningFunctionOutput) {\n            return;\n        }\n        const { left, top, name, config } = positioningFunctionOutput;\n        this.name = name;\n        this.config = config;\n        this._positioningFunctionCoordinates = { left, top };\n        this._options = options;\n    }\n    /**\n     * The left value in pixels in the CSS `position: absolute` coordinate system.\n     * Set it on the positioned element in DOM to move it to the position.\n     */\n    get left() {\n        return this._absoluteRect.left;\n    }\n    /**\n     * The top value in pixels in the CSS `position: absolute` coordinate system.\n     * Set it on the positioned element in DOM to move it to the position.\n     */\n    get top() {\n        return this._absoluteRect.top;\n    }\n    /**\n     * An intersection area between positioned element and limiter within viewport constraints.\n     */\n    get limiterIntersectionArea() {\n        const limiterRect = this._options.limiterRect;\n        if (limiterRect) {\n            return limiterRect.getIntersectionArea(this._rect);\n        }\n        return 0;\n    }\n    /**\n     * An intersection area between positioned element and viewport.\n     */\n    get viewportIntersectionArea() {\n        const viewportRect = this._options.viewportRect;\n        return viewportRect.getIntersectionArea(this._rect);\n    }\n    /**\n     * An already positioned element rect. A clone of the element rect passed to the constructor\n     * but placed in the viewport according to the positioning function.\n     */\n    get _rect() {\n        if (this._cachedRect) {\n            return this._cachedRect;\n        }\n        this._cachedRect = this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left, this._positioningFunctionCoordinates.top);\n        return this._cachedRect;\n    }\n    /**\n     * An already absolutely positioned element rect. See ({@link #_rect}).\n     */\n    get _absoluteRect() {\n        if (this._cachedAbsoluteRect) {\n            return this._cachedAbsoluteRect;\n        }\n        this._cachedAbsoluteRect = this._rect.toAbsoluteRect();\n        return this._cachedAbsoluteRect;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/remove\n */\n/**\n * Removes given node from parent.\n *\n * @param node Node to remove.\n */\nexport function remove(node) {\n    const parent = node.parentNode;\n    if (parent) {\n        parent.removeChild(node);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/getvisualviewportoffset\n */\nimport { global } from './global.js';\nimport { env } from '../env.js';\n/**\n * Returns the visual viewport offsets to adjust elements with `position: fixed` style.\n */\nexport function getVisualViewportOffset() {\n    const visualViewport = global.window.visualViewport;\n    if (!visualViewport || !(env.isiOS || env.isSafari)) {\n        return { left: 0, top: 0 };\n    }\n    const left = Math.max(Math.round(visualViewport.offsetLeft), 0);\n    const top = Math.max(Math.round(visualViewport.offsetTop), 0);\n    return { left, top };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/scroll\n */\nimport { isRange } from './isrange.js';\nimport { Rect } from './rect.js';\nimport { isText } from './istext.js';\n/**\n * Makes any page `HTMLElement` or `Range` (`target`) visible inside the browser viewport.\n * This helper will scroll all `target` ancestors and the web browser viewport to reveal the target to\n * the user. If the `target` is already visible, nothing will happen.\n *\n * @param options Additional configuration of the scrolling behavior.\n * @param options.target A target, which supposed to become visible to the user.\n * @param options.viewportOffset An offset from the edge of the viewport (in pixels)\n * the `target` will be moved by if the viewport is scrolled. It enhances the user experience\n * by keeping the `target` some distance from the edge of the viewport and thus making it easier to\n * read or edit by the user.\n * @param options.ancestorOffset An offset from the boundary of scrollable ancestors (if any)\n * the `target` will be moved by if the viewport is scrolled. It enhances the user experience\n * by keeping the `target` some distance from the edge of the ancestors and thus making it easier to\n * read or edit by the user.\n * @param options.alignToTop When set `true`, the helper will make sure the `target` is scrolled up\n * to the top boundary of the viewport and/or scrollable ancestors if scrolled up. When not set\n * (default), the `target` will be revealed by scrolling as little as possible. This option will\n * not affect `targets` that must be scrolled down because they will appear at the top of the boundary\n * anyway.\n *\n * ```\n *                                             scrollViewportToShowTarget() with            scrollViewportToShowTarget() with\n *          Initial state                        alignToTop unset (default)                        alignToTop = true\n *\n * ┌────────────────────────────────┬─┐       ┌────────────────────────────────┬─┐        ┌────────────────────────────────┬─┐\n * │                                │▲│       │                                │▲│        │   [ Target to be revealed ]    │▲│\n * │                                │ │       │                                │ │        │                                │ │\n * │                                │█│       │                                │ │        │                                │ │\n * │                                │█│       │                                │ │        │                                │ │\n * │                                │ │       │                                │█│        │                                │ │\n * │                                │ │       │                                │█│        │                                │█│\n * │                                │ │       │                                │ │        │                                │█│\n * │                                │▼│       │   [ Target to be revealed ]    │▼│        │                                │▼│\n * └────────────────────────────────┴─┘       └────────────────────────────────┴─┘        └────────────────────────────────┴─┘\n *\n *\n *     [ Target to be revealed ]\n *```\n *\n * @param options.forceScroll When set `true`, the `target` will be aligned to the top of the viewport\n * and scrollable ancestors whether it is already visible or not. This option will only work when `alignToTop`\n * is `true`\n */\nexport function scrollViewportToShowTarget({ target, viewportOffset = 0, ancestorOffset = 0, alignToTop, forceScroll }) {\n    const targetWindow = getWindow(target);\n    let currentWindow = targetWindow;\n    let currentFrame = null;\n    viewportOffset = normalizeViewportOffset(viewportOffset);\n    // Iterate over all windows, starting from target's parent window up to window#top.\n    while (currentWindow) {\n        let firstAncestorToScroll;\n        // Let's scroll target's ancestors first to reveal it. Then, once the ancestor scrolls\n        // settled down, the algorithm can eventually scroll the viewport of the current window.\n        //\n        // Note: If the current window is target's **original** window (e.g. the first one),\n        // start scrolling the closest parent of the target. If not, scroll the closest parent\n        // of an iframe that resides in the current window.\n        if (currentWindow == targetWindow) {\n            firstAncestorToScroll = getParentElement(target);\n        }\n        else {\n            firstAncestorToScroll = getParentElement(currentFrame);\n        }\n        // Scroll the target's ancestors first. Once done, scrolling the viewport is easy.\n        scrollAncestorsToShowRect({\n            parent: firstAncestorToScroll,\n            getRect: () => {\n                // Note: If the target does not belong to the current window **directly**,\n                // i.e. it resides in an iframe belonging to the window, obtain the target's rect\n                // in the coordinates of the current window. By default, a Rect returns geometry\n                // relative to the current window's viewport. To make it work in a parent window,\n                // it must be shifted.\n                return getRectRelativeToWindow(target, currentWindow);\n            },\n            alignToTop,\n            ancestorOffset,\n            forceScroll\n        });\n        // Obtain the rect of the target after it has been scrolled within its ancestors.\n        // It's time to scroll the viewport.\n        let targetRect = getRectRelativeToWindow(target, currentWindow);\n        // Detect situation where the target is higher than the first scrollable ancestor.\n        // In such case scrolling the viewport to reveal the target might be malfunctioning because\n        // the target `.top` position is lower than the ancestor's `.top` position. If it's large enough it can be negative.\n        // It causes the `scrollWindowToShowRect` to scroll the viewport to the negative top position which is not possible\n        // and leads to the viewport being scrolled to the absolute top of the document. To prevent this, the target's rect\n        // must be shifted to the ancestor's top position. It should not affect the target's visibility because the ancestor\n        // is already scrolled to reveal the target.\n        // See more: https://github.com/ckeditor/ckeditor5/issues/17079\n        const ancestorWindowRelativeRect = getRectRelativeToWindow(firstAncestorToScroll, currentWindow);\n        if (targetRect.height > ancestorWindowRelativeRect.height) {\n            const ancestorTargetIntersection = targetRect.getIntersection(ancestorWindowRelativeRect);\n            if (ancestorTargetIntersection) {\n                targetRect = ancestorTargetIntersection;\n            }\n        }\n        scrollWindowToShowRect({\n            window: currentWindow,\n            rect: targetRect,\n            viewportOffset,\n            alignToTop,\n            forceScroll\n        });\n        if (currentWindow.parent != currentWindow) {\n            // Keep the reference to the <iframe> element the \"previous current window\" was\n            // rendered within. It will be useful to re–calculate the rect of the target\n            // in the parent window's relative geometry. The target's rect must be shifted\n            // by it's iframe's position.\n            currentFrame = currentWindow.frameElement;\n            currentWindow = currentWindow.parent;\n            // If the current window has some parent but frameElement is inaccessible, then they have\n            // different domains/ports and, due to security reasons, accessing and scrolling\n            // the parent window won't be possible.\n            // See https://github.com/ckeditor/ckeditor5/issues/930.\n            if (!currentFrame) {\n                return;\n            }\n        }\n        else {\n            currentWindow = null;\n        }\n    }\n}\n/**\n * Makes any page `HTMLElement` or `Range` (target) visible within its scrollable ancestors,\n * e.g. if they have `overflow: scroll` CSS style.\n *\n * @param target A target, which supposed to become visible to the user.\n * @param ancestorOffset An offset between the target and the boundary of scrollable ancestors\n * to be maintained while scrolling.\n * @param limiterElement The outermost ancestor that should be scrolled. If specified, it can prevent\n * scrolling the whole page.\n */\nexport function scrollAncestorsToShowTarget(target, ancestorOffset, limiterElement) {\n    const targetParent = getParentElement(target);\n    scrollAncestorsToShowRect({\n        parent: targetParent,\n        getRect: () => new Rect(target),\n        ancestorOffset,\n        limiterElement\n    });\n}\n/**\n * Makes a given rect visible within its parent window.\n *\n * Note: Avoid the situation where the caret is still in the viewport, but totally\n * at the edge of it. In such situation, if it moved beyond the viewport in the next\n * action e.g. after paste, the scrolling would move it to the viewportOffset level\n * and it all would look like the caret visually moved up/down:\n *\n * 1.\n * ```\n * | foo[]\n * |                                    <--- N px of space below the caret\n * +---------------------------------...\n * ```\n *\n * 2. *paste*\n * 3.\n * ```\n * |\n * |\n * +-foo-----------------------------...\n *   bar[]                              <--- caret below viewport, scrolling...\n * ```\n *\n * 4. *scrolling*\n * 5.\n * ```\n * |\n * | foo\n * | bar[]                              <--- caret precisely at the edge\n * +---------------------------------...\n * ```\n *\n * To prevent this, this method checks the rects moved by the viewportOffset to cover\n * the upper/lower edge of the viewport. It makes sure if the action repeats, there's\n * no twitching – it's a purely visual improvement:\n *\n * 5. (after fix)\n * ```\n * |\n * | foo\n * | bar[]\n * |                                    <--- N px of space below the caret\n * +---------------------------------...\n * ```\n *\n * @param options Additional configuration of the scrolling behavior.\n * @param options.window A window which is scrolled to reveal the rect.\n * @param options.rect A rect which is to be revealed.\n * @param options.viewportOffset An offset from the edge of the viewport (in pixels) the `rect` will be\n * moved by if the viewport is scrolled.\n * @param options.alignToTop When set `true`, the helper will make sure the `rect` is scrolled up\n * to the top boundary of the viewport if scrolled up. When not set (default), the `rect` will be\n * revealed by scrolling as little as possible. This option will not affect rects that must be scrolled\n * down because they will appear at the top of the boundary anyway.\n * @param options.forceScroll When set `true`, the `rect` will be aligned to the top of the viewport\n * whether it is already visible or not. This option will only work when `alignToTop` is `true`\n */\nfunction scrollWindowToShowRect({ window, rect, alignToTop, forceScroll, viewportOffset }) {\n    const targetShiftedDownRect = rect.clone().moveBy(0, viewportOffset.bottom);\n    const targetShiftedUpRect = rect.clone().moveBy(0, -viewportOffset.top);\n    const viewportRect = new Rect(window).excludeScrollbarsAndBorders();\n    const rects = [targetShiftedUpRect, targetShiftedDownRect];\n    const forceScrollToTop = alignToTop && forceScroll;\n    const allRectsFitInViewport = rects.every(rect => viewportRect.contains(rect));\n    let { scrollX, scrollY } = window;\n    const initialScrollX = scrollX;\n    const initialScrollY = scrollY;\n    if (forceScrollToTop) {\n        scrollY -= (viewportRect.top - rect.top) + viewportOffset.top;\n    }\n    else if (!allRectsFitInViewport) {\n        if (isAbove(targetShiftedUpRect, viewportRect)) {\n            scrollY -= viewportRect.top - rect.top + viewportOffset.top;\n        }\n        else if (isBelow(targetShiftedDownRect, viewportRect)) {\n            if (alignToTop) {\n                scrollY += rect.top - viewportRect.top - viewportOffset.top;\n            }\n            else {\n                scrollY += rect.bottom - viewportRect.bottom + viewportOffset.bottom;\n            }\n        }\n    }\n    if (!allRectsFitInViewport) {\n        // TODO: Web browsers scroll natively to place the target in the middle\n        // of the viewport. It's not a very popular case, though.\n        if (isLeftOf(rect, viewportRect)) {\n            scrollX -= viewportRect.left - rect.left + viewportOffset.left;\n        }\n        else if (isRightOf(rect, viewportRect)) {\n            scrollX += rect.right - viewportRect.right + viewportOffset.right;\n        }\n    }\n    if (scrollX != initialScrollX || scrollY !== initialScrollY) {\n        window.scrollTo(scrollX, scrollY);\n    }\n}\n/**\n * Recursively scrolls element ancestors to visually reveal a rect.\n *\n * @param options Additional configuration of the scrolling behavior.\n * @param options.parent The first parent ancestor to start scrolling.\n * @param options.getRect A function which returns the Rect, which is to be revealed.\n * @param options.ancestorOffset An offset from the boundary of scrollable ancestors (if any)\n * the `Rect` instance will be moved by if the viewport is scrolled.\n * @param options.alignToTop When set `true`, the helper will make sure the `Rect` instance is scrolled up\n * to the top boundary of the scrollable ancestors if scrolled up. When not set (default), the `rect`\n * will be revealed by scrolling as little as possible. This option will not affect rects that must be\n * scrolled down because they will appear at the top of the boundary\n * anyway.\n * @param options.forceScroll When set `true`, the `rect` will be aligned to the top of scrollable ancestors\n * whether it is already visible or not. This option will only work when `alignToTop` is `true`\n * @param options.limiterElement The outermost ancestor that should be scrolled. Defaults to the `<body>` element.\n */\nfunction scrollAncestorsToShowRect({ parent, getRect, alignToTop, forceScroll, ancestorOffset = 0, limiterElement }) {\n    const parentWindow = getWindow(parent);\n    const forceScrollToTop = alignToTop && forceScroll;\n    let parentRect, targetRect, targetFitsInTarget;\n    const limiter = limiterElement || parentWindow.document.body;\n    while (parent != limiter) {\n        targetRect = getRect();\n        parentRect = new Rect(parent).excludeScrollbarsAndBorders();\n        targetFitsInTarget = parentRect.contains(targetRect);\n        if (forceScrollToTop) {\n            parent.scrollTop -= (parentRect.top - targetRect.top) + ancestorOffset;\n        }\n        else if (!targetFitsInTarget) {\n            if (isAbove(targetRect, parentRect)) {\n                parent.scrollTop -= parentRect.top - targetRect.top + ancestorOffset;\n            }\n            else if (isBelow(targetRect, parentRect)) {\n                if (alignToTop) {\n                    parent.scrollTop += targetRect.top - parentRect.top - ancestorOffset;\n                }\n                else {\n                    parent.scrollTop += targetRect.bottom - parentRect.bottom + ancestorOffset;\n                }\n            }\n        }\n        if (!targetFitsInTarget) {\n            if (isLeftOf(targetRect, parentRect)) {\n                parent.scrollLeft -= parentRect.left - targetRect.left + ancestorOffset;\n            }\n            else if (isRightOf(targetRect, parentRect)) {\n                parent.scrollLeft += targetRect.right - parentRect.right + ancestorOffset;\n            }\n        }\n        parent = parent.parentNode;\n    }\n}\n/**\n * Determines if a given `Rect` extends beyond the bottom edge of the second `Rect`.\n */\nfunction isBelow(firstRect, secondRect) {\n    return firstRect.bottom > secondRect.bottom;\n}\n/**\n * Determines if a given `Rect` extends beyond the top edge of the second `Rect`.\n */\nfunction isAbove(firstRect, secondRect) {\n    return firstRect.top < secondRect.top;\n}\n/**\n * Determines if a given `Rect` extends beyond the left edge of the second `Rect`.\n */\nfunction isLeftOf(firstRect, secondRect) {\n    return firstRect.left < secondRect.left;\n}\n/**\n * Determines if a given `Rect` extends beyond the right edge of the second `Rect`.\n */\nfunction isRightOf(firstRect, secondRect) {\n    return firstRect.right > secondRect.right;\n}\n/**\n * Returns the closest window of an element or range.\n */\nfunction getWindow(elementOrRange) {\n    if (isRange(elementOrRange)) {\n        return elementOrRange.startContainer.ownerDocument.defaultView;\n    }\n    else {\n        return elementOrRange.ownerDocument.defaultView;\n    }\n}\n/**\n * Returns the closest parent of an element or DOM range.\n */\nfunction getParentElement(elementOrRange) {\n    if (isRange(elementOrRange)) {\n        let parent = elementOrRange.commonAncestorContainer;\n        // If a Range is attached to the Text, use the closest element ancestor.\n        if (isText(parent)) {\n            parent = parent.parentNode;\n        }\n        return parent;\n    }\n    else {\n        return elementOrRange.parentNode;\n    }\n}\n/**\n * Returns the rect of an element or range residing in an iframe.\n * The result rect is relative to the geometry of the passed window instance.\n *\n * @param target Element or range which rect should be returned.\n * @param relativeWindow A window the rect should be relative to.\n */\nfunction getRectRelativeToWindow(target, relativeWindow) {\n    const targetWindow = getWindow(target);\n    const rect = new Rect(target);\n    if (targetWindow === relativeWindow) {\n        return rect;\n    }\n    else {\n        let currentWindow = targetWindow;\n        while (currentWindow != relativeWindow) {\n            const frame = currentWindow.frameElement;\n            const frameRect = new Rect(frame).excludeScrollbarsAndBorders();\n            rect.moveBy(frameRect.left, frameRect.top);\n            currentWindow = currentWindow.parent;\n        }\n    }\n    return rect;\n}\n/**\n * A helper that explodes the `viewportOffset` configuration if defined as a plain number into an object\n * with `top`, `bottom`, `left`, and `right` properties.\n *\n * If an object value is passed, this helper will pass it through.\n *\n * @param viewportOffset Viewport offset to be normalized.\n */\nfunction normalizeViewportOffset(viewportOffset) {\n    if (typeof viewportOffset === 'number') {\n        return {\n            top: viewportOffset,\n            bottom: viewportOffset,\n            left: viewportOffset,\n            right: viewportOffset\n        };\n    }\n    return viewportOffset;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { CKEditorError } from './ckeditorerror.js';\nimport { env } from './env.js';\nconst modifiersToGlyphsMac = {\n    ctrl: '⌃',\n    cmd: '⌘',\n    alt: '⌥',\n    shift: '⇧'\n};\nconst modifiersToGlyphsNonMac = {\n    ctrl: 'Ctrl+',\n    alt: 'Alt+',\n    shift: 'Shift+'\n};\nconst keyCodesToGlyphs = {\n    37: '←',\n    38: '↑',\n    39: '→',\n    40: '↓',\n    9: '⇥',\n    33: 'Page Up',\n    34: 'Page Down'\n};\n/**\n * An object with `keyName => keyCode` pairs for a set of known keys.\n *\n * Contains:\n *\n * * `a-z`,\n * * `0-9`,\n * * `f1-f12`,\n * * `` ` ``, `-`, `=`, `[`, `]`, `;`, `'`, `,`, `.`, `/`, `\\`,\n * * `arrow(left|up|right|bottom)`,\n * * `backspace`, `delete`, `end`, `enter`, `esc`, `home`, `tab`,\n * * `ctrl`, `cmd`, `shift`, `alt`.\n */\nexport const keyCodes = /* #__PURE__ */ generateKnownKeyCodes();\nconst keyCodeNames = /* #__PURE__ */ Object.fromEntries(\n/* #__PURE__ */ Object.entries(keyCodes).map(([name, code]) => {\n    let prettyKeyName;\n    if (code in keyCodesToGlyphs) {\n        prettyKeyName = keyCodesToGlyphs[code];\n    }\n    else {\n        prettyKeyName = name.charAt(0).toUpperCase() + name.slice(1);\n    }\n    return [code, prettyKeyName];\n}));\n/**\n * Converts a key name or {@link module:utils/keyboard~KeystrokeInfo keystroke info} into a key code.\n *\n * Note: Key names are matched with {@link module:utils/keyboard#keyCodes} in a case-insensitive way.\n *\n * @param key A key name (see {@link module:utils/keyboard#keyCodes}) or a keystroke data object.\n * @returns Key or keystroke code.\n */\nexport function getCode(key) {\n    let keyCode;\n    if (typeof key == 'string') {\n        keyCode = keyCodes[key.toLowerCase()];\n        if (!keyCode) {\n            /**\n             * Unknown key name. Only key names included in the {@link module:utils/keyboard#keyCodes} can be used.\n             *\n             * @error keyboard-unknown-key\n             * @param {string} key Ths specified key name.\n             */\n            throw new CKEditorError('keyboard-unknown-key', null, { key });\n        }\n    }\n    else {\n        keyCode = key.keyCode +\n            (key.altKey ? keyCodes.alt : 0) +\n            (key.ctrlKey ? keyCodes.ctrl : 0) +\n            (key.shiftKey ? keyCodes.shift : 0) +\n            (key.metaKey ? keyCodes.cmd : 0);\n    }\n    return keyCode;\n}\n/**\n * Parses the keystroke and returns a keystroke code that will match the code returned by\n * {@link module:utils/keyboard~getCode} for the corresponding {@link module:utils/keyboard~KeystrokeInfo keystroke info}.\n *\n * The keystroke can be passed in two formats:\n *\n * * as a single string – e.g. `ctrl + A`,\n * * as an array of {@link module:utils/keyboard~keyCodes known key names} and key codes – e.g.:\n *   * `[ 'ctrl', 32 ]` (ctrl + space),\n *   * `[ 'ctrl', 'a' ]` (ctrl + A).\n *\n * Note: Key names are matched with {@link module:utils/keyboard#keyCodes} in a case-insensitive way.\n *\n * Note: Only keystrokes with a single non-modifier key are supported (e.g. `ctrl+A` is OK, but `ctrl+A+B` is not).\n *\n * Note: On macOS, keystroke handling is translating the `Ctrl` key to the `Cmd` key and handling only that keystroke.\n * For example, a registered keystroke `Ctrl+A` will be translated to `Cmd+A` on macOS. To disable the translation of some keystroke,\n * use the forced modifier: `Ctrl!+A` (note the exclamation mark).\n *\n * @param keystroke The keystroke definition.\n * @returns Keystroke code.\n */\nexport function parseKeystroke(keystroke) {\n    if (typeof keystroke == 'string') {\n        keystroke = splitKeystrokeText(keystroke);\n    }\n    return keystroke\n        .map(key => (typeof key == 'string') ? getEnvKeyCode(key) : key)\n        .reduce((key, sum) => sum + key, 0);\n}\n/**\n * Translates any keystroke string text like `\"Ctrl+A\"` to an\n * environment–specific keystroke, i.e. `\"⌘A\"` on macOS.\n *\n * @param keystroke The keystroke text.\n * @param [forcedEnv] The environment to force the key translation to. If not provided, the current environment is used.\n * @returns The keystroke text specific for the environment.\n */\nexport function getEnvKeystrokeText(keystroke, forcedEnv) {\n    let keystrokeCode = parseKeystroke(keystroke);\n    const isMac = forcedEnv ? forcedEnv === 'Mac' : env.isMac || env.isiOS;\n    const modifiersToGlyphs = Object.entries(isMac ? modifiersToGlyphsMac : modifiersToGlyphsNonMac);\n    const modifiers = modifiersToGlyphs.reduce((modifiers, [name, glyph]) => {\n        // Modifier keys are stored as a bit mask so extract those from the keystroke code.\n        if ((keystrokeCode & keyCodes[name]) != 0) {\n            keystrokeCode &= ~keyCodes[name];\n            modifiers += glyph;\n        }\n        return modifiers;\n    }, '');\n    return modifiers + (keystrokeCode ? keyCodeNames[keystrokeCode] : '');\n}\n/**\n * Returns `true` if the provided key code represents one of the arrow keys.\n *\n * @param keyCode A key code as in {@link module:utils/keyboard~KeystrokeInfo#keyCode}.\n */\nexport function isArrowKeyCode(keyCode) {\n    return keyCode == keyCodes.arrowright ||\n        keyCode == keyCodes.arrowleft ||\n        keyCode == keyCodes.arrowup ||\n        keyCode == keyCodes.arrowdown;\n}\n/**\n * Returns the direction in which the {@link module:engine/model/documentselection~ModelDocumentSelection selection}\n * will move when the provided arrow key code is pressed considering the language direction of the editor content.\n *\n * For instance, in right–to–left (RTL) content languages, pressing the left arrow means moving the selection right (forward)\n * in the model structure. Similarly, pressing the right arrow moves the selection left (backward).\n *\n * @param keyCode A key code as in {@link module:utils/keyboard~KeystrokeInfo#keyCode}.\n * @param contentLanguageDirection The content language direction, corresponding to\n * {@link module:utils/locale~Locale#contentLanguageDirection}.\n * @returns Localized arrow direction or `undefined` for non-arrow key codes.\n */\nexport function getLocalizedArrowKeyCodeDirection(keyCode, contentLanguageDirection) {\n    const isLtrContent = contentLanguageDirection === 'ltr';\n    switch (keyCode) {\n        case keyCodes.arrowleft:\n            return isLtrContent ? 'left' : 'right';\n        case keyCodes.arrowright:\n            return isLtrContent ? 'right' : 'left';\n        case keyCodes.arrowup:\n            return 'up';\n        case keyCodes.arrowdown:\n            return 'down';\n    }\n}\n/**\n * Converts a key name to the key code with mapping based on the env.\n *\n * See: {@link module:utils/keyboard~getCode}.\n *\n * @param key The key name (see {@link module:utils/keyboard#keyCodes}).\n * @returns Key code.\n */\nfunction getEnvKeyCode(key) {\n    // Don't remap modifier key for forced modifiers.\n    if (key.endsWith('!')) {\n        return getCode(key.slice(0, -1));\n    }\n    const code = getCode(key);\n    return (env.isMac || env.isiOS) && code == keyCodes.ctrl ? keyCodes.cmd : code;\n}\n/**\n * Determines if the provided key code moves the {@link module:engine/model/documentselection~ModelDocumentSelection selection}\n * forward or backward considering the language direction of the editor content.\n *\n * For instance, in right–to–left (RTL) languages, pressing the left arrow means moving forward\n * in the model structure. Similarly, pressing the right arrow moves the selection backward.\n *\n * @param keyCode A key code as in {@link module:utils/keyboard~KeystrokeInfo#keyCode}.\n * @param contentLanguageDirection The content language direction, corresponding to\n * {@link module:utils/locale~Locale#contentLanguageDirection}.\n */\nexport function isForwardArrowKeyCode(keyCode, contentLanguageDirection) {\n    const localizedKeyCodeDirection = getLocalizedArrowKeyCodeDirection(keyCode, contentLanguageDirection);\n    return localizedKeyCodeDirection === 'down' || localizedKeyCodeDirection === 'right';\n}\nfunction generateKnownKeyCodes() {\n    const keyCodes = {\n        pageup: 33,\n        pagedown: 34,\n        end: 35,\n        home: 36,\n        arrowleft: 37,\n        arrowup: 38,\n        arrowright: 39,\n        arrowdown: 40,\n        backspace: 8,\n        delete: 46,\n        enter: 13,\n        space: 32,\n        esc: 27,\n        tab: 9,\n        // The idea about these numbers is that they do not collide with any real key codes, so we can use them\n        // like bit masks.\n        ctrl: 0x110000,\n        shift: 0x220000,\n        alt: 0x440000,\n        cmd: 0x880000\n    };\n    // a-z\n    for (let code = 65; code <= 90; code++) {\n        const letter = String.fromCharCode(code);\n        keyCodes[letter.toLowerCase()] = code;\n    }\n    // 0-9\n    for (let code = 48; code <= 57; code++) {\n        keyCodes[code - 48] = code;\n    }\n    // F1-F12\n    for (let code = 112; code <= 123; code++) {\n        keyCodes['f' + (code - 111)] = code;\n    }\n    // other characters\n    Object.assign(keyCodes, {\n        '\\'': 222,\n        ',': 108,\n        '-': 109,\n        '.': 110,\n        '/': 111,\n        ';': 186,\n        '=': 187,\n        '[': 219,\n        '\\\\': 220,\n        ']': 221,\n        '`': 223\n    });\n    return keyCodes;\n}\nfunction splitKeystrokeText(keystroke) {\n    return keystroke.split('+').map(key => key.trim());\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nexport function toArray(data) {\n    return Array.isArray(data) ? data : [data];\n}\n","import { cloneDeepWith } from './cloneDeepWith.mjs';\n\nfunction cloneDeep(obj) {\n    return cloneDeepWith(obj);\n}\n\nexport { cloneDeep };\n","function isUnsafeProperty(key) {\n    return key === '__proto__';\n}\n\nexport { isUnsafeProperty };\n","import { getTag } from '../_internal/getTag.mjs';\n\nfunction isArguments(value) {\n    return value !== null && typeof value === 'object' && getTag(value) === '[object Arguments]';\n}\n\nexport { isArguments };\n","import { isTypedArray as isTypedArray$1 } from '../../predicate/isTypedArray.mjs';\n\nfunction isTypedArray(x) {\n    return isTypedArray$1(x);\n}\n\nexport { isTypedArray };\n","import { cloneDeep } from './cloneDeep.mjs';\nimport { isUnsafeProperty } from '../../_internal/isUnsafeProperty.mjs';\nimport { clone } from '../../object/clone.mjs';\nimport { isPrimitive } from '../../predicate/isPrimitive.mjs';\nimport { getSymbols } from '../_internal/getSymbols.mjs';\nimport { isArguments } from '../predicate/isArguments.mjs';\nimport { isObjectLike } from '../predicate/isObjectLike.mjs';\nimport { isPlainObject } from '../predicate/isPlainObject.mjs';\nimport { isTypedArray } from '../predicate/isTypedArray.mjs';\n\nfunction mergeWith(object, ...otherArgs) {\n    const sources = otherArgs.slice(0, -1);\n    const merge = otherArgs[otherArgs.length - 1];\n    let result = object;\n    for (let i = 0; i < sources.length; i++) {\n        const source = sources[i];\n        result = mergeWithDeep(result, source, merge, new Map());\n    }\n    return result;\n}\nfunction mergeWithDeep(target, source, merge, stack) {\n    if (isPrimitive(target)) {\n        target = Object(target);\n    }\n    if (source == null || typeof source !== 'object') {\n        return target;\n    }\n    if (stack.has(source)) {\n        return clone(stack.get(source));\n    }\n    stack.set(source, target);\n    if (Array.isArray(source)) {\n        source = source.slice();\n        for (let i = 0; i < source.length; i++) {\n            source[i] = source[i] ?? undefined;\n        }\n    }\n    const sourceKeys = [...Object.keys(source), ...getSymbols(source)];\n    for (let i = 0; i < sourceKeys.length; i++) {\n        const key = sourceKeys[i];\n        if (isUnsafeProperty(key)) {\n            continue;\n        }\n        let sourceValue = source[key];\n        let targetValue = target[key];\n        if (isArguments(sourceValue)) {\n            sourceValue = { ...sourceValue };\n        }\n        if (isArguments(targetValue)) {\n            targetValue = { ...targetValue };\n        }\n        if (typeof Buffer !== 'undefined' && Buffer.isBuffer(sourceValue)) {\n            sourceValue = cloneDeep(sourceValue);\n        }\n        if (Array.isArray(sourceValue)) {\n            if (typeof targetValue === 'object' && targetValue != null) {\n                const cloned = [];\n                const targetKeys = Reflect.ownKeys(targetValue);\n                for (let i = 0; i < targetKeys.length; i++) {\n                    const targetKey = targetKeys[i];\n                    cloned[targetKey] = targetValue[targetKey];\n                }\n                targetValue = cloned;\n            }\n            else {\n                targetValue = [];\n            }\n        }\n        const merged = merge(targetValue, sourceValue, key, target, source, stack);\n        if (merged != null) {\n            target[key] = merged;\n        }\n        else if (Array.isArray(sourceValue)) {\n            target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);\n        }\n        else if (isObjectLike(targetValue) && isObjectLike(sourceValue)) {\n            target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);\n        }\n        else if (targetValue == null && isPlainObject(sourceValue)) {\n            target[key] = mergeWithDeep({}, sourceValue, merge, stack);\n        }\n        else if (targetValue == null && isTypedArray(sourceValue)) {\n            target[key] = cloneDeep(sourceValue);\n        }\n        else if (targetValue === undefined || sourceValue !== undefined) {\n            target[key] = sourceValue;\n        }\n    }\n    return target;\n}\n\nexport { mergeWith };\n","import { isPrimitive } from '../predicate/isPrimitive.mjs';\nimport { isTypedArray } from '../predicate/isTypedArray.mjs';\n\nfunction clone(obj) {\n    if (isPrimitive(obj)) {\n        return obj;\n    }\n    if (Array.isArray(obj) ||\n        isTypedArray(obj) ||\n        obj instanceof ArrayBuffer ||\n        (typeof SharedArrayBuffer !== 'undefined' && obj instanceof SharedArrayBuffer)) {\n        return obj.slice(0);\n    }\n    const prototype = Object.getPrototypeOf(obj);\n    const Constructor = prototype.constructor;\n    if (obj instanceof Date || obj instanceof Map || obj instanceof Set) {\n        return new Constructor(obj);\n    }\n    if (obj instanceof RegExp) {\n        const newRegExp = new Constructor(obj);\n        newRegExp.lastIndex = obj.lastIndex;\n        return newRegExp;\n    }\n    if (obj instanceof DataView) {\n        return new Constructor(obj.buffer.slice(0));\n    }\n    if (obj instanceof Error) {\n        const newError = new Constructor(obj.message);\n        newError.stack = obj.stack;\n        newError.name = obj.name;\n        newError.cause = obj.cause;\n        return newError;\n    }\n    if (typeof File !== 'undefined' && obj instanceof File) {\n        const newFile = new Constructor([obj], obj.name, { type: obj.type, lastModified: obj.lastModified });\n        return newFile;\n    }\n    if (typeof obj === 'object') {\n        const newObject = Object.create(prototype);\n        return Object.assign(newObject, obj);\n    }\n    return obj;\n}\n\nexport { clone };\n","function noop() { }\n\nexport { noop };\n","import { mergeWith } from './mergeWith.mjs';\nimport { noop } from '../../function/noop.mjs';\n\nfunction merge(object, ...sources) {\n    return mergeWith(object, ...sources, noop);\n}\n\nexport { merge };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { CKEditorError } from './ckeditorerror.js';\nimport { global } from './dom/global.js';\nimport { merge } from 'es-toolkit/compat';\n/* istanbul ignore else -- @preserve */\nif (!global.window.CKEDITOR_TRANSLATIONS) {\n    global.window.CKEDITOR_TRANSLATIONS = {};\n}\n/**\n * Adds translations to existing ones or overrides the existing translations. These translations will later\n * be available for the {@link module:utils/locale~Locale#t `t()`} function.\n *\n * The `translations` is an object which consists of `messageId: translation` pairs. Note that the message ID can be\n * either constructed from the message string or from the message ID if it was passed\n * (this happens rarely and mostly for short messages or messages with placeholders).\n * Since the editor displays only the message string, the message ID can be found either in the source code or in the\n * built translations for another language.\n *\n * ```ts\n * add( 'pl', {\n * \t'Cancel': 'Anuluj',\n * \t'IMAGE': 'obraz', // Note that the `IMAGE` comes from the message ID, while the string can be `image`.\n * } );\n * ```\n *\n * If the message is supposed to support various plural forms, make sure to provide an array with the singular form and all plural forms:\n *\n * ```ts\n * add( 'pl', {\n * \t'Add space': [ 'Dodaj spację', 'Dodaj %0 spacje', 'Dodaj %0 spacji' ]\n * } );\n * ```\n *\n * You should also specify the third argument (the `getPluralForm()` function) that will be used to determine the plural form if no\n * language file was loaded for that language. All language files coming from CKEditor 5 sources will have this option set, so\n * these plural form rules will be reused by other translations added to the registered languages. The `getPluralForm()` function\n * can return either a Boolean or a number.\n *\n * ```ts\n * add( 'en', {\n * \t// ... Translations.\n * }, n => n !== 1 );\n * add( 'pl', {\n * \t// ... Translations.\n * }, n => n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && ( n % 100 < 10 || n % 100 >= 20 ) ? 1 : 2 );\n * ```\n *\n * All translations extend the global `window.CKEDITOR_TRANSLATIONS` object. An example of this object can be found below:\n *\n * ```ts\n * {\n * \tpl: {\n * \t\tdictionary: {\n * \t\t\t'Cancel': 'Anuluj',\n * \t\t\t'Add space': [ 'Dodaj spację', 'Dodaj %0 spacje', 'Dodaj %0 spacji' ]\n * \t\t},\n * \t\t// A function that returns the plural form index.\n * \t\tgetPluralForm: n => n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && ( n % 100 < 10 || n % 100 >= 20 ) ? 1 : 2 );\n * \t}\n * \t// Other languages.\n * \t}\n * ```\n *\n * If you cannot import { this function } from this module (e.g. because you use a CKEditor 5 build), you can\n * still add translations by extending the global `window.CKEDITOR_TRANSLATIONS` object by using a function like\n * the one below:\n *\n * ```ts\n * function addTranslations( language, translations, getPluralForm ) {\n * \tif ( !global.window.CKEDITOR_TRANSLATIONS ) {\n * \t\tglobal.window.CKEDITOR_TRANSLATIONS = {};\n * \t}\n\n * \tif ( !global.window.CKEDITOR_TRANSLATIONS[ language ] ) {\n * \t\tglobal.window.CKEDITOR_TRANSLATIONS[ language ] = {};\n * \t}\n *\n * \tconst languageTranslations = global.window.CKEDITOR_TRANSLATIONS[ language ];\n *\n * \tlanguageTranslations.dictionary = languageTranslations.dictionary || {};\n * \tlanguageTranslations.getPluralForm = getPluralForm || languageTranslations.getPluralForm;\n *\n * \t// Extend the dictionary for the given language.\n * \tObject.assign( languageTranslations.dictionary, translations );\n * }\n * ```\n *\n * @param language Target language.\n * @param translations An object with translations which will be added to the dictionary.\n * For each message ID the value should be either a translation or an array of translations if the message\n * should support plural forms.\n * @param getPluralForm A function that returns the plural form index (a number).\n */\nexport function add(language, translations, getPluralForm) {\n    if (!global.window.CKEDITOR_TRANSLATIONS[language]) {\n        global.window.CKEDITOR_TRANSLATIONS[language] = {};\n    }\n    const languageTranslations = global.window.CKEDITOR_TRANSLATIONS[language];\n    languageTranslations.dictionary = languageTranslations.dictionary || {};\n    languageTranslations.getPluralForm = getPluralForm || languageTranslations.getPluralForm;\n    Object.assign(languageTranslations.dictionary, translations);\n}\n/**\n * **Note:** This method is internal, use {@link module:utils/locale~Locale#t the `t()` function} instead to translate\n * the editor UI parts.\n *\n * This function is responsible for translating messages to the specified language. It uses translations added perviously\n * by {@link module:utils/translation-service~add} (a translations dictionary and the `getPluralForm()` function\n * to provide accurate translations of plural forms).\n *\n * When no translation is defined in the dictionary or the dictionary does not exist, this function returns\n * the original message string or the message plural depending on the number of elements.\n *\n * ```ts\n * translate( 'pl', { string: 'Cancel' } ); // 'Cancel'\n * ```\n *\n * The third optional argument is the number of elements, based on which the single form or one of the plural forms\n * should be picked when the message is supposed to support various plural forms.\n *\n * ```ts\n * translate( 'en', { string: 'Add a space', plural: 'Add %0 spaces' }, 1 ); // 'Add a space'\n * translate( 'en', { string: 'Add a space', plural: 'Add %0 spaces' }, 3 ); // 'Add %0 spaces'\n * ```\n *\n * The message should provide an ID using the `id` property when the message strings are not unique and their\n * translations should be different.\n *\n * ```ts\n * translate( 'en', { string: 'image', id: 'ADD_IMAGE' } );\n * translate( 'en', { string: 'image', id: 'AN_IMAGE' } );\n * ```\n *\n * @internal\n * @param language Target language.\n * @param message A message that will be translated.\n * @param quantity The number of elements for which a plural form should be picked from the target language dictionary.\n * @param translations Translations passed in editor config, if not provided use the global `window.CKEDITOR_TRANSLATIONS`.\n * @returns Translated sentence.\n */\nexport function _translate(language, message, quantity = 1, translations) {\n    if (typeof quantity !== 'number') {\n        /**\n         * An incorrect value was passed to the translation function. This was probably caused\n         * by an incorrect message interpolation of a plural form. Note that for messages supporting plural forms\n         * the second argument of the `t()` function should always be a number or an array with a number as the first element.\n         *\n         * @error translation-service-quantity-not-a-number\n         */\n        throw new CKEditorError('translation-service-quantity-not-a-number', null, { quantity });\n    }\n    const normalizedTranslations = translations || global.window.CKEDITOR_TRANSLATIONS;\n    const numberOfLanguages = getNumberOfLanguages(normalizedTranslations);\n    if (numberOfLanguages === 1) {\n        // Override the language to the only supported one.\n        // This can't be done in the `Locale` class, because the translations comes after the `Locale` class initialization.\n        language = Object.keys(normalizedTranslations)[0];\n    }\n    const messageId = message.id || message.string;\n    if (numberOfLanguages === 0 || !hasTranslation(language, messageId, normalizedTranslations)) {\n        if (quantity !== 1) {\n            // Return the default plural form that was passed in the `message.plural` parameter.\n            return message.plural;\n        }\n        return message.string;\n    }\n    const dictionary = normalizedTranslations[language].dictionary;\n    const getPluralForm = normalizedTranslations[language].getPluralForm || (n => n === 1 ? 0 : 1);\n    const translation = dictionary[messageId];\n    if (typeof translation === 'string') {\n        return translation;\n    }\n    const pluralFormIndex = Number(getPluralForm(quantity));\n    // Note: The `translate` function is not responsible for replacing `%0, %1, ...` with values.\n    return translation[pluralFormIndex];\n}\n/**\n * Clears dictionaries for test purposes.\n *\n * @internal\n */\nexport function _clear() {\n    if (global.window.CKEDITOR_TRANSLATIONS) {\n        global.window.CKEDITOR_TRANSLATIONS = {};\n    }\n}\n/**\n * If array then merge objects which are inside otherwise return given object.\n *\n * @internal\n * @param translations Translations passed in editor config.\n */\nexport function _unifyTranslations(translations) {\n    return Array.isArray(translations) ?\n        translations.reduce((acc, translation) => merge(acc, translation)) :\n        translations;\n}\n/**\n * Checks whether the dictionary exists and translation in that dictionary exists.\n */\nfunction hasTranslation(language, messageId, translations) {\n    return !!translations[language] && !!translations[language].dictionary[messageId];\n}\nfunction getNumberOfLanguages(translations) {\n    return Object.keys(translations).length;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nconst RTL_LANGUAGE_CODES = [\n    'ar', 'ara', // Arabic\n    'dv', 'div', // Dhivehi\n    'fa', 'per', 'fas', // Persian\n    'he', 'heb', // Hebrew\n    'ku', 'kur', // Kurdish\n    'ug', 'uig', // Uighur, Uyghur\n    'ur', 'urd' // Urdu\n];\n/**\n * Helps determine whether a language text direction is LTR or RTL.\n *\n * @param languageCode The ISO 639-1 or ISO 639-2 language code.\n */\nexport function getLanguageDirection(languageCode) {\n    return RTL_LANGUAGE_CODES.includes(languageCode) ? 'rtl' : 'ltr';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/locale\n */\nimport { toArray } from './toarray.js';\nimport { _translate, _unifyTranslations } from './translation-service.js';\nimport { getLanguageDirection } from './language.js';\n/**\n * Represents the localization services.\n */\nexport class Locale {\n    /**\n     * The editor UI language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.\n     *\n     * If the {@link #contentLanguage content language} was not specified in the `Locale` constructor,\n     * it also defines the language of the content.\n     */\n    uiLanguage;\n    /**\n     * Text direction of the {@link #uiLanguage editor UI language}. Either `'ltr'` or `'rtl'`.\n     */\n    uiLanguageDirection;\n    /**\n     * The editor content language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.\n     *\n     * Usually the same as the {@link #uiLanguage editor language}, it can be customized by passing an optional\n     * argument to the `Locale` constructor.\n     */\n    contentLanguage;\n    /**\n     * Text direction of the {@link #contentLanguage editor content language}.\n     *\n     * If the content language was passed directly to the `Locale` constructor, this property represents the\n     * direction of that language.\n     *\n     * If the {@link #contentLanguage editor content language} was derived from the {@link #uiLanguage editor language},\n     * the content language direction is the same as the {@link #uiLanguageDirection UI language direction}.\n     *\n     * The value is either `'ltr'` or `'rtl'`.\n     */\n    contentLanguageDirection;\n    /**\n     * Translates the given message to the {@link #uiLanguage}. This method is also available in\n     * {@link module:core/editor/editor~Editor#t `Editor`} and {@link module:ui/view~View#t `View`}.\n     *\n     * This method's context is statically bound to the `Locale` instance and **should always be called as a function**:\n     *\n     * ```ts\n     * const t = locale.t;\n     * t( 'Label' );\n     * ```\n     *\n     * The message can be either a string or an object implementing the {@link module:utils/translation-service~Message} interface.\n     *\n     * The message may contain placeholders (`%<index>`) for value(s) that are passed as a `values` parameter.\n     * For an array of values, the `%<index>` will be changed to an element of that array at the given index.\n     * For a single value passed as the second argument, only the `%0` placeholders will be changed to the provided value.\n     *\n     * ```ts\n     * t( 'Created file \"%0\" in %1ms.', [ fileName, timeTaken ] );\n     * t( 'Created file \"%0\", fileName );\n     * ```\n     *\n     * The message supports plural forms. To specify the plural form, use the `plural` property. Singular or plural form\n     * will be chosen depending on the first value from the passed `values`. The value of the `plural` property is used\n     * as a default plural translation when the translation for the target language is missing.\n     *\n     * ```ts\n     * t( { string: 'Add a space', plural: 'Add %0 spaces' }, 1 ); // 'Add a space' for the English language.\n     * t( { string: 'Add a space', plural: 'Add %0 spaces' }, 5 ); // 'Add 5 spaces' for the English language.\n     * t( { string: '%1 a space', plural: '%1 %0 spaces' }, [ 2, 'Add' ] ); // 'Add 2 spaces' for the English language.\n     *\n     * t( { string: 'Add a space', plural: 'Add %0 spaces' }, 1 ); // 'Dodaj spację' for the Polish language.\n     * t( { string: 'Add a space', plural: 'Add %0 spaces' }, 5 ); // 'Dodaj 5 spacji' for the Polish language.\n     * t( { string: '%1 a space', plural: '%1 %0 spaces' }, [ 2, 'Add' ] ); // 'Dodaj 2 spacje' for the Polish language.\n     * ```\n     *\n     *  * The message should provide an ID using the `id` property when the message strings are not unique and their\n     * translations should be different.\n     *\n     * ```ts\n     * translate( 'en', { string: 'image', id: 'ADD_IMAGE' } );\n     * translate( 'en', { string: 'image', id: 'AN_IMAGE' } );\n     * ```\n     */\n    t;\n    /**\n     * Object that contains translations.\n     */\n    translations;\n    /**\n     * Creates a new instance of the locale class. Learn more about\n     * {@glink getting-started/setup/ui-language configuring the language of the editor}.\n     *\n     * @param options Locale configuration.\n     * @param options.uiLanguage The editor UI language code in the\n     * [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format. See {@link #uiLanguage}.\n     * @param options.contentLanguage The editor content language code in the\n     * [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format. If not specified, the same as `options.language`.\n     * See {@link #contentLanguage}.\n     * @param options.translations Translations passed as a editor config parameter.\n     */\n    constructor({ uiLanguage = 'en', contentLanguage, translations } = {}) {\n        this.uiLanguage = uiLanguage;\n        this.contentLanguage = contentLanguage || this.uiLanguage;\n        this.uiLanguageDirection = getLanguageDirection(this.uiLanguage);\n        this.contentLanguageDirection = getLanguageDirection(this.contentLanguage);\n        this.translations = _unifyTranslations(translations);\n        this.t = (message, values) => this._t(message, values);\n    }\n    /**\n     * An unbound version of the {@link #t} method.\n     */\n    _t(message, values = []) {\n        values = toArray(values);\n        if (typeof message === 'string') {\n            message = { string: message };\n        }\n        const hasPluralForm = !!message.plural;\n        const quantity = hasPluralForm ? values[0] : 1;\n        const translatedString = _translate(this.uiLanguage, message, quantity, this.translations);\n        return interpolateString(translatedString, values);\n    }\n}\n/**\n * Fills the `%0, %1, ...` string placeholders with values.\n */\nfunction interpolateString(string, values) {\n    return string.replace(/%(\\d+)/g, (match, index) => {\n        return (index < values.length) ? values[index] : match;\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/collection\n */\nimport { EmitterMixin } from './emittermixin.js';\nimport { CKEditorError } from './ckeditorerror.js';\nimport { uid } from './uid.js';\nimport { isIterable } from './isiterable.js';\n/**\n * Collections are ordered sets of objects. Items in the collection can be retrieved by their indexes\n * in the collection (like in an array) or by their ids.\n *\n * If an object without an `id` property is being added to the collection, the `id` property will be generated\n * automatically. Note that the automatically generated id is unique only within this single collection instance.\n *\n * By default an item in the collection is identified by its `id` property. The name of the identifier can be\n * configured through the constructor of the collection.\n *\n * @typeParam T The type of the collection element.\n */\nexport class Collection extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * The internal list of items in the collection.\n     */\n    _items;\n    /**\n     * The internal map of items in the collection.\n     */\n    _itemMap;\n    /**\n     * The name of the property which is considered to identify an item.\n     */\n    _idProperty;\n    /**\n     * A collection instance this collection is bound to as a result\n     * of calling {@link #bindTo} method.\n     */\n    _bindToCollection;\n    /**\n     * A helper mapping external items of a bound collection ({@link #bindTo})\n     * and actual items of this collection. It provides information\n     * necessary to properly remove items bound to another collection.\n     *\n     * See {@link #_bindToInternalToExternalMap}.\n     */\n    _bindToExternalToInternalMap;\n    /**\n     * A helper mapping items of this collection to external items of a bound collection\n     * ({@link #bindTo}). It provides information necessary to manage the bindings, e.g.\n     * to avoid loops in two–way bindings.\n     *\n     * See {@link #_bindToExternalToInternalMap}.\n     */\n    _bindToInternalToExternalMap;\n    /**\n     * Stores indexes of skipped items from bound external collection.\n     */\n    _skippedIndexesFromExternal;\n    constructor(initialItemsOrOptions = {}, options = {}) {\n        super();\n        const hasInitialItems = isIterable(initialItemsOrOptions);\n        if (!hasInitialItems) {\n            options = initialItemsOrOptions;\n        }\n        this._items = [];\n        this._itemMap = new Map();\n        this._idProperty = options.idProperty || 'id';\n        this._bindToExternalToInternalMap = new WeakMap();\n        this._bindToInternalToExternalMap = new WeakMap();\n        this._skippedIndexesFromExternal = [];\n        // Set the initial content of the collection (if provided in the constructor).\n        if (hasInitialItems) {\n            for (const item of initialItemsOrOptions) {\n                this._items.push(item);\n                this._itemMap.set(this._getItemIdBeforeAdding(item), item);\n            }\n        }\n    }\n    /**\n     * The number of items available in the collection.\n     */\n    get length() {\n        return this._items.length;\n    }\n    /**\n     * Returns the first item from the collection or null when collection is empty.\n     */\n    get first() {\n        return this._items[0] || null;\n    }\n    /**\n     * Returns the last item from the collection or null when collection is empty.\n     */\n    get last() {\n        return this._items[this.length - 1] || null;\n    }\n    /**\n     * Adds an item into the collection.\n     *\n     * If the item does not have an id, then it will be automatically generated and set on the item.\n     *\n     * @param item\n     * @param index The position of the item in the collection. The item\n     * is pushed to the collection when `index` not specified.\n     * @fires add\n     * @fires change\n     */\n    add(item, index) {\n        return this.addMany([item], index);\n    }\n    /**\n     * Adds multiple items into the collection.\n     *\n     * Any item not containing an id will get an automatically generated one.\n     *\n     * @param items\n     * @param index The position of the insertion. Items will be appended if no `index` is specified.\n     * @fires add\n     * @fires change\n     */\n    addMany(items, index) {\n        if (index === undefined) {\n            index = this._items.length;\n        }\n        else if (index > this._items.length || index < 0) {\n            /**\n             * The `index` passed to {@link module:utils/collection~Collection#addMany `Collection#addMany()`}\n             * is invalid. It must be a number between 0 and the collection's length.\n             *\n             * @error collection-add-item-invalid-index\n             */\n            throw new CKEditorError('collection-add-item-invalid-index', this);\n        }\n        let offset = 0;\n        for (const item of items) {\n            const itemId = this._getItemIdBeforeAdding(item);\n            const currentItemIndex = index + offset;\n            this._items.splice(currentItemIndex, 0, item);\n            this._itemMap.set(itemId, item);\n            this.fire('add', item, currentItemIndex);\n            offset++;\n        }\n        this.fire('change', {\n            added: items,\n            removed: [],\n            index\n        });\n        return this;\n    }\n    /**\n     * Gets an item by its ID or index.\n     *\n     * @param idOrIndex The item ID or index in the collection.\n     * @returns The requested item or `null` if such item does not exist.\n     */\n    get(idOrIndex) {\n        let item;\n        if (typeof idOrIndex == 'string') {\n            item = this._itemMap.get(idOrIndex);\n        }\n        else if (typeof idOrIndex == 'number') {\n            item = this._items[idOrIndex];\n        }\n        else {\n            /**\n             * An index or ID must be given.\n             *\n             * @error collection-get-invalid-arg\n             */\n            throw new CKEditorError('collection-get-invalid-arg', this);\n        }\n        return item || null;\n    }\n    /**\n     * Returns a Boolean indicating whether the collection contains an item.\n     *\n     * @param itemOrId The item or its ID in the collection.\n     * @returns `true` if the collection contains the item, `false` otherwise.\n     */\n    has(itemOrId) {\n        if (typeof itemOrId == 'string') {\n            return this._itemMap.has(itemOrId);\n        }\n        else { // Object\n            const idProperty = this._idProperty;\n            const id = itemOrId[idProperty];\n            return id && this._itemMap.has(id);\n        }\n    }\n    /**\n     * Gets an index of an item in the collection.\n     * When an item is not defined in the collection, the index will equal -1.\n     *\n     * @param itemOrId The item or its ID in the collection.\n     * @returns The index of a given item.\n     */\n    getIndex(itemOrId) {\n        let item;\n        if (typeof itemOrId == 'string') {\n            item = this._itemMap.get(itemOrId);\n        }\n        else {\n            item = itemOrId;\n        }\n        return item ? this._items.indexOf(item) : -1;\n    }\n    /**\n     * Removes an item from the collection.\n     *\n     * @param subject The item to remove, its ID or index in the collection.\n     * @returns The removed item.\n     * @fires remove\n     * @fires change\n     */\n    remove(subject) {\n        const [item, index] = this._remove(subject);\n        this.fire('change', {\n            added: [],\n            removed: [item],\n            index\n        });\n        return item;\n    }\n    /**\n     * Executes the callback for each item in the collection and composes an array or values returned by this callback.\n     *\n     * @typeParam U The result type of the callback.\n     * @param callback\n     * @param ctx Context in which the `callback` will be called.\n     * @returns The result of mapping.\n     */\n    map(callback, ctx) {\n        return this._items.map(callback, ctx);\n    }\n    /**\n     * Performs the specified action for each item in the collection.\n     *\n     * @param ctx Context in which the `callback` will be called.\n     */\n    forEach(callback, ctx) {\n        this._items.forEach(callback, ctx);\n    }\n    /**\n     * Finds the first item in the collection for which the `callback` returns a true value.\n     *\n     * @param callback\n     * @param ctx Context in which the `callback` will be called.\n     * @returns The item for which `callback` returned a true value.\n     */\n    find(callback, ctx) {\n        return this._items.find(callback, ctx);\n    }\n    /**\n     * Returns an array with items for which the `callback` returned a true value.\n     *\n     * @param callback\n     * @param ctx Context in which the `callback` will be called.\n     * @returns The array with matching items.\n     */\n    filter(callback, ctx) {\n        return this._items.filter(callback, ctx);\n    }\n    /**\n     * Removes all items from the collection and destroys the binding created using\n     * {@link #bindTo}.\n     *\n     * @fires remove\n     * @fires change\n     */\n    clear() {\n        if (this._bindToCollection) {\n            this.stopListening(this._bindToCollection);\n            this._bindToCollection = null;\n        }\n        const removedItems = Array.from(this._items);\n        while (this.length) {\n            this._remove(0);\n        }\n        this.fire('change', {\n            added: [],\n            removed: removedItems,\n            index: 0\n        });\n    }\n    /**\n     * Binds and synchronizes the collection with another one.\n     *\n     * The binding can be a simple factory:\n     *\n     * ```ts\n     * class FactoryClass {\n     * \tpublic label: string;\n     *\n     * \tconstructor( data: { label: string } ) {\n     * \t\tthis.label = data.label;\n     * \t}\n     * }\n     *\n     * const source = new Collection<{ label: string }>( { idProperty: 'label' } );\n     * const target = new Collection<FactoryClass>();\n     *\n     * target.bindTo( source ).as( FactoryClass );\n     *\n     * source.add( { label: 'foo' } );\n     * source.add( { label: 'bar' } );\n     *\n     * console.log( target.length ); // 2\n     * console.log( target.get( 1 ).label ); // 'bar'\n     *\n     * source.remove( 0 );\n     * console.log( target.length ); // 1\n     * console.log( target.get( 0 ).label ); // 'bar'\n     * ```\n     *\n     * or the factory driven by a custom callback:\n     *\n     * ```ts\n     * class FooClass {\n     * \tpublic label: string;\n     *\n     * \tconstructor( data: { label: string } ) {\n     * \t\tthis.label = data.label;\n     * \t}\n     * }\n     *\n     * class BarClass {\n     * \tpublic label: string;\n     *\n     * \tconstructor( data: { label: string } ) {\n     * \t\tthis.label = data.label;\n     * \t}\n     * }\n     *\n     * const source = new Collection<{ label: string }>( { idProperty: 'label' } );\n     * const target = new Collection<FooClass | BarClass>();\n     *\n     * target.bindTo( source ).using( ( item ) => {\n     * \tif ( item.label == 'foo' ) {\n     * \t\treturn new FooClass( item );\n     * \t} else {\n     * \t\treturn new BarClass( item );\n     * \t}\n     * } );\n     *\n     * source.add( { label: 'foo' } );\n     * source.add( { label: 'bar' } );\n     *\n     * console.log( target.length ); // 2\n     * console.log( target.get( 0 ) instanceof FooClass ); // true\n     * console.log( target.get( 1 ) instanceof BarClass ); // true\n     * ```\n     *\n     * or the factory out of property name:\n     *\n     * ```ts\n     * const source = new Collection<{ nested: { value: string } }>();\n     * const target = new Collection<{ value: string }>();\n     *\n     * target.bindTo( source ).using( 'nested' );\n     *\n     * source.add( { nested: { value: 'foo' } } );\n     * source.add( { nested: { value: 'bar' } } );\n     *\n     * console.log( target.length ); // 2\n     * console.log( target.get( 0 ).value ); // 'foo'\n     * console.log( target.get( 1 ).value ); // 'bar'\n     * ```\n     *\n     * It's possible to skip specified items by returning null value:\n     *\n     * ```ts\n     * const source = new Collection<{ hidden: boolean }>();\n     * const target = new Collection<{ hidden: boolean }>();\n     *\n     * target.bindTo( source ).using( item => {\n     * \tif ( item.hidden ) {\n     * \t\treturn null;\n     * \t}\n     *\n     * \treturn item;\n     * } );\n     *\n     * source.add( { hidden: true } );\n     * source.add( { hidden: false } );\n     *\n     * console.log( source.length ); // 2\n     * console.log( target.length ); // 1\n     * ```\n     *\n     * **Note**: {@link #clear} can be used to break the binding.\n     *\n     * @typeParam S The type of `externalCollection` element.\n     * @param externalCollection A collection to be bound.\n     * @returns The binding chain object.\n     */\n    bindTo(externalCollection) {\n        if (this._bindToCollection) {\n            /**\n             * The collection cannot be bound more than once.\n             *\n             * @error collection-bind-to-rebind\n             */\n            throw new CKEditorError('collection-bind-to-rebind', this);\n        }\n        this._bindToCollection = externalCollection;\n        return {\n            as: Class => {\n                this._setUpBindToBinding(item => new Class(item));\n            },\n            using: callbackOrProperty => {\n                if (typeof callbackOrProperty == 'function') {\n                    this._setUpBindToBinding(callbackOrProperty);\n                }\n                else {\n                    this._setUpBindToBinding(item => item[callbackOrProperty]);\n                }\n            }\n        };\n    }\n    /**\n     * Finalizes and activates a binding initiated by {@link #bindTo}.\n     *\n     * @param factory A function which produces collection items.\n     */\n    _setUpBindToBinding(factory) {\n        const externalCollection = this._bindToCollection;\n        // Adds the item to the collection once a change has been done to the external collection.\n        const addItem = (evt, externalItem, index) => {\n            const isExternalBoundToThis = externalCollection._bindToCollection == this;\n            const externalItemBound = externalCollection._bindToInternalToExternalMap.get(externalItem);\n            // If an external collection is bound to this collection, which makes it a 2–way binding,\n            // and the particular external collection item is already bound, don't add it here.\n            // The external item has been created **out of this collection's item** and (re)adding it will\n            // cause a loop.\n            if (isExternalBoundToThis && externalItemBound) {\n                this._bindToExternalToInternalMap.set(externalItem, externalItemBound);\n                this._bindToInternalToExternalMap.set(externalItemBound, externalItem);\n            }\n            else {\n                const item = factory(externalItem);\n                // When there is no item we need to remember skipped index first and then we can skip this item.\n                if (!item) {\n                    this._skippedIndexesFromExternal.push(index);\n                    return;\n                }\n                // Lets try to put item at the same index as index in external collection\n                // but when there are a skipped items in one or both collections we need to recalculate this index.\n                let finalIndex = index;\n                // When we try to insert item after some skipped items from external collection we need\n                // to include this skipped items and decrease index.\n                //\n                // For the following example:\n                // external -> [ 'A', 'B - skipped for internal', 'C - skipped for internal' ]\n                // internal -> [ A ]\n                //\n                // Another item is been added at the end of external collection:\n                // external.add( 'D' )\n                // external -> [ 'A', 'B - skipped for internal', 'C - skipped for internal', 'D' ]\n                //\n                // We can't just add 'D' to internal at the same index as index in external because\n                // this will produce empty indexes what is invalid:\n                // internal -> [ 'A', empty, empty, 'D' ]\n                //\n                // So we need to include skipped items and decrease index\n                // internal -> [ 'A', 'D' ]\n                for (const skipped of this._skippedIndexesFromExternal) {\n                    if (index > skipped) {\n                        finalIndex--;\n                    }\n                }\n                // We need to take into consideration that external collection could skip some items from\n                // internal collection.\n                //\n                // For the following example:\n                // internal -> [ 'A', 'B - skipped for external', 'C - skipped for external' ]\n                // external -> [ A ]\n                //\n                // Another item is been added at the end of external collection:\n                // external.add( 'D' )\n                // external -> [ 'A', 'D' ]\n                //\n                // We need to include skipped items and place new item after them:\n                // internal -> [ 'A', 'B - skipped for external', 'C - skipped for external', 'D' ]\n                for (const skipped of externalCollection._skippedIndexesFromExternal) {\n                    if (finalIndex >= skipped) {\n                        finalIndex++;\n                    }\n                }\n                this._bindToExternalToInternalMap.set(externalItem, item);\n                this._bindToInternalToExternalMap.set(item, externalItem);\n                this.add(item, finalIndex);\n                // After adding new element to internal collection we need update indexes\n                // of skipped items in external collection.\n                for (let i = 0; i < externalCollection._skippedIndexesFromExternal.length; i++) {\n                    if (finalIndex <= externalCollection._skippedIndexesFromExternal[i]) {\n                        externalCollection._skippedIndexesFromExternal[i]++;\n                    }\n                }\n            }\n        };\n        // Load the initial content of the collection.\n        for (const externalItem of externalCollection) {\n            addItem(null, externalItem, externalCollection.getIndex(externalItem));\n        }\n        // Synchronize the with collection as new items are added.\n        this.listenTo(externalCollection, 'add', addItem);\n        // Synchronize the with collection as new items are removed.\n        this.listenTo(externalCollection, 'remove', (evt, externalItem, index) => {\n            const item = this._bindToExternalToInternalMap.get(externalItem);\n            if (item) {\n                this.remove(item);\n            }\n            // After removing element from external collection we need update/remove indexes\n            // of skipped items in internal collection.\n            this._skippedIndexesFromExternal = this._skippedIndexesFromExternal.reduce((result, skipped) => {\n                if (index < skipped) {\n                    result.push(skipped - 1);\n                }\n                if (index > skipped) {\n                    result.push(skipped);\n                }\n                return result;\n            }, []);\n        });\n    }\n    /**\n     * Returns an unique id property for a given `item`.\n     *\n     * The method will generate new id and assign it to the `item` if it doesn't have any.\n     *\n     * @param item Item to be added.\n     */\n    _getItemIdBeforeAdding(item) {\n        const idProperty = this._idProperty;\n        let itemId;\n        if ((idProperty in item)) {\n            itemId = item[idProperty];\n            if (typeof itemId != 'string') {\n                /**\n                 * This item's ID should be a string.\n                 *\n                 * @error collection-add-invalid-id\n                 */\n                throw new CKEditorError('collection-add-invalid-id', this);\n            }\n            if (this.get(itemId)) {\n                /**\n                 * This item already exists in the collection.\n                 *\n                 * @error collection-add-item-already-exists\n                 */\n                throw new CKEditorError('collection-add-item-already-exists', this);\n            }\n        }\n        else {\n            item[idProperty] = itemId = uid();\n        }\n        return itemId;\n    }\n    /**\n     * Core {@link #remove} method implementation shared in other functions.\n     *\n     * In contrast this method **does not** fire the {@link #event:change} event.\n     *\n     * @param subject The item to remove, its id or index in the collection.\n     * @returns Returns an array with the removed item and its index.\n     * @fires remove\n     */\n    _remove(subject) {\n        let index, id, item;\n        let itemDoesNotExist = false;\n        const idProperty = this._idProperty;\n        if (typeof subject == 'string') {\n            id = subject;\n            item = this._itemMap.get(id);\n            itemDoesNotExist = !item;\n            if (item) {\n                index = this._items.indexOf(item);\n            }\n        }\n        else if (typeof subject == 'number') {\n            index = subject;\n            item = this._items[index];\n            itemDoesNotExist = !item;\n            if (item) {\n                id = item[idProperty];\n            }\n        }\n        else {\n            item = subject;\n            id = item[idProperty];\n            index = this._items.indexOf(item);\n            itemDoesNotExist = (index == -1 || !this._itemMap.get(id));\n        }\n        if (itemDoesNotExist) {\n            /**\n             * Item not found.\n             *\n             * @error collection-remove-404\n             */\n            throw new CKEditorError('collection-remove-404', this);\n        }\n        this._items.splice(index, 1);\n        this._itemMap.delete(id);\n        const externalItem = this._bindToInternalToExternalMap.get(item);\n        this._bindToInternalToExternalMap.delete(item);\n        this._bindToExternalToInternalMap.delete(externalItem);\n        this.fire('remove', item, index);\n        return [item, index];\n    }\n    /**\n     * Iterable interface.\n     */\n    [Symbol.iterator]() {\n        return this._items[Symbol.iterator]();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/first\n */\n/**\n * Returns first item of the given `iterator`.\n */\nexport function first(iterator) {\n    const iteratorItem = iterator.next();\n    if (iteratorItem.done) {\n        return null;\n    }\n    return iteratorItem.value;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/focustracker\n */\nimport { DomEmitterMixin } from './dom/emittermixin.js';\nimport { ObservableMixin } from './observablemixin.js';\nimport { CKEditorError } from './ckeditorerror.js';\nimport { isElement as _isElement } from 'es-toolkit/compat';\n/**\n * Allows observing a group of DOM `Element`s or {@link module:ui/view~View view instances} whether at least one of them (or their child)\n * is focused.\n *\n * Used by the {@link module:core/editor/editor~Editor} in order to track whether the focus is still within the application,\n * or were used outside of its UI.\n *\n * **Note** `focus` and `blur` listeners use event capturing, so it is only needed to register wrapper `Element`\n * which contain other `focusable` elements. But note that this wrapper element has to be focusable too\n * (have e.g. `tabindex=\"-1\"`).\n *\n * Check out the {@glink framework/deep-dive/ui/focus-tracking \"Deep dive into focus tracking\"} guide to learn more.\n */\nexport class FocusTracker extends /* #__PURE__ */ DomEmitterMixin(/* #__PURE__ */ ObservableMixin()) {\n    /**\n     * List of registered DOM elements.\n     *\n     * @internal\n     */\n    _elements = new Set();\n    /**\n     * List of views with external focus trackers that contribute to the state of this focus tracker.\n     *\n     * @internal\n     */\n    _externalViews = new Set();\n    /**\n     * Asynchronous blur event timeout.\n     */\n    _blurTimeout = null;\n    // @if CK_DEBUG_FOCUSTRACKER // public _label?: string;\n    constructor() {\n        super();\n        this.set('isFocused', false);\n        this.set('focusedElement', null);\n        // @if CK_DEBUG_FOCUSTRACKER // FocusTracker._instances.push( this );\n    }\n    /**\n     * List of registered DOM elements.\n     *\n     * **Note**: The list does do not include elements from {@link #externalViews}.\n     */\n    get elements() {\n        return Array.from(this._elements.values());\n    }\n    /**\n     * List of external focusable views that contribute to the state of this focus tracker. See {@link #add} to learn more.\n     */\n    get externalViews() {\n        return Array.from(this._externalViews.values());\n    }\n    /**\n     * Starts tracking a specified DOM element or a {@link module:ui/view~View} instance.\n     *\n     * * If a DOM element is passed, the focus tracker listens to the `focus` and `blur` events on this element.\n     * Tracked elements are listed in {@link #elements}.\n     * * If a {@link module:ui/view~View} instance is passed that has a `FocusTracker` instance ({@link ~ViewWithFocusTracker}),\n     * the external focus tracker's state ({@link #isFocused}, {@link #focusedElement}) starts contributing to the current tracker instance.\n     * This allows for increasing the \"reach\" of a focus tracker instance, by connecting two or more focus trackers together when DOM\n     * elements they track are located in different subtrees in DOM. External focus trackers are listed in {@link #externalViews}.\n     * * If a {@link module:ui/view~View} instance is passed that has no `FocusTracker` (**not** a {@link ~ViewWithFocusTracker}),\n     * its {@link module:ui/view~View#element} is used to track focus like any other DOM element.\n     */\n    add(elementOrView) {\n        if (isElement(elementOrView)) {\n            this._addElement(elementOrView);\n        }\n        else {\n            if (isViewWithFocusTracker(elementOrView)) {\n                this._addView(elementOrView);\n            }\n            else {\n                if (!elementOrView.element) {\n                    /**\n                     * The {@link module:ui/view~View} added to the {@link module:utils/focustracker~FocusTracker} does not have an\n                     * {@link module:ui/view~View#element}. Make sure the view is {@link module:ui/view~View#render} before adding\n                     * it to the focus tracker.\n                     *\n                     * @error focustracker-add-view-missing-element\n                     */\n                    throw new CKEditorError('focustracker-add-view-missing-element', {\n                        focusTracker: this,\n                        view: elementOrView\n                    });\n                }\n                this._addElement(elementOrView.element);\n            }\n        }\n    }\n    /**\n     * Stops tracking focus in the specified DOM element or a {@link module:ui/view~View view instance}. See {@link #add} to learn more.\n     */\n    remove(elementOrView) {\n        if (isElement(elementOrView)) {\n            this._removeElement(elementOrView);\n        }\n        else {\n            if (isViewWithFocusTracker(elementOrView)) {\n                this._removeView(elementOrView);\n            }\n            else {\n                // Assuming that if the view was successfully added, it must have come with an existing #element.\n                this._removeElement(elementOrView.element);\n            }\n        }\n    }\n    /**\n     * Adds a DOM element to the focus tracker and starts listening to the `focus` and `blur` events on it.\n     */\n    _addElement(element) {\n        if (this._elements.has(element)) {\n            /**\n             * This element is already tracked by {@link module:utils/focustracker~FocusTracker}.\n             *\n             * @error focustracker-add-element-already-exist\n             */\n            throw new CKEditorError('focustracker-add-element-already-exist', this);\n        }\n        this.listenTo(element, 'focus', () => {\n            // @if CK_DEBUG_FOCUSTRACKER // console.log( `\"${ getName( this ) }\": Focus with useCapture on DOM element` );\n            const externalFocusedViewInSubtree = this.externalViews.find(view => isExternalViewSubtreeFocused(element, view));\n            if (externalFocusedViewInSubtree) {\n                this._focus(externalFocusedViewInSubtree.element);\n            }\n            else {\n                this._focus(element);\n            }\n        }, { useCapture: true });\n        this.listenTo(element, 'blur', () => {\n            // @if CK_DEBUG_FOCUSTRACKER // console.log( `\"${ getName( this ) }\": Blur with useCapture on DOM element` );\n            this._blur();\n        }, { useCapture: true });\n        this._elements.add(element);\n    }\n    /**\n     * Removes a DOM element from the focus tracker.\n     */\n    _removeElement(element) {\n        if (this._elements.has(element)) {\n            this.stopListening(element);\n            this._elements.delete(element);\n        }\n        if (element === this.focusedElement) {\n            this._blur();\n        }\n    }\n    /**\n     * Adds an external {@link module:ui/view~View view instance} to this focus tracker and makes it contribute to this focus tracker's\n     * state either by its `View#element` or by its `View#focusTracker` instance.\n     */\n    _addView(view) {\n        if (view.element) {\n            this._addElement(view.element);\n        }\n        this.listenTo(view.focusTracker, 'change:focusedElement', () => {\n            // @if CK_DEBUG_FOCUSTRACKER // console.log(\n            // @if CK_DEBUG_FOCUSTRACKER // \t`\"${ getName( this ) }\": Related \"${ getName( view.focusTracker ) }\"#focusedElement = `,\n            // @if CK_DEBUG_FOCUSTRACKER // \tview.focusTracker.focusedElement\n            // @if CK_DEBUG_FOCUSTRACKER // );\n            if (view.focusTracker.focusedElement) {\n                if (view.element) {\n                    this._focus(view.element);\n                }\n            }\n            else {\n                this._blur();\n            }\n        });\n        this._externalViews.add(view);\n    }\n    /**\n     * Removes an external {@link module:ui/view~View view instance} from this focus tracker.\n     */\n    _removeView(view) {\n        if (view.element) {\n            this._removeElement(view.element);\n        }\n        this.stopListening(view.focusTracker);\n        this._externalViews.delete(view);\n    }\n    /**\n     * Destroys the focus tracker by:\n     * - Disabling all event listeners attached to tracked elements or external views.\n     * - Removing all tracked elements and views that were previously added.\n     */\n    destroy() {\n        this.stopListening();\n        this._elements.clear();\n        this._externalViews.clear();\n        this.isFocused = false;\n        this.focusedElement = null;\n    }\n    /**\n     * Stores currently focused element as {@link #focusedElement} and sets {@link #isFocused} `true`.\n     */\n    _focus(element) {\n        // @if CK_DEBUG_FOCUSTRACKER // console.log( `\"${ getName( this ) }\": _focus() on element`, element );\n        this._clearBlurTimeout();\n        this.focusedElement = element;\n        this.isFocused = true;\n    }\n    /**\n     * Clears currently {@link #focusedElement} and sets {@link #isFocused} `false`.\n     *\n     * This method uses `setTimeout()` to change order of `blur` and `focus` events calls, ensuring that moving focus between\n     * two elements within a single focus tracker's scope, will not cause `[ blurA, focusB ]` sequence but just `[ focusB ]`.\n     * The former would cause a momentary change of `#isFocused` to `false` which is not desired because any logic listening to\n     * a focus tracker state would experience UI flashes and glitches as the user focus travels across the UI.\n     */\n    _blur() {\n        const isAnyElementFocused = this.elements.find(element => element.contains(document.activeElement));\n        // Avoid blurs originating from external FTs when the focus still remains in one of the #elements.\n        if (isAnyElementFocused) {\n            return;\n        }\n        const isAnyExternalViewFocused = this.externalViews.find(view => {\n            // Do not consider external views's focus trackers as focused if there's a blur timeout pending.\n            return view.focusTracker.isFocused && !view.focusTracker._blurTimeout;\n        });\n        // Avoid unnecessary DOM blurs coming from #elements when the focus still remains in one of #externalViews.\n        if (isAnyExternalViewFocused) {\n            return;\n        }\n        this._clearBlurTimeout();\n        this._blurTimeout = setTimeout(() => {\n            // @if CK_DEBUG_FOCUSTRACKER // console.log( `\"${ getName( this ) }\": Blur.` );\n            this.focusedElement = null;\n            this.isFocused = false;\n        }, 0);\n    }\n    /**\n     * Clears the asynchronous blur event timeout on demand. See {@link #_blur} to learn more.\n     */\n    _clearBlurTimeout() {\n        clearTimeout(this._blurTimeout);\n        this._blurTimeout = null;\n    }\n}\n/**\n * Checks whether a view is an instance of {@link ~ViewWithFocusTracker}.\n */\nexport function isViewWithFocusTracker(view) {\n    return 'focusTracker' in view && view.focusTracker instanceof FocusTracker;\n}\nfunction isElement(value) {\n    return _isElement(value);\n}\nfunction isExternalViewSubtreeFocused(subTreeRoot, view) {\n    if (isFocusedView(subTreeRoot, view)) {\n        return true;\n    }\n    return !!view.focusTracker.externalViews.find(view => isFocusedView(subTreeRoot, view));\n}\nfunction isFocusedView(subTreeRoot, view) {\n    // Note: You cannot depend on externalView.focusTracker.focusedElement because blurs are asynchronous and the value may\n    // be outdated when moving focus between two elements. Using document.activeElement instead.\n    return !!view.element && view.element.contains(document.activeElement) && subTreeRoot.contains(view.element);\n}\n// @if CK_DEBUG_FOCUSTRACKER // declare global {\n// @if CK_DEBUG_FOCUSTRACKER // \tinterface Window {\n// @if CK_DEBUG_FOCUSTRACKER // \t\tlogFocusTrackers: Function;\n// @if CK_DEBUG_FOCUSTRACKER // \t}\n// @if CK_DEBUG_FOCUSTRACKER // }\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // function getName( focusTracker: FocusTracker ): string {\n// @if CK_DEBUG_FOCUSTRACKER // \treturn focusTracker._label || 'Unknown';\n// @if CK_DEBUG_FOCUSTRACKER // }\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // function logState(\n// @if CK_DEBUG_FOCUSTRACKER // \tfocusTracker: FocusTracker,\n// @if CK_DEBUG_FOCUSTRACKER // \tkeysToLog: Array<string> = [ 'isFocused', 'focusedElement' ]\n// @if CK_DEBUG_FOCUSTRACKER // ): string {\n// @if CK_DEBUG_FOCUSTRACKER // \tkeysToLog.forEach( key => { console.log( `${ key }=`, focusTracker[ key ] ) } );\n// @if CK_DEBUG_FOCUSTRACKER // \tconsole.log( 'elements', focusTracker.elements );\n// @if CK_DEBUG_FOCUSTRACKER // \tconsole.log( 'externalViews', focusTracker.externalViews );\n// @if CK_DEBUG_FOCUSTRACKER // }\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // window.logFocusTrackers = (\n// @if CK_DEBUG_FOCUSTRACKER // \tfilter = () => true,\n// @if CK_DEBUG_FOCUSTRACKER // \tkeysToLog: Array<string>\n// @if CK_DEBUG_FOCUSTRACKER // ): void => {\n// @if CK_DEBUG_FOCUSTRACKER // \tconsole.group( 'FocusTrackers' );\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \tfor ( const focusTracker of FocusTracker._instances ) {\n// @if CK_DEBUG_FOCUSTRACKER // \t\tif ( filter( focusTracker ) ) {\n// @if CK_DEBUG_FOCUSTRACKER // \t\t\tconsole.group( `\"${ getName( focusTracker ) }\"` );\n// @if CK_DEBUG_FOCUSTRACKER // \t\t\tlogState( focusTracker, keysToLog );\n// @if CK_DEBUG_FOCUSTRACKER // \t\t\tconsole.groupEnd();\n// @if CK_DEBUG_FOCUSTRACKER // \t\t}\n// @if CK_DEBUG_FOCUSTRACKER // \t}\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \tconsole.groupEnd();\n// @if CK_DEBUG_FOCUSTRACKER // };\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // window.logFocusTrackerTree = (\n// @if CK_DEBUG_FOCUSTRACKER // \trootFocusTracker: FocusTracker,\n// @if CK_DEBUG_FOCUSTRACKER // \tfilter = () => true,\n// @if CK_DEBUG_FOCUSTRACKER // \tkeysToLog: Array<string>\n// @if CK_DEBUG_FOCUSTRACKER // ): void => {\n// @if CK_DEBUG_FOCUSTRACKER // \tconsole.group( 'FocusTrackers tree' );\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \tlogBranch( rootFocusTracker, filter );\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \tfunction logBranch( focusTracker, filter ) {\n// @if CK_DEBUG_FOCUSTRACKER // \t\tconsole.group( `\"${ getName( focusTracker ) }\"` );\n// @if CK_DEBUG_FOCUSTRACKER // \t\tlogState( focusTracker, keysToLog );\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \t\tfor ( const externalView of focusTracker.externalViews ) {\n// @if CK_DEBUG_FOCUSTRACKER // \t\t\tif ( filter( externalView.focusTracker ) ) {\n// @if CK_DEBUG_FOCUSTRACKER // \t\t\t\tlogBranch( externalView.focusTracker, filter );\n// @if CK_DEBUG_FOCUSTRACKER // \t\t\t}\n// @if CK_DEBUG_FOCUSTRACKER // \t\t}\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \t\tconsole.groupEnd();\n// @if CK_DEBUG_FOCUSTRACKER // \t}\n// @if CK_DEBUG_FOCUSTRACKER //\n// @if CK_DEBUG_FOCUSTRACKER // \tconsole.groupEnd();\n// @if CK_DEBUG_FOCUSTRACKER // };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/keystrokehandler\n */\nimport { DomEmitterMixin } from './dom/emittermixin.js';\nimport { getCode, parseKeystroke } from './keyboard.js';\n/**\n * Keystroke handler allows registering callbacks for given keystrokes.\n *\n * The most frequent use of this class is through the {@link module:core/editor/editor~Editor#keystrokes `editor.keystrokes`}\n * property. It allows listening to keystrokes executed in the editing view:\n *\n * ```ts\n * editor.keystrokes.set( 'Ctrl+A', ( keyEvtData, cancel ) => {\n * \tconsole.log( 'Ctrl+A has been pressed' );\n * \tcancel();\n * } );\n * ```\n *\n * However, this utility class can be used in various part of the UI. For instance, a certain {@link module:ui/view~View}\n * can use it like this:\n *\n * ```ts\n * class MyView extends View {\n * \tconstructor() {\n * \t\tthis.keystrokes = new KeystrokeHandler();\n *\n * \t\tthis.keystrokes.set( 'tab', handleTabKey );\n * \t}\n *\n * \trender() {\n * \t\tsuper.render();\n *\n * \t\tthis.keystrokes.listenTo( this.element );\n * \t}\n * }\n * ```\n *\n * That keystroke handler will listen to `keydown` events fired in this view's main element.\n *\n */\nexport class KeystrokeHandler {\n    /**\n     * Listener used to listen to events for easier keystroke handler destruction.\n     */\n    _listener;\n    /**\n     * Creates an instance of the keystroke handler.\n     */\n    constructor() {\n        this._listener = new (DomEmitterMixin())();\n    }\n    /**\n     * Starts listening for `keydown` events from a given emitter.\n     */\n    listenTo(emitter) {\n        // The #_listener works here as a kind of dispatcher. It groups the events coming from the same\n        // keystroke so the listeners can be attached to them with different priorities.\n        //\n        // E.g. all the keystrokes with the `keyCode` of 42 coming from the `emitter` are propagated\n        // as a `_keydown:42` event by the `_listener`. If there's a callback created by the `set`\n        // method for this 42 keystroke, it listens to the `_listener#_keydown:42` event only and interacts\n        // only with other listeners of this particular event, thus making it possible to prioritize\n        // the listeners and safely cancel execution, when needed. Instead of duplicating the Emitter logic,\n        // the KeystrokeHandler re–uses it to do its job.\n        this._listener.listenTo(emitter, 'keydown', (evt, keyEvtData) => {\n            this._listener.fire('_keydown:' + getCode(keyEvtData), keyEvtData);\n        });\n    }\n    /**\n     * Registers a handler for the specified keystroke.\n     *\n     * @param keystroke Keystroke defined in a format accepted by\n     * the {@link module:utils/keyboard~parseKeystroke} function.\n     * @param callback A function called with the\n     * {@link module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data} object and\n     * a helper function to call both `preventDefault()` and `stopPropagation()` on the underlying event.\n     * @param options Additional options.\n     */\n    set(keystroke, callback, options = {}) {\n        const keyCode = parseKeystroke(keystroke);\n        const priority = options.priority;\n        // Execute the passed callback on KeystrokeHandler#_keydown.\n        // TODO: https://github.com/ckeditor/ckeditor5-utils/issues/144\n        this._listener.listenTo(this._listener, '_keydown:' + keyCode, (evt, keyEvtData) => {\n            if (options.filter && !options.filter(keyEvtData)) {\n                return;\n            }\n            callback(keyEvtData, () => {\n                // Stop the event in the DOM: no listener in the web page\n                // will be triggered by this event.\n                keyEvtData.preventDefault();\n                keyEvtData.stopPropagation();\n                // Stop the event in the KeystrokeHandler: no more callbacks\n                // will be executed for this keystroke.\n                evt.stop();\n            });\n            // Mark this keystroke as handled by the callback. See: #press.\n            evt.return = true;\n        }, { priority });\n    }\n    /**\n     * Triggers a keystroke handler for a specified key combination, if such a keystroke was {@link #set defined}.\n     *\n     * @param keyEvtData Key event data.\n     * @returns Whether the keystroke was handled.\n     */\n    press(keyEvtData) {\n        return !!this._listener.fire('_keydown:' + getCode(keyEvtData), keyEvtData);\n    }\n    /**\n     * Stops listening to `keydown` events from the given emitter.\n     */\n    stopListening(emitter) {\n        this._listener.stopListening(emitter);\n    }\n    /**\n     * Destroys the keystroke handler.\n     */\n    destroy() {\n        this.stopListening();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/tomap\n */\nimport { objectToMap } from './objecttomap.js';\nimport { isIterable } from './isiterable.js';\n/**\n * Transforms object or iterable to map. Iterable needs to be in the format acceptable by the `Map` constructor.\n *\n * ```ts\n * map = toMap( { 'foo': 1, 'bar': 2 } );\n * map = toMap( [ [ 'foo', 1 ], [ 'bar', 2 ] ] );\n * map = toMap( anotherMap );\n * ```\n *\n * @param data Object or iterable to transform.\n * @returns Map created from data.\n */\nexport function toMap(data) {\n    if (isIterable(data)) {\n        return new Map(data);\n    }\n    else {\n        return objectToMap(data);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/objecttomap\n */\n/**\n * Transforms object to map.\n *\n * ```ts\n * const map = objectToMap( { 'foo': 1, 'bar': 2 } );\n * map.get( 'foo' ); // 1\n * ```\n *\n * **Note**: For mixed data (`Object` or `Iterable`) there's a dedicated {@link module:utils/tomap~toMap} function.\n *\n * @param obj Object to transform.\n * @returns Map created from object.\n */\nexport function objectToMap(obj) {\n    const map = new Map();\n    for (const key in obj) {\n        map.set(key, obj[key]);\n    }\n    return map;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/splicearray\n */\n/**\n * Splices one array into another. To be used instead of `Array.prototype.splice` for better\n * performance and because the latter may throw \"Maximum call stack size exceeded\" error when\n * passing huge number of items to insert.\n *\n * ```ts\n * spliceArray( [ 1, 2 ], [ 3, 4 ], 0 );\t// [ 3, 4, 1, 2 ]\n * spliceArray( [ 1, 2 ], [ 3, 4 ], 1 );\t// [ 1, 3, 4, 2 ]\n * spliceArray( [ 1, 2 ], [ 3, 4 ], 2 );\t// [ 1, 2, 3, 4 ]\n * spliceArray( [ 1, 2 ], [],       0 );\t// [ 1, 2 ]\n * ```\n *\n * @param targetArray Array to be spliced.\n * @param insertArray Array of elements to be inserted to target.\n * @param index Index at which nodes should be inserted.\n *\n * @returns New spliced array.\n */\nexport function spliceArray(targetArray, insertArray, index) {\n    const originalLength = targetArray.length;\n    const insertLength = insertArray.length;\n    // Shift elements in the target array to make space for insertArray\n    for (let i = originalLength - 1; i >= index; i--) {\n        targetArray[i + insertLength] = targetArray[i];\n    }\n    // Copy elements from insertArray into the target array\n    for (let i = 0; i < insertLength; i++) {\n        targetArray[index + i] = insertArray[i];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/delay\n */\n/**\n * Returns a function wrapper that will trigger a function after a specified wait time.\n * The timeout can be canceled by calling the cancel function on the returned wrapped function.\n *\n * @param func The function to wrap.\n * @param wait The timeout in ms.\n */\nexport function delay(func, wait) {\n    let timer;\n    function delayed(...args) {\n        delayed.cancel();\n        timer = setTimeout(() => func(...args), wait);\n    }\n    delayed.cancel = () => {\n        clearTimeout(timer);\n    };\n    return delayed;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/parsebase64encodedobject\n */\n/**\n * Parses a base64-encoded object and returns the decoded object, or null if the decoding was unsuccessful.\n */\nexport function parseBase64EncodedObject(encoded) {\n    try {\n        if (!encoded.startsWith('ey')) {\n            return null;\n        }\n        const decoded = atob(encoded.replace(/-/g, '+').replace(/_/g, '/'));\n        return JSON.parse(decoded);\n    }\n    catch {\n        return null;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/formathtml\n */\n/**\n * A simple (and naive) HTML code formatter that returns a formatted HTML markup that can be easily\n * parsed by human eyes. It beautifies the HTML code by adding new lines between elements that behave like block elements\n * (https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements\n * and a few more like `tr`, `td`, and similar ones) and inserting indents for nested content.\n *\n * WARNING: This function works only on a text that does not contain any indentations or new lines.\n * Calling this function on the already formatted text will damage the formatting.\n *\n * @param input An HTML string to format.\n */\nexport function formatHtml(input) {\n    // A list of block-like elements around which the new lines should be inserted, and within which\n    // the indentation of their children should be increased.\n    // The list is partially based on https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements that contains\n    // a full list of HTML block-level elements.\n    // A void element is an element that cannot have any child - https://html.spec.whatwg.org/multipage/syntax.html#void-elements.\n    // Note that <pre> element is not listed on this list to avoid breaking whitespace formatting.\n    // Note that <br> element is not listed and handled separately so no additional white spaces are injected.\n    const elementsToFormat = [\n        { name: 'address', isVoid: false },\n        { name: 'article', isVoid: false },\n        { name: 'aside', isVoid: false },\n        { name: 'blockquote', isVoid: false },\n        { name: 'details', isVoid: false },\n        { name: 'dialog', isVoid: false },\n        { name: 'dd', isVoid: false },\n        { name: 'div', isVoid: false },\n        { name: 'dl', isVoid: false },\n        { name: 'dt', isVoid: false },\n        { name: 'fieldset', isVoid: false },\n        { name: 'figcaption', isVoid: false },\n        { name: 'figure', isVoid: false },\n        { name: 'footer', isVoid: false },\n        { name: 'form', isVoid: false },\n        { name: 'h1', isVoid: false },\n        { name: 'h2', isVoid: false },\n        { name: 'h3', isVoid: false },\n        { name: 'h4', isVoid: false },\n        { name: 'h5', isVoid: false },\n        { name: 'h6', isVoid: false },\n        { name: 'header', isVoid: false },\n        { name: 'hgroup', isVoid: false },\n        { name: 'hr', isVoid: true },\n        { name: 'li', isVoid: false },\n        { name: 'main', isVoid: false },\n        { name: 'nav', isVoid: false },\n        { name: 'ol', isVoid: false },\n        { name: 'p', isVoid: false },\n        { name: 'section', isVoid: false },\n        { name: 'table', isVoid: false },\n        { name: 'tbody', isVoid: false },\n        { name: 'td', isVoid: false },\n        { name: 'th', isVoid: false },\n        { name: 'thead', isVoid: false },\n        { name: 'tr', isVoid: false },\n        { name: 'ul', isVoid: false }\n    ];\n    const elementNamesToFormat = elementsToFormat.map(element => element.name).join('|');\n    // It is not the fastest way to format the HTML markup but the performance should be good enough.\n    const lines = input\n        // Add new line before and after `<tag>` and `</tag>`.\n        // It may separate individual elements with two new lines, but this will be fixed below.\n        .replace(new RegExp(`</?(${elementNamesToFormat})( .*?)?>`, 'g'), '\\n$&\\n')\n        // Keep `<br>`s at the end of line to avoid adding additional whitespaces before `<br>`.\n        .replace(/<br[^>]*>/g, '$&\\n')\n        // Divide input string into lines, which start with either an opening tag, a closing tag, or just a text.\n        .split('\\n');\n    let indentCount = 0;\n    let isPreformattedLine = false;\n    return lines\n        .map(line => {\n        isPreformattedLine = isPreformattedBlockLine(line, isPreformattedLine);\n        // Ignore empty lines outside a <pre> block.\n        if (!line.length && !isPreformattedLine) {\n            return '';\n        }\n        if (isNonVoidOpeningTag(line, elementsToFormat)) {\n            return indentLine(line, indentCount++);\n        }\n        if (isClosingTag(line, elementsToFormat)) {\n            return indentLine(line, --indentCount);\n        }\n        if (isPreformattedLine === 'middle' || isPreformattedLine === 'last') {\n            return indentLine(line, 0);\n        }\n        return indentLine(line, indentCount);\n    })\n        .join('')\n        .trimEnd();\n}\n/**\n * Checks, if an argument is an opening tag of a non-void element to be formatted.\n *\n * @param line String to check.\n * @param elementsToFormat Elements to be formatted.\n */\nfunction isNonVoidOpeningTag(line, elementsToFormat) {\n    return elementsToFormat.some(element => {\n        if (element.isVoid) {\n            return false;\n        }\n        if (!new RegExp(`<${element.name}( .*?)?>`).test(line)) {\n            return false;\n        }\n        return true;\n    });\n}\n/**\n * Checks, if an argument is a closing tag.\n *\n * @param line String to check.\n * @param elementsToFormat Elements to be formatted.\n */\nfunction isClosingTag(line, elementsToFormat) {\n    return elementsToFormat.some(element => {\n        return new RegExp(`</${element.name}>`).test(line);\n    });\n}\n/**\n * Indents a line by a specified number of characters.\n *\n * @param line Line to indent.\n * @param indentCount Number of characters to use for indentation.\n * @param indentChar Indentation character(s). 4 spaces by default.\n */\nfunction indentLine(line, indentCount, indentChar = '    ') {\n    // More about Math.max() here in https://github.com/ckeditor/ckeditor5/issues/10698.\n    return `${indentChar.repeat(Math.max(0, indentCount))}${line}\\n`;\n}\n/**\n * Checks whether a line belongs to a preformatted (`<pre>`) block.\n *\n * @param line Line to check.\n * @param isPreviousLinePreFormatted Information on whether the previous line was preformatted (and how).\n */\nfunction isPreformattedBlockLine(line, isPreviousLinePreFormatted) {\n    const isPreOpen = /<pre( .*?)?>/.test(line);\n    const isPreClose = /<\\/pre>/.test(line);\n    if (isPreOpen && isPreClose) {\n        // If both an opening and closing a <pre> tag, no special treatment needed.\n        return false;\n    }\n    else if (isPreOpen) {\n        return 'first';\n    }\n    else if (isPreClose) {\n        return 'last';\n    }\n    else if (isPreviousLinePreFormatted === 'first' || isPreviousLinePreFormatted === 'middle') {\n        // This line is just after a 'first' or 'middle' line of a multi-line pre-block.\n        return 'middle';\n    }\n    else {\n        return false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Set of utils to handle unicode characters.\n *\n * @module utils/unicode\n */\n/**\n * Checks whether given `character` is a combining mark.\n *\n * @param character Character to check.\n */\nexport function isCombiningMark(character) {\n    // eslint-disable-next-line no-misleading-character-class\n    return !!character && character.length == 1 && /[\\u0300-\\u036f\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\u20d0-\\u20ff\\ufe20-\\ufe2f]/.test(character);\n}\n/**\n * Checks whether given `character` is a high half of surrogate pair.\n *\n * Using UTF-16 terminology, a surrogate pair denotes UTF-16 character using two UTF-8 characters. The surrogate pair\n * consist of high surrogate pair character followed by low surrogate pair character.\n *\n * @param character Character to check.\n */\nexport function isHighSurrogateHalf(character) {\n    return !!character && character.length == 1 && /[\\ud800-\\udbff]/.test(character);\n}\n/**\n * Checks whether given `character` is a low half of surrogate pair.\n *\n * Using UTF-16 terminology, a surrogate pair denotes UTF-16 character using two UTF-8 characters. The surrogate pair\n * consist of high surrogate pair character followed by low surrogate pair character.\n *\n * @param character Character to check.\n */\nexport function isLowSurrogateHalf(character) {\n    return !!character && character.length == 1 && /[\\udc00-\\udfff]/.test(character);\n}\n/**\n * Checks whether given offset in a string is inside a surrogate pair (between two surrogate halves).\n *\n * @param string String to check.\n * @param offset Offset to check.\n */\nexport function isInsideSurrogatePair(string, offset) {\n    return isHighSurrogateHalf(string.charAt(offset - 1)) && isLowSurrogateHalf(string.charAt(offset));\n}\n/**\n * Checks whether given offset in a string is between base character and combining mark or between two combining marks.\n *\n * @param string String to check.\n * @param offset Offset to check.\n */\nexport function isInsideCombinedSymbol(string, offset) {\n    return isCombiningMark(string.charAt(offset));\n}\nconst EMOJI_PATTERN = /* #__PURE__ */ buildEmojiRegexp();\n/**\n * Checks whether given offset in a string is inside multi-character emoji sequence.\n *\n * @param string String to check.\n * @param offset Offset to check.\n */\nexport function isInsideEmojiSequence(string, offset) {\n    const matches = String(string).matchAll(EMOJI_PATTERN);\n    return Array.from(matches).some(match => match.index < offset && offset < match.index + match[0].length);\n}\nfunction buildEmojiRegexp() {\n    const parts = [\n        // Emoji Tag Sequence (ETS)\n        /\\p{Emoji}[\\u{E0020}-\\u{E007E}]+\\u{E007F}/u,\n        // Emoji Keycap Sequence\n        /\\p{Emoji}\\u{FE0F}?\\u{20E3}/u,\n        // Emoji Presentation Sequence\n        /\\p{Emoji}\\u{FE0F}/u,\n        // Single-Character Emoji / Emoji Modifier Sequence\n        /(?=\\p{General_Category=Other_Symbol})\\p{Emoji}\\p{Emoji_Modifier}*/u\n    ];\n    const flagSequence = /\\p{Regional_Indicator}{2}/u.source;\n    const emoji = '(?:' + parts.map(part => part.source).join('|') + ')';\n    const sequence = `${flagSequence}|${emoji}(?:\\u{200D}${emoji})*`;\n    return new RegExp(sequence, 'ug');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/decodelicensekey\n*/\nimport { parseBase64EncodedObject } from './parsebase64encodedobject.js';\n/**\n * Parses the provided license key and returns the decoded object, or null if the decoding was unsuccessful.\n *\n * @param licenseKey The license key to decode.\n */\nexport function decodeLicenseKey(licenseKey) {\n    if (!licenseKey) {\n        return null;\n    }\n    const encodedPayload = getLicenseKeyPayload(licenseKey);\n    if (!encodedPayload) {\n        return null;\n    }\n    return parseBase64EncodedObject(encodedPayload);\n}\nfunction getLicenseKeyPayload(licenseKey) {\n    const parts = licenseKey.split('.');\n    if (parts.length != 3) {\n        return null;\n    }\n    return parts[1];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/componentfactory\n */\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * A helper class implementing the UI component ({@link module:ui/view~View view}) factory.\n *\n * It allows functions producing specific UI components to be registered under their unique names\n * in the factory. A registered component can be then instantiated by providing its name.\n * Note that the names are case insensitive.\n *\n * ```ts\n * // The editor provides localization tools for the factory.\n * const factory = new ComponentFactory( editor );\n *\n * factory.add( 'foo', locale => new FooView( locale ) );\n * factory.add( 'bar', locale => new BarView( locale ) );\n *\n * // An instance of FooView.\n * const fooInstance = factory.create( 'foo' );\n *\n * // Names are case insensitive so this is also allowed:\n * const barInstance = factory.create( 'Bar' );\n * ```\n *\n * The {@link module:core/editor/editor~Editor#locale editor locale} is passed to the factory\n * function when {@link module:ui/componentfactory~ComponentFactory#create} is called.\n */\nexport class ComponentFactory {\n    /**\n     * The editor instance that the factory belongs to.\n     */\n    editor;\n    /**\n     * Registered component factories.\n     */\n    _components = new Map();\n    /**\n     * Creates an instance of the factory.\n     *\n     * @param editor The editor instance.\n     */\n    constructor(editor) {\n        this.editor = editor;\n    }\n    /**\n     * Returns an iterator of registered component names. Names are returned in lower case.\n     */\n    *names() {\n        for (const value of this._components.values()) {\n            yield value.originalName;\n        }\n    }\n    /**\n     * Registers a component factory function that will be used by the\n     * {@link #create create} method and called with the\n     * {@link module:core/editor/editor~Editor#locale editor locale} as an argument,\n     * allowing localization of the {@link module:ui/view~View view}.\n     *\n     * @param name The name of the component.\n     * @param callback The callback that returns the component.\n     */\n    add(name, callback) {\n        this._components.set(getNormalized(name), { callback, originalName: name });\n    }\n    /**\n     * Creates an instance of a component registered in the factory under a specific name.\n     *\n     * When called, the {@link module:core/editor/editor~Editor#locale editor locale} is passed to\n     * the previously {@link #add added} factory function, allowing localization of the\n     * {@link module:ui/view~View view}.\n     *\n     * @param name The name of the component.\n     * @returns The instantiated component view.\n     */\n    create(name) {\n        if (!this.has(name)) {\n            /**\n             * The required component is not registered in the component factory. Please make sure\n             * the provided name is correct and the component has been correctly\n             * {@link module:ui/componentfactory~ComponentFactory#add added} to the factory.\n             *\n             * @error componentfactory-item-missing\n             * @param {string} name The name of the missing component.\n             */\n            throw new CKEditorError('componentfactory-item-missing', this, { name });\n        }\n        return this._components.get(getNormalized(name)).callback(this.editor.locale);\n    }\n    /**\n     * Checks if a component of a given name is registered in the factory.\n     *\n     * @param name The name of the component.\n     */\n    has(name) {\n        return this._components.has(getNormalized(name));\n    }\n}\n/**\n * Ensures that the component name used as the key in the internal map is in lower case.\n */\nfunction getNormalized(name) {\n    return String(name).toLowerCase();\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/viewcollection\n */\nimport { CKEditorError, Collection } from '@ckeditor/ckeditor5-utils';\n/**\n * Collects {@link module:ui/view~View} instances.\n *\n * ```ts\n * const parentView = new ParentView( locale );\n * const collection = new ViewCollection( locale );\n *\n * collection.setParent( parentView.element );\n *\n * const viewA = new ChildView( locale );\n * const viewB = new ChildView( locale );\n * ```\n *\n * View collection renders and manages view {@link module:ui/view~View#element elements}:\n *\n * ```ts\n * collection.add( viewA );\n * collection.add( viewB );\n *\n * console.log( parentView.element.firsChild ); // -> viewA.element\n * console.log( parentView.element.lastChild ); // -> viewB.element\n * ```\n *\n * It {@link module:ui/viewcollection~ViewCollection#delegate propagates} DOM events too:\n *\n * ```ts\n * // Delegate #click and #keydown events from viewA and viewB to the parentView.\n * collection.delegate( 'click' ).to( parentView );\n *\n * parentView.on( 'click', ( evt ) => {\n * \tconsole.log( `${ evt.source } has been clicked.` );\n * } );\n *\n * // This event will be delegated to the parentView.\n * viewB.fire( 'click' );\n * ```\n *\n * **Note**: A view collection can be used directly in the {@link module:ui/template~TemplateDefinition definition}\n * of a {@link module:ui/template~Template template}.\n */\nexport class ViewCollection extends Collection {\n    /**\n     * A parent element within which child views are rendered and managed in DOM.\n     */\n    _parentElement;\n    /**\n     * Creates a new instance of the {@link module:ui/viewcollection~ViewCollection}.\n     *\n     * @param initialItems The initial items of the collection.\n     */\n    constructor(initialItems = []) {\n        super(initialItems, {\n            // An #id Number attribute should be legal and not break the `ViewCollection` instance.\n            // https://github.com/ckeditor/ckeditor5-ui/issues/93\n            idProperty: 'viewUid'\n        });\n        // Handle {@link module:ui/view~View#element} in DOM when a new view is added to the collection.\n        this.on('add', (evt, view, index) => {\n            this._renderViewIntoCollectionParent(view, index);\n        });\n        // Handle {@link module:ui/view~View#element} in DOM when a view is removed from the collection.\n        this.on('remove', (evt, view) => {\n            if (view.element && this._parentElement) {\n                view.element.remove();\n            }\n        });\n        this._parentElement = null;\n    }\n    /**\n     * Destroys the view collection along with child views.\n     * See the view {@link module:ui/view~View#destroy} method.\n     */\n    destroy() {\n        this.map(view => view.destroy());\n    }\n    /**\n     * Sets the parent HTML element of this collection. When parent is set, {@link #add adding} and\n     * {@link #remove removing} views in the collection synchronizes their\n     * {@link module:ui/view~View#element elements} in the parent element.\n     *\n     * @param elementOrDocFragment A new parent element or document fragment.\n     */\n    setParent(elementOrDocFragment) {\n        this._parentElement = elementOrDocFragment;\n        // Take care of the initial collection items passed to the constructor.\n        for (const view of this) {\n            this._renderViewIntoCollectionParent(view);\n        }\n    }\n    /**\n     * Delegates selected events coming from within views in the collection to any\n     * {@link module:utils/emittermixin~Emitter}.\n     *\n     * For the following views and collection:\n     *\n     * ```ts\n     * const viewA = new View();\n     * const viewB = new View();\n     * const viewC = new View();\n     *\n     * const views = parentView.createCollection();\n     *\n     * views.delegate( 'eventX' ).to( viewB );\n     * views.delegate( 'eventX', 'eventY' ).to( viewC );\n     *\n     * views.add( viewA );\n     * ```\n     *\n     * the `eventX` is delegated (fired by) `viewB` and `viewC` along with `customData`:\n     *\n     * ```ts\n     * viewA.fire( 'eventX', customData );\n     * ```\n     *\n     * and `eventY` is delegated (fired by) `viewC` along with `customData`:\n     *\n     * ```ts\n     * viewA.fire( 'eventY', customData );\n     * ```\n     *\n     * See {@link module:utils/emittermixin~Emitter#delegate}.\n     *\n     * @param events {@link module:ui/view~View} event names to be delegated to another\n     * {@link module:utils/emittermixin~Emitter}.\n     * @returns Object with `to` property, a function which accepts the destination\n     * of {@link module:utils/emittermixin~Emitter#delegate delegated} events.\n     */\n    delegate(...events) {\n        if (!events.length || !isStringArray(events)) {\n            /**\n             * All event names must be strings.\n             *\n             * @error ui-viewcollection-delegate-wrong-events\n             */\n            throw new CKEditorError('ui-viewcollection-delegate-wrong-events', this);\n        }\n        return {\n            to: dest => {\n                // Activate delegating on existing views in this collection.\n                for (const view of this) {\n                    for (const evtName of events) {\n                        view.delegate(evtName).to(dest);\n                    }\n                }\n                // Activate delegating on future views in this collection.\n                this.on('add', (evt, view) => {\n                    for (const evtName of events) {\n                        view.delegate(evtName).to(dest);\n                    }\n                });\n                // Deactivate delegating when view is removed from this collection.\n                this.on('remove', (evt, view) => {\n                    for (const evtName of events) {\n                        view.stopDelegating(evtName, dest);\n                    }\n                });\n            }\n        };\n    }\n    /**\n     * This method {@link module:ui/view~View#render renders} a new view added to the collection.\n     *\n     * If the {@link #_parentElement parent element} of the collection is set, this method also adds\n     * the view's {@link module:ui/view~View#element} as a child of the parent in DOM at a specified index.\n     *\n     * **Note**: If index is not specified, the view's element is pushed as the last child\n     * of the parent element.\n     *\n     * @param view A new view added to the collection.\n     * @param index An index the view holds in the collection. When not specified,\n     * the view is added at the end.\n     */\n    _renderViewIntoCollectionParent(view, index) {\n        if (!view.isRendered) {\n            view.render();\n        }\n        if (view.element && this._parentElement) {\n            this._parentElement.insertBefore(view.element, this._parentElement.children[index]);\n        }\n    }\n    /**\n     * Removes a child view from the collection. If the {@link #setParent parent element} of the\n     * collection has been set, the {@link module:ui/view~View#element element} of the view is also removed\n     * in DOM, reflecting the order of the collection.\n     *\n     * See the {@link #add} method.\n     *\n     * @param subject The view to remove, its id or index in the collection.\n     * @returns The removed view.\n     */\n    remove(subject) {\n        return super.remove(subject);\n    }\n}\n/**\n * Check if all entries of the array are of `String` type.\n *\n * @param arr An array to be checked.\n */\nfunction isStringArray(arr) {\n    return arr.every(a => typeof a == 'string');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/template\n */\nimport { View } from './view.js';\nimport { ViewCollection } from './viewcollection.js';\nimport { CKEditorError, EmitterMixin, isNode, toArray } from '@ckeditor/ckeditor5-utils';\nimport { isObject, cloneDeepWith } from 'es-toolkit/compat';\nconst xhtmlNs = 'http://www.w3.org/1999/xhtml';\n/**\n * A basic Template class. It renders a DOM HTML element or text from a\n * {@link module:ui/template~TemplateDefinition definition} and supports element attributes, children,\n * bindings to {@link module:utils/observablemixin~Observable observables} and DOM event propagation.\n *\n * A simple template can look like this:\n *\n * ```ts\n * const bind = Template.bind( observable, emitter );\n *\n * new Template( {\n * \ttag: 'p',\n * \tattributes: {\n * \t\tclass: 'foo',\n * \t\tstyle: {\n * \t\t\tbackgroundColor: 'yellow'\n * \t\t}\n * \t},\n * \ton: {\n * \t\tclick: bind.to( 'clicked' )\n * \t},\n * \tchildren: [\n * \t\t'A paragraph.'\n * \t]\n * } ).render();\n * ```\n *\n * and it will render the following HTML element:\n *\n * ```html\n * <p class=\"foo\" style=\"background-color: yellow;\">A paragraph.</p>\n * ```\n *\n * Additionally, the `observable` will always fire `clicked` upon clicking `<p>` in the DOM.\n *\n * See {@link module:ui/template~TemplateDefinition} to know more about templates and complex\n * template definitions.\n */\nexport class Template extends /* #__PURE__ */ EmitterMixin() {\n    ns;\n    /**\n     * The tag (`tagName`) of this template, e.g. `div`. It also indicates that the template\n     * renders to an HTML element.\n     */\n    tag;\n    /**\n     * The text of the template. It also indicates that the template renders to a DOM text node.\n     */\n    text;\n    /**\n     * The attributes of the template, e.g. `{ id: [ 'ck-id' ] }`, corresponding with\n     * the attributes of an HTML element.\n     *\n     * **Note**: This property only makes sense when {@link #tag} is defined.\n     */\n    attributes;\n    /**\n     * The children of the template. They can be either:\n     * * independent instances of {@link ~Template} (sub–templates),\n     * * native DOM Nodes.\n     *\n     * **Note**: This property only makes sense when {@link #tag} is defined.\n     */\n    children;\n    /**\n     * The DOM event listeners of the template.\n     */\n    eventListeners;\n    /**\n     * Indicates whether this particular Template instance has been\n     * {@link #render rendered}.\n     */\n    _isRendered;\n    /**\n     * The data used by the {@link #revert} method to restore a node to its original state.\n     *\n     * See: {@link #apply}.\n     */\n    _revertData;\n    /**\n     * Creates an instance of the {@link ~Template} class.\n     *\n     * @param def The definition of the template.\n     */\n    constructor(def) {\n        super();\n        Object.assign(this, normalize(clone(def)));\n        this._isRendered = false;\n        this._revertData = null;\n    }\n    /**\n     * Renders a DOM Node (an HTML element or text) out of the template.\n     *\n     * ```ts\n     * const domNode = new Template( { ... } ).render();\n     * ```\n     *\n     * See: {@link #apply}.\n     */\n    render() {\n        const node = this._renderNode({\n            intoFragment: true\n        });\n        this._isRendered = true;\n        return node;\n    }\n    /**\n     * Applies the template to an existing DOM Node, either HTML element or text.\n     *\n     * **Note:** No new DOM nodes will be created. Applying extends:\n     *\n     * {@link module:ui/template~TemplateDefinition attributes},\n     * {@link module:ui/template~TemplateDefinition event listeners}, and\n     * `textContent` of {@link module:ui/template~TemplateDefinition children} only.\n     *\n     * **Note:** Existing `class` and `style` attributes are extended when a template\n     * is applied to an HTML element, while other attributes and `textContent` are overridden.\n     *\n     * **Note:** The process of applying a template can be easily reverted using the\n     * {@link module:ui/template~Template#revert} method.\n     *\n     * ```ts\n     * const element = document.createElement( 'div' );\n     * const observable = new Model( { divClass: 'my-div' } );\n     * const emitter = Object.create( EmitterMixin );\n     * const bind = Template.bind( observable, emitter );\n     *\n     * new Template( {\n     * \tattributes: {\n     * \t\tid: 'first-div',\n     * \t\tclass: bind.to( 'divClass' )\n     * \t},\n     * \ton: {\n     * \t\tclick: bind( 'elementClicked' ) // Will be fired by the observable.\n     * \t},\n     * \tchildren: [\n     * \t\t'Div text.'\n     * \t]\n     * } ).apply( element );\n     *\n     * console.log( element.outerHTML ); // -> '<div id=\"first-div\" class=\"my-div\"></div>'\n     * ```\n     *\n     * @see module:ui/template~Template#render\n     * @see module:ui/template~Template#revert\n     * @param node Root node for the template to apply.\n     */\n    apply(node) {\n        this._revertData = getEmptyRevertData();\n        this._renderNode({\n            node,\n            intoFragment: false,\n            isApplying: true,\n            revertData: this._revertData\n        });\n        return node;\n    }\n    /**\n     * Reverts a template {@link module:ui/template~Template#apply applied} to a DOM node.\n     *\n     * @param node The root node for the template to revert. In most of the cases, it is the\n     * same node used by {@link module:ui/template~Template#apply}.\n     */\n    revert(node) {\n        if (!this._revertData) {\n            /**\n             * Attempting to revert a template which has not been applied yet.\n             *\n             * @error ui-template-revert-not-applied\n             */\n            throw new CKEditorError('ui-template-revert-not-applied', [this, node]);\n        }\n        this._revertTemplateFromNode(node, this._revertData);\n    }\n    /**\n     * Returns an iterator which traverses the template in search of {@link module:ui/view~View}\n     * instances and returns them one by one.\n     *\n     * ```ts\n     * const viewFoo = new View();\n     * const viewBar = new View();\n     * const viewBaz = new View();\n     * const template = new Template( {\n     * \ttag: 'div',\n     * \tchildren: [\n     * \t\tviewFoo,\n     * \t\t{\n     * \t\t\ttag: 'div',\n     * \t\t\tchildren: [\n     * \t\t\t\tviewBar\n     * \t\t\t]\n     * \t\t},\n     * \t\tviewBaz\n     * \t]\n     * } );\n     *\n     * // Logs: viewFoo, viewBar, viewBaz\n     * for ( const view of template.getViews() ) {\n     * \tconsole.log( view );\n     * }\n     * ```\n     */\n    *getViews() {\n        function* search(def) {\n            if (def.children) {\n                for (const child of def.children) {\n                    if (isView(child)) {\n                        yield child;\n                    }\n                    else if (isTemplate(child)) {\n                        yield* search(child);\n                    }\n                }\n            }\n        }\n        yield* search(this);\n    }\n    /**\n     * An entry point to the interface which binds DOM nodes to\n     * {@link module:utils/observablemixin~Observable observables}.\n     * There are two types of bindings:\n     *\n     * * HTML element attributes or text `textContent` synchronized with attributes of an\n     * {@link module:utils/observablemixin~Observable}. Learn more about {@link module:ui/template~BindChain#to}\n     * and {@link module:ui/template~BindChain#if}.\n     *\n     * ```ts\n     * const bind = Template.bind( observable, emitter );\n     *\n     * new Template( {\n     * \tattributes: {\n     * \t\t// Binds the element \"class\" attribute to observable#classAttribute.\n     * \t\tclass: bind.to( 'classAttribute' )\n     * \t}\n     * } ).render();\n     * ```\n     *\n     * * DOM events fired on HTML element propagated through\n     * {@link module:utils/observablemixin~Observable}. Learn more about {@link module:ui/template~BindChain#to}.\n     *\n     * ```ts\n     * const bind = Template.bind( observable, emitter );\n     *\n     * new Template( {\n     * \ton: {\n     * \t\t// Will be fired by the observable.\n     * \t\tclick: bind( 'elementClicked' )\n     * \t}\n     * } ).render();\n     * ```\n     *\n     * Also see {@link module:ui/view~View#bindTemplate}.\n     *\n     * @param observable An observable which provides boundable attributes.\n     * @param emitter An emitter that listens to observable attribute\n     * changes or DOM Events (depending on the kind of the binding). Usually, a {@link module:ui/view~View} instance.\n     */\n    static bind(observable, emitter) {\n        return {\n            to(eventNameOrFunctionOrAttribute, callback) {\n                return new TemplateToBinding({\n                    eventNameOrFunction: eventNameOrFunctionOrAttribute,\n                    attribute: eventNameOrFunctionOrAttribute,\n                    observable, emitter, callback\n                });\n            },\n            if(attribute, valueIfTrue, callback) {\n                return new TemplateIfBinding({\n                    observable, emitter, attribute, valueIfTrue, callback\n                });\n            }\n        };\n    }\n    /**\n     * Extends an existing {@link module:ui/template~Template} instance with some additional content\n     * from another {@link module:ui/template~TemplateDefinition}.\n     *\n     * ```ts\n     * const bind = Template.bind( observable, emitter );\n     *\n     * const template = new Template( {\n     * \ttag: 'p',\n     * \tattributes: {\n     * \t\tclass: 'a',\n     * \t\tdata-x: bind.to( 'foo' )\n     * \t},\n     * \tchildren: [\n     * \t\t{\n     * \t\t\ttag: 'span',\n     * \t\t\tattributes: {\n     * \t\t\t\tclass: 'b'\n     * \t\t\t},\n     * \t\t\tchildren: [\n     * \t\t\t\t'Span'\n     * \t\t\t]\n     * \t\t}\n     * \t]\n     *  } );\n     *\n     * // Instance-level extension.\n     * Template.extend( template, {\n     * \tattributes: {\n     * \t\tclass: 'b',\n     * \t\tdata-x: bind.to( 'bar' )\n     * \t},\n     * \tchildren: [\n     * \t\t{\n     * \t\t\tattributes: {\n     * \t\t\t\tclass: 'c'\n     * \t\t\t}\n     * \t\t}\n     * \t]\n     * } );\n     *\n     * // Child extension.\n     * Template.extend( template.children[ 0 ], {\n     * \tattributes: {\n     * \t\tclass: 'd'\n     * \t}\n     * } );\n     * ```\n     *\n     * the `outerHTML` of `template.render()` is:\n     *\n     * ```html\n     * <p class=\"a b\" data-x=\"{ observable.foo } { observable.bar }\">\n     * \t<span class=\"b c d\">Span</span>\n     * </p>\n     * ```\n     *\n     * @param template An existing template instance to be extended.\n     * @param def Additional definition to be applied to a template.\n     */\n    static extend(template, def) {\n        if (template._isRendered) {\n            /**\n             * Extending a template after rendering may not work as expected. To make sure\n             * the {@link module:ui/template~Template.extend extending} works for an element,\n             * make sure it happens before {@link module:ui/template~Template#render} is called.\n             *\n             * @error template-extend-render\n             */\n            throw new CKEditorError('template-extend-render', [this, template]);\n        }\n        extendTemplate(template, normalize(clone(def)));\n    }\n    /**\n     * Renders a DOM Node (either an HTML element or text) out of the template.\n     *\n     * @param data Rendering data.\n     */\n    _renderNode(data) {\n        let isInvalid;\n        if (data.node) {\n            // When applying, a definition cannot have \"tag\" and \"text\" at the same time.\n            isInvalid = this.tag && this.text;\n        }\n        else {\n            // When rendering, a definition must have either \"tag\" or \"text\": XOR( this.tag, this.text ).\n            isInvalid = this.tag ? this.text : !this.text;\n        }\n        if (isInvalid) {\n            /**\n             * Node definition cannot have the \"tag\" and \"text\" properties at the same time.\n             * Node definition must have either \"tag\" or \"text\" when rendering a new Node.\n             *\n             * @error ui-template-wrong-syntax\n             */\n            throw new CKEditorError('ui-template-wrong-syntax', this);\n        }\n        if (this.text) {\n            return this._renderText(data);\n        }\n        else {\n            return this._renderElement(data);\n        }\n    }\n    /**\n     * Renders an HTML element out of the template.\n     *\n     * @param data Rendering data.\n     */\n    _renderElement(data) {\n        let node = data.node;\n        if (!node) {\n            node = data.node = document.createElementNS(this.ns || xhtmlNs, this.tag);\n        }\n        this._renderAttributes(data);\n        this._renderElementChildren(data);\n        this._setUpListeners(data);\n        return node;\n    }\n    /**\n     * Renders a text node out of {@link module:ui/template~Template#text}.\n     *\n     * @param data Rendering data.\n     */\n    _renderText(data) {\n        let node = data.node;\n        // Save the original textContent to revert it in #revert().\n        if (node) {\n            data.revertData.text = node.textContent;\n        }\n        else {\n            node = data.node = document.createTextNode('');\n        }\n        // Check if this Text Node is bound to Observable. Cases:\n        //\n        //\t\ttext: [ Template.bind( ... ).to( ... ) ]\n        //\n        //\t\ttext: [\n        //\t\t\t'foo',\n        //\t\t\tTemplate.bind( ... ).to( ... ),\n        //\t\t\t...\n        //\t\t]\n        //\n        if (hasTemplateBinding(this.text)) {\n            this._bindToObservable({\n                schema: this.text,\n                updater: getTextUpdater(node),\n                data\n            });\n        }\n        // Simply set text. Cases:\n        //\n        //\t\ttext: [ 'all', 'are', 'static' ]\n        //\n        //\t\ttext: [ 'foo' ]\n        //\n        else {\n            node.textContent = this.text.join('');\n        }\n        return node;\n    }\n    /**\n     * Renders HTML element attributes out of {@link module:ui/template~Template#attributes}.\n     *\n     * @param data Rendering data.\n     */\n    _renderAttributes(data) {\n        if (!this.attributes) {\n            return;\n        }\n        const node = data.node;\n        const revertData = data.revertData;\n        for (const attrName in this.attributes) {\n            // Current attribute value in DOM.\n            const domAttrValue = node.getAttribute(attrName);\n            // The value to be set.\n            const attrValue = this.attributes[attrName];\n            // Save revert data.\n            if (revertData) {\n                revertData.attributes[attrName] = domAttrValue;\n            }\n            // Detect custom namespace:\n            //\n            //\t\tclass: {\n            //\t\t\tns: 'abc',\n            //\t\t\tvalue: Template.bind( ... ).to( ... )\n            //\t\t}\n            //\n            const attrNs = isNamespaced(attrValue) ? attrValue[0].ns : null;\n            // Activate binding if one is found. Cases:\n            //\n            //\t\tclass: [\n            //\t\t\tTemplate.bind( ... ).to( ... )\n            //\t\t]\n            //\n            //\t\tclass: [\n            //\t\t\t'bar',\n            //\t\t\tTemplate.bind( ... ).to( ... ),\n            //\t\t\t'baz'\n            //\t\t]\n            //\n            //\t\tclass: {\n            //\t\t\tns: 'abc',\n            //\t\t\tvalue: Template.bind( ... ).to( ... )\n            //\t\t}\n            //\n            if (hasTemplateBinding(attrValue)) {\n                // Normalize attributes with additional data like namespace:\n                //\n                //\t\tclass: {\n                //\t\t\tns: 'abc',\n                //\t\t\tvalue: [ ... ]\n                //\t\t}\n                //\n                const valueToBind = isNamespaced(attrValue) ? attrValue[0].value : attrValue;\n                // Extend the original value of attributes like \"style\" and \"class\",\n                // don't override them.\n                if (revertData && shouldExtend(attrName)) {\n                    valueToBind.unshift(domAttrValue);\n                }\n                this._bindToObservable({\n                    schema: valueToBind,\n                    updater: getAttributeUpdater(node, attrName, attrNs),\n                    data\n                });\n            }\n            // Style attribute could be an Object so it needs to be parsed in a specific way.\n            //\n            //\t\tstyle: {\n            //\t\t\twidth: '100px',\n            //\t\t\theight: Template.bind( ... ).to( ... )\n            //\t\t}\n            //\n            else if (attrName == 'style' && typeof attrValue[0] !== 'string') {\n                this._renderStyleAttribute(attrValue[0], data);\n            }\n            // Otherwise simply set the static attribute:\n            //\n            //\t\tclass: [ 'foo' ]\n            //\n            //\t\tclass: [ 'all', 'are', 'static' ]\n            //\n            //\t\tclass: [\n            //\t\t\t{\n            //\t\t\t\tns: 'abc',\n            //\t\t\t\tvalue: [ 'foo' ]\n            //\t\t\t}\n            //\t\t]\n            //\n            else {\n                // Extend the original value of attributes like \"style\" and \"class\",\n                // don't override them.\n                if (revertData && domAttrValue && shouldExtend(attrName)) {\n                    attrValue.unshift(domAttrValue);\n                }\n                const value = attrValue\n                    // Retrieve \"values\" from:\n                    //\n                    //\t\tclass: [\n                    //\t\t\t{\n                    //\t\t\t\tns: 'abc',\n                    //\t\t\t\tvalue: [ ... ]\n                    //\t\t\t}\n                    //\t\t]\n                    //\n                    .map((val) => val ? (val.value || val) : val)\n                    // Flatten the array.\n                    .reduce((prev, next) => prev.concat(next), [])\n                    // Convert into string.\n                    .reduce(arrayValueReducer, '');\n                if (!isFalsy(value)) {\n                    node.setAttributeNS(attrNs, attrName, value);\n                }\n            }\n        }\n    }\n    /**\n     * Renders the `style` attribute of an HTML element based on\n     * {@link module:ui/template~Template#attributes}.\n     *\n     * A style attribute is an object with static values:\n     *\n     * ```ts\n     * attributes: {\n     * \tstyle: {\n     * \t\tcolor: 'red',\n     * \t\t'--color': 'red'\n     * \t}\n     * }\n     * ```\n     *\n     * or values bound to {@link module:ui/model~UIModel} properties:\n     *\n     * ```ts\n     * attributes: {\n     * \tstyle: {\n     * \t\tcolor: bind.to( ... ),\n     * \t\t'--color': bind.to( ... )\n     * \t}\n     * }\n     * ```\n     *\n     * Note: The `style` attribute is rendered without setting the namespace. It does not seem to be\n     * needed.\n     *\n     * @param styles Styles located in `attributes.style` of {@link module:ui/template~TemplateDefinition}.\n     * @param data Rendering data.\n     */\n    _renderStyleAttribute(styles, data) {\n        const node = data.node;\n        for (const styleName in styles) {\n            const styleValue = styles[styleName];\n            // Cases:\n            //\n            //\t\tstyle: {\n            //\t\t\tcolor: bind.to( 'attribute' )\n            //\t\t}\n            //\n            if (hasTemplateBinding(styleValue)) {\n                this._bindToObservable({\n                    schema: [styleValue],\n                    updater: getStyleUpdater(node, styleName),\n                    data\n                });\n            }\n            // Cases:\n            //\n            //\t\tstyle: {\n            //\t\t\t--color: 'red'\n            //\t\t}\n            //\n            else if (isCssVariable(styleName)) {\n                node.style.setProperty(styleName, styleValue);\n            }\n            // Cases:\n            //\n            //\t\tstyle: {\n            //\t\t\tcolor: 'red'\n            //\t\t}\n            //\n            else {\n                node.style[styleName] = styleValue;\n            }\n        }\n    }\n    /**\n     * Recursively renders HTML element's children from {@link module:ui/template~Template#children}.\n     *\n     * @param data Rendering data.\n     */\n    _renderElementChildren(data) {\n        const node = data.node;\n        const container = data.intoFragment ? document.createDocumentFragment() : node;\n        const isApplying = data.isApplying;\n        let childIndex = 0;\n        for (const child of this.children) {\n            if (isViewCollection(child)) {\n                if (!isApplying) {\n                    child.setParent(node);\n                    // Note: ViewCollection renders its children.\n                    for (const view of child) {\n                        container.appendChild(view.element);\n                    }\n                }\n            }\n            else if (isView(child)) {\n                if (!isApplying) {\n                    if (!child.isRendered) {\n                        child.render();\n                    }\n                    container.appendChild(child.element);\n                }\n            }\n            else if (isNode(child)) {\n                container.appendChild(child);\n            }\n            else {\n                if (isApplying) {\n                    const revertData = data.revertData;\n                    const childRevertData = getEmptyRevertData();\n                    revertData.children.push(childRevertData);\n                    child._renderNode({\n                        intoFragment: false,\n                        node: container.childNodes[childIndex++],\n                        isApplying: true,\n                        revertData: childRevertData\n                    });\n                }\n                else {\n                    container.appendChild(child.render());\n                }\n            }\n        }\n        if (data.intoFragment) {\n            node.appendChild(container);\n        }\n    }\n    /**\n     * Activates `on` event listeners from the {@link module:ui/template~TemplateDefinition}\n     * on an HTML element.\n     *\n     * @param data Rendering data.\n     */\n    _setUpListeners(data) {\n        if (!this.eventListeners) {\n            return;\n        }\n        for (const key in this.eventListeners) {\n            const revertBindings = this.eventListeners[key].map(schemaItem => {\n                const [domEvtName, domSelector] = key.split('@');\n                return schemaItem.activateDomEventListener(domEvtName, domSelector, data);\n            });\n            if (data.revertData) {\n                data.revertData.bindings.push(revertBindings);\n            }\n        }\n    }\n    /**\n     * For a given {@link module:ui/template~TemplateValueSchema} containing {@link module:ui/template~TemplateBinding}\n     * activates the binding and sets its initial value.\n     *\n     * Note: {@link module:ui/template~TemplateValueSchema} can be for HTML element attributes or\n     * text node `textContent`.\n     *\n     * @param options Binding options.\n     * @param options.updater A function which updates the DOM (like attribute or text).\n     * @param options.data Rendering data.\n     */\n    _bindToObservable({ schema, updater, data }) {\n        const revertData = data.revertData;\n        // Set initial values.\n        syncValueSchemaValue(schema, updater, data);\n        const revertBindings = schema\n            // Filter \"falsy\" (false, undefined, null, '') value schema components out.\n            .filter(item => !isFalsy(item))\n            // Filter inactive bindings from schema, like static strings ('foo'), numbers (42), etc.\n            .filter((item) => item.observable)\n            // Once only the actual binding are left, let the emitter listen to observable change:attribute event.\n            // TODO: Reduce the number of listeners attached as many bindings may listen\n            // to the same observable attribute.\n            .map(templateBinding => templateBinding.activateAttributeListener(schema, updater, data));\n        if (revertData) {\n            revertData.bindings.push(revertBindings);\n        }\n    }\n    /**\n     * Reverts {@link module:ui/template~RenderData#revertData template data} from a node to\n     * return it to the original state.\n     *\n     * @param node A node to be reverted.\n     * @param revertData An object that stores information about what changes have been made by\n     * {@link #apply} to the node. See {@link module:ui/template~RenderData#revertData} for more information.\n     */\n    _revertTemplateFromNode(node, revertData) {\n        for (const binding of revertData.bindings) {\n            // Each binding may consist of several observable+observable#attribute.\n            // like the following has 2:\n            //\n            //\t\tclass: [\n            //\t\t\t'x',\n            //\t\t\tbind.to( 'foo' ),\n            //\t\t\t'y',\n            //\t\t\tbind.to( 'bar' )\n            //\t\t]\n            //\n            for (const revertBinding of binding) {\n                revertBinding();\n            }\n        }\n        if (revertData.text) {\n            node.textContent = revertData.text;\n            return;\n        }\n        const element = node;\n        for (const attrName in revertData.attributes) {\n            const attrValue = revertData.attributes[attrName];\n            // When the attribute has **not** been set before #apply().\n            if (attrValue === null) {\n                element.removeAttribute(attrName);\n            }\n            else {\n                element.setAttribute(attrName, attrValue);\n            }\n        }\n        for (let i = 0; i < revertData.children.length; ++i) {\n            this._revertTemplateFromNode(element.childNodes[i], revertData.children[i]);\n        }\n    }\n}\n/**\n * Describes a binding created by the {@link module:ui/template~Template.bind} interface.\n *\n * @internal\n */\nexport class TemplateBinding {\n    /**\n     * The name of the {@link module:ui/template~TemplateBinding#observable observed attribute}.\n     */\n    attribute;\n    /**\n     * An observable instance of the binding. It either:\n     *\n     * * provides the attribute with the value,\n     * * or passes the event when a corresponding DOM event is fired.\n     */\n    observable;\n    /**\n     * An {@link module:utils/emittermixin~Emitter} used by the binding to:\n     *\n     * * listen to the attribute change in the {@link module:ui/template~TemplateBinding#observable},\n     * * or listen to the event in the DOM.\n     */\n    emitter;\n    /**\n     * A custom function to process the value of the {@link module:ui/template~TemplateBinding#attribute}.\n     */\n    callback;\n    /**\n     * Creates an instance of the {@link module:ui/template~TemplateBinding} class.\n     *\n     * @param def The definition of the binding.\n     */\n    constructor(def) {\n        this.attribute = def.attribute;\n        this.observable = def.observable;\n        this.emitter = def.emitter;\n        this.callback = def.callback;\n    }\n    /**\n     * Returns the value of the binding. It is the value of the {@link module:ui/template~TemplateBinding#attribute} in\n     * {@link module:ui/template~TemplateBinding#observable}. The value may be processed by the\n     * {@link module:ui/template~TemplateBinding#callback}, if such has been passed to the binding.\n     *\n     * @param node A native DOM node, passed to the custom {@link module:ui/template~TemplateBinding#callback}.\n     * @returns The value of {@link module:ui/template~TemplateBinding#attribute} in\n     * {@link module:ui/template~TemplateBinding#observable}.\n     */\n    getValue(node) {\n        const value = this.observable[this.attribute];\n        return this.callback ? this.callback(value, node) : value;\n    }\n    /**\n     * Activates the listener which waits for changes of the {@link module:ui/template~TemplateBinding#attribute} in\n     * {@link module:ui/template~TemplateBinding#observable}, then updates the DOM with the aggregated\n     * value of {@link module:ui/template~TemplateValueSchema}.\n     *\n     * @param schema A full schema to generate an attribute or text in the DOM.\n     * @param updater A DOM updater function used to update the native DOM attribute or text.\n     * @param data Rendering data.\n     * @returns A function to sever the listener binding.\n     */\n    activateAttributeListener(schema, updater, data) {\n        const callback = () => syncValueSchemaValue(schema, updater, data);\n        this.emitter.listenTo(this.observable, `change:${this.attribute}`, callback);\n        // Allows revert of the listener.\n        return () => {\n            this.emitter.stopListening(this.observable, `change:${this.attribute}`, callback);\n        };\n    }\n}\n/**\n * Describes either:\n *\n * * a binding to an {@link module:utils/observablemixin~Observable},\n * * or a native DOM event binding.\n *\n * It is created by the {@link module:ui/template~BindChain#to} method.\n *\n * @internal\n */\nexport class TemplateToBinding extends TemplateBinding {\n    eventNameOrFunction;\n    constructor(def) {\n        super(def);\n        this.eventNameOrFunction = def.eventNameOrFunction;\n    }\n    /**\n     * Activates the listener for the native DOM event, which when fired, is propagated by\n     * the {@link module:ui/template~TemplateBinding#emitter}.\n     *\n     * @param domEvtName The name of the native DOM event.\n     * @param domSelector The selector in the DOM to filter delegated events.\n     * @param data Rendering data.\n     * @returns A function to sever the listener binding.\n     */\n    activateDomEventListener(domEvtName, domSelector, data) {\n        const callback = (evt, domEvt) => {\n            if (!domSelector || domEvt.target.matches(domSelector)) {\n                if (typeof this.eventNameOrFunction == 'function') {\n                    this.eventNameOrFunction(domEvt);\n                }\n                else {\n                    this.observable.fire(this.eventNameOrFunction, domEvt);\n                }\n            }\n        };\n        this.emitter.listenTo(data.node, domEvtName, callback);\n        // Allows revert of the listener.\n        return () => {\n            this.emitter.stopListening(data.node, domEvtName, callback);\n        };\n    }\n}\n/**\n * Describes a binding to {@link module:utils/observablemixin~Observable} created by the {@link module:ui/template~BindChain#if}\n * method.\n *\n * @internal\n */\nexport class TemplateIfBinding extends TemplateBinding {\n    /**\n     * The value of the DOM attribute or text to be set if the {@link module:ui/template~TemplateBinding#attribute} in\n     * {@link module:ui/template~TemplateBinding#observable} is `true`.\n     */\n    valueIfTrue;\n    constructor(def) {\n        super(def);\n        this.valueIfTrue = def.valueIfTrue;\n    }\n    /**\n     * @inheritDoc\n     */\n    getValue(node) {\n        const value = super.getValue(node);\n        return isFalsy(value) ? false : (this.valueIfTrue || true);\n    }\n}\n/**\n * Checks whether given {@link module:ui/template~TemplateValueSchema} contains a\n * {@link module:ui/template~TemplateBinding}.\n */\nfunction hasTemplateBinding(schema) {\n    if (!schema) {\n        return false;\n    }\n    // Normalize attributes with additional data like namespace:\n    //\n    //\t\tclass: {\n    //\t\t\tns: 'abc',\n    //\t\t\tvalue: [ ... ]\n    //\t\t}\n    //\n    if (schema.value) {\n        schema = schema.value;\n    }\n    if (Array.isArray(schema)) {\n        return schema.some(hasTemplateBinding);\n    }\n    else if (schema instanceof TemplateBinding) {\n        return true;\n    }\n    return false;\n}\n/**\n * Checks whether the given name is a valid CSS variable name.\n *\n * A valid CSS variable name starts with two dashes (`--`), followed by a letter, underscore (`_`),\n * or dash (`-`), and can be followed by any combination of letters, digits, underscores, dashes,\n * or additional dashes.\n *\n * @param name The name to validate as a CSS variable.\n * @returns True if the name is a valid CSS variable, false otherwise.\n */\nfunction isCssVariable(name) {\n    const regex = /^--[a-zA-Z_-][\\w-]*$/;\n    return regex.test(name);\n}\n/**\n * Assembles the value using {@link module:ui/template~TemplateValueSchema} and stores it in a form of\n * an Array. Each entry of the Array corresponds to one of {@link module:ui/template~TemplateValueSchema}\n * items.\n *\n * @param node DOM Node updated when {@link module:utils/observablemixin~Observable} changes.\n */\nfunction getValueSchemaValue(schema, node) {\n    return schema.map(schemaItem => {\n        // Process {@link module:ui/template~TemplateBinding} bindings.\n        if (schemaItem instanceof TemplateBinding) {\n            return schemaItem.getValue(node);\n        }\n        // All static values like strings, numbers, and \"falsy\" values (false, null, undefined, '', etc.) just pass.\n        return schemaItem;\n    });\n}\n/**\n * A function executed each time the bound Observable attribute changes, which updates the DOM with a value\n * constructed from {@link module:ui/template~TemplateValueSchema}.\n *\n * @param updater A function which updates the DOM (like attribute or text).\n * @param node DOM Node updated when {@link module:utils/observablemixin~Observable} changes.\n */\nfunction syncValueSchemaValue(schema, updater, { node }) {\n    const values = getValueSchemaValue(schema, node);\n    let value;\n    // Check if schema is a single Template.bind.if, like:\n    //\n    //\t\tclass: Template.bind.if( 'foo' )\n    //\n    if (schema.length == 1 && schema[0] instanceof TemplateIfBinding) {\n        value = values[0];\n    }\n    else {\n        value = values.reduce(arrayValueReducer, '');\n    }\n    if (isFalsy(value)) {\n        updater.remove();\n    }\n    else {\n        updater.set(value);\n    }\n}\n/**\n * Returns an object consisting of `set` and `remove` functions, which\n * can be used in the context of DOM Node to set or reset `textContent`.\n * @see module:ui/view~View#_bindToObservable\n *\n * @param node DOM Node to be modified.\n */\nfunction getTextUpdater(node) {\n    return {\n        set(value) {\n            node.textContent = value;\n        },\n        remove() {\n            node.textContent = '';\n        }\n    };\n}\n/**\n * Returns an object consisting of `set` and `remove` functions, which\n * can be used in the context of DOM Node to set or reset an attribute.\n * @see module:ui/view~View#_bindToObservable\n *\n * @param el DOM Node to be modified.\n * @param attrName Name of the attribute to be modified.\n * @param ns Namespace to use.\n */\nfunction getAttributeUpdater(el, attrName, ns) {\n    return {\n        set(value) {\n            el.setAttributeNS(ns, attrName, value);\n        },\n        remove() {\n            el.removeAttributeNS(ns, attrName);\n        }\n    };\n}\n/**\n * Returns an object consisting of `set` and `remove` functions, which\n * can be used in the context of CSSStyleDeclaration to set or remove a style.\n * @see module:ui/view~View#_bindToObservable\n *\n * @param el DOM Node to be modified.\n * @param styleName Name of the style to be modified.\n */\nfunction getStyleUpdater(el, styleName) {\n    return {\n        set(value) {\n            if (isCssVariable(styleName)) {\n                el.style.setProperty(styleName, value);\n            }\n            else {\n                el.style[styleName] = value;\n            }\n        },\n        remove() {\n            if (isCssVariable(styleName)) {\n                el.style.removeProperty(styleName);\n            }\n            else {\n                el.style[styleName] = null;\n            }\n        }\n    };\n}\n/**\n * Clones definition of the template.\n */\nfunction clone(def) {\n    const clone = cloneDeepWith(def, value => {\n        // Don't clone the `Template.bind`* bindings because of the references to Observable\n        // and DomEmitterMixin instances inside, which would also be traversed and cloned by greedy\n        // cloneDeepWith algorithm. There's no point in cloning Observable/DomEmitterMixins\n        // along with the definition.\n        //\n        // Don't clone Template instances if provided as a child. They're simply #render()ed\n        // and nothing should interfere.\n        //\n        // Also don't clone View instances if provided as a child of the Template. The template\n        // instance will be extracted from the View during the normalization and there's no need\n        // to clone it.\n        if (value && (value instanceof TemplateBinding || isTemplate(value) || isView(value) || isViewCollection(value))) {\n            return value;\n        }\n    });\n    return clone;\n}\n/**\n * Normalizes given {@link module:ui/template~TemplateDefinition}.\n *\n * See:\n *  * {@link normalizeAttributes}\n *  * {@link normalizeListeners}\n *  * {@link normalizePlainTextDefinition}\n *  * {@link normalizeTextDefinition}\n *\n * @param def A template definition.\n * @returns Normalized definition.\n */\nfunction normalize(def) {\n    if (typeof def == 'string') {\n        def = normalizePlainTextDefinition(def);\n    }\n    else if (def.text) {\n        normalizeTextDefinition(def);\n    }\n    if (def.on) {\n        def.eventListeners = normalizeListeners(def.on);\n        // Template mixes EmitterMixin, so delete #on to avoid collision.\n        delete def.on;\n    }\n    if (!def.text) {\n        if (def.attributes) {\n            normalizeAttributes(def.attributes);\n        }\n        const children = [];\n        if (def.children) {\n            if (isViewCollection(def.children)) {\n                children.push(def.children);\n            }\n            else {\n                for (const child of def.children) {\n                    if (isTemplate(child) || isView(child) || isNode(child)) {\n                        children.push(child);\n                    }\n                    else {\n                        children.push(new Template(child));\n                    }\n                }\n            }\n        }\n        def.children = children;\n    }\n    return def;\n}\n/**\n * Normalizes \"attributes\" section of {@link module:ui/template~TemplateDefinition}.\n *\n * ```\n * attributes: {\n * \ta: 'bar',\n * \tb: {@link module:ui/template~TemplateBinding},\n * \tc: {\n * \t\tvalue: 'bar'\n * \t}\n * }\n * ```\n *\n * becomes\n *\n * ```\n * attributes: {\n * \ta: [ 'bar' ],\n * \tb: [ {@link module:ui/template~TemplateBinding} ],\n * \tc: {\n * \t\tvalue: [ 'bar' ]\n * \t}\n * }\n * ```\n */\nfunction normalizeAttributes(attributes) {\n    for (const a in attributes) {\n        if (attributes[a].value) {\n            attributes[a].value = toArray(attributes[a].value);\n        }\n        arrayify(attributes, a);\n    }\n}\n/**\n * Normalizes \"on\" section of {@link module:ui/template~TemplateDefinition}.\n *\n * ```\n * on: {\n * \ta: 'bar',\n * \tb: {@link module:ui/template~TemplateBinding},\n * \tc: [ {@link module:ui/template~TemplateBinding}, () => { ... } ]\n * }\n * ```\n *\n * becomes\n *\n * ```\n * on: {\n * \ta: [ 'bar' ],\n * \tb: [ {@link module:ui/template~TemplateBinding} ],\n * \tc: [ {@link module:ui/template~TemplateBinding}, () => { ... } ]\n * }\n * ```\n *\n * @returns Object containing normalized listeners.\n */\nfunction normalizeListeners(listeners) {\n    for (const l in listeners) {\n        arrayify(listeners, l);\n    }\n    return listeners;\n}\n/**\n * Normalizes \"string\" {@link module:ui/template~TemplateDefinition}.\n *\n * ```\n * \"foo\"\n * ```\n *\n * becomes\n *\n * ```\n * { text: [ 'foo' ] },\n * ```\n *\n * @returns Normalized template definition.\n */\nfunction normalizePlainTextDefinition(def) {\n    return {\n        text: [def]\n    };\n}\n/**\n * Normalizes text {@link module:ui/template~TemplateDefinition}.\n *\n * ```\n * children: [\n * \t{ text: 'def' },\n * \t{ text: {@link module:ui/template~TemplateBinding} }\n * ]\n * ```\n *\n * becomes\n *\n * ```\n * children: [\n * \t{ text: [ 'def' ] },\n * \t{ text: [ {@link module:ui/template~TemplateBinding} ] }\n * ]\n * ```\n */\nfunction normalizeTextDefinition(def) {\n    def.text = toArray(def.text);\n}\n/**\n * Wraps an entry in Object in an Array, if not already one.\n *\n * ```\n * {\n * \tx: 'y',\n * \ta: [ 'b' ]\n * }\n * ```\n *\n * becomes\n *\n * ```\n * {\n * \tx: [ 'y' ],\n * \ta: [ 'b' ]\n * }\n * ```\n */\nfunction arrayify(obj, key) {\n    obj[key] = toArray(obj[key]);\n}\n/**\n * A helper which concatenates the value avoiding unwanted\n * leading white spaces.\n */\nfunction arrayValueReducer(prev, cur) {\n    if (isFalsy(cur)) {\n        return prev;\n    }\n    else if (isFalsy(prev)) {\n        return cur;\n    }\n    else {\n        return `${prev} ${cur}`;\n    }\n}\n/**\n * Extends one object defined in the following format:\n *\n * ```\n * {\n * \tkey1: [Array1],\n * \tkey2: [Array2],\n * \t...\n * \tkeyN: [ArrayN]\n * }\n * ```\n *\n * with another object of the same data format.\n *\n * @param obj Base object.\n * @param ext Object extending base.\n */\nfunction extendObjectValueArray(obj, ext) {\n    for (const a in ext) {\n        if (obj[a]) {\n            obj[a].push(...ext[a]);\n        }\n        else {\n            obj[a] = ext[a];\n        }\n    }\n}\n/**\n * A helper for {@link module:ui/template~Template#extend}. Recursively extends {@link module:ui/template~Template} instance\n * with content from {@link module:ui/template~TemplateDefinition}. See {@link module:ui/template~Template#extend} to learn more.\n *\n * @param def A template instance to be extended.\n * @param def A definition which is to extend the template instance.\n * @param Error context.\n */\nfunction extendTemplate(template, def) {\n    if (def.attributes) {\n        if (!template.attributes) {\n            template.attributes = {};\n        }\n        extendObjectValueArray(template.attributes, def.attributes);\n    }\n    if (def.eventListeners) {\n        if (!template.eventListeners) {\n            template.eventListeners = {};\n        }\n        extendObjectValueArray(template.eventListeners, def.eventListeners);\n    }\n    if (def.text) {\n        template.text.push(...def.text);\n    }\n    if (def.children && def.children.length) {\n        if (template.children.length != def.children.length) {\n            /**\n             * The number of children in extended definition does not match.\n             *\n             * @error ui-template-extend-children-mismatch\n             */\n            throw new CKEditorError('ui-template-extend-children-mismatch', template);\n        }\n        let childIndex = 0;\n        for (const childDef of def.children) {\n            extendTemplate(template.children[childIndex++], childDef);\n        }\n    }\n}\n/**\n * Checks if value is \"falsy\".\n * Note: 0 (Number) is not \"falsy\" in this context.\n *\n * @param value Value to be checked.\n */\nfunction isFalsy(value) {\n    return !value && value !== 0;\n}\n/**\n * Checks if the item is an instance of {@link module:ui/view~View}\n *\n * @param value Value to be checked.\n */\nfunction isView(item) {\n    return item instanceof View;\n}\n/**\n * Checks if the item is an instance of {@link module:ui/template~Template}\n *\n * @param value Value to be checked.\n */\nfunction isTemplate(item) {\n    return item instanceof Template;\n}\n/**\n * Checks if the item is an instance of {@link module:ui/viewcollection~ViewCollection}\n *\n * @param value Value to be checked.\n */\nfunction isViewCollection(item) {\n    return item instanceof ViewCollection;\n}\n/**\n * Checks if value array contains the one with namespace.\n */\nfunction isNamespaced(attrValue) {\n    return isObject(attrValue[0]) && attrValue[0].ns;\n}\n/**\n * Creates an empty skeleton for {@link module:ui/template~Template#revert}\n * data.\n */\nfunction getEmptyRevertData() {\n    return {\n        children: [],\n        bindings: [],\n        attributes: {}\n    };\n}\n/**\n * Checks whether an attribute should be extended when\n * {@link module:ui/template~Template#apply} is called.\n *\n * @param attrName Attribute name to check.\n */\nfunction shouldExtend(attrName) {\n    return attrName == 'class' || attrName == 'style';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/view\n */\nimport { ViewCollection } from './viewcollection.js';\nimport { Template } from './template.js';\nimport { CKEditorError, Collection, DomEmitterMixin, ObservableMixin, isIterable } from '@ckeditor/ckeditor5-utils';\nimport '../theme/globals/globals.css';\n/**\n * The basic view class, which represents an HTML element created out of a\n * {@link module:ui/view~View#template}. Views are building blocks of the user interface and handle\n * interaction\n *\n * Views {@link module:ui/view~View#registerChild aggregate} children in\n * {@link module:ui/view~View#createCollection collections} and manage the life cycle of DOM\n * listeners e.g. by handling rendering and destruction.\n *\n * See the {@link module:ui/template~TemplateDefinition} syntax to learn more about shaping view\n * elements, attributes and listeners.\n *\n * ```ts\n * class SampleView extends View {\n * \tconstructor( locale ) {\n * \t\tsuper( locale );\n *\n * \t\tconst bind = this.bindTemplate;\n *\n * \t\t// Views define their interface (state) using observable attributes.\n * \t\tthis.set( 'elementClass', 'bar' );\n *\n * \t\tthis.setTemplate( {\n * \t\t\ttag: 'p',\n *\n * \t\t\t// The element of the view can be defined with its children.\n * \t\t\tchildren: [\n * \t\t\t\t'Hello',\n * \t\t\t\t{\n * \t\t\t\t\ttag: 'b',\n * \t\t\t\t\tchildren: [ 'world!' ]\n * \t\t\t\t}\n * \t\t\t],\n * \t\t\tattributes: {\n * \t\t\t\tclass: [\n * \t\t\t\t\t'foo',\n *\n * \t\t\t\t\t// Observable attributes control the state of the view in DOM.\n * \t\t\t\t\tbind.to( 'elementClass' )\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\ton: {\n * \t\t\t\t// Views listen to DOM events and propagate them.\n * \t\t\t\tclick: bind.to( 'clicked' )\n * \t\t\t}\n * \t\t} );\n * \t}\n * }\n *\n * const view = new SampleView( locale );\n *\n * view.render();\n *\n * // Append <p class=\"foo bar\">Hello<b>world</b></p> to the <body>\n * document.body.appendChild( view.element );\n *\n * // Change the class attribute to <p class=\"foo baz\">Hello<b>world</b></p>\n * view.elementClass = 'baz';\n *\n * // Respond to the \"click\" event in DOM by executing a custom action.\n * view.on( 'clicked', () => {\n * \tconsole.log( 'The view has been clicked!' );\n * } );\n * ```\n */\nexport class View extends /* #__PURE__ */ DomEmitterMixin(/* #__PURE__ */ ObservableMixin()) {\n    /**\n     * An HTML element of the view. `null` until {@link #render rendered}\n     * from the {@link #template}.\n     *\n     * ```ts\n     * class SampleView extends View {\n     * \tconstructor() {\n     * \t\tsuper();\n     *\n     * \t\t// A template instance the #element will be created from.\n     * \t\tthis.setTemplate( {\n     * \t\t\ttag: 'p'\n     *\n     * \t\t\t// ...\n     * \t\t} );\n     * \t}\n     * }\n     *\n     * const view = new SampleView();\n     *\n     * // Renders the #template.\n     * view.render();\n     *\n     * // Append the HTML element of the view to <body>.\n     * document.body.appendChild( view.element );\n     * ```\n     *\n     * **Note**: The element of the view can also be assigned directly:\n     *\n     * ```ts\n     * view.element = document.querySelector( '#my-container' );\n     * ```\n     */\n    element;\n    /**\n     * Set `true` when the view has already been {@link module:ui/view~View#render rendered}.\n     *\n     * @readonly\n     */\n    isRendered;\n    /**\n     * A set of tools to localize the user interface.\n     *\n     * Also see {@link module:core/editor/editor~Editor#locale}.\n     *\n     * @readonly\n     */\n    locale;\n    /**\n     * Shorthand for {@link module:utils/locale~Locale#t}.\n     *\n     * Note: If {@link #locale} instance hasn't been passed to the view this method may not\n     * be available.\n     *\n     * @see module:utils/locale~Locale#t\n     */\n    t;\n    /**\n     * Template of this view. It provides the {@link #element} representing\n     * the view in DOM, which is {@link #render rendered}.\n     */\n    template;\n    /**\n     * Collections registered with {@link #createCollection}.\n     */\n    _viewCollections;\n    /**\n     * A collection of view instances, which have been added directly\n     * into the {@link module:ui/template~Template#children}.\n     */\n    _unboundChildren;\n    /**\n     * Cached {@link module:ui/template~BindChain bind chain} object created by the\n     * {@link #template}. See {@link #bindTemplate}.\n     */\n    _bindTemplate;\n    /**\n     * Creates an instance of the {@link module:ui/view~View} class.\n     *\n     * Also see {@link #render}.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super();\n        this.element = null;\n        this.isRendered = false;\n        this.locale = locale;\n        this.t = locale && locale.t;\n        this._viewCollections = new Collection();\n        this._unboundChildren = this.createCollection();\n        // Pass parent locale to its children.\n        this._viewCollections.on('add', (evt, collection) => {\n            collection.locale = locale;\n            collection.t = locale && locale.t;\n        });\n        this.decorate('render');\n    }\n    /**\n     * Shorthand for {@link module:ui/template~Template.bind}, a binding\n     * {@link module:ui/template~BindChain interface} pre–configured for the view instance.\n     *\n     * It provides {@link module:ui/template~BindChain#to `to()`} and\n     * {@link module:ui/template~BindChain#if `if()`} methods that initialize bindings with\n     * observable attributes and attach DOM listeners.\n     *\n     * ```ts\n     * class SampleView extends View {\n     * \tconstructor( locale ) {\n     * \t\tsuper( locale );\n     *\n     * \t\tconst bind = this.bindTemplate;\n     *\n     * \t\t// These {@link module:utils/observablemixin~Observable observable} attributes will control\n     * \t\t// the state of the view in DOM.\n     * \t\tthis.set( {\n     * \t\t\telementClass: 'foo',\n     * \t\t \tisEnabled: true\n     * \t\t } );\n     *\n     * \t\tthis.setTemplate( {\n     * \t\t\ttag: 'p',\n     *\n     * \t\t\tattributes: {\n     * \t\t\t\t// The class HTML attribute will follow elementClass\n     * \t\t\t\t// and isEnabled view attributes.\n     * \t\t\t\tclass: [\n     * \t\t\t\t\tbind.to( 'elementClass' )\n     * \t\t\t\t\tbind.if( 'isEnabled', 'present-when-enabled' )\n     * \t\t\t\t]\n     * \t\t\t},\n     *\n     * \t\t\ton: {\n     * \t\t\t\t// The view will fire the \"clicked\" event upon clicking <p> in DOM.\n     * \t\t\t\tclick: bind.to( 'clicked' )\n     * \t\t\t}\n     * \t\t} );\n     * \t}\n     * }\n     * ```\n     */\n    get bindTemplate() {\n        if (this._bindTemplate) {\n            return this._bindTemplate;\n        }\n        return (this._bindTemplate = Template.bind(this, this));\n    }\n    /**\n     * Creates a new collection of views, which can be used as\n     * {@link module:ui/template~Template#children} of this view.\n     *\n     * ```ts\n     * class SampleView extends View {\n     * \tconstructor( locale ) {\n     * \t\tsuper( locale );\n     *\n     * \t\tconst child = new ChildView( locale );\n     * \t\tthis.items = this.createCollection( [ child ] );\n     *\n     * \t\tthis.setTemplate( {\n     * \t\t\ttag: 'p',\n     *\n     * \t\t\t// `items` collection will render here.\n     * \t\t\tchildren: this.items\n     * \t\t} );\n     * \t}\n     * }\n     *\n     * const view = new SampleView( locale );\n     * view.render();\n     *\n     * // It will append <p><child#element></p> to the <body>.\n     * document.body.appendChild( view.element );\n     * ```\n     *\n     * @param views Initial views of the collection.\n     * @returns A new collection of view instances.\n     */\n    createCollection(views) {\n        const collection = new ViewCollection(views);\n        this._viewCollections.add(collection);\n        return collection;\n    }\n    /**\n     * Registers a new child view under the view instance. Once registered, a child\n     * view is managed by its parent, including {@link #render rendering}\n     * and {@link #destroy destruction}.\n     *\n     * To revert this, use {@link #deregisterChild}.\n     *\n     * ```ts\n     * class SampleView extends View {\n     * \tconstructor( locale ) {\n     * \t\tsuper( locale );\n     *\n     * \t\tthis.childA = new SomeChildView( locale );\n     * \t\tthis.childB = new SomeChildView( locale );\n     *\n     * \t\tthis.setTemplate( { tag: 'p' } );\n     *\n     * \t\t// Register the children.\n     * \t\tthis.registerChild( [ this.childA, this.childB ] );\n     * \t}\n     *\n     * \trender() {\n     * \t\tsuper.render();\n     *\n     * \t\tthis.element.appendChild( this.childA.element );\n     * \t\tthis.element.appendChild( this.childB.element );\n     * \t}\n     * }\n     *\n     * const view = new SampleView( locale );\n     *\n     * view.render();\n     *\n     * // Will append <p><childA#element><b></b><childB#element></p>.\n     * document.body.appendChild( view.element );\n     * ```\n     *\n     * **Note**: There's no need to add child views if they're already referenced in the\n     * {@link #template}:\n     *\n     * ```ts\n     * class SampleView extends View {\n     * \tconstructor( locale ) {\n     * \t\tsuper( locale );\n     *\n     * \t\tthis.childA = new SomeChildView( locale );\n     * \t\tthis.childB = new SomeChildView( locale );\n     *\n     * \t\tthis.setTemplate( {\n     * \t\t\ttag: 'p',\n     *\n     * \t\t\t// These children will be added automatically. There's no\n     * \t\t\t// need to call {@link #registerChild} for any of them.\n     * \t\t\tchildren: [ this.childA, this.childB ]\n     * \t\t} );\n     * \t}\n     *\n     * \t// ...\n     * }\n     * ```\n     *\n     * @param children Children views to be registered.\n     */\n    registerChild(children) {\n        if (!isIterable(children)) {\n            children = [children];\n        }\n        for (const child of children) {\n            this._unboundChildren.add(child);\n        }\n    }\n    /**\n     * The opposite of {@link #registerChild}. Removes a child view from this view instance.\n     * Once removed, the child is no longer managed by its parent, e.g. it can safely\n     * become a child of another parent view.\n     *\n     * @see #registerChild\n     * @param children Child views to be removed.\n     */\n    deregisterChild(children) {\n        if (!isIterable(children)) {\n            children = [children];\n        }\n        for (const child of children) {\n            this._unboundChildren.remove(child);\n        }\n    }\n    /**\n     * Sets the {@link #template} of the view with with given definition.\n     *\n     * A shorthand for:\n     *\n     * ```ts\n     * view.setTemplate( definition );\n     * ```\n     *\n     * @param definition Definition of view's template.\n     */\n    setTemplate(definition) {\n        this.template = new Template(definition);\n    }\n    /**\n     * {@link module:ui/template~Template.extend Extends} the {@link #template} of the view with\n     * with given definition.\n     *\n     * A shorthand for:\n     *\n     * ```ts\n     * Template.extend( view.template, definition );\n     * ```\n     *\n     * **Note**: Is requires the {@link #template} to be already set. See {@link #setTemplate}.\n     *\n     * @param definition Definition which extends the {@link #template}.\n     */\n    extendTemplate(definition) {\n        Template.extend(this.template, definition);\n    }\n    /**\n     * Recursively renders the view.\n     *\n     * Once the view is rendered:\n     * * the {@link #element} becomes an HTML element out of {@link #template},\n     * * the {@link #isRendered} flag is set `true`.\n     *\n     * **Note**: The children of the view:\n     * * defined directly in the {@link #template}\n     * * residing in collections created by the {@link #createCollection} method,\n     * * and added by {@link #registerChild}\n     * are also rendered in the process.\n     *\n     * In general, `render()` method is the right place to keep the code which refers to the\n     * {@link #element} and should be executed at the very beginning of the view's life cycle.\n     *\n     * It is possible to {@link module:ui/template~Template.extend} the {@link #template} before\n     * the view is rendered. To allow an early customization of the view (e.g. by its parent),\n     * such references should be done in `render()`.\n     *\n     * ```ts\n     * class SampleView extends View {\n     * \tconstructor() {\n     * \t\tthis.setTemplate( {\n     * \t\t\t// ...\n     * \t\t} );\n     * \t},\n     *\n     * \trender() {\n     * \t\t// View#element becomes available.\n     * \t\tsuper.render();\n     *\n     * \t\t// The \"scroll\" listener depends on #element.\n     * \t\tthis.listenTo( window, 'scroll', () => {\n     * \t\t\t// A reference to #element would render the #template and make it non-extendable.\n     * \t\t\tif ( window.scrollY > 0 ) {\n     * \t\t\t\tthis.element.scrollLeft = 100;\n     * \t\t\t} else {\n     * \t\t\t\tthis.element.scrollLeft = 0;\n     * \t\t\t}\n     * \t\t} );\n     * \t}\n     * }\n     *\n     * const view = new SampleView();\n     *\n     * // Let's customize the view before it gets rendered.\n     * view.extendTemplate( {\n     * \tattributes: {\n     * \t\tclass: [\n     * \t\t\t'additional-class'\n     * \t\t]\n     * \t}\n     * } );\n     *\n     * // Late rendering allows customization of the view.\n     * view.render();\n     * ```\n     */\n    render() {\n        if (this.isRendered) {\n            /**\n             * This View has already been rendered.\n             *\n             * @error ui-view-render-already-rendered\n             */\n            throw new CKEditorError('ui-view-render-already-rendered', this);\n        }\n        // Render #element of the view.\n        if (this.template) {\n            this.element = this.template.render();\n            // Auto–register view children from #template.\n            this.registerChild(this.template.getViews());\n        }\n        this.isRendered = true;\n    }\n    /**\n     * Recursively destroys the view instance and child views added by {@link #registerChild} and\n     * residing in collections created by the {@link #createCollection}.\n     *\n     * Destruction disables all event listeners:\n     * * created on the view, e.g. `view.on( 'event', () => {} )`,\n     * * defined in the {@link #template} for DOM events.\n     */\n    destroy() {\n        this.stopListening();\n        this._viewCollections.map(c => c.destroy());\n        // Template isn't obligatory for views.\n        if (this.template && this.template._revertData) {\n            this.template.revert(this.element);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/panel/balloon/balloonpanelview\n */\nimport { View } from '../../view.js';\nimport { getOptimalPosition, global, isRange, toUnit, isVisible, isText, ResizeObserver, Rect } from '@ckeditor/ckeditor5-utils';\nimport { isElement } from 'es-toolkit/compat';\nimport '../../../theme/components/panel/balloonpanel.css';\nconst toPx = /* #__PURE__ */ toUnit('px');\n// A static balloon panel positioning function that moves the balloon far off the viewport.\n// It is used as a fallback when there is no way to position the balloon using provided\n// positioning functions (see: `getOptimalPosition()`), for instance, when the target the\n// balloon should be attached to gets obscured by scrollable containers or the viewport.\n//\n// It prevents the balloon from being attached to the void and possible degradation of the UX.\n// At the same time, it keeps the balloon physically visible in the DOM so the focus remains\n// uninterrupted.\nconst POSITION_OFF_SCREEN = {\n    top: -99999,\n    left: -99999,\n    name: 'arrowless',\n    config: {\n        withArrow: false\n    }\n};\n/**\n * The balloon panel view class.\n *\n * A floating container which can\n * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#pin pin} to any\n * {@link module:utils/dom/position~DomOptimalPositionOptions#target target} in the DOM and remain in that position\n * e.g. when the web page is scrolled.\n *\n * The balloon panel can be used to display contextual, non-blocking UI like forms, toolbars and\n * the like in its {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#content} view\n * collection.\n *\n * There is a number of {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}\n * that the balloon can use, automatically switching from one to another when the viewport space becomes\n * scarce to keep the balloon visible to the user as long as it is possible. The balloon will also\n * accept any custom position set provided by the user compatible with the\n * {@link module:utils/dom/position~DomOptimalPositionOptions options}.\n *\n * ```ts\n * const panel = new BalloonPanelView( locale );\n * const childView = new ChildView();\n * const positions = BalloonPanelView.defaultPositions;\n *\n * panel.render();\n *\n * // Add a child view to the panel's content collection.\n * panel.content.add( childView );\n *\n * // Start pinning the panel to an element with the \"target\" id DOM.\n * // The balloon will remain pinned until unpin() is called.\n * panel.pin( {\n * \ttarget: document.querySelector( '#target' ),\n * \tpositions: [\n * \t\tpositions.northArrowSouth,\n * \t\tpositions.southArrowNorth\n * \t]\n * } );\n * ```\n */\nexport class BalloonPanelView extends View {\n    /**\n     * A collection of the child views that creates the balloon panel contents.\n     */\n    content;\n    /**\n     * A callback that starts pinning the panel when {@link #isVisible} gets\n     * `true`. Used by {@link #pin}.\n     *\n     * @private\n     */\n    _pinWhenIsVisibleCallback;\n    /**\n     * An instance of resize observer used to detect if target element is still visible.\n     */\n    _resizeObserver;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('top', 0);\n        this.set('left', 0);\n        this.set('position', 'arrow_nw');\n        this.set('isVisible', false);\n        this.set('withArrow', true);\n        this.set('class', undefined);\n        this._pinWhenIsVisibleCallback = null;\n        this._resizeObserver = null;\n        this.content = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-balloon-panel',\n                    bind.to('position', value => `ck-balloon-panel_${value}`),\n                    bind.if('isVisible', 'ck-balloon-panel_visible'),\n                    bind.if('withArrow', 'ck-balloon-panel_with-arrow'),\n                    bind.to('class')\n                ],\n                style: {\n                    top: bind.to('top', toPx),\n                    left: bind.to('left', toPx)\n                }\n            },\n            children: this.content\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this.hide();\n        super.destroy();\n    }\n    /**\n     * Shows the panel.\n     *\n     * See {@link #isVisible}.\n     */\n    show() {\n        this.isVisible = true;\n    }\n    /**\n     * Hides the panel.\n     *\n     * See {@link #isVisible}.\n     */\n    hide() {\n        this.isVisible = false;\n    }\n    /**\n     * Attaches the panel to a specified {@link module:utils/dom/position~DomOptimalPositionOptions#target} with a\n     * smart positioning heuristics that chooses from available positions to make sure the panel\n     * is visible to the user i.e. within the limits of the viewport.\n     *\n     * This method accepts configuration {@link module:utils/dom/position~DomOptimalPositionOptions options}\n     * to set the `target`, optional `limiter` and `positions` the balloon should choose from.\n     *\n     * ```ts\n     * const panel = new BalloonPanelView( locale );\n     * const positions = BalloonPanelView.defaultPositions;\n     *\n     * panel.render();\n     *\n     * // Attach the panel to an element with the \"target\" id DOM.\n     * panel.attachTo( {\n     * \ttarget: document.querySelector( '#target' ),\n     * \tpositions: [\n     * \t\tpositions.northArrowSouth,\n     * \t\tpositions.southArrowNorth\n     * \t]\n     * } );\n     * ```\n     *\n     * **Note**: Attaching the panel will also automatically {@link #show} it.\n     *\n     * **Note**: An attached panel will not follow its target when the window is scrolled or resized.\n     * See the {@link #pin} method for a more permanent positioning strategy.\n     *\n     * @param options Positioning options compatible with {@link module:utils/dom/position~getOptimalPosition}.\n     * Default `positions` array is {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.\n     * @returns Whether the balloon was shown and successfully attached or not. Attaching can fail if the target\n     * provided in the options is invisible (e.g. element detached from DOM).\n     */\n    attachTo(options) {\n        const target = getDomElement(options.target);\n        if (target && !isVisible(target)) {\n            return false;\n        }\n        this.show();\n        const defaultPositions = BalloonPanelView.defaultPositions;\n        const positionOptions = Object.assign({}, {\n            element: this.element,\n            positions: [\n                defaultPositions.southArrowNorth,\n                defaultPositions.southArrowNorthMiddleWest,\n                defaultPositions.southArrowNorthMiddleEast,\n                defaultPositions.southArrowNorthWest,\n                defaultPositions.southArrowNorthEast,\n                defaultPositions.northArrowSouth,\n                defaultPositions.northArrowSouthMiddleWest,\n                defaultPositions.northArrowSouthMiddleEast,\n                defaultPositions.northArrowSouthWest,\n                defaultPositions.northArrowSouthEast,\n                defaultPositions.viewportStickyNorth\n            ],\n            limiter: global.document.body,\n            fitInViewport: true\n        }, options);\n        const optimalPosition = BalloonPanelView._getOptimalPosition(positionOptions) || POSITION_OFF_SCREEN;\n        // Usually browsers make some problems with super accurate values like 104.345px\n        // so it is better to use int values.\n        const left = parseInt(optimalPosition.left);\n        const top = parseInt(optimalPosition.top);\n        const position = optimalPosition.name;\n        const config = optimalPosition.config || {};\n        const { withArrow = true } = config;\n        this.top = top;\n        this.left = left;\n        this.position = position;\n        this.withArrow = withArrow;\n        return true;\n    }\n    /**\n     * Works the same way as the {@link #attachTo} method except that the position of the panel is\n     * continuously updated when:\n     *\n     * * any ancestor of the {@link module:utils/dom/position~DomOptimalPositionOptions#target}\n     * or {@link module:utils/dom/position~DomOptimalPositionOptions#limiter} is scrolled,\n     * * the browser window gets resized or scrolled.\n     *\n     * Thanks to that, the panel always sticks to the {@link module:utils/dom/position~DomOptimalPositionOptions#target}\n     * and is immune to the changing environment.\n     *\n     * ```ts\n     * const panel = new BalloonPanelView( locale );\n     * const positions = BalloonPanelView.defaultPositions;\n     *\n     * panel.render();\n     *\n     * // Pin the panel to an element with the \"target\" id DOM.\n     * panel.pin( {\n     * \ttarget: document.querySelector( '#target' ),\n     * \tpositions: [\n     * \t\tpositions.northArrowSouth,\n     * \t\tpositions.southArrowNorth\n     * \t]\n     * } );\n     * ```\n     *\n     * To leave the pinned state, use the {@link #unpin} method.\n     *\n     * **Note**: Pinning the panel will also automatically {@link #show} it.\n     *\n     * @param options Positioning options compatible with {@link module:utils/dom/position~getOptimalPosition}.\n     * Default `positions` array is {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.\n     */\n    pin(options) {\n        this.unpin();\n        if (!this._startPinning(options)) {\n            return;\n        }\n        this._pinWhenIsVisibleCallback = () => {\n            if (this.isVisible) {\n                this._startPinning(options);\n            }\n            else {\n                this._stopPinning();\n            }\n        };\n        // Control the state of the listeners depending on whether the panel is visible\n        // or not.\n        // TODO: Use on() (https://github.com/ckeditor/ckeditor5-utils/issues/144).\n        this.listenTo(this, 'change:isVisible', this._pinWhenIsVisibleCallback);\n    }\n    /**\n     * Stops pinning the panel, as set up by {@link #pin}.\n     */\n    unpin() {\n        if (this._pinWhenIsVisibleCallback) {\n            // Deactivate listeners attached by pin().\n            this._stopPinning();\n            // Deactivate the panel pin() control logic.\n            // TODO: Use off() (https://github.com/ckeditor/ckeditor5-utils/issues/144).\n            this.stopListening(this, 'change:isVisible', this._pinWhenIsVisibleCallback);\n            this._pinWhenIsVisibleCallback = null;\n            this.hide();\n        }\n    }\n    /**\n     * Starts managing the pinned state of the panel. See {@link #pin}.\n     *\n     * @param options Positioning options compatible with {@link module:utils/dom/position~getOptimalPosition}.\n     * @returns Whether the balloon was shown and successfully attached or not. Attaching can fail if the target\n     * provided in the options is invisible (e.g. element detached from DOM).\n     */\n    _startPinning(options) {\n        if (!this.attachTo(options)) {\n            return false;\n        }\n        let targetElement = getDomElement(options.target);\n        const limiterElement = options.limiter ? getDomElement(options.limiter) : global.document.body;\n        // Then we need to listen on scroll event of eny element in the document.\n        this.listenTo(global.document, 'scroll', (evt, domEvt) => {\n            const scrollTarget = domEvt.target;\n            // The position needs to be updated if the positioning target is within the scrolled element.\n            const isWithinScrollTarget = targetElement && scrollTarget.contains(targetElement);\n            // The position needs to be updated if the positioning limiter is within the scrolled element.\n            const isLimiterWithinScrollTarget = limiterElement && scrollTarget.contains(limiterElement);\n            // The positioning target and/or limiter can be a Rect, object etc..\n            // There's no way to optimize the listener then.\n            if (isWithinScrollTarget || isLimiterWithinScrollTarget || !targetElement || !limiterElement) {\n                this.attachTo(options);\n            }\n        }, { useCapture: true });\n        // We need to listen on window resize event and update position.\n        this.listenTo(global.window, 'resize', () => {\n            this.attachTo(options);\n        });\n        // Hide the panel if the target element is no longer visible.\n        if (!this._resizeObserver) {\n            // If the target element is a text node, we need to check the parent element.\n            // It's because `ResizeObserver` accept only elements, not text nodes.\n            if (targetElement && isText(targetElement)) {\n                targetElement = targetElement.parentElement;\n            }\n            if (targetElement) {\n                const checkVisibility = () => {\n                    // If the target element is no longer visible, hide the panel.\n                    if (!isVisible(targetElement)) {\n                        this.unpin();\n                    }\n                };\n                // Element is being resized to 0x0 after it's parent became hidden,\n                // so we need to check size in order to determine if it's visible or not.\n                this._resizeObserver = new ResizeObserver(targetElement, checkVisibility);\n            }\n        }\n        return true;\n    }\n    /**\n     * Stops managing the pinned state of the panel. See {@link #pin}.\n     */\n    _stopPinning() {\n        this.stopListening(global.document, 'scroll');\n        this.stopListening(global.window, 'resize');\n        if (this._resizeObserver) {\n            this._resizeObserver.destroy();\n            this._resizeObserver = null;\n        }\n    }\n    /**\n     * Returns available {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView}\n     * {@link module:utils/dom/position~PositioningFunction positioning functions} adjusted by the specific offsets.\n     *\n     * @internal\n     * @param options Options to generate positions. If not specified, this helper will simply return\n     * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.\n     * @param options.sideOffset A custom side offset (in pixels) of each position. If\n     * not specified, {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.arrowSideOffset the default value}\n     * will be used.\n     * @param options.heightOffset A custom height offset (in pixels) of each position. If\n     * not specified, {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.arrowHeightOffset the default value}\n     * will be used.\n     * @param options.stickyVerticalOffset A custom offset (in pixels) of the `viewportStickyNorth` positioning function.\n     * If not specified, {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.stickyVerticalOffset the default value}\n     * will be used.\n     * @param options.config Additional configuration of the balloon balloon panel view.\n     * Currently only {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#withArrow} is supported. Learn more\n     * about {@link module:utils/dom/position~PositioningFunction positioning functions}.\n     */\n    static generatePositions(options = {}) {\n        const { sideOffset = BalloonPanelView.arrowSideOffset, heightOffset = BalloonPanelView.arrowHeightOffset, stickyVerticalOffset = BalloonPanelView.stickyVerticalOffset, config } = options;\n        return {\n            // ------- North west\n            northWestArrowSouthWest: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left - sideOffset,\n                name: 'arrow_sw',\n                ...(config && { config })\n            }),\n            northWestArrowSouthMiddleWest: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left - (balloonRect.width * .25) - sideOffset,\n                name: 'arrow_smw',\n                ...(config && { config })\n            }),\n            northWestArrowSouth: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left - balloonRect.width / 2,\n                name: 'arrow_s',\n                ...(config && { config })\n            }),\n            northWestArrowSouthMiddleEast: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left - (balloonRect.width * .75) + sideOffset,\n                name: 'arrow_sme',\n                ...(config && { config })\n            }),\n            northWestArrowSouthEast: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left - balloonRect.width + sideOffset,\n                name: 'arrow_se',\n                ...(config && { config })\n            }),\n            // ------- North\n            northArrowSouthWest: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left + targetRect.width / 2 - sideOffset,\n                name: 'arrow_sw',\n                ...(config && { config })\n            }),\n            northArrowSouthMiddleWest: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left + targetRect.width / 2 - (balloonRect.width * .25) - sideOffset,\n                name: 'arrow_smw',\n                ...(config && { config })\n            }),\n            northArrowSouth: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2,\n                name: 'arrow_s',\n                ...(config && { config })\n            }),\n            northArrowSouthMiddleEast: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left + targetRect.width / 2 - (balloonRect.width * .75) + sideOffset,\n                name: 'arrow_sme',\n                ...(config && { config })\n            }),\n            northArrowSouthEast: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.left + targetRect.width / 2 - balloonRect.width + sideOffset,\n                name: 'arrow_se',\n                ...(config && { config })\n            }),\n            // ------- North east\n            northEastArrowSouthWest: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.right - sideOffset,\n                name: 'arrow_sw',\n                ...(config && { config })\n            }),\n            northEastArrowSouthMiddleWest: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.right - (balloonRect.width * .25) - sideOffset,\n                name: 'arrow_smw',\n                ...(config && { config })\n            }),\n            northEastArrowSouth: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.right - balloonRect.width / 2,\n                name: 'arrow_s',\n                ...(config && { config })\n            }),\n            northEastArrowSouthMiddleEast: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.right - (balloonRect.width * .75) + sideOffset,\n                name: 'arrow_sme',\n                ...(config && { config })\n            }),\n            northEastArrowSouthEast: (targetRect, balloonRect) => ({\n                top: getNorthTop(targetRect, balloonRect),\n                left: targetRect.right - balloonRect.width + sideOffset,\n                name: 'arrow_se',\n                ...(config && { config })\n            }),\n            // ------- South west\n            southWestArrowNorthWest: targetRect => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left - sideOffset,\n                name: 'arrow_nw',\n                ...(config && { config })\n            }),\n            southWestArrowNorthMiddleWest: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left - (balloonRect.width * .25) - sideOffset,\n                name: 'arrow_nmw',\n                ...(config && { config })\n            }),\n            southWestArrowNorth: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left - balloonRect.width / 2,\n                name: 'arrow_n',\n                ...(config && { config })\n            }),\n            southWestArrowNorthMiddleEast: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left - (balloonRect.width * .75) + sideOffset,\n                name: 'arrow_nme',\n                ...(config && { config })\n            }),\n            southWestArrowNorthEast: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left - balloonRect.width + sideOffset,\n                name: 'arrow_ne',\n                ...(config && { config })\n            }),\n            // ------- South\n            southArrowNorthWest: targetRect => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left + targetRect.width / 2 - sideOffset,\n                name: 'arrow_nw',\n                ...(config && { config })\n            }),\n            southArrowNorthMiddleWest: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left + targetRect.width / 2 - (balloonRect.width * 0.25) - sideOffset,\n                name: 'arrow_nmw',\n                ...(config && { config })\n            }),\n            southArrowNorth: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2,\n                name: 'arrow_n',\n                ...(config && { config })\n            }),\n            southArrowNorthMiddleEast: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left + targetRect.width / 2 - (balloonRect.width * 0.75) + sideOffset,\n                name: 'arrow_nme',\n                ...(config && { config })\n            }),\n            southArrowNorthEast: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.left + targetRect.width / 2 - balloonRect.width + sideOffset,\n                name: 'arrow_ne',\n                ...(config && { config })\n            }),\n            // ------- South east\n            southEastArrowNorthWest: targetRect => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.right - sideOffset,\n                name: 'arrow_nw',\n                ...(config && { config })\n            }),\n            southEastArrowNorthMiddleWest: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.right - (balloonRect.width * .25) - sideOffset,\n                name: 'arrow_nmw',\n                ...(config && { config })\n            }),\n            southEastArrowNorth: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.right - balloonRect.width / 2,\n                name: 'arrow_n',\n                ...(config && { config })\n            }),\n            southEastArrowNorthMiddleEast: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.right - (balloonRect.width * .75) + sideOffset,\n                name: 'arrow_nme',\n                ...(config && { config })\n            }),\n            southEastArrowNorthEast: (targetRect, balloonRect) => ({\n                top: getSouthTop(targetRect),\n                left: targetRect.right - balloonRect.width + sideOffset,\n                name: 'arrow_ne',\n                ...(config && { config })\n            }),\n            // ------- West\n            westArrowEast: (targetRect, balloonRect) => ({\n                top: targetRect.top + targetRect.height / 2 - balloonRect.height / 2,\n                left: targetRect.left - balloonRect.width - heightOffset,\n                name: 'arrow_e',\n                ...(config && { config })\n            }),\n            // ------- East\n            eastArrowWest: (targetRect, balloonRect) => ({\n                top: targetRect.top + targetRect.height / 2 - balloonRect.height / 2,\n                left: targetRect.right + heightOffset,\n                name: 'arrow_w',\n                ...(config && { config })\n            }),\n            // ------- Sticky\n            viewportStickyNorth: (targetRect, balloonRect, viewportRect) => {\n                // Get the intersection of the viewport and the document body.\n                const boundaryRect = new Rect(global.document.body).getIntersection(viewportRect.getVisible());\n                if (!boundaryRect) {\n                    return null;\n                }\n                // Get the visible intersection of the boundary and the document body.\n                const visibleBoundaryRect = boundaryRect.getVisible();\n                // Check if the target is in the boundary.\n                if (!targetRect.getIntersection(visibleBoundaryRect)) {\n                    return null;\n                }\n                // Checks if there is enough space to put the balloon on the top or bottom of the target.\n                // If not, makes the balloon sticky.\n                if (!(visibleBoundaryRect.top - targetRect.top - stickyVerticalOffset < balloonRect.height &&\n                    visibleBoundaryRect.bottom - targetRect.bottom < balloonRect.height)) {\n                    return null;\n                }\n                return {\n                    top: visibleBoundaryRect.top + stickyVerticalOffset,\n                    left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2,\n                    name: 'arrowless',\n                    config: {\n                        withArrow: false,\n                        ...config\n                    }\n                };\n            }\n        };\n        /**\n         * Returns the top coordinate for positions starting with `north*`.\n         *\n         * @param targetRect A rect of the target.\n         * @param balloonRect A rect of the balloon.\n         */\n        function getNorthTop(targetRect, balloonRect) {\n            return targetRect.top - balloonRect.height - heightOffset;\n        }\n        /**\n         * Returns the top coordinate for positions starting with `south*`.\n         *\n         * @param targetRect A rect of the target.\n         */\n        function getSouthTop(targetRect) {\n            return targetRect.bottom + heightOffset;\n        }\n    }\n    /**\n     * A side offset of the arrow tip from the edge of the balloon. Controlled by CSS.\n     *\n     * ```\n     *\t\t ┌───────────────────────┐\n     *\t\t │                       │\n     *\t\t │         Balloon       │\n     *\t\t │         Content       │\n     *\t\t │                       │\n     *\t\t └──+    +───────────────┘\n     *\t\t |   \\  /\n     *\t\t |    \\/\n     *\t\t>┼─────┼< ─────────────────────── side offset\n     *\n     * ```\n     *\n     * @default 25\n     */\n    static arrowSideOffset = 25;\n    /**\n     * A height offset of the arrow from the edge of the balloon. Controlled by CSS.\n     *\n     * ```\n     *\t\t ┌───────────────────────┐\n     *\t\t │                       │\n     *\t\t │         Balloon       │\n     *\t\t │         Content       │      ╱-- arrow height offset\n     *\t\t │                       │      V\n     *\t\t └──+    +───────────────┘ --- ─┼───────\n     *\t\t     \\  /                       │\n     *\t\t      \\/                        │\n     *\t\t────────────────────────────────┼───────\n     *\t\t                                ^\n     *\n     *\n     *\t\t>┼────┼<  arrow height offset\n     *\t\t │    │\n     *\t\t │    ┌────────────────────────┐\n     *\t\t │    │                        │\n     *\t\t │   ╱                         │\n     *\t\t │ ╱            Balloon        │\n     *\t\t │ ╲            Content        │\n     *\t\t │   ╲                         │\n     *\t\t │    │                        │\n     *\t\t │    └────────────────────────┘\n     * ```\n     *\n     * @default 10\n    */\n    static arrowHeightOffset = 10;\n    /**\n     * A vertical offset of the balloon panel from the edge of the viewport if sticky.\n     * It helps in accessing toolbar buttons underneath the balloon panel.\n     *\n     * ```\n     *\t\t  ┌───────────────────────────────────────────────────┐\n     *\t\t  │                      Target                       │\n     *\t\t  │                                                   │\n     *\t\t  │                            /── vertical offset    │\n     *\t\t┌─────────────────────────────V─────────────────────────┐\n     *\t\t│ Toolbar            ┌─────────────┐                    │\n     *\t\t├────────────────────│   Balloon   │────────────────────┤\n     *\t\t│ │                  └─────────────┘                  │ │\n     *\t\t│ │                                                   │ │\n     *\t\t│ │                                                   │ │\n     *\t\t│ │                                                   │ │\n     *\t\t│ └───────────────────────────────────────────────────┘ │\n     *\t\t│                        Viewport                       │\n     *\t\t└───────────────────────────────────────────────────────┘\n     * ```\n     *\n     * @default 20\n     */\n    static stickyVerticalOffset = 20;\n    /**\n     * Function used to calculate the optimal position for the balloon.\n     */\n    static _getOptimalPosition = getOptimalPosition;\n    /**\n     * A default set of positioning functions used by the balloon panel view\n     * when attaching using the {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#attachTo} method.\n     *\n     * The available positioning functions are as follows:\n     *\n     * **North west**\n     *\n     * * `northWestArrowSouthWest`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t V\n     *\t\t [ Target ]\n     * ```\n     *\n     * * `northWestArrowSouthMiddleWest`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t    V\n     *\t\t    [ Target ]\n     * ```\n     *\n     * * `northWestArrowSouth`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t         V\n     *\t\t         [ Target ]\n     * ```\n     *\n     * * `northWestArrowSouthMiddleEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t             V\n     *\t\t             [ Target ]\n     * ```\n     *\n     * * `northWestArrowSouthEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t                 V\n     *\t\t                 [ Target ]\n     * ```\n     *\n     * **North**\n     *\n     * * `northArrowSouthWest`\n     *\n     * ```\n     *\t\t    +-----------------+\n     *\t\t    |     Balloon     |\n     *\t\t    +-----------------+\n     *\t\t     V\n     *\t\t[ Target ]\n     * ```\n     *\n     * * `northArrowSouthMiddleWest`\n     *\n     * ```\n     *\t\t +-----------------+\n     *\t\t |     Balloon     |\n     *\t\t +-----------------+\n     *\t\t     V\n     *\t\t[ Target ]\n     * ```\n     * * `northArrowSouth`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t         V\n     *\t\t    [ Target ]\n     * ```\n     *\n     * * `northArrowSouthMiddleEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t             V\n     *\t\t        [ Target ]\n     * ```\n     *\n     * * `northArrowSouthEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t                V\n     *\t\t           [ Target ]\n     * ```\n     *\n     * **North east**\n     *\n     * * `northEastArrowSouthWest`\n     *\n     * ```\n     *\t\t        +-----------------+\n     *\t\t        |     Balloon     |\n     *\t\t        +-----------------+\n     *\t\t         V\n     *\t\t[ Target ]\n     * ```\n     *\n     * * `northEastArrowSouthMiddleWest`\n     *\n     * ```\n     *\t\t     +-----------------+\n     *\t\t     |     Balloon     |\n     *\t\t     +-----------------+\n     *\t\t         V\n     *\t\t[ Target ]\n     * ```\n     *\n     * * `northEastArrowSouth`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t         V\n     *\t\t[ Target ]\n     * ```\n     *\n     * * `northEastArrowSouthMiddleEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t             V\n     *\t\t    [ Target ]\n     * ```\n     *\n     * * `northEastArrowSouthEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     *\t\t                 V\n     *\t\t        [ Target ]\n     * ```\n     *\n     * **South**\n     *\n     * * `southArrowNorthWest`\n     *\n     * ```\n     *\t\t[ Target ]\n     *\t\t     ^\n     *\t\t    +-----------------+\n     *\t\t    |     Balloon     |\n     *\t\t    +-----------------+\n     * ```\n     *\n     * * `southArrowNorthMiddleWest`\n     *\n     * ```\n     *\t\t   [ Target ]\n     *\t\t        ^\n     *\t\t    +-----------------+\n     *\t\t    |     Balloon     |\n     *\t\t    +-----------------+\n     * ```\n     *\n     * * `southArrowNorth`\n     *\n     * ```\n     *\t\t    [ Target ]\n     *\t\t         ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southArrowNorthMiddleEast`\n     *\n     * ```\n     *\t\t            [ Target ]\n     *\t\t                 ^\n     *\t\t   +-----------------+\n     *\t\t   |     Balloon     |\n     *\t\t   +-----------------+\n     * ```\n     *\n     * * `southArrowNorthEast`\n     *\n     * ```\n     *\t\t            [ Target ]\n     *\t\t                 ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * **South west**\n     *\n     * * `southWestArrowNorthWest`\n     *\n     *\n     * ```\n     *\t\t [ Target ]\n     *\t\t ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southWestArrowNorthMiddleWest`\n     *\n     * ```\n     *\t\t     [ Target ]\n     *\t\t     ^\n     *\t\t +-----------------+\n     *\t\t |     Balloon     |\n     *\t\t +-----------------+\n     * ```\n     *\n     * * `southWestArrowNorth`\n     *\n     * ```\n     *\t\t         [ Target ]\n     *\t\t         ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southWestArrowNorthMiddleEast`\n     *\n     * ```\n     *\t\t              [ Target ]\n     *\t\t              ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southWestArrowNorthEast`\n     *\n     * ```\n     *\t\t                 [ Target ]\n     *\t\t                 ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * **South east**\n     *\n     * * `southEastArrowNorthWest`\n     *\n     * ```\n     *\t\t[ Target ]\n     *\t\t         ^\n     *\t\t        +-----------------+\n     *\t\t        |     Balloon     |\n     *\t\t        +-----------------+\n     * ```\n     *\n     * * `southEastArrowNorthMiddleWest`\n     *\n     * ```\n     *\t\t   [ Target ]\n     *\t\t            ^\n     *\t\t        +-----------------+\n     *\t\t        |     Balloon     |\n     *\t\t        +-----------------+\n     * ```\n     *\n     * * `southEastArrowNorth`\n     *\n     * ```\n     *\t\t[ Target ]\n     *\t\t         ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southEastArrowNorthMiddleEast`\n     *\n     * ```\n     *\t\t     [ Target ]\n     *\t\t              ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southEastArrowNorthEast`\n     *\n     * ```\n     *\t\t        [ Target ]\n     *\t\t                 ^\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |\n     *\t\t+-----------------+\n     * ```\n     *\n     * **West**\n     *\n     * * `westArrowEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|     Balloon     |>[ Target ]\n     *\t\t+-----------------+\n     * ```\n     *\n     * **East**\n     *\n     * * `eastArrowWest`\n     *\n     * ```\n     *\t\t           +-----------------+\n     *\t\t[ Target ]<|     Balloon     |\n     *\t\t           +-----------------+\n     * ```\n     *\n     * **Sticky**\n     *\n     * * `viewportStickyNorth`\n     *\n     * ```\n     *\t\t    +---------------------------+\n     *\t\t    |        [ Target ]         |\n     *\t\t    |                           |\n     *\t\t+-----------------------------------+\n     *\t\t|   |    +-----------------+    |   |\n     *\t\t|   |    |     Balloon     |    |   |\n     *\t\t|   |    +-----------------+    |   |\n     *\t\t|   |                           |   |\n     *\t\t|   |                           |   |\n     *\t\t|   |                           |   |\n     *\t\t|   |                           |   |\n     *\t\t|   +---------------------------+   |\n     *\t\t|             Viewport              |\n     *\t\t+-----------------------------------+\n     * ```\n     *\n     * See {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#attachTo}.\n     *\n     * Positioning functions must be compatible with {@link module:utils/dom/position~DomPoint}.\n     *\n     * Default positioning functions with customized offsets can be generated using\n     * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.generatePositions}.\n     *\n     * The name that the position function returns will be reflected in the balloon panel's class that\n     * controls the placement of the \"arrow\". See {@link #position} to learn more.\n     */\n    static defaultPositions = /* #__PURE__ */ BalloonPanelView.generatePositions();\n}\n/**\n * Returns the DOM element for given object or null, if there is none,\n * e.g. when the passed object is a Rect instance or so.\n */\nfunction getDomElement(object) {\n    if (isElement(object)) {\n        return object;\n    }\n    if (isRange(object)) {\n        return object.commonAncestorContainer;\n    }\n    if (typeof object == 'function') {\n        return getDomElement(object());\n    }\n    return null;\n}\n","import { debounce as debounce$1 } from '../../function/debounce.mjs';\n\nfunction debounce(func, debounceMs = 0, options = {}) {\n    if (typeof options !== 'object') {\n        options = {};\n    }\n    const { leading = false, trailing = true, maxWait } = options;\n    const edges = Array(2);\n    if (leading) {\n        edges[0] = 'leading';\n    }\n    if (trailing) {\n        edges[1] = 'trailing';\n    }\n    let result = undefined;\n    let pendingAt = null;\n    const _debounced = debounce$1(function (...args) {\n        result = func.apply(this, args);\n        pendingAt = null;\n    }, debounceMs, { edges });\n    const debounced = function (...args) {\n        if (maxWait != null) {\n            if (pendingAt === null) {\n                pendingAt = Date.now();\n            }\n            if (Date.now() - pendingAt >= maxWait) {\n                result = func.apply(this, args);\n                pendingAt = Date.now();\n                _debounced.cancel();\n                _debounced.schedule();\n                return result;\n            }\n        }\n        _debounced.apply(this, args);\n        return result;\n    };\n    const flush = () => {\n        _debounced.flush();\n        return result;\n    };\n    debounced.cancel = _debounced.cancel;\n    debounced.flush = flush;\n    return debounced;\n}\n\nexport { debounce };\n","function debounce(func, debounceMs, { signal, edges } = {}) {\n    let pendingThis = undefined;\n    let pendingArgs = null;\n    const leading = edges != null && edges.includes('leading');\n    const trailing = edges == null || edges.includes('trailing');\n    const invoke = () => {\n        if (pendingArgs !== null) {\n            func.apply(pendingThis, pendingArgs);\n            pendingThis = undefined;\n            pendingArgs = null;\n        }\n    };\n    const onTimerEnd = () => {\n        if (trailing) {\n            invoke();\n        }\n        cancel();\n    };\n    let timeoutId = null;\n    const schedule = () => {\n        if (timeoutId != null) {\n            clearTimeout(timeoutId);\n        }\n        timeoutId = setTimeout(() => {\n            timeoutId = null;\n            onTimerEnd();\n        }, debounceMs);\n    };\n    const cancelTimer = () => {\n        if (timeoutId !== null) {\n            clearTimeout(timeoutId);\n            timeoutId = null;\n        }\n    };\n    const cancel = () => {\n        cancelTimer();\n        pendingThis = undefined;\n        pendingArgs = null;\n    };\n    const flush = () => {\n        cancelTimer();\n        invoke();\n    };\n    const debounced = function (...args) {\n        if (signal?.aborted) {\n            return;\n        }\n        pendingThis = this;\n        pendingArgs = args;\n        const isFirstCall = timeoutId == null;\n        schedule();\n        if (leading && isFirstCall) {\n            invoke();\n        }\n    };\n    debounced.schedule = schedule;\n    debounced.cancel = cancel;\n    debounced.flush = flush;\n    signal?.addEventListener('abort', cancel, { once: true });\n    return debounced;\n}\n\nexport { debounce };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/tooltipmanager\n */\nimport { View } from './view.js';\nimport { BalloonPanelView } from './panel/balloon/balloonpanelview.js';\nimport { DomEmitterMixin, first, global, isVisible } from '@ckeditor/ckeditor5-utils';\nimport { isElement, debounce } from 'es-toolkit/compat';\nimport '../theme/components/tooltip/tooltip.css';\nconst BALLOON_CLASS = 'ck-tooltip';\n/**\n * A tooltip manager class for the UI of the editor.\n *\n * **Note**: Most likely you do not have to use the `TooltipManager` API listed below in order to display tooltips. Popular\n * {@glink framework/architecture/ui-library UI components} support tooltips out-of-the-box via observable properties\n * (see {@link module:ui/button/buttonview~ButtonView#tooltip} and {@link module:ui/button/buttonview~ButtonView#tooltipPosition}).\n *\n * # Displaying tooltips\n *\n * To display a tooltip, set `data-cke-tooltip-text` attribute on any DOM element:\n *\n * ```ts\n * domElement.dataset.ckeTooltipText = 'My tooltip';\n * ```\n *\n * The tooltip will show up whenever the user moves the mouse over the element or the element gets focus in DOM.\n *\n * # Positioning tooltips\n *\n * To change the position of the tooltip, use the `data-cke-tooltip-position` attribute (`s`, `se`, `sw`, `n`, `e`, or `w`):\n *\n * ```ts\n * domElement.dataset.ckeTooltipText = 'Tooltip to the north';\n * domElement.dataset.ckeTooltipPosition = 'n';\n * ```\n *\n * # Disabling tooltips\n *\n * In order to disable the tooltip temporarily, use the `data-cke-tooltip-disabled` attribute:\n *\n * ```ts\n * domElement.dataset.ckeTooltipText = 'Disabled. For now.';\n * domElement.dataset.ckeTooltipDisabled = 'true';\n * ```\n *\n * # Instant tooltips\n *\n * To remove the delay before showing or hiding the tooltip, use the `data-cke-tooltip-instant` attribute:\n *\n * ```ts\n * domElement.dataset.ckeTooltipInstant = 'true';\n * ```\n *\n * # Styling tooltips\n *\n * By default, the tooltip has `.ck-tooltip` class and its text inner `.ck-tooltip__text`.\n *\n * If your tooltip requires custom styling, using `data-cke-tooltip-class` attribute will add additional class to the balloon\n * displaying the tooltip:\n *\n * ```ts\n * domElement.dataset.ckeTooltipText = 'Tooltip with a red text';\n * domElement.dataset.ckeTooltipClass = 'my-class';\n * ```\n *\n * ```css\n * .ck.ck-tooltip.my-class { color: red }\n * ```\n *\n * **Note**: This class is a singleton. All editor instances re-use the same instance loaded by\n * {@link module:ui/editorui/editorui~EditorUI} of the first editor.\n */\nexport class TooltipManager extends /* #__PURE__ */ DomEmitterMixin() {\n    /**\n     * The view rendering text of the tooltip.\n     */\n    tooltipTextView;\n    /**\n     * The instance of the balloon panel that renders and positions the tooltip.\n     */\n    balloonPanelView;\n    /**\n     * A set of default {@link module:utils/dom/position~PositioningFunction positioning functions} used by the `TooltipManager`\n     * to pin tooltips in different positions.\n     */\n    static defaultBalloonPositions = /* #__PURE__ */ BalloonPanelView.generatePositions({\n        heightOffset: 5,\n        sideOffset: 13\n    });\n    /**\n     * Stores the reference to the DOM element the tooltip is attached to. `null` when there's no tooltip\n     * in the UI.\n     */\n    _currentElementWithTooltip = null;\n    /**\n     * Stores the current tooltip position. `null` when there's no tooltip in the UI.\n     */\n    _currentTooltipPosition = null;\n    /**\n     * An instance of the mutation observer that keeps track on target element attributes changes.\n     */\n    _mutationObserver = null;\n    /**\n     * A debounced version of {@link #_pinTooltip}. Tooltips show with a delay to avoid flashing and\n     * to improve the UX.\n     */\n    _pinTooltipDebounced;\n    /**\n     * A debounced version of {@link #_unpinTooltip}. Tooltips hide with a delay to allow hovering of their titles.\n     */\n    _unpinTooltipDebounced;\n    _watchdogExcluded;\n    /**\n     * A set of editors the single tooltip manager instance must listen to.\n     * This is mostly to handle `EditorUI#update` listeners from individual editors.\n     */\n    static _editors = new Set();\n    /**\n     * A reference to the `TooltipManager` instance. The class is a singleton and as such,\n     * successive attempts at creating instances should return this instance.\n     */\n    static _instance = null;\n    /**\n     * Creates an instance of the tooltip manager.\n     */\n    constructor(editor) {\n        super();\n        TooltipManager._editors.add(editor);\n        // TooltipManager must be a singleton. Multiple instances would mean multiple tooltips attached\n        // to the same DOM element with data-cke-tooltip-* attributes.\n        if (TooltipManager._instance) {\n            return TooltipManager._instance;\n        }\n        TooltipManager._instance = this;\n        this.tooltipTextView = new View(editor.locale);\n        this.tooltipTextView.set('text', '');\n        this.tooltipTextView.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-tooltip__text'\n                ]\n            },\n            children: [\n                {\n                    text: this.tooltipTextView.bindTemplate.to('text')\n                }\n            ]\n        });\n        this.balloonPanelView = new BalloonPanelView(editor.locale);\n        this.balloonPanelView.class = BALLOON_CLASS;\n        this.balloonPanelView.content.add(this.tooltipTextView);\n        this._mutationObserver = createMutationObserver(() => {\n            this._updateTooltipPosition();\n        });\n        this._pinTooltipDebounced = debounce(this._pinTooltip, 600);\n        this._unpinTooltipDebounced = debounce(this._unpinTooltip, 400);\n        this.listenTo(global.document, 'keydown', this._onKeyDown.bind(this), { useCapture: true });\n        this.listenTo(global.document, 'mouseenter', this._onEnterOrFocus.bind(this), { useCapture: true });\n        this.listenTo(global.document, 'mouseleave', this._onLeaveOrBlur.bind(this), { useCapture: true });\n        this.listenTo(global.document, 'focus', this._onEnterOrFocus.bind(this), { useCapture: true });\n        this.listenTo(global.document, 'blur', this._onLeaveOrBlur.bind(this), { useCapture: true });\n        this.listenTo(global.document, 'scroll', this._onScroll.bind(this), { useCapture: true });\n        // Because this class is a singleton, its only instance is shared across all editors and connects them through the reference.\n        // This causes issues with the ContextWatchdog. When an error is thrown in one editor, the watchdog traverses the references\n        // and (because of shared tooltip manager) figures that the error affects all editors and restarts them all.\n        // This flag, excludes tooltip manager instance from the traversal and brings ContextWatchdog back to normal.\n        // More in https://github.com/ckeditor/ckeditor5/issues/12292.\n        this._watchdogExcluded = true;\n    }\n    /**\n     * Destroys the tooltip manager.\n     *\n     * **Note**: The manager singleton cannot be destroyed until all editors that use it are destroyed.\n     *\n     * @param editor The editor the manager was created for.\n     */\n    destroy(editor) {\n        const editorBodyViewCollection = editor.ui.view && editor.ui.view.body;\n        TooltipManager._editors.delete(editor);\n        this.stopListening(editor.ui);\n        // Prevent the balloon panel from being destroyed in the EditorUI#destroy() cascade. It should be destroyed along\n        // with the last editor only (https://github.com/ckeditor/ckeditor5/issues/12602).\n        if (editorBodyViewCollection && editorBodyViewCollection.has(this.balloonPanelView)) {\n            editorBodyViewCollection.remove(this.balloonPanelView);\n        }\n        if (!TooltipManager._editors.size) {\n            this._unpinTooltip();\n            this.balloonPanelView.destroy();\n            this.stopListening();\n            TooltipManager._instance = null;\n        }\n    }\n    /**\n     * Returns {@link #balloonPanelView} {@link module:utils/dom/position~PositioningFunction positioning functions} for a given position\n     * name.\n     *\n     * @param position Name of the position (`s`, `se`, `sw`, `n`, `e`, or `w`).\n     * @returns Positioning functions to be used by the {@link #balloonPanelView}.\n     */\n    static getPositioningFunctions(position) {\n        const defaultPositions = TooltipManager.defaultBalloonPositions;\n        return {\n            // South is most popular. We can use positioning heuristics to avoid clipping by the viewport with the sane fallback.\n            s: [\n                defaultPositions.southArrowNorth,\n                defaultPositions.southArrowNorthEast,\n                defaultPositions.southArrowNorthWest\n            ],\n            n: [defaultPositions.northArrowSouth],\n            e: [defaultPositions.eastArrowWest],\n            w: [defaultPositions.westArrowEast],\n            sw: [defaultPositions.southArrowNorthEast],\n            se: [defaultPositions.southArrowNorthWest]\n        }[position];\n    }\n    /**\n     * Handles hiding tooltips on `keydown` in DOM.\n     *\n     * @param evt An object containing information about the fired event.\n     * @param domEvent The DOM event.\n     */\n    _onKeyDown(evt, domEvent) {\n        if (domEvent.key === 'Escape' && this._currentElementWithTooltip) {\n            this._unpinTooltip();\n            domEvent.stopPropagation();\n        }\n    }\n    /**\n     * Handles displaying tooltips on `mouseenter` and `focus` in DOM.\n     *\n     * @param evt An object containing information about the fired event.\n     * @param domEvent The DOM event.\n     */\n    _onEnterOrFocus(evt, { target }) {\n        const elementWithTooltipAttribute = getDescendantWithTooltip(target);\n        // Abort when there's no descendant needing tooltip.\n        if (!elementWithTooltipAttribute) {\n            // Unpin if element is focused, regardless of whether it contains a label or not.\n            // It also prevents tooltips from overlapping the menu bar\n            if (evt.name === 'focus') {\n                this._unpinTooltip();\n            }\n            return;\n        }\n        // Abort to avoid flashing when, for instance:\n        // * a tooltip is displayed for a focused element, then the same element gets mouseentered,\n        // * a tooltip is displayed for an element via mouseenter, then the focus moves to the same element.\n        if (elementWithTooltipAttribute === this._currentElementWithTooltip) {\n            this._unpinTooltipDebounced.cancel();\n            return;\n        }\n        this._unpinTooltip();\n        // The tooltip should be pinned immediately when the element gets focused using keyboard.\n        // If it is focused using the mouse, the tooltip should be pinned after a delay to prevent flashing.\n        // See https://github.com/ckeditor/ckeditor5/issues/16383\n        // Also, if the element has an attribute `data-cke-tooltip-instant`, the tooltip should be pinned immediately.\n        // This is useful for elements that have their content partially hidden (e.g. a long text in a small container)\n        // and should show a tooltip on hover, like merge field.\n        if (evt.name === 'focus' && !elementWithTooltipAttribute.matches(':hover') ||\n            elementWithTooltipAttribute.matches('[data-cke-tooltip-instant]')) {\n            this._pinTooltip(elementWithTooltipAttribute, getTooltipData(elementWithTooltipAttribute));\n        }\n        else {\n            this._pinTooltipDebounced(elementWithTooltipAttribute, getTooltipData(elementWithTooltipAttribute));\n        }\n    }\n    /**\n     * Handles hiding tooltips on `mouseleave` and `blur` in DOM.\n     *\n     * @param evt An object containing information about the fired event.\n     * @param domEvent The DOM event.\n     */\n    _onLeaveOrBlur(evt, { target, relatedTarget }) {\n        if (evt.name === 'mouseleave') {\n            // Don't act when the event does not concern a DOM element (e.g. a mouseleave out of an entire document),\n            if (!isElement(target)) {\n                return;\n            }\n            const balloonElement = this.balloonPanelView.element;\n            const isEnteringBalloon = balloonElement && (balloonElement === relatedTarget || balloonElement.contains(relatedTarget));\n            const isLeavingBalloon = !isEnteringBalloon && target === balloonElement;\n            // Do not hide the tooltip when the user moves the cursor over it.\n            if (isEnteringBalloon) {\n                this._unpinTooltipDebounced.cancel();\n                return;\n            }\n            // If a tooltip is currently visible, don't act for a targets other than the one it is attached to.\n            // The only exception is leaving balloon, in this scenario tooltip should be closed.\n            // For instance, a random mouseleave far away in the page should not unpin the tooltip that was pinned because\n            // of a previous focus. Only leaving the same element should hide the tooltip.\n            if (!isLeavingBalloon && this._currentElementWithTooltip && target !== this._currentElementWithTooltip) {\n                return;\n            }\n            const descendantWithTooltip = getDescendantWithTooltip(target);\n            const relatedDescendantWithTooltip = getDescendantWithTooltip(relatedTarget);\n            // Unpin when the mouse was leaving element with a tooltip to a place which does not have or has a different tooltip.\n            // Note that this should happen whether the tooltip is already visible or not, for instance,\n            // it could be invisible but queued (debounced): it should get canceled.\n            if (isLeavingBalloon || (descendantWithTooltip && descendantWithTooltip !== relatedDescendantWithTooltip)) {\n                this._pinTooltipDebounced.cancel();\n                // If the currently visible tooltip is instant, unpin it immediately.\n                if (this._currentElementWithTooltip && this._currentElementWithTooltip.matches('[data-cke-tooltip-instant]') ||\n                    descendantWithTooltip && descendantWithTooltip.matches('[data-cke-tooltip-instant]')) {\n                    this._unpinTooltip();\n                }\n                else {\n                    this._unpinTooltipDebounced();\n                }\n            }\n        }\n        else {\n            // If a tooltip is currently visible, don't act for a targets other than the one it is attached to.\n            // For instance, a random blur in the web page should not unpin the tooltip that was pinned because of a previous mouseenter.\n            if (this._currentElementWithTooltip && target !== this._currentElementWithTooltip) {\n                return;\n            }\n            // Note that unpinning should happen whether the tooltip is already visible or not, for instance, it could be invisible but\n            // queued (debounced): it should get canceled (e.g. quick focus then quick blur using the keyboard).\n            this._pinTooltipDebounced.cancel();\n            this._unpinTooltipDebounced();\n        }\n    }\n    /**\n     * Handles hiding tooltips on `scroll` in DOM.\n     *\n     * @param evt An object containing information about the fired event.\n     * @param domEvent The DOM event.\n     */\n    _onScroll(evt, { target }) {\n        // No tooltip, no reason to react on scroll.\n        if (!this._currentElementWithTooltip) {\n            return;\n        }\n        // When scrolling a container that has both the balloon and the current element (common ancestor), the balloon can remain\n        // visible (e.g. scrolling ≤body>). Otherwise, to avoid glitches (clipping, lagging) better just hide the tooltip.\n        // Also, don't do anything when scrolling an unrelated DOM element that has nothing to do with the current element and the balloon.\n        if (target.contains(this.balloonPanelView.element) && target.contains(this._currentElementWithTooltip)) {\n            return;\n        }\n        this._unpinTooltip();\n    }\n    /**\n     * Pins the tooltip to a specific DOM element.\n     *\n     * @param targetDomElement Element to be pinned to.\n     * @param options Options for the tooltip.\n     * @param options.text Text of the tooltip to display.\n     * @param options.position The position of the tooltip.\n     * @param options.cssClass Additional CSS class of the balloon with the tooltip.\n     */\n    _pinTooltip(targetDomElement, { text, position, cssClass }) {\n        this._unpinTooltip();\n        // Use the body collection of the first editor.\n        const bodyViewCollection = first(TooltipManager._editors.values()).ui.view.body;\n        if (!bodyViewCollection.has(this.balloonPanelView)) {\n            bodyViewCollection.add(this.balloonPanelView);\n        }\n        this.tooltipTextView.text = text;\n        this.balloonPanelView.class = [BALLOON_CLASS, cssClass]\n            .filter(className => className)\n            .join(' ');\n        // Ensure that all changes to the tooltip are set before pinning it.\n        // Setting class or text after pinning can cause the tooltip to be pinned in the wrong position.\n        // It happens especially often when tooltip has class modified (like adding `ck-tooltip_multi-line`).\n        // See https://github.com/ckeditor/ckeditor5/issues/16365\n        this.balloonPanelView.pin({\n            target: targetDomElement,\n            positions: TooltipManager.getPositioningFunctions(position)\n        });\n        this._mutationObserver.attach(targetDomElement);\n        // Start responding to changes in editor UI or content layout. For instance, when collaborators change content\n        // and a contextual toolbar attached to a content starts to move (and so should move the tooltip).\n        // Note: Using low priority to let other listeners that position contextual toolbars etc. to react first.\n        for (const editor of TooltipManager._editors) {\n            this.listenTo(editor.ui, 'update', this._updateTooltipPosition.bind(this), { priority: 'low' });\n        }\n        this._currentElementWithTooltip = targetDomElement;\n        this._currentTooltipPosition = position;\n    }\n    /**\n     * Unpins the tooltip and cancels all queued pinning.\n     */\n    _unpinTooltip() {\n        this._unpinTooltipDebounced.cancel();\n        this._pinTooltipDebounced.cancel();\n        this.balloonPanelView.unpin();\n        for (const editor of TooltipManager._editors) {\n            this.stopListening(editor.ui, 'update');\n        }\n        this._currentElementWithTooltip = null;\n        this._currentTooltipPosition = null;\n        this.tooltipTextView.text = '';\n        this._mutationObserver.detach();\n    }\n    /**\n     * Updates the position of the tooltip so it stays in sync with the element it is pinned to.\n     *\n     * Hides the tooltip when the element is no longer visible in DOM or the tooltip text was removed.\n     */\n    _updateTooltipPosition() {\n        // The tooltip might get removed by focus listener triggered by the same UI `update` event.\n        // See https://github.com/ckeditor/ckeditor5/pull/16363.\n        if (!this._currentElementWithTooltip) {\n            return;\n        }\n        const tooltipData = getTooltipData(this._currentElementWithTooltip);\n        // This could happen if the tooltip was attached somewhere in a contextual content toolbar and the toolbar\n        // disappeared (e.g. removed an image), or the tooltip text was removed.\n        if (!isVisible(this._currentElementWithTooltip) || !tooltipData.text) {\n            this._unpinTooltip();\n            return;\n        }\n        this.balloonPanelView.pin({\n            target: this._currentElementWithTooltip,\n            positions: TooltipManager.getPositioningFunctions(tooltipData.position)\n        });\n    }\n}\nfunction getDescendantWithTooltip(element) {\n    if (!isElement(element)) {\n        return null;\n    }\n    return element.closest('[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])');\n}\nfunction getTooltipData(element) {\n    return {\n        text: element.dataset.ckeTooltipText,\n        position: (element.dataset.ckeTooltipPosition || 's'),\n        cssClass: element.dataset.ckeTooltipClass || ''\n    };\n}\n// Creates a simple `MutationObserver` instance wrapper that observes changes in the tooltip-related attributes of the given element.\n// Used instead of the `MutationObserver` from the engine for simplicity.\nfunction createMutationObserver(callback) {\n    const mutationObserver = new MutationObserver(() => {\n        callback();\n    });\n    return {\n        attach(element) {\n            mutationObserver.observe(element, {\n                attributes: true,\n                attributeFilter: ['data-cke-tooltip-text', 'data-cke-tooltip-position']\n            });\n        },\n        detach() {\n            mutationObserver.disconnect();\n        }\n    };\n}\n","import { debounce } from './debounce.mjs';\n\nfunction throttle(func, throttleMs = 0, options = {}) {\n    if (typeof options !== 'object') {\n        options = {};\n    }\n    const { leading = true, trailing = true } = options;\n    return debounce(func, throttleMs, {\n        leading,\n        trailing,\n        maxWait: throttleMs,\n    });\n}\n\nexport { throttle };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Rect, DomEmitterMixin } from '@ckeditor/ckeditor5-utils';\nimport { BalloonPanelView } from '../panel/balloon/balloonpanelview.js';\nimport { throttle } from 'es-toolkit/compat';\n// ⚠ Note, whenever changing the threshold, make sure to update the docs/support/managing-ckeditor-logo.md docs\n// as this information is also mentioned there ⚠.\nconst NARROW_ROOT_HEIGHT_THRESHOLD = 50;\nconst NARROW_ROOT_WIDTH_THRESHOLD = 350;\n/**\n * A helper that enables the badge feature in the editor and renders a custom view next to the bottom of the editable element\n * (editor root, source editing area, etc.) when the editor is focused.\n *\n * @private\n */\nexport class Badge extends /* #__PURE__ */ DomEmitterMixin() {\n    /**\n     * Editor instance the helper was created for.\n     */\n    editor;\n    /**\n     * A reference to the balloon panel hosting and positioning the badge content.\n     */\n    _balloonView = null;\n    /**\n     * A throttled version of the {@link #_showBalloon} method meant for frequent use to avoid performance loss.\n     */\n    _showBalloonThrottled = throttle(() => this._showBalloon(), 50, { leading: true });\n    /**\n     * A reference to the last editable element (root, source editing area, etc.) focused by the user.\n     * Since the focus can move to other focusable elements in the UI, this reference allows positioning the balloon over the\n     * right element whether the user is typing or using the UI.\n     */\n    _lastFocusedEditableElement = null;\n    /**\n     * An additional CSS class added to the `BalloonView`.\n     */\n    _balloonClass;\n    /**\n     * Creates a badge for a given editor. The feature is initialized on Editor#ready\n     * event.\n     */\n    constructor(editor, options = {}) {\n        super();\n        this.editor = editor;\n        this._balloonClass = options.balloonClass;\n        editor.on('ready', () => this._handleEditorReady());\n    }\n    /**\n     * Destroys the badge along with its view.\n     */\n    destroy() {\n        const balloon = this._balloonView;\n        if (balloon) {\n            // Balloon gets destroyed by the body collection.\n            // The badge view gets destroyed by the balloon.\n            balloon.unpin();\n            this._balloonView = null;\n        }\n        this._showBalloonThrottled.cancel();\n        this.stopListening();\n    }\n    /**\n     * Enables badge label once the editor (ui) is ready.\n     */\n    _handleEditorReady() {\n        const editor = this.editor;\n        if (!this._isEnabled()) {\n            return;\n        }\n        // No view means no body collection to append the badge balloon to.\n        if (!editor.ui.view) {\n            return;\n        }\n        editor.ui.focusTracker.on('change:isFocused', (evt, data, isFocused) => {\n            this._updateLastFocusedEditableElement();\n            if (isFocused) {\n                this._showBalloon();\n            }\n            else {\n                this._hideBalloon();\n            }\n        });\n        editor.ui.focusTracker.on('change:focusedElement', (evt, data, focusedElement) => {\n            this._updateLastFocusedEditableElement();\n            if (focusedElement) {\n                this._showBalloon();\n            }\n        });\n        editor.ui.on('update', () => {\n            this._showBalloonThrottled();\n        });\n    }\n    /**\n     * Returns normalized configuration for the badge.\n     */\n    _getNormalizedConfig() {\n        return {\n            side: this.editor.locale.contentLanguageDirection === 'ltr' ? 'right' : 'left',\n            position: 'border',\n            verticalOffset: 0,\n            horizontalOffset: 5\n        };\n    }\n    /**\n     * Attempts to display the balloon with the badge view.\n     */\n    _showBalloon() {\n        const attachOptions = this._getBalloonAttachOptions();\n        if (!attachOptions) {\n            return;\n        }\n        if (!this._balloonView) {\n            this._balloonView = this._createBalloonView();\n        }\n        this._balloonView.pin(attachOptions);\n    }\n    /**\n     * Hides the badge balloon if already visible.\n     */\n    _hideBalloon() {\n        if (this._balloonView) {\n            this._balloonView.unpin();\n        }\n    }\n    /**\n     * Creates an instance of the {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView balloon panel}\n     * with the badge view inside ready for positioning.\n     */\n    _createBalloonView() {\n        const editor = this.editor;\n        const balloon = new BalloonPanelView();\n        const view = this._createBadgeContent();\n        balloon.content.add(view);\n        if (this._balloonClass) {\n            balloon.class = this._balloonClass;\n        }\n        editor.ui.view.body.add(balloon);\n        return balloon;\n    }\n    /**\n     * Returns the options for attaching the balloon to the focused editable element.\n     */\n    _getBalloonAttachOptions() {\n        if (!this._lastFocusedEditableElement) {\n            return null;\n        }\n        const badgeConfig = this._getNormalizedConfig();\n        const positioningFunction = badgeConfig.side === 'right' ?\n            getLowerRightCornerPosition(this._lastFocusedEditableElement, badgeConfig) :\n            getLowerLeftCornerPosition(this._lastFocusedEditableElement, badgeConfig);\n        return {\n            target: this._lastFocusedEditableElement,\n            positions: [positioningFunction]\n        };\n    }\n    /**\n     * Updates the {@link #_lastFocusedEditableElement} based on the state of the global focus tracker.\n     */\n    _updateLastFocusedEditableElement() {\n        const editor = this.editor;\n        const isFocused = editor.ui.focusTracker.isFocused;\n        const focusedElement = editor.ui.focusTracker.focusedElement;\n        if (!isFocused || !focusedElement) {\n            this._lastFocusedEditableElement = null;\n            return;\n        }\n        const editableEditorElements = Array.from(editor.ui.getEditableElementsNames()).map(name => {\n            return editor.ui.getEditableElement(name);\n        });\n        if (editableEditorElements.includes(focusedElement)) {\n            this._lastFocusedEditableElement = focusedElement;\n        }\n        else {\n            // If it's none of the editable element, then the focus is somewhere in the UI. Let's display the badge\n            // over the first element then.\n            this._lastFocusedEditableElement = editableEditorElements[0];\n        }\n    }\n}\nfunction getLowerRightCornerPosition(focusedEditableElement, config) {\n    return getLowerCornerPosition(focusedEditableElement, config, (rootRect, balloonRect) => {\n        return rootRect.left + rootRect.width - balloonRect.width - config.horizontalOffset;\n    });\n}\nfunction getLowerLeftCornerPosition(focusedEditableElement, config) {\n    return getLowerCornerPosition(focusedEditableElement, config, rootRect => rootRect.left + config.horizontalOffset);\n}\nfunction getLowerCornerPosition(focusedEditableElement, config, getBalloonLeft) {\n    return (visibleEditableElementRect, balloonRect) => {\n        const editableElementRect = new Rect(focusedEditableElement);\n        if (editableElementRect.width < NARROW_ROOT_WIDTH_THRESHOLD || editableElementRect.height < NARROW_ROOT_HEIGHT_THRESHOLD) {\n            return null;\n        }\n        let balloonTop;\n        if (config.position === 'inside') {\n            balloonTop = editableElementRect.bottom - balloonRect.height;\n        }\n        else {\n            balloonTop = editableElementRect.bottom - balloonRect.height / 2;\n        }\n        balloonTop -= config.verticalOffset;\n        const balloonLeft = getBalloonLeft(editableElementRect, balloonRect);\n        // Clone the editable element rect and place it where the balloon would be placed.\n        // This will allow getVisible() to work from editable element's perspective (rect source).\n        // and yield a result as if the balloon was on the same (scrollable) layer as the editable element.\n        const newBalloonPositionRect = visibleEditableElementRect\n            .clone()\n            .moveTo(balloonLeft, balloonTop)\n            .getIntersection(balloonRect.clone().moveTo(balloonLeft, balloonTop));\n        const newBalloonPositionVisibleRect = newBalloonPositionRect.getVisible();\n        if (!newBalloonPositionVisibleRect || newBalloonPositionVisibleRect.getArea() < balloonRect.getArea()) {\n            return null;\n        }\n        return {\n            top: balloonTop,\n            left: balloonLeft,\n            name: `position_${config.position}-side_${config.side}`,\n            config: {\n                withArrow: false\n            }\n        };\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/icon/iconview\n */\nimport { View } from '../view.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/icon/icon.css';\n/**\n * The icon view class.\n */\nexport class IconView extends View {\n    /**\n     * A list of presentational attributes that can be set on the `<svg>` element and should be preserved\n     * when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.\n     *\n     * See the [specification](https://www.w3.org/TR/SVG/styling.html#TermPresentationAttribute) to learn more.\n     */\n    static presentationalAttributeNames = [\n        'alignment-baseline', 'baseline-shift', 'clip-path', 'clip-rule', 'color', 'color-interpolation',\n        'color-interpolation-filters', 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline', 'fill', 'fill-opacity',\n        'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style',\n        'font-variant', 'font-weight', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start',\n        'mask', 'opacity', 'overflow', 'paint-order', 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke',\n        'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width',\n        'text-anchor', 'text-decoration', 'text-overflow', 'text-rendering', 'transform', 'unicode-bidi', 'vector-effect',\n        'visibility', 'white-space', 'word-spacing', 'writing-mode'\n    ];\n    /**\n     * @inheritDoc\n     */\n    constructor() {\n        super();\n        const bind = this.bindTemplate;\n        this.set('content', '');\n        this.set('viewBox', '0 0 20 20');\n        this.set('fillColor', '');\n        this.set('isColorInherited', true);\n        this.set('isVisible', true);\n        this.setTemplate({\n            tag: 'svg',\n            ns: 'http://www.w3.org/2000/svg',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-icon',\n                    bind.if('isVisible', 'ck-hidden', value => !value),\n                    // Exclude icon internals from the CSS reset to allow rich (non-monochromatic) icons\n                    // (https://github.com/ckeditor/ckeditor5/issues/12599).\n                    'ck-reset_all-excluded',\n                    // The class to remove the dynamic color inheritance is toggleable\n                    // (https://github.com/ckeditor/ckeditor5/issues/12599).\n                    bind.if('isColorInherited', 'ck-icon_inherit-color')\n                ],\n                viewBox: bind.to('viewBox'),\n                'aria-hidden': true\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this._updateXMLContent();\n        this._colorFillPaths();\n        // This is a hack for lack of innerHTML binding.\n        // See: https://github.com/ckeditor/ckeditor5-ui/issues/99.\n        this.on('change:content', () => {\n            this._updateXMLContent();\n            this._colorFillPaths();\n        });\n        this.on('change:fillColor', () => {\n            this._colorFillPaths();\n        });\n    }\n    /**\n     * Updates the {@link #element} with the value of {@link #content}.\n     */\n    _updateXMLContent() {\n        if (this.content) {\n            const parsed = new DOMParser().parseFromString(this.content.trim(), 'image/svg+xml');\n            const svg = parsed.querySelector('svg');\n            if (!svg) {\n                /**\n                 * The provided icon content is not a valid SVG.\n                 *\n                 * @error ui-iconview-invalid-svg\n                 */\n                throw new CKEditorError('ui-iconview-invalid-svg', this);\n            }\n            const viewBox = svg.getAttribute('viewBox');\n            if (viewBox) {\n                this.viewBox = viewBox;\n            }\n            // Preserve presentational attributes of the <svg> element from the source.\n            // They can affect rendering of the entire icon (https://github.com/ckeditor/ckeditor5/issues/12597).\n            for (const { name, value } of Array.from(svg.attributes)) {\n                if (IconView.presentationalAttributeNames.includes(name)) {\n                    this.element.setAttribute(name, value);\n                }\n            }\n            while (this.element.firstChild) {\n                this.element.removeChild(this.element.firstChild);\n            }\n            while (svg.childNodes.length > 0) {\n                this.element.appendChild(svg.childNodes[0]);\n            }\n        }\n    }\n    /**\n     * Fills all child `path.ck-icon__fill` with the `#fillColor`.\n     */\n    _colorFillPaths() {\n        if (this.fillColor) {\n            this.element.querySelectorAll('.ck-icon__fill').forEach(path => {\n                path.style.fill = this.fillColor;\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/poweredby\n */\nimport { IconProjectLogo } from '@ckeditor/ckeditor5-icons';\nimport { parseBase64EncodedObject } from '@ckeditor/ckeditor5-utils';\nimport { View } from '../view.js';\nimport { Badge } from '../badge/badge.js';\nimport { IconView } from '../icon/iconview.js';\nconst DEFAULT_LABEL = 'Powered by';\n/**\n * A helper that enables the \"powered by\" feature in the editor and renders a link to the project's\n * webpage next to the bottom of the editable element (editor root, source editing area, etc.) when the editor is focused.\n *\n * @private\n */\nexport class PoweredBy extends Badge {\n    constructor(editor) {\n        super(editor, { balloonClass: 'ck-powered-by-balloon' });\n    }\n    /**\n     * Enables \"powered by\" label.\n     */\n    _isEnabled() {\n        const editor = this.editor;\n        const forceVisible = editor.config.get('ui.poweredBy.forceVisible');\n        if (forceVisible) {\n            return true;\n        }\n        const licenseKey = editor.config.get('licenseKey');\n        if (licenseKey == 'GPL') {\n            return true;\n        }\n        const licenseContent = parseBase64EncodedObject(licenseKey.split('.')[1]);\n        if (!licenseContent) {\n            return true;\n        }\n        return !licenseContent.whiteLabel;\n    }\n    /**\n     * Creates a \"powered by\" badge content.\n     */\n    _createBadgeContent() {\n        return new PoweredByView(this.editor.locale, this._getNormalizedConfig().label);\n    }\n    /**\n     * Returns the normalized configuration for the \"powered by\" badge.\n     * It takes the user configuration into account and falls back to the default one.\n     */\n    _getNormalizedConfig() {\n        const badgeConfig = super._getNormalizedConfig();\n        const userConfig = this.editor.config.get('ui.poweredBy') || {};\n        const position = userConfig.position || badgeConfig.position;\n        const verticalOffset = position === 'inside' ? 5 : badgeConfig.verticalOffset;\n        return {\n            position,\n            side: userConfig.side || badgeConfig.side,\n            label: userConfig.label === undefined ? DEFAULT_LABEL : userConfig.label,\n            verticalOffset: userConfig.verticalOffset !== undefined ? userConfig.verticalOffset : verticalOffset,\n            horizontalOffset: userConfig.horizontalOffset !== undefined ? userConfig.horizontalOffset : badgeConfig.horizontalOffset,\n            forceVisible: !!userConfig.forceVisible\n        };\n    }\n}\n/**\n * A view displaying a \"powered by\" label and project logo wrapped in a link.\n */\nclass PoweredByView extends View {\n    /**\n     * Creates an instance of the \"powered by\" view.\n     *\n     * @param locale The localization services instance.\n     * @param label The label text.\n     */\n    constructor(locale, label) {\n        super(locale);\n        const iconView = new IconView();\n        const bind = this.bindTemplate;\n        iconView.set({\n            content: IconProjectLogo,\n            isColorInherited: false\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-powered-by'],\n                'aria-hidden': true\n            },\n            children: [\n                {\n                    tag: 'a',\n                    attributes: {\n                        href: 'https://ckeditor.com/powered-by-ckeditor/?utm_source=ckeditor&' +\n                            'utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo',\n                        target: '_blank',\n                        tabindex: '-1'\n                    },\n                    children: [\n                        ...label ? [\n                            {\n                                tag: 'span',\n                                attributes: {\n                                    class: ['ck', 'ck-powered-by__label']\n                                },\n                                children: [label]\n                            }\n                        ] : [],\n                        iconView\n                    ],\n                    on: {\n                        dragstart: bind.to(evt => evt.preventDefault())\n                    }\n                }\n            ]\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"53\\\" height=\\\"10\\\" viewBox=\\\"0 0 53 10\\\"><path fill=\\\"#1C2331\\\" d=\\\"M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z\\\"/><path fill=\\\"#AFE229\\\" d=\\\"M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z\\\"/><path fill=\\\"#771BFF\\\" d=\\\"m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z\\\"/></svg>\\n\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { parseBase64EncodedObject } from '@ckeditor/ckeditor5-utils';\nimport { View } from '../view.js';\nimport { Badge } from '../badge/badge.js';\n/**\n * A helper that enables the \"evaluation badge\" feature in the editor at the bottom of the editable element\n * (editor root, source editing area, etc.) when the editor is focused.\n *\n * @private\n */\nexport class EvaluationBadge extends Badge {\n    licenseTypeMessage = {\n        evaluation: 'For evaluation purposes only',\n        trial: 'For evaluation purposes only',\n        development: 'For development purposes only'\n    };\n    constructor(editor) {\n        super(editor, { balloonClass: 'ck-evaluation-badge-balloon' });\n    }\n    /**\n     * Enables \"evaluation badge\" label.\n     */\n    _isEnabled() {\n        const editor = this.editor;\n        const licenseKey = editor.config.get('licenseKey');\n        const licenseType = getLicenseTypeFromLicenseKey(licenseKey);\n        return Boolean(licenseType && this.licenseTypeMessage[licenseType]);\n    }\n    /**\n     * Creates the content of the \"evaluation badge\".\n     */\n    _createBadgeContent() {\n        const licenseKey = this.editor.config.get('licenseKey');\n        const licenseType = getLicenseTypeFromLicenseKey(licenseKey);\n        return new EvaluationBadgeView(this.editor.locale, this.licenseTypeMessage[licenseType]);\n    }\n    /**\n     * Returns the normalized configuration for the \"evaluation badge\".\n     * It takes 'ui.poweredBy' configuration into account to determine the badge position and side.\n     */\n    _getNormalizedConfig() {\n        const badgeConfig = super._getNormalizedConfig();\n        const userConfig = this.editor.config.get('ui.poweredBy') || {};\n        const position = userConfig.position || badgeConfig.position;\n        const poweredBySide = userConfig.side || badgeConfig.side;\n        return {\n            position,\n            side: poweredBySide === 'left' ? 'right' : 'left',\n            verticalOffset: badgeConfig.verticalOffset,\n            horizontalOffset: badgeConfig.horizontalOffset\n        };\n    }\n}\n/**\n * A view displaying the \"evaluation badge\".\n */\nclass EvaluationBadgeView extends View {\n    /**\n     * Creates an instance of the \"evaluation badge\" view.\n     *\n     * @param locale The localization services instance.\n     * @param label The label text.\n     */\n    constructor(locale, label) {\n        super(locale);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-evaluation-badge'],\n                'aria-hidden': true\n            },\n            children: [\n                {\n                    tag: 'span',\n                    attributes: {\n                        class: ['ck', 'ck-evaluation-badge__label']\n                    },\n                    children: [label]\n                }\n            ]\n        });\n    }\n}\n/**\n * Returns the license type based on the license key.\n */\nfunction getLicenseTypeFromLicenseKey(licenseKey) {\n    if (licenseKey == 'GPL') {\n        return 'GPL';\n    }\n    const licenseContent = parseBase64EncodedObject(licenseKey.split('.')[1]);\n    if (!licenseContent) {\n        return null;\n    }\n    return licenseContent.licenseType || 'production';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { View } from './view.js';\nimport '../theme/components/arialiveannouncer/arialiveannouncer.css';\n/**\n * The politeness level of an `aria-live` announcement.\n *\n * Available keys are:\n * * `AriaLiveAnnouncerPoliteness.POLITE`,\n * * `AriaLiveAnnouncerPoliteness.ASSERTIVE`\n *\n * [Learn more](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Politeness_levels).\n */\nexport const AriaLiveAnnouncerPoliteness = {\n    POLITE: 'polite',\n    ASSERTIVE: 'assertive'\n};\n/**\n * An accessibility helper that manages all ARIA live regions associated with an editor instance. ARIA live regions announce changes\n * to the state of the editor features.\n *\n * These announcements are consumed and propagated by screen readers and give users a better understanding of the current\n * state of the editor.\n *\n * To announce a state change to an editor use the {@link #announce} method:\n *\n * ```ts\n * editor.ui.ariaLiveAnnouncer.announce( 'Text of an announcement.' );\n * ```\n */\nexport class AriaLiveAnnouncer {\n    /**\n     * The editor instance.\n     */\n    editor;\n    /**\n     * The view that aggregates all `aria-live` regions.\n     */\n    view;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        this.editor = editor;\n        /**\n         * Some screen readers only look at changes in the aria-live region.\n         * They might not read a region that already has content when it is added.\n         * To stop this problem, make sure to set up regions for all politeness settings when the editor starts.\n         */\n        editor.once('ready', () => {\n            for (const politeness of Object.values(AriaLiveAnnouncerPoliteness)) {\n                this.announce('', politeness);\n            }\n        });\n    }\n    /**\n     * Sets an announcement text to an aria region that is then announced by a screen reader to the user.\n     *\n     * If the aria region of a specified politeness does not exist, it will be created and can be re-used later.\n     *\n     * The default announcement politeness level is `'polite'`.\n     *\n     * ```ts\n     * // Most screen readers will queue announcements from multiple aria-live regions and read them out in the order they were emitted.\n     * editor.ui.ariaLiveAnnouncer.announce( 'Image uploaded.' );\n     * editor.ui.ariaLiveAnnouncer.announce( 'Connection lost. Reconnecting.' );\n     * ```\n     */\n    announce(announcement, attributes = AriaLiveAnnouncerPoliteness.POLITE) {\n        const editor = this.editor;\n        if (!editor.ui.view) {\n            return;\n        }\n        if (!this.view) {\n            this.view = new AriaLiveAnnouncerView(editor.locale);\n            editor.ui.view.body.add(this.view);\n        }\n        const { politeness, isUnsafeHTML } = typeof attributes === 'string' ? {\n            politeness: attributes\n        } : attributes;\n        let politenessRegionView = this.view.regionViews.find(view => view.politeness === politeness);\n        if (!politenessRegionView) {\n            politenessRegionView = new AriaLiveAnnouncerRegionView(editor, politeness);\n            this.view.regionViews.add(politenessRegionView);\n        }\n        politenessRegionView.announce({\n            announcement,\n            isUnsafeHTML\n        });\n    }\n}\n/**\n * The view that aggregates all `aria-live` regions.\n */\nexport class AriaLiveAnnouncerView extends View {\n    /**\n     * A collection of all views that represent individual `aria-live` regions.\n     */\n    regionViews;\n    constructor(locale) {\n        super(locale);\n        this.regionViews = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-aria-live-announcer'\n                ]\n            },\n            children: this.regionViews\n        });\n    }\n}\n/**\n * The view that represents a single `aria-live`.\n */\nexport class AriaLiveAnnouncerRegionView extends View {\n    /**\n     * Current politeness level of the region.\n     */\n    politeness;\n    /**\n     * DOM converter used to sanitize unsafe HTML passed to {@link #announce} method.\n     */\n    _domConverter;\n    /**\n     * Interval used to remove additions. It prevents accumulation of added nodes in region.\n     */\n    _pruneAnnouncementsInterval;\n    constructor(editor, politeness) {\n        super(editor.locale);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                'aria-live': politeness,\n                'aria-relevant': 'additions'\n            },\n            children: [\n                {\n                    tag: 'ul',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-aria-live-region-list'\n                        ]\n                    }\n                }\n            ]\n        });\n        editor.on('destroy', () => {\n            if (this._pruneAnnouncementsInterval !== null) {\n                clearInterval(this._pruneAnnouncementsInterval);\n                this._pruneAnnouncementsInterval = null;\n            }\n        });\n        this.politeness = politeness;\n        this._domConverter = editor.data.htmlProcessor.domConverter;\n        this._pruneAnnouncementsInterval = setInterval(() => {\n            if (this.element && this._listElement.firstChild) {\n                this._listElement.firstChild.remove();\n            }\n        }, 5000);\n    }\n    /**\n     * Appends new announcement to region.\n     */\n    announce({ announcement, isUnsafeHTML }) {\n        if (!announcement.trim().length) {\n            return;\n        }\n        const messageListItem = document.createElement('li');\n        if (isUnsafeHTML) {\n            this._domConverter.setContentOf(messageListItem, announcement);\n        }\n        else {\n            messageListItem.innerText = announcement;\n        }\n        this._listElement.appendChild(messageListItem);\n    }\n    /**\n     * Return current announcements list HTML element.\n     */\n    get _listElement() {\n        return this.element.querySelector('ul');\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/list/listitemview\n */\nimport { View } from '../view.js';\n/**\n * The list item view class.\n */\nexport class ListItemView extends View {\n    /**\n     * Collection of the child views inside of the list item {@link #element}.\n     */\n    children;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('isVisible', true);\n        this.children = this.createCollection();\n        this.setTemplate({\n            tag: 'li',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-list__item',\n                    bind.if('isVisible', 'ck-hidden', value => !value)\n                ],\n                role: 'presentation'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * Focuses the list item.\n     */\n    focus() {\n        if (this.children.first) {\n            this.children.first.focus();\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ListItemView } from '../list/listitemview.js';\nimport '../../theme/components/menubar/menubarmenulistitem.css';\n/**\n * A menu bar list item view, a child of {@link module:ui/menubar/menubarmenulistview~MenuBarMenuListView}.\n *\n * Populate this item with a {@link module:ui/menubar/menubarmenulistitembuttonview~MenuBarMenuListItemButtonView} instance\n * or a {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} instance to create a sub-menu.\n */\nexport class MenuBarMenuListItemView extends ListItemView {\n    /**\n     * Creates an instance of the list item view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale, parentMenuView) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-menu-bar__menu__item'\n                ]\n            },\n            on: {\n                'mouseenter': bind.to('mouseenter')\n            }\n        });\n        this.delegate('mouseenter').to(parentMenuView);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Handles clicking **outside** of a specified set of elements, then fires an action.\n *\n * **Note**: Actually, the action is executed upon `mousedown`, not `click`. It prevents\n * certain issues when the user keeps holding the mouse button and the UI cannot react\n * properly.\n *\n * @param options Configuration options.\n * @param options.emitter The emitter to which this behavior should be added.\n * @param options.activator Function returning a `Boolean`, to determine whether the handler is active.\n * @param options.contextElements Array of HTML elements or a callback returning an array of HTML elements\n * that determine the scope of the handler. Clicking any of them or their descendants will **not** fire the callback.\n * @param options.callback An action executed by the handler.\n * @param options.listenerOptions Additional options for the listener (like priority).\n */\nexport function clickOutsideHandler({ emitter, activator, callback, contextElements, listenerOptions }) {\n    emitter.listenTo(document, 'mousedown', (evt, domEvt) => {\n        if (!activator()) {\n            return;\n        }\n        // Check if `composedPath` is `undefined` in case the browser does not support native shadow DOM.\n        // Can be removed when all supported browsers support native shadow DOM.\n        const path = typeof domEvt.composedPath == 'function' ? domEvt.composedPath() : [];\n        const contextElementsList = typeof contextElements == 'function' ? contextElements() : contextElements;\n        for (const contextElement of contextElementsList) {\n            if (contextElement.contains(domEvt.target) || path.includes(contextElement)) {\n                return;\n            }\n        }\n        callback();\n    }, listenerOptions);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/menubar/utils\n */\nimport { MenuBarMenuListItemView } from './menubarmenulistitemview.js';\nimport { clickOutsideHandler } from '../bindings/clickoutsidehandler.js';\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\nimport { cloneDeep } from 'es-toolkit/compat';\nconst NESTED_PANEL_HORIZONTAL_OFFSET = 5;\n/**\n * Behaviors of the {@link module:ui/menubar/menubarview~MenuBarView} component.\n * @internal\n */\nexport const MenuBarBehaviors = {\n    /**\n     * When the bar is already open:\n     * * Opens the menu when the user hovers over its button.\n     * * Closes open menu when another menu's button gets hovered.\n     */\n    toggleMenusAndFocusItemsOnHover(menuBarView) {\n        menuBarView.on('menu:mouseenter', evt => {\n            // This behavior should be activated when one of condition is present:\n            // 1. The user opened any submenu of menubar and hover over items in the menu bar.\n            // 2. The user focused whole menubar using keyboard interaction and enabled focus borders and hover over items in the menu bar.\n            if (!menuBarView.isFocusBorderEnabled && !menuBarView.isOpen) {\n                return;\n            }\n            if (menuBarView.isOpen) {\n                for (const menuView of menuBarView.menus) {\n                    // @if CK_DEBUG_MENU_BAR // const wasOpen = menuView.isOpen;\n                    const pathLeaf = evt.path[0];\n                    const isListItemContainingMenu = pathLeaf instanceof MenuBarMenuListItemView && pathLeaf.children.first === menuView;\n                    menuView.isOpen = (evt.path.includes(menuView) || isListItemContainingMenu) && menuView.isEnabled;\n                    // @if CK_DEBUG_MENU_BAR // if ( wasOpen !== menuView.isOpen ) {\n                    // @if CK_DEBUG_MENU_BAR // console.log( '[BEHAVIOR] toggleMenusAndFocusItemsOnHover(): Toggle',\n                    // @if CK_DEBUG_MENU_BAR // \tlogMenu( menuView ), 'isOpen', menuView.isOpen\n                    // @if CK_DEBUG_MENU_BAR // );\n                    // @if CK_DEBUG_MENU_BAR // }\n                }\n            }\n            evt.source.focus();\n        });\n    },\n    /**\n     * Moves between top-level menus using the arrow left and right keys.\n     *\n     * If the menubar has already been open, the arrow keys move focus between top-level menu buttons and open them.\n     * If the menubar is closed, the arrow keys only move focus between top-level menu buttons.\n     */\n    focusCycleMenusOnArrows(menuBarView) {\n        const isContentRTL = menuBarView.locale.uiLanguageDirection === 'rtl';\n        menuBarView.on('menu:arrowright', evt => {\n            cycleTopLevelMenus(evt.source, isContentRTL ? -1 : 1);\n        });\n        menuBarView.on('menu:arrowleft', evt => {\n            cycleTopLevelMenus(evt.source, isContentRTL ? 1 : -1);\n        });\n        function cycleTopLevelMenus(currentMenuView, step) {\n            const currentIndex = menuBarView.children.getIndex(currentMenuView);\n            const isCurrentMenuViewOpen = currentMenuView.isOpen;\n            const menusCount = menuBarView.children.length;\n            const menuViewToOpen = menuBarView.children.get((currentIndex + menusCount + step) % menusCount);\n            currentMenuView.isOpen = false;\n            if (isCurrentMenuViewOpen) {\n                menuViewToOpen.isOpen = true;\n            }\n            menuViewToOpen.buttonView.focus();\n        }\n    },\n    /**\n     * Closes the entire sub-menu structure when the bar is closed. This prevents sub-menus from being open if the user\n     * closes the entire bar, and then re-opens some top-level menu.\n     */\n    closeMenusWhenTheBarCloses(menuBarView) {\n        menuBarView.on('change:isOpen', () => {\n            if (!menuBarView.isOpen) {\n                menuBarView.menus.forEach(menuView => {\n                    menuView.isOpen = false;\n                    // @if CK_DEBUG_MENU_BAR // console.log( '[BEHAVIOR] closeMenusWhenTheBarCloses(): Closing', logMenu( menuView ) );\n                });\n            }\n        });\n    },\n    /**\n     * Handles the following case:\n     * 1. Hover to open a sub-menu (A). The button has focus.\n     * 2. Press arrow up/down to move focus to another sub-menu (B) button.\n     * 3. Press arrow right to open the sub-menu (B).\n     * 4. The sub-menu (A) should close as it would with `toggleMenusAndFocusItemsOnHover()`.\n     */\n    closeMenuWhenAnotherOnTheSameLevelOpens(menuBarView) {\n        menuBarView.on('menu:change:isOpen', (evt, name, isOpen) => {\n            if (isOpen) {\n                menuBarView.menus\n                    .filter(menuView => {\n                    return evt.source.parentMenuView === menuView.parentMenuView &&\n                        evt.source !== menuView &&\n                        menuView.isOpen;\n                }).forEach(menuView => {\n                    menuView.isOpen = false;\n                    // @if CK_DEBUG_MENU_BAR // console.log( '[BEHAVIOR] closeMenuWhenAnotherOpens(): Closing', logMenu( menuView ) );\n                });\n            }\n        });\n    },\n    /**\n     * Closes the bar when the user clicked outside of it (page body, editor root, etc.).\n     */\n    closeOnClickOutside(menuBarView) {\n        clickOutsideHandler({\n            emitter: menuBarView,\n            activator: () => menuBarView.isOpen,\n            callback: () => menuBarView.close(),\n            contextElements: () => menuBarView.children.map(child => child.element)\n        });\n    },\n    /**\n     * Tracks the keyboard focus interaction on the menu bar view. It is used to determine if the nested items\n     * of the menu bar should render focus rings after first interaction with the keyboard.\n     */\n    enableFocusHighlightOnInteraction(menuBarView) {\n        let isKeyPressed = false;\n        menuBarView.on('change:isOpen', (_, evt, isOpen) => {\n            if (!isOpen) {\n                // Keep the focus border if the menu bar was closed by a keyboard interaction (Esc key).\n                // The user remains in the keyboard navigation mode and can traverse the main categories.\n                // See https://github.com/ckeditor/ckeditor5/issues/16719.\n                if (!isKeyPressed) {\n                    menuBarView.isFocusBorderEnabled = false;\n                }\n                // Reset the flag when the menu bar is closed, menu items tend to intercept `keyup` event\n                // and sometimes, after pressing `enter` on focused item, `isKeyPressed` stuck in `true` state.\n                isKeyPressed = false;\n            }\n        });\n        menuBarView.listenTo(menuBarView.element, 'keydown', () => {\n            isKeyPressed = true;\n        }, { useCapture: true });\n        menuBarView.listenTo(menuBarView.element, 'keyup', () => {\n            isKeyPressed = false;\n        }, { useCapture: true });\n        menuBarView.listenTo(menuBarView.element, 'focus', () => {\n            if (isKeyPressed) {\n                menuBarView.isFocusBorderEnabled = true;\n            }\n        }, { useCapture: true });\n    }\n};\n/**\n * Behaviors of the {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} component.\n * @internal\n */\nexport const MenuBarMenuBehaviors = {\n    /**\n     * If the button of the menu is focused, pressing the arrow down key should open the panel and focus it.\n     * This is analogous to the {@link module:ui/dropdown/dropdownview~DropdownView}.\n     */\n    openAndFocusPanelOnArrowDownKey(menuView) {\n        menuView.keystrokes.set('arrowdown', (data, cancel) => {\n            if (menuView.isEnabled && menuView.focusTracker.focusedElement === menuView.buttonView.element) {\n                if (!menuView.isOpen) {\n                    menuView.isOpen = true;\n                }\n                menuView.panelView.focus();\n                cancel();\n            }\n        });\n    },\n    /**\n     * Open the menu on the right arrow key press. This allows for navigating to sub-menus using the keyboard.\n     */\n    openOnArrowRightKey(menuView) {\n        const keystroke = menuView.locale.uiLanguageDirection === 'rtl' ? 'arrowleft' : 'arrowright';\n        menuView.keystrokes.set(keystroke, (data, cancel) => {\n            if (menuView.focusTracker.focusedElement !== menuView.buttonView.element || !menuView.isEnabled) {\n                return;\n            }\n            // @if CK_DEBUG_MENU_BAR // console.log( '[BEHAVIOR] openOnArrowRightKey(): Opening', logMenu( menuView ) );\n            if (!menuView.isOpen) {\n                menuView.isOpen = true;\n            }\n            menuView.panelView.focus();\n            cancel();\n        });\n    },\n    /**\n     * Opens the menu on its button click. Note that this behavior only opens but never closes the menu (unlike\n     * {@link module:ui/dropdown/dropdownview~DropdownView}).\n     */\n    openOnButtonClick(menuView) {\n        menuView.buttonView.on('execute', () => {\n            menuView.isOpen = true;\n        });\n    },\n    /**\n     * Toggles the menu on its button click. This behavior is analogous to {@link module:ui/dropdown/dropdownview~DropdownView}.\n     */\n    toggleOnButtonClick(menuView) {\n        menuView.buttonView.on('execute', () => {\n            menuView.isOpen = !menuView.isOpen;\n        });\n    },\n    /**\n     * Opens the menu and focuses the panel content upon pressing the Enter key.\n     */\n    openAndFocusOnEnterKeyPress(menuView) {\n        menuView.keystrokes.set('enter', (data, cancel) => {\n            // Engage only for Enter key press when the button is focused. The panel can contain\n            // other UI components and features that rely on the Enter key press.\n            if (menuView.focusTracker.focusedElement !== menuView.buttonView.element) {\n                return;\n            }\n            menuView.isOpen = true;\n            menuView.panelView.focus();\n            cancel();\n        });\n    },\n    /**\n     * Closes the menu on the right left key press. This allows for navigating to sub-menus using the keyboard.\n     */\n    closeOnArrowLeftKey(menuView) {\n        const keystroke = menuView.locale.uiLanguageDirection === 'rtl' ? 'arrowright' : 'arrowleft';\n        menuView.keystrokes.set(keystroke, (data, cancel) => {\n            if (menuView.isOpen) {\n                menuView.isOpen = false;\n                menuView.focus();\n                cancel();\n            }\n        });\n    },\n    /**\n     * Closes the menu on the esc key press. This allows for navigating to sub-menus using the keyboard.\n     */\n    closeOnEscKey(menuView) {\n        menuView.keystrokes.set('esc', (data, cancel) => {\n            if (menuView.isOpen) {\n                menuView.isOpen = false;\n                menuView.focus();\n                cancel();\n            }\n        });\n    },\n    /**\n     * Closes the menu when its parent menu also closed. This prevents from orphaned open menus when the parent menu re-opens.\n     */\n    closeOnParentClose(menuView) {\n        menuView.parentMenuView.on('change:isOpen', (evt, name, isOpen) => {\n            if (!isOpen && evt.source === menuView.parentMenuView) {\n                // @if CK_DEBUG_MENU_BAR // console.log( '[BEHAVIOR] closeOnParentClose(): Closing', logMenu( menuView ) );\n                menuView.isOpen = false;\n            }\n        });\n    }\n};\n// @if CK_DEBUG_MENU_BAR // function logMenu( menuView: MenuBarMenuView ) {\n// @if CK_DEBUG_MENU_BAR //\treturn `\"${ menuView.buttonView.label }\"`;\n// @if CK_DEBUG_MENU_BAR // }\n/**\n * Contains every positioning function used by {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} that decides where the\n * {@link module:ui/menubar/menubarmenuview~MenuBarMenuView#panelView} should be placed.\n *\n * Top-level menu positioning functions:\n *\n *\t┌──────┐\n *\t│      │\n *\t├──────┴────────┐\n *\t│               │\n *\t│               │\n *\t│               │\n *\t│            SE │\n *\t└───────────────┘\n *\n *\t         ┌──────┐\n *\t         │      │\n *\t┌────────┴──────┤\n *\t│               │\n *\t│               │\n *\t│               │\n *\t│ SW            │\n *\t└───────────────┘\n *\n *\t┌───────────────┐\n *\t│ NW            │\n *\t│               │\n *\t│               │\n *\t│               │\n *\t└────────┬──────┤\n *\t         │      │\n *\t         └──────┘\n *\n *\t┌───────────────┐\n *\t│            NE │\n *\t│               │\n *\t│               │\n *\t│               │\n *\t├──────┬────────┘\n *\t│      │\n *\t└──────┘\n *\n * Sub-menu positioning functions:\n *\n *\t┌──────┬───────────────┐\n *\t│      │               │\n *\t└──────┤               │\n *\t       │               │\n *\t       │            ES │\n *\t       └───────────────┘\n *\n *\t┌───────────────┬──────┐\n *\t│               │      │\n *\t│               ├──────┘\n *\t│               │\n *\t│ WS            │\n *\t└───────────────┘\n *\n *\t       ┌───────────────┐\n *\t       │            EN │\n *\t       │               │\n *\t┌──────┤               │\n *\t│      │               │\n *\t└──────┴───────────────┘\n *\n *\t┌───────────────┐\n *\t│ WN            │\n *\t│               │\n *\t│               ├──────┐\n *\t│               │      │\n *\t└───────────────┴──────┘\n */\n/**\n * @internal\n */\nexport const MenuBarMenuViewPanelPositioningFunctions = {\n    southEast: buttonRect => {\n        return {\n            top: buttonRect.bottom,\n            left: buttonRect.left,\n            name: 'se'\n        };\n    },\n    southWest: (buttonRect, panelRect) => {\n        return {\n            top: buttonRect.bottom,\n            left: buttonRect.left - panelRect.width + buttonRect.width,\n            name: 'sw'\n        };\n    },\n    northEast: (buttonRect, panelRect) => {\n        return {\n            top: buttonRect.top - panelRect.height,\n            left: buttonRect.left,\n            name: 'ne'\n        };\n    },\n    northWest: (buttonRect, panelRect) => {\n        return {\n            top: buttonRect.top - panelRect.height,\n            left: buttonRect.left - panelRect.width + buttonRect.width,\n            name: 'nw'\n        };\n    },\n    eastSouth: buttonRect => {\n        return {\n            top: buttonRect.top,\n            left: buttonRect.right - NESTED_PANEL_HORIZONTAL_OFFSET,\n            name: 'es'\n        };\n    },\n    eastNorth: (buttonRect, panelRect) => {\n        return {\n            top: buttonRect.top - panelRect.height,\n            left: buttonRect.right - NESTED_PANEL_HORIZONTAL_OFFSET,\n            name: 'en'\n        };\n    },\n    westSouth: (buttonRect, panelRect) => {\n        return {\n            top: buttonRect.top,\n            left: buttonRect.left - panelRect.width + NESTED_PANEL_HORIZONTAL_OFFSET,\n            name: 'ws'\n        };\n    },\n    westNorth: (buttonRect, panelRect) => {\n        return {\n            top: buttonRect.top - panelRect.height,\n            left: buttonRect.left - panelRect.width + NESTED_PANEL_HORIZONTAL_OFFSET,\n            name: 'wn'\n        };\n    }\n};\n/**\n * The default items {@link module:core/editor/editorconfig~EditorConfig#menuBar configuration} of the\n * {@link module:ui/menubar/menubarview~MenuBarView} component. It contains names of all menu bar components\n * registered in the {@link module:ui/componentfactory~ComponentFactory component factory} (available in the project).\n *\n * **Note**: Menu bar component names provided by core editor features are prefixed with `menuBar:` in order to distinguish\n * them from components referenced by the {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar configuration}, for instance,\n * `'menuBar:bold'` is a menu bar button but `'bold'` is a toolbar button.\n *\n * Below is the preset menu bar structure (the default value of `config.menuBar.items` property):\n *\n * ```ts\n * [\n * \t{\n * \t\tmenuId: 'file',\n * \t\tlabel: 'File',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'export',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:exportPdf',\n * \t\t\t\t\t'menuBar:exportWord'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'import',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:importWord'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'revisionHistory',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:revisionHistory'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tmenuId: 'edit',\n * \t\tlabel: 'Edit',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'undo',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:undo',\n * \t\t\t\t\t'menuBar:redo'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'selectAll',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:selectAll'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'findAndReplace',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:findAndReplace'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tmenuId: 'view',\n * \t\tlabel: 'View',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'sourceEditingEnhanced',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:sourceEditingEnhanced'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'sourceEditing',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:sourceEditing'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'showBlocks',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:showBlocks'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'previewMergeFields',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:previewMergeFields'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'fullscreen',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:fullscreen'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'restrictedEditingException',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:restrictedEditingException'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tmenuId: 'insert',\n * \t\tlabel: 'Insert',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'insertMainWidgets',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:insertImage',\n * \t\t\t\t\t'menuBar:ckbox',\n * \t\t\t\t\t'menuBar:ckfinder',\n * \t\t\t\t\t'menuBar:insertTable'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'insertInline',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:link',\n * \t\t\t\t\t'menuBar:insertFootnote',\n * \t\t\t\t\t'menuBar:bookmark',\n * \t\t\t\t\t'menuBar:comment',\n * \t\t\t\t\t'menuBar:insertMergeField',\n * \t\t\t\t\t'menuBar:emoji'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'insertMinorWidgets',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:mediaEmbed',\n * \t\t\t\t\t'menuBar:insertTemplate',\n * \t\t\t\t\t'menuBar:blockQuote',\n * \t\t\t\t\t'menuBar:codeBlock',\n * \t\t\t\t\t'menuBar:htmlEmbed'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'insertStructureWidgets',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:horizontalLine',\n * \t\t\t\t\t'menuBar:pageBreak',\n * \t\t\t\t\t'menuBar:tableOfContents'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'restrictedEditing',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:restrictedEditing'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tmenuId: 'format',\n * \t\tlabel: 'Format',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'textAndFont',\n * \t\t\t\titems: [\n * \t\t\t\t\t{\n * \t\t\t\t\t\tmenuId: 'text',\n * \t\t\t\t\t\tlabel: 'Text',\n * \t\t\t\t\t\tgroups: [\n * \t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\tgroupId: 'basicStyles',\n * \t\t\t\t\t\t\t\titems: [\n * \t\t\t\t\t\t\t\t\t'menuBar:bold',\n * \t\t\t\t\t\t\t\t\t'menuBar:italic',\n * \t\t\t\t\t\t\t\t\t'menuBar:underline',\n * \t\t\t\t\t\t\t\t\t'menuBar:strikethrough',\n * \t\t\t\t\t\t\t\t\t'menuBar:superscript',\n * \t\t\t\t\t\t\t\t\t'menuBar:subscript',\n * \t\t\t\t\t\t\t\t\t'menuBar:code'\n * \t\t\t\t\t\t\t\t]\n * \t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\tgroupId: 'textPartLanguage',\n * \t\t\t\t\t\t\t\titems: [\n * \t\t\t\t\t\t\t\t\t'menuBar:textPartLanguage'\n * \t\t\t\t\t\t\t\t]\n * \t\t\t\t\t\t\t}\n * \t\t\t\t\t\t]\n * \t\t\t\t\t},\n * \t\t\t\t\t{\n * \t\t\t\t\t\tmenuId: 'font',\n * \t\t\t\t\t\tlabel: 'Font',\n * \t\t\t\t\t\tgroups: [\n * \t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\tgroupId: 'fontProperties',\n * \t\t\t\t\t\t\t\titems: [\n * \t\t\t\t\t\t\t\t\t'menuBar:fontSize',\n * \t\t\t\t\t\t\t\t\t'menuBar:fontFamily'\n * \t\t\t\t\t\t\t\t]\n * \t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\tgroupId: 'fontColors',\n * \t\t\t\t\t\t\t\titems: [\n * \t\t\t\t\t\t\t\t\t'menuBar:fontColor',\n * \t\t\t\t\t\t\t\t\t'menuBar:fontBackgroundColor'\n * \t\t\t\t\t\t\t\t]\n * \t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\tgroupId: 'highlight',\n * \t\t\t\t\t\t\t\titems: [\n * \t\t\t\t\t\t\t\t\t'menuBar:highlight'\n * \t\t\t\t\t\t\t\t]\n * \t\t\t\t\t\t\t}\n * \t\t\t\t\t\t]\n * \t\t\t\t\t},\n * \t\t\t\t\t'menuBar:heading'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'list',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:bulletedList',\n * \t\t\t\t\t'menuBar:numberedList',\n * \t\t\t\t\t'menuBar:multiLevelList',\n * \t\t\t\t\t'menuBar:todoList'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'indent',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:alignment',\n * \t\t\t\t\t'menuBar:lineHeight',\n * \t\t\t\t\t'menuBar:indent',\n * \t\t\t\t\t'menuBar:outdent'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'caseChange',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:caseChange'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'removeFormat',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:removeFormat'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tmenuId: 'tools',\n * \t\tlabel: 'Tools',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'aiTools',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:aiAssistant',\n * \t\t\t\t\t'menuBar:aiCommands',\n * \t\t\t\t\t'menuBar:toggleAi',\n * \t\t\t\t\t'menuBar:aiQuickActions'\n * \t\t\t\t]\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tgroupId: 'tools',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:trackChanges',\n * \t\t\t\t\t'menuBar:commentsArchive'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tmenuId: 'help',\n * \t\tlabel: 'Help',\n * \t\tgroups: [\n * \t\t\t{\n * \t\t\t\tgroupId: 'help',\n * \t\t\t\titems: [\n * \t\t\t\t\t'menuBar:accessibilityHelp'\n * \t\t\t\t]\n * \t\t\t}\n * \t\t]\n * \t}\n * ];\n * ```\n *\n * The menu bar can be customized using the `config.menuBar.removeItems` and `config.menuBar.addItems` properties.\n */\n// **NOTE: Whenever you make changes to this value, reflect it in the documentation above!**\nexport const DefaultMenuBarItems = [\n    {\n        menuId: 'file',\n        label: 'File',\n        groups: [\n            {\n                groupId: 'export',\n                items: [\n                    'menuBar:exportPdf',\n                    'menuBar:exportWord'\n                ]\n            },\n            {\n                groupId: 'import',\n                items: [\n                    'menuBar:importWord'\n                ]\n            },\n            {\n                groupId: 'revisionHistory',\n                items: [\n                    'menuBar:revisionHistory'\n                ]\n            }\n        ]\n    },\n    {\n        menuId: 'edit',\n        label: 'Edit',\n        groups: [\n            {\n                groupId: 'undo',\n                items: [\n                    'menuBar:undo',\n                    'menuBar:redo'\n                ]\n            },\n            {\n                groupId: 'selectAll',\n                items: [\n                    'menuBar:selectAll'\n                ]\n            },\n            {\n                groupId: 'findAndReplace',\n                items: [\n                    'menuBar:findAndReplace'\n                ]\n            }\n        ]\n    },\n    {\n        menuId: 'view',\n        label: 'View',\n        groups: [\n            {\n                groupId: 'sourceEditingEnhanced',\n                items: [\n                    'menuBar:sourceEditingEnhanced'\n                ]\n            },\n            {\n                groupId: 'sourceEditing',\n                items: [\n                    'menuBar:sourceEditing'\n                ]\n            },\n            {\n                groupId: 'showBlocks',\n                items: [\n                    'menuBar:showBlocks'\n                ]\n            },\n            {\n                groupId: 'previewMergeFields',\n                items: [\n                    'menuBar:previewMergeFields'\n                ]\n            },\n            {\n                groupId: 'fullscreen',\n                items: [\n                    'menuBar:fullscreen'\n                ]\n            },\n            {\n                groupId: 'restrictedEditing',\n                items: [\n                    'menuBar:restrictedEditing'\n                ]\n            }\n        ]\n    },\n    {\n        menuId: 'insert',\n        label: 'Insert',\n        groups: [\n            {\n                groupId: 'insertMainWidgets',\n                items: [\n                    'menuBar:insertImage',\n                    'menuBar:ckbox',\n                    'menuBar:ckfinder',\n                    'menuBar:insertTable',\n                    'menuBar:insertTableLayout'\n                ]\n            },\n            {\n                groupId: 'insertInline',\n                items: [\n                    'menuBar:link',\n                    'menuBar:insertFootnote',\n                    'menuBar:bookmark',\n                    'menuBar:comment',\n                    'menuBar:insertMergeField',\n                    'menuBar:emoji'\n                ]\n            },\n            {\n                groupId: 'insertMinorWidgets',\n                items: [\n                    'menuBar:mediaEmbed',\n                    'menuBar:insertTemplate',\n                    'menuBar:specialCharacters',\n                    'menuBar:blockQuote',\n                    'menuBar:codeBlock',\n                    'menuBar:htmlEmbed'\n                ]\n            },\n            {\n                groupId: 'insertStructureWidgets',\n                items: [\n                    'menuBar:horizontalLine',\n                    'menuBar:pageBreak',\n                    'menuBar:tableOfContents'\n                ]\n            },\n            {\n                groupId: 'restrictedEditingException',\n                items: [\n                    'menuBar:restrictedEditingException:inline',\n                    'menuBar:restrictedEditingException:block'\n                ]\n            }\n        ]\n    },\n    {\n        menuId: 'format',\n        label: 'Format',\n        groups: [\n            {\n                groupId: 'textAndFont',\n                items: [\n                    {\n                        menuId: 'text',\n                        label: 'Text',\n                        groups: [\n                            {\n                                groupId: 'basicStyles',\n                                items: [\n                                    'menuBar:bold',\n                                    'menuBar:italic',\n                                    'menuBar:underline',\n                                    'menuBar:strikethrough',\n                                    'menuBar:superscript',\n                                    'menuBar:subscript',\n                                    'menuBar:code'\n                                ]\n                            },\n                            {\n                                groupId: 'textPartLanguage',\n                                items: [\n                                    'menuBar:textPartLanguage'\n                                ]\n                            }\n                        ]\n                    },\n                    {\n                        menuId: 'font',\n                        label: 'Font',\n                        groups: [\n                            {\n                                groupId: 'fontProperties',\n                                items: [\n                                    'menuBar:fontSize',\n                                    'menuBar:fontFamily'\n                                ]\n                            },\n                            {\n                                groupId: 'fontColors',\n                                items: [\n                                    'menuBar:fontColor',\n                                    'menuBar:fontBackgroundColor'\n                                ]\n                            },\n                            {\n                                groupId: 'highlight',\n                                items: [\n                                    'menuBar:highlight'\n                                ]\n                            }\n                        ]\n                    },\n                    'menuBar:heading'\n                ]\n            },\n            {\n                groupId: 'list',\n                items: [\n                    'menuBar:bulletedList',\n                    'menuBar:numberedList',\n                    'menuBar:multiLevelList',\n                    'menuBar:todoList'\n                ]\n            },\n            {\n                groupId: 'indent',\n                items: [\n                    'menuBar:alignment',\n                    'menuBar:lineHeight',\n                    'menuBar:indent',\n                    'menuBar:outdent'\n                ]\n            },\n            {\n                groupId: 'caseChange',\n                items: [\n                    'menuBar:caseChange'\n                ]\n            },\n            {\n                groupId: 'removeFormat',\n                items: [\n                    'menuBar:removeFormat'\n                ]\n            }\n        ]\n    },\n    {\n        menuId: 'tools',\n        label: 'Tools',\n        groups: [\n            {\n                groupId: 'aiTools',\n                items: [\n                    'menuBar:aiAssistant',\n                    'menuBar:aiCommands',\n                    'menuBar:toggleAi',\n                    'menuBar:aiQuickActions'\n                ]\n            },\n            {\n                groupId: 'tools',\n                items: [\n                    'menuBar:trackChanges',\n                    'menuBar:commentsArchive'\n                ]\n            }\n        ]\n    },\n    {\n        menuId: 'help',\n        label: 'Help',\n        groups: [\n            {\n                groupId: 'help',\n                items: [\n                    'menuBar:accessibilityHelp'\n                ]\n            }\n        ]\n    }\n];\n/**\n * Performs a cleanup and normalization of the menu bar configuration.\n */\nexport function normalizeMenuBarConfig(config) {\n    let configObject;\n    // The integrator specified the config as an object but without items. Let's give them defaults but respect their\n    // additions and removals.\n    if (!('items' in config) || !config.items) {\n        configObject = {\n            items: cloneDeep(DefaultMenuBarItems),\n            addItems: [],\n            removeItems: [],\n            isVisible: true,\n            isUsingDefaultConfig: true,\n            ...config\n        };\n    }\n    // The integrator specified the config as an object and there are items there. Let's take it as it is.\n    else {\n        configObject = {\n            items: config.items,\n            removeItems: [],\n            addItems: [],\n            isVisible: true,\n            isUsingDefaultConfig: false,\n            ...config\n        };\n    }\n    return configObject;\n}\n/**\n * Processes a normalized menu bar config and returns a config clone with the following modifications:\n *\n * * Removed components that are not available in the component factory,\n * * Removed obsolete separators,\n * * Purged empty menus,\n * * Localized top-level menu labels.\n * @internal\n */\nexport function processMenuBarConfig({ normalizedConfig, locale, componentFactory, extraItems }) {\n    const configClone = cloneDeep(normalizedConfig);\n    handleAdditions(normalizedConfig, configClone, extraItems);\n    handleRemovals(normalizedConfig, configClone);\n    handleAdditions(normalizedConfig, configClone, configClone.addItems);\n    purgeUnavailableComponents(normalizedConfig, configClone, componentFactory);\n    purgeEmptyMenus(normalizedConfig, configClone);\n    localizeMenuLabels(configClone, locale);\n    return configClone;\n}\n/**\n * Removes items from the menu bar config based on user `removeItems` configuration. Users can remove\n * individual items, groups, or entire menus. For each removed item, a warning is logged if the item\n * was not found in the configuration.\n */\nfunction handleRemovals(originalConfig, config) {\n    const itemsToBeRemoved = config.removeItems;\n    const successfullyRemovedItems = [];\n    // Remove top-level menus.\n    config.items = config.items.filter(({ menuId }) => {\n        if (itemsToBeRemoved.includes(menuId)) {\n            successfullyRemovedItems.push(menuId);\n            return false;\n        }\n        return true;\n    });\n    walkConfigMenus(config.items, menuDefinition => {\n        // Remove groups from menus.\n        menuDefinition.groups = menuDefinition.groups.filter(({ groupId }) => {\n            if (itemsToBeRemoved.includes(groupId)) {\n                successfullyRemovedItems.push(groupId);\n                return false;\n            }\n            return true;\n        });\n        // Remove sub-menus and items from groups.\n        for (const groupDefinition of menuDefinition.groups) {\n            groupDefinition.items = groupDefinition.items.filter(item => {\n                const itemId = getIdFromGroupItem(item);\n                if (itemsToBeRemoved.includes(itemId)) {\n                    successfullyRemovedItems.push(itemId);\n                    return false;\n                }\n                return true;\n            });\n        }\n    });\n    for (const itemName of itemsToBeRemoved) {\n        if (!successfullyRemovedItems.includes(itemName)) {\n            /**\n             * There was a problem processing the configuration of the menu bar. The item with the given\n             * name does could not be removed from the menu bar configuration.\n             *\n             * This warning usually shows up when the {@link module:core/plugin~Plugin} which is supposed\n             * to provide a menu bar item has not been loaded or there is a typo in the\n             * {@link module:core/editor/editorconfig~EditorConfig#menuBar menu bar configuration}.\n             *\n             * @error menu-bar-item-could-not-be-removed\n             * @param menuBarConfig The full configuration of the menu bar.\n             * @param itemName The name of the item that was not removed from the menu bar.\n             */\n            logWarning('menu-bar-item-could-not-be-removed', {\n                menuBarConfig: originalConfig,\n                itemName\n            });\n        }\n    }\n}\n/**\n * Adds provided items to config. It allows for adding menus, groups, and items at arbitrary\n * positions in the menu bar. If the position does not exist, a warning is logged.\n */\nfunction handleAdditions(originalConfig, config, items) {\n    const successFullyAddedItems = [];\n    if (items.length == 0) {\n        return;\n    }\n    for (const itemToAdd of items) {\n        const relation = getRelationFromPosition(itemToAdd.position);\n        const relativeId = getRelativeIdFromPosition(itemToAdd.position);\n        // Adding a menu.\n        if (isMenuBarMenuAddition(itemToAdd)) {\n            if (!relativeId) {\n                // Adding a top-level menu at the beginning of the menu bar.\n                if (relation === 'start') {\n                    config.items.unshift(itemToAdd.menu);\n                    successFullyAddedItems.push(itemToAdd);\n                }\n                // Adding a top-level menu at the end of the menu bar.\n                else if (relation === 'end') {\n                    config.items.push(itemToAdd.menu);\n                    successFullyAddedItems.push(itemToAdd);\n                }\n            }\n            else {\n                const topLevelMenuDefinitionIndex = config.items.findIndex(menuDefinition => menuDefinition.menuId === relativeId);\n                // Adding a top-level menu somewhere between existing menu bar menus.\n                if (topLevelMenuDefinitionIndex != -1) {\n                    if (relation === 'before') {\n                        config.items.splice(topLevelMenuDefinitionIndex, 0, itemToAdd.menu);\n                        successFullyAddedItems.push(itemToAdd);\n                    }\n                    else if (relation === 'after') {\n                        config.items.splice(topLevelMenuDefinitionIndex + 1, 0, itemToAdd.menu);\n                        successFullyAddedItems.push(itemToAdd);\n                    }\n                }\n                // Adding a sub-menu to an existing items group.\n                else {\n                    const wasAdded = addMenuOrItemToGroup(config, itemToAdd.menu, relativeId, relation);\n                    if (wasAdded) {\n                        successFullyAddedItems.push(itemToAdd);\n                    }\n                }\n            }\n        }\n        // Adding a group.\n        else if (isMenuBarMenuGroupAddition(itemToAdd)) {\n            walkConfigMenus(config.items, menuDefinition => {\n                if (menuDefinition.menuId === relativeId) {\n                    // Add a group at the start of a menu.\n                    if (relation === 'start') {\n                        menuDefinition.groups.unshift(itemToAdd.group);\n                        successFullyAddedItems.push(itemToAdd);\n                    }\n                    // Add a group at the end of a menu.\n                    else if (relation === 'end') {\n                        menuDefinition.groups.push(itemToAdd.group);\n                        successFullyAddedItems.push(itemToAdd);\n                    }\n                }\n                else {\n                    const relativeGroupIndex = menuDefinition.groups.findIndex(group => group.groupId === relativeId);\n                    if (relativeGroupIndex !== -1) {\n                        // Add a group before an existing group in a menu.\n                        if (relation === 'before') {\n                            menuDefinition.groups.splice(relativeGroupIndex, 0, itemToAdd.group);\n                            successFullyAddedItems.push(itemToAdd);\n                        }\n                        // Add a group after an existing group in a menu.\n                        else if (relation === 'after') {\n                            menuDefinition.groups.splice(relativeGroupIndex + 1, 0, itemToAdd.group);\n                            successFullyAddedItems.push(itemToAdd);\n                        }\n                    }\n                }\n            });\n        }\n        // Adding an item to an existing items group.\n        else {\n            const wasAdded = addMenuOrItemToGroup(config, itemToAdd.item, relativeId, relation);\n            if (wasAdded) {\n                successFullyAddedItems.push(itemToAdd);\n            }\n        }\n    }\n    for (const addedItemConfig of items) {\n        if (!successFullyAddedItems.includes(addedItemConfig)) {\n            /**\n             * There was a problem processing the configuration of the menu bar. The configured item could not be added\n             * because the position it was supposed to be added to does not exist.\n             *\n             * This warning usually shows up when the {@link module:core/plugin~Plugin} which is supposed\n             * to provide a menu bar item has not been loaded or there is a typo in the\n             * {@link module:core/editor/editorconfig~EditorConfig#menuBar menu bar configuration}.\n             *\n             * @error menu-bar-item-could-not-be-removed\n             * @param {object} menuBarConfig The full configuration of the menu bar.\n             * @param {object} addedItemConfig The name of the item that was not removed from the menu bar.\n             */\n            logWarning('menu-bar-item-could-not-be-added', {\n                menuBarConfig: originalConfig,\n                addedItemConfig\n            });\n        }\n    }\n}\n/**\n * Handles adding a sub-menu or an item into a group. The logic is the same for both cases.\n */\nfunction addMenuOrItemToGroup(config, itemOrMenuToAdd, relativeId, relation) {\n    let wasAdded = false;\n    walkConfigMenus(config.items, menuDefinition => {\n        for (const { groupId, items: groupItems } of menuDefinition.groups) {\n            // Avoid infinite loops.\n            if (wasAdded) {\n                return;\n            }\n            if (groupId === relativeId) {\n                // Adding an item/menu at the beginning of a group.\n                if (relation === 'start') {\n                    groupItems.unshift(itemOrMenuToAdd);\n                    wasAdded = true;\n                }\n                // Adding an item/menu at the end of a group.\n                else if (relation === 'end') {\n                    groupItems.push(itemOrMenuToAdd);\n                    wasAdded = true;\n                }\n            }\n            else {\n                // Adding an item/menu relative to an existing item/menu.\n                const relativeItemIndex = groupItems.findIndex(groupItem => {\n                    return getIdFromGroupItem(groupItem) === relativeId;\n                });\n                if (relativeItemIndex !== -1) {\n                    if (relation === 'before') {\n                        groupItems.splice(relativeItemIndex, 0, itemOrMenuToAdd);\n                        wasAdded = true;\n                    }\n                    else if (relation === 'after') {\n                        groupItems.splice(relativeItemIndex + 1, 0, itemOrMenuToAdd);\n                        wasAdded = true;\n                    }\n                }\n            }\n        }\n    });\n    return wasAdded;\n}\n/**\n * Removes components from the menu bar configuration that are not available in the factory and would\n * not be instantiated. Warns about missing components if the menu bar configuration was specified by the user.\n */\nfunction purgeUnavailableComponents(originalConfig, config, componentFactory) {\n    walkConfigMenus(config.items, menuDefinition => {\n        for (const groupDefinition of menuDefinition.groups) {\n            groupDefinition.items = groupDefinition.items.filter(item => {\n                const isItemUnavailable = typeof item === 'string' && !componentFactory.has(item);\n                // The default configuration contains all possible editor features. But integrators' editors rarely load\n                // every possible feature. This is why we do not want to log warnings about unavailable items for the default config\n                // because they would show up in almost every integration. If the configuration has been provided by\n                // the integrator, on the other hand, then these warnings bring value.\n                if (isItemUnavailable && !config.isUsingDefaultConfig) {\n                    /**\n                     * There was a problem processing the configuration of the menu bar. The item with the given\n                     * name does not exist so it was omitted when rendering the menu bar.\n                     *\n                     * This warning usually shows up when the {@link module:core/plugin~Plugin} which is supposed\n                     * to provide a menu bar item has not been loaded or there is a typo in the\n                     * {@link module:core/editor/editorconfig~EditorConfig#menuBar menu bar configuration}.\n                     *\n                     * Make sure the plugin responsible for this menu bar item is loaded and the menu bar configuration\n                     * is correct, e.g. {@link module:basic-styles/bold/boldui~BoldUI} is loaded for the `'menuBar:bold'`\n                     * menu bar item.\n                     *\n                     * @error menu-bar-item-unavailable\n                     * @param {object} menuBarConfig The full configuration of the menu bar.\n                     * @param {object} parentMenuConfig The config of the menu the unavailable component was defined in.\n                     * @param {string} componentName The name of the unavailable component.\n                     */\n                    logWarning('menu-bar-item-unavailable', {\n                        menuBarConfig: originalConfig,\n                        parentMenuConfig: cloneDeep(menuDefinition),\n                        componentName: item\n                    });\n                }\n                return !isItemUnavailable;\n            });\n        }\n    });\n}\n/**\n * Removes empty menus from the menu bar configuration to improve the visual UX. Such menus can occur\n * when some plugins responsible for providing menu bar items have not been loaded and some part of\n * the configuration populated menus using these components exclusively.\n */\nfunction purgeEmptyMenus(originalConfig, config) {\n    const isUsingDefaultConfig = config.isUsingDefaultConfig;\n    let wasSubMenuPurged = false;\n    // Purge top-level menus.\n    config.items = config.items.filter(menuDefinition => {\n        if (!menuDefinition.groups.length) {\n            warnAboutEmptyMenu(originalConfig, menuDefinition, isUsingDefaultConfig);\n            return false;\n        }\n        return true;\n    });\n    // Warn if there were no top-level menus left in the menu bar after purging.\n    if (!config.items.length) {\n        warnAboutEmptyMenu(originalConfig, originalConfig, isUsingDefaultConfig);\n        return;\n    }\n    // Purge sub-menus and groups.\n    walkConfigMenus(config.items, menuDefinition => {\n        // Get rid of empty groups.\n        menuDefinition.groups = menuDefinition.groups.filter(groupDefinition => {\n            if (!groupDefinition.items.length) {\n                wasSubMenuPurged = true;\n                return false;\n            }\n            return true;\n        });\n        // Get rid of empty sub-menus.\n        for (const groupDefinition of menuDefinition.groups) {\n            groupDefinition.items = groupDefinition.items.filter(item => {\n                // If no groups were left after removing empty ones.\n                if (isMenuDefinition(item) && !item.groups.length) {\n                    warnAboutEmptyMenu(originalConfig, item, isUsingDefaultConfig);\n                    wasSubMenuPurged = true;\n                    return false;\n                }\n                return true;\n            });\n        }\n    });\n    if (wasSubMenuPurged) {\n        // The config is walked from the root to the leaves so if anything gets removed, we need to re-run the\n        // whole process because it could've affected parents.\n        purgeEmptyMenus(originalConfig, config);\n    }\n}\nfunction warnAboutEmptyMenu(originalConfig, emptyMenuConfig, isUsingDefaultConfig) {\n    if (isUsingDefaultConfig) {\n        return;\n    }\n    /**\n     * There was a problem processing the configuration of the menu bar. One of the menus\n     * is empty so it was omitted when rendering the menu bar.\n     *\n     * This warning usually shows up when some {@link module:core/plugin~Plugin plugins} responsible for\n     * providing menu bar items have not been loaded and the\n     * {@link module:core/editor/editorconfig~EditorConfig#menuBar menu bar configuration} was not updated.\n     *\n     * Make sure all necessary editor plugins are loaded and/or update the menu bar configuration\n     * to account for the missing menu items.\n     *\n     * @error menu-bar-menu-empty\n     * @param {object} menuBarConfig The full configuration of the menu bar.\n     * @param {object} emptyMenuConfig The definition of the menu that has no child items.\n     */\n    logWarning('menu-bar-menu-empty', {\n        menuBarConfig: originalConfig,\n        emptyMenuConfig\n    });\n}\n/**\n * Localizes the user-config using pre-defined localized category labels.\n */\nfunction localizeMenuLabels(config, locale) {\n    const t = locale.t;\n    const localizedCategoryLabels = {\n        // Top-level categories.\n        'File': t({\n            string: 'File',\n            id: 'MENU_BAR_MENU_FILE'\n        }),\n        'Edit': t({\n            string: 'Edit',\n            id: 'MENU_BAR_MENU_EDIT'\n        }),\n        'View': t({\n            string: 'View',\n            id: 'MENU_BAR_MENU_VIEW'\n        }),\n        'Insert': t({\n            string: 'Insert',\n            id: 'MENU_BAR_MENU_INSERT'\n        }),\n        'Format': t({\n            string: 'Format',\n            id: 'MENU_BAR_MENU_FORMAT'\n        }),\n        'Tools': t({\n            string: 'Tools',\n            id: 'MENU_BAR_MENU_TOOLS'\n        }),\n        'Help': t({\n            string: 'Help',\n            id: 'MENU_BAR_MENU_HELP'\n        }),\n        // Sub-menus.\n        'Text': t({\n            string: 'Text',\n            id: 'MENU_BAR_MENU_TEXT'\n        }),\n        'Font': t({\n            string: 'Font',\n            id: 'MENU_BAR_MENU_FONT'\n        })\n    };\n    walkConfigMenus(config.items, definition => {\n        if (definition.label in localizedCategoryLabels) {\n            definition.label = localizedCategoryLabels[definition.label];\n        }\n    });\n}\n/**\n * Recursively visits all menu definitions in the config and calls the callback for each of them.\n */\nfunction walkConfigMenus(definition, callback) {\n    if (Array.isArray(definition)) {\n        for (const topLevelMenuDefinition of definition) {\n            walk(topLevelMenuDefinition);\n        }\n    }\n    function walk(menuDefinition) {\n        callback(menuDefinition);\n        for (const groupDefinition of menuDefinition.groups) {\n            for (const groupItem of groupDefinition.items) {\n                if (isMenuDefinition(groupItem)) {\n                    walk(groupItem);\n                }\n            }\n        }\n    }\n}\nfunction isMenuBarMenuAddition(definition) {\n    return typeof definition === 'object' && 'menu' in definition;\n}\nfunction isMenuBarMenuGroupAddition(definition) {\n    return typeof definition === 'object' && 'group' in definition;\n}\nfunction getRelationFromPosition(position) {\n    if (position.startsWith('start')) {\n        return 'start';\n    }\n    else if (position.startsWith('end')) {\n        return 'end';\n    }\n    else if (position.startsWith('after')) {\n        return 'after';\n    }\n    else {\n        return 'before';\n    }\n}\nfunction getRelativeIdFromPosition(position) {\n    const match = position.match(/^[^:]+:(.+)/);\n    if (match) {\n        return match[1];\n    }\n    return null;\n}\nfunction getIdFromGroupItem(item) {\n    return typeof item === 'string' ? item : item.menuId;\n}\nfunction isMenuDefinition(definition) {\n    return typeof definition === 'object' && 'menuId' in definition;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/editorui\n */\nimport { ComponentFactory } from '../componentfactory.js';\nimport { TooltipManager } from '../tooltipmanager.js';\nimport { PoweredBy } from './poweredby.js';\nimport { EvaluationBadge } from './evaluationbadge.js';\nimport { AriaLiveAnnouncer } from '../arialiveannouncer.js';\nimport { ObservableMixin, DomEmitterMixin, global, isVisible, FocusTracker, getVisualViewportOffset } from '@ckeditor/ckeditor5-utils';\nimport { normalizeMenuBarConfig } from '../menubar/utils.js';\n/**\n * A class providing the minimal interface that is required to successfully bootstrap any editor UI.\n */\nexport class EditorUI extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * The editor that the UI belongs to.\n     */\n    editor;\n    /**\n     * An instance of the {@link module:ui/componentfactory~ComponentFactory}, a registry used by plugins\n     * to register factories of specific UI components.\n     */\n    componentFactory;\n    /**\n     * Stores the information about the editor UI focus and propagates it so various plugins and components\n     * are unified as a focus group.\n     */\n    focusTracker;\n    /**\n     * Manages the tooltips displayed on mouseover and focus across the UI.\n     */\n    tooltipManager;\n    /**\n     * A helper that enables the \"powered by\" feature in the editor and renders a link to the project's webpage.\n     */\n    poweredBy;\n    /**\n     * A helper that enables the \"evaluation badge\" feature in the editor.\n     */\n    evaluationBadge;\n    /**\n     * A helper that manages the content of an `aria-live` regions used by editor features to announce status changes\n     * to screen readers.\n     */\n    ariaLiveAnnouncer;\n    /**\n     * Indicates the UI is ready. Set `true` after {@link #event:ready} event is fired.\n     *\n     * @readonly\n     * @default false\n     */\n    isReady = false;\n    /**\n     * Stores all editable elements used by the editor instance.\n     */\n    _editableElementsMap = new Map();\n    /**\n     * All available & focusable toolbars.\n     */\n    _focusableToolbarDefinitions = [];\n    /**\n     * All additional menu bar items, groups or menus that have their default location defined.\n     */\n    _extraMenuBarElements = [];\n    /**\n     * The last focused element to which focus should return on `Esc` press.\n     */\n    _lastFocusedForeignElement = null;\n    /**\n     * The DOM emitter instance used for visual viewport watching.\n     */\n    _domEmitter;\n    /**\n     * Creates an instance of the editor UI class.\n     *\n     * @param editor The editor instance.\n     */\n    constructor(editor) {\n        super();\n        const editingView = editor.editing.view;\n        this.editor = editor;\n        this.componentFactory = new ComponentFactory(editor);\n        this.focusTracker = new FocusTracker();\n        this.tooltipManager = new TooltipManager(editor);\n        this.poweredBy = new PoweredBy(editor);\n        this.evaluationBadge = new EvaluationBadge(editor);\n        this.ariaLiveAnnouncer = new AriaLiveAnnouncer(editor);\n        this._initViewportOffset(this._readViewportOffsetFromConfig());\n        this.once('ready', () => {\n            this._bindBodyCollectionWithFocusTracker();\n            this.isReady = true;\n        });\n        // Informs UI components that should be refreshed after layout change.\n        this.listenTo(editingView.document, 'layoutChanged', this.update.bind(this));\n        this.listenTo(editingView, 'scrollToTheSelection', this._handleScrollToTheSelection.bind(this));\n        this._initFocusTracking();\n        this._initVisualViewportSupport();\n    }\n    /**\n     * The main (outermost) DOM element of the editor UI.\n     *\n     * For example, in {@link module:editor-classic/classiceditor~ClassicEditor} it is a `<div>` which\n     * wraps the editable element and the toolbar. In {@link module:editor-inline/inlineeditor~InlineEditor}\n     * it is the editable element itself (as there is no other wrapper). However, in\n     * {@link module:editor-decoupled/decouplededitor~DecoupledEditor} it is set to `null` because this editor does not\n     * come with a single \"main\" HTML element (its editable element and toolbar are separate).\n     *\n     * This property can be understood as a shorthand for retrieving the element that a specific editor integration\n     * considers to be its main DOM element.\n     */\n    get element() {\n        return null;\n    }\n    /**\n     * Fires the {@link module:ui/editorui/editorui~EditorUI#event:update `update`} event.\n     *\n     * This method should be called when the editor UI (e.g. positions of its balloons) needs to be updated due to\n     * some environmental change which CKEditor 5 is not aware of (e.g. resize of a container in which it is used).\n     */\n    update() {\n        this.fire('update');\n    }\n    /**\n     * Destroys the UI.\n     */\n    destroy() {\n        this.stopListening();\n        this.focusTracker.destroy();\n        this.tooltipManager.destroy(this.editor);\n        this.poweredBy.destroy();\n        this.evaluationBadge.destroy();\n        // Clean–up the references to the CKEditor instance stored in the native editable DOM elements.\n        for (const domElement of this._editableElementsMap.values()) {\n            domElement.ckeditorInstance = null;\n            this.editor.keystrokes.stopListening(domElement);\n        }\n        this._editableElementsMap = new Map();\n        this._focusableToolbarDefinitions = [];\n        if (this._domEmitter) {\n            this._domEmitter.stopListening();\n        }\n    }\n    /**\n     * Stores the native DOM editable element used by the editor under a unique name.\n     *\n     * Also, registers the element in the editor to maintain the accessibility of the UI. When the user is editing text in a focusable\n     * editable area, they can use the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke to navigate over editor toolbars. See {@link #addToolbar}.\n     *\n     * @param rootName The unique name of the editable element.\n     * @param domElement The native DOM editable element.\n     */\n    setEditableElement(rootName, domElement) {\n        this._editableElementsMap.set(rootName, domElement);\n        // Put a reference to the CKEditor instance in the editable native DOM element.\n        // It helps 3rd–party software (browser extensions, other libraries) access and recognize\n        // CKEditor 5 instances (editing roots) and use their API (there is no global editor\n        // instance registry).\n        if (!domElement.ckeditorInstance) {\n            domElement.ckeditorInstance = this.editor;\n        }\n        // Register the element, so it becomes available for Alt+F10 and Esc navigation.\n        this.focusTracker.add(domElement);\n        const setUpKeystrokeHandler = () => {\n            // The editing view of the editor is already listening to keystrokes from DOM roots (see: KeyObserver).\n            // Do not duplicate listeners.\n            if (this.editor.editing.view.getDomRoot(rootName)) {\n                return;\n            }\n            this.editor.keystrokes.listenTo(domElement);\n        };\n        // For editable elements set by features after EditorUI is ready (e.g. source editing).\n        if (this.isReady) {\n            setUpKeystrokeHandler();\n        }\n        // For editable elements set while the editor is being created (e.g. DOM roots).\n        else {\n            this.once('ready', setUpKeystrokeHandler);\n        }\n    }\n    /**\n     * Removes the editable from the editor UI. Removes all handlers added by {@link #setEditableElement}.\n     *\n     * @param rootName The name of the editable element to remove.\n     */\n    removeEditableElement(rootName) {\n        const domElement = this._editableElementsMap.get(rootName);\n        if (!domElement) {\n            return;\n        }\n        this._editableElementsMap.delete(rootName);\n        this.editor.keystrokes.stopListening(domElement);\n        this.focusTracker.remove(domElement);\n        domElement.ckeditorInstance = null;\n    }\n    /**\n     * Returns the editable editor element with the given name or null if editable does not exist.\n     *\n     * @param rootName The editable name.\n     */\n    getEditableElement(rootName = 'main') {\n        return this._editableElementsMap.get(rootName);\n    }\n    /**\n     * Returns array of names of all editor editable elements.\n     */\n    getEditableElementsNames() {\n        return this._editableElementsMap.keys();\n    }\n    /**\n     * Adds a toolbar to the editor UI. Used primarily to maintain the accessibility of the UI.\n     *\n     * Focusable toolbars can be accessed (focused) by users by pressing the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke.\n     * Successive keystroke presses navigate over available toolbars.\n     *\n     * @param toolbarView A instance of the toolbar to be registered.\n     */\n    addToolbar(toolbarView, options = {}) {\n        if (toolbarView.isRendered) {\n            this.focusTracker.add(toolbarView);\n            this.editor.keystrokes.listenTo(toolbarView.element);\n        }\n        else {\n            toolbarView.once('render', () => {\n                this.focusTracker.add(toolbarView);\n                this.editor.keystrokes.listenTo(toolbarView.element);\n            });\n        }\n        this._focusableToolbarDefinitions.push({ toolbarView, options });\n    }\n    /**\n     * Registers an extra menu bar element, which could be a single item, a group of items, or a menu containing groups.\n     *\n     * ```ts\n     * // Register a new menu bar item.\n     * editor.ui.extendMenuBar( {\n     *   item: 'menuBar:customFunctionButton',\n     *   position: 'after:menuBar:bold'\n     * } );\n     *\n     * // Register a new menu bar group.\n     * editor.ui.extendMenuBar( {\n     *   group: {\n     *     groupId: 'customGroup',\n     *     items: [\n     *       'menuBar:customFunctionButton'\n     *     ]\n     *   },\n     *   position: 'start:help'\n     * } );\n     *\n     * // Register a new menu bar menu.\n     * editor.ui.extendMenuBar( {\n     *   menu: {\n     *     menuId: 'customMenu',\n     *     label: 'customMenu',\n     *     groups: [\n     *       {\n     *         groupId: 'customGroup',\n     *         items: [\n     *           'menuBar:customFunctionButton'\n     *         ]\n     *       }\n     *     ]\n     *   },\n     *   position: 'after:help'\n     * } );\n     * ```\n     */\n    extendMenuBar(config) {\n        this._extraMenuBarElements.push(config);\n    }\n    /**\n     * Initializes menu bar.\n     */\n    initMenuBar(menuBarView) {\n        const menuBarViewElement = menuBarView.element;\n        this.focusTracker.add(menuBarViewElement);\n        this.editor.keystrokes.listenTo(menuBarViewElement);\n        const normalizedMenuBarConfig = normalizeMenuBarConfig(this.editor.config.get('menuBar') || {});\n        menuBarView.fillFromConfig(normalizedMenuBarConfig, this.componentFactory, this._extraMenuBarElements);\n        this.editor.keystrokes.set('Esc', (data, cancel) => {\n            if (!menuBarViewElement.contains(this.editor.ui.focusTracker.focusedElement)) {\n                return;\n            }\n            // Bring focus back to where it came from before focusing the toolbar:\n            // If it came from outside the engine view (e.g. source editing), move it there.\n            if (this._lastFocusedForeignElement) {\n                this._lastFocusedForeignElement.focus();\n                this._lastFocusedForeignElement = null;\n            }\n            // Else just focus the view editing.\n            else {\n                this.editor.editing.view.focus();\n            }\n            cancel();\n        });\n        this.editor.keystrokes.set('Alt+F9', (data, cancel) => {\n            // If menu bar is already focused do nothing.\n            if (menuBarViewElement.contains(this.editor.ui.focusTracker.focusedElement)) {\n                return;\n            }\n            this._saveLastFocusedForeignElement();\n            menuBarView.isFocusBorderEnabled = true;\n            menuBarView.focus();\n            cancel();\n        });\n    }\n    /**\n     * Returns viewport offsets object:\n     *\n     * ```js\n     * {\n     * \ttop: Number,\n     * \tright: Number,\n     * \tbottom: Number,\n     * \tleft: Number\n     * }\n     * ```\n     *\n     * Only top property is currently supported.\n     */\n    _readViewportOffsetFromConfig() {\n        const editor = this.editor;\n        const viewportOffsetConfig = editor.config.get('ui.viewportOffset');\n        if (viewportOffsetConfig) {\n            return viewportOffsetConfig;\n        }\n        // Not present in EditorConfig type, because it's legacy. Hence the `as` expression.\n        const legacyOffsetConfig = editor.config.get('toolbar.viewportTopOffset');\n        // Fall back to deprecated toolbar config.\n        if (legacyOffsetConfig) {\n            /**\n             * The {@link module:core/editor/editorconfig~EditorConfig#toolbar `EditorConfig#toolbar.viewportTopOffset`}\n             * property has been deprecated and will be removed in the near future. Please use\n             * {@link module:core/editor/editorconfig~EditorConfig#ui `EditorConfig#ui.viewportOffset`} instead.\n             *\n             * @error editor-ui-deprecated-viewport-offset-config\n             */\n            console.warn('editor-ui-deprecated-viewport-offset-config: ' +\n                'The `toolbar.vieportTopOffset` configuration option is deprecated. ' +\n                'It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead.');\n            return { top: legacyOffsetConfig };\n        }\n        // More keys to come in the future.\n        return { top: 0 };\n    }\n    /**\n     * Starts listening for <kbd>Alt</kbd> + <kbd>F10</kbd> and <kbd>Esc</kbd> keystrokes in the context of focusable\n     * {@link #setEditableElement editable elements} and {@link #addToolbar toolbars}\n     * to allow users navigate across the UI.\n     */\n    _initFocusTracking() {\n        const editor = this.editor;\n        let candidateDefinitions;\n        // Focus the next focusable toolbar on <kbd>Alt</kbd> + <kbd>F10</kbd>.\n        editor.keystrokes.set('Alt+F10', (data, cancel) => {\n            this._saveLastFocusedForeignElement();\n            const currentFocusedToolbarDefinition = this._getCurrentFocusedToolbarDefinition();\n            // * When focusing a toolbar for the first time, set the array of definitions for successive presses of Alt+F10.\n            // This ensures, the navigation works always the same and no pair of toolbars takes over\n            // (e.g. image and table toolbars when a selected image is inside a cell).\n            // * It could be that the focus went to the toolbar by clicking a toolbar item (e.g. a dropdown). In this case,\n            // there were no candidates so they must be obtained (#12339).\n            if (!currentFocusedToolbarDefinition || !candidateDefinitions) {\n                candidateDefinitions = this._getFocusableCandidateToolbarDefinitions();\n            }\n            // In a single Alt+F10 press, check all candidates but if none were focused, don't go any further.\n            // This prevents an infinite loop.\n            for (let i = 0; i < candidateDefinitions.length; i++) {\n                const candidateDefinition = candidateDefinitions.shift();\n                // Put the first definition to the back of the array. This allows circular navigation over all toolbars\n                // on successive presses of Alt+F10.\n                candidateDefinitions.push(candidateDefinition);\n                // Don't focus the same toolbar again. If you did, this would move focus from the nth focused toolbar item back to the\n                // first item as per ToolbarView#focus() if the user navigated inside the toolbar.\n                if (candidateDefinition !== currentFocusedToolbarDefinition &&\n                    this._focusFocusableCandidateToolbar(candidateDefinition)) {\n                    // Clean up after a current visible toolbar when switching to the next one.\n                    if (currentFocusedToolbarDefinition && currentFocusedToolbarDefinition.options.afterBlur) {\n                        currentFocusedToolbarDefinition.options.afterBlur();\n                    }\n                    break;\n                }\n            }\n            cancel();\n        });\n        // Blur the focused toolbar on <kbd>Esc</kbd> and bring the focus back to its origin.\n        editor.keystrokes.set('Esc', (data, cancel) => {\n            const focusedToolbarDef = this._getCurrentFocusedToolbarDefinition();\n            if (!focusedToolbarDef) {\n                return;\n            }\n            // Bring focus back to where it came from before focusing the toolbar:\n            // 1. If it came from outside the engine view (e.g. source editing), move it there.\n            if (this._lastFocusedForeignElement) {\n                this._lastFocusedForeignElement.focus();\n                this._lastFocusedForeignElement = null;\n            }\n            // 2. There are two possibilities left:\n            //   2.1. It could be that the focus went from an editable element in the view (root or nested).\n            //   2.2. It could be the focus went straight to the toolbar before even focusing the editing area.\n            // In either case, just focus the view editing. The focus will land where it belongs.\n            else {\n                editor.editing.view.focus();\n            }\n            // Clean up after the toolbar if there is anything to do there.\n            if (focusedToolbarDef.options.afterBlur) {\n                focusedToolbarDef.options.afterBlur();\n            }\n            cancel();\n        });\n    }\n    /**\n     * Saves last focused element that doen not belong to editing view to restore focus on `Esc`.\n     */\n    _saveLastFocusedForeignElement() {\n        const focusedElement = this.focusTracker.focusedElement;\n        // Focus moved out of a DOM element that\n        // * is not a toolbar,\n        // * does not belong to the editing view (e.g. source editing).\n        if (Array.from(this._editableElementsMap.values()).includes(focusedElement) &&\n            !Array.from(this.editor.editing.view.domRoots.values()).includes(focusedElement)) {\n            this._lastFocusedForeignElement = focusedElement;\n        }\n    }\n    /**\n     * Returns definitions of toolbars that could potentially be focused, sorted by their importance for the user.\n     *\n     * Focusable toolbars candidates are either:\n     * * already visible,\n     * * have `beforeFocus()` set in their {@link module:ui/editorui/editorui~FocusableToolbarDefinition definition} that suggests that\n     * they might show up when called. Keep in mind that determining whether a toolbar will show up (and become focusable) is impossible\n     * at this stage because it depends on its implementation, that in turn depends on the editing context (selection).\n     *\n     * **Note**: Contextual toolbars take precedence over regular toolbars.\n     */\n    _getFocusableCandidateToolbarDefinitions() {\n        const definitions = [];\n        for (const toolbarDef of this._focusableToolbarDefinitions) {\n            const { toolbarView, options } = toolbarDef;\n            if (isVisible(toolbarView.element) || options.beforeFocus) {\n                definitions.push(toolbarDef);\n            }\n        }\n        // Contextual and already visible toolbars have higher priority. If both are true, the toolbar will always focus first.\n        // For instance, a selected widget toolbar vs inline editor toolbar: both are visible but the widget toolbar is contextual.\n        definitions.sort((defA, defB) => getToolbarDefinitionWeight(defA) - getToolbarDefinitionWeight(defB));\n        return definitions;\n    }\n    /**\n     * Returns a definition of the toolbar that is currently visible and focused (one of its children has focus).\n     *\n     * `null` is returned when no toolbar is currently focused.\n     */\n    _getCurrentFocusedToolbarDefinition() {\n        for (const definition of this._focusableToolbarDefinitions) {\n            if (definition.toolbarView.element && definition.toolbarView.element.contains(this.focusTracker.focusedElement)) {\n                return definition;\n            }\n        }\n        return null;\n    }\n    /**\n     * Focuses a focusable toolbar candidate using its definition.\n     *\n     * @param candidateToolbarDefinition A definition of the toolbar to focus.\n     * @returns `true` when the toolbar candidate was focused. `false` otherwise.\n     */\n    _focusFocusableCandidateToolbar(candidateToolbarDefinition) {\n        const { toolbarView, options: { beforeFocus } } = candidateToolbarDefinition;\n        if (beforeFocus) {\n            beforeFocus();\n        }\n        // If it didn't show up after beforeFocus(), it's not focusable at all.\n        if (!isVisible(toolbarView.element)) {\n            return false;\n        }\n        toolbarView.focus();\n        return true;\n    }\n    /**\n     * Provides an integration between {@link #viewportOffset} and {@link module:utils/dom/scroll~scrollViewportToShowTarget}.\n     * It allows the UI-agnostic engine method to consider user-configured viewport offsets specific for the integration.\n     *\n     * @param evt The `scrollToTheSelection` event info.\n     * @param data The payload carried by the `scrollToTheSelection` event.\n     */\n    _handleScrollToTheSelection(evt, data) {\n        const configuredViewportOffset = {\n            top: 0,\n            bottom: 0,\n            left: 0,\n            right: 0,\n            ...this.viewportOffset\n        };\n        data.viewportOffset.top += configuredViewportOffset.top;\n        data.viewportOffset.bottom += configuredViewportOffset.bottom;\n        data.viewportOffset.left += configuredViewportOffset.left;\n        data.viewportOffset.right += configuredViewportOffset.right;\n    }\n    /**\n     * Ensures that the focus tracker is aware of all views' DOM elements in the body collection.\n     */\n    _bindBodyCollectionWithFocusTracker() {\n        const body = this.view.body;\n        for (const view of body) {\n            this.focusTracker.add(view.element);\n        }\n        body.on('add', (evt, view) => {\n            this.focusTracker.add(view.element);\n        });\n        body.on('remove', (evt, view) => {\n            this.focusTracker.remove(view.element);\n        });\n    }\n    /**\n     * Set initial viewport offset and setup visualTop augmentation.\n     */\n    _initViewportOffset(viewportOffsetConfig) {\n        // Augment the viewport offset set from outside the editor with the visualTop property.\n        this.on('set:viewportOffset', (evt, name, value) => {\n            const visualTop = this._getVisualViewportTopOffset(value);\n            // Update only if there is a change in a value, so we do not trigger\n            // listeners to the viewportOffset observable.\n            if (value.visualTop !== visualTop) {\n                evt.return = { ...value, visualTop };\n            }\n        });\n        // Set the initial value after augmenting the setter.\n        this.set('viewportOffset', viewportOffsetConfig);\n    }\n    /**\n     * Listen to visual viewport changes and update the viewportOffset with the visualTop property\n     * according to the visible part of it (visual viewport).\n     */\n    _initVisualViewportSupport() {\n        if (!global.window.visualViewport) {\n            return;\n        }\n        const updateViewport = () => {\n            const visualTop = this._getVisualViewportTopOffset(this.viewportOffset);\n            // Update only if there is a change in a value, so we do not trigger\n            // listeners to the viewportOffset observable.\n            if (this.viewportOffset.visualTop !== visualTop) {\n                this.viewportOffset = { ...this.viewportOffset, visualTop };\n            }\n        };\n        // Listen to the changes in the visual viewport to adjust the visualTop of viewport offset.\n        this._domEmitter = new (DomEmitterMixin())();\n        this._domEmitter.listenTo(global.window.visualViewport, 'scroll', updateViewport);\n        this._domEmitter.listenTo(global.window.visualViewport, 'resize', updateViewport);\n    }\n    /**\n     * Calculate the viewport top offset according to the visible part of it (visual viewport).\n     */\n    _getVisualViewportTopOffset(viewportOffset) {\n        const visualViewportOffsetTop = getVisualViewportOffset().top;\n        const viewportTopOffset = viewportOffset.top || 0;\n        return visualViewportOffsetTop > viewportTopOffset ? 0 : viewportTopOffset - visualViewportOffsetTop;\n    }\n}\n/**\n * Returns a number (weight) for a toolbar definition. Visible toolbars have a higher priority and so do\n * contextual toolbars (displayed in the context of a content, for instance, an image toolbar).\n *\n * A standard invisible toolbar is the heaviest. A visible contextual toolbar is the lightest.\n *\n * @param toolbarDef A toolbar definition to be weighted.\n */\nfunction getToolbarDefinitionWeight(toolbarDef) {\n    const { toolbarView, options } = toolbarDef;\n    let weight = 10;\n    // Prioritize already visible toolbars. They should get focused first.\n    if (isVisible(toolbarView.element)) {\n        weight--;\n    }\n    // Prioritize contextual toolbars. They are displayed at the selection.\n    if (options.isContextual) {\n        weight -= 2;\n    }\n    return weight;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/toolbar/normalizetoolbarconfig\n */\n/**\n * Normalizes the toolbar configuration (`config.toolbar`), which:\n *\n * * may be defined as an `Array`:\n *\n * ```\n * toolbar: [ 'heading', 'bold', 'italic', 'link', ... ]\n * ```\n *\n * * or an `Object`:\n *\n * ```\n * toolbar: {\n * \titems: [ 'heading', 'bold', 'italic', 'link', ... ],\n * \tremoveItems: [ 'bold' ],\n * \t...\n * }\n * ```\n *\n * * or may not be defined at all (`undefined`)\n *\n * and returns it in the object form.\n *\n * @param config The value of `config.toolbar`.\n * @returns A normalized toolbar config object.\n */\nexport function normalizeToolbarConfig(config) {\n    if (Array.isArray(config)) {\n        return {\n            items: config,\n            removeItems: []\n        };\n    }\n    const predefinedConfigOptions = {\n        items: [],\n        removeItems: []\n    };\n    if (!config) {\n        return predefinedConfigOptions;\n    }\n    return {\n        ...predefinedConfigOptions,\n        ...config\n    };\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/formheader/formheaderview\n */\nimport { View } from '../view.js';\nimport { IconView } from '../icon/iconview.js';\nimport '../../theme/components/formheader/formheader.css';\n/**\n * The class component representing a form header view. It should be used in more advanced forms to\n * describe the main purpose of the form.\n *\n * By default the component contains a bolded label view that has to be set. The label is usually a short (at most 3-word) string.\n * The component can also be extended by any other elements, like: icons, dropdowns, etc.\n *\n * It is used i.a.\n * by {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}.\n *\n * The latter is an example, where the component has been extended by {@link module:ui/dropdown/dropdownview~DropdownView} view.\n */\nexport class FormHeaderView extends View {\n    /**\n     * A collection of header items.\n     */\n    children;\n    /**\n     * The icon view instance. Defined only if icon was passed in the constructor's options.\n     */\n    iconView;\n    /**\n     * Creates an instance of the form header class.\n     *\n     * @param locale The locale instance.\n     * @param options.label A label.\n     * @param options.class An additional class.\n     */\n    constructor(locale, options = {}) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('label', options.label || '');\n        this.set('class', options.class || null);\n        this.children = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form__header',\n                    bind.to('class')\n                ]\n            },\n            children: this.children\n        });\n        if (options.icon) {\n            this.iconView = new IconView();\n            this.iconView.content = options.icon;\n            this.children.add(this.iconView);\n        }\n        const label = new View(locale);\n        label.setTemplate({\n            tag: 'h2',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form__header__label'\n                ],\n                role: 'presentation'\n            },\n            children: [\n                { text: bind.to('label') }\n            ]\n        });\n        this.children.add(label);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/button/buttonlabelview\n */\nimport { View } from '../view.js';\n/**\n * A default implementation of the button view's label. It comes with a dynamic text support\n * via {@link module:ui/button/buttonlabelview~ButtonLabelView#text} property.\n */\nexport class ButtonLabelView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor() {\n        super();\n        this.set({\n            style: undefined,\n            text: undefined,\n            id: undefined\n        });\n        const bind = this.bindTemplate;\n        this.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-button__label'\n                ],\n                style: bind.to('style'),\n                id: bind.to('id')\n            },\n            children: [\n                {\n                    text: bind.to('text')\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/button/buttonview\n */\nimport { View } from '../view.js';\nimport { IconView } from '../icon/iconview.js';\nimport { ButtonLabelView } from './buttonlabelview.js';\nimport { env, getEnvKeystrokeText, uid, delay } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/button/button.css';\n/**\n * The button view class.\n *\n * ```ts\n * const view = new ButtonView();\n *\n * view.set( {\n * \tlabel: 'A button',\n * \tkeystroke: 'Ctrl+B',\n * \ttooltip: true,\n * \twithText: true\n * } );\n *\n * view.render();\n *\n * document.body.append( view.element );\n * ```\n */\nexport class ButtonView extends View {\n    /**\n     * Collection of the child views inside of the button {@link #element}.\n     */\n    children;\n    /**\n     * Label of the button view. Its text is configurable using the {@link #label label attribute}.\n     *\n     * If not configured otherwise in the `constructor()`, by default the label is an instance\n     * of {@link module:ui/button/buttonlabelview~ButtonLabelView}.\n     */\n    labelView;\n    /**\n     * The icon view of the button. Will be added to {@link #children} when the\n     * {@link #icon icon attribute} is defined.\n     */\n    iconView;\n    /**\n     * A view displaying the keystroke of the button next to the {@link #labelView label}.\n     * Added to {@link #children} when the {@link #withKeystroke `withKeystroke` attribute}\n     * is defined.\n     */\n    keystrokeView;\n    /**\n     * Delayed focus function for focus handling in Safari.\n     */\n    _focusDelayed = null;\n    /**\n     * Creates an instance of the button view class.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param labelView The instance of the button's label. If not provided, an instance of\n     * {@link module:ui/button/buttonlabelview~ButtonLabelView} is used.\n     */\n    constructor(locale, labelView = new ButtonLabelView()) {\n        super(locale);\n        const bind = this.bindTemplate;\n        const ariaLabelUid = uid();\n        // Implement the Button interface.\n        this.set('_ariaPressed', false);\n        this.set('_ariaChecked', false);\n        this.set('ariaLabel', undefined);\n        this.set('ariaLabelledBy', `ck-editor__aria-label_${ariaLabelUid}`);\n        this.set('class', undefined);\n        this.set('labelStyle', undefined);\n        this.set('icon', undefined);\n        this.set('isEnabled', true);\n        this.set('isOn', false);\n        this.set('isVisible', true);\n        this.set('isToggleable', false);\n        this.set('keystroke', undefined);\n        this.set('label', undefined);\n        this.set('role', undefined);\n        this.set('tabindex', -1);\n        this.set('tooltip', false);\n        this.set('tooltipPosition', 's');\n        this.set('type', 'button');\n        this.set('withText', false);\n        this.set('withKeystroke', false);\n        this.children = this.createCollection();\n        this.labelView = this._setupLabelView(labelView);\n        this.iconView = new IconView();\n        this.iconView.extendTemplate({\n            attributes: {\n                class: 'ck-button__icon'\n            }\n        });\n        this.iconView.bind('content').to(this, 'icon');\n        this.keystrokeView = this._createKeystrokeView();\n        this.bind('_tooltipString').to(this, 'tooltip', this, 'label', this, 'keystroke', this._getTooltipString.bind(this));\n        const template = {\n            tag: 'button',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-button',\n                    bind.to('class'),\n                    bind.if('isEnabled', 'ck-disabled', value => !value),\n                    bind.if('isVisible', 'ck-hidden', value => !value),\n                    bind.to('isOn', value => value ? 'ck-on' : 'ck-off'),\n                    bind.if('withText', 'ck-button_with-text'),\n                    bind.if('withKeystroke', 'ck-button_with-keystroke')\n                ],\n                role: bind.to('role'),\n                type: bind.to('type', value => value ? value : 'button'),\n                tabindex: bind.to('tabindex'),\n                'aria-checked': bind.to('_ariaChecked'),\n                'aria-pressed': bind.to('_ariaPressed'),\n                'aria-label': bind.to('ariaLabel'),\n                'aria-labelledby': bind.to('ariaLabelledBy'),\n                'aria-disabled': bind.if('isEnabled', true, value => !value),\n                'data-cke-tooltip-text': bind.to('_tooltipString'),\n                'data-cke-tooltip-position': bind.to('tooltipPosition')\n            },\n            children: this.children,\n            on: {\n                click: bind.to(evt => {\n                    // We can't make the button disabled using the disabled attribute, because it won't be focusable.\n                    // Though, shouldn't this condition be moved to the button controller?\n                    if (this.isEnabled) {\n                        this.fire('execute');\n                    }\n                    else {\n                        // Prevent the default when button is disabled, to block e.g.\n                        // automatic form submitting. See ckeditor/ckeditor5-link#74.\n                        evt.preventDefault();\n                    }\n                })\n            }\n        };\n        this.bind('_ariaPressed').to(this, 'isOn', this, 'isToggleable', this, 'role', (isOn, isToggleable, role) => {\n            if (!isToggleable || isCheckableRole(role)) {\n                return false;\n            }\n            return String(!!isOn);\n        });\n        this.bind('_ariaChecked').to(this, 'isOn', this, 'isToggleable', this, 'role', (isOn, isToggleable, role) => {\n            if (!isToggleable || !isCheckableRole(role)) {\n                return false;\n            }\n            return String(!!isOn);\n        });\n        // On Safari we have to force the focus on a button on click as it's the only browser\n        // that doesn't do that automatically. See #12115.\n        if (env.isSafari) {\n            if (!this._focusDelayed) {\n                this._focusDelayed = delay(() => this.focus(), 0);\n            }\n            template.on.mousedown = bind.to(() => {\n                this._focusDelayed();\n            });\n            template.on.mouseup = bind.to(() => {\n                this._focusDelayed.cancel();\n            });\n        }\n        this.setTemplate(template);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        if (this.icon) {\n            this.children.add(this.iconView);\n        }\n        this.on('change:icon', (evt, prop, newIcon, oldIcon) => {\n            if (newIcon && !oldIcon) {\n                this.children.add(this.iconView, 0);\n            }\n            else if (!newIcon && oldIcon) {\n                this.children.remove(this.iconView);\n            }\n        });\n        this.children.add(this.labelView);\n        if (this.withKeystroke && this.keystroke) {\n            this.children.add(this.keystrokeView);\n        }\n    }\n    /**\n     * Focuses the {@link #element} of the button.\n     */\n    focus() {\n        this.element.focus();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        if (this._focusDelayed) {\n            this._focusDelayed.cancel();\n        }\n        super.destroy();\n    }\n    /**\n     * Binds the label view instance it with button attributes.\n     */\n    _setupLabelView(labelView) {\n        labelView.bind('text', 'style', 'id').to(this, 'label', 'labelStyle', 'ariaLabelledBy');\n        return labelView;\n    }\n    /**\n     * Creates a view that displays a keystroke next to a {@link #labelView label }\n     * and binds it with button attributes.\n     */\n    _createKeystrokeView() {\n        const keystrokeView = new View();\n        keystrokeView.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-button__keystroke'\n                ]\n            },\n            children: [\n                {\n                    text: this.bindTemplate.to('keystroke', text => getEnvKeystrokeText(text))\n                }\n            ]\n        });\n        return keystrokeView;\n    }\n    /**\n     * Gets the text for the tooltip from the combination of\n     * {@link #tooltip}, {@link #label} and {@link #keystroke} attributes.\n     *\n     * @see #tooltip\n     * @see #_tooltipString\n     * @param tooltip Button tooltip.\n     * @param label Button label.\n     * @param keystroke Button keystroke.\n     */\n    _getTooltipString(tooltip, label, keystroke) {\n        if (tooltip) {\n            if (typeof tooltip == 'string') {\n                return tooltip;\n            }\n            else {\n                if (keystroke) {\n                    keystroke = getEnvKeystrokeText(keystroke);\n                }\n                if (tooltip instanceof Function) {\n                    return tooltip(label, keystroke);\n                }\n                else {\n                    return `${label}${keystroke ? ` (${keystroke})` : ''}`;\n                }\n            }\n        }\n        return '';\n    }\n}\n/**\n * Checks if `aria-checkbox` can be used with specified role.\n */\nfunction isCheckableRole(role) {\n    switch (role) {\n        case 'radio':\n        case 'checkbox':\n        case 'option':\n        case 'switch':\n        case 'menuitemcheckbox':\n        case 'menuitemradio':\n            return true;\n        default:\n            return false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/focuscycler\n */\nimport { isVisible, EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * A utility class that helps cycling over {@link module:ui/focuscycler~FocusableView focusable views} in a\n * {@link module:ui/viewcollection~ViewCollection} when the focus is tracked by the\n * {@link module:utils/focustracker~FocusTracker} instance. It helps implementing keyboard\n * navigation in HTML forms, toolbars, lists and the like.\n *\n * To work properly it requires:\n * * a collection of focusable (HTML `tabindex` attribute) views that implement the `focus()` method,\n * * an associated focus tracker to determine which view is focused.\n *\n * A simple cycler setup can look like this:\n *\n * ```ts\n * const focusables = new ViewCollection<FocusableView>();\n * const focusTracker = new FocusTracker();\n *\n * // Add focusable views to the focus tracker.\n * focusTracker.add( ... );\n * ```\n *\n * Then, the cycler can be used manually:\n *\n * ```ts\n * const cycler = new FocusCycler( { focusables, focusTracker } );\n *\n * // Will focus the first focusable view in #focusables.\n * cycler.focusFirst();\n *\n * // Will log the next focusable item in #focusables.\n * console.log( cycler.next );\n * ```\n *\n * Alternatively, it can work side by side with the {@link module:utils/keystrokehandler~KeystrokeHandler}:\n *\n * ```ts\n * const keystrokeHandler = new KeystrokeHandler();\n *\n * // Activate the keystroke handler.\n * keystrokeHandler.listenTo( sourceOfEvents );\n *\n * const cycler = new FocusCycler( {\n * \tfocusables, focusTracker, keystrokeHandler,\n * \tactions: {\n * \t\t// When arrowup of arrowleft is detected by the #keystrokeHandler,\n * \t\t// focusPrevious() will be called on the cycler.\n * \t\tfocusPrevious: [ 'arrowup', 'arrowleft' ],\n * \t}\n * } );\n * ```\n *\n * Check out the {@glink framework/deep-dive/ui/focus-tracking \"Deep dive into focus tracking\"} guide to learn more.\n */\nexport class FocusCycler extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * A {@link module:ui/focuscycler~FocusableView focusable views} collection that the cycler operates on.\n     */\n    focusables;\n    /**\n     * A focus tracker instance that the cycler uses to determine the current focus\n     * state in {@link #focusables}.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}\n     * which can respond to certain keystrokes and cycle the focus.\n     */\n    keystrokeHandler;\n    /**\n     * Actions that the cycler can take when a keystroke is pressed. Requires\n     * `options.keystrokeHandler` to be passed and working. When an action is\n     * performed, `preventDefault` and `stopPropagation` will be called on the event\n     * the keystroke fired in the DOM.\n     *\n     * ```ts\n     * actions: {\n     * \t// Will call #focusPrevious() when arrowleft or arrowup is pressed.\n     * \tfocusPrevious: [ 'arrowleft', 'arrowup' ],\n     *\n     * \t// Will call #focusNext() when arrowdown is pressed.\n     * \tfocusNext: 'arrowdown'\n     * }\n     * ```\n     */\n    actions;\n    /**\n     * Creates an instance of the focus cycler utility.\n     *\n     * @param options Configuration options.\n     */\n    constructor(options) {\n        super();\n        this.focusables = options.focusables;\n        this.focusTracker = options.focusTracker;\n        this.keystrokeHandler = options.keystrokeHandler;\n        this.actions = options.actions;\n        if (options.actions && options.keystrokeHandler) {\n            for (const methodName in options.actions) {\n                let actions = options.actions[methodName];\n                if (typeof actions == 'string') {\n                    actions = [actions];\n                }\n                for (const keystroke of actions) {\n                    options.keystrokeHandler.set(keystroke, (data, cancel) => {\n                        this[methodName]();\n                        cancel();\n                    }, options.keystrokeHandlerOptions);\n                }\n            }\n        }\n        this.on('forwardCycle', () => this.focusFirst(), { priority: 'low' });\n        this.on('backwardCycle', () => this.focusLast(), { priority: 'low' });\n    }\n    /**\n     * Returns the first focusable view in {@link #focusables}.\n     * Returns `null` if there is none.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    get first() {\n        return (this.focusables.find(isDomFocusable) || null);\n    }\n    /**\n     * Returns the last focusable view in {@link #focusables}.\n     * Returns `null` if there is none.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    get last() {\n        return (this.focusables.filter(isDomFocusable).slice(-1)[0] || null);\n    }\n    /**\n     * Returns the next focusable view in {@link #focusables} based on {@link #current}.\n     * Returns `null` if there is none.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    get next() {\n        return this._getDomFocusableItem(1);\n    }\n    /**\n     * Returns the previous focusable view in {@link #focusables} based on {@link #current}.\n     * Returns `null` if there is none.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    get previous() {\n        return this._getDomFocusableItem(-1);\n    }\n    /**\n     * An index of the view in the {@link #focusables} which is focused according\n     * to {@link #focusTracker}. Returns `null` when there is no such view.\n     */\n    get current() {\n        let index = null;\n        // There's no focused view in the focusables.\n        if (this.focusTracker.focusedElement === null) {\n            return null;\n        }\n        this.focusables.find((view, viewIndex) => {\n            const focused = view.element === this.focusTracker.focusedElement;\n            if (focused) {\n                index = viewIndex;\n            }\n            return focused;\n        });\n        return index;\n    }\n    /**\n     * Focuses the {@link #first} item in {@link #focusables}.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    focusFirst() {\n        this._focus(this.first, 1);\n    }\n    /**\n     * Focuses the {@link #last} item in {@link #focusables}.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    focusLast() {\n        this._focus(this.last, -1);\n    }\n    /**\n     * Focuses the {@link #next} item in {@link #focusables}.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    focusNext() {\n        const next = this.next;\n        // If there's only one focusable item, we need to let the outside world know\n        // that the next cycle is about to happen. This may be useful\n        // e.g. if you want to move the focus to the parent focus cycler.\n        // Note that the focus is not actually moved in this case.\n        if (next && this.focusables.getIndex(next) === this.current) {\n            this.fire('forwardCycle');\n            return;\n        }\n        if (next === this.first) {\n            this.fire('forwardCycle');\n        }\n        else {\n            this._focus(next, 1);\n        }\n    }\n    /**\n     * Focuses the {@link #previous} item in {@link #focusables}.\n     *\n     * **Note**: Hidden views (e.g. with `display: none`) are ignored.\n     */\n    focusPrevious() {\n        const previous = this.previous;\n        if (previous && this.focusables.getIndex(previous) === this.current) {\n            this.fire('backwardCycle');\n            return;\n        }\n        if (previous === this.last) {\n            this.fire('backwardCycle');\n        }\n        else {\n            this._focus(previous, -1);\n        }\n    }\n    /**\n     * Allows for creating continuous focus cycling across multiple focus cyclers and their collections of {@link #focusables}.\n     *\n     * It starts listening to the {@link module:ui/focuscycler~FocusCyclerForwardCycleEvent} and\n     * {@link module:ui/focuscycler~FocusCyclerBackwardCycleEvent} events of the chained focus cycler and engages,\n     * whenever the user reaches the last (forwards navigation) or first (backwards navigation) focusable view\n     * and would normally start over. Instead, the navigation continues on the higher level (flattens).\n     *\n     * For instance, for the following nested focus navigation structure, the focus would get stuck the moment\n     * the AB gets focused and its focus cycler starts managing it:\n     *\n     *\t   ┌────────────┐   ┌──────────────────────────────────┐   ┌────────────┐\n     *\t   │ AA         │   │ AB                               │   │ AC         │\n     *\t   │            │   │                                  │   │            │\n     *\t   │            │   │    ┌─────┐  ┌─────┐  ┌─────┐     │   │            │\n     *\t   │            │   │ ┌──► ABA ├──► ABB ├──► ABC ├───┐ │   │            │\n     *\t   │            ├───► │  └─────┘  └─────┘  └─────┘   │ │   │            │\n     *\t   │            │   │ │                              │ │   │            │\n     *\t   │            │   │ │                              │ │   │            │\n     *\t   │            │   │ └──────────────────────────────┘ │   │            │\n     *\t   │            │   │                                  │   │            │\n     *\t   └────────────┘   └──────────────────────────────────┘   └────────────┘\n     *\n     * Chaining a focus tracker that manages AA, AB, and AC with the focus tracker that manages ABA, ABB, and ABC\n     * creates a seamless navigation experience instead:\n     *\n     *\t   ┌────────────┐   ┌──────────────────────────────────┐   ┌────────────┐\n     *\t   │ AA         │   │ AB                               │   │ AC         │\n     *\t   │            │   │                                  │   │            │\n     *\t   │            │   │    ┌─────┐  ┌─────┐  ┌─────┐     │   │            │\n     *\t   │            │   │ ┌──► ABA ├──► ABB ├──► ABC ├──┐  │   │            │\n     *\t┌──►            ├───┼─┘  └─────┘  └─────┘  └─────┘  └──┼───►            ├──┐\n     *\t│  │            │   │                                  │   │            │  │\n     *\t│  │            │   │                                  │   │            │  │\n     *\t│  │            │   │                                  │   │            │  │\n     *\t│  │            │   │                                  │   │            │  │\n     *\t│  └────────────┘   └──────────────────────────────────┘   └────────────┘  │\n     *\t│                                                                          │\n     *\t│                                                                          │\n     *\t└──────────────────────────────────────────────────────────────────────────┘\n     *\n     * See {@link #unchain} to reverse the chaining.\n     */\n    chain(chainedFocusCycler) {\n        const getCurrentFocusedView = () => {\n            // This may happen when one focus cycler does not include focusables of the other (horizontal case).\n            if (this.current === null) {\n                return null;\n            }\n            return this.focusables.get(this.current);\n        };\n        this.listenTo(chainedFocusCycler, 'forwardCycle', evt => {\n            const oldCurrent = getCurrentFocusedView();\n            this.focusNext();\n            // Stop the event propagation only if an attempt at focusing the view actually moved the focus.\n            // If not, let the otherFocusCycler handle the event.\n            if (oldCurrent !== getCurrentFocusedView()) {\n                evt.stop();\n            }\n            // The priority is critical for cycling across multiple chain levels when there's a single view at some of them only.\n        }, { priority: 'low' });\n        this.listenTo(chainedFocusCycler, 'backwardCycle', evt => {\n            const oldCurrent = getCurrentFocusedView();\n            this.focusPrevious();\n            // Stop the event propagation only if an attempt at focusing the view actually moved the focus.\n            // If not, let the otherFocusCycler handle the event.\n            if (oldCurrent !== getCurrentFocusedView()) {\n                evt.stop();\n            }\n            // The priority is critical for cycling across multiple chain levels when there's a single view at some of them only.\n        }, { priority: 'low' });\n    }\n    /**\n     * Reverses a chaining made by {@link #chain}.\n     */\n    unchain(otherFocusCycler) {\n        this.stopListening(otherFocusCycler);\n    }\n    /**\n     * Focuses the given view if it exists.\n     *\n     * @param view The view to be focused\n     * @param direction The direction of the focus if the view has focusable children.\n     * @returns\n     */\n    _focus(view, direction) {\n        // Don't fire focus events if the view is already focused.\n        // Such attempt may occur when cycling with only one focusable item:\n        // even though `focusNext()` method returns without changing focus,\n        // the `forwardCycle` event is fired, triggering the `focusFirst()` method.\n        if (view && this.focusTracker.focusedElement !== view.element) {\n            view.focus(direction);\n        }\n    }\n    /**\n     * Returns the next or previous focusable view in {@link #focusables} with respect\n     * to {@link #current}.\n     *\n     * @param step Either `1` for checking forward from {@link #current} or `-1` for checking backwards.\n     */\n    _getDomFocusableItem(step) {\n        // Cache for speed.\n        const collectionLength = this.focusables.length;\n        if (!collectionLength) {\n            return null;\n        }\n        const current = this.current;\n        // Start from the beginning if no view is focused.\n        // https://github.com/ckeditor/ckeditor5-ui/issues/206\n        if (current === null) {\n            return this[step === 1 ? 'first' : 'last'];\n        }\n        // Note: If current is the only focusable view, it will also be returned for the given step.\n        let focusableItem = this.focusables.get(current);\n        // Cycle in both directions.\n        let index = (current + collectionLength + step) % collectionLength;\n        do {\n            const focusableItemCandidate = this.focusables.get(index);\n            if (isDomFocusable(focusableItemCandidate)) {\n                focusableItem = focusableItemCandidate;\n                break;\n            }\n            // Cycle in both directions.\n            index = (index + collectionLength + step) % collectionLength;\n        } while (index !== current);\n        return focusableItem;\n    }\n}\n/**\n * Checks whether a view can be focused (has `focus()` method and is visible).\n *\n * @param view A view to be checked.\n */\nfunction isDomFocusable(view) {\n    return isFocusable(view) && isVisible(view.element);\n}\n/**\n * Checks whether a view is {@link ~FocusableView}.\n *\n * @param view A view to be checked.\n */\nexport function isFocusable(view) {\n    return !!('focus' in view && typeof view.focus == 'function');\n}\n/**\n * Checks whether a view is an instance of {@link ~ViewWithFocusCycler}.\n *\n * @param view A view to be checked.\n */\nexport function isViewWithFocusCycler(view) {\n    return isFocusable(view) && 'focusCycler' in view && view.focusCycler instanceof FocusCycler;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { global } from '@ckeditor/ckeditor5-utils';\n/**\n * A mixin that brings the possibility to observe dragging of the view element.\n * The view has to implement the {@link ~DraggableView} interface to use it:\n *\n * ```js\n * export class MyDraggableView extends DraggableViewMixin( View ) implements DraggableView {\n * \t\t// ...\n * }\n * ```\n *\n * Creating a class extending it attaches a set of mouse and touch listeners allowing to observe dragging of the view element:\n * * `mousedown` and `touchstart` on the view element - starting the dragging.\n * * `mousemove` and `touchmove` on the document - updating the view coordinates.\n * * `mouseup` and `touchend` on the document - stopping the dragging.\n *\n * The mixin itself does not provide a visual feedback (that is, the dragged element does not change its position) -\n * it is up to the developer to implement it.\n */\nexport function DraggableViewMixin(view) {\n    class DraggableMixin extends view {\n        /**\n         * A bound version of {@link #_onDrag}.\n         */\n        _onDragBound = this._onDrag.bind(this);\n        /**\n         * A bound version of {@link #_onDragEnd}.\n         */\n        _onDragEndBound = this._onDragEnd.bind(this);\n        /**\n         * The last coordinates of the view. It is updated on every mouse move.\n         */\n        _lastDraggingCoordinates = { x: 0, y: 0 };\n        /**\n         * @inheritDoc\n         */\n        constructor(...args) {\n            super(...args);\n            this.on('render', () => {\n                this._attachListeners();\n            });\n            this.set('isDragging', false);\n        }\n        /**\n         * Attaches the listeners for the drag start.\n         */\n        _attachListeners() {\n            this.listenTo(this.element, 'mousedown', this._onDragStart.bind(this));\n            this.listenTo(this.element, 'touchstart', this._onDragStart.bind(this));\n        }\n        /**\n         * Attaches the listeners for the dragging and drag end.\n         */\n        _attachDragListeners() {\n            this.listenTo(global.document, 'mouseup', this._onDragEndBound);\n            this.listenTo(global.document, 'touchend', this._onDragEndBound);\n            this.listenTo(global.document, 'mousemove', this._onDragBound);\n            this.listenTo(global.document, 'touchmove', this._onDragBound);\n        }\n        /**\n         * Detaches the listeners after the drag end.\n         */\n        _detachDragListeners() {\n            this.stopListening(global.document, 'mouseup', this._onDragEndBound);\n            this.stopListening(global.document, 'touchend', this._onDragEndBound);\n            this.stopListening(global.document, 'mousemove', this._onDragBound);\n            this.stopListening(global.document, 'touchmove', this._onDragBound);\n        }\n        /**\n         * Starts the dragging listeners and sets the initial view coordinates.\n         */\n        _onDragStart(evt, domEvt) {\n            if (!this._isHandleElementPressed(domEvt)) {\n                return;\n            }\n            this._attachDragListeners();\n            let x = 0;\n            let y = 0;\n            // If dragging is performed with a mouse, there is only one set of coordinates available.\n            // But when using a touch device, there may be many of them, so use the coordinates from the first touch.\n            if (domEvt instanceof MouseEvent) {\n                x = domEvt.clientX;\n                y = domEvt.clientY;\n            }\n            else {\n                x = domEvt.touches[0].clientX;\n                y = domEvt.touches[0].clientY;\n            }\n            this._lastDraggingCoordinates = { x, y };\n            this.isDragging = true;\n        }\n        /**\n         * Updates the view coordinates and fires the `drag` event.\n         */\n        _onDrag(evt, domEvt) {\n            // If dragging was stopped by some external intervention, stop listening.\n            if (!this.isDragging) {\n                this._detachDragListeners();\n                return;\n            }\n            let newX = 0;\n            let newY = 0;\n            // If dragging is performed with a mouse, there is only one set of coordinates available.\n            // But when using a touch device, there may be many of them, so use the coordinates from the first touch.\n            if (domEvt instanceof MouseEvent) {\n                newX = domEvt.clientX;\n                newY = domEvt.clientY;\n            }\n            else {\n                newX = domEvt.touches[0].clientX;\n                newY = domEvt.touches[0].clientY;\n            }\n            // Prevents selection of text while dragging on Safari.\n            domEvt.preventDefault();\n            this.fire('drag', {\n                deltaX: Math.round(newX - this._lastDraggingCoordinates.x),\n                deltaY: Math.round(newY - this._lastDraggingCoordinates.y)\n            });\n            this._lastDraggingCoordinates = { x: newX, y: newY };\n        }\n        /**\n         * Stops the dragging and detaches the listeners.\n         */\n        _onDragEnd() {\n            this._detachDragListeners();\n            this.isDragging = false;\n        }\n        /**\n         * Checks if the drag handle element was pressed.\n         */\n        _isHandleElementPressed(domEvt) {\n            if (!this.dragHandleElement) {\n                return false;\n            }\n            return this.dragHandleElement === domEvt.target ||\n                (domEvt.target instanceof HTMLElement && this.dragHandleElement.contains(domEvt.target));\n        }\n    }\n    return DraggableMixin;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dialog/dialogactionsview\n */\nimport { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';\nimport { ButtonView } from '../button/buttonview.js';\nimport { View } from '../view.js';\nimport { ViewCollection } from '../viewcollection.js';\nimport { FocusCycler } from '../focuscycler.js';\nimport '../../theme/components/dialog/dialogactions.css';\n/**\n * A dialog actions view class. It contains button views which are used to execute dialog actions.\n */\nexport class DialogActionsView extends View {\n    /**\n     * A collection of button views.\n     */\n    children;\n    /**\n     * A keystroke handler instance.\n     */\n    keystrokes;\n    /**\n     * A focus cycler instance.\n     */\n    focusCycler;\n    /**\n     * A focus tracker instance.\n     */\n    _focusTracker;\n    /**\n     * A collection of focusable views.\n     */\n    _focusables;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.children = this.createCollection();\n        this.keystrokes = new KeystrokeHandler();\n        this._focusTracker = new FocusTracker();\n        this._focusables = new ViewCollection();\n        this.focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this._focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-dialog__actions'\n                ]\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * Creates the button views based on the given definitions.\n     * Then adds them to the {@link #children} collection and to the focus cycler.\n     */\n    setButtons(definitions) {\n        for (const definition of definitions) {\n            const button = new ButtonView(this.locale);\n            let property;\n            button.on('execute', () => definition.onExecute());\n            if (definition.onCreate) {\n                definition.onCreate(button);\n            }\n            for (property in definition) {\n                if (property != 'onExecute' && property != 'onCreate') {\n                    button.set(property, definition[property]);\n                }\n            }\n            this.children.add(button);\n        }\n        this._updateFocusCyclableItems();\n    }\n    /**\n     * @inheritDoc\n     */\n    focus(direction) {\n        if (direction === -1) {\n            this.focusCycler.focusLast();\n        }\n        else {\n            this.focusCycler.focusFirst();\n        }\n    }\n    /**\n     * Adds all elements from the {@link #children} collection to the {@link #_focusables} collection\n     * and to the {@link #_focusTracker} instance.\n     */\n    _updateFocusCyclableItems() {\n        Array.from(this.children).forEach(v => {\n            this._focusables.add(v);\n            this._focusTracker.add(v.element);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dialog/dialogcontentview\n */\nimport { View } from '../view.js';\n/**\n * A dialog content view class.\n */\nexport class DialogContentView extends View {\n    /**\n     * A collection of content items.\n     */\n    children;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.children = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-dialog__content']\n            },\n            children: this.children\n        });\n    }\n    /**\n     * Removes all the child views.\n     */\n    reset() {\n        while (this.children.length) {\n            this.children.remove(0);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dialog/dialogview\n */\nimport { KeystrokeHandler, FocusTracker, Rect, getConstrainedViewportRect, global, toUnit } from '@ckeditor/ckeditor5-utils';\nimport { IconCancel } from '@ckeditor/ckeditor5-icons';\nimport { ViewCollection } from '../viewcollection.js';\nimport { View } from '../view.js';\nimport { FormHeaderView } from '../formheader/formheaderview.js';\nimport { ButtonView } from '../button/buttonview.js';\nimport { FocusCycler, isViewWithFocusCycler, isFocusable } from '../focuscycler.js';\nimport { DraggableViewMixin } from '../bindings/draggableviewmixin.js';\nimport { DialogActionsView } from './dialogactionsview.js';\nimport { DialogContentView } from './dialogcontentview.js';\nimport '../../theme/components/dialog/dialog.css';\n// @if CK_DEBUG_DIALOG // const RectDrawer = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' ).default;\n/**\n * Available dialog view positions:\n *\n * * `DialogViewPosition.SCREEN_CENTER` &ndash; A fixed position in the center of the screen.\n * * `DialogViewPosition.EDITOR_CENTER` &ndash; A dynamic position in the center of the editor editable area.\n * * `DialogViewPosition.EDITOR_TOP_SIDE` &ndash; A dynamic position at the top-right (for the left-to-right languages)\n * or top-left (for right-to-left languages) corner of the editor editable area.\n * * `DialogViewPosition.EDITOR_TOP_CENTER` &ndash; A dynamic position at the top-center of the editor editable area.\n * * `DialogViewPosition.EDITOR_BOTTOM_CENTER` &ndash; A dynamic position at the bottom-center of the editor editable area.\n * * `DialogViewPosition.EDITOR_ABOVE_CENTER` &ndash; A dynamic position centered above the editor editable area.\n * * `DialogViewPosition.EDITOR_BELOW_CENTER` &ndash; A dynamic position centered below the editor editable area.\n *\n * The position of a dialog is specified by a {@link module:ui/dialog/dialog~DialogDefinition#position `position` property} of a\n * definition passed to the {@link module:ui/dialog/dialog~Dialog#show} method.\n */\nexport const DialogViewPosition = {\n    SCREEN_CENTER: 'screen-center',\n    EDITOR_CENTER: 'editor-center',\n    EDITOR_TOP_SIDE: 'editor-top-side',\n    EDITOR_TOP_CENTER: 'editor-top-center',\n    EDITOR_BOTTOM_CENTER: 'editor-bottom-center',\n    EDITOR_ABOVE_CENTER: 'editor-above-center',\n    EDITOR_BELOW_CENTER: 'editor-below-center'\n};\nconst toPx = /* #__PURE__ */ toUnit('px');\n/**\n * A dialog view class.\n */\nexport class DialogView extends /* #__PURE__ */ DraggableViewMixin(View) {\n    /**\n     * A collection of the child views inside of the dialog.\n     * A dialog can have 3 optional parts: header, content, and actions.\n     */\n    parts;\n    /**\n     * A header view of the dialog. It is also a drag handle of the dialog.\n     */\n    headerView;\n    /**\n     * A close button view. It is automatically added to the header view if present.\n     */\n    closeButtonView;\n    /**\n     * A view with the action buttons available to the user.\n     */\n    actionsView;\n    /**\n     * A default dialog element offset from the reference element (e.g. editor editable area).\n     */\n    static defaultOffset = 15;\n    /**\n     * A view with the dialog content.\n     */\n    contentView;\n    /**\n     * A keystroke handler instance.\n     */\n    keystrokes;\n    /**\n     * A focus tracker instance.\n     */\n    focusTracker;\n    /**\n     * A flag indicating if the dialog was moved manually. If so, its position\n     * will not be updated automatically upon window resize or document scroll.\n     */\n    wasMoved = false;\n    /**\n     * A callback returning the DOM root that requested the dialog.\n     */\n    _getCurrentDomRoot;\n    /**\n     * A callback returning the configured editor viewport offset.\n     */\n    _getViewportOffset;\n    /**\n     * The list of the focusable elements inside the dialog view.\n     */\n    _focusables;\n    /**\n     * The focus cycler instance.\n     */\n    _focusCycler;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale, { getCurrentDomRoot, getViewportOffset, keystrokeHandlerOptions }) {\n        super(locale);\n        const bind = this.bindTemplate;\n        const t = locale.t;\n        this.set('className', '');\n        this.set('ariaLabel', t('Editor dialog'));\n        this.set('isModal', false);\n        this.set('position', DialogViewPosition.SCREEN_CENTER);\n        this.set('_isVisible', false);\n        this.set('_isTransparent', false);\n        this.set('_top', 0);\n        this.set('_left', 0);\n        this._getCurrentDomRoot = getCurrentDomRoot;\n        this._getViewportOffset = getViewportOffset;\n        this.decorate('moveTo');\n        this.parts = this.createCollection();\n        this.keystrokes = new KeystrokeHandler();\n        this.focusTracker = new FocusTracker();\n        this._focusables = new ViewCollection();\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            },\n            keystrokeHandlerOptions\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-dialog-overlay',\n                    bind.if('isModal', 'ck-dialog-overlay__transparent', isModal => !isModal),\n                    bind.if('_isVisible', 'ck-hidden', value => !value)\n                ],\n                // Prevent from editor losing focus when clicking on the modal overlay.\n                tabindex: '-1'\n            },\n            children: [\n                {\n                    tag: 'div',\n                    attributes: {\n                        tabindex: '-1',\n                        class: [\n                            'ck',\n                            'ck-dialog',\n                            bind.if('isModal', 'ck-dialog_modal'),\n                            bind.to('className')\n                        ],\n                        role: 'dialog',\n                        'aria-label': bind.to('ariaLabel'),\n                        style: {\n                            top: bind.to('_top', top => toPx(top)),\n                            left: bind.to('_left', left => toPx(left)),\n                            visibility: bind.if('_isTransparent', 'hidden')\n                        }\n                    },\n                    children: this.parts\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.keystrokes.set('Esc', (data, cancel) => {\n            // Do not react to the Esc key if the event has already been handled and defaultPrevented\n            // by some logic of the dialog guest (child) view (https://github.com/ckeditor/ckeditor5/issues/17343).\n            if (!data.defaultPrevented) {\n                this.fire('close', { source: 'escKeyPress' });\n                cancel();\n            }\n        });\n        // Support for dragging the modal.\n        this.on('drag', (evt, { deltaX, deltaY }) => {\n            this.wasMoved = true;\n            this.moveBy(deltaX, deltaY);\n        });\n        // Update dialog position upon window resize, if the position was not changed manually.\n        this.listenTo(global.window, 'resize', () => {\n            if (this._isVisible && !this.wasMoved) {\n                this.updatePosition();\n            }\n        });\n        // Update dialog position upon document scroll, if the position was not changed manually.\n        this.listenTo(global.document, 'scroll', () => {\n            if (this._isVisible && !this.wasMoved) {\n                this.updatePosition();\n            }\n        });\n        this.on('change:_isVisible', (evt, name, isVisible) => {\n            if (isVisible) {\n                // Let the content render first, then apply the position. Otherwise, the calculated DOM Rects\n                // will not reflect the final look of the dialog. Note that we're not using #_moveOffScreen() here because\n                // it causes a violent movement of the viewport on iOS (because the dialog still keeps the DOM focus).\n                this._isTransparent = true;\n                // FYI: RAF is too short. We need to wait a bit longer.\n                setTimeout(() => {\n                    this.updatePosition();\n                    this._isTransparent = false;\n                    // The view must get the focus after it gets visible. But this is only possible\n                    // after the dialog is no longer transparent.\n                    this.focus();\n                }, 10);\n            }\n        });\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * Returns the element that should be used as a drag handle.\n     */\n    get dragHandleElement() {\n        // Modals should not be draggable.\n        if (this.headerView && !this.isModal) {\n            return this.headerView.element;\n        }\n        else {\n            return null;\n        }\n    }\n    /**\n     * Creates the dialog parts. Which of them are created depends on the arguments passed to the method.\n     * There are no rules regarding the dialog construction, that is, no part is mandatory.\n     * Each part can only be created once.\n     *\n     * @internal\n     */\n    setupParts({ icon, title, hasCloseButton = true, content, actionButtons }) {\n        if (title) {\n            this.headerView = new FormHeaderView(this.locale, { icon });\n            if (hasCloseButton) {\n                this.closeButtonView = this._createCloseButton();\n                this.headerView.children.add(this.closeButtonView);\n            }\n            this.headerView.label = title;\n            this.ariaLabel = title;\n            this.parts.add(this.headerView, 0);\n        }\n        if (content) {\n            // Normalize the content specified in the arguments.\n            if (content instanceof View) {\n                content = [content];\n            }\n            this.contentView = new DialogContentView(this.locale);\n            this.contentView.children.addMany(content);\n            this.parts.add(this.contentView);\n        }\n        if (actionButtons) {\n            this.actionsView = new DialogActionsView(this.locale);\n            this.actionsView.setButtons(actionButtons);\n            this.parts.add(this.actionsView);\n        }\n        this._updateFocusCyclableItems();\n    }\n    /**\n     * Focuses the first focusable element inside the dialog.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Normalizes the passed coordinates to make sure the dialog view\n     * is displayed within the visible viewport and moves it there.\n     *\n     * @internal\n     */\n    moveTo(left, top) {\n        const viewportRect = this._getViewportRect();\n        const dialogRect = this._getDialogRect();\n        // Don't let the dialog go beyond the right edge of the viewport.\n        if (left + dialogRect.width > viewportRect.right) {\n            left = viewportRect.right - dialogRect.width;\n        }\n        // Don't let the dialog go beyond the left edge of the viewport.\n        if (left < viewportRect.left) {\n            left = viewportRect.left;\n        }\n        // Don't let the dialog go beyond the top edge of the viewport.\n        if (top < viewportRect.top) {\n            top = viewportRect.top;\n        }\n        // Note: We don't do the same for the bottom edge to allow users to resize the window vertically\n        // and let the dialog to stay put instead of covering the editing root.\n        this._moveTo(left, top);\n    }\n    /**\n     * Moves the dialog to the specified coordinates.\n     */\n    _moveTo(left, top) {\n        this._left = left;\n        this._top = top;\n    }\n    /**\n     * Moves the dialog by the specified offset.\n     *\n     * @internal\n     */\n    moveBy(left, top) {\n        this.moveTo(this._left + left, this._top + top);\n    }\n    /**\n     * Moves the dialog view to the off-screen position.\n     * Used when there is no space to display the dialog.\n     */\n    _moveOffScreen() {\n        this._moveTo(-9999, -9999);\n    }\n    /**\n     * Recalculates the dialog according to the set position and viewport,\n     * and moves it to the new position.\n     */\n    updatePosition() {\n        if (!this.element || !this.element.parentNode) {\n            return;\n        }\n        const viewportRect = this._getViewportRect();\n        // Actual position may be different from the configured one if there's no DOM root.\n        let configuredPosition = this.position;\n        let domRootRect;\n        if (!this._getCurrentDomRoot()) {\n            configuredPosition = DialogViewPosition.SCREEN_CENTER;\n        }\n        else {\n            domRootRect = this._getVisibleDomRootRect(viewportRect);\n        }\n        const defaultOffset = DialogView.defaultOffset;\n        const dialogRect = this._getDialogRect();\n        if (this.position == null) {\n            return;\n        }\n        else if (typeof this.position == 'function') {\n            const coords = this.position(dialogRect, domRootRect);\n            if (coords == null) {\n                this._moveOffScreen();\n                return;\n            }\n            this._moveTo(coords.left, coords.top);\n            return;\n        }\n        // @if CK_DEBUG_DIALOG // RectDrawer.clear();\n        // @if CK_DEBUG_DIALOG // RectDrawer.draw( viewportRect, { outlineColor: 'blue' }, 'Viewport' );\n        switch (configuredPosition) {\n            case DialogViewPosition.EDITOR_TOP_SIDE: {\n                // @if CK_DEBUG_DIALOG // if ( domRootRect ) {\n                // @if CK_DEBUG_DIALOG // \tRectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );\n                // @if CK_DEBUG_DIALOG // }\n                if (domRootRect) {\n                    const leftCoordinate = this.locale.contentLanguageDirection === 'ltr' ?\n                        domRootRect.right - dialogRect.width - defaultOffset :\n                        domRootRect.left + defaultOffset;\n                    this.moveTo(leftCoordinate, domRootRect.top + defaultOffset);\n                }\n                else {\n                    this._moveOffScreen();\n                }\n                break;\n            }\n            case DialogViewPosition.EDITOR_CENTER: {\n                if (domRootRect) {\n                    this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), Math.round(domRootRect.top + domRootRect.height / 2 - dialogRect.height / 2));\n                }\n                else {\n                    this._moveOffScreen();\n                }\n                break;\n            }\n            case DialogViewPosition.SCREEN_CENTER: {\n                this.moveTo(Math.round((viewportRect.width - dialogRect.width) / 2), Math.round((viewportRect.height - dialogRect.height) / 2));\n                break;\n            }\n            case DialogViewPosition.EDITOR_TOP_CENTER: {\n                // @if CK_DEBUG_DIALOG // if ( domRootRect ) {\n                // @if CK_DEBUG_DIALOG // \tRectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );\n                // @if CK_DEBUG_DIALOG // }\n                if (domRootRect) {\n                    this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.top + defaultOffset);\n                }\n                else {\n                    this._moveOffScreen();\n                }\n                break;\n            }\n            case DialogViewPosition.EDITOR_BOTTOM_CENTER: {\n                // @if CK_DEBUG_DIALOG // if ( domRootRect ) {\n                // @if CK_DEBUG_DIALOG // \tRectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );\n                // @if CK_DEBUG_DIALOG // }\n                if (domRootRect) {\n                    this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.bottom - dialogRect.height - defaultOffset);\n                }\n                else {\n                    this._moveOffScreen();\n                }\n                break;\n            }\n            case DialogViewPosition.EDITOR_ABOVE_CENTER: {\n                // @if CK_DEBUG_DIALOG // if ( domRootRect ) {\n                // @if CK_DEBUG_DIALOG // \tRectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );\n                // @if CK_DEBUG_DIALOG // }\n                if (domRootRect) {\n                    this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.top - dialogRect.height - defaultOffset);\n                }\n                else {\n                    this._moveOffScreen();\n                }\n                break;\n            }\n            case DialogViewPosition.EDITOR_BELOW_CENTER: {\n                // @if CK_DEBUG_DIALOG // if ( domRootRect ) {\n                // @if CK_DEBUG_DIALOG // \tRectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );\n                // @if CK_DEBUG_DIALOG // }\n                if (domRootRect) {\n                    this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.bottom + defaultOffset);\n                }\n                else {\n                    this._moveOffScreen();\n                }\n                break;\n            }\n        }\n    }\n    /**\n     * Calculates the visible DOM root part.\n     */\n    _getVisibleDomRootRect(viewportRect) {\n        let visibleDomRootRect = new Rect(this._getCurrentDomRoot()).getVisible();\n        if (!visibleDomRootRect) {\n            return null;\n        }\n        else {\n            visibleDomRootRect = viewportRect.getIntersection(visibleDomRootRect);\n            if (!visibleDomRootRect) {\n                return null;\n            }\n        }\n        return visibleDomRootRect;\n    }\n    /**\n     * Calculates the dialog element rect.\n     */\n    _getDialogRect() {\n        return new Rect(this.element.firstElementChild);\n    }\n    /**\n     * Returns a viewport `Rect` shrunk by the viewport offset config from all sides.\n     */\n    _getViewportRect() {\n        const viewportRect = new Rect(global.window);\n        // Modals should not be restricted by the viewport offsets as they are always displayed on top of the page.\n        if (this.isModal) {\n            return viewportRect;\n        }\n        return getConstrainedViewportRect(this._getViewportOffset());\n    }\n    /**\n     * Collects all focusable elements inside the dialog parts\n     * and adds them to the focus tracker and focus cycler.\n     */\n    _updateFocusCyclableItems() {\n        const focusables = [];\n        if (this.contentView) {\n            for (const child of this.contentView.children) {\n                if (isFocusable(child)) {\n                    focusables.push(child);\n                }\n            }\n        }\n        if (this.actionsView) {\n            focusables.push(this.actionsView);\n        }\n        if (this.closeButtonView) {\n            focusables.push(this.closeButtonView);\n        }\n        focusables.forEach(focusable => {\n            this._focusables.add(focusable);\n            this.focusTracker.add(focusable.element);\n            if (isViewWithFocusCycler(focusable)) {\n                this._focusCycler.chain(focusable.focusCycler);\n            }\n        });\n    }\n    /**\n     * Creates the close button view that is displayed in the header view corner.\n     */\n    _createCloseButton() {\n        const buttonView = new ButtonView(this.locale);\n        const t = this.locale.t;\n        buttonView.set({\n            label: t('Close'),\n            tooltip: true,\n            icon: IconCancel\n        });\n        buttonView.on('execute', () => this.fire('close', { source: 'closeButton' }));\n        return buttonView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/placeholder\n */\nimport '../../theme/placeholder.css';\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\n// Each document stores information about its placeholder elements and check functions.\nconst documentPlaceholders = new WeakMap();\nlet hasDisplayedPlaceholderDeprecationWarning = false;\n/**\n * A helper that enables a placeholder on the provided view element (also updates its visibility).\n * The placeholder is a CSS pseudo–element (with a text content) attached to the element.\n *\n * To change the placeholder text, change value of the `placeholder` property in the provided `element`.\n *\n * To disable the placeholder, use {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} helper.\n *\n * @param options Configuration options of the placeholder.\n * @param options.view Editing view instance.\n * @param options.element Element that will gain a placeholder. See `options.isDirectHost` to learn more.\n * @param options.isDirectHost If set `false`, the placeholder will not be enabled directly\n * in the passed `element` but in one of its children (selected automatically, i.e. a first empty child element).\n * Useful when attaching placeholders to elements that can host other elements (not just text), for instance,\n * editable root elements.\n * @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use\n * {@link module:engine/view/placeholder~PlaceholderableViewElement#placeholder `options.element.placeholder`} instead.\n * @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.\n */\nexport function enableViewPlaceholder({ view, element, text, isDirectHost = true, keepOnFocus = false }) {\n    const doc = view.document;\n    // Use a single post fixer per—document to update all placeholders.\n    if (!documentPlaceholders.has(doc)) {\n        documentPlaceholders.set(doc, new Map());\n        // If a post-fixer callback makes a change, it should return `true` so other post–fixers\n        // can re–evaluate the document again.\n        doc.registerPostFixer(writer => updateDocumentPlaceholders(documentPlaceholders.get(doc), writer));\n        // Update placeholders on isComposing state change since rendering is disabled while in composition mode.\n        doc.on('change:isComposing', () => {\n            view.change(writer => updateDocumentPlaceholders(documentPlaceholders.get(doc), writer));\n        }, { priority: 'high' });\n    }\n    if (element.is('editableElement')) {\n        element.on('change:placeholder', (evtInfo, evt, text) => setPlaceholder(text));\n    }\n    if (element.placeholder) {\n        setPlaceholder(element.placeholder);\n    }\n    else if (text) {\n        setPlaceholder(text);\n    }\n    if (text) {\n        showViewPlaceholderTextDeprecationWarning();\n    }\n    function setPlaceholder(text) {\n        const config = {\n            text,\n            isDirectHost,\n            keepOnFocus,\n            hostElement: isDirectHost ? element : null\n        };\n        // Store information about the element placeholder under its document.\n        documentPlaceholders.get(doc).set(element, config);\n        // Update the placeholders right away.\n        view.change(writer => updateDocumentPlaceholders([[element, config]], writer));\n    }\n}\n/**\n * Disables the placeholder functionality from a given element.\n *\n * See {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} to learn more.\n */\nexport function disableViewPlaceholder(view, element) {\n    const doc = element.document;\n    if (!documentPlaceholders.has(doc)) {\n        return;\n    }\n    view.change(writer => {\n        const placeholders = documentPlaceholders.get(doc);\n        const config = placeholders.get(element);\n        writer.removeAttribute('data-placeholder', config.hostElement);\n        hideViewPlaceholder(writer, config.hostElement);\n        placeholders.delete(element);\n    });\n}\n/**\n * Shows a placeholder in the provided element by changing related attributes and CSS classes.\n *\n * **Note**: This helper will not update the placeholder visibility nor manage the\n * it in any way in the future. What it does is a one–time state change of an element. Use\n * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} and\n * {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} for full\n * placeholder functionality.\n *\n * **Note**: This helper will blindly show the placeholder directly in the root editable element if\n * one is passed, which could result in a visual clash if the editable element has some children\n * (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`}\n * in that case or make sure the correct element is passed to the helper.\n *\n * @returns `true`, if any changes were made to the `element`.\n */\nexport function showViewPlaceholder(writer, element) {\n    if (!element.hasClass('ck-placeholder')) {\n        writer.addClass('ck-placeholder', element);\n        return true;\n    }\n    return false;\n}\n/**\n * Hides a placeholder in the element by changing related attributes and CSS classes.\n *\n * **Note**: This helper will not update the placeholder visibility nor manage the\n * it in any way in the future. What it does is a one–time state change of an element. Use\n * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} and\n * {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} for full\n * placeholder functionality.\n *\n * @returns `true`, if any changes were made to the `element`.\n */\nexport function hideViewPlaceholder(writer, element) {\n    if (element.hasClass('ck-placeholder')) {\n        writer.removeClass('ck-placeholder', element);\n        return true;\n    }\n    return false;\n}\n/**\n * Checks if a placeholder should be displayed in the element.\n *\n * **Note**: This helper will blindly check the possibility of showing a placeholder directly in the\n * root editable element if one is passed, which may not be the expected result. If an element can\n * host other elements (not just text), most likely one of its children should be checked instead\n * because it will be the final host for the placeholder. Use\n * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} in that case or make\n * sure the correct element is passed to the helper.\n *\n * @param element Element that holds the placeholder.\n * @param keepOnFocus Focusing the element will keep the placeholder visible.\n */\nexport function needsViewPlaceholder(element, keepOnFocus) {\n    if (!element.isAttached()) {\n        return false;\n    }\n    if (hasContent(element)) {\n        return false;\n    }\n    const doc = element.document;\n    const viewSelection = doc.selection;\n    const selectionAnchor = viewSelection.anchor;\n    if (doc.isComposing && selectionAnchor && selectionAnchor.parent === element) {\n        return false;\n    }\n    // Skip the focus check and make the placeholder visible already regardless of document focus state.\n    if (keepOnFocus) {\n        return true;\n    }\n    // If the document is blurred.\n    if (!doc.isFocused) {\n        return true;\n    }\n    // If document is focused and the element is empty but the selection is not anchored inside it.\n    return !!selectionAnchor && selectionAnchor.parent !== element;\n}\n/**\n * Anything but uiElement(s) counts as content.\n */\nfunction hasContent(element) {\n    for (const child of element.getChildren()) {\n        if (!child.is('uiElement')) {\n            return true;\n        }\n    }\n    return false;\n}\n/**\n * Updates all placeholders associated with a document in a post–fixer callback.\n *\n * @returns True if any changes were made to the view document.\n */\nfunction updateDocumentPlaceholders(placeholders, writer) {\n    const directHostElements = [];\n    let wasViewModified = false;\n    // First set placeholders on the direct hosts.\n    for (const [element, config] of placeholders) {\n        if (config.isDirectHost) {\n            directHostElements.push(element);\n            if (updatePlaceholder(writer, element, config)) {\n                wasViewModified = true;\n            }\n        }\n    }\n    // Then set placeholders on the indirect hosts but only on those that does not already have an direct host placeholder.\n    for (const [element, config] of placeholders) {\n        if (config.isDirectHost) {\n            continue;\n        }\n        const hostElement = getChildPlaceholderHostSubstitute(element);\n        // If host element changed, remove the placeholder from the previous one.\n        // This can happen when user replaces the first child element of the parent element\n        // with new one, but the previous one is still in the view tree.\n        // See:\n        // https://github.com/ckeditor/ckeditor5/issues/14354\n        // https://github.com/ckeditor/ckeditor5/issues/18149\n        if (hostElement !== config.hostElement && config.hostElement) {\n            writer.removeAttribute('data-placeholder', config.hostElement);\n            hideViewPlaceholder(writer, config.hostElement);\n            config.hostElement = null;\n            wasViewModified = true;\n        }\n        // When not a direct host, it could happen that there is no child element\n        // capable of displaying a placeholder.\n        if (!hostElement) {\n            continue;\n        }\n        // Don't override placeholder if the host element already has some direct placeholder.\n        if (directHostElements.includes(hostElement)) {\n            continue;\n        }\n        // Update the host element (used for setting and removing the placeholder).\n        config.hostElement = hostElement;\n        if (updatePlaceholder(writer, element, config)) {\n            wasViewModified = true;\n        }\n    }\n    return wasViewModified;\n}\n/**\n * Updates a single placeholder in a post–fixer callback.\n *\n * @returns True if any changes were made to the view document.\n */\nfunction updatePlaceholder(writer, element, config) {\n    const { text, isDirectHost, hostElement } = config;\n    let wasViewModified = false;\n    // This may be necessary when updating the placeholder text to something else.\n    if (hostElement.getAttribute('data-placeholder') !== text) {\n        writer.setAttribute('data-placeholder', text, hostElement);\n        wasViewModified = true;\n    }\n    // If the host element is not a direct host then placeholder is needed only when there is only one element.\n    const isOnlyChild = isDirectHost || element.childCount == 1;\n    if (isOnlyChild && needsViewPlaceholder(hostElement, config.keepOnFocus)) {\n        if (showViewPlaceholder(writer, hostElement)) {\n            wasViewModified = true;\n        }\n    }\n    else if (hideViewPlaceholder(writer, hostElement)) {\n        wasViewModified = true;\n    }\n    return wasViewModified;\n}\n/**\n * Gets a child element capable of displaying a placeholder if a parent element can host more\n * than just text (for instance, when it is a root editable element). The child element\n * can then be used in other placeholder helpers as a substitute of its parent.\n */\nfunction getChildPlaceholderHostSubstitute(parent) {\n    if (parent.childCount) {\n        const firstChild = parent.getChild(0);\n        if (firstChild.is('element') && !firstChild.is('uiElement') && !firstChild.is('attributeElement')) {\n            return firstChild;\n        }\n    }\n    return null;\n}\n/**\n * Displays a deprecation warning message in the console, but only once per page load.\n */\nfunction showViewPlaceholderTextDeprecationWarning() {\n    if (!hasDisplayedPlaceholderDeprecationWarning) {\n        /**\n         * The \"text\" option in the {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`}\n         * function is deprecated and will be removed soon.\n         *\n         * See the {@glink updating/guides/update-to-39#view-element-placeholder Migration to v39} guide for\n         * more information on how to apply this change.\n         *\n         * @error enableViewPlaceholder-deprecated-text-option\n         */\n        logWarning('enableViewPlaceholder-deprecated-text-option');\n    }\n    hasDisplayedPlaceholderDeprecationWarning = true;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/typecheckable\n */\nexport class ViewTypeCheckable {\n    /* istanbul ignore next -- @preserve */\n    is() {\n        // There are a lot of overloads above.\n        // Overriding method in derived classes remove them and only `is( type: string ): boolean` is visible which we don't want.\n        // One option would be to copy them all to all classes, but that's ugly.\n        // It's best when TypeScript compiler doesn't see those overloads, except the one in the top base class.\n        // To overload a method, but not let the compiler see it, do after class definition:\n        // `MyClass.prototype.is = function( type: string ) {...}`\n        throw new Error('is() method is abstract');\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/node\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { CKEditorError, EmitterMixin, compareArrays } from '@ckeditor/ckeditor5-utils';\n/**\n * Abstract view node class.\n *\n * This is an abstract class. Its constructor should not be used directly.\n * Use the {@link module:engine/view/downcastwriter~ViewDowncastWriter} or {@link module:engine/view/upcastwriter~ViewUpcastWriter}\n * to create new instances of view nodes.\n */\nexport class ViewNode extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {\n    /**\n     * The document instance to which this node belongs.\n     */\n    document;\n    /**\n     * Parent element. Null by default. Set by {@link module:engine/view/element~ViewElement#_insertChild}.\n     */\n    parent;\n    /**\n     * Creates a tree view node.\n     *\n     * @param document The document instance to which this node belongs.\n     */\n    constructor(document) {\n        super();\n        this.document = document;\n        this.parent = null;\n    }\n    /**\n     * Index of the node in the parent element or null if the node has no parent.\n     *\n     * Accessing this property throws an error if this node's parent element does not contain it.\n     * This means that view tree got broken.\n     */\n    get index() {\n        let pos;\n        if (!this.parent) {\n            return null;\n        }\n        // No parent or child doesn't exist in parent's children.\n        if ((pos = this.parent.getChildIndex(this)) == -1) {\n            /**\n             * The node's parent does not contain this node. It means that the document tree is corrupted.\n             *\n             * @error view-node-not-found-in-parent\n             */\n            throw new CKEditorError('view-node-not-found-in-parent', this);\n        }\n        return pos;\n    }\n    /**\n     * Node's next sibling, or `null` if it is the last child.\n     */\n    get nextSibling() {\n        const index = this.index;\n        return (index !== null && this.parent.getChild(index + 1)) || null;\n    }\n    /**\n     * Node's previous sibling, or `null` if it is the first child.\n     */\n    get previousSibling() {\n        const index = this.index;\n        return (index !== null && this.parent.getChild(index - 1)) || null;\n    }\n    /**\n     * Top-most ancestor of the node. If the node has no parent it is the root itself.\n     */\n    get root() {\n        // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n        let root = this;\n        while (root.parent) {\n            root = root.parent;\n        }\n        return root;\n    }\n    /**\n     * Returns true if the node is in a tree rooted in the document (is a descendant of one of its roots).\n     */\n    isAttached() {\n        return this.root.is('rootElement');\n    }\n    /**\n     * Gets a path to the node. The path is an array containing indices of consecutive ancestors of this node,\n     * beginning from {@link module:engine/view/node~ViewNode#root root}, down to this node's index.\n     *\n     * ```ts\n     * const abc = downcastWriter.createText( 'abc' );\n     * const foo = downcastWriter.createText( 'foo' );\n     * const h1 = downcastWriter.createElement( 'h1', null, downcastWriter.createText( 'header' ) );\n     * const p = downcastWriter.createElement( 'p', null, [ abc, foo ] );\n     * const div = downcastWriter.createElement( 'div', null, [ h1, p ] );\n     * foo.getPath(); // Returns [ 1, 3 ]. `foo` is in `p` which is in `div`. `p` starts at offset 1, while `foo` at 3.\n     * h1.getPath(); // Returns [ 0 ].\n     * div.getPath(); // Returns [].\n     * ```\n     *\n     * @returns The path.\n     */\n    getPath() {\n        const path = [];\n        // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n        let node = this;\n        while (node.parent) {\n            path.unshift(node.index);\n            node = node.parent;\n        }\n        return path;\n    }\n    /**\n     * Returns ancestors array of this node.\n     *\n     * @param options Options object.\n     * @param options.includeSelf When set to `true` this node will be also included in parent's array.\n     * @param options.parentFirst When set to `true`, array will be sorted from node's parent to root element,\n     * otherwise root element will be the first item in the array.\n     * @returns Array with ancestors.\n     */\n    getAncestors(options = {}) {\n        const ancestors = [];\n        let parent = options.includeSelf ? this : this.parent;\n        while (parent) {\n            ancestors[options.parentFirst ? 'push' : 'unshift'](parent);\n            parent = parent.parent;\n        }\n        return ancestors;\n    }\n    /**\n     * Returns a {@link module:engine/view/element~ViewElement} or {@link module:engine/view/documentfragment~ViewDocumentFragment}\n     * which is a common ancestor of both nodes.\n     *\n     * @param node The second node.\n     * @param options Options object.\n     * @param options.includeSelf When set to `true` both nodes will be considered \"ancestors\" too.\n     * Which means that if e.g. node A is inside B, then their common ancestor will be B.\n     */\n    getCommonAncestor(node, options = {}) {\n        const ancestorsA = this.getAncestors(options);\n        const ancestorsB = node.getAncestors(options);\n        let i = 0;\n        while (ancestorsA[i] == ancestorsB[i] && ancestorsA[i]) {\n            i++;\n        }\n        return i === 0 ? null : ancestorsA[i - 1];\n    }\n    /**\n     * Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,\n     * in different {@link module:engine/view/documentfragment~ViewDocumentFragment}s).\n     *\n     * @param node Node to compare with.\n     */\n    isBefore(node) {\n        // Given node is not before this node if they are same.\n        if (this == node) {\n            return false;\n        }\n        // Return `false` if it is impossible to compare nodes.\n        if (this.root !== node.root) {\n            return false;\n        }\n        const thisPath = this.getPath();\n        const nodePath = node.getPath();\n        const result = compareArrays(thisPath, nodePath);\n        switch (result) {\n            case 'prefix':\n                return true;\n            case 'extension':\n                return false;\n            default:\n                return thisPath[result] < nodePath[result];\n        }\n    }\n    /**\n     * Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,\n     * in different {@link module:engine/view/documentfragment~ViewDocumentFragment}s).\n     *\n     * @param node Node to compare with.\n     */\n    isAfter(node) {\n        // Given node is not before this node if they are same.\n        if (this == node) {\n            return false;\n        }\n        // Return `false` if it is impossible to compare nodes.\n        if (this.root !== node.root) {\n            return false;\n        }\n        // In other cases, just check if the `node` is before, and return the opposite.\n        return !this.isBefore(node);\n    }\n    /**\n     * Removes node from parent.\n     *\n     * @internal\n     */\n    _remove() {\n        this.parent._removeChildren(this.index);\n    }\n    /**\n     * @internal\n     * @param type Type of the change.\n     * @param node Changed node.\n     * @param data Additional data.\n     * @fires change\n     */\n    _fireChange(type, node, data) {\n        this.fire(`change:${type}`, node, data);\n        if (this.parent) {\n            this.parent._fireChange(type, node, data);\n        }\n    }\n    /**\n     * Converts `ViewNode` to plain object and returns it.\n     *\n     * @returns `ViewNode` converted to plain object.\n     */\n    toJSON() {\n        const json = {\n            path: this.getPath(),\n            type: 'Node'\n        };\n        if (this !== this.root && this.root.is('rootElement')) {\n            json.root = this.root.toJSON();\n        }\n        return json;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewNode.prototype.is = function (type) {\n    return type === 'node' || type === 'view:node';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/text\n */\nimport { ViewNode } from './node.js';\n/**\n * Tree view text node.\n *\n * The constructor of this class should not be used directly. To create a new text node instance\n * use the {@link module:engine/view/downcastwriter~ViewDowncastWriter#createText `ViewDowncastWriter#createText()`}\n * method when working on data downcasted from the model or the\n * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createText `ViewUpcastWriter#createText()`}\n * method when working on non-semantic views.\n */\nexport class ViewText extends ViewNode {\n    /**\n     * The text content.\n     *\n     * Setting the data fires the {@link module:engine/view/node~ViewNode#event:change:text change event}.\n     */\n    _textData;\n    /**\n     * Creates a tree view text node.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createText\n     * @internal\n     * @param document The document instance to which this text node belongs.\n     * @param data The text's data.\n     */\n    constructor(document, data) {\n        super(document);\n        this._textData = data;\n    }\n    /**\n     * The text content.\n     */\n    get data() {\n        return this._textData;\n    }\n    /**\n     * The `_data` property is controlled by a getter and a setter.\n     *\n     * The getter is required when using the addition assignment operator on protected property:\n     *\n     * ```ts\n     * const foo = downcastWriter.createText( 'foo' );\n     * const bar = downcastWriter.createText( 'bar' );\n     *\n     * foo._data += bar.data;   // executes: `foo._data = foo._data + bar.data`\n     * console.log( foo.data ); // prints: 'foobar'\n     * ```\n     *\n     * If the protected getter didn't exist, `foo._data` will return `undefined` and result of the merge will be invalid.\n     *\n     * The setter sets data and fires the {@link module:engine/view/node~ViewNode#event:change:text change event}.\n     *\n     * @internal\n     */\n    get _data() {\n        return this.data;\n    }\n    set _data(data) {\n        this._fireChange('text', this);\n        this._textData = data;\n    }\n    /**\n     * Checks if this text node is similar to other text node.\n     * Both nodes should have the same data to be considered as similar.\n     *\n     * @param otherNode Node to check if it is same as this node.\n     */\n    isSimilar(otherNode) {\n        if (!(otherNode instanceof ViewText)) {\n            return false;\n        }\n        return this === otherNode || this.data === otherNode.data;\n    }\n    /**\n     * Converts `ViewText` instance to plain object and returns it.\n     *\n     * @returns `ViewText` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'Text';\n        json.data = this.data;\n        return json;\n    }\n    /**\n     * Clones this node.\n     *\n     * @internal\n     * @returns Text node that is a clone of this node.\n     */\n    _clone() {\n        return new ViewText(this.document, this.data);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewText.prototype.is = function (type) {\n    return type === '$text' || type === 'view:$text' ||\n        // This are legacy values kept for backward compatibility.\n        type === 'text' || type === 'view:text' ||\n        // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n        type === 'node' || type === 'view:node';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/textproxy\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * ViewTextProxy is a wrapper for substring of {@link module:engine/view/text~ViewText}. Instance of this class is created by\n * {@link module:engine/view/treewalker~ViewTreeWalker} when only a part of {@link module:engine/view/text~ViewText} needs to be returned.\n *\n * `ViewTextProxy` has an API similar to {@link module:engine/view/text~ViewText Text} and allows to do most of the common tasks performed\n * on view nodes.\n *\n * **Note:** Some `ViewTextProxy` instances may represent whole text node, not just a part of it.\n * See {@link module:engine/view/textproxy~ViewTextProxy#isPartial}.\n *\n * **Note:** `ViewTextProxy` is a readonly interface.\n *\n * **Note:** `ViewTextProxy` instances are created on the fly basing\n * on the current state of parent {@link module:engine/view/text~ViewText}.\n * Because of this it is highly unrecommended to store references to `TextProxy instances because they might get\n * invalidated due to operations on Document. Also ViewTextProxy is not a {@link module:engine/view/node~ViewNode} so it cannot be\n * inserted as a child of {@link module:engine/view/element~ViewElement}.\n *\n * `ViewTextProxy` instances are created by {@link module:engine/view/treewalker~ViewTreeWalker view tree walker}.\n * You should not need to create an instance of this class by your own.\n */\nexport class ViewTextProxy extends ViewTypeCheckable {\n    /**\n     * Reference to the {@link module:engine/view/text~ViewText} element which ViewTextProxy is a substring.\n     */\n    textNode;\n    /**\n     * Text data represented by this text proxy.\n     */\n    data;\n    /**\n     * Offset in the `textNode` where this `ViewTextProxy` instance starts.\n     */\n    offsetInText;\n    /**\n     * Creates a text proxy.\n     *\n     * @internal\n     * @param textNode Text node which part is represented by this text proxy.\n     * @param offsetInText Offset in {@link module:engine/view/textproxy~ViewTextProxy#textNode text node}\n     * from which the text proxy starts.\n     * @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.\n     */\n    constructor(textNode, offsetInText, length) {\n        super();\n        this.textNode = textNode;\n        if (offsetInText < 0 || offsetInText > textNode.data.length) {\n            /**\n             * Given offsetInText value is incorrect.\n             *\n             * @error view-textproxy-wrong-offsetintext\n             */\n            throw new CKEditorError('view-textproxy-wrong-offsetintext', this);\n        }\n        if (length < 0 || offsetInText + length > textNode.data.length) {\n            /**\n             * Given length value is incorrect.\n             *\n             * @error view-textproxy-wrong-length\n             */\n            throw new CKEditorError('view-textproxy-wrong-length', this);\n        }\n        this.data = textNode.data.substring(offsetInText, offsetInText + length);\n        this.offsetInText = offsetInText;\n    }\n    /**\n     * Offset size of this node.\n     */\n    get offsetSize() {\n        return this.data.length;\n    }\n    /**\n     * Flag indicating whether `ViewTextProxy` instance covers only part of the original {@link module:engine/view/text~ViewText text node}\n     * (`true`) or the whole text node (`false`).\n     *\n     * This is `false` when text proxy starts at the very beginning of {@link module:engine/view/textproxy~ViewTextProxy#textNode textNode}\n     * ({@link module:engine/view/textproxy~ViewTextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to\n     * text node size.\n     */\n    get isPartial() {\n        return this.data.length !== this.textNode.data.length;\n    }\n    /**\n     * Parent of this text proxy, which is same as parent of text node represented by this text proxy.\n     */\n    get parent() {\n        return this.textNode.parent;\n    }\n    /**\n     * Root of this text proxy, which is same as root of text node represented by this text proxy.\n     */\n    get root() {\n        return this.textNode.root;\n    }\n    /**\n     * {@link module:engine/view/document~ViewDocument View document} that owns this text proxy, or `null` if the text proxy is inside\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.\n     */\n    get document() {\n        return this.textNode.document;\n    }\n    /**\n     * Returns ancestors array of this text proxy.\n     *\n     * @param options Options object.\n     * @param options.includeSelf When set to `true`, textNode will be also included in parent's array.\n     * @param options.parentFirst When set to `true`, array will be sorted from text proxy parent to\n     * root element, otherwise root element will be the first item in the array.\n     * @returns Array with ancestors.\n     */\n    getAncestors(options = {}) {\n        const ancestors = [];\n        let parent = options.includeSelf ? this.textNode : this.parent;\n        while (parent !== null) {\n            ancestors[options.parentFirst ? 'push' : 'unshift'](parent);\n            parent = parent.parent;\n        }\n        return ancestors;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewTextProxy.prototype.is = function (type) {\n    return type === '$textProxy' || type === 'view:$textProxy' ||\n        // This are legacy values kept for backward compatibility.\n        type === 'textProxy' || type === 'view:textProxy';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/viewconsumable\n */\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Class used for handling consumption of view {@link module:engine/view/element~ViewElement elements},\n * {@link module:engine/view/text~ViewText text nodes} and\n * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragments}.\n * Element's name and its parts (attributes, classes and styles) can be consumed separately. Consuming an element's name\n * does not consume its attributes, classes and styles.\n * To add items for consumption use {@link module:engine/conversion/viewconsumable~ViewConsumable#add add method}.\n * To test items use {@link module:engine/conversion/viewconsumable~ViewConsumable#test test method}.\n * To consume items use {@link module:engine/conversion/viewconsumable~ViewConsumable#consume consume method}.\n * To revert already consumed items use {@link module:engine/conversion/viewconsumable~ViewConsumable#revert revert method}.\n *\n * ```ts\n * viewConsumable.add( element, { name: true } ); // Adds element's name as ready to be consumed.\n * viewConsumable.add( textNode ); // Adds text node for consumption.\n * viewConsumable.add( docFragment ); // Adds document fragment for consumption.\n * viewConsumable.test( element, { name: true }  ); // Tests if element's name can be consumed.\n * viewConsumable.test( textNode ); // Tests if text node can be consumed.\n * viewConsumable.test( docFragment ); // Tests if document fragment can be consumed.\n * viewConsumable.consume( element, { name: true }  ); // Consume element's name.\n * viewConsumable.consume( textNode ); // Consume text node.\n * viewConsumable.consume( docFragment ); // Consume document fragment.\n * viewConsumable.revert( element, { name: true }  ); // Revert already consumed element's name.\n * viewConsumable.revert( textNode ); // Revert already consumed text node.\n * viewConsumable.revert( docFragment ); // Revert already consumed document fragment.\n * ```\n */\nexport class ViewConsumable {\n    /**\n     * Map of consumable elements. If {@link module:engine/view/element~ViewElement element} is used as a key,\n     * {@link module:engine/conversion/viewconsumable~ViewElementConsumables ViewElementConsumables} instance is stored as value.\n     * For {@link module:engine/view/text~ViewText text nodes} and\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragments} boolean value is stored as value.\n     */\n    _consumables = new Map();\n    /**\n     * Adds view {@link module:engine/view/element~ViewElement element}, {@link module:engine/view/text~ViewText text node} or\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} as ready to be consumed.\n     *\n     * ```ts\n     * viewConsumable.add( p, { name: true } ); // Adds element's name to consume.\n     * viewConsumable.add( p, { attributes: 'name' } ); // Adds element's attribute.\n     * viewConsumable.add( p, { classes: 'foobar' } ); // Adds element's class.\n     * viewConsumable.add( p, { styles: 'color' } ); // Adds element's style\n     * viewConsumable.add( p, { attributes: 'name', styles: 'color' } ); // Adds attribute and style.\n     * viewConsumable.add( p, { classes: [ 'baz', 'bar' ] } ); // Multiple consumables can be provided.\n     * viewConsumable.add( textNode ); // Adds text node to consume.\n     * viewConsumable.add( docFragment ); // Adds document fragment to consume.\n     * ```\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`\n     * attribute is provided - it should be handled separately by providing actual style/class.\n     *\n     * ```ts\n     * viewConsumable.add( p, { attributes: 'style' } ); // This call will throw an exception.\n     * viewConsumable.add( p, { styles: 'color' } ); // This is properly handled style.\n     * ```\n     *\n     * @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.\n     * @param consumables.name If set to true element's name will be included.\n     * @param consumables.attributes Attribute name or array of attribute names.\n     * @param consumables.classes Class name or array of class names.\n     * @param consumables.styles Style name or array of style names.\n     */\n    add(element, consumables) {\n        let elementConsumables;\n        // For text nodes and document fragments just mark them as consumable.\n        if (element.is('$text') || element.is('documentFragment')) {\n            this._consumables.set(element, true);\n            return;\n        }\n        // For elements create new ViewElementConsumables or update already existing one.\n        if (!this._consumables.has(element)) {\n            elementConsumables = new ViewElementConsumables(element);\n            this._consumables.set(element, elementConsumables);\n        }\n        else {\n            elementConsumables = this._consumables.get(element);\n        }\n        elementConsumables.add(consumables ? normalizeConsumables(consumables) : element._getConsumables());\n    }\n    /**\n     * Tests if {@link module:engine/view/element~ViewElement view element}, {@link module:engine/view/text~ViewText text node} or\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} can be consumed.\n     * It returns `true` when all items included in method's call can be consumed. Returns `false` when\n     * first already consumed item is found and `null` when first non-consumable item is found.\n     *\n     * ```ts\n     * viewConsumable.test( p, { name: true } ); // Tests element's name.\n     * viewConsumable.test( p, { attributes: 'name' } ); // Tests attribute.\n     * viewConsumable.test( p, { classes: 'foobar' } ); // Tests class.\n     * viewConsumable.test( p, { styles: 'color' } ); // Tests style.\n     * viewConsumable.test( p, { attributes: 'name', styles: 'color' } ); // Tests attribute and style.\n     * viewConsumable.test( p, { classes: [ 'baz', 'bar' ] } ); // Multiple consumables can be tested.\n     * viewConsumable.test( textNode ); // Tests text node.\n     * viewConsumable.test( docFragment ); // Tests document fragment.\n     * ```\n     *\n     * Testing classes and styles as attribute will test if all added classes/styles can be consumed.\n     *\n     * ```ts\n     * viewConsumable.test( p, { attributes: 'class' } ); // Tests if all added classes can be consumed.\n     * viewConsumable.test( p, { attributes: 'style' } ); // Tests if all added styles can be consumed.\n     * ```\n     *\n     * @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.\n     * @param consumables.name If set to true element's name will be included.\n     * @param consumables.attributes Attribute name or array of attribute names.\n     * @param consumables.classes Class name or array of class names.\n     * @param consumables.styles Style name or array of style names.\n     * @returns Returns `true` when all items included in method's call can be consumed. Returns `false`\n     * when first already consumed item is found and `null` when first non-consumable item is found.\n     */\n    test(element, consumables) {\n        const elementConsumables = this._consumables.get(element);\n        if (elementConsumables === undefined) {\n            return null;\n        }\n        // For text nodes and document fragments return stored boolean value.\n        if (element.is('$text') || element.is('documentFragment')) {\n            return elementConsumables;\n        }\n        // For elements test consumables object.\n        return elementConsumables.test(normalizeConsumables(consumables));\n    }\n    /**\n     * Consumes {@link module:engine/view/element~ViewElement view element}, {@link module:engine/view/text~ViewText text node} or\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.\n     * It returns `true` when all items included in method's call can be consumed, otherwise returns `false`.\n     *\n     * ```ts\n     * viewConsumable.consume( p, { name: true } ); // Consumes element's name.\n     * viewConsumable.consume( p, { attributes: 'name' } ); // Consumes element's attribute.\n     * viewConsumable.consume( p, { classes: 'foobar' } ); // Consumes element's class.\n     * viewConsumable.consume( p, { styles: 'color' } ); // Consumes element's style.\n     * viewConsumable.consume( p, { attributes: 'name', styles: 'color' } ); // Consumes attribute and style.\n     * viewConsumable.consume( p, { classes: [ 'baz', 'bar' ] } ); // Multiple consumables can be consumed.\n     * viewConsumable.consume( textNode ); // Consumes text node.\n     * viewConsumable.consume( docFragment ); // Consumes document fragment.\n     * ```\n     *\n     * Consuming classes and styles as attribute will test if all added classes/styles can be consumed.\n     *\n     * ```ts\n     * viewConsumable.consume( p, { attributes: 'class' } ); // Consume only if all added classes can be consumed.\n     * viewConsumable.consume( p, { attributes: 'style' } ); // Consume only if all added styles can be consumed.\n     * ```\n     *\n     * @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.\n     * @param consumables.name If set to true element's name will be included.\n     * @param consumables.attributes Attribute name or array of attribute names.\n     * @param consumables.classes Class name or array of class names.\n     * @param consumables.styles Style name or array of style names.\n     * @returns Returns `true` when all items included in method's call can be consumed,\n     * otherwise returns `false`.\n     */\n    consume(element, consumables) {\n        if (element.is('$text') || element.is('documentFragment')) {\n            if (!this.test(element, consumables)) {\n                return false;\n            }\n            // For text nodes and document fragments set value to false.\n            this._consumables.set(element, false);\n            return true;\n        }\n        // For elements - consume consumables object.\n        const elementConsumables = this._consumables.get(element);\n        if (elementConsumables === undefined) {\n            return false;\n        }\n        return elementConsumables.consume(normalizeConsumables(consumables));\n    }\n    /**\n     * Reverts {@link module:engine/view/element~ViewElement view element}, {@link module:engine/view/text~ViewText text node} or\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} so they can be consumed once again.\n     * Method does not revert items that were never previously added for consumption, even if they are included in\n     * method's call.\n     *\n     * ```ts\n     * viewConsumable.revert( p, { name: true } ); // Reverts element's name.\n     * viewConsumable.revert( p, { attributes: 'name' } ); // Reverts element's attribute.\n     * viewConsumable.revert( p, { classes: 'foobar' } ); // Reverts element's class.\n     * viewConsumable.revert( p, { styles: 'color' } ); // Reverts element's style.\n     * viewConsumable.revert( p, { attributes: 'name', styles: 'color' } ); // Reverts attribute and style.\n     * viewConsumable.revert( p, { classes: [ 'baz', 'bar' ] } ); // Multiple names can be reverted.\n     * viewConsumable.revert( textNode ); // Reverts text node.\n     * viewConsumable.revert( docFragment ); // Reverts document fragment.\n     * ```\n     *\n     * Reverting classes and styles as attribute will revert all classes/styles that were previously added for\n     * consumption.\n     *\n     * ```ts\n     * viewConsumable.revert( p, { attributes: 'class' } ); // Reverts all classes added for consumption.\n     * viewConsumable.revert( p, { attributes: 'style' } ); // Reverts all styles added for consumption.\n     * ```\n     *\n     * @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.\n     * @param consumables.name If set to true element's name will be included.\n     * @param consumables.attributes Attribute name or array of attribute names.\n     * @param consumables.classes Class name or array of class names.\n     * @param consumables.styles Style name or array of style names.\n     */\n    revert(element, consumables) {\n        const elementConsumables = this._consumables.get(element);\n        if (elementConsumables !== undefined) {\n            if (element.is('$text') || element.is('documentFragment')) {\n                // For text nodes and document fragments - set consumable to true.\n                this._consumables.set(element, true);\n            }\n            else {\n                // For elements - revert items from consumables object.\n                elementConsumables.revert(normalizeConsumables(consumables));\n            }\n        }\n    }\n    /**\n     * Creates {@link module:engine/conversion/viewconsumable~ViewConsumable ViewConsumable} instance from\n     * {@link module:engine/view/node~ViewNode node} or {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.\n     * Instance will contain all elements, child nodes, attributes, styles and classes added for consumption.\n     *\n     * @param from View node or document fragment from which `ViewConsumable` will be created.\n     * @param instance If provided, given `ViewConsumable` instance will be used\n     * to add all consumables. It will be returned instead of a new instance.\n     */\n    static createFrom(from, instance) {\n        if (!instance) {\n            instance = new ViewConsumable();\n        }\n        if (from.is('$text')) {\n            instance.add(from);\n        }\n        else if (from.is('element') || from.is('documentFragment')) {\n            instance.add(from);\n            for (const child of from.getChildren()) {\n                ViewConsumable.createFrom(child, instance);\n            }\n        }\n        return instance;\n    }\n}\n/**\n * This is a private helper-class for {@link module:engine/conversion/viewconsumable~ViewConsumable}.\n * It represents and manipulates consumable parts of a single {@link module:engine/view/element~ViewElement}.\n *\n * @internal\n */\nexport class ViewElementConsumables {\n    element;\n    /**\n     * Flag indicating if name of the element can be consumed.\n     */\n    _canConsumeName = null;\n    /**\n     * A map of element's consumables.\n     * * For plain attributes the value is a boolean indicating whether the attribute is available to consume.\n     * * For token based attributes (like class list and style) the value is a map of tokens to booleans\n     * indicating whether the token is available to consume on the given attribute.\n     */\n    _attributes = new Map();\n    /**\n     * Creates ViewElementConsumables instance.\n     *\n     * @param from View element from which `ViewElementConsumables` is being created.\n     */\n    constructor(from) {\n        this.element = from;\n    }\n    /**\n     * Adds consumable parts of the {@link module:engine/view/element~ViewElement view element}.\n     * Element's name itself can be marked to be consumed (when element's name is consumed its attributes, classes and\n     * styles still could be consumed):\n     *\n     * ```ts\n     * consumables.add( { name: true } );\n     * ```\n     *\n     * Attributes classes and styles:\n     *\n     * ```ts\n     * consumables.add( { attributes: [ [ 'title' ], [ 'class', 'foo' ], [ 'style', 'color'] ] } );\n     * consumables.add( { attributes: [ [ 'title' ], [ 'name' ], [ 'class', 'foo' ], [ 'class', 'bar' ] ] } );\n     * ```\n     *\n     * Note: This method accepts only {@link module:engine/view/element~ViewNormalizedConsumables}.\n     * You can use {@link module:engine/conversion/viewconsumable~normalizeConsumables} helper to convert from\n     * {@link module:engine/conversion/viewconsumable~Consumables} to `ViewNormalizedConsumables`.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`\n     * attribute is provided - it should be handled separately by providing `style` and `class` in consumables object.\n     *\n     * @param consumables Object describing which parts of the element can be consumed.\n     */\n    add(consumables) {\n        if (consumables.name) {\n            this._canConsumeName = true;\n        }\n        for (const [name, token] of consumables.attributes) {\n            if (token) {\n                let attributeTokens = this._attributes.get(name);\n                if (!attributeTokens || typeof attributeTokens == 'boolean') {\n                    attributeTokens = new Map();\n                    this._attributes.set(name, attributeTokens);\n                }\n                attributeTokens.set(token, true);\n            }\n            else if (name == 'style' || name == 'class') {\n                /**\n                 * Class and style attributes should be handled separately in\n                 * {@link module:engine/conversion/viewconsumable~ViewConsumable#add `ViewConsumable#add()`}.\n                 *\n                 * What you have done is trying to use:\n                 *\n                 * ```ts\n                 * consumables.add( { attributes: [ 'class', 'style' ] } );\n                 * ```\n                 *\n                 * While each class and style should be registered separately:\n                 *\n                 * ```ts\n                 * consumables.add( { classes: 'some-class', styles: 'font-weight' } );\n                 * ```\n                 *\n                 * @error viewconsumable-invalid-attribute\n                 */\n                throw new CKEditorError('viewconsumable-invalid-attribute', this);\n            }\n            else {\n                this._attributes.set(name, true);\n            }\n        }\n    }\n    /**\n     * Tests if parts of the {@link module:engine/view/element~ViewElement view element} can be consumed.\n     *\n     * Element's name can be tested:\n     *\n     * ```ts\n     * consumables.test( { name: true } );\n     * ```\n     *\n     * Attributes classes and styles:\n     *\n     * ```ts\n     * consumables.test( { attributes: [ [ 'title' ], [ 'class', 'foo' ], [ 'style', 'color' ] ] } );\n     * consumables.test( { attributes: [ [ 'title' ], [ 'name' ], [ 'class', 'foo' ], [ 'class', 'bar' ] ] } );\n     * ```\n     *\n     * @param consumables Object describing which parts of the element should be tested.\n     * @returns `true` when all tested items can be consumed, `null` when even one of the items\n     * was never marked for consumption and `false` when even one of the items was already consumed.\n     */\n    test(consumables) {\n        // Check if name can be consumed.\n        if (consumables.name && !this._canConsumeName) {\n            return this._canConsumeName;\n        }\n        for (const [name, token] of consumables.attributes) {\n            const value = this._attributes.get(name);\n            // Return null if attribute is not found.\n            if (value === undefined) {\n                return null;\n            }\n            // Already consumed.\n            if (value === false) {\n                return false;\n            }\n            // Simple attribute is not consumed so continue to next attribute.\n            if (value === true) {\n                continue;\n            }\n            if (!token) {\n                // Tokenized attribute but token is not specified so check if all tokens are not consumed.\n                for (const tokenValue of value.values()) {\n                    // Already consumed token.\n                    if (!tokenValue) {\n                        return false;\n                    }\n                }\n            }\n            else {\n                const tokenValue = value.get(token);\n                // Return null if token is not found.\n                if (tokenValue === undefined) {\n                    return null;\n                }\n                // Already consumed.\n                if (!tokenValue) {\n                    return false;\n                }\n            }\n        }\n        // Return true only if all can be consumed.\n        return true;\n    }\n    /**\n     * Tests if parts of the {@link module:engine/view/element~ViewElement view element} can be consumed and consumes them if available.\n     * It returns `true` when all items included in method's call can be consumed, otherwise returns `false`.\n     *\n     * Element's name can be consumed:\n     *\n     * ```ts\n     * consumables.consume( { name: true } );\n     * ```\n     *\n     * Attributes classes and styles:\n     *\n     * ```ts\n     * consumables.consume( { attributes: [ [ 'title' ], [ 'class', 'foo' ], [ 'style', 'color' ] ] } );\n     * consumables.consume( { attributes: [ [ 'title' ], [ 'name' ], [ 'class', 'foo' ], [ 'class', 'bar' ] ] } );\n     * ```\n     *\n     * @param consumables Object describing which parts of the element should be consumed.\n     * @returns `true` when all tested items can be consumed and `false` when even one of the items could not be consumed.\n     */\n    consume(consumables) {\n        if (!this.test(consumables)) {\n            return false;\n        }\n        if (consumables.name) {\n            this._canConsumeName = false;\n        }\n        for (const [name, token] of consumables.attributes) {\n            // `value` must be set, because `this.test()` returned `true`.\n            const value = this._attributes.get(name);\n            // Plain (not tokenized) not-consumed attribute.\n            if (typeof value == 'boolean') {\n                // Use Element API to collect related attributes.\n                for (const [toConsume] of this.element._getConsumables(name, token).attributes) {\n                    this._attributes.set(toConsume, false);\n                }\n            }\n            else if (!token) {\n                // Tokenized attribute but token is not specified so consume all tokens.\n                for (const token of value.keys()) {\n                    value.set(token, false);\n                }\n            }\n            else {\n                // Use Element API to collect related attribute tokens.\n                for (const [, toConsume] of this.element._getConsumables(name, token).attributes) {\n                    value.set(toConsume, false);\n                }\n            }\n        }\n        return true;\n    }\n    /**\n     * Revert already consumed parts of {@link module:engine/view/element~ViewElement view Element}, so they can be consumed once again.\n     * Element's name can be reverted:\n     *\n     * ```ts\n     * consumables.revert( { name: true } );\n     * ```\n     *\n     * Attributes classes and styles:\n     *\n     * ```ts\n     * consumables.revert( { attributes: [ [ 'title' ], [ 'class', 'foo' ], [ 'style', 'color' ] ] } );\n     * consumables.revert( { attributes: [ [ 'title' ], [ 'name' ], [ 'class', 'foo' ], [ 'class', 'bar' ] ] } );\n     * ```\n     *\n     * @param consumables Object describing which parts of the element should be reverted.\n     */\n    revert(consumables) {\n        if (consumables.name) {\n            this._canConsumeName = true;\n        }\n        for (const [name, token] of consumables.attributes) {\n            const value = this._attributes.get(name);\n            // Plain consumed attribute.\n            if (value === false) {\n                this._attributes.set(name, true);\n                continue;\n            }\n            // Unknown attribute or not consumed.\n            if (value === undefined || value === true) {\n                continue;\n            }\n            if (!token) {\n                // Tokenized attribute but token is not specified so revert all tokens.\n                for (const token of value.keys()) {\n                    value.set(token, true);\n                }\n            }\n            else {\n                const tokenValue = value.get(token);\n                if (tokenValue === false) {\n                    value.set(token, true);\n                }\n                // Note that revert of consumed related styles is not handled.\n            }\n        }\n    }\n}\n/**\n * Normalizes a {@link module:engine/conversion/viewconsumable~Consumables} or {@link module:engine/view/matcher~Match}\n * to a {@link module:engine/view/element~ViewNormalizedConsumables}.\n *\n * @internal\n */\nexport function normalizeConsumables(consumables) {\n    const attributes = [];\n    if ('attributes' in consumables && consumables.attributes) {\n        normalizeConsumablePart(attributes, consumables.attributes);\n    }\n    if ('classes' in consumables && consumables.classes) {\n        normalizeConsumablePart(attributes, consumables.classes, 'class');\n    }\n    if ('styles' in consumables && consumables.styles) {\n        normalizeConsumablePart(attributes, consumables.styles, 'style');\n    }\n    return {\n        name: consumables.name || false,\n        attributes\n    };\n}\n/**\n * Normalizes a list of consumable attributes to a common tuple format.\n */\nfunction normalizeConsumablePart(attributes, items, prefix) {\n    if (typeof items == 'string') {\n        attributes.push(prefix ? [prefix, items] : [items]);\n        return;\n    }\n    for (const item of items) {\n        if (Array.isArray(item)) {\n            attributes.push(item);\n        }\n        else {\n            attributes.push(prefix ? [prefix, item] : [item]);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\nimport { normalizeConsumables } from '../conversion/viewconsumable.js';\n/**\n * View matcher class.\n * Instance of this class can be used to find {@link module:engine/view/element~ViewElement elements} that match given pattern.\n */\nexport class Matcher {\n    _patterns = [];\n    /**\n     * Creates new instance of Matcher.\n     *\n     * @param pattern Match patterns. See {@link module:engine/view/matcher~Matcher#add add method} for more information.\n     */\n    constructor(...pattern) {\n        this.add(...pattern);\n    }\n    /**\n     * Adds pattern or patterns to matcher instance.\n     *\n     * ```ts\n     * // String.\n     * matcher.add( 'div' );\n     *\n     * // Regular expression.\n     * matcher.add( /^\\w/ );\n     *\n     * // Single class.\n     * matcher.add( {\n     * \tclasses: 'foobar'\n     * } );\n     * ```\n     *\n     * See {@link module:engine/view/matcher~MatcherPattern} for more examples.\n     *\n     * Multiple patterns can be added in one call:\n     *\n     * ```ts\n     * matcher.add( 'div', { classes: 'foobar' } );\n     * ```\n     *\n     * @param pattern Object describing pattern details. If string or regular expression\n     * is provided it will be used to match element's name. Pattern can be also provided in a form\n     * of a function - then this function will be called with each {@link module:engine/view/element~ViewElement element} as a parameter.\n     * Function's return value will be stored under `match` key of the object returned from\n     * {@link module:engine/view/matcher~Matcher#match match} or {@link module:engine/view/matcher~Matcher#matchAll matchAll} methods.\n     */\n    add(...pattern) {\n        for (let item of pattern) {\n            // String or RegExp pattern is used as element's name.\n            if (typeof item == 'string' || item instanceof RegExp) {\n                item = { name: item };\n            }\n            this._patterns.push(item);\n        }\n    }\n    /**\n     * Matches elements for currently stored patterns. Returns match information about first found\n     * {@link module:engine/view/element~ViewElement element}, otherwise returns `null`.\n     *\n     * Example of returned object:\n     *\n     * ```ts\n     * {\n     * \telement: <instance of found element>,\n     * \tpattern: <pattern used to match found element>,\n     * \tmatch: {\n     * \t\tname: true,\n     * \t\tattributes: [\n     * \t\t\t[ 'title' ],\n     * \t\t\t[ 'href' ],\n     * \t\t\t[ 'class', 'foo' ],\n     * \t\t\t[ 'style', 'color' ],\n     * \t\t\t[ 'style', 'position' ]\n     * \t\t]\n     * \t}\n     * }\n     * ```\n     *\n     * You could use the `match` field from the above returned object as an input for the\n     * {@link module:engine/conversion/viewconsumable~ViewConsumable#test `ViewConsumable#test()`} and\n     * {@link module:engine/conversion/viewconsumable~ViewConsumable#consume `ViewConsumable#consume()`} methods.\n     *\n     * @see module:engine/view/matcher~Matcher#add\n     * @see module:engine/view/matcher~Matcher#matchAll\n     * @param element View element to match against stored patterns.\n     * @returns The match information about found element or `null`.\n     */\n    match(...element) {\n        for (const singleElement of element) {\n            for (const pattern of this._patterns) {\n                const match = this._isElementMatching(singleElement, pattern);\n                if (match) {\n                    return {\n                        element: singleElement,\n                        pattern,\n                        match\n                    };\n                }\n            }\n        }\n        return null;\n    }\n    /**\n     * Matches elements for currently stored patterns. Returns array of match information with all found\n     * {@link module:engine/view/element~ViewElement elements}. If no element is found - returns `null`.\n     *\n     * @see module:engine/view/matcher~Matcher#add\n     * @see module:engine/view/matcher~Matcher#match\n     * @param element View element to match against stored patterns.\n     * @returns Array with match information about found elements or `null`. For more information\n     * see {@link module:engine/view/matcher~Matcher#match match method} description.\n     */\n    matchAll(...element) {\n        const results = [];\n        for (const singleElement of element) {\n            for (const pattern of this._patterns) {\n                const match = this._isElementMatching(singleElement, pattern);\n                if (match) {\n                    results.push({\n                        element: singleElement,\n                        pattern,\n                        match\n                    });\n                }\n            }\n        }\n        return results.length > 0 ? results : null;\n    }\n    /**\n     * Returns the name of the element to match if there is exactly one pattern added to the matcher instance\n     * and it matches element name defined by `string` (not `RegExp`). Otherwise, returns `null`.\n     *\n     * @returns Element name trying to match.\n     */\n    getElementName() {\n        if (this._patterns.length !== 1) {\n            return null;\n        }\n        const pattern = this._patterns[0];\n        const name = pattern.name;\n        return (typeof pattern != 'function' && name && !(name instanceof RegExp)) ? name : null;\n    }\n    /**\n     * Returns match information if {@link module:engine/view/element~ViewElement element} is matching provided pattern.\n     * If element cannot be matched to provided pattern - returns `null`.\n     *\n     * @returns Returns object with match information or null if element is not matching.\n     */\n    _isElementMatching(element, pattern) {\n        // If pattern is provided as function - return result of that function;\n        if (typeof pattern == 'function') {\n            const match = pattern(element);\n            // In some places we use Matcher with callback pattern that returns boolean.\n            if (!match || typeof match != 'object') {\n                return match;\n            }\n            return normalizeConsumables(match);\n        }\n        const match = {};\n        // Check element's name.\n        if (pattern.name) {\n            match.name = matchName(pattern.name, element.name);\n            if (!match.name) {\n                return null;\n            }\n        }\n        const attributesMatch = [];\n        // Check element's attributes.\n        if (pattern.attributes && !matchAttributes(pattern.attributes, element, attributesMatch)) {\n            return null;\n        }\n        // Check element's classes.\n        if (pattern.classes && !matchClasses(pattern.classes, element, attributesMatch)) {\n            return null;\n        }\n        // Check element's styles.\n        if (pattern.styles && !matchStyles(pattern.styles, element, attributesMatch)) {\n            return null;\n        }\n        // Note the `attributesMatch` array is populated by the above calls.\n        if (attributesMatch.length) {\n            match.attributes = attributesMatch;\n        }\n        return match;\n    }\n}\n/**\n * Returns true if the given `item` matches the pattern.\n *\n * @internal\n * @param pattern A pattern representing a key/value we want to match.\n * @param item An actual item key/value (e.g. `'src'`, `'background-color'`, `'ck-widget'`) we're testing against pattern.\n */\nexport function isPatternMatched(pattern, item) {\n    return pattern === true ||\n        pattern === item ||\n        pattern instanceof RegExp && !!String(item).match(pattern);\n}\n/**\n * Checks if name can be matched by provided pattern.\n *\n * @returns Returns `true` if name can be matched, `false` otherwise.\n */\nfunction matchName(pattern, name) {\n    // If pattern is provided as RegExp - test against this regexp.\n    if (pattern instanceof RegExp) {\n        return !!name.match(pattern);\n    }\n    return pattern === name;\n}\n/**\n * Bring all the possible pattern forms to an array of tuples where first item is a key, second is a value,\n * and third optional is a token value.\n *\n * Examples:\n *\n * Boolean pattern value:\n *\n * ```ts\n * true\n * ```\n *\n * to\n *\n * ```ts\n * [ [ true, true ] ]\n * ```\n *\n * Textual pattern value:\n *\n * ```ts\n * 'attribute-name-or-class-or-style'\n * ```\n *\n * to\n *\n * ```ts\n * [ [ 'attribute-name-or-class-or-style', true ] ]\n * ```\n *\n * Regular expression:\n *\n * ```ts\n * /^data-.*$/\n * ```\n *\n * to\n *\n * ```ts\n * [ [ /^data-.*$/, true ] ]\n * ```\n *\n * Objects (plain or with `key` and `value` specified explicitly):\n *\n * ```ts\n * {\n * \tsrc: /^https:.*$/\n * }\n * ```\n *\n * or\n *\n * ```ts\n * [ {\n * \tkey: 'src',\n * \tvalue: /^https:.*$/\n * } ]\n * ```\n *\n * to:\n *\n * ```ts\n * [ [ 'src', /^https:.*$/ ] ]\n * ```\n *\n * @returns Returns an array of objects or null if provided patterns were not in an expected form.\n */\nfunction normalizePatterns(patterns, prefix) {\n    if (Array.isArray(patterns)) {\n        return patterns.map(pattern => {\n            if (typeof pattern !== 'object' || pattern instanceof RegExp) {\n                return prefix ?\n                    [prefix, pattern, true] :\n                    [pattern, true];\n            }\n            if (pattern.key === undefined || pattern.value === undefined) {\n                // Documented at the end of matcher.js.\n                logWarning('matcher-pattern-missing-key-or-value', pattern);\n            }\n            return prefix ?\n                [prefix, pattern.key, pattern.value] :\n                [pattern.key, pattern.value];\n        });\n    }\n    if (typeof patterns !== 'object' || patterns instanceof RegExp) {\n        return [\n            prefix ?\n                [prefix, patterns, true] :\n                [patterns, true]\n        ];\n    }\n    // Below we do what Object.entries() does, but faster\n    const normalizedPatterns = [];\n    for (const key in patterns) {\n        // Replace with Object.hasOwn() when we upgrade to es2022.\n        if (Object.prototype.hasOwnProperty.call(patterns, key)) {\n            normalizedPatterns.push(prefix ?\n                [prefix, key, patterns[key]] :\n                [key, patterns[key]]);\n        }\n    }\n    return normalizedPatterns;\n}\n/**\n * Checks if attributes of provided element can be matched against provided patterns.\n *\n * @param patterns Object with information about attributes to match. Each key of the object will be\n * used as attribute name. Value of each key can be a string or regular expression to match against attribute value.\n * @param  element Element which attributes will be tested.\n * @param match An array to populate with matching tuples.\n * @returns Returns array with matched attribute names or `null` if no attributes were matched.\n */\nfunction matchAttributes(patterns, element, match) {\n    let excludeAttributes;\n    // `style` and `class` attribute keys are deprecated. Only allow them in object pattern\n    // for backward compatibility.\n    if (typeof patterns === 'object' && !(patterns instanceof RegExp) && !Array.isArray(patterns)) {\n        if (patterns.style !== undefined) {\n            // Documented at the end of matcher.js.\n            logWarning('matcher-pattern-deprecated-attributes-style-key', patterns);\n        }\n        if (patterns.class !== undefined) {\n            // Documented at the end of matcher.js.\n            logWarning('matcher-pattern-deprecated-attributes-class-key', patterns);\n        }\n    }\n    else {\n        excludeAttributes = ['class', 'style'];\n    }\n    return element._collectAttributesMatch(normalizePatterns(patterns), match, excludeAttributes);\n}\n/**\n * Checks if classes of provided element can be matched against provided patterns.\n *\n * @param patterns Array of strings or regular expressions to match against element's classes.\n * @param element Element which classes will be tested.\n * @param match An array to populate with matching tuples.\n * @returns Returns array with matched class names or `null` if no classes were matched.\n */\nfunction matchClasses(patterns, element, match) {\n    return element._collectAttributesMatch(normalizePatterns(patterns, 'class'), match);\n}\n/**\n * Checks if styles of provided element can be matched against provided patterns.\n *\n * @param patterns Object with information about styles to match. Each key of the object will be\n * used as style name. Value of each key can be a string or regular expression to match against style value.\n * @param element Element which styles will be tested.\n * @param match An array to populate with matching tuples.\n * @returns Returns array with matched style names or `null` if no styles were matched.\n */\nfunction matchStyles(patterns, element, match) {\n    return element._collectAttributesMatch(normalizePatterns(patterns, 'style'), match);\n}\n/**\n * The key-value matcher pattern is missing key or value. Both must be present.\n * Refer the documentation: {@link module:engine/view/matcher~MatcherPattern}.\n *\n * @param pattern Pattern with missing properties.\n * @error matcher-pattern-missing-key-or-value\n */\n/**\n * The key-value matcher pattern for `attributes` option is using deprecated `style` key.\n *\n * Use `styles` matcher pattern option instead:\n *\n * ```ts\n * // Instead of:\n * const pattern = {\n * \tattributes: {\n * \t\tkey1: 'value1',\n * \t\tkey2: 'value2',\n * \t\tstyle: /^border.*$/\n * \t}\n * }\n *\n * // Use:\n * const pattern = {\n * \tattributes: {\n * \t\tkey1: 'value1',\n * \t\tkey2: 'value2'\n * \t},\n * \tstyles: /^border.*$/\n * }\n * ```\n *\n * Refer to the {@glink updating/guides/update-to-29##update-to-ckeditor-5-v2910 Migration to v29.1.0} guide\n * and {@link module:engine/view/matcher~MatcherPattern} documentation.\n *\n * @param pattern Pattern with missing properties.\n * @error matcher-pattern-deprecated-attributes-style-key\n */\n/**\n * The key-value matcher pattern for `attributes` option is using deprecated `class` key.\n *\n * Use `classes` matcher pattern option instead:\n *\n * ```ts\n * // Instead of:\n * const pattern = {\n * \tattributes: {\n * \t\tkey1: 'value1',\n * \t\tkey2: 'value2',\n * \t\tclass: 'foobar'\n * \t}\n * }\n *\n * // Use:\n * const pattern = {\n * \tattributes: {\n * \t\tkey1: 'value1',\n * \t\tkey2: 'value2'\n * \t},\n * \tclasses: 'foobar'\n * }\n * ```\n *\n * Refer to the {@glink updating/guides/update-to-29##update-to-ckeditor-5-v2910 Migration to v29.1.0} guide\n * and the {@link module:engine/view/matcher~MatcherPattern} documentation.\n *\n * @param pattern Pattern with missing properties.\n * @error matcher-pattern-deprecated-attributes-class-key\n */\n","function isDeepKey(key) {\n    switch (typeof key) {\n        case 'number':\n        case 'symbol': {\n            return false;\n        }\n        case 'string': {\n            return key.includes('.') || key.includes('[') || key.includes(']');\n        }\n    }\n}\n\nexport { isDeepKey };\n","function toKey(value) {\n    if (typeof value === 'string' || typeof value === 'symbol') {\n        return value;\n    }\n    if (Object.is(value?.valueOf?.(), -0)) {\n        return '-0';\n    }\n    return String(value);\n}\n\nexport { toKey };\n","function toPath(deepKey) {\n    const result = [];\n    const length = deepKey.length;\n    if (length === 0) {\n        return result;\n    }\n    let index = 0;\n    let key = '';\n    let quoteChar = '';\n    let bracket = false;\n    if (deepKey.charCodeAt(0) === 46) {\n        result.push('');\n        index++;\n    }\n    while (index < length) {\n        const char = deepKey[index];\n        if (quoteChar) {\n            if (char === '\\\\' && index + 1 < length) {\n                index++;\n                key += deepKey[index];\n            }\n            else if (char === quoteChar) {\n                quoteChar = '';\n            }\n            else {\n                key += char;\n            }\n        }\n        else if (bracket) {\n            if (char === '\"' || char === \"'\") {\n                quoteChar = char;\n            }\n            else if (char === ']') {\n                bracket = false;\n                result.push(key);\n                key = '';\n            }\n            else {\n                key += char;\n            }\n        }\n        else {\n            if (char === '[') {\n                bracket = true;\n                if (key) {\n                    result.push(key);\n                    key = '';\n                }\n            }\n            else if (char === '.') {\n                if (key) {\n                    result.push(key);\n                    key = '';\n                }\n            }\n            else {\n                key += char;\n            }\n        }\n        index++;\n    }\n    if (key) {\n        result.push(key);\n    }\n    return result;\n}\n\nexport { toPath };\n","import { isUnsafeProperty } from '../../_internal/isUnsafeProperty.mjs';\nimport { isDeepKey } from '../_internal/isDeepKey.mjs';\nimport { toKey } from '../_internal/toKey.mjs';\nimport { toPath } from '../util/toPath.mjs';\n\nfunction get(object, path, defaultValue) {\n    if (object == null) {\n        return defaultValue;\n    }\n    switch (typeof path) {\n        case 'string': {\n            if (isUnsafeProperty(path)) {\n                return defaultValue;\n            }\n            const result = object[path];\n            if (result === undefined) {\n                if (isDeepKey(path)) {\n                    return get(object, toPath(path), defaultValue);\n                }\n                else {\n                    return defaultValue;\n                }\n            }\n            return result;\n        }\n        case 'number':\n        case 'symbol': {\n            if (typeof path === 'number') {\n                path = toKey(path);\n            }\n            const result = object[path];\n            if (result === undefined) {\n                return defaultValue;\n            }\n            return result;\n        }\n        default: {\n            if (Array.isArray(path)) {\n                return getWithPath(object, path, defaultValue);\n            }\n            if (Object.is(path?.valueOf(), -0)) {\n                path = '-0';\n            }\n            else {\n                path = String(path);\n            }\n            if (isUnsafeProperty(path)) {\n                return defaultValue;\n            }\n            const result = object[path];\n            if (result === undefined) {\n                return defaultValue;\n            }\n            return result;\n        }\n    }\n}\nfunction getWithPath(object, path, defaultValue) {\n    if (path.length === 0) {\n        return defaultValue;\n    }\n    let current = object;\n    for (let index = 0; index < path.length; index++) {\n        if (current == null) {\n            return defaultValue;\n        }\n        if (isUnsafeProperty(path[index])) {\n            return defaultValue;\n        }\n        current = current[path[index]];\n    }\n    if (current === undefined) {\n        return defaultValue;\n    }\n    return current;\n}\n\nexport { get };\n","function eq(value, other) {\n    return value === other || (Number.isNaN(value) && Number.isNaN(other));\n}\n\nexport { eq };\n","import { eq } from '../util/eq.mjs';\n\nconst assignValue = (object, key, value) => {\n    const objValue = object[key];\n    if (!(Object.hasOwn(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) {\n        object[key] = value;\n    }\n};\n\nexport { assignValue };\n","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/;\nfunction isIndex(value, length = Number.MAX_SAFE_INTEGER) {\n    switch (typeof value) {\n        case 'number': {\n            return Number.isInteger(value) && value >= 0 && value < length;\n        }\n        case 'symbol': {\n            return false;\n        }\n        case 'string': {\n            return IS_UNSIGNED_INTEGER.test(value);\n        }\n    }\n}\n\nexport { isIndex };\n","function isSymbol(value) {\n    return typeof value === 'symbol' || value instanceof Symbol;\n}\n\nexport { isSymbol };\n","import { isSymbol } from '../predicate/isSymbol.mjs';\n\nconst regexIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\nconst regexIsPlainProp = /^\\w*$/;\nfunction isKey(value, object) {\n    if (Array.isArray(value)) {\n        return false;\n    }\n    if (typeof value === 'number' || typeof value === 'boolean' || value == null || isSymbol(value)) {\n        return true;\n    }\n    return ((typeof value === 'string' && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value))) ||\n        (object != null && Object.hasOwn(object, value)));\n}\n\nexport { isKey };\n","import { updateWith } from './updateWith.mjs';\n\nfunction set(obj, path, value) {\n    return updateWith(obj, path, () => value, () => undefined);\n}\n\nexport { set };\n","import { isUnsafeProperty } from '../../_internal/isUnsafeProperty.mjs';\nimport { assignValue } from '../_internal/assignValue.mjs';\nimport { isIndex } from '../_internal/isIndex.mjs';\nimport { isKey } from '../_internal/isKey.mjs';\nimport { toKey } from '../_internal/toKey.mjs';\nimport { isObject } from '../predicate/isObject.mjs';\nimport { toPath } from '../util/toPath.mjs';\n\nfunction updateWith(obj, path, updater, customizer) {\n    if (obj == null && !isObject(obj)) {\n        return obj;\n    }\n    const resolvedPath = isKey(path, obj)\n        ? [path]\n        : Array.isArray(path)\n            ? path\n            : typeof path === 'string'\n                ? toPath(path)\n                : [path];\n    let current = obj;\n    for (let i = 0; i < resolvedPath.length && current != null; i++) {\n        const key = toKey(resolvedPath[i]);\n        if (isUnsafeProperty(key)) {\n            continue;\n        }\n        let newValue;\n        if (i === resolvedPath.length - 1) {\n            newValue = updater(current[key]);\n        }\n        else {\n            const objValue = current[key];\n            const customizerResult = customizer?.(objValue, key, obj);\n            newValue =\n                customizerResult !== undefined\n                    ? customizerResult\n                    : isObject(objValue)\n                        ? objValue\n                        : isIndex(resolvedPath[i + 1])\n                            ? []\n                            : {};\n        }\n        assignValue(current, key, newValue);\n        current = current[key];\n    }\n    return obj;\n}\n\nexport { updateWith };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/stylesmap\n */\nimport { get, isObject, merge, set } from 'es-toolkit/compat';\nimport { toArray } from '@ckeditor/ckeditor5-utils';\nimport { isPatternMatched } from './matcher.js';\n/**\n * Styles map. Allows handling (adding, removing, retrieving) a set of style rules (usually, of an element).\n */\nexport class StylesMap {\n    /**\n     * Keeps an internal representation of styles map. Normalized styles are kept as object tree to allow unified modification and\n     * value access model using lodash's get, set, unset, etc methods.\n     *\n     * When no style processor rules are defined it acts as simple key-value storage.\n     */\n    _styles;\n    /**\n     * Cached list of style names for faster access.\n     */\n    _cachedStyleNames = null;\n    /**\n     * Cached list of expanded style names for faster access.\n     */\n    _cachedExpandedStyleNames = null;\n    /**\n     * An instance of the {@link module:engine/view/stylesmap~StylesProcessor}.\n     */\n    _styleProcessor;\n    /**\n     * Creates Styles instance.\n     */\n    constructor(styleProcessor) {\n        this._styles = {};\n        this._styleProcessor = styleProcessor;\n    }\n    /**\n     * Returns true if style map has no styles set.\n     */\n    get isEmpty() {\n        const entries = Object.entries(this._styles);\n        return !entries.length;\n    }\n    /**\n     * Number of styles defined.\n     */\n    get size() {\n        if (this.isEmpty) {\n            return 0;\n        }\n        return this.getStyleNames().length;\n    }\n    /**\n     * Set styles map to a new value.\n     *\n     * ```ts\n     * styles.setTo( 'border:1px solid blue;margin-top:1px;' );\n     * ```\n     */\n    setTo(inlineStyle) {\n        this.clear();\n        const parsedStyles = parseInlineStyles(inlineStyle);\n        for (const [key, value] of parsedStyles) {\n            this._styleProcessor.toNormalizedForm(key, value, this._styles);\n        }\n        return this;\n    }\n    /**\n     * Checks if a given style is set.\n     *\n     * ```ts\n     * styles.setTo( 'margin-left:1px;' );\n     *\n     * styles.has( 'margin-left' );    // -> true\n     * styles.has( 'padding' );        // -> false\n     * ```\n     *\n     * **Note**: This check supports normalized style names.\n     *\n     * ```ts\n     * // Enable 'margin' shorthand processing:\n     * editor.data.addStyleProcessorRules( addMarginStylesRules );\n     *\n     * styles.setTo( 'margin:2px;' );\n     *\n     * styles.has( 'margin' );         // -> true\n     * styles.has( 'margin-top' );     // -> true\n     * styles.has( 'margin-left' );    // -> true\n     *\n     * styles.remove( 'margin-top' );\n     *\n     * styles.has( 'margin' );         // -> false\n     * styles.has( 'margin-top' );     // -> false\n     * styles.has( 'margin-left' );    // -> true\n     * ```\n     *\n     * @param name Style name.\n     */\n    has(name) {\n        if (this.isEmpty) {\n            return false;\n        }\n        const styles = this._styleProcessor.getReducedForm(name, this._styles);\n        const propertyDescriptor = styles.find(([property]) => property === name);\n        // Only return a value if it is set;\n        return Array.isArray(propertyDescriptor);\n    }\n    set(nameOrObject, valueOrObject) {\n        this._cachedStyleNames = null;\n        this._cachedExpandedStyleNames = null;\n        if (isObject(nameOrObject)) {\n            for (const [key, value] of Object.entries(nameOrObject)) {\n                this._styleProcessor.toNormalizedForm(key, value, this._styles);\n            }\n        }\n        else {\n            this._styleProcessor.toNormalizedForm(nameOrObject, valueOrObject, this._styles);\n        }\n    }\n    /**\n     * Removes given style.\n     *\n     * ```ts\n     * styles.setTo( 'background:#f00;margin-right:2px;' );\n     *\n     * styles.remove( 'background' );\n     *\n     * styles.toString();   // -> 'margin-right:2px;'\n     * ```\n     *\n     * ***Note**:* This method uses {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules\n     * enabled style processor rules} to normalize passed values.\n     *\n     * ```ts\n     * // Enable 'margin' shorthand processing:\n     * editor.data.addStyleProcessorRules( addMarginStylesRules );\n     *\n     * styles.setTo( 'margin:1px' );\n     *\n     * styles.remove( 'margin-top' );\n     * styles.remove( 'margin-right' );\n     *\n     * styles.toString(); // -> 'margin-bottom:1px;margin-left:1px;'\n     * ```\n     *\n     * @param names Style name or an array of names.\n     */\n    remove(names) {\n        const normalizedStylesToRemove = {};\n        for (const name of toArray(names)) {\n            // First, try the easy path, when the path reflects normalized styles structure.\n            const path = toPath(name);\n            const pathValue = get(this._styles, path);\n            if (pathValue) {\n                appendStyleValue(normalizedStylesToRemove, path, pathValue);\n            }\n            else {\n                // Easy path did not work, so try to get the value from the styles map.\n                const value = this.getAsString(name);\n                if (value !== undefined) {\n                    this._styleProcessor.toNormalizedForm(name, value, normalizedStylesToRemove);\n                }\n            }\n        }\n        if (Object.keys(normalizedStylesToRemove).length) {\n            removeStyles(this._styles, normalizedStylesToRemove);\n            this._cachedStyleNames = null;\n            this._cachedExpandedStyleNames = null;\n        }\n    }\n    /**\n     * Returns a normalized style object or a single value.\n     *\n     * ```ts\n     * // Enable 'margin' shorthand processing:\n     * editor.data.addStyleProcessorRules( addMarginStylesRules );\n     *\n     * const styles = new Styles();\n     * styles.setTo( 'margin:1px 2px 3em;' );\n     *\n     * styles.getNormalized( 'margin' );\n     * // will log:\n     * // {\n     * //     top: '1px',\n     * //     right: '2px',\n     * //     bottom: '3em',\n     * //     left: '2px'     // normalized value from margin shorthand\n     * // }\n     *\n     * styles.getNormalized( 'margin-left' ); // -> '2px'\n     * ```\n     *\n     * **Note**: This method will only return normalized styles if a style processor was defined.\n     *\n     * @param name Style name.\n     */\n    getNormalized(name) {\n        return this._styleProcessor.getNormalized(name, this._styles);\n    }\n    /**\n     * Returns a normalized style string. Styles are sorted by name.\n     *\n     * ```ts\n     * styles.set( 'margin' , '1px' );\n     * styles.set( 'background', '#f00' );\n     *\n     * styles.toString(); // -> 'background:#f00;margin:1px;'\n     * ```\n     *\n     * **Note**: This method supports normalized styles if defined.\n     *\n     * ```ts\n     * // Enable 'margin' shorthand processing:\n     * editor.data.addStyleProcessorRules( addMarginStylesRules );\n     *\n     * styles.set( 'margin' , '1px' );\n     * styles.set( 'background', '#f00' );\n     * styles.remove( 'margin-top' );\n     * styles.remove( 'margin-right' );\n     *\n     * styles.toString(); // -> 'background:#f00;margin-bottom:1px;margin-left:1px;'\n     * ```\n     */\n    toString() {\n        if (this.isEmpty) {\n            return '';\n        }\n        return this.getStylesEntries()\n            .map(arr => arr.join(':'))\n            .sort()\n            .join(';') + ';';\n    }\n    /**\n     * Returns property as a value string or undefined if property is not set.\n     *\n     * ```ts\n     * // Enable 'margin' shorthand processing:\n     * editor.data.addStyleProcessorRules( addMarginStylesRules );\n     *\n     * const styles = new Styles();\n     * styles.setTo( 'margin:1px;' );\n     * styles.set( 'margin-bottom', '3em' );\n     *\n     * styles.getAsString( 'margin' ); // -> 'margin: 1px 1px 3em;'\n     * ```\n     *\n     * Note, however, that all sub-values must be set for the longhand property name to return a value:\n     *\n     * ```ts\n     * const styles = new Styles();\n     * styles.setTo( 'margin:1px;' );\n     * styles.remove( 'margin-bottom' );\n     *\n     * styles.getAsString( 'margin' ); // -> undefined\n     * ```\n     *\n     * In the above scenario, it is not possible to return a `margin` value, so `undefined` is returned.\n     * Instead, you should use:\n     *\n     * ```ts\n     * const styles = new Styles();\n     * styles.setTo( 'margin:1px;' );\n     * styles.remove( 'margin-bottom' );\n     *\n     * for ( const styleName of styles.getStyleNames() ) {\n     * \tconsole.log( styleName, styles.getAsString( styleName ) );\n     * }\n     * // 'margin-top', '1px'\n     * // 'margin-right', '1px'\n     * // 'margin-left', '1px'\n     * ```\n     *\n     * In general, it is recommend to iterate over style names like in the example above. This way, you will always get all\n     * the currently set style values. So, if all the 4 margin values would be set\n     * the for-of loop above would yield only `'margin'`, `'1px'`:\n     *\n     * ```ts\n     * const styles = new Styles();\n     * styles.setTo( 'margin:1px;' );\n     *\n     * for ( const styleName of styles.getStyleNames() ) {\n     * \tconsole.log( styleName, styles.getAsString( styleName ) );\n     * }\n     * // 'margin', '1px'\n     * ```\n     *\n     * **Note**: To get a normalized version of a longhand property use the {@link #getNormalized `#getNormalized()`} method.\n     */\n    getAsString(propertyName) {\n        if (this.isEmpty) {\n            return;\n        }\n        if (this._styles[propertyName] && !isObject(this._styles[propertyName])) {\n            // Try return styles set directly - values that are not parsed.\n            return this._styles[propertyName];\n        }\n        const styles = this._styleProcessor.getReducedForm(propertyName, this._styles);\n        const propertyDescriptor = styles.find(([property]) => property === propertyName);\n        // Only return a value if it is set;\n        if (Array.isArray(propertyDescriptor)) {\n            return propertyDescriptor[1];\n        }\n    }\n    /**\n     * Returns all style properties names as they would appear when using {@link #toString `#toString()`}.\n     *\n     * When `expand` is set to true and there's a shorthand style property set, it will also return all equivalent styles:\n     *\n     * ```ts\n     * stylesMap.setTo( 'margin: 1em' )\n     * ```\n     *\n     * will be expanded to:\n     *\n     * ```ts\n     * [ 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left' ]\n     * ```\n     *\n     * @param expand Expand shorthand style properties and all return equivalent style representations.\n     */\n    getStyleNames(expand = false) {\n        if (this.isEmpty) {\n            return [];\n        }\n        if (expand) {\n            this._cachedExpandedStyleNames ||= this._styleProcessor.getStyleNames(this._styles);\n            return this._cachedExpandedStyleNames;\n        }\n        this._cachedStyleNames ||= this.getStylesEntries().map(([key]) => key);\n        return this._cachedStyleNames;\n    }\n    /**\n     * Alias for {@link #getStyleNames}.\n     */\n    keys() {\n        return this.getStyleNames();\n    }\n    /**\n     * Removes all styles.\n     */\n    clear() {\n        this._styles = {};\n        this._cachedStyleNames = null;\n        this._cachedExpandedStyleNames = null;\n    }\n    /**\n     * Returns `true` if both attributes have the same styles.\n     */\n    isSimilar(other) {\n        if (this.size !== other.size) {\n            return false;\n        }\n        for (const property of this.getStyleNames()) {\n            if (!other.has(property) || other.getAsString(property) !== this.getAsString(property)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Returns normalized styles entries for further processing.\n     */\n    getStylesEntries() {\n        const parsed = [];\n        const keys = Object.keys(this._styles);\n        for (const key of keys) {\n            parsed.push(...this._styleProcessor.getReducedForm(key, this._styles));\n        }\n        return parsed;\n    }\n    /**\n     * Clones the attribute value.\n     *\n     * @internal\n     */\n    _clone() {\n        const clone = new this.constructor(this._styleProcessor);\n        clone.set(this.getNormalized());\n        return clone;\n    }\n    /**\n     * Used by the {@link module:engine/view/matcher~Matcher Matcher} to collect matching styles.\n     *\n     * @internal\n     * @param tokenPattern The matched style name pattern.\n     * @param valuePattern The matched style value pattern.\n     * @returns An array of matching tokens (style names).\n     */\n    _getTokensMatch(tokenPattern, valuePattern) {\n        const match = [];\n        for (const styleName of this.getStyleNames(true)) {\n            if (isPatternMatched(tokenPattern, styleName)) {\n                if (valuePattern === true) {\n                    match.push(styleName);\n                    continue;\n                }\n                // For now, the reducers are not returning the full tree of properties.\n                // Casting to string preserves the old behavior until the root cause is fixed.\n                // More can be found in https://github.com/ckeditor/ckeditor5/issues/10399.\n                const value = this.getAsString(styleName);\n                if (isPatternMatched(valuePattern, value)) {\n                    match.push(styleName);\n                }\n            }\n        }\n        return match.length ? match : undefined;\n    }\n    /**\n     * Returns a list of consumables for the attribute. This includes related styles.\n     *\n     * Could be filtered by the given style name.\n     *\n     * @internal\n     */\n    _getConsumables(name) {\n        const result = [];\n        if (name) {\n            result.push(name);\n            for (const relatedName of this._styleProcessor.getRelatedStyles(name)) {\n                result.push(relatedName);\n            }\n        }\n        else {\n            for (const name of this.getStyleNames()) {\n                for (const relatedName of this._styleProcessor.getRelatedStyles(name)) {\n                    result.push(relatedName);\n                }\n                result.push(name);\n            }\n        }\n        return result;\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_canMergeAttributesFrom} to verify if the given attribute can be merged without\n     * conflicts into the attribute.\n     *\n     * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.\n     *\n     * @internal\n     */\n    _canMergeFrom(other) {\n        for (const key of other.getStyleNames()) {\n            if (this.has(key) && this.getAsString(key) !== other.getAsString(key)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.\n     *\n     * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.\n     *\n     * @internal\n     */\n    _mergeFrom(other) {\n        for (const prop of other.getStyleNames()) {\n            if (!this.has(prop)) {\n                this.set(prop, other.getAsString(prop));\n            }\n        }\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_canSubtractAttributesOf} to verify if the given attribute can be fully\n     * subtracted from the attribute.\n     *\n     * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.\n     *\n     * @internal\n     */\n    _isMatching(other) {\n        for (const key of other.getStyleNames()) {\n            if (!this.has(key) || this.getAsString(key) !== other.getAsString(key)) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n/**\n * Style processor is responsible for writing and reading a normalized styles object.\n */\nexport class StylesProcessor {\n    _normalizers;\n    _extractors;\n    _reducers;\n    _consumables;\n    /**\n     * Creates StylesProcessor instance.\n     *\n     * @internal\n     */\n    constructor() {\n        this._normalizers = new Map();\n        this._extractors = new Map();\n        this._reducers = new Map();\n        this._consumables = new Map();\n    }\n    /**\n     * Parse style string value to a normalized object and appends it to styles object.\n     *\n     * ```ts\n     * const styles = {};\n     *\n     * stylesProcessor.toNormalizedForm( 'margin', '1px', styles );\n     *\n     * // styles will consist: { margin: { top: '1px', right: '1px', bottom: '1px', left: '1px; } }\n     * ```\n     *\n     * **Note**: To define normalizer callbacks use {@link #setNormalizer}.\n     *\n     * @param name Name of style property.\n     * @param propertyValue Value of style property.\n     * @param styles Object holding normalized styles.\n     */\n    toNormalizedForm(name, propertyValue, styles) {\n        if (isObject(propertyValue)) {\n            appendStyleValue(styles, toPath(name), propertyValue);\n            return;\n        }\n        if (this._normalizers.has(name)) {\n            const normalizer = this._normalizers.get(name);\n            const { path, value } = normalizer(propertyValue);\n            appendStyleValue(styles, path, value);\n        }\n        else {\n            appendStyleValue(styles, name, propertyValue);\n        }\n    }\n    /**\n     * Returns a normalized version of a style property.\n     *\n     * ```ts\n     * const styles = {\n     * \tmargin: { top: '1px', right: '1px', bottom: '1px', left: '1px; },\n     * \tbackground: { color: '#f00' }\n     * };\n     *\n     * stylesProcessor.getNormalized( 'background' );\n     * // will return: { color: '#f00' }\n     *\n     * stylesProcessor.getNormalized( 'margin-top' );\n     * // will return: '1px'\n     * ```\n     *\n     * **Note**: In some cases extracting single value requires defining an extractor callback {@link #setExtractor}.\n     *\n     * @param name Name of style property.\n     * @param styles Object holding normalized styles.\n     */\n    getNormalized(name, styles) {\n        if (!name) {\n            return merge({}, styles);\n        }\n        // Might be empty string.\n        if (styles[name] !== undefined) {\n            return styles[name];\n        }\n        if (this._extractors.has(name)) {\n            const extractor = this._extractors.get(name);\n            if (typeof extractor === 'string') {\n                return get(styles, extractor);\n            }\n            const value = extractor(name, styles);\n            if (value) {\n                return value;\n            }\n        }\n        return get(styles, toPath(name));\n    }\n    /**\n     * Returns a reduced form of style property form normalized object.\n     *\n     * For default margin reducer, the below code:\n     *\n     * ```ts\n     * stylesProcessor.getReducedForm( 'margin', {\n     * \tmargin: { top: '1px', right: '1px', bottom: '2px', left: '1px; }\n     * } );\n     * ```\n     *\n     * will return:\n     *\n     * ```ts\n     * [\n     * \t[ 'margin', '1px 1px 2px' ]\n     * ]\n     * ```\n     *\n     * because it might be represented as a shorthand 'margin' value. However if one of margin long hand values is missing it should return:\n     *\n     * ```ts\n     * [\n     * \t[ 'margin-top', '1px' ],\n     * \t[ 'margin-right', '1px' ],\n     * \t[ 'margin-bottom', '2px' ]\n     * \t// the 'left' value is missing - cannot use 'margin' shorthand.\n     * ]\n     * ```\n     *\n     * **Note**: To define reducer callbacks use {@link #setReducer}.\n     *\n     * @param name Name of style property.\n     */\n    getReducedForm(name, styles) {\n        const normalizedValue = this.getNormalized(name, styles);\n        // Might be empty string.\n        if (normalizedValue === undefined) {\n            return [];\n        }\n        if (this._reducers.has(name)) {\n            const reducer = this._reducers.get(name);\n            return reducer(normalizedValue);\n        }\n        return [[name, normalizedValue]];\n    }\n    /**\n     * Return all style properties. Also expand shorthand properties (e.g. `margin`, `background`) if respective extractor is available.\n     *\n     * @param styles Object holding normalized styles.\n     */\n    getStyleNames(styles) {\n        const styleNamesKeysSet = new Set();\n        // Find all extractable styles that have a value.\n        for (const name of this._consumables.keys()) {\n            const style = this.getNormalized(name, styles);\n            if (style && (typeof style != 'object' || Object.keys(style).length)) {\n                styleNamesKeysSet.add(name);\n            }\n        }\n        // For simple styles (for example `color`) we don't have a map of those styles\n        // but they are 1 to 1 with normalized object keys.\n        for (const name of Object.keys(styles)) {\n            styleNamesKeysSet.add(name);\n        }\n        return Array.from(styleNamesKeysSet);\n    }\n    /**\n     * Returns related style names.\n     *\n     * ```ts\n     * stylesProcessor.getRelatedStyles( 'margin' );\n     * // will return: [ 'margin-top', 'margin-right', 'margin-bottom', 'margin-left' ];\n     *\n     * stylesProcessor.getRelatedStyles( 'margin-top' );\n     * // will return: [ 'margin' ];\n     * ```\n     *\n     * **Note**: To define new style relations load an existing style processor or use\n     * {@link module:engine/view/stylesmap~StylesProcessor#setStyleRelation `StylesProcessor.setStyleRelation()`}.\n     */\n    getRelatedStyles(name) {\n        return this._consumables.get(name) || [];\n    }\n    /**\n     * Adds a normalizer method for a style property.\n     *\n     * A normalizer returns describing how the value should be normalized.\n     *\n     * For instance 'margin' style is a shorthand for four margin values:\n     *\n     * - 'margin-top'\n     * - 'margin-right'\n     * - 'margin-bottom'\n     * - 'margin-left'\n     *\n     * and can be written in various ways if some values are equal to others. For instance `'margin: 1px 2em;'` is a shorthand for\n     * `'margin-top: 1px;margin-right: 2em;margin-bottom: 1px;margin-left: 2em'`.\n     *\n     * A normalizer should parse various margin notations as a single object:\n     *\n     * ```ts\n     * const styles = {\n     * \tmargin: {\n     * \t\ttop: '1px',\n     * \t\tright: '2em',\n     * \t\tbottom: '1px',\n     * \t\tleft: '2em'\n     * \t}\n     * };\n     * ```\n     *\n     * Thus a normalizer for 'margin' style should return an object defining style path and value to store:\n     *\n     * ```ts\n     * const returnValue = {\n     * \tpath: 'margin',\n     * \tvalue: {\n     * \t\ttop: '1px',\n     * \t\tright: '2em',\n     * \t\tbottom: '1px',\n     * \t\tleft: '2em'\n     * \t}\n     * };\n     * ```\n     *\n     * Additionally to fully support all margin notations there should be also defined 4 normalizers for longhand margin notations. Below\n     * is an example for 'margin-top' style property normalizer:\n     *\n     * ```ts\n     * stylesProcessor.setNormalizer( 'margin-top', valueString => {\n     * \treturn {\n     * \t\tpath: 'margin.top',\n     * \t\tvalue: valueString\n     * \t}\n     * } );\n     * ```\n     */\n    setNormalizer(name, callback) {\n        this._normalizers.set(name, callback);\n    }\n    /**\n     * Adds a extractor callback for a style property.\n     *\n     * Most normalized style values are stored as one level objects. It is assumed that `'margin-top'` style will be stored as:\n     *\n     * ```ts\n     * const styles = {\n     * \tmargin: {\n     * \t\ttop: 'value'\n     * \t}\n     * }\n     * ```\n     *\n     * However, some styles can have conflicting notations and thus it might be harder to extract a style value from shorthand. For instance\n     * the 'border-top-style' can be defined using `'border-top:solid'`, `'border-style:solid none none none'` or by `'border:solid'`\n     * shorthands. The default border styles processors stores styles as:\n     *\n     * ```ts\n     * const styles = {\n     * \tborder: {\n     * \t\tstyle: {\n     * \t\t\ttop: 'solid'\n     * \t\t}\n     * \t}\n     * }\n     * ```\n     *\n     * as it is better to modify border style independently from other values. On the other part the output of the border might be\n     * desired as `border-top`, `border-left`, etc notation.\n     *\n     * In the above example an extractor should return a side border value that combines style, color and width:\n     *\n     * ```ts\n     * styleProcessor.setExtractor( 'border-top', styles => {\n     * \treturn {\n     * \t\tcolor: styles.border.color.top,\n     * \t\tstyle: styles.border.style.top,\n     * \t\twidth: styles.border.width.top\n     * \t}\n     * } );\n     * ```\n     *\n     * @param callbackOrPath Callback that return a requested value or path string for single values.\n     */\n    setExtractor(name, callbackOrPath) {\n        this._extractors.set(name, callbackOrPath);\n    }\n    /**\n     * Adds a reducer callback for a style property.\n     *\n     * Reducer returns a minimal notation for given style name. For longhand properties it is not required to write a reducer as\n     * by default the direct value from style path is taken.\n     *\n     * For shorthand styles a reducer should return minimal style notation either by returning single name-value tuple or multiple tuples\n     * if a shorthand cannot be used. For instance for a margin shorthand a reducer might return:\n     *\n     * ```ts\n     * const marginShortHandTuple = [\n     * \t[ 'margin', '1px 1px 2px' ]\n     * ];\n     * ```\n     *\n     * or a longhand tuples for defined values:\n     *\n     * ```ts\n     * // Considering margin.bottom and margin.left are undefined.\n     * const marginLonghandsTuples = [\n     * \t[ 'margin-top', '1px' ],\n     * \t[ 'margin-right', '1px' ]\n     * ];\n     * ```\n     *\n     * A reducer obtains a normalized style value:\n     *\n     * ```ts\n     * // Simplified reducer that always outputs 4 values which are always present:\n     * stylesProcessor.setReducer( 'margin', margin => {\n     * \treturn [\n     * \t\t[ 'margin', `${ margin.top } ${ margin.right } ${ margin.bottom } ${ margin.left }` ]\n     * \t]\n     * } );\n     * ```\n     */\n    setReducer(name, callback) {\n        this._reducers.set(name, callback);\n    }\n    /**\n     * Defines a style shorthand relation to other style notations.\n     *\n     * ```ts\n     * stylesProcessor.setStyleRelation( 'margin', [\n     * \t'margin-top',\n     * \t'margin-right',\n     * \t'margin-bottom',\n     * \t'margin-left'\n     * ] );\n     * ```\n     *\n     * This enables expanding of style names for shorthands. For instance, if defined,\n     * {@link module:engine/conversion/viewconsumable~ViewConsumable view consumable} items are automatically created\n     * for long-hand margin style notation alongside the `'margin'` item.\n     *\n     * This means that when an element being converted has a style `margin`, a converter for `margin-left` will work just\n     * fine since the view consumable will contain a consumable `margin-left` item (thanks to the relation) and\n     * `element.getStyle( 'margin-left' )` will work as well assuming that the style processor was correctly configured.\n     * However, once `margin-left` is consumed, `margin` will not be consumable anymore.\n     */\n    setStyleRelation(shorthandName, styleNames) {\n        this._mapStyleNames(shorthandName, styleNames);\n        for (const alsoName of styleNames) {\n            this._mapStyleNames(alsoName, [shorthandName]);\n        }\n    }\n    /**\n     * Set two-way binding of style names.\n     */\n    _mapStyleNames(name, styleNames) {\n        if (!this._consumables.has(name)) {\n            this._consumables.set(name, []);\n        }\n        this._consumables.get(name).push(...styleNames);\n    }\n}\n/**\n * Parses inline styles and puts property - value pairs into styles map.\n *\n * @param stylesString Styles to parse.\n * @returns Map of parsed properties and values.\n */\nfunction parseInlineStyles(stylesString) {\n    // `null` if no quote was found in input string or last found quote was a closing quote. See below.\n    let quoteType = null;\n    let propertyNameStart = 0;\n    let propertyValueStart = 0;\n    let propertyName = null;\n    const stylesMap = new Map();\n    // Do not set anything if input string is empty.\n    if (stylesString === '') {\n        return stylesMap;\n    }\n    // Fix inline styles that do not end with `;` so they are compatible with algorithm below.\n    if (stylesString.charAt(stylesString.length - 1) != ';') {\n        stylesString = stylesString + ';';\n    }\n    // Seek the whole string for \"special characters\".\n    for (let i = 0; i < stylesString.length; i++) {\n        const char = stylesString.charAt(i);\n        if (quoteType === null) {\n            // No quote found yet or last found quote was a closing quote.\n            switch (char) {\n                case ':':\n                    // Most of time colon means that property name just ended.\n                    // Sometimes however `:` is found inside property value (for example in background image url).\n                    if (!propertyName) {\n                        // Treat this as end of property only if property name is not already saved.\n                        // Save property name.\n                        propertyName = stylesString.substr(propertyNameStart, i - propertyNameStart);\n                        // Save this point as the start of property value.\n                        propertyValueStart = i + 1;\n                    }\n                    break;\n                case '\"':\n                case '\\'':\n                    // Opening quote found (this is an opening quote, because `quoteType` is `null`).\n                    quoteType = char;\n                    break;\n                case ';': {\n                    // Property value just ended.\n                    // Use previously stored property value start to obtain property value.\n                    const propertyValue = stylesString.substr(propertyValueStart, i - propertyValueStart);\n                    if (propertyName) {\n                        // Save parsed part.\n                        stylesMap.set(propertyName.trim(), propertyValue.trim());\n                    }\n                    propertyName = null;\n                    // Save this point as property name start. Property name starts immediately after previous property value ends.\n                    propertyNameStart = i + 1;\n                    break;\n                }\n            }\n        }\n        else if (char === quoteType) {\n            // If a quote char is found and it is a closing quote, mark this fact by `null`-ing `quoteType`.\n            quoteType = null;\n        }\n    }\n    return stylesMap;\n}\n/**\n * Return lodash compatible path from style name.\n */\nfunction toPath(name) {\n    return name.replace('-', '.');\n}\n/**\n * Appends style definition to the styles object.\n */\nfunction appendStyleValue(stylesObject, nameOrPath, valueOrObject) {\n    let valueToSet = valueOrObject;\n    if (isObject(valueOrObject)) {\n        valueToSet = merge({}, get(stylesObject, nameOrPath), valueOrObject);\n    }\n    set(stylesObject, nameOrPath, valueToSet);\n}\n/**\n * Modifies the `styles` deeply nested object by removing properties defined in `toRemove`.\n */\nfunction removeStyles(styles, toRemove) {\n    for (const key of Object.keys(toRemove)) {\n        if (styles[key] !== null &&\n            !Array.isArray(styles[key]) &&\n            typeof styles[key] == 'object' &&\n            typeof toRemove[key] == 'object') {\n            removeStyles(styles[key], toRemove[key]);\n            if (!Object.keys(styles[key]).length) {\n                delete styles[key];\n            }\n        }\n        else {\n            delete styles[key];\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/tokenlist\n */\nimport { toArray } from '@ckeditor/ckeditor5-utils';\n/**\n * Token list. Allows handling (adding, removing, retrieving) a set of tokens (for example class names).\n */\nexport class ViewTokenList {\n    /**\n     * The set of tokens.\n     */\n    _set = new Set();\n    /**\n     * Returns true if token list has no tokens set.\n     */\n    get isEmpty() {\n        return this._set.size == 0;\n    }\n    /**\n     * Number of tokens.\n     */\n    get size() {\n        return this._set.size;\n    }\n    /**\n     * Checks if a given token is set.\n     */\n    has(name) {\n        return this._set.has(name);\n    }\n    /**\n     * Returns all tokens.\n     */\n    keys() {\n        return Array.from(this._set.keys());\n    }\n    /**\n     * Resets the value to the given one.\n     */\n    setTo(value) {\n        this.clear();\n        for (const token of value.split(/\\s+/)) {\n            if (token) {\n                this._set.add(token);\n            }\n        }\n        return this;\n    }\n    /**\n     * Sets a given token without affecting other tokens.\n     */\n    set(tokens) {\n        for (const token of toArray(tokens)) {\n            if (token) {\n                this._set.add(token);\n            }\n        }\n    }\n    /**\n     * Removes given token.\n     */\n    remove(tokens) {\n        for (const token of toArray(tokens)) {\n            this._set.delete(token);\n        }\n    }\n    /**\n     * Removes all tokens.\n     */\n    clear() {\n        this._set.clear();\n    }\n    /**\n     * Returns a normalized tokens string.\n     */\n    toString() {\n        return Array.from(this._set).join(' ');\n    }\n    /**\n     * Returns `true` if both attributes have the same tokens.\n     */\n    isSimilar(other) {\n        if (this.size !== other.size) {\n            return false;\n        }\n        for (const token of this.keys()) {\n            if (!other.has(token)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Clones the attribute value.\n     *\n     * @internal\n     */\n    _clone() {\n        const clone = new this.constructor();\n        clone._set = new Set(this._set);\n        return clone;\n    }\n    /**\n     * Used by the {@link module:engine/view/matcher~Matcher Matcher} to collect matching attribute tokens.\n     *\n     * @internal\n     * @param tokenPattern The matched token name pattern.\n     * @returns An array of matching tokens.\n     */\n    _getTokensMatch(tokenPattern) {\n        const match = [];\n        if (tokenPattern === true) {\n            for (const token of this._set.keys()) {\n                match.push(token);\n            }\n            return match;\n        }\n        if (typeof tokenPattern == 'string') {\n            for (const token of tokenPattern.split(/\\s+/)) {\n                if (this._set.has(token)) {\n                    match.push(token);\n                }\n                else {\n                    return undefined;\n                }\n            }\n            return match;\n        }\n        for (const token of this._set.keys()) {\n            if (token.match(tokenPattern)) {\n                match.push(token);\n            }\n        }\n        return match.length ? match : undefined;\n    }\n    /**\n     * Returns a list of consumables for the attribute.\n     *\n     * Could be filtered by the given token name.\n     *\n     * @internal\n     */\n    _getConsumables(name) {\n        return name ? [name] : this.keys();\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_canMergeAttributesFrom} to verify if the given attribute\n     * can be merged without conflicts into the attribute.\n     *\n     * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while downcasting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other `AttributeElement`.\n     *\n     * @internal\n     */\n    _canMergeFrom() {\n        return true;\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.\n     *\n     * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.\n     *\n     * @internal\n     */\n    _mergeFrom(other) {\n        for (const token of other._set.keys()) {\n            if (!this._set.has(token)) {\n                this._set.add(token);\n            }\n        }\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_canSubtractAttributesOf} to verify if the given attribute\n     * can be fully subtracted from the attribute.\n     *\n     * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.\n     *\n     * @internal\n     */\n    _isMatching(other) {\n        for (const name of other._set.keys()) {\n            if (!this._set.has(name)) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/element\n */\nimport { ViewNode } from './node.js';\nimport { ViewText } from './text.js';\nimport { ViewTextProxy } from './textproxy.js';\nimport { isIterable, toMap } from '@ckeditor/ckeditor5-utils';\nimport { Matcher, isPatternMatched } from './matcher.js';\nimport { StylesMap } from './stylesmap.js';\nimport { ViewTokenList } from './tokenlist.js';\n// @if CK_DEBUG_ENGINE // const { convertMapToTags } = require( '../dev-utils/utils' );\n/**\n * View element.\n *\n * The editing engine does not define a fixed semantics of its elements (it is \"DTD-free\").\n * This is why the type of the {@link module:engine/view/element~ViewElement} need to\n * be defined by the feature developer. When creating an element you should use one of the following methods:\n *\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement `downcastWriter#createContainerElement()`}\n * in order to create a {@link module:engine/view/containerelement~ViewContainerElement},\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement `downcastWriter#createAttributeElement()`}\n * in order to create a {@link module:engine/view/attributeelement~ViewAttributeElement},\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`}\n * in order to create a {@link module:engine/view/emptyelement~ViewEmptyElement}.\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}\n * in order to create a {@link module:engine/view/uielement~ViewUIElement}.\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEditableElement `downcastWriter#createEditableElement()`}\n * in order to create a {@link module:engine/view/editableelement~ViewEditableElement}.\n *\n * Note that for view elements which are not created from the model, like elements from mutations, paste or\n * {@link module:engine/controller/datacontroller~DataController#set data.set} it is not possible to define the type of the element.\n * In such cases the {@link module:engine/view/upcastwriter~ViewUpcastWriter#createElement `UpcastWriter#createElement()`} method\n * should be used to create generic view elements.\n */\nexport class ViewElement extends ViewNode {\n    /**\n     * Name of the element.\n     */\n    name;\n    /**\n     * A list of attribute names that should be rendered in the editing pipeline even though filtering mechanisms\n     * implemented in the {@link module:engine/view/domconverter~ViewDomConverter} (for instance,\n     * {@link module:engine/view/domconverter~ViewDomConverter#shouldRenderAttribute}) would filter them out.\n     *\n     * These attributes can be specified as an option when the element is created by\n     * the {@link module:engine/view/downcastwriter~ViewDowncastWriter}. To check whether an unsafe an attribute should\n     * be permitted, use the {@link #shouldRenderUnsafeAttribute} method.\n     *\n     * @internal\n     */\n    _unsafeAttributesToRender = [];\n    /**\n     * Map of attributes, where attributes names are keys and attributes values are values.\n     */\n    _attrs;\n    /**\n     * Array of child nodes.\n     */\n    _children;\n    /**\n     * Map of custom properties.\n     * Custom properties can be added to element instance, will be cloned but not rendered into DOM.\n     */\n    _customProperties = new Map();\n    /**\n     * Set of classes associated with element instance.\n     *\n     * Note that this is just an alias for `this._attrs.get( 'class' );`\n     */\n    get _classes() {\n        return this._attrs.get('class');\n    }\n    /**\n     * Normalized styles.\n     *\n     * Note that this is just an alias for `this._attrs.get( 'style' );`\n     */\n    get _styles() {\n        return this._attrs.get('style');\n    }\n    /**\n     * Creates a view element.\n     *\n     * Attributes can be passed in various formats:\n     *\n     * ```ts\n     * new Element( viewDocument, 'div', { class: 'editor', contentEditable: 'true' } ); // object\n     * new Element( viewDocument, 'div', [ [ 'class', 'editor' ], [ 'contentEditable', 'true' ] ] ); // map-like iterator\n     * new Element( viewDocument, 'div', mapOfAttributes ); // map\n     * ```\n     *\n     * @internal\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attrs Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attrs, children) {\n        super(document);\n        this.name = name;\n        this._attrs = this._parseAttributes(attrs);\n        this._children = [];\n        if (children) {\n            this._insertChild(0, children);\n        }\n    }\n    /**\n     * Number of element's children.\n     */\n    get childCount() {\n        return this._children.length;\n    }\n    /**\n     * Is `true` if there are no nodes inside this element, `false` otherwise.\n     */\n    get isEmpty() {\n        return this._children.length === 0;\n    }\n    /**\n     * Gets child at the given index.\n     *\n     * @param index Index of child.\n     * @returns Child node.\n     */\n    getChild(index) {\n        return this._children[index];\n    }\n    /**\n     * Gets index of the given child node. Returns `-1` if child node is not found.\n     *\n     * @param node Child node.\n     * @returns Index of the child node.\n     */\n    getChildIndex(node) {\n        return this._children.indexOf(node);\n    }\n    /**\n     * Gets child nodes iterator.\n     *\n     * @returns Child nodes iterator.\n     */\n    getChildren() {\n        return this._children[Symbol.iterator]();\n    }\n    /**\n     * Returns an iterator that contains the keys for attributes. Order of inserting attributes is not preserved.\n     *\n     * @returns Keys for attributes.\n     */\n    *getAttributeKeys() {\n        // This is yielded in this specific order to maintain backward compatibility of data.\n        // Otherwise, we could simply just have the `for` loop only inside this method.\n        if (this._classes) {\n            yield 'class';\n        }\n        if (this._styles) {\n            yield 'style';\n        }\n        for (const key of this._attrs.keys()) {\n            if (key != 'class' && key != 'style') {\n                yield key;\n            }\n        }\n    }\n    /**\n     * Returns iterator that iterates over this element's attributes.\n     *\n     * Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.\n     * This format is accepted by native `Map` object and also can be passed in `Node` constructor.\n     */\n    *getAttributes() {\n        for (const [name, value] of this._attrs.entries()) {\n            yield [name, String(value)];\n        }\n    }\n    /**\n     * Gets attribute by key. If attribute is not present - returns undefined.\n     *\n     * @param key Attribute key.\n     * @returns Attribute value.\n     */\n    getAttribute(key) {\n        return this._attrs.has(key) ? String(this._attrs.get(key)) : undefined;\n    }\n    /**\n     * Returns a boolean indicating whether an attribute with the specified key exists in the element.\n     *\n     * @param key Attribute key.\n     * @returns `true` if attribute with the specified key exists in the element, `false` otherwise.\n     */\n    hasAttribute(key, token) {\n        if (!this._attrs.has(key)) {\n            return false;\n        }\n        if (token !== undefined) {\n            if (usesStylesMap(this.name, key) || usesTokenList(this.name, key)) {\n                return this._attrs.get(key).has(token);\n            }\n            else {\n                return this._attrs.get(key) === token;\n            }\n        }\n        return true;\n    }\n    /**\n     * Checks if this element is similar to other element.\n     * Both elements should have the same name and attributes to be considered as similar. Two similar elements\n     * can contain different set of children nodes.\n     */\n    isSimilar(otherElement) {\n        if (!(otherElement instanceof ViewElement)) {\n            return false;\n        }\n        // If exactly the same Element is provided - return true immediately.\n        if (this === otherElement) {\n            return true;\n        }\n        // Check element name.\n        if (this.name != otherElement.name) {\n            return false;\n        }\n        // Check number of attributes, classes and styles.\n        if (this._attrs.size !== otherElement._attrs.size) {\n            return false;\n        }\n        // Check if attributes are the same.\n        for (const [key, value] of this._attrs) {\n            const otherValue = otherElement._attrs.get(key);\n            if (otherValue === undefined) {\n                return false;\n            }\n            if (typeof value == 'string' || typeof otherValue == 'string') {\n                if (otherValue !== value) {\n                    return false;\n                }\n            }\n            else if (!value.isSimilar(otherValue)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Returns true if class is present.\n     * If more then one class is provided - returns true only when all classes are present.\n     *\n     * ```ts\n     * element.hasClass( 'foo' ); // Returns true if 'foo' class is present.\n     * element.hasClass( 'foo', 'bar' ); // Returns true if 'foo' and 'bar' classes are both present.\n     * ```\n     */\n    hasClass(...className) {\n        for (const name of className) {\n            if (!this._classes || !this._classes.has(name)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Returns iterator that contains all class names.\n     */\n    getClassNames() {\n        const array = this._classes ? this._classes.keys() : [];\n        // This is overcomplicated because we need to be backward compatible for use cases when iterator is expected.\n        const iterator = array[Symbol.iterator]();\n        return Object.assign(array, {\n            next: iterator.next.bind(iterator)\n        });\n    }\n    /**\n     * Returns style value for the given property name.\n     * If the style does not exist `undefined` is returned.\n     *\n     * **Note**: This method can work with normalized style names if\n     * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.\n     * See {@link module:engine/view/stylesmap~StylesMap#getAsString `StylesMap#getAsString()`} for details.\n     *\n     * For an element with style set to `'margin:1px'`:\n     *\n     * ```ts\n     * // Enable 'margin' shorthand processing:\n     * editor.data.addStyleProcessorRules( addMarginStylesRules );\n     *\n     * const element = view.change( writer => {\n     * \tconst element = writer.createElement();\n     * \twriter.setStyle( 'margin', '1px' );\n     * \twriter.setStyle( 'margin-bottom', '3em' );\n     *\n     * \treturn element;\n     * } );\n     *\n     * element.getStyle( 'margin' ); // -> 'margin: 1px 1px 3em;'\n     * ```\n     */\n    getStyle(property) {\n        return this._styles && this._styles.getAsString(property);\n    }\n    /**\n     * Returns a normalized style object or single style value.\n     *\n     * For an element with style set to: margin:1px 2px 3em;\n     *\n     * ```ts\n     * element.getNormalizedStyle( 'margin' ) );\n     * ```\n     *\n     * will return:\n     *\n     * ```ts\n     * {\n     * \ttop: '1px',\n     * \tright: '2px',\n     * \tbottom: '3em',\n     * \tleft: '2px'    // a normalized value from margin shorthand\n     * }\n     * ```\n     *\n     * and reading for single style value:\n     *\n     * ```ts\n     * styles.getNormalizedStyle( 'margin-left' );\n     * ```\n     *\n     * Will return a `2px` string.\n     *\n     * **Note**: This method will return normalized values only if\n     * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.\n     * See {@link module:engine/view/stylesmap~StylesMap#getNormalized `StylesMap#getNormalized()`} for details.\n     *\n     * @param property Name of CSS property\n     */\n    getNormalizedStyle(property) {\n        return this._styles && this._styles.getNormalized(property);\n    }\n    /**\n     * Returns an array that contains all style names.\n     *\n     * @param expand Expand shorthand style properties and return all equivalent style representations.\n     */\n    getStyleNames(expand) {\n        return this._styles ? this._styles.getStyleNames(expand) : [];\n    }\n    /**\n     * Returns true if style keys are present.\n     * If more then one style property is provided - returns true only when all properties are present.\n     *\n     * ```ts\n     * element.hasStyle( 'color' ); // Returns true if 'border-top' style is present.\n     * element.hasStyle( 'color', 'border-top' ); // Returns true if 'color' and 'border-top' styles are both present.\n     * ```\n     */\n    hasStyle(...property) {\n        for (const name of property) {\n            if (!this._styles || !this._styles.has(name)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Returns ancestor element that match specified pattern.\n     * Provided patterns should be compatible with {@link module:engine/view/matcher~Matcher Matcher} as it is used internally.\n     *\n     * @see module:engine/view/matcher~Matcher\n     * @param patterns Patterns used to match correct ancestor. See {@link module:engine/view/matcher~Matcher}.\n     * @returns Found element or `null` if no matching ancestor was found.\n     */\n    findAncestor(...patterns) {\n        const matcher = new Matcher(...patterns);\n        let parent = this.parent;\n        while (parent && !parent.is('documentFragment')) {\n            if (matcher.match(parent)) {\n                return parent;\n            }\n            parent = parent.parent;\n        }\n        return null;\n    }\n    /**\n     * Returns the custom property value for the given key.\n     */\n    getCustomProperty(key) {\n        return this._customProperties.get(key);\n    }\n    /**\n     * Returns an iterator which iterates over this element's custom properties.\n     * Iterator provides `[ key, value ]` pairs for each stored property.\n     */\n    *getCustomProperties() {\n        yield* this._customProperties.entries();\n    }\n    /**\n     * Returns identity string based on element's name, styles, classes and other attributes.\n     * Two elements that {@link #isSimilar are similar} will have same identity string.\n     * It has the following format:\n     *\n     * ```ts\n     * 'name class=\"class1,class2\" style=\"style1:value1;style2:value2\" attr1=\"val1\" attr2=\"val2\"'\n     * ```\n     *\n     * For example:\n     *\n     * ```ts\n     * const element = writer.createContainerElement( 'foo', {\n     * \tbanana: '10',\n     * \tapple: '20',\n     * \tstyle: 'color: red; border-color: white;',\n     * \tclass: 'baz'\n     * } );\n     *\n     * // returns 'foo class=\"baz\" style=\"border-color:white;color:red\" apple=\"20\" banana=\"10\"'\n     * element.getIdentity();\n     * ```\n     *\n     * **Note**: Classes, styles and other attributes are sorted alphabetically.\n     */\n    getIdentity() {\n        const classes = this._classes ? this._classes.keys().sort().join(',') : '';\n        const styles = this._styles && String(this._styles);\n        const attributes = Array.from(this._attrs)\n            .filter(([key]) => key != 'style' && key != 'class')\n            .map(i => `${i[0]}=\"${i[1]}\"`)\n            .sort().join(' ');\n        return this.name +\n            (classes == '' ? '' : ` class=\"${classes}\"`) +\n            (!styles ? '' : ` style=\"${styles}\"`) +\n            (attributes == '' ? '' : ` ${attributes}`);\n    }\n    /**\n     * Decides whether an unsafe attribute is whitelisted and should be rendered in the editing pipeline even though filtering mechanisms\n     * like {@link module:engine/view/domconverter~ViewDomConverter#shouldRenderAttribute} say it should not.\n     *\n     * Unsafe attribute names can be specified when creating an element via {@link module:engine/view/downcastwriter~ViewDowncastWriter}.\n     *\n     * @param attributeName The name of the attribute to be checked.\n     */\n    shouldRenderUnsafeAttribute(attributeName) {\n        return this._unsafeAttributesToRender.includes(attributeName);\n    }\n    /**\n     * Converts `ViewElement` to plain object and returns it.\n     *\n     * @returns `ViewElement` converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.name = this.name;\n        json.type = 'Element';\n        if (this._attrs.size) {\n            json.attributes = Object.fromEntries(this.getAttributes());\n        }\n        if (this._children.length > 0) {\n            json.children = [];\n            for (const node of this._children) {\n                json.children.push(node.toJSON());\n            }\n        }\n        return json;\n    }\n    /**\n     * Clones provided element.\n     *\n     * @internal\n     * @param deep If set to `true` clones element and all its children recursively. When set to `false`,\n     * element will be cloned without any children.\n     * @returns Clone of this element.\n     */\n    _clone(deep = false) {\n        const childrenClone = [];\n        if (deep) {\n            for (const child of this.getChildren()) {\n                childrenClone.push(child._clone(deep));\n            }\n        }\n        // ViewContainerElement and ViewAttributeElement should be also cloned properly.\n        const cloned = new this.constructor(this.document, this.name, this._attrs, childrenClone);\n        // Clone custom properties.\n        cloned._customProperties = new Map(this._customProperties);\n        // Clone filler offset method.\n        // We can't define this method in a prototype because it's behavior which\n        // is changed by e.g. toWidget() function from ckeditor5-widget. Perhaps this should be one of custom props.\n        cloned.getFillerOffset = this.getFillerOffset;\n        // Clone unsafe attributes list.\n        cloned._unsafeAttributesToRender = this._unsafeAttributesToRender;\n        return cloned;\n    }\n    /**\n     * {@link module:engine/view/element~ViewElement#_insertChild Insert} a child node or a list of child nodes at the end of this node\n     * and sets the parent of these nodes to this element.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#insert\n     * @internal\n     * @param items Items to be inserted.\n     * @fires change\n     * @returns Number of appended nodes.\n     */\n    _appendChild(items) {\n        return this._insertChild(this.childCount, items);\n    }\n    /**\n     * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to\n     * this element.\n     *\n     * @internal\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#insert\n     * @param index Position where nodes should be inserted.\n     * @param items Items to be inserted.\n     * @fires change\n     * @returns Number of inserted nodes.\n     */\n    _insertChild(index, items) {\n        this._fireChange('children', this, { index });\n        let count = 0;\n        const nodes = normalize(this.document, items);\n        for (const node of nodes) {\n            // If node that is being added to this element is already inside another element, first remove it from the old parent.\n            if (node.parent !== null) {\n                node._remove();\n            }\n            node.parent = this;\n            node.document = this.document;\n            this._children.splice(index, 0, node);\n            index++;\n            count++;\n        }\n        return count;\n    }\n    /**\n     * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#remove\n     * @internal\n     * @param index Number of the first node to remove.\n     * @param howMany Number of nodes to remove.\n     * @fires change\n     * @returns The array of removed nodes.\n     */\n    _removeChildren(index, howMany = 1) {\n        this._fireChange('children', this, { index });\n        for (let i = index; i < index + howMany; i++) {\n            this._children[i].parent = null;\n        }\n        return this._children.splice(index, howMany);\n    }\n    /**\n     * Adds or overwrite attribute with a specified key and value.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#setAttribute\n     * @internal\n     * @param key Attribute key.\n     * @param value Attribute value.\n     * @param overwrite Whether tokenized attribute should override the attribute value or just add a token.\n     * @fires change\n     */\n    _setAttribute(key, value, overwrite = true) {\n        this._fireChange('attributes', this);\n        if (usesStylesMap(this.name, key) || usesTokenList(this.name, key)) {\n            let currentValue = this._attrs.get(key);\n            if (!currentValue) {\n                currentValue = usesStylesMap(this.name, key) ?\n                    new StylesMap(this.document.stylesProcessor) :\n                    new ViewTokenList();\n                this._attrs.set(key, currentValue);\n            }\n            if (overwrite) {\n                // If reset is set then value have to be a string to tokenize.\n                currentValue.setTo(String(value));\n            }\n            else if (usesStylesMap(this.name, key)) {\n                if (Array.isArray(value)) {\n                    currentValue.set(value[0], value[1]);\n                }\n                else {\n                    currentValue.set(value);\n                }\n            }\n            else { // TokenList.\n                currentValue.set(typeof value == 'string' ? value.split(/\\s+/) : value);\n            }\n        }\n        else {\n            this._attrs.set(key, String(value));\n        }\n    }\n    /**\n     * Removes attribute from the element.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeAttribute\n     * @internal\n     * @param key Attribute key.\n     * @param tokens Attribute value tokens to remove. The whole attribute is removed if not specified.\n     * @returns Returns true if an attribute existed and has been removed.\n     * @fires change\n     */\n    _removeAttribute(key, tokens) {\n        this._fireChange('attributes', this);\n        if (tokens !== undefined && (usesStylesMap(this.name, key) || usesTokenList(this.name, key))) {\n            const currentValue = this._attrs.get(key);\n            if (!currentValue) {\n                return false;\n            }\n            if (usesTokenList(this.name, key) && typeof tokens == 'string') {\n                tokens = tokens.split(/\\s+/);\n            }\n            currentValue.remove(tokens);\n            if (currentValue.isEmpty) {\n                return this._attrs.delete(key);\n            }\n            return false;\n        }\n        return this._attrs.delete(key);\n    }\n    /**\n     * Adds specified class.\n     *\n     * ```ts\n     * element._addClass( 'foo' ); // Adds 'foo' class.\n     * element._addClass( [ 'foo', 'bar' ] ); // Adds 'foo' and 'bar' classes.\n     * ```\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#addClass\n     * @internal\n     * @fires change\n     */\n    _addClass(className) {\n        this._setAttribute('class', className, false);\n    }\n    /**\n     * Removes specified class.\n     *\n     * ```ts\n     * element._removeClass( 'foo' );  // Removes 'foo' class.\n     * element._removeClass( [ 'foo', 'bar' ] ); // Removes both 'foo' and 'bar' classes.\n     * ```\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeClass\n     * @internal\n     * @fires change\n     */\n    _removeClass(className) {\n        this._removeAttribute('class', className);\n    }\n    _setStyle(property, value) {\n        if (typeof property != 'string') {\n            this._setAttribute('style', property, false);\n        }\n        else {\n            this._setAttribute('style', [property, value], false);\n        }\n    }\n    /**\n     * Removes specified style.\n     *\n     * ```ts\n     * element._removeStyle( 'color' );  // Removes 'color' style.\n     * element._removeStyle( [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.\n     * ```\n     *\n     * **Note**: This method can work with normalized style names if\n     * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.\n     * See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeStyle\n     * @internal\n     * @fires change\n     */\n    _removeStyle(property) {\n        this._removeAttribute('style', property);\n    }\n    /**\n     * Used by the {@link module:engine/view/matcher~Matcher Matcher} to collect matching attribute tuples\n     * (attribute name and optional token).\n     *\n     * Normalized patterns can be used in following ways:\n     * - to match any attribute name with any or no value:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ true, true ]\n     * ]\n     * ```\n     *\n     * - to match a specific attribute with any value:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ 'required', true ]\n     * ]\n     * ```\n     *\n     * - to match an attribute name with a RegExp with any value:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ /h[1-6]/, true ]\n     * ]\n     * ```\n     *\n     * \t- to match a specific attribute with the exact value:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ 'rel', 'nofollow' ]\n     * ]\n     * ```\n     *\n     * \t- to match a specific attribute with a value matching a RegExp:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ 'src', /^https/ ]\n     * ]\n     * ```\n     *\n     * \t- to match an attribute name with a RegExp and the exact value:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ /^data-property-/, 'foobar' ],\n     * ]\n     * ```\n     *\n     * \t- to match an attribute name with a RegExp and match a value with another RegExp:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ /^data-property-/, /^foo/ ]\n     * ]\n     * ```\n     *\n     * \t- to match a specific style property with the value matching a RegExp:\n     *\n     * ```ts\n     * patterns: [\n     * \t[ 'style', 'font-size', /px$/ ]\n     * ]\n     * ```\n     *\n     * \t- to match a specific class (class attribute is tokenized so it matches tokens individually):\n     *\n     * ```ts\n     * patterns: [\n     * \t[ 'class', 'foo' ]\n     * ]\n     * ```\n     *\n     * @internal\n     * @param patterns An array of normalized patterns (tuples of 2 or 3 items depending on if tokenized attribute value match is needed).\n     * @param match An array to populate with matching tuples.\n     * @param exclude Array of attribute names to exclude from match.\n     * @returns `true` if element matches all patterns. The matching tuples are pushed to the `match` array.\n     */\n    _collectAttributesMatch(patterns, match, exclude) {\n        for (const [keyPattern, tokenPattern, valuePattern] of patterns) {\n            let hasKey = false;\n            let hasValue = false;\n            for (const [key, value] of this._attrs) {\n                if (exclude && exclude.includes(key) || !isPatternMatched(keyPattern, key)) {\n                    continue;\n                }\n                hasKey = true;\n                if (typeof value == 'string') {\n                    if (isPatternMatched(tokenPattern, value)) {\n                        match.push([key]);\n                        hasValue = true;\n                    }\n                    else if (!(keyPattern instanceof RegExp)) {\n                        return false;\n                    }\n                }\n                else {\n                    const tokenMatch = value._getTokensMatch(tokenPattern, valuePattern || true);\n                    if (tokenMatch) {\n                        hasValue = true;\n                        for (const tokenMatchItem of tokenMatch) {\n                            match.push([key, tokenMatchItem]);\n                        }\n                    }\n                    else if (!(keyPattern instanceof RegExp)) {\n                        return false;\n                    }\n                }\n            }\n            if (!hasKey || !hasValue) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Used by the {@link module:engine/conversion/viewconsumable~ViewConsumable} to collect the\n     * {@link module:engine/view/element~ViewNormalizedConsumables} for the element.\n     *\n     * When `key` and `token` parameters are provided the output is filtered for the specified attribute and it's tokens and related tokens.\n     *\n     * @internal\n     * @param key Attribute name.\n     * @param token Reference token to collect all related tokens.\n     */\n    _getConsumables(key, token) {\n        const attributes = [];\n        if (key) {\n            const value = this._attrs.get(key);\n            if (value !== undefined) {\n                if (typeof value == 'string') {\n                    attributes.push([key]);\n                }\n                else {\n                    for (const prop of value._getConsumables(token)) {\n                        attributes.push([key, prop]);\n                    }\n                }\n            }\n        }\n        else {\n            for (const [key, value] of this._attrs) {\n                if (typeof value == 'string') {\n                    attributes.push([key]);\n                }\n                else {\n                    for (const prop of value._getConsumables()) {\n                        attributes.push([key, prop]);\n                    }\n                }\n            }\n        }\n        return {\n            name: !key,\n            attributes\n        };\n    }\n    /**\n     * Verify if the given element can be merged without conflicts into the element.\n     *\n     * Note that this method is extended by the {@link module:engine/view/attributeelement~ViewAttributeElement} implementation.\n     *\n     * This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.\n     *\n     * @internal\n     * @returns Returns `true` if elements can be merged.\n     */\n    _canMergeAttributesFrom(otherElement) {\n        if (this.name != otherElement.name) {\n            return false;\n        }\n        for (const [key, otherValue] of otherElement._attrs) {\n            const value = this._attrs.get(key);\n            if (value === undefined) {\n                continue;\n            }\n            if (typeof value == 'string' || typeof otherValue == 'string') {\n                if (value !== otherValue) {\n                    return false;\n                }\n            }\n            else if (!value._canMergeFrom(otherValue)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Merges attributes of a given element into the element.\n     * This includes also tokenized attributes like style and class.\n     *\n     * Note that you should make sure there are no conflicts before merging (see {@link #_canMergeAttributesFrom}).\n     *\n     * This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.\n     *\n     * @internal\n     */\n    _mergeAttributesFrom(otherElement) {\n        this._fireChange('attributes', this);\n        // Move all attributes/classes/styles from wrapper to wrapped ViewAttributeElement.\n        for (const [key, otherValue] of otherElement._attrs) {\n            const value = this._attrs.get(key);\n            if (value === undefined || typeof value == 'string' || typeof otherValue == 'string') {\n                this._setAttribute(key, otherValue);\n            }\n            else {\n                value._mergeFrom(otherValue);\n            }\n        }\n    }\n    /**\n     * Verify if the given element attributes can be fully subtracted from the element.\n     *\n     * Note that this method is extended by the {@link module:engine/view/attributeelement~ViewAttributeElement} implementation.\n     *\n     * This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.\n     *\n     * @internal\n     * @returns Returns `true` if elements attributes can be fully subtracted.\n     */\n    _canSubtractAttributesOf(otherElement) {\n        if (this.name != otherElement.name) {\n            return false;\n        }\n        for (const [key, otherValue] of otherElement._attrs) {\n            const value = this._attrs.get(key);\n            if (value === undefined) {\n                return false;\n            }\n            if (typeof value == 'string' || typeof otherValue == 'string') {\n                if (value !== otherValue) {\n                    return false;\n                }\n            }\n            else if (!value._isMatching(otherValue)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Removes (subtracts) corresponding attributes of the given element from the element.\n     * This includes also tokenized attributes like style and class.\n     * All attributes, classes and styles from given element should be present inside the element being unwrapped.\n     *\n     * Note that you should make sure all attributes could be subtracted before subtracting them (see {@link #_canSubtractAttributesOf}).\n     *\n     * This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting\n     * an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.\n     *\n     * @internal\n     */\n    _subtractAttributesOf(otherElement) {\n        this._fireChange('attributes', this);\n        for (const [key, otherValue] of otherElement._attrs) {\n            const value = this._attrs.get(key);\n            if (typeof value == 'string' || typeof otherValue == 'string') {\n                this._attrs.delete(key);\n            }\n            else {\n                value.remove(otherValue.keys());\n                if (value.isEmpty) {\n                    this._attrs.delete(key);\n                }\n            }\n        }\n    }\n    /**\n     * Sets a custom property. Unlike attributes, custom properties are not rendered to the DOM,\n     * so they can be used to add special data to elements.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#setCustomProperty\n     * @internal\n     */\n    _setCustomProperty(key, value) {\n        this._customProperties.set(key, value);\n    }\n    /**\n     * Removes the custom property stored under the given key.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeCustomProperty\n     * @internal\n     * @returns Returns true if property was removed.\n     */\n    _removeCustomProperty(key) {\n        return this._customProperties.delete(key);\n    }\n    /**\n     * Parses attributes provided to the element constructor before they are applied to an element. If attributes are passed\n     * as an object (instead of `Iterable`), the object is transformed to the map. Attributes with `null` value are removed.\n     * Attributes with non-`String` value are converted to `String`.\n     *\n     * @param attrs Attributes to parse.\n     * @returns Parsed attributes.\n     */\n    _parseAttributes(attrs) {\n        const attrsMap = toMap(attrs);\n        for (const [key, value] of attrsMap) {\n            if (value === null) {\n                attrsMap.delete(key);\n            }\n            else if (usesStylesMap(this.name, key)) {\n                // This is either an element clone so we need to clone styles map, or a new instance which requires value to be parsed.\n                const newValue = value instanceof StylesMap ?\n                    value._clone() :\n                    new StylesMap(this.document.stylesProcessor).setTo(String(value));\n                attrsMap.set(key, newValue);\n            }\n            else if (usesTokenList(this.name, key)) {\n                // This is either an element clone so we need to clone token list, or a new instance which requires value to be parsed.\n                const newValue = value instanceof ViewTokenList ?\n                    value._clone() :\n                    new ViewTokenList().setTo(String(value));\n                attrsMap.set(key, newValue);\n            }\n            else if (typeof value != 'string') {\n                attrsMap.set(key, String(value));\n            }\n        }\n        return attrsMap;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'element' || type === 'view:element' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'element' || type === 'view:element');\n    }\n};\n/**\n * Converts strings to Text and non-iterables to arrays.\n */\nfunction normalize(document, nodes) {\n    // Separate condition because string is iterable.\n    if (typeof nodes == 'string') {\n        return [new ViewText(document, nodes)];\n    }\n    if (!isIterable(nodes)) {\n        nodes = [nodes];\n    }\n    const normalizedNodes = [];\n    for (const node of nodes) {\n        if (typeof node == 'string') {\n            normalizedNodes.push(new ViewText(document, node));\n        }\n        else if (node instanceof ViewTextProxy) {\n            normalizedNodes.push(new ViewText(document, node.data));\n        }\n        else {\n            normalizedNodes.push(node);\n        }\n    }\n    return normalizedNodes;\n}\n/**\n * Returns `true` if an attribute on a given element should be handled as a TokenList.\n */\nfunction usesTokenList(elementName, key) {\n    return key == 'class' || elementName == 'a' && key == 'rel';\n}\n/**\n * Returns `true` if an attribute on a given element should be handled as a StylesMap.\n */\nfunction usesStylesMap(elementName, key) {\n    return key == 'style';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/containerelement\n */\nimport { ViewElement } from './element.js';\n/**\n * Containers are elements which define document structure. They define boundaries for\n * {@link module:engine/view/attributeelement~ViewAttributeElement attributes}.\n * They are mostly used for block elements like `<p>` or `<div>`.\n *\n * Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various\n * types (container element, {@link module:engine/view/attributeelement~ViewAttributeElement attribute element},\n * {@link module:engine/view/emptyelement~ViewEmptyElement empty element}, etc) when developing a feature.\n *\n * The container element should be your default choice when writing a converter, unless:\n *\n * * this element represents a model text attribute (then use {@link module:engine/view/attributeelement~ViewAttributeElement}),\n * * this is an empty element like `<img>` (then use {@link module:engine/view/emptyelement~ViewEmptyElement}),\n * * this is a root element,\n * * this is a nested editable element (then use  {@link module:engine/view/editableelement~ViewEditableElement}).\n *\n * To create a new container element instance use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement `ViewDowncastWriter#createContainerElement()`}\n * method.\n */\nexport class ViewContainerElement extends ViewElement {\n    /**\n     * Creates a container element.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement\n     * @see module:engine/view/element~ViewElement\n     * @internal\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attrs Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attrs, children) {\n        super(document, name, attrs, children);\n        this.getFillerOffset = getViewFillerOffset;\n    }\n    /**\n     * Converts `ViewContainerElement` instance to plain object and returns it.\n     *\n     * @returns `ViewContainerElement` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'ContainerElement';\n        return json;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewContainerElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'containerElement' || type === 'view:containerElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'containerElement' || type === 'view:containerElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'view:element');\n    }\n};\n/**\n * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.\n *\n * @returns Block filler offset or `null` if block filler is not needed.\n */\nexport function getViewFillerOffset() {\n    const children = [...this.getChildren()];\n    const lastChild = children[this.childCount - 1];\n    // Block filler is required after a `<br>` if it's the last element in its container. See #1422.\n    if (lastChild && lastChild.is('element', 'br')) {\n        return this.childCount;\n    }\n    for (const child of children) {\n        // If there's any non-UI element – don't render the bogus.\n        if (!child.is('uiElement')) {\n            return null;\n        }\n    }\n    // If there are only UI elements – render the bogus at the end of the element.\n    return this.childCount;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/editableelement\n */\nimport { ViewContainerElement } from './containerelement.js';\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Editable element which can be a {@link module:engine/view/rooteditableelement~ViewRootEditableElement root}\n * or nested editable area in the editor.\n *\n * Editable is automatically read-only when its {@link module:engine/view/document~ViewDocument Document} is read-only.\n *\n * The constructor of this class shouldn't be used directly. To create new `ViewEditableElement` use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEditableElement `downcastWriter#createEditableElement()`} method.\n */\nexport class ViewEditableElement extends /* #__PURE__ */ ObservableMixin(ViewContainerElement) {\n    /**\n     * Creates an editable element.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createEditableElement\n     * @internal\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attributes Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attributes, children) {\n        super(document, name, attributes, children);\n        this.set('isReadOnly', false);\n        this.set('isFocused', false);\n        this.set('placeholder', undefined);\n        this.bind('isReadOnly').to(document);\n        this.bind('isFocused').to(document, 'isFocused', isFocused => isFocused && document.selection.editableElement == this);\n        // Update focus state based on selection changes.\n        this.listenTo(document.selection, 'change', () => {\n            this.isFocused = document.isFocused && document.selection.editableElement == this;\n        });\n    }\n    destroy() {\n        this.stopListening();\n    }\n    /**\n     * Converts `ViewEditableElement` instance to plain object and returns it.\n     *\n     * @returns `ViewEditableElement` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'EditableElement';\n        json.isReadOnly = this.isReadOnly;\n        json.isFocused = this.isFocused;\n        return json;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewEditableElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'editableElement' || type === 'view:editableElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'containerElement' || type === 'view:containerElement' ||\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'editableElement' || type === 'view:editableElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'containerElement' || type === 'view:containerElement' ||\n            type === 'element' || type === 'view:element');\n    }\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/rooteditableelement\n */\nimport { ViewEditableElement } from './editableelement.js';\nconst rootNameSymbol = Symbol('rootName');\n/**\n * Class representing a single root in the data view. A root can be either\n * {@link ~ViewRootEditableElement#isReadOnly editable or read-only},\n * but in both cases it is called \"an editable\". Roots can contain other {@link module:engine/view/editableelement~ViewEditableElement\n * editable elements} making them \"nested editables\".\n */\nexport class ViewRootEditableElement extends ViewEditableElement {\n    /**\n     * Creates root editable element.\n     *\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     */\n    constructor(document, name) {\n        super(document, name);\n        this.rootName = 'main';\n    }\n    /**\n     * Name of this root inside {@link module:engine/view/document~ViewDocument} that is an owner of this root. If no\n     * other name is set, `main` name is used.\n     *\n     * @readonly\n     */\n    get rootName() {\n        return this.getCustomProperty(rootNameSymbol);\n    }\n    set rootName(rootName) {\n        this._setCustomProperty(rootNameSymbol, rootName);\n    }\n    /**\n     * Converts `ViewRootEditableElement` instance to string and returns it.\n     *\n     * @returns `ViewRootEditableElement` instance converted to string.\n     */\n    toJSON() {\n        return this.rootName;\n    }\n    /**\n     * Overrides old element name and sets new one.\n     * This is needed because view roots are created before they are attached to the DOM.\n     * The name of the root element is temporary at this stage. It has to be changed when the\n     * view root element is attached to the DOM element.\n     *\n     * @internal\n     * @param name The new name of element.\n     */\n    set _name(name) {\n        this.name = name;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewRootEditableElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'rootElement' || type === 'view:rootElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'editableElement' || type === 'view:editableElement' ||\n            type === 'containerElement' || type === 'view:containerElement' ||\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'rootElement' || type === 'view:rootElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'editableElement' || type === 'view:editableElement' ||\n            type === 'containerElement' || type === 'view:containerElement' ||\n            type === 'element' || type === 'view:element');\n    }\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ViewTextProxy } from './textproxy.js';\nimport { ViewPosition } from './position.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Position iterator class. It allows to iterate forward and backward over the document.\n */\nexport class ViewTreeWalker {\n    /**\n     * Walking direction. Defaults `'forward'`.\n     */\n    direction;\n    /**\n     * Iterator boundaries.\n     *\n     * When the iterator is walking `'forward'` on the end of boundary or is walking `'backward'`\n     * on the start of boundary, then `{ done: true }` is returned.\n     *\n     * If boundaries are not defined they are set before first and after last child of the root node.\n     */\n    boundaries;\n    /**\n     * Flag indicating whether all characters from {@link module:engine/view/text~ViewText} should be returned as one\n     * {@link module:engine/view/text~ViewText} or one by one as {@link module:engine/view/textproxy~ViewTextProxy}.\n     */\n    singleCharacters;\n    /**\n     * Flag indicating whether iterator should enter elements or not. If the iterator is shallow child nodes of any\n     * iterated node will not be returned along with `elementEnd` tag.\n     */\n    shallow;\n    /**\n     * Flag indicating whether iterator should ignore `elementEnd` tags. If set to `true`, walker will not\n     * return a parent node of the start position. Each {@link module:engine/view/element~ViewElement} will be returned once.\n     * When set to `false` each element might be returned twice: for `'elementStart'` and `'elementEnd'`.\n     */\n    ignoreElementEnd;\n    /**\n     * Iterator position. If start position is not defined then position depends on {@link #direction}. If direction is\n     * `'forward'` position starts form the beginning, when direction is `'backward'` position starts from the end.\n     */\n    _position;\n    /**\n     * Start boundary parent.\n     */\n    _boundaryStartParent;\n    /**\n     * End boundary parent.\n     */\n    _boundaryEndParent;\n    /**\n     * Creates a range iterator. All parameters are optional, but you have to specify either `boundaries` or `startPosition`.\n     *\n     * @param options Object with configuration.\n     */\n    constructor(options = {}) {\n        if (!options.boundaries && !options.startPosition) {\n            /**\n             * Neither boundaries nor starting position have been defined.\n             *\n             * @error view-tree-walker-no-start-position\n             */\n            throw new CKEditorError('view-tree-walker-no-start-position', null);\n        }\n        if (options.direction && options.direction != 'forward' && options.direction != 'backward') {\n            /**\n             * Only `backward` and `forward` direction allowed.\n             *\n             * @error view-tree-walker-unknown-direction\n             */\n            throw new CKEditorError('view-tree-walker-unknown-direction', options.startPosition, { direction: options.direction });\n        }\n        this.boundaries = options.boundaries || null;\n        if (options.startPosition) {\n            this._position = ViewPosition._createAt(options.startPosition);\n        }\n        else {\n            this._position = ViewPosition._createAt(options.boundaries[options.direction == 'backward' ? 'end' : 'start']);\n        }\n        this.direction = options.direction || 'forward';\n        this.singleCharacters = !!options.singleCharacters;\n        this.shallow = !!options.shallow;\n        this.ignoreElementEnd = !!options.ignoreElementEnd;\n        this._boundaryStartParent = this.boundaries ? this.boundaries.start.parent : null;\n        this._boundaryEndParent = this.boundaries ? this.boundaries.end.parent : null;\n    }\n    /**\n     * Iterable interface.\n     */\n    [Symbol.iterator]() {\n        return this;\n    }\n    /**\n     * Iterator position. If start position is not defined then position depends on {@link #direction}. If direction is\n     * `'forward'` position starts form the beginning, when direction is `'backward'` position starts from the end.\n     */\n    get position() {\n        return this._position;\n    }\n    /**\n     * Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.\n     *\n     * For example:\n     *\n     * ```ts\n     * walker.skip( value => value.type == 'text' ); // <p>{}foo</p> -> <p>foo[]</p>\n     * walker.skip( value => true ); // Move the position to the end: <p>{}foo</p> -> <p>foo</p>[]\n     * walker.skip( value => false ); // Do not move the position.\n     * ```\n     *\n     * @param skip Callback function. Gets {@link module:engine/view/treewalker~ViewTreeWalkerValue} and should\n     * return `true` if the value should be skipped or `false` if not.\n     */\n    skip(skip) {\n        let nextResult;\n        let prevPosition;\n        do {\n            prevPosition = this.position;\n            nextResult = this.next();\n        } while (!nextResult.done && skip(nextResult.value));\n        if (!nextResult.done) {\n            this._position = prevPosition;\n        }\n    }\n    /**\n     * Moves tree walker {@link #position} to provided `position`. Tree walker will\n     * continue traversing from that position.\n     *\n     * Note: in contrary to {@link ~ViewTreeWalker#skip}, this method does not iterate over the nodes along the way.\n     * It simply sets the current tree walker position to a new one.\n     * From the performance standpoint, it is better to use {@link ~ViewTreeWalker#jumpTo} rather than {@link ~ViewTreeWalker#skip}.\n     *\n     * If the provided position is before the start boundary, the position will be\n     * set to the start boundary. If the provided position is after the end boundary,\n     * the position will be set to the end boundary.\n     * This is done to prevent the treewalker from traversing outside the boundaries.\n     *\n     * @param position Position to jump to.\n     */\n    jumpTo(position) {\n        if (this._boundaryStartParent && position.isBefore(this.boundaries.start)) {\n            position = this.boundaries.start;\n        }\n        else if (this._boundaryEndParent && position.isAfter(this.boundaries.end)) {\n            position = this.boundaries.end;\n        }\n        this._position = position.clone();\n    }\n    /**\n     * Gets the next tree walker's value.\n     *\n     * @returns Object implementing iterator interface, returning\n     * information about taken step.\n     */\n    next() {\n        if (this.direction == 'forward') {\n            return this._next();\n        }\n        else {\n            return this._previous();\n        }\n    }\n    /**\n     * Makes a step forward in view. Moves the {@link #position} to the next position and returns the encountered value.\n     */\n    _next() {\n        let position = this.position.clone();\n        const previousPosition = this.position;\n        const parent = position.parent;\n        // We are at the end of the root.\n        if (parent.parent === null && position.offset === parent.childCount) {\n            return { done: true, value: undefined };\n        }\n        // We reached the walker boundary.\n        if (parent === this._boundaryEndParent && position.offset == this.boundaries.end.offset) {\n            return { done: true, value: undefined };\n        }\n        // Get node just after current position.\n        let node;\n        // Text is a specific parent because it contains string instead of child nodes.\n        if (parent && parent.is('view:$text')) {\n            if (position.isAtEnd) {\n                // Prevent returning \"elementEnd\" for Text node. Skip that value and return the next walker step.\n                this._position = ViewPosition._createAfter(parent);\n                return this._next();\n            }\n            node = parent.data[position.offset];\n        }\n        else {\n            node = parent.getChild(position.offset);\n        }\n        if (typeof node == 'string') {\n            let textLength;\n            if (this.singleCharacters) {\n                textLength = 1;\n            }\n            else {\n                // Check if text stick out of walker range.\n                const endOffset = parent === this._boundaryEndParent ? this.boundaries.end.offset : parent.data.length;\n                textLength = endOffset - position.offset;\n            }\n            const textProxy = new ViewTextProxy(parent, position.offset, textLength);\n            position.offset += textLength;\n            this._position = position;\n            return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);\n        }\n        if (node && node.is('view:element')) {\n            if (!this.shallow) {\n                position = new ViewPosition(node, 0);\n            }\n            else {\n                // We are past the walker boundaries.\n                if (this.boundaries && this.boundaries.end.isBefore(position)) {\n                    return { done: true, value: undefined };\n                }\n                position.offset++;\n            }\n            this._position = position;\n            return this._formatReturnValue('elementStart', node, previousPosition, position, 1);\n        }\n        if (node && node.is('view:$text')) {\n            if (this.singleCharacters) {\n                position = new ViewPosition(node, 0);\n                this._position = position;\n                return this._next();\n            }\n            let charactersCount = node.data.length;\n            let item;\n            // If text stick out of walker range, we need to cut it and wrap in ViewTextProxy.\n            if (node == this._boundaryEndParent) {\n                charactersCount = this.boundaries.end.offset;\n                item = new ViewTextProxy(node, 0, charactersCount);\n                position = ViewPosition._createAfter(item);\n            }\n            else {\n                item = new ViewTextProxy(node, 0, node.data.length);\n                // If not just keep moving forward.\n                position.offset++;\n            }\n            this._position = position;\n            return this._formatReturnValue('text', item, previousPosition, position, charactersCount);\n        }\n        // `node` is not set, we reached the end of current `parent`.\n        position = ViewPosition._createAfter(parent);\n        this._position = position;\n        if (this.ignoreElementEnd) {\n            return this._next();\n        }\n        return this._formatReturnValue('elementEnd', parent, previousPosition, position);\n    }\n    /**\n     * Makes a step backward in view. Moves the {@link #position} to the previous position and returns the encountered value.\n     */\n    _previous() {\n        let position = this.position.clone();\n        const previousPosition = this.position;\n        const parent = position.parent;\n        // We are at the beginning of the root.\n        if (parent.parent === null && position.offset === 0) {\n            return { done: true, value: undefined };\n        }\n        // We reached the walker boundary.\n        if (parent == this._boundaryStartParent && position.offset == this.boundaries.start.offset) {\n            return { done: true, value: undefined };\n        }\n        // Get node just before current position.\n        let node;\n        // Text {@link module:engine/view/text~ViewText} element is a specific parent because contains string instead of child nodes.\n        if (parent.is('view:$text')) {\n            if (position.isAtStart) {\n                // Prevent returning \"elementStart\" for Text node. Skip that value and return the next walker step.\n                this._position = ViewPosition._createBefore(parent);\n                return this._previous();\n            }\n            node = parent.data[position.offset - 1];\n        }\n        else {\n            node = parent.getChild(position.offset - 1);\n        }\n        if (typeof node == 'string') {\n            let textLength;\n            if (!this.singleCharacters) {\n                // Check if text stick out of walker range.\n                const startOffset = parent === this._boundaryStartParent ? this.boundaries.start.offset : 0;\n                textLength = position.offset - startOffset;\n            }\n            else {\n                textLength = 1;\n            }\n            position.offset -= textLength;\n            const textProxy = new ViewTextProxy(parent, position.offset, textLength);\n            this._position = position;\n            return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);\n        }\n        if (node && node.is('view:element')) {\n            if (this.shallow) {\n                position.offset--;\n                this._position = position;\n                return this._formatReturnValue('elementStart', node, previousPosition, position, 1);\n            }\n            position = new ViewPosition(node, node.childCount);\n            this._position = position;\n            if (this.ignoreElementEnd) {\n                return this._previous();\n            }\n            return this._formatReturnValue('elementEnd', node, previousPosition, position);\n        }\n        if (node && node.is('view:$text')) {\n            if (this.singleCharacters) {\n                position = new ViewPosition(node, node.data.length);\n                this._position = position;\n                return this._previous();\n            }\n            let charactersCount = node.data.length;\n            let item;\n            // If text stick out of walker range, we need to cut it and wrap in ViewTextProxy.\n            if (node == this._boundaryStartParent) {\n                const offset = this.boundaries.start.offset;\n                item = new ViewTextProxy(node, offset, node.data.length - offset);\n                charactersCount = item.data.length;\n                position = ViewPosition._createBefore(item);\n            }\n            else {\n                item = new ViewTextProxy(node, 0, node.data.length);\n                // If not just keep moving backward.\n                position.offset--;\n            }\n            this._position = position;\n            return this._formatReturnValue('text', item, previousPosition, position, charactersCount);\n        }\n        // `node` is not set, we reached the beginning of current `parent`.\n        position = ViewPosition._createBefore(parent);\n        this._position = position;\n        return this._formatReturnValue('elementStart', parent, previousPosition, position, 1);\n    }\n    /**\n     * Format returned data and adjust `previousPosition` and `nextPosition` if\n     * reach the bound of the {@link module:engine/view/text~ViewText}.\n     *\n     * @param type Type of step.\n     * @param item Item between old and new position.\n     * @param previousPosition Previous position of iterator.\n     * @param nextPosition Next position of iterator.\n     * @param length Length of the item.\n     */\n    _formatReturnValue(type, item, previousPosition, nextPosition, length) {\n        // Text is a specific parent, because contains string instead of children.\n        // Walker doesn't enter to the Text except situations when walker is iterating over every single character,\n        // or the bound starts/ends inside the Text. So when the position is at the beginning or at the end of the Text\n        // we move it just before or just after Text.\n        if (item.is('view:$textProxy')) {\n            // Position is at the end of Text.\n            if (item.offsetInText + item.data.length == item.textNode.data.length) {\n                if (this.direction == 'forward' && !(this.boundaries && this.boundaries.end.isEqual(this.position))) {\n                    nextPosition = ViewPosition._createAfter(item.textNode);\n                    // When we change nextPosition of returned value we need also update walker current position.\n                    this._position = nextPosition;\n                }\n                else {\n                    previousPosition = ViewPosition._createAfter(item.textNode);\n                }\n            }\n            // Position is at the begining ot the text.\n            if (item.offsetInText === 0) {\n                if (this.direction == 'backward' && !(this.boundaries && this.boundaries.start.isEqual(this.position))) {\n                    nextPosition = ViewPosition._createBefore(item.textNode);\n                    // When we change nextPosition of returned value we need also update walker current position.\n                    this._position = nextPosition;\n                }\n                else {\n                    previousPosition = ViewPosition._createBefore(item.textNode);\n                }\n            }\n        }\n        return {\n            done: false,\n            value: {\n                type,\n                item,\n                previousPosition,\n                nextPosition,\n                length\n            }\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/position\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';\nimport { ViewEditableElement } from './editableelement.js';\nimport { ViewTreeWalker } from './treewalker.js';\n/**\n * Position in the view tree. Position is represented by its parent node and an offset in this parent.\n *\n * In order to create a new position instance use the `createPosition*()` factory methods available in:\n *\n * * {@link module:engine/view/view~EditingView}\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter}\n * * {@link module:engine/view/upcastwriter~ViewUpcastWriter}\n */\nexport class ViewPosition extends ViewTypeCheckable {\n    /**\n     * Position parent.\n     */\n    parent;\n    /**\n     * Position offset.\n     */\n    offset;\n    /**\n     * Creates a position.\n     *\n     * @param parent Position parent.\n     * @param offset Position offset.\n     */\n    constructor(parent, offset) {\n        super();\n        this.parent = parent;\n        this.offset = offset;\n    }\n    /**\n     * Node directly after the position. Equals `null` when there is no node after position or position is located\n     * inside text node.\n     */\n    get nodeAfter() {\n        if (this.parent.is('$text')) {\n            return null;\n        }\n        return this.parent.getChild(this.offset) || null;\n    }\n    /**\n     * Node directly before the position. Equals `null` when there is no node before position or position is located\n     * inside text node.\n     */\n    get nodeBefore() {\n        if (this.parent.is('$text')) {\n            return null;\n        }\n        return this.parent.getChild(this.offset - 1) || null;\n    }\n    /**\n     * Is `true` if position is at the beginning of its {@link module:engine/view/position~ViewPosition#parent parent}, `false` otherwise.\n     */\n    get isAtStart() {\n        return this.offset === 0;\n    }\n    /**\n     * Is `true` if position is at the end of its {@link module:engine/view/position~ViewPosition#parent parent}, `false` otherwise.\n     */\n    get isAtEnd() {\n        const endOffset = this.parent.is('$text') ? this.parent.data.length : this.parent.childCount;\n        return this.offset === endOffset;\n    }\n    /**\n     * Position's root, that is the root of the position's parent element.\n     */\n    get root() {\n        return this.parent.root;\n    }\n    /**\n     * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this position, or `null` if\n     * position is not inside an editable element.\n     */\n    get editableElement() {\n        let editable = this.parent;\n        while (!(editable instanceof ViewEditableElement)) {\n            if (editable.parent) {\n                editable = editable.parent;\n            }\n            else {\n                return null;\n            }\n        }\n        return editable;\n    }\n    /**\n     * Returns a new instance of Position with offset incremented by `shift` value.\n     *\n     * @param shift How position offset should get changed. Accepts negative values.\n     * @returns Shifted position.\n     */\n    getShiftedBy(shift) {\n        const shifted = ViewPosition._createAt(this);\n        const offset = shifted.offset + shift;\n        shifted.offset = offset < 0 ? 0 : offset;\n        return shifted;\n    }\n    /**\n     * Gets the farthest position which matches the callback using\n     * {@link module:engine/view/treewalker~ViewTreeWalker TreeWalker}.\n     *\n     * For example:\n     *\n     * ```ts\n     * getLastMatchingPosition( value => value.type == 'text' ); // <p>{}foo</p> -> <p>foo[]</p>\n     * getLastMatchingPosition( value => value.type == 'text', { direction: 'backward' } ); // <p>foo[]</p> -> <p>{}foo</p>\n     * getLastMatchingPosition( value => false ); // Do not move the position.\n     * ```\n     *\n     * @param skip Callback function. Gets {@link module:engine/view/treewalker~ViewTreeWalkerValue} and should\n     * return `true` if the value should be skipped or `false` if not.\n     * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}.\n     * @returns The position after the last item which matches the `skip` callback test.\n     */\n    getLastMatchingPosition(skip, options = {}) {\n        options.startPosition = this;\n        const treeWalker = new ViewTreeWalker(options);\n        treeWalker.skip(skip);\n        return treeWalker.position;\n    }\n    /**\n     * Returns ancestors array of this position, that is this position's parent and it's ancestors.\n     *\n     * @returns Array with ancestors.\n     */\n    getAncestors() {\n        if (this.parent.is('documentFragment')) {\n            return [this.parent];\n        }\n        else {\n            return this.parent.getAncestors({ includeSelf: true });\n        }\n    }\n    /**\n     * Returns a {@link module:engine/view/node~ViewNode} or {@link module:engine/view/documentfragment~ViewDocumentFragment}\n     * which is a common ancestor of both positions.\n     */\n    getCommonAncestor(position) {\n        const ancestorsA = this.getAncestors();\n        const ancestorsB = position.getAncestors();\n        let i = 0;\n        while (ancestorsA[i] == ancestorsB[i] && ancestorsA[i]) {\n            i++;\n        }\n        return i === 0 ? null : ancestorsA[i - 1];\n    }\n    /**\n     * Checks whether this position equals given position.\n     *\n     * @param otherPosition Position to compare with.\n     * @returns True if positions are same.\n     */\n    isEqual(otherPosition) {\n        return (this.parent == otherPosition.parent && this.offset == otherPosition.offset);\n    }\n    /**\n     * Checks whether this position is located before given position. When method returns `false` it does not mean that\n     * this position is after give one. Two positions may be located inside separate roots and in that situation this\n     * method will still return `false`.\n     *\n     * @see module:engine/view/position~ViewPosition#isAfter\n     * @see module:engine/view/position~ViewPosition#compareWith\n     * @param otherPosition Position to compare with.\n     * @returns Returns `true` if this position is before given position.\n     */\n    isBefore(otherPosition) {\n        return this.compareWith(otherPosition) == 'before';\n    }\n    /**\n     * Checks whether this position is located after given position. When method returns `false` it does not mean that\n     * this position is before give one. Two positions may be located inside separate roots and in that situation this\n     * method will still return `false`.\n     *\n     * @see module:engine/view/position~ViewPosition#isBefore\n     * @see module:engine/view/position~ViewPosition#compareWith\n     * @param otherPosition Position to compare with.\n     * @returns Returns `true` if this position is after given position.\n     */\n    isAfter(otherPosition) {\n        return this.compareWith(otherPosition) == 'after';\n    }\n    /**\n     * Checks whether this position is before, after or in same position that other position. Two positions may be also\n     * different when they are located in separate roots.\n     *\n     * @param otherPosition Position to compare with.\n     */\n    compareWith(otherPosition) {\n        if (this.root !== otherPosition.root) {\n            return 'different';\n        }\n        if (this.isEqual(otherPosition)) {\n            return 'same';\n        }\n        // Get path from root to position's parent element.\n        const thisPath = this.parent.is('node') ? this.parent.getPath() : [];\n        const otherPath = otherPosition.parent.is('node') ? otherPosition.parent.getPath() : [];\n        // Add the positions' offsets to the parents offsets.\n        thisPath.push(this.offset);\n        otherPath.push(otherPosition.offset);\n        // Compare both path arrays to find common ancestor.\n        const result = compareArrays(thisPath, otherPath);\n        switch (result) {\n            case 'prefix':\n                return 'before';\n            case 'extension':\n                return 'after';\n            default:\n                // Cast to number to avoid having 'same' as a type of `result`.\n                return thisPath[result] < otherPath[result] ? 'before' : 'after';\n        }\n    }\n    /**\n     * Creates a {@link module:engine/view/treewalker~ViewTreeWalker TreeWalker} instance with this positions as a start position.\n     *\n     * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}\n     */\n    getWalker(options = {}) {\n        options.startPosition = this;\n        return new ViewTreeWalker(options);\n    }\n    /**\n     * Clones this position.\n     */\n    clone() {\n        return new ViewPosition(this.parent, this.offset);\n    }\n    /**\n     * Converts `ViewPosition` instance to plain object and returns it.\n     *\n     * @returns `ViewPosition` instance converted to plain object.\n     */\n    toJSON() {\n        return {\n            parent: this.parent.toJSON(),\n            offset: this.offset\n        };\n    }\n    /**\n     * Creates position at the given location. The location can be specified as:\n     *\n     * * a {@link module:engine/view/position~ViewPosition position},\n     * * parent element and offset (offset defaults to `0`),\n     * * parent element and `'end'` (sets position at the end of that element),\n     * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).\n     *\n     * This method is a shortcut to other constructors such as:\n     *\n     * * {@link module:engine/view/position~ViewPosition._createBefore},\n     * * {@link module:engine/view/position~ViewPosition._createAfter}.\n     *\n     * @internal\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    static _createAt(itemOrPosition, offset) {\n        if (itemOrPosition instanceof ViewPosition) {\n            return new this(itemOrPosition.parent, itemOrPosition.offset);\n        }\n        else {\n            const node = itemOrPosition;\n            if (offset == 'end') {\n                offset = node.is('$text') ? node.data.length : node.childCount;\n            }\n            else if (offset == 'before') {\n                return this._createBefore(node);\n            }\n            else if (offset == 'after') {\n                return this._createAfter(node);\n            }\n            else if (offset !== 0 && !offset) {\n                /**\n                 * {@link module:engine/view/view~EditingView#createPositionAt `View#createPositionAt()`}\n                 * requires the offset to be specified when the first parameter is a view item.\n                 *\n                 * @error view-createpositionat-offset-required\n                 */\n                throw new CKEditorError('view-createpositionat-offset-required', node);\n            }\n            return new ViewPosition(node, offset);\n        }\n    }\n    /**\n     * Creates a new position after given view item.\n     *\n     * @internal\n     * @param item View item after which the position should be located.\n     */\n    static _createAfter(item) {\n        // ViewTextProxy is not a instance of Node so we need do handle it in specific way.\n        if (item.is('$textProxy')) {\n            return new ViewPosition(item.textNode, item.offsetInText + item.data.length);\n        }\n        if (!item.parent) {\n            /**\n             * You cannot make a position after a root.\n             *\n             * @error view-position-after-root\n             * @param {module:engine/view/node~ViewNode} root A root item.\n             */\n            throw new CKEditorError('view-position-after-root', item, { root: item });\n        }\n        return new ViewPosition(item.parent, item.index + 1);\n    }\n    /**\n     * Creates a new position before given view item.\n     *\n     * @internal\n     * @param item View item before which the position should be located.\n     */\n    static _createBefore(item) {\n        // ViewTextProxy is not a instance of Node so we need do handle it in specific way.\n        if (item.is('$textProxy')) {\n            return new ViewPosition(item.textNode, item.offsetInText);\n        }\n        if (!item.parent) {\n            /**\n             * You cannot make a position before a root.\n             *\n             * @error view-position-before-root\n             * @param {module:engine/view/node~ViewNode} root A root item.\n             */\n            throw new CKEditorError('view-position-before-root', item, { root: item });\n        }\n        return new ViewPosition(item.parent, item.index);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewPosition.prototype.is = function (type) {\n    return type === 'position' || type === 'view:position';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/range\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { ViewPosition } from './position.js';\nimport { ViewTreeWalker } from './treewalker.js';\n/**\n * Range in the view tree. A range is represented by its start and end {@link module:engine/view/position~ViewPosition positions}.\n *\n * In order to create a new position instance use the `createPosition*()` factory methods available in:\n *\n * * {@link module:engine/view/view~EditingView}\n * * {@link module:engine/view/downcastwriter~ViewDowncastWriter}\n * * {@link module:engine/view/upcastwriter~ViewUpcastWriter}\n */\nexport class ViewRange extends ViewTypeCheckable {\n    /**\n     * Start position.\n     */\n    start;\n    /**\n     * End position.\n     */\n    end;\n    /**\n     * Creates a range spanning from `start` position to `end` position.\n     *\n     * **Note:** Constructor creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.\n     *\n     * @param start Start position.\n     * @param end End position. If not set, range will be collapsed at the `start` position.\n     */\n    constructor(start, end = null) {\n        super();\n        this.start = start.clone();\n        this.end = end ? end.clone() : start.clone();\n    }\n    /**\n     * Iterable interface.\n     *\n     * Iterates over all {@link module:engine/view/item~ViewItem view items} that are in this range and returns\n     * them together with additional information like length or {@link module:engine/view/position~ViewPosition positions},\n     * grouped as {@link module:engine/view/treewalker~ViewTreeWalkerValue}.\n     *\n     * This iterator uses {@link module:engine/view/treewalker~ViewTreeWalker TreeWalker} with `boundaries` set to this range and\n     * `ignoreElementEnd` option\n     * set to `true`.\n     */\n    *[Symbol.iterator]() {\n        yield* new ViewTreeWalker({ boundaries: this, ignoreElementEnd: true });\n    }\n    /**\n     * Returns whether the range is collapsed, that is it start and end positions are equal.\n     */\n    get isCollapsed() {\n        return this.start.isEqual(this.end);\n    }\n    /**\n     * Returns whether this range is flat, that is if {@link module:engine/view/range~ViewRange#start start} position and\n     * {@link module:engine/view/range~ViewRange#end end} position are in the same\n     * {@link module:engine/view/position~ViewPosition#parent parent}.\n     */\n    get isFlat() {\n        return this.start.parent === this.end.parent;\n    }\n    /**\n     * Range root element.\n     */\n    get root() {\n        return this.start.root;\n    }\n    /**\n     * Creates a maximal range that has the same content as this range but is expanded in both ways (at the beginning\n     * and at the end).\n     *\n     * For example:\n     *\n     * ```html\n     * <p>Foo</p><p><b>{Bar}</b></p> -> <p>Foo</p>[<p><b>Bar</b>]</p>\n     * <p><b>foo</b>{bar}<span></span></p> -> <p><b>foo[</b>bar<span></span>]</p>\n     * ```\n     *\n     * Note that in the sample above:\n     *\n     * - `<p>` have type of {@link module:engine/view/containerelement~ViewContainerElement},\n     * - `<b>` have type of {@link module:engine/view/attributeelement~ViewAttributeElement},\n     * - `<span>` have type of {@link module:engine/view/uielement~ViewUIElement}.\n     *\n     * @returns Enlarged range.\n     */\n    getEnlarged() {\n        let start = this.start.getLastMatchingPosition(enlargeTrimSkip, { direction: 'backward' });\n        let end = this.end.getLastMatchingPosition(enlargeTrimSkip);\n        // Fix positions, in case if they are in Text node.\n        if (start.parent.is('$text') && start.isAtStart) {\n            start = ViewPosition._createBefore(start.parent);\n        }\n        if (end.parent.is('$text') && end.isAtEnd) {\n            end = ViewPosition._createAfter(end.parent);\n        }\n        return new ViewRange(start, end);\n    }\n    /**\n     * Creates a minimum range that has the same content as this range but is trimmed in both ways (at the beginning\n     * and at the end).\n     *\n     * For example:\n     *\n     * ```html\n     * <p>Foo</p>[<p><b>Bar</b>]</p> -> <p>Foo</p><p><b>{Bar}</b></p>\n     * <p><b>foo[</b>bar<span></span>]</p> -> <p><b>foo</b>{bar}<span></span></p>\n     * ```\n     *\n     * Note that in the sample above:\n     *\n     * - `<p>` have type of {@link module:engine/view/containerelement~ViewContainerElement},\n     * - `<b>` have type of {@link module:engine/view/attributeelement~ViewAttributeElement},\n     * - `<span>` have type of {@link module:engine/view/uielement~ViewUIElement}.\n     *\n     * @returns Shrunk range.\n     */\n    getTrimmed() {\n        let start = this.start.getLastMatchingPosition(enlargeTrimSkip);\n        if (start.isAfter(this.end) || start.isEqual(this.end)) {\n            return new ViewRange(start, start);\n        }\n        let end = this.end.getLastMatchingPosition(enlargeTrimSkip, { direction: 'backward' });\n        const nodeAfterStart = start.nodeAfter;\n        const nodeBeforeEnd = end.nodeBefore;\n        // Because TreeWalker prefers positions next to text node, we need to move them manually into these text nodes.\n        if (nodeAfterStart && nodeAfterStart.is('$text')) {\n            start = new ViewPosition(nodeAfterStart, 0);\n        }\n        if (nodeBeforeEnd && nodeBeforeEnd.is('$text')) {\n            end = new ViewPosition(nodeBeforeEnd, nodeBeforeEnd.data.length);\n        }\n        return new ViewRange(start, end);\n    }\n    /**\n     * Two ranges are equal if their start and end positions are equal.\n     *\n     * @param otherRange Range to compare with.\n     * @returns `true` if ranges are equal, `false` otherwise\n     */\n    isEqual(otherRange) {\n        return this == otherRange || (this.start.isEqual(otherRange.start) && this.end.isEqual(otherRange.end));\n    }\n    /**\n     * Checks whether this range contains given {@link module:engine/view/position~ViewPosition position}.\n     *\n     * @param position Position to check.\n     * @returns `true` if given {@link module:engine/view/position~ViewPosition position} is contained in this range, `false` otherwise.\n     */\n    containsPosition(position) {\n        return position.isAfter(this.start) && position.isBefore(this.end);\n    }\n    /**\n     * Checks whether this range contains given {@link module:engine/view/range~ViewRange range}.\n     *\n     * @param otherRange Range to check.\n     * @param loose Whether the check is loose or strict. If the check is strict (`false`), compared range cannot\n     * start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or\n     * even be equal to this range. Note that collapsed ranges are always compared in strict mode.\n     * @returns `true` if given {@link module:engine/view/range~ViewRange range} boundaries are contained by this range, `false`\n     * otherwise.\n     */\n    containsRange(otherRange, loose = false) {\n        if (otherRange.isCollapsed) {\n            loose = false;\n        }\n        const containsStart = this.containsPosition(otherRange.start) || (loose && this.start.isEqual(otherRange.start));\n        const containsEnd = this.containsPosition(otherRange.end) || (loose && this.end.isEqual(otherRange.end));\n        return containsStart && containsEnd;\n    }\n    /**\n     * Computes which part(s) of this {@link module:engine/view/range~ViewRange range} is not a part of given\n     * {@link module:engine/view/range~ViewRange range}.\n     * Returned array contains zero, one or two {@link module:engine/view/range~ViewRange ranges}.\n     *\n     * Examples:\n     *\n     * ```ts\n     * let foo = downcastWriter.createText( 'foo' );\n     * let img = downcastWriter.createContainerElement( 'img' );\n     * let bar = downcastWriter.createText( 'bar' );\n     * let p = downcastWriter.createContainerElement( 'p', null, [ foo, img, bar ] );\n     *\n     * let range = view.createRange( view.createPositionAt( foo, 2 ), view.createPositionAt( bar, 1 ); // \"o\", img, \"b\" are in range.\n     * let otherRange = view.createRange( // \"oo\", img, \"ba\" are in range.\n     * \tview.createPositionAt( foo, 1 ),\n     * \tview.createPositionAt( bar, 2 )\n     * );\n     * let transformed = range.getDifference( otherRange );\n     * // transformed array has no ranges because `otherRange` contains `range`\n     *\n     * otherRange = view.createRange( view.createPositionAt( foo, 1 ), view.createPositionAt( p, 2 ); // \"oo\", img are in range.\n     * transformed = range.getDifference( otherRange );\n     * // transformed array has one range: from ( p, 2 ) to ( bar, 1 )\n     *\n     * otherRange = view.createRange( view.createPositionAt( p, 1 ), view.createPositionAt( p, 2 ) ); // img is in range.\n     * transformed = range.getDifference( otherRange );\n     * // transformed array has two ranges: from ( foo, 1 ) to ( p, 1 ) and from ( p, 2 ) to ( bar, 1 )\n     * ```\n     *\n     * @param otherRange Range to differentiate against.\n     * @returns The difference between ranges.\n     */\n    getDifference(otherRange) {\n        const ranges = [];\n        if (this.isIntersecting(otherRange)) {\n            // Ranges intersect.\n            if (this.containsPosition(otherRange.start)) {\n                // Given range start is inside this range. This means that we have to\n                // add shrunken range - from the start to the middle of this range.\n                ranges.push(new ViewRange(this.start, otherRange.start));\n            }\n            if (this.containsPosition(otherRange.end)) {\n                // Given range end is inside this range. This means that we have to\n                // add shrunken range - from the middle of this range to the end.\n                ranges.push(new ViewRange(otherRange.end, this.end));\n            }\n        }\n        else {\n            // Ranges do not intersect, return the original range.\n            ranges.push(this.clone());\n        }\n        return ranges;\n    }\n    /**\n     * Returns an intersection of this {@link module:engine/view/range~ViewRange range}\n     * and given {@link module:engine/view/range~ViewRange range}.\n     * Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.\n     *\n     * Examples:\n     *\n     * ```ts\n     * let foo = downcastWriter.createText( 'foo' );\n     * let img = downcastWriter.createContainerElement( 'img' );\n     * let bar = downcastWriter.createText( 'bar' );\n     * let p = downcastWriter.createContainerElement( 'p', null, [ foo, img, bar ] );\n     *\n     * let range = view.createRange( view.createPositionAt( foo, 2 ), view.createPositionAt( bar, 1 ); // \"o\", img, \"b\" are in range.\n     * let otherRange = view.createRange( view.createPositionAt( foo, 1 ), view.createPositionAt( p, 2 ); // \"oo\", img are in range.\n     * let transformed = range.getIntersection( otherRange ); // range from ( foo, 1 ) to ( p, 2 ).\n     *\n     * otherRange = view.createRange( view.createPositionAt( bar, 1 ), view.createPositionAt( bar, 3 ); \"ar\" is in range.\n     * transformed = range.getIntersection( otherRange ); // null - no common part.\n     * ```\n     *\n     * @param otherRange Range to check for intersection.\n     * @returns A common part of given ranges or `null` if ranges have no common part.\n     */\n    getIntersection(otherRange) {\n        if (this.isIntersecting(otherRange)) {\n            // Ranges intersect, so a common range will be returned.\n            // At most, it will be same as this range.\n            let commonRangeStart = this.start;\n            let commonRangeEnd = this.end;\n            if (this.containsPosition(otherRange.start)) {\n                // Given range start is inside this range. This means thaNt we have to\n                // shrink common range to the given range start.\n                commonRangeStart = otherRange.start;\n            }\n            if (this.containsPosition(otherRange.end)) {\n                // Given range end is inside this range. This means that we have to\n                // shrink common range to the given range end.\n                commonRangeEnd = otherRange.end;\n            }\n            return new ViewRange(commonRangeStart, commonRangeEnd);\n        }\n        // Ranges do not intersect, so they do not have common part.\n        return null;\n    }\n    /**\n     * Creates a {@link module:engine/view/treewalker~ViewTreeWalker TreeWalker} instance with this range as a boundary.\n     *\n     * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}.\n     */\n    getWalker(options = {}) {\n        options.boundaries = this;\n        return new ViewTreeWalker(options);\n    }\n    /**\n     * Returns a {@link module:engine/view/node~ViewNode} or {@link module:engine/view/documentfragment~ViewDocumentFragment}\n     * which is a common ancestor of range's both ends (in which the entire range is contained).\n     */\n    getCommonAncestor() {\n        return this.start.getCommonAncestor(this.end);\n    }\n    /**\n     * Returns an {@link module:engine/view/element~ViewElement Element} contained by the range.\n     * The element will be returned when it is the **only** node within the range and **fully–contained**\n     * at the same time.\n     */\n    getContainedElement() {\n        if (this.isCollapsed) {\n            return null;\n        }\n        let nodeAfterStart = this.start.nodeAfter;\n        let nodeBeforeEnd = this.end.nodeBefore;\n        // Handle the situation when the range position is at the beginning / at the end of a text node.\n        // In such situation `.nodeAfter` and `.nodeBefore` are `null` but the range still might be spanning\n        // over one element.\n        //\n        // <p>Foo{<span class=\"widget\"></span>}bar</p> vs <p>Foo[<span class=\"widget\"></span>]bar</p>\n        //\n        // These are basically the same range, only the difference is if the range position is at\n        // at the end/at the beginning of a text node or just before/just after the text node.\n        //\n        if (this.start.parent.is('$text') && this.start.isAtEnd && this.start.parent.nextSibling) {\n            nodeAfterStart = this.start.parent.nextSibling;\n        }\n        if (this.end.parent.is('$text') && this.end.isAtStart && this.end.parent.previousSibling) {\n            nodeBeforeEnd = this.end.parent.previousSibling;\n        }\n        if (nodeAfterStart && nodeAfterStart.is('element') && nodeAfterStart === nodeBeforeEnd) {\n            return nodeAfterStart;\n        }\n        return null;\n    }\n    /**\n     * Clones this range.\n     */\n    clone() {\n        return new ViewRange(this.start, this.end);\n    }\n    /**\n     * Returns an iterator that iterates over all {@link module:engine/view/item~ViewItem view items} that are in this range and returns\n     * them.\n     *\n     * This method uses {@link module:engine/view/treewalker~ViewTreeWalker} with `boundaries` set to this range\n     * and `ignoreElementEnd` option set to `true`. However it returns only {@link module:engine/view/item~ViewItem items},\n     * not {@link module:engine/view/treewalker~ViewTreeWalkerValue}.\n     *\n     * You may specify additional options for the tree walker. See {@link module:engine/view/treewalker~ViewTreeWalker} for\n     * a full list of available options.\n     *\n     * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}.\n     */\n    *getItems(options = {}) {\n        options.boundaries = this;\n        options.ignoreElementEnd = true;\n        const treeWalker = new ViewTreeWalker(options);\n        for (const value of treeWalker) {\n            yield value.item;\n        }\n    }\n    /**\n     * Returns an iterator that iterates over all {@link module:engine/view/position~ViewPosition positions} that are boundaries or\n     * contained in this range.\n     *\n     * This method uses {@link module:engine/view/treewalker~ViewTreeWalker} with `boundaries` set to this range. However it returns only\n     * {@link module:engine/view/position~ViewPosition positions}, not {@link module:engine/view/treewalker~ViewTreeWalkerValue}.\n     *\n     * You may specify additional options for the tree walker. See {@link module:engine/view/treewalker~ViewTreeWalker} for\n     * a full list of available options.\n     *\n     * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}.\n     */\n    *getPositions(options = {}) {\n        options.boundaries = this;\n        const treeWalker = new ViewTreeWalker(options);\n        yield treeWalker.position;\n        for (const value of treeWalker) {\n            yield value.nextPosition;\n        }\n    }\n    /**\n     * Checks and returns whether this range intersects with the given range.\n     *\n     * @param otherRange Range to compare with.\n     * @returns True if ranges intersect.\n     */\n    isIntersecting(otherRange) {\n        return this.start.isBefore(otherRange.end) && this.end.isAfter(otherRange.start);\n    }\n    /**\n     * Converts `ViewRange` instance to plain object and returns it.\n     *\n     * @returns `ViewRange` instance converted to plain object.\n     */\n    toJSON() {\n        return {\n            start: this.start.toJSON(),\n            end: this.end.toJSON()\n        };\n    }\n    /**\n     * Creates a range from the given parents and offsets.\n     *\n     * @internal\n     * @param startElement Start position parent element.\n     * @param startOffset Start position offset.\n     * @param endElement End position parent element.\n     * @param endOffset End position offset.\n     * @returns Created range.\n     */\n    static _createFromParentsAndOffsets(startElement, startOffset, endElement, endOffset) {\n        return new this(new ViewPosition(startElement, startOffset), new ViewPosition(endElement, endOffset));\n    }\n    /**\n     * Creates a new range, spreading from specified {@link module:engine/view/position~ViewPosition position} to a position moved by\n     * given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.\n     *\n     * @internal\n     * @param position Beginning of the range.\n     * @param shift How long the range should be.\n     */\n    static _createFromPositionAndShift(position, shift) {\n        const start = position;\n        const end = position.getShiftedBy(shift);\n        return shift > 0 ? new this(start, end) : new this(end, start);\n    }\n    /**\n     * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * @internal\n     * @param element Element which is a parent for the range.\n     */\n    static _createIn(element) {\n        return this._createFromParentsAndOffsets(element, 0, element, element.childCount);\n    }\n    /**\n     * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.\n     *\n     * @internal\n     */\n    static _createOn(item) {\n        const size = item.is('$textProxy') ? item.offsetSize : 1;\n        return this._createFromPositionAndShift(ViewPosition._createBefore(item), size);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewRange.prototype.is = function (type) {\n    return type === 'range' || type === 'view:range';\n};\n/**\n * Function used by getEnlarged and getTrimmed methods.\n */\nfunction enlargeTrimSkip(value) {\n    if (value.item.is('attributeElement') || value.item.is('uiElement')) {\n        return true;\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/selection\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { ViewRange } from './range.js';\nimport { ViewPosition } from './position.js';\nimport { ViewNode } from './node.js';\nimport { ViewDocumentSelection } from './documentselection.js';\nimport { CKEditorError, EmitterMixin, count, isIterable } from '@ckeditor/ckeditor5-utils';\n/**\n * Class representing an arbirtary selection in the view.\n * See also {@link module:engine/view/documentselection~ViewDocumentSelection}.\n *\n * New selection instances can be created via the constructor or one these methods:\n *\n * * {@link module:engine/view/view~EditingView#createSelection `View#createSelection()`},\n * * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createSelection `UpcastWriter#createSelection()`}.\n *\n * A selection can consist of {@link module:engine/view/range~ViewRange ranges} that can be set by using\n * the {@link module:engine/view/selection~ViewSelection#setTo `Selection#setTo()`} method.\n */\nexport class ViewSelection extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {\n    /**\n     * Stores all ranges that are selected.\n     */\n    _ranges;\n    /**\n     * Specifies whether the last added range was added as a backward or forward range.\n     */\n    _lastRangeBackward;\n    /**\n     * Specifies whether selection instance is fake.\n     */\n    _isFake;\n    /**\n     * Fake selection's label.\n     */\n    _fakeSelectionLabel;\n    /**\n     * Creates new selection instance.\n     *\n     * **Note**: The selection constructor is available as a factory method:\n     *\n     * * {@link module:engine/view/view~EditingView#createSelection `View#createSelection()`},\n     * * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createSelection `UpcastWriter#createSelection()`}.\n     *\n     * ```ts\n     * // Creates empty selection without ranges.\n     * const selection = writer.createSelection();\n     *\n     * // Creates selection at the given range.\n     * const range = writer.createRange( start, end );\n     * const selection = writer.createSelection( range );\n     *\n     * // Creates selection at the given ranges\n     * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n     * const selection = writer.createSelection( ranges );\n     *\n     * // Creates selection from the other selection.\n     * const otherSelection = writer.createSelection();\n     * const selection = writer.createSelection( otherSelection );\n     *\n     * // Creates selection from the document selection.\n     * const selection = writer.createSelection( editor.editing.view.document.selection );\n     *\n     * // Creates selection at the given position.\n     * const position = writer.createPositionFromPath( root, path );\n     * const selection = writer.createSelection( position );\n     *\n     * // Creates collapsed selection at the position of given item and offset.\n     * const paragraph = writer.createContainerElement( 'paragraph' );\n     * const selection = writer.createSelection( paragraph, offset );\n     *\n     * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the\n     * // first child of that element and ends after the last child of that element.\n     * const selection = writer.createSelection( paragraph, 'in' );\n     *\n     * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends\n     * // just after the item.\n     * const selection = writer.createSelection( paragraph, 'on' );\n     * ```\n     *\n     * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n     *\n     * ```ts\n     * // Creates backward selection.\n     * const selection = writer.createSelection( range, { backward: true } );\n     * ```\n     *\n     * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n     * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n     * represented in other way, for example by applying proper CSS class.\n     *\n     * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n     * (and be  properly handled by screen readers).\n     *\n     * ```ts\n     * // Creates fake selection with label.\n     * const selection = writer.createSelection( range, { fake: true, label: 'foo' } );\n     * ```\n     *\n     * @internal\n     */\n    constructor(...args) {\n        super();\n        this._ranges = [];\n        this._lastRangeBackward = false;\n        this._isFake = false;\n        this._fakeSelectionLabel = '';\n        if (args.length) {\n            this.setTo(...args);\n        }\n    }\n    /**\n     * Returns true if selection instance is marked as `fake`.\n     *\n     * @see #setTo\n     */\n    get isFake() {\n        return this._isFake;\n    }\n    /**\n     * Returns fake selection label.\n     *\n     * @see #setTo\n     */\n    get fakeSelectionLabel() {\n        return this._fakeSelectionLabel;\n    }\n    /**\n     * Selection anchor. Anchor may be described as a position where the selection starts. Together with\n     * {@link #focus focus} they define the direction of selection, which is important\n     * when expanding/shrinking selection. Anchor is always the start or end of the most recent added range.\n     * It may be a bit unintuitive when there are multiple ranges in selection.\n     *\n     * @see #focus\n     */\n    get anchor() {\n        if (!this._ranges.length) {\n            return null;\n        }\n        const range = this._ranges[this._ranges.length - 1];\n        const anchor = this._lastRangeBackward ? range.end : range.start;\n        return anchor.clone();\n    }\n    /**\n     * Selection focus. Focus is a position where the selection ends.\n     *\n     * @see #anchor\n     */\n    get focus() {\n        if (!this._ranges.length) {\n            return null;\n        }\n        const range = this._ranges[this._ranges.length - 1];\n        const focus = this._lastRangeBackward ? range.start : range.end;\n        return focus.clone();\n    }\n    /**\n     * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is\n     * collapsed.\n     */\n    get isCollapsed() {\n        return this.rangeCount === 1 && this._ranges[0].isCollapsed;\n    }\n    /**\n     * Returns number of ranges in selection.\n     */\n    get rangeCount() {\n        return this._ranges.length;\n    }\n    /**\n     * Specifies whether the {@link #focus} precedes {@link #anchor}.\n     */\n    get isBackward() {\n        return !this.isCollapsed && this._lastRangeBackward;\n    }\n    /**\n     * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this selection, or `null`\n     * if the selection is not inside an editable element.\n     */\n    get editableElement() {\n        if (this.anchor) {\n            return this.anchor.editableElement;\n        }\n        return null;\n    }\n    /**\n     * Returns an iterable that contains copies of all ranges added to the selection.\n     */\n    *getRanges() {\n        for (const range of this._ranges) {\n            yield range.clone();\n        }\n    }\n    /**\n     * Returns copy of the first range in the selection. First range is the one which\n     * {@link module:engine/view/range~ViewRange#start start} position\n     * {@link module:engine/view/position~ViewPosition#isBefore is before} start\n     * position of all other ranges (not to confuse with the first range added to the selection).\n     * Returns `null` if no ranges are added to selection.\n     */\n    getFirstRange() {\n        let first = null;\n        for (const range of this._ranges) {\n            if (!first || range.start.isBefore(first.start)) {\n                first = range;\n            }\n        }\n        return first ? first.clone() : null;\n    }\n    /**\n     * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~ViewRange#end end}\n     * position {@link module:engine/view/position~ViewPosition#isAfter is after} end position of all other ranges (not to confuse\n     * with the last range added to the selection). Returns `null` if no ranges are added to selection.\n     */\n    getLastRange() {\n        let last = null;\n        for (const range of this._ranges) {\n            if (!last || range.end.isAfter(last.end)) {\n                last = range;\n            }\n        }\n        return last ? last.clone() : null;\n    }\n    /**\n     * Returns copy of the first position in the selection. First position is the position that\n     * {@link module:engine/view/position~ViewPosition#isBefore is before} any other position in the selection ranges.\n     * Returns `null` if no ranges are added to selection.\n     */\n    getFirstPosition() {\n        const firstRange = this.getFirstRange();\n        return firstRange ? firstRange.start.clone() : null;\n    }\n    /**\n     * Returns copy of the last position in the selection. Last position is the position that\n     * {@link module:engine/view/position~ViewPosition#isAfter is after} any other position in the selection ranges.\n     * Returns `null` if no ranges are added to selection.\n     */\n    getLastPosition() {\n        const lastRange = this.getLastRange();\n        return lastRange ? lastRange.end.clone() : null;\n    }\n    /**\n     * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,\n     * same number of ranges and all ranges from one selection equal to a range from other selection.\n     *\n     * @param otherSelection Selection to compare with.\n     * @returns `true` if selections are equal, `false` otherwise.\n     */\n    isEqual(otherSelection) {\n        if (this.isFake != otherSelection.isFake) {\n            return false;\n        }\n        if (this.isFake && this.fakeSelectionLabel != otherSelection.fakeSelectionLabel) {\n            return false;\n        }\n        if (this.rangeCount != otherSelection.rangeCount) {\n            return false;\n        }\n        else if (this.rangeCount === 0) {\n            return true;\n        }\n        if (!this.anchor.isEqual(otherSelection.anchor) || !this.focus.isEqual(otherSelection.focus)) {\n            return false;\n        }\n        for (const thisRange of this._ranges) {\n            let found = false;\n            for (const otherRange of otherSelection._ranges) {\n                if (thisRange.isEqual(otherRange)) {\n                    found = true;\n                    break;\n                }\n            }\n            if (!found) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same\n     * number of ranges, and all {@link module:engine/view/range~ViewRange#getTrimmed trimmed} ranges from one selection are\n     * equal to any trimmed range from other selection.\n     *\n     * @param otherSelection Selection to compare with.\n     * @returns `true` if selections are similar, `false` otherwise.\n     */\n    isSimilar(otherSelection) {\n        if (this.isBackward != otherSelection.isBackward) {\n            return false;\n        }\n        const numOfRangesA = count(this.getRanges());\n        const numOfRangesB = count(otherSelection.getRanges());\n        // If selections have different number of ranges, they cannot be similar.\n        if (numOfRangesA != numOfRangesB) {\n            return false;\n        }\n        // If both selections have no ranges, they are similar.\n        if (numOfRangesA == 0) {\n            return true;\n        }\n        // Check if each range in one selection has a similar range in other selection.\n        for (let rangeA of this.getRanges()) {\n            rangeA = rangeA.getTrimmed();\n            let found = false;\n            for (let rangeB of otherSelection.getRanges()) {\n                rangeB = rangeB.getTrimmed();\n                if (rangeA.start.isEqual(rangeB.start) && rangeA.end.isEqual(rangeB.end)) {\n                    found = true;\n                    break;\n                }\n            }\n            // For `rangeA`, neither range in `otherSelection` was similar. So selections are not similar.\n            if (!found) {\n                return false;\n            }\n        }\n        // There were no ranges that weren't matched. Selections are similar.\n        return true;\n    }\n    /**\n     * Returns the selected element. {@link module:engine/view/element~ViewElement Element} is considered as selected if there is only\n     * one range in the selection, and that range contains exactly one element.\n     * Returns `null` if there is no selected element.\n     */\n    getSelectedElement() {\n        if (this.rangeCount !== 1) {\n            return null;\n        }\n        return this.getFirstRange().getContainedElement();\n    }\n    /**\n     * Sets this selection's ranges and direction to the specified location based on the given\n     * {@link module:engine/view/selection~ViewSelectable selectable}.\n     *\n     * ```ts\n     * // Sets selection to the given range.\n     * const range = writer.createRange( start, end );\n     * selection.setTo( range );\n     *\n     * // Sets selection to given ranges.\n     * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n     * selection.setTo( range );\n     *\n     * // Sets selection to the other selection.\n     * const otherSelection = writer.createSelection();\n     * selection.setTo( otherSelection );\n     *\n     * // Sets selection to contents of ViewDocumentSelection.\n     * selection.setTo( editor.editing.view.document.selection );\n     *\n     * // Sets collapsed selection at the given position.\n     * const position = writer.createPositionAt( root, path );\n     * selection.setTo( position );\n     *\n     * // Sets collapsed selection at the position of given item and offset.\n     * selection.setTo( paragraph, offset );\n     * ```\n     *\n     * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * ```ts\n     * selection.setTo( paragraph, 'in' );\n     * ```\n     *\n     * Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.\n     *\n     * ```ts\n     * selection.setTo( paragraph, 'on' );\n     *\n     * // Clears selection. Removes all ranges.\n     * selection.setTo( null );\n     * ```\n     *\n     * `Selection#setTo()` method allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n     *\n     * ```ts\n     * // Sets selection as backward.\n     * selection.setTo( range, { backward: true } );\n     * ```\n     *\n     * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n     * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n     * represented in other way, for example by applying proper CSS class.\n     *\n     * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n     * (and be  properly handled by screen readers).\n     *\n     * ```ts\n     * // Creates fake selection with label.\n     * selection.setTo( range, { fake: true, label: 'foo' } );\n     * ```\n     *\n     * @fires change\n     */\n    setTo(...args) {\n        let [selectable, placeOrOffset, options] = args;\n        if (typeof placeOrOffset == 'object') {\n            options = placeOrOffset;\n            placeOrOffset = undefined;\n        }\n        if (selectable === null) {\n            this._setRanges([]);\n            this._setFakeOptions(options);\n        }\n        else if (selectable instanceof ViewSelection || selectable instanceof ViewDocumentSelection) {\n            this._setRanges(selectable.getRanges(), selectable.isBackward);\n            this._setFakeOptions({ fake: selectable.isFake, label: selectable.fakeSelectionLabel });\n        }\n        else if (selectable instanceof ViewRange) {\n            this._setRanges([selectable], options && options.backward);\n            this._setFakeOptions(options);\n        }\n        else if (selectable instanceof ViewPosition) {\n            this._setRanges([new ViewRange(selectable)]);\n            this._setFakeOptions(options);\n        }\n        else if (selectable instanceof ViewNode) {\n            const backward = !!options && !!options.backward;\n            let range;\n            if (placeOrOffset === undefined) {\n                /**\n                 * selection.setTo requires the second parameter when the first parameter is a node.\n                 *\n                 * @error view-selection-setto-required-second-parameter\n                 */\n                throw new CKEditorError('view-selection-setto-required-second-parameter', this);\n            }\n            else if (placeOrOffset == 'in') {\n                range = ViewRange._createIn(selectable);\n            }\n            else if (placeOrOffset == 'on') {\n                range = ViewRange._createOn(selectable);\n            }\n            else {\n                range = new ViewRange(ViewPosition._createAt(selectable, placeOrOffset));\n            }\n            this._setRanges([range], backward);\n            this._setFakeOptions(options);\n        }\n        else if (isIterable(selectable)) {\n            // We assume that the selectable is an iterable of ranges.\n            // Array.from() is used to prevent setting ranges to the old iterable\n            this._setRanges(selectable, options && options.backward);\n            this._setFakeOptions(options);\n        }\n        else {\n            /**\n             * Cannot set selection to given place.\n             *\n             * @error view-selection-setto-not-selectable\n             */\n            throw new CKEditorError('view-selection-setto-not-selectable', this);\n        }\n        this.fire('change');\n    }\n    /**\n     * Moves {@link #focus} to the specified location.\n     *\n     * The location can be specified in the same form as\n     * {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}\n     * parameters.\n     *\n     * @fires change\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    setFocus(itemOrPosition, offset) {\n        if (this.anchor === null) {\n            /**\n             * Cannot set selection focus if there are no ranges in selection.\n             *\n             * @error view-selection-setfocus-no-ranges\n             */\n            throw new CKEditorError('view-selection-setfocus-no-ranges', this);\n        }\n        const newFocus = ViewPosition._createAt(itemOrPosition, offset);\n        if (newFocus.compareWith(this.focus) == 'same') {\n            return;\n        }\n        const anchor = this.anchor;\n        this._ranges.pop();\n        if (newFocus.compareWith(anchor) == 'before') {\n            this._addRange(new ViewRange(newFocus, anchor), true);\n        }\n        else {\n            this._addRange(new ViewRange(anchor, newFocus));\n        }\n        this.fire('change');\n    }\n    /**\n     * Converts `ViewSelection` instance to plain object and returns it.\n     *\n     * @returns `ViewSelection` instance converted to plain object.\n     */\n    toJSON() {\n        const json = {\n            ranges: Array.from(this.getRanges()).map(range => range.toJSON())\n        };\n        if (this.isBackward) {\n            json.isBackward = true;\n        }\n        if (this.isFake) {\n            json.isFake = true;\n        }\n        return json;\n    }\n    /**\n     * Replaces all ranges that were added to the selection with given array of ranges. Last range of the array\n     * is treated like the last added range and is used to set {@link #anchor anchor} and {@link #focus focus}.\n     * Accepts a flag describing in which way the selection is made.\n     *\n     * @param newRanges Iterable object of ranges to set.\n     * @param isLastBackward Flag describing if last added range was selected forward - from start to end\n     * (`false`) or backward - from end to start (`true`). Defaults to `false`.\n     */\n    _setRanges(newRanges, isLastBackward = false) {\n        // New ranges should be copied to prevent removing them by setting them to `[]` first.\n        // Only applies to situations when selection is set to the same selection or same selection's ranges.\n        newRanges = Array.from(newRanges);\n        this._ranges = [];\n        for (const range of newRanges) {\n            this._addRange(range);\n        }\n        this._lastRangeBackward = !!isLastBackward;\n    }\n    /**\n     * Sets this selection instance to be marked as `fake`. A fake selection does not render as browser native selection\n     * over selected elements and is hidden to the user. This way, no native selection UI artifacts are displayed to\n     * the user and selection over elements can be represented in other way, for example by applying proper CSS class.\n     *\n     * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM (and be\n     * properly handled by screen readers).\n     */\n    _setFakeOptions(options = {}) {\n        this._isFake = !!options.fake;\n        this._fakeSelectionLabel = options.fake ? options.label || '' : '';\n    }\n    /**\n     * Adds a range to the selection. Added range is copied. This means that passed range is not saved in the\n     * selection instance and you can safely operate on it.\n     *\n     * Accepts a flag describing in which way the selection is made - passed range might be selected from\n     * {@link module:engine/view/range~ViewRange#start start} to {@link module:engine/view/range~ViewRange#end end}\n     * or from {@link module:engine/view/range~ViewRange#end end} to {@link module:engine/view/range~ViewRange#start start}.\n     * The flag is used to set {@link #anchor anchor} and {@link #focus focus} properties.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects\n     * with ranges already stored in Selection instance.\n     */\n    _addRange(range, isBackward = false) {\n        if (!(range instanceof ViewRange)) {\n            /**\n             * Selection range set to an object that is not an instance of {@link module:engine/view/range~ViewRange}.\n             *\n             * @error view-selection-add-range-not-range\n             */\n            throw new CKEditorError('view-selection-add-range-not-range', this);\n        }\n        this._pushRange(range);\n        this._lastRangeBackward = !!isBackward;\n    }\n    /**\n     * Adds range to selection - creates copy of given range so it can be safely used and modified.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects\n     * with ranges already stored in selection instance.\n     */\n    _pushRange(range) {\n        for (const storedRange of this._ranges) {\n            if (range.isIntersecting(storedRange)) {\n                /**\n                 * Trying to add a range that intersects with another range from selection.\n                 *\n                 * @error view-selection-range-intersects\n                 * @param {module:engine/view/range~ViewRange} addedRange Range that was added to the selection.\n                 * @param {module:engine/view/range~ViewRange} intersectingRange Range from selection that intersects with `addedRange`.\n                 */\n                throw new CKEditorError('view-selection-range-intersects', this, { addedRange: range, intersectingRange: storedRange });\n            }\n        }\n        this._ranges.push(new ViewRange(range.start, range.end));\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewSelection.prototype.is = function (type) {\n    return type === 'selection' || type === 'view:selection';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/documentselection\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { ViewSelection } from './selection.js';\nimport { EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Class representing the document selection in the view.\n *\n * Its instance is available in {@link module:engine/view/document~ViewDocument#selection `Document#selection`}.\n *\n * It is similar to {@link module:engine/view/selection~ViewSelection} but\n * it has a read-only API and can be modified only by the writer available in\n * the {@link module:engine/view/view~EditingView#change `View#change()`} block\n * (so via {@link module:engine/view/downcastwriter~ViewDowncastWriter#setSelection `ViewDowncastWriter#setSelection()`}).\n */\nexport class ViewDocumentSelection extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {\n    /**\n     * Selection is used internally (`ViewDocumentSelection` is a proxy to that selection).\n     */\n    _selection;\n    constructor(...args) {\n        super();\n        this._selection = new ViewSelection();\n        // Delegate change event to be fired on ViewDocumentSelection instance.\n        this._selection.delegate('change').to(this);\n        // Set selection data.\n        if (args.length) {\n            this._selection.setTo(...args);\n        }\n    }\n    /**\n     * Returns true if selection instance is marked as `fake`.\n     *\n     * @see #_setTo\n     */\n    get isFake() {\n        return this._selection.isFake;\n    }\n    /**\n     * Returns fake selection label.\n     *\n     * @see #_setTo\n     */\n    get fakeSelectionLabel() {\n        return this._selection.fakeSelectionLabel;\n    }\n    /**\n     * Selection anchor. Anchor may be described as a position where the selection starts. Together with\n     * {@link #focus focus} they define the direction of selection, which is important\n     * when expanding/shrinking selection. Anchor is always the start or end of the most recent added range.\n     * It may be a bit unintuitive when there are multiple ranges in selection.\n     *\n     * @see #focus\n     */\n    get anchor() {\n        return this._selection.anchor;\n    }\n    /**\n     * Selection focus. Focus is a position where the selection ends.\n     *\n     * @see #anchor\n     */\n    get focus() {\n        return this._selection.focus;\n    }\n    /**\n     * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is\n     * collapsed.\n     */\n    get isCollapsed() {\n        return this._selection.isCollapsed;\n    }\n    /**\n     * Returns number of ranges in selection.\n     */\n    get rangeCount() {\n        return this._selection.rangeCount;\n    }\n    /**\n     * Specifies whether the {@link #focus} precedes {@link #anchor}.\n     */\n    get isBackward() {\n        return this._selection.isBackward;\n    }\n    /**\n     * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this selection, or `null`\n     * if the selection is not inside an editable element.\n     */\n    get editableElement() {\n        return this._selection.editableElement;\n    }\n    /**\n     * Used for the compatibility with the {@link module:engine/view/selection~ViewSelection#isEqual} method.\n     *\n     * @internal\n     */\n    get _ranges() {\n        return this._selection._ranges;\n    }\n    /**\n     * Returns an iterable that contains copies of all ranges added to the selection.\n     */\n    *getRanges() {\n        yield* this._selection.getRanges();\n    }\n    /**\n     * Returns copy of the first range in the selection. First range is the one which\n     * {@link module:engine/view/range~ViewRange#start start} position\n     * {@link module:engine/view/position~ViewPosition#isBefore is before} start\n     * position of all other ranges (not to confuse with the first range added to the selection).\n     * Returns `null` if no ranges are added to selection.\n     */\n    getFirstRange() {\n        return this._selection.getFirstRange();\n    }\n    /**\n     * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~ViewRange#end end}\n     * position {@link module:engine/view/position~ViewPosition#isAfter is after} end position of all other ranges (not to confuse\n     * with the last range added to the selection). Returns `null` if no ranges are added to selection.\n     */\n    getLastRange() {\n        return this._selection.getLastRange();\n    }\n    /**\n     * Returns copy of the first position in the selection. First position is the position that\n     * {@link module:engine/view/position~ViewPosition#isBefore is before} any other position in the selection ranges.\n     * Returns `null` if no ranges are added to selection.\n     */\n    getFirstPosition() {\n        return this._selection.getFirstPosition();\n    }\n    /**\n     * Returns copy of the last position in the selection. Last position is the position that\n     * {@link module:engine/view/position~ViewPosition#isAfter is after} any other position in the selection ranges.\n     * Returns `null` if no ranges are added to selection.\n     */\n    getLastPosition() {\n        return this._selection.getLastPosition();\n    }\n    /**\n     * Returns the selected element. {@link module:engine/view/element~ViewElement Element} is considered as selected if there is only\n     * one range in the selection, and that range contains exactly one element.\n     * Returns `null` if there is no selected element.\n     */\n    getSelectedElement() {\n        return this._selection.getSelectedElement();\n    }\n    /**\n     * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,\n     * same number of ranges and all ranges from one selection equal to a range from other selection.\n     *\n     * @param otherSelection Selection to compare with.\n     * @returns `true` if selections are equal, `false` otherwise.\n     */\n    isEqual(otherSelection) {\n        return this._selection.isEqual(otherSelection);\n    }\n    /**\n     * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same\n     * number of ranges, and all {@link module:engine/view/range~ViewRange#getTrimmed trimmed} ranges from one selection are\n     * equal to any trimmed range from other selection.\n     *\n     * @param otherSelection Selection to compare with.\n     * @returns `true` if selections are similar, `false` otherwise.\n     */\n    isSimilar(otherSelection) {\n        return this._selection.isSimilar(otherSelection);\n    }\n    /**\n     * Converts `ViewDocumentSelection` instance to plain object and returns it.\n     *\n     * @returns `ViewDocumentSelection` instance converted to plain object.\n     */\n    toJSON() {\n        return this._selection.toJSON();\n    }\n    /**\n     * Sets this selection's ranges and direction to the specified location based on the given\n     * {@link module:engine/view/selection~ViewSelectable selectable}.\n     *\n     * ```ts\n     * // Sets selection to the given range.\n     * const range = writer.createRange( start, end );\n     * documentSelection._setTo( range );\n     *\n     * // Sets selection to given ranges.\n     * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( start2, end2 ) ];\n     * documentSelection._setTo( range );\n     *\n     * // Sets selection to the other selection.\n     * const otherSelection = writer.createSelection();\n     * documentSelection._setTo( otherSelection );\n     *\n     * // Sets collapsed selection at the given position.\n     * const position = writer.createPositionAt( root, offset );\n     * documentSelection._setTo( position );\n     *\n     * // Sets collapsed selection at the position of given item and offset.\n     * documentSelection._setTo( paragraph, offset );\n     * ```\n     *\n     * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * ```ts\n     * documentSelection._setTo( paragraph, 'in' );\n     * ```\n     *\n     * Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.\n     *\n     * ```ts\n     * documentSelection._setTo( paragraph, 'on' );\n     *\n     * // Clears selection. Removes all ranges.\n     * documentSelection._setTo( null );\n     * ```\n     *\n     * `Selection#_setTo()` method allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n     *\n     * ```ts\n     * // Sets selection as backward.\n     * documentSelection._setTo( range, { backward: true } );\n     * ```\n     *\n     * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n     * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n     * represented in other way, for example by applying proper CSS class.\n     *\n     * Additionally fake's selection label can be provided. It will be used to des cribe fake selection in DOM\n     * (and be  properly handled by screen readers).\n     *\n     * ```ts\n     * // Creates fake selection with label.\n     * documentSelection._setTo( range, { fake: true, label: 'foo' } );\n     * ```\n     *\n     * @internal\n     * @fires change\n     */\n    _setTo(...args) {\n        this._selection.setTo(...args);\n    }\n    /**\n     * Moves {@link #focus} to the specified location.\n     *\n     * The location can be specified in the same form as\n     * {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}\n     * parameters.\n     *\n     * @internal\n     * @fires change\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    _setFocus(itemOrPosition, offset) {\n        this._selection.setFocus(itemOrPosition, offset);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewDocumentSelection.prototype.is = function (type) {\n    return type === 'selection' ||\n        type == 'documentSelection' ||\n        type == 'view:selection' ||\n        type == 'view:documentSelection';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/bubblingeventinfo\n */\nimport { EventInfo } from '@ckeditor/ckeditor5-utils';\n/**\n * The event object passed to bubbling event callbacks. It is used to provide information about the event as well as a tool to\n * manipulate it.\n */\nexport class BubblingEventInfo extends EventInfo {\n    /**\n     * The view range that the bubbling should start from.\n     */\n    startRange;\n    /**\n     * The current event phase.\n     */\n    _eventPhase;\n    /**\n     * The current bubbling target.\n     */\n    _currentTarget;\n    /**\n     * @param source The emitter.\n     * @param name The event name.\n     * @param startRange The view range that the bubbling should start from.\n     */\n    constructor(source, name, startRange) {\n        super(source, name);\n        this.startRange = startRange;\n        this._eventPhase = 'none';\n        this._currentTarget = null;\n    }\n    /**\n     * The current event phase.\n     */\n    get eventPhase() {\n        return this._eventPhase;\n    }\n    /**\n     * The current bubbling target.\n     */\n    get currentTarget() {\n        return this._currentTarget;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/bubblingemittermixin\n */\nimport { CKEditorError, EmitterMixin, EventInfo, toArray } from '@ckeditor/ckeditor5-utils';\nimport { BubblingEventInfo } from './bubblingeventinfo.js';\nconst bubblingEmitterSymbol = Symbol('bubblingEmitter');\nconst callbackMapSymbol = Symbol('bubblingCallbacks');\nconst contextsSymbol = Symbol('bubblingContexts');\n/**\n * Bubbling emitter mixin for the view document as described in the {@link ~BubblingEmitter} interface.\n *\n * This function creates a class that inherits from the provided `base` and implements `Emitter` interface.\n * The base class must implement {@link module:utils/emittermixin~Emitter} interface.\n *\n * ```ts\n * class BaseClass extends EmitterMixin() {\n * \t// ...\n * }\n *\n * class MyClass extends BubblingEmitterMixin( BaseClass ) {\n * \t// This class derives from `BaseClass` and implements the `BubblingEmitter` interface.\n * }\n * ```\n */\nexport function BubblingEmitterMixin(base) {\n    class Mixin extends base {\n        fire(eventOrInfo, ...eventArgs) {\n            try {\n                const eventInfo = eventOrInfo instanceof EventInfo ? eventOrInfo : new EventInfo(this, eventOrInfo);\n                const bubblingEmitter = getBubblingEmitter(this);\n                const customContexts = getCustomContexts(this);\n                updateEventInfo(eventInfo, 'capturing', this);\n                // The capture phase of the event.\n                if (fireListenerFor(bubblingEmitter, '$capture', eventInfo, ...eventArgs)) {\n                    return eventInfo.return;\n                }\n                const startRange = eventInfo.startRange || this.selection.getFirstRange();\n                const selectedElement = startRange ? startRange.getContainedElement() : null;\n                const isCustomContext = selectedElement ? hasMatchingCustomContext(customContexts, selectedElement) : false;\n                let node = selectedElement || getDeeperRangeParent(startRange);\n                updateEventInfo(eventInfo, 'atTarget', node);\n                // For the not yet bubbling event trigger for $text node if selection can be there and it's not a custom context selected.\n                if (!isCustomContext) {\n                    if (fireListenerFor(bubblingEmitter, '$text', eventInfo, ...eventArgs)) {\n                        return eventInfo.return;\n                    }\n                    updateEventInfo(eventInfo, 'bubbling', node);\n                }\n                while (node) {\n                    if (node.is('element') && fireListenerFor(bubblingEmitter, node, eventInfo, ...eventArgs)) {\n                        return eventInfo.return;\n                    }\n                    node = node.parent;\n                    updateEventInfo(eventInfo, 'bubbling', node);\n                }\n                updateEventInfo(eventInfo, 'bubbling', this);\n                // Document context.\n                fireListenerFor(bubblingEmitter, '$document', eventInfo, ...eventArgs);\n                return eventInfo.return;\n            }\n            catch (err) {\n                // @if CK_DEBUG // throw err;\n                /* istanbul ignore next -- @preserve */\n                CKEditorError.rethrowUnexpectedError(err, this);\n            }\n        }\n        _addEventListener(event, callback, options) {\n            const contexts = toArray(options.context || '$document');\n            const bubblingEmitter = getBubblingEmitter(this);\n            const callbacksMap = getCallbackMap(this);\n            for (const context of contexts) {\n                if (typeof context == 'function') {\n                    getCustomContexts(this).add(context);\n                }\n            }\n            // Wrap callback with current target match.\n            const wrappedCallback = wrapCallback(this, contexts, callback);\n            // Store for later removing of listeners.\n            callbacksMap.set(callback, wrappedCallback);\n            // Listen for the event.\n            this.listenTo(bubblingEmitter, event, wrappedCallback, options);\n        }\n        _removeEventListener(event, callback) {\n            const bubblingEmitter = getBubblingEmitter(this);\n            const callbacksMap = getCallbackMap(this);\n            const wrappedCallback = callbacksMap.get(callback);\n            if (wrappedCallback) {\n                callbacksMap.delete(callback);\n                this.stopListening(bubblingEmitter, event, wrappedCallback);\n            }\n        }\n    }\n    return Mixin;\n}\n/**\n * Update the event info bubbling fields.\n *\n * @param eventInfo The event info object to update.\n * @param eventPhase The current event phase.\n * @param currentTarget The current bubbling target.\n */\nfunction updateEventInfo(eventInfo, eventPhase, currentTarget) {\n    if (eventInfo instanceof BubblingEventInfo) {\n        eventInfo._eventPhase = eventPhase;\n        eventInfo._currentTarget = currentTarget;\n    }\n}\n/**\n * Fires the listener for the specified context. Returns `true` if event was stopped.\n *\n * @param eventInfo The `EventInfo` object.\n * @param eventArgs Additional arguments to be passed to the callbacks.\n * @returns True if event stop was called.\n */\nfunction fireListenerFor(emitter, currentTarget, eventInfo, ...eventArgs) {\n    emitter.fire(eventInfo, {\n        currentTarget,\n        eventArgs\n    });\n    // Similar to DOM Event#stopImmediatePropagation() this does not fire events\n    // for other contexts on the same node.\n    if (eventInfo.stop.called) {\n        return true;\n    }\n    return false;\n}\n/**\n * Returns an event callback wrapped with context check condition.\n */\nfunction wrapCallback(emitter, contexts, callback) {\n    return function (event, data) {\n        const { currentTarget, eventArgs } = data;\n        // Quick path for string based context ($capture, $text, $document).\n        if (typeof currentTarget == 'string') {\n            if (contexts.includes(currentTarget)) {\n                callback.call(emitter, event, ...eventArgs);\n            }\n            return;\n        }\n        // The current target is a view element.\n        // Special case for the root element as it could be handled ac $root context.\n        // Note that it could also be matched later by custom context.\n        if (currentTarget.is('rootElement') && contexts.includes('$root')) {\n            callback.call(emitter, event, ...eventArgs);\n            return;\n        }\n        // Check if it is a context for this element name.\n        if (contexts.includes(currentTarget.name)) {\n            callback.call(emitter, event, ...eventArgs);\n            return;\n        }\n        // Check if dynamic context matches.\n        for (const context of contexts) {\n            if (typeof context == 'function' && context(currentTarget)) {\n                callback.call(emitter, event, ...eventArgs);\n                return;\n            }\n        }\n    };\n}\n/**\n * Returns bubbling emitter for the source (emitter).\n */\nfunction getBubblingEmitter(source) {\n    if (!source[bubblingEmitterSymbol]) {\n        source[bubblingEmitterSymbol] = new (EmitterMixin())();\n    }\n    return source[bubblingEmitterSymbol];\n}\n/**\n * Returns map of callbacks (original to wrapped one).\n */\nfunction getCallbackMap(source) {\n    if (!source[callbackMapSymbol]) {\n        source[callbackMapSymbol] = new Map();\n    }\n    return source[callbackMapSymbol];\n}\n/**\n * Returns the set of registered custom contexts.\n */\nfunction getCustomContexts(source) {\n    if (!source[contextsSymbol]) {\n        source[contextsSymbol] = new Set();\n    }\n    return source[contextsSymbol];\n}\n/**\n * Returns true if any of custom context match the given element.\n */\nfunction hasMatchingCustomContext(customContexts, element) {\n    for (const context of customContexts) {\n        if (context(element)) {\n            return true;\n        }\n    }\n    return false;\n}\n/**\n * Returns the deeper parent element for the range.\n */\nfunction getDeeperRangeParent(range) {\n    if (!range) {\n        return null;\n    }\n    const startParent = range.start.parent;\n    const endParent = range.end.parent;\n    const startPath = startParent.getPath();\n    const endPath = endParent.getPath();\n    return startPath.length > endPath.length ? startParent : endParent;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/document\n */\nimport { ViewDocumentSelection } from './documentselection.js';\nimport { BubblingEmitterMixin } from './observer/bubblingemittermixin.js';\nimport { Collection, ObservableMixin } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' );\n/**\n * Document class creates an abstract layer over the content editable area, contains a tree of view elements and\n * {@link module:engine/view/documentselection~ViewDocumentSelection view selection} associated with this document.\n */\nexport class ViewDocument extends /* #__PURE__ */ BubblingEmitterMixin(/* #__PURE__ */ ObservableMixin()) {\n    /**\n     * Selection done on this document.\n     */\n    selection;\n    /**\n     * Roots of the view tree. Collection of the {@link module:engine/view/element~ViewElement view elements}.\n     *\n     * View roots are created as a result of binding between {@link module:engine/view/document~ViewDocument#roots} and\n     * {@link module:engine/model/document~ModelDocument#roots} and this is handled by\n     * {@link module:engine/controller/editingcontroller~EditingController}, so to create view root we need to create\n     * model root using {@link module:engine/model/document~ModelDocument#createRoot}.\n     */\n    roots;\n    /**\n     * The styles processor instance used by this document when normalizing styles.\n     */\n    stylesProcessor;\n    /**\n     * Post-fixer callbacks registered to the view document.\n     */\n    _postFixers = new Set();\n    /**\n     * Creates a Document instance.\n     *\n     * @param stylesProcessor The styles processor instance.\n     */\n    constructor(stylesProcessor) {\n        super();\n        this.selection = new ViewDocumentSelection();\n        this.roots = new Collection({ idProperty: 'rootName' });\n        this.stylesProcessor = stylesProcessor;\n        this.set('isReadOnly', false);\n        this.set('isFocused', false);\n        this.set('isSelecting', false);\n        this.set('isComposing', false);\n    }\n    /**\n     * Gets a {@link module:engine/view/document~ViewDocument#roots view root element} with the specified name. If the name is not\n     * specific \"main\" root is returned.\n     *\n     * @param name Name of the root.\n     * @returns The view root element with the specified name or null when there is no root of given name.\n     */\n    getRoot(name = 'main') {\n        return this.roots.get(name);\n    }\n    /**\n     * Allows registering post-fixer callbacks. A post-fixers mechanism allows to update the view tree just before it is rendered\n     * to the DOM.\n     *\n     * Post-fixers are executed right after all changes from the outermost change block were applied but\n     * before the {@link module:engine/view/view~EditingView#event:render render event} is fired. If a post-fixer callback made\n     * a change, it should return `true`. When this happens, all post-fixers are fired again to check if something else should\n     * not be fixed in the new document tree state.\n     *\n     * View post-fixers are useful when you want to apply some fixes whenever the view structure changes. Keep in mind that\n     * changes executed in a view post-fixer should not break model-view mapping.\n     *\n     * The types of changes which should be safe:\n     *\n     * * adding or removing attribute from elements,\n     * * changes inside of {@link module:engine/view/uielement~ViewUIElement UI elements},\n     * * {@link module:engine/controller/editingcontroller~EditingController#reconvertItem marking some of the model elements to be\n     * re-converted}.\n     *\n     * Try to avoid changes which touch view structure:\n     *\n     * * you should not add or remove nor wrap or unwrap any view elements,\n     * * you should not change the editor data model in a view post-fixer.\n     *\n     * As a parameter, a post-fixer callback receives a {@link module:engine/view/downcastwriter~ViewDowncastWriter downcast writer}.\n     *\n     * Typically, a post-fixer will look like this:\n     *\n     * ```ts\n     * editor.editing.view.document.registerPostFixer( writer => {\n     * \tif ( checkSomeCondition() ) {\n     * \t\twriter.doSomething();\n     *\n     * \t\t// Let other post-fixers know that something changed.\n     * \t\treturn true;\n     * \t}\n     *\n     * \treturn false;\n     * } );\n     * ```\n     *\n     * Note that nothing happens right after you register a post-fixer (e.g. execute such a code in the console).\n     * That is because adding a post-fixer does not execute it.\n     * The post-fixer will be executed as soon as any change in the document needs to cause its rendering.\n     * If you want to re-render the editor's view after registering the post-fixer then you should do it manually by calling\n     * {@link module:engine/view/view~EditingView#forceRender `view.forceRender()`}.\n     *\n     * If you need to register a callback which is executed when DOM elements are already updated,\n     * use {@link module:engine/view/view~EditingView#event:render render event}.\n     */\n    registerPostFixer(postFixer) {\n        this._postFixers.add(postFixer);\n    }\n    /**\n     * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.\n     */\n    destroy() {\n        this.roots.forEach(root => root.destroy());\n        this.stopListening();\n    }\n    /**\n     * Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.\n     *\n     * @internal\n     */\n    _callPostFixers(writer) {\n        let wasFixed = false;\n        do {\n            for (const callback of this._postFixers) {\n                wasFixed = callback(writer);\n                if (wasFixed) {\n                    break;\n                }\n            }\n        } while (wasFixed);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/attributeelement\n */\nimport { ViewElement } from './element.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n// Default attribute priority.\nconst DEFAULT_PRIORITY = 10;\n/**\n * Attribute elements are used to represent formatting elements in the view (think – `<b>`, `<span style=\"font-size: 2em\">`, etc.).\n * Most often they are created when downcasting model text attributes.\n *\n * Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various\n * types (container element, {@link module:engine/view/attributeelement~ViewAttributeElement attribute element},\n * {@link module:engine/view/emptyelement~ViewEmptyElement empty element}, etc) when developing a feature.\n *\n * To create a new attribute element instance use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement `ViewDowncastWriter#createAttributeElement()`} method.\n */\nexport class ViewAttributeElement extends ViewElement {\n    static DEFAULT_PRIORITY = DEFAULT_PRIORITY;\n    /**\n     * Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.\n     *\n     * @internal\n     * @readonly\n     */\n    _priority = DEFAULT_PRIORITY;\n    /**\n     * Element identifier. If set, it is used by {@link module:engine/view/element~ViewElement#isSimilar},\n     * and then two elements are considered similar if, and only if they have the same `_id`.\n     *\n     * @internal\n     * @readonly\n     */\n    _id = null;\n    /**\n     * Keeps all the attribute elements that have the same {@link module:engine/view/attributeelement~ViewAttributeElement#id ids}\n     * and still exist in the view tree.\n     *\n     * This property is managed by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.\n     */\n    _clonesGroup = null;\n    /**\n     * Creates an attribute element.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement\n     * @see module:engine/view/element~ViewElement\n     * @protected\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attrs Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attrs, children) {\n        super(document, name, attrs, children);\n        this.getFillerOffset = getFillerOffset;\n    }\n    /**\n     * Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~ViewDowncastWriter}.\n     */\n    get priority() {\n        return this._priority;\n    }\n    /**\n     * Element identifier. If set, it is used by {@link module:engine/view/element~ViewElement#isSimilar},\n     * and then two elements are considered similar if, and only if they have the same `id`.\n     */\n    get id() {\n        return this._id;\n    }\n    /**\n     * Returns all {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that has the\n     * same {@link module:engine/view/attributeelement~ViewAttributeElement#id id} and are in the view tree (were not removed).\n     *\n     * Note: If this element has been removed from the tree, returned set will not include it.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError attribute-element-get-elements-with-same-id-no-id}\n     * if this element has no `id`.\n     *\n     * @returns Set containing all the attribute elements\n     * with the same `id` that were added and not removed from the view tree.\n     */\n    getElementsWithSameId() {\n        if (this.id === null) {\n            /**\n             * Cannot get elements with the same id for an attribute element without id.\n             *\n             * @error attribute-element-get-elements-with-same-id-no-id\n             */\n            throw new CKEditorError('attribute-element-get-elements-with-same-id-no-id', this);\n        }\n        return new Set(this._clonesGroup);\n    }\n    /**\n     * Checks if this element is similar to other element.\n     *\n     * If none of elements has set {@link module:engine/view/attributeelement~ViewAttributeElement#id}, then both elements\n     * should have the same name, attributes and priority to be considered as similar. Two similar elements can contain\n     * different set of children nodes.\n     *\n     * If at least one element has {@link module:engine/view/attributeelement~ViewAttributeElement#id} set, then both\n     * elements have to have the same {@link module:engine/view/attributeelement~ViewAttributeElement#id} value to be\n     * considered similar.\n     *\n     * Similarity is important for {@link module:engine/view/downcastwriter~ViewDowncastWriter}. For example:\n     *\n     * * two following similar elements can be merged together into one, longer element,\n     * * {@link module:engine/view/downcastwriter~ViewDowncastWriter#unwrap} checks similarity of passed element and processed element to\n     * decide whether processed element should be unwrapped,\n     * * etc.\n     */\n    isSimilar(otherElement) {\n        // If any element has an `id` set, just compare the ids.\n        if (this.id !== null || otherElement.id !== null) {\n            return this.id === otherElement.id;\n        }\n        return super.isSimilar(otherElement) && this.priority == otherElement.priority;\n    }\n    /**\n     * Converts `ViewAttributeElement` instance to plain object and returns it.\n     *\n     * @returns `ViewAttributeElement` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'AttributeElement';\n        return json;\n    }\n    /**\n     * Clones provided element with priority.\n     *\n     * @internal\n     * @param deep If set to `true` clones element and all its children recursively. When set to `false`,\n     * element will be cloned without any children.\n     * @returns Clone of this element.\n     */\n    _clone(deep = false) {\n        const cloned = super._clone(deep);\n        // Clone priority too.\n        cloned._priority = this._priority;\n        // And id too.\n        cloned._id = this._id;\n        return cloned;\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to verify if the given element can be merged without\n     * conflicts into this element.\n     *\n     * @internal\n     */\n    _canMergeAttributesFrom(otherElement) {\n        // Can't merge if any of elements have an id or a difference of priority.\n        if (this.id !== null || otherElement.id !== null || this.priority !== otherElement.priority) {\n            return false;\n        }\n        return super._canMergeAttributesFrom(otherElement);\n    }\n    /**\n     * Used by {@link module:engine/view/element~ViewElement#_subtractAttributesOf} to verify if the given element attributes\n     * can be fully subtracted from this element.\n     *\n     * @internal\n     */\n    _canSubtractAttributesOf(otherElement) {\n        // Can't subtract if any of elements have an id or a difference of priority.\n        if (this.id !== null || otherElement.id !== null || this.priority !== otherElement.priority) {\n            return false;\n        }\n        return super._canSubtractAttributesOf(otherElement);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewAttributeElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'attributeElement' || type === 'view:attributeElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'attributeElement' || type === 'view:attributeElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'view:element');\n    }\n};\n/**\n * Returns block {@link module:engine/view/filler~Filler filler} offset or `null` if block filler is not needed.\n *\n * @returns Block filler offset or `null` if block filler is not needed.\n */\nfunction getFillerOffset() {\n    // <b>foo</b> does not need filler.\n    if (nonUiChildrenCount(this)) {\n        return null;\n    }\n    let element = this.parent;\n    // <p><b></b></p> needs filler -> <p><b><br></b></p>\n    while (element && element.is('attributeElement')) {\n        if (nonUiChildrenCount(element) > 1) {\n            return null;\n        }\n        element = element.parent;\n    }\n    if (!element || nonUiChildrenCount(element) > 1) {\n        return null;\n    }\n    // Render block filler at the end of element (after all ui elements).\n    return this.childCount;\n}\n/**\n * Returns total count of children that are not {@link module:engine/view/uielement~ViewUIElement UIElements}.\n */\nfunction nonUiChildrenCount(element) {\n    return Array.from(element.getChildren()).filter(element => !element.is('uiElement')).length;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/emptyelement\n */\nimport { ViewElement } from './element.js';\nimport { ViewNode } from './node.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Empty element class. It is used to represent elements that cannot contain any child nodes (for example `<img>` elements).\n *\n * To create a new empty element use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`} method.\n */\nexport class ViewEmptyElement extends ViewElement {\n    /**\n     * Creates new instance of ViewEmptyElement.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` when third parameter is passed,\n     * to inform that usage of ViewEmptyElement is incorrect (adding child nodes to ViewEmptyElement is forbidden).\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createEmptyElement\n     * @internal\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attributes Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attributes, children) {\n        super(document, name, attributes, children);\n        this.getFillerOffset = getFillerOffset;\n    }\n    /**\n     * Converts `ViewEmptyElement` instance to plain object and returns it.\n     *\n     * @returns `ViewEmptyElement` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'EmptyElement';\n        return json;\n    }\n    /**\n     * Overrides {@link module:engine/view/element~ViewElement#_insertChild} method.\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` to prevent\n     * adding any child nodes to ViewEmptyElement.\n     *\n     * @internal\n     */\n    _insertChild(index, items) {\n        if (items && (items instanceof ViewNode || Array.from(items).length > 0)) {\n            /**\n             * Cannot add children to {@link module:engine/view/emptyelement~ViewEmptyElement}.\n             *\n             * @error view-emptyelement-cannot-add\n             */\n            throw new CKEditorError('view-emptyelement-cannot-add', [this, items]);\n        }\n        return 0;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewEmptyElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'emptyElement' || type === 'view:emptyElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'emptyElement' || type === 'view:emptyElement' ||\n            type === 'element' || type === 'view:element');\n    }\n};\n/**\n * Returns `null` because block filler is not needed for ViewEmptyElements.\n */\nfunction getFillerOffset() {\n    return null;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/uielement\n */\nimport { ViewElement } from './element.js';\nimport { ViewNode } from './node.js';\nimport { CKEditorError, keyCodes } from '@ckeditor/ckeditor5-utils';\n/**\n * UI element class. It should be used to represent editing UI which needs to be injected into the editing view\n * If possible, you should keep your UI outside the editing view. However, if that is not possible,\n * UI elements can be used.\n *\n * How a UI element is rendered is in your control (you pass a callback to\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}).\n * The editor will ignore your UI element – the selection cannot be placed in it, it is skipped (invisible) when\n * the user modifies the selection by using arrow keys and the editor does not listen to any mutations which\n * happen inside your UI elements.\n *\n * The limitation is that you cannot convert a model element to a UI element. UI elements need to be\n * created for {@link module:engine/model/markercollection~Marker markers} or as additinal elements\n * inside normal {@link module:engine/view/containerelement~ViewContainerElement container elements}.\n *\n * To create a new UI element use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.\n */\nexport class ViewUIElement extends ViewElement {\n    /**\n     * Creates new instance of UIElement.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,\n     * to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement\n     * @internal\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attrs Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attrs, children) {\n        super(document, name, attrs, children);\n        this.getFillerOffset = getFillerOffset;\n    }\n    /**\n     * Overrides {@link module:engine/view/element~ViewElement#_insertChild} method.\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes\n     * to UIElement.\n     *\n     * @internal\n     */\n    _insertChild(index, items) {\n        if (items && (items instanceof ViewNode || Array.from(items).length > 0)) {\n            /**\n             * Cannot add children to {@link module:engine/view/uielement~ViewUIElement}.\n             *\n             * @error view-uielement-cannot-add\n             */\n            throw new CKEditorError('view-uielement-cannot-add', [this, items]);\n        }\n        return 0;\n    }\n    /**\n     * Renders this {@link module:engine/view/uielement~ViewUIElement} to DOM. This method is called by\n     * {@link module:engine/view/domconverter~ViewDomConverter}.\n     * Do not use inheritance to create custom rendering method, replace `render()` method instead:\n     *\n     * ```ts\n     * const myUIElement = downcastWriter.createUIElement( 'span' );\n     * myUIElement.render = function( domDocument, domConverter ) {\n     * \tconst domElement = this.toDomElement( domDocument );\n     *\n     * \tdomConverter.setContentOf( domElement, '<b>this is ui element</b>' );\n     *\n     * \treturn domElement;\n     * };\n     * ```\n     *\n     * If changes in your UI element should trigger some editor UI update you should call\n     * the {@link module:ui/editorui/editorui~EditorUI#update `editor.ui.update()`} method\n     * after rendering your UI element.\n     *\n     * @param domConverter Instance of the ViewDomConverter used to optimize the output.\n     */\n    render(domDocument, domConverter // eslint-disable-line @typescript-eslint/no-unused-vars\n    ) {\n        // Provide basic, default output.\n        return this.toDomElement(domDocument);\n    }\n    /**\n     * Creates DOM element based on this view UIElement.\n     * Note that each time this method is called new DOM element is created.\n     */\n    toDomElement(domDocument) {\n        const domElement = domDocument.createElement(this.name);\n        for (const key of this.getAttributeKeys()) {\n            domElement.setAttribute(key, this.getAttribute(key));\n        }\n        return domElement;\n    }\n    /**\n     * Converts `ViewUIElement` instance to plain object and returns it.\n     *\n     * @returns `ViewUIElement` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'UIElement';\n        return json;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewUIElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'uiElement' || type === 'view:uiElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'uiElement' || type === 'view:uiElement' ||\n            type === 'element' || type === 'view:element');\n    }\n};\n/**\n * This function injects UI element handling to the given {@link module:engine/view/document~ViewDocument document}.\n *\n * A callback is added to {@link module:engine/view/document~ViewDocument#event:keydown document keydown event}.\n * The callback handles the situation when right arrow key is pressed and selection is collapsed before a UI element.\n * Without this handler, it would be impossible to \"jump over\" UI element using right arrow key.\n *\n * @param view View controller to which the quirks handling will be injected.\n * @internal\n */\nexport function injectUiElementHandling(view) {\n    view.document.on('arrowKey', (evt, data) => jumpOverUiElement(evt, data, view.domConverter), { priority: 'low' });\n}\n/**\n * Returns `null` because block filler is not needed for UIElements.\n */\nfunction getFillerOffset() {\n    return null;\n}\n/**\n * Selection cannot be placed in a `UIElement`. Whenever it is placed there, it is moved before it. This\n * causes a situation when it is impossible to jump over `UIElement` using right arrow key, because the selection\n * ends up in ui element (in DOM) and is moved back to the left. This handler fixes this situation.\n */\nfunction jumpOverUiElement(evt, data, domConverter) {\n    if (data.keyCode == keyCodes.arrowright) {\n        const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();\n        const domSelectionCollapsed = domSelection.rangeCount == 1 && domSelection.getRangeAt(0).collapsed;\n        // Jump over UI element if selection is collapsed or shift key is pressed. These are the cases when selection would extend.\n        if (domSelectionCollapsed || data.shiftKey) {\n            const domParent = domSelection.focusNode;\n            const domOffset = domSelection.focusOffset;\n            const viewPosition = domConverter.domPositionToView(domParent, domOffset);\n            // In case if dom element is not converted to view or is not mapped or something. Happens for example in some tests.\n            if (viewPosition === null) {\n                return;\n            }\n            // Skip all following ui elements.\n            let jumpedOverAnyUiElement = false;\n            const nextViewPosition = viewPosition.getLastMatchingPosition(value => {\n                if (value.item.is('uiElement')) {\n                    // Remember that there was at least one ui element.\n                    jumpedOverAnyUiElement = true;\n                }\n                // Jump over ui elements, jump over empty attribute elements, move up from inside of attribute element.\n                if (value.item.is('uiElement') || value.item.is('attributeElement')) {\n                    return true;\n                }\n                // Don't jump over text or don't get out of container element.\n                return false;\n            });\n            // If anything has been skipped, fix position.\n            // This `if` could be possibly omitted but maybe it is better not to mess with DOM selection if not needed.\n            if (jumpedOverAnyUiElement) {\n                const newDomPosition = domConverter.viewPositionToDom(nextViewPosition);\n                if (domSelectionCollapsed) {\n                    // Selection was collapsed, so collapse it at further position.\n                    domSelection.collapse(newDomPosition.parent, newDomPosition.offset);\n                }\n                else {\n                    // Selection was not collapse, so extend it instead of collapsing.\n                    domSelection.extend(newDomPosition.parent, newDomPosition.offset);\n                }\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n * @module engine/view/rawelement\n */\nimport { ViewElement } from './element.js';\nimport { ViewNode } from './node.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * The raw element class.\n *\n * The raw elements work as data containers (\"wrappers\", \"sandboxes\") but their children are not managed or\n * even recognized by the editor. This encapsulation allows integrations to maintain custom DOM structures\n * in the editor content without, for instance, worrying about compatibility with other editor features.\n * Raw elements are a perfect tool for integration with external frameworks and data sources.\n *\n * Unlike {@link module:engine/view/uielement~ViewUIElement UI elements}, raw elements act like real editor\n * content (similar to {@link module:engine/view/containerelement~ViewContainerElement} or\n * {@link module:engine/view/emptyelement~ViewEmptyElement}), they are considered by the editor selection and\n * {@link module:widget/utils~toWidget they can work as widgets}.\n *\n * To create a new raw element, use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createRawElement `downcastWriter#createRawElement()`} method.\n */\nexport class ViewRawElement extends ViewElement {\n    /**\n     * Creates a new instance of a raw element.\n     *\n     * Throws the `view-rawelement-cannot-add` {@link module:utils/ckeditorerror~CKEditorError CKEditorError} when the `children`\n     * parameter is passed to inform that the usage of `ViewRawElement` is incorrect (adding child nodes to `ViewRawElement` is forbidden).\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#createRawElement\n     * @internal\n     * @param document The document instance to which this element belongs.\n     * @param name Node name.\n     * @param attrs Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     */\n    constructor(document, name, attrs, children) {\n        super(document, name, attrs, children);\n        // Returns `null` because filler is not needed for raw elements.\n        this.getFillerOffset = getFillerOffset;\n    }\n    /**\n     * Converts `ViewRawElement` instance to plain object and returns it.\n     *\n     * @returns `ViewRawElement` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.type = 'RawElement';\n        return json;\n    }\n    /**\n     * Overrides the {@link module:engine/view/element~ViewElement#_insertChild} method.\n     * Throws the `view-rawelement-cannot-add` {@link module:utils/ckeditorerror~CKEditorError CKEditorError} to prevent\n     * adding any child nodes to a raw element.\n     *\n     * @internal\n     */\n    _insertChild(index, items) {\n        if (items && (items instanceof ViewNode || Array.from(items).length > 0)) {\n            /**\n             * Cannot add children to a {@link module:engine/view/rawelement~ViewRawElement} instance.\n             *\n             * @error view-rawelement-cannot-add\n             */\n            throw new CKEditorError('view-rawelement-cannot-add', [this, items]);\n        }\n        return 0;\n    }\n    /**\n     * This allows rendering the children of a {@link module:engine/view/rawelement~ViewRawElement} on the DOM level.\n     * This method is called by the {@link module:engine/view/domconverter~ViewDomConverter} with the raw DOM element\n     * passed as an argument, leaving the number and shape of the children up to the integrator.\n     *\n     * This method **must be defined** for the raw element to work:\n     *\n     * ```ts\n     * const myRawElement = downcastWriter.createRawElement( 'div' );\n     *\n     * myRawElement.render = function( domElement, domConverter ) {\n     * \tdomConverter.setContentOf( domElement, '<b>This is the raw content of myRawElement.</b>' );\n     * };\n     * ```\n     *\n     * @param domElement The native DOM element representing the raw view element.\n     * @param domConverter Instance of the ViewDomConverter used to optimize the output.\n     */\n    render(domElement, domConverter) { }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewRawElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'rawElement' || type === 'view:rawElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === this.name || type === 'view:' + this.name ||\n            type === 'element' || type === 'view:element' ||\n            type === 'node' || type === 'view:node';\n    }\n    else {\n        return name === this.name && (type === 'rawElement' || type === 'view:rawElement' ||\n            type === 'element' || type === 'view:element');\n    }\n};\n/**\n * Returns `null` because block filler is not needed for raw elements.\n */\nfunction getFillerOffset() {\n    return null;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/documentfragment\n */\nimport { ViewTypeCheckable } from './typecheckable.js';\nimport { ViewText } from './text.js';\nimport { ViewTextProxy } from './textproxy.js';\nimport { EmitterMixin, isIterable } from '@ckeditor/ckeditor5-utils';\n/**\n * Document fragment.\n *\n * To create a new document fragment instance use the\n * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createDocumentFragment `ViewUpcastWriter#createDocumentFragment()`}\n * method.\n */\nexport class ViewDocumentFragment extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {\n    /**\n     * The document to which this document fragment belongs.\n     */\n    document;\n    /**\n     * Array of child nodes.\n     */\n    _children = [];\n    /**\n     * Map of custom properties.\n     * Custom properties can be added to document fragment instance.\n     */\n    _customProperties = new Map();\n    /**\n     * Creates new DocumentFragment instance.\n     *\n     * @internal\n     * @param document The document to which this document fragment belongs.\n     * @param children A list of nodes to be inserted into the created document fragment.\n     */\n    constructor(document, children) {\n        super();\n        this.document = document;\n        if (children) {\n            this._insertChild(0, children);\n        }\n    }\n    /**\n     * Iterable interface.\n     *\n     * Iterates over nodes added to this document fragment.\n     */\n    [Symbol.iterator]() {\n        return this._children[Symbol.iterator]();\n    }\n    /**\n     * Number of child nodes in this document fragment.\n     */\n    get childCount() {\n        return this._children.length;\n    }\n    /**\n     * Is `true` if there are no nodes inside this document fragment, `false` otherwise.\n     */\n    get isEmpty() {\n        return this.childCount === 0;\n    }\n    /**\n     * Artificial root of `DocumentFragment`. Returns itself. Added for compatibility reasons.\n     */\n    get root() {\n        return this;\n    }\n    /**\n     * Artificial parent of `DocumentFragment`. Returns `null`. Added for compatibility reasons.\n     */\n    get parent() {\n        return null;\n    }\n    /**\n     * Artificial element name. Returns `undefined`. Added for compatibility reasons.\n     */\n    get name() {\n        return undefined;\n    }\n    /**\n     * Artificial element getFillerOffset. Returns `undefined`. Added for compatibility reasons.\n     */\n    get getFillerOffset() {\n        return undefined;\n    }\n    /**\n     * Returns the custom property value for the given key.\n     */\n    getCustomProperty(key) {\n        return this._customProperties.get(key);\n    }\n    /**\n     * Returns an iterator which iterates over this document fragment's custom properties.\n     * Iterator provides `[ key, value ]` pairs for each stored property.\n     */\n    *getCustomProperties() {\n        yield* this._customProperties.entries();\n    }\n    /**\n     * Converts `ViewDocumentFragment` instance to plain object and returns it.\n     * Takes care of converting all of this document fragment's children.\n     *\n     * @returns `ViewDocumentFragment` instance converted to plain object.\n     */\n    toJSON() {\n        const json = [];\n        for (const node of this._children) {\n            json.push(node.toJSON());\n        }\n        return json;\n    }\n    /**\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment#_insertChild Insert} a child node or a list of child nodes at the end\n     * and sets the parent of these nodes to this fragment.\n     *\n     * @internal\n     * @param items Items to be inserted.\n     * @returns Number of appended nodes.\n     */\n    _appendChild(items) {\n        return this._insertChild(this.childCount, items);\n    }\n    /**\n     * Gets child at the given index.\n     *\n     * @param index Index of child.\n     * @returns Child node.\n     */\n    getChild(index) {\n        return this._children[index];\n    }\n    /**\n     * Gets index of the given child node. Returns `-1` if child node is not found.\n     *\n     * @param node Child node.\n     * @returns Index of the child node.\n     */\n    getChildIndex(node) {\n        return this._children.indexOf(node);\n    }\n    /**\n     * Gets child nodes iterator.\n     *\n     * @returns Child nodes iterator.\n     */\n    getChildren() {\n        return this._children[Symbol.iterator]();\n    }\n    /**\n     * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to\n     * this fragment.\n     *\n     * @internal\n     * @param index Position where nodes should be inserted.\n     * @param items Items to be inserted.\n     * @returns Number of inserted nodes.\n     */\n    _insertChild(index, items) {\n        this._fireChange('children', this, { index });\n        let count = 0;\n        const nodes = normalize(this.document, items);\n        for (const node of nodes) {\n            // If node that is being added to this element is already inside another element, first remove it from the old parent.\n            if (node.parent !== null) {\n                node._remove();\n            }\n            node.parent = this;\n            this._children.splice(index, 0, node);\n            index++;\n            count++;\n        }\n        return count;\n    }\n    /**\n     * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.\n     *\n     * @internal\n     * @param index Number of the first node to remove.\n     * @param howMany Number of nodes to remove.\n     * @returns The array of removed nodes.\n     */\n    _removeChildren(index, howMany = 1) {\n        this._fireChange('children', this, { index });\n        for (let i = index; i < index + howMany; i++) {\n            this._children[i].parent = null;\n        }\n        return this._children.splice(index, howMany);\n    }\n    /**\n     * @internal\n     * @param type Type of the change.\n     * @param node Changed node.\n     * @param data Additional data.\n     * @fires module:engine/view/node~ViewNode#event:change\n     */\n    _fireChange(type, node, data) {\n        this.fire(`change:${type}`, node, data);\n    }\n    /**\n     * Sets a custom property. They can be used to add special data to elements.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#setCustomProperty\n     * @internal\n     */\n    _setCustomProperty(key, value) {\n        this._customProperties.set(key, value);\n    }\n    /**\n     * Removes the custom property stored under the given key.\n     *\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeCustomProperty\n     * @internal\n     * @returns Returns true if property was removed.\n     */\n    _removeCustomProperty(key) {\n        return this._customProperties.delete(key);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nViewDocumentFragment.prototype.is = function (type) {\n    return type === 'documentFragment' || type === 'view:documentFragment';\n};\n/**\n * Converts strings to Text and non-iterables to arrays.\n */\nfunction normalize(document, nodes) {\n    // Separate condition because string is iterable.\n    if (typeof nodes == 'string') {\n        return [new ViewText(document, nodes)];\n    }\n    if (!isIterable(nodes)) {\n        nodes = [nodes];\n    }\n    // Array.from to enable .map() on non-arrays.\n    return Array.from(nodes)\n        .map(node => {\n        if (typeof node == 'string') {\n            return new ViewText(document, node);\n        }\n        if (node instanceof ViewTextProxy) {\n            return new ViewText(document, node.data);\n        }\n        return node;\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/downcastwriter\n */\nimport { ViewPosition } from './position.js';\nimport { ViewRange } from './range.js';\nimport { ViewSelection } from './selection.js';\nimport { ViewContainerElement } from './containerelement.js';\nimport { ViewAttributeElement } from './attributeelement.js';\nimport { ViewEmptyElement } from './emptyelement.js';\nimport { ViewUIElement } from './uielement.js';\nimport { ViewRawElement } from './rawelement.js';\nimport { CKEditorError, isIterable } from '@ckeditor/ckeditor5-utils';\nimport { ViewDocumentFragment } from './documentfragment.js';\nimport { ViewText } from './text.js';\nimport { ViewEditableElement } from './editableelement.js';\nimport { isPlainObject } from 'es-toolkit/compat';\n/**\n * View downcast writer.\n *\n * It provides a set of methods used to manipulate view nodes.\n *\n * Do not create an instance of this writer manually. To modify a view structure, use\n * the {@link module:engine/view/view~EditingView#change `View#change()`} block.\n *\n * The `ViewDowncastWriter` is designed to work with semantic views which are the views that were/are being downcasted from the model.\n * To work with ordinary views (e.g. parsed from a pasted content) use the\n * {@link module:engine/view/upcastwriter~ViewUpcastWriter upcast writer}.\n *\n * Read more about changing the view in the {@glink framework/architecture/editing-engine#changing-the-view Changing the view}\n * section of the {@glink framework/architecture/editing-engine Editing engine architecture} guide.\n */\nexport class ViewDowncastWriter {\n    /**\n     * The view document instance in which this writer operates.\n     */\n    document;\n    /**\n     * Holds references to the attribute groups that share the same {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.\n     * The keys are `id`s, the values are `Set`s holding {@link module:engine/view/attributeelement~ViewAttributeElement}s.\n     */\n    _cloneGroups = new Map();\n    /**\n     * The slot factory used by the `elementToStructure` downcast helper.\n     */\n    _slotFactory = null;\n    /**\n     * @param document The view document instance.\n     */\n    constructor(document) {\n        this.document = document;\n    }\n    setSelection(...args) {\n        this.document.selection._setTo(...args);\n    }\n    /**\n     * Moves {@link module:engine/view/documentselection~ViewDocumentSelection#focus selection's focus} to the specified location.\n     *\n     * The location can be specified in the same form as\n     * {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}\n     * parameters.\n     *\n     * @param itemOrPosition\n     * @param offset Offset or one of the flags. Used only when the first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    setSelectionFocus(itemOrPosition, offset) {\n        this.document.selection._setFocus(itemOrPosition, offset);\n    }\n    /**\n     * Creates a new {@link module:engine/view/documentfragment~ViewDocumentFragment} instance.\n     *\n     * @param children A list of nodes to be inserted into the created document fragment.\n     * @returns The created document fragment.\n     */\n    createDocumentFragment(children) {\n        return new ViewDocumentFragment(this.document, children);\n    }\n    /**\n     * Creates a new {@link module:engine/view/text~ViewText text node}.\n     *\n     * ```ts\n     * writer.createText( 'foo' );\n     * ```\n     *\n     * @param data The text's data.\n     * @returns The created text node.\n     */\n    createText(data) {\n        return new ViewText(this.document, data);\n    }\n    /**\n     * Creates a new {@link module:engine/view/attributeelement~ViewAttributeElement}.\n     *\n     * ```ts\n     * writer.createAttributeElement( 'strong' );\n     * writer.createAttributeElement( 'a', { href: 'foo.bar' } );\n     *\n     * // Make `<a>` element contain other attributes element so the `<a>` element is not broken.\n     * writer.createAttributeElement( 'a', { href: 'foo.bar' }, { priority: 5 } );\n     *\n     * // Set `id` of a marker element so it is not joined or merged with \"normal\" elements.\n     * writer.createAttributeElement( 'span', { class: 'my-marker' }, { id: 'marker:my' } );\n     * ```\n     *\n     * @param name Name of the element.\n     * @param attributes Element's attributes.\n     * @param options Element's options.\n     * @param options.priority Element's {@link module:engine/view/attributeelement~ViewAttributeElement#priority priority}.\n     * @param options.id Element's {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.\n     * @param options.renderUnsafeAttributes A list of attribute names that should be rendered in the editing\n     * pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.\n     * @returns Created element.\n     */\n    createAttributeElement(name, attributes, options = {}) {\n        const attributeElement = new ViewAttributeElement(this.document, name, attributes);\n        if (typeof options.priority === 'number') {\n            attributeElement._priority = options.priority;\n        }\n        if (options.id) {\n            attributeElement._id = options.id;\n        }\n        if (options.renderUnsafeAttributes) {\n            attributeElement._unsafeAttributesToRender.push(...options.renderUnsafeAttributes);\n        }\n        return attributeElement;\n    }\n    createContainerElement(name, attributes, childrenOrOptions = {}, options = {}) {\n        let children = undefined;\n        if (isContainerOptions(childrenOrOptions)) {\n            options = childrenOrOptions;\n        }\n        else {\n            children = childrenOrOptions;\n        }\n        const containerElement = new ViewContainerElement(this.document, name, attributes, children);\n        if (options.renderUnsafeAttributes) {\n            containerElement._unsafeAttributesToRender.push(...options.renderUnsafeAttributes);\n        }\n        return containerElement;\n    }\n    /**\n     * Creates a new {@link module:engine/view/editableelement~ViewEditableElement}.\n     *\n     * ```ts\n     * writer.createEditableElement( 'div' );\n     * writer.createEditableElement( 'div', { id: 'foo-1234' } );\n     * ```\n     *\n     * Note: The editable element is to be used in the editing pipeline. Usually, together with\n     * {@link module:widget/utils~toWidgetEditable `toWidgetEditable()`}.\n     *\n     * @param name Name of the element.\n     * @param attributes Elements attributes.\n     * @param options Element's options.\n     * @param options.renderUnsafeAttributes A list of attribute names that should be rendered in the editing\n     * pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.\n     * @returns Created element.\n     */\n    createEditableElement(name, attributes, options = {}) {\n        const editableElement = new ViewEditableElement(this.document, name, attributes);\n        if (options.renderUnsafeAttributes) {\n            editableElement._unsafeAttributesToRender.push(...options.renderUnsafeAttributes);\n        }\n        return editableElement;\n    }\n    /**\n     * Creates a new {@link module:engine/view/emptyelement~ViewEmptyElement}.\n     *\n     * ```ts\n     * writer.createEmptyElement( 'img' );\n     * writer.createEmptyElement( 'img', { id: 'foo-1234' } );\n     * ```\n     *\n     * @param name Name of the element.\n     * @param attributes Elements attributes.\n     * @param options Element's options.\n     * @param options.renderUnsafeAttributes A list of attribute names that should be rendered in the editing\n     * pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.\n     * @returns Created element.\n     */\n    createEmptyElement(name, attributes, options = {}) {\n        const emptyElement = new ViewEmptyElement(this.document, name, attributes);\n        if (options.renderUnsafeAttributes) {\n            emptyElement._unsafeAttributesToRender.push(...options.renderUnsafeAttributes);\n        }\n        return emptyElement;\n    }\n    /**\n     * Creates a new {@link module:engine/view/uielement~ViewUIElement}.\n     *\n     * ```ts\n     * writer.createUIElement( 'span' );\n     * writer.createUIElement( 'span', { id: 'foo-1234' } );\n     * ```\n     *\n     * A custom render function can be provided as the third parameter:\n     *\n     * ```ts\n     * writer.createUIElement( 'span', null, function( domDocument ) {\n     * \tconst domElement = this.toDomElement( domDocument );\n     * \tdomElement.innerHTML = '<b>this is ui element</b>';\n     *\n     * \treturn domElement;\n     * } );\n     * ```\n     *\n     * Unlike {@link #createRawElement raw elements}, UI elements are by no means editor content, for instance,\n     * they are ignored by the editor selection system.\n     *\n     * You should not use UI elements as data containers. Check out {@link #createRawElement} instead.\n     *\n     * @param name The name of the element.\n     * @param attributes Element attributes.\n     * @param renderFunction A custom render function.\n     * @returns The created element.\n     */\n    createUIElement(name, attributes, renderFunction) {\n        const uiElement = new ViewUIElement(this.document, name, attributes);\n        if (renderFunction) {\n            uiElement.render = renderFunction;\n        }\n        return uiElement;\n    }\n    /**\n     * Creates a new {@link module:engine/view/rawelement~ViewRawElement}.\n     *\n     * ```ts\n     * writer.createRawElement( 'span', { id: 'foo-1234' }, function( domElement ) {\n     * \tdomElement.innerHTML = '<b>This is the raw content of the raw element.</b>';\n     * } );\n     * ```\n     *\n     * Raw elements work as data containers (\"wrappers\", \"sandboxes\") but their children are not managed or\n     * even recognized by the editor. This encapsulation allows integrations to maintain custom DOM structures\n     * in the editor content without, for instance, worrying about compatibility with other editor features.\n     * Raw elements are a perfect tool for integration with external frameworks and data sources.\n     *\n     * Unlike {@link #createUIElement UI elements}, raw elements act like \"real\" editor content (similar to\n     * {@link module:engine/view/containerelement~ViewContainerElement} or {@link module:engine/view/emptyelement~ViewEmptyElement}),\n     * and they are considered by the editor selection.\n     *\n     * You should not use raw elements to render the UI in the editor content. Check out {@link #createUIElement `#createUIElement()`}\n     * instead.\n     *\n     * @param name The name of the element.\n     * @param attributes Element attributes.\n     * @param renderFunction A custom render function.\n     * @param options Element's options.\n     * @param options.renderUnsafeAttributes A list of attribute names that should be rendered in the editing\n     * pipeline even though they would normally be filtered out by unsafe attribute detection mechanisms.\n     * @returns The created element.\n     */\n    createRawElement(name, attributes, renderFunction, options = {}) {\n        const rawElement = new ViewRawElement(this.document, name, attributes);\n        if (renderFunction) {\n            rawElement.render = renderFunction;\n        }\n        if (options.renderUnsafeAttributes) {\n            rawElement._unsafeAttributesToRender.push(...options.renderUnsafeAttributes);\n        }\n        return rawElement;\n    }\n    setAttribute(key, value, elementOrOverwrite, element) {\n        if (element !== undefined) {\n            element._setAttribute(key, value, elementOrOverwrite);\n        }\n        else {\n            elementOrOverwrite._setAttribute(key, value);\n        }\n    }\n    removeAttribute(key, elementOrTokens, element) {\n        if (element !== undefined) {\n            element._removeAttribute(key, elementOrTokens);\n        }\n        else {\n            elementOrTokens._removeAttribute(key);\n        }\n    }\n    /**\n     * Adds specified class to the element.\n     *\n     * ```ts\n     * writer.addClass( 'foo', linkElement );\n     * writer.addClass( [ 'foo', 'bar' ], linkElement );\n     * ```\n     */\n    addClass(className, element) {\n        element._addClass(className);\n    }\n    /**\n     * Removes specified class from the element.\n     *\n     * ```ts\n     * writer.removeClass( 'foo', linkElement );\n     * writer.removeClass( [ 'foo', 'bar' ], linkElement );\n     * ```\n     */\n    removeClass(className, element) {\n        element._removeClass(className);\n    }\n    setStyle(property, value, element) {\n        if (isPlainObject(property) && element === undefined) {\n            value._setStyle(property);\n        }\n        else {\n            element._setStyle(property, value);\n        }\n    }\n    /**\n     * Removes specified style from the element.\n     *\n     * ```ts\n     * writer.removeStyle( 'color', element ); // Removes 'color' style.\n     * writer.removeStyle( [ 'color', 'border-top' ], element ); // Removes both 'color' and 'border-top' styles.\n     * ```\n     *\n     * **Note**: This method can work with normalized style names if\n     * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.\n     * See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.\n     */\n    removeStyle(property, element) {\n        element._removeStyle(property);\n    }\n    /**\n     * Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,\n     * so they can be used to add special data to elements.\n     */\n    setCustomProperty(key, value, element) {\n        element._setCustomProperty(key, value);\n    }\n    /**\n     * Removes a custom property stored under the given key.\n     *\n     * @returns Returns true if property was removed.\n     */\n    removeCustomProperty(key, element) {\n        return element._removeCustomProperty(key);\n    }\n    /**\n     * Breaks attribute elements at the provided position or at the boundaries of a provided range. It breaks attribute elements\n     * up to their first ancestor that is a container element.\n     *\n     * In following examples `<p>` is a container, `<b>` and `<u>` are attribute elements:\n     *\n     * ```html\n     * <p>foo<b><u>bar{}</u></b></p> -> <p>foo<b><u>bar</u></b>[]</p>\n     * <p>foo<b><u>{}bar</u></b></p> -> <p>foo{}<b><u>bar</u></b></p>\n     * <p>foo<b><u>b{}ar</u></b></p> -> <p>foo<b><u>b</u></b>[]<b><u>ar</u></b></p>\n     * <p><b>fo{o</b><u>ba}r</u></p> -> <p><b>fo</b><b>o</b><u>ba</u><u>r</u></b></p>\n     * ```\n     *\n     * **Note:** {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment} is treated like a container.\n     *\n     * **Note:** The difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes breakAttributes()} and\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakContainer breakContainer()} is that `breakAttributes()` breaks all\n     * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that are ancestors of a given `position`,\n     * up to the first encountered {@link module:engine/view/containerelement~ViewContainerElement container element}.\n     * `breakContainer()` assumes that a given `position` is directly in the container element and breaks that container element.\n     *\n     * Throws the `view-writer-invalid-range-container` {@link module:utils/ckeditorerror~CKEditorError CKEditorError}\n     * when the {@link module:engine/view/range~ViewRange#start start}\n     * and {@link module:engine/view/range~ViewRange#end end} positions of a passed range are not placed inside same parent container.\n     *\n     * Throws the `view-writer-cannot-break-empty-element` {@link module:utils/ckeditorerror~CKEditorError CKEditorError}\n     * when trying to break attributes inside an {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElement}.\n     *\n     * Throws the `view-writer-cannot-break-ui-element` {@link module:utils/ckeditorerror~CKEditorError CKEditorError}\n     * when trying to break attributes inside a {@link module:engine/view/uielement~ViewUIElement UIElement}.\n     *\n     * @see module:engine/view/attributeelement~ViewAttributeElement\n     * @see module:engine/view/containerelement~ViewContainerElement\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#breakContainer\n     * @param positionOrRange The position where to break attribute elements.\n     * @returns The new position or range, after breaking the attribute elements.\n     */\n    breakAttributes(positionOrRange) {\n        if (positionOrRange instanceof ViewPosition) {\n            return this._breakAttributes(positionOrRange);\n        }\n        else {\n            return this._breakAttributesRange(positionOrRange);\n        }\n    }\n    /**\n     * Breaks a {@link module:engine/view/containerelement~ViewContainerElement container view element} into two, at the given position.\n     * The position has to be directly inside the container element and cannot be in the root. It does not break the conrainer view element\n     * if the position is at the beginning or at the end of its parent element.\n     *\n     * ```html\n     * <p>foo^bar</p> -> <p>foo</p><p>bar</p>\n     * <div><p>foo</p>^<p>bar</p></div> -> <div><p>foo</p></div><div><p>bar</p></div>\n     * <p>^foobar</p> -> ^<p>foobar</p>\n     * <p>foobar^</p> -> <p>foobar</p>^\n     * ```\n     *\n     * **Note:** The difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes breakAttributes()} and\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakContainer breakContainer()} is that `breakAttributes()` breaks all\n     * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that are ancestors of a given `position`,\n     * up to the first encountered {@link module:engine/view/containerelement~ViewContainerElement container element}.\n     * `breakContainer()` assumes that the given `position` is directly in the container element and breaks that container element.\n     *\n     * @see module:engine/view/attributeelement~ViewAttributeElement\n     * @see module:engine/view/containerelement~ViewContainerElement\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes\n     * @param position The position where to break the element.\n     * @returns The position between broken elements. If an element has not been broken,\n     * the returned position is placed either before or after it.\n     */\n    breakContainer(position) {\n        const element = position.parent;\n        if (!(element.is('containerElement'))) {\n            /**\n             * Trying to break an element which is not a container element.\n             *\n             * @error view-writer-break-non-container-element\n             */\n            throw new CKEditorError('view-writer-break-non-container-element', this.document);\n        }\n        if (!element.parent) {\n            /**\n             * Trying to break root element.\n             *\n             * @error view-writer-break-root\n             */\n            throw new CKEditorError('view-writer-break-root', this.document);\n        }\n        if (position.isAtStart) {\n            return ViewPosition._createBefore(element);\n        }\n        else if (!position.isAtEnd) {\n            const newElement = element._clone(false);\n            this.insert(ViewPosition._createAfter(element), newElement);\n            const sourceRange = new ViewRange(position, ViewPosition._createAt(element, 'end'));\n            const targetPosition = new ViewPosition(newElement, 0);\n            this.move(sourceRange, targetPosition);\n        }\n        return ViewPosition._createAfter(element);\n    }\n    /**\n     * Merges {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}. It also merges text nodes if needed.\n     * Only {@link module:engine/view/attributeelement~ViewAttributeElement#isSimilar similar} attribute elements can be merged.\n     *\n     * In following examples `<p>` is a container and `<b>` is an attribute element:\n     *\n     * ```html\n     * <p>foo[]bar</p> -> <p>foo{}bar</p>\n     * <p><b>foo</b>[]<b>bar</b></p> -> <p><b>foo{}bar</b></p>\n     * <p><b foo=\"bar\">a</b>[]<b foo=\"baz\">b</b></p> -> <p><b foo=\"bar\">a</b>[]<b foo=\"baz\">b</b></p>\n     * ```\n     *\n     * It will also take care about empty attributes when merging:\n     *\n     * ```html\n     * <p><b>[]</b></p> -> <p>[]</p>\n     * <p><b>foo</b><i>[]</i><b>bar</b></p> -> <p><b>foo{}bar</b></p>\n     * ```\n     *\n     * **Note:** Difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeAttributes mergeAttributes} and\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeContainers mergeContainers} is that `mergeAttributes` merges two\n     * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} or\n     * {@link module:engine/view/text~ViewText text nodes} while `mergeContainer` merges two\n     * {@link module:engine/view/containerelement~ViewContainerElement container elements}.\n     *\n     * @see module:engine/view/attributeelement~ViewAttributeElement\n     * @see module:engine/view/containerelement~ViewContainerElement\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#mergeContainers\n     * @param position Merge position.\n     * @returns Position after merge.\n     */\n    mergeAttributes(position) {\n        const positionOffset = position.offset;\n        const positionParent = position.parent;\n        // When inside text node - nothing to merge.\n        if (positionParent.is('$text')) {\n            return position;\n        }\n        // When inside empty attribute - remove it.\n        if (positionParent.is('attributeElement') && positionParent.childCount === 0) {\n            const parent = positionParent.parent;\n            const offset = positionParent.index;\n            positionParent._remove();\n            this._removeFromClonedElementsGroup(positionParent);\n            return this.mergeAttributes(new ViewPosition(parent, offset));\n        }\n        const nodeBefore = positionParent.getChild(positionOffset - 1);\n        const nodeAfter = positionParent.getChild(positionOffset);\n        // Position should be placed between two nodes.\n        if (!nodeBefore || !nodeAfter) {\n            return position;\n        }\n        // When position is between two text nodes.\n        if (nodeBefore.is('$text') && nodeAfter.is('$text')) {\n            return mergeTextNodes(nodeBefore, nodeAfter);\n        }\n        // When position is between two same attribute elements.\n        else if (nodeBefore.is('attributeElement') && nodeAfter.is('attributeElement') && nodeBefore.isSimilar(nodeAfter)) {\n            // Move all children nodes from node placed after selection and remove that node.\n            const count = nodeBefore.childCount;\n            nodeBefore._appendChild(nodeAfter.getChildren());\n            nodeAfter._remove();\n            this._removeFromClonedElementsGroup(nodeAfter);\n            // New position is located inside the first node, before new nodes.\n            // Call this method recursively to merge again if needed.\n            return this.mergeAttributes(new ViewPosition(nodeBefore, count));\n        }\n        return position;\n    }\n    /**\n     * Merges two {@link module:engine/view/containerelement~ViewContainerElement container elements} that are\n     * before and after given position. Precisely, the element after the position is removed and it's contents are\n     * moved to element before the position.\n     *\n     * ```html\n     * <p>foo</p>^<p>bar</p> -> <p>foo^bar</p>\n     * <div>foo</div>^<p>bar</p> -> <div>foo^bar</div>\n     * ```\n     *\n     * **Note:** Difference between {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeAttributes mergeAttributes} and\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter#mergeContainers mergeContainers} is that `mergeAttributes` merges two\n     * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} or\n     * {@link module:engine/view/text~ViewText text nodes} while `mergeContainer` merges two\n     * {@link module:engine/view/containerelement~ViewContainerElement container elements}.\n     *\n     * @see module:engine/view/attributeelement~ViewAttributeElement\n     * @see module:engine/view/containerelement~ViewContainerElement\n     * @see module:engine/view/downcastwriter~ViewDowncastWriter#mergeAttributes\n     * @param position Merge position.\n     * @returns Position after merge.\n     */\n    mergeContainers(position) {\n        const prev = position.nodeBefore;\n        const next = position.nodeAfter;\n        if (!prev || !next || !prev.is('containerElement') || !next.is('containerElement')) {\n            /**\n             * Element before and after given position cannot be merged.\n             *\n             * @error view-writer-merge-containers-invalid-position\n             */\n            throw new CKEditorError('view-writer-merge-containers-invalid-position', this.document);\n        }\n        const lastChild = prev.getChild(prev.childCount - 1);\n        const newPosition = lastChild instanceof ViewText ?\n            ViewPosition._createAt(lastChild, 'end') :\n            ViewPosition._createAt(prev, 'end');\n        this.move(ViewRange._createIn(next), ViewPosition._createAt(prev, 'end'));\n        this.remove(ViewRange._createOn(next));\n        return newPosition;\n    }\n    /**\n     * Inserts a node or nodes at specified position. Takes care about breaking attributes before insertion\n     * and merging them afterwards.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-insert-invalid-node` when nodes to insert\n     * contains instances that are not {@link module:engine/view/text~ViewText Texts},\n     * {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElements},\n     * {@link module:engine/view/containerelement~ViewContainerElement ViewContainerElements},\n     * {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElements},\n     * {@link module:engine/view/rawelement~ViewRawElement RawElements} or\n     * {@link module:engine/view/uielement~ViewUIElement UIElements}.\n     *\n     * @param position Insertion position.\n     * @param nodes Node or nodes to insert.\n     * @returns Range around inserted nodes.\n     */\n    insert(position, nodes) {\n        nodes = isIterable(nodes) ? [...nodes] : [nodes];\n        // Check if nodes to insert are instances of ViewAttributeElements, ViewContainerElements, ViewEmptyElements, UIElements or Text.\n        validateNodesToInsert(nodes, this.document);\n        // Group nodes in batches of nodes that require or do not require breaking an ViewAttributeElements.\n        const nodeGroups = nodes.reduce((groups, node) => {\n            const lastGroup = groups[groups.length - 1];\n            // Break attributes on nodes that do exist in the model tree so they can have attributes, other elements\n            // can't have an attribute in model and won't get wrapped with an ViewAttributeElement while down-casted.\n            const breakAttributes = !node.is('uiElement');\n            if (!lastGroup || lastGroup.breakAttributes != breakAttributes) {\n                groups.push({\n                    breakAttributes,\n                    nodes: [node]\n                });\n            }\n            else {\n                lastGroup.nodes.push(node);\n            }\n            return groups;\n        }, []);\n        // Insert nodes in batches.\n        let start = null;\n        let end = position;\n        for (const { nodes, breakAttributes } of nodeGroups) {\n            const range = this._insertNodes(end, nodes, breakAttributes);\n            if (!start) {\n                start = range.start;\n            }\n            end = range.end;\n        }\n        // When no nodes were inserted - return collapsed range.\n        if (!start) {\n            return new ViewRange(position);\n        }\n        return new ViewRange(start, end);\n    }\n    /**\n     * Removes provided range from the container.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n     * {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}\n     * positions are not placed inside same parent container.\n     *\n     * @param rangeOrItem Range to remove from container\n     * or an {@link module:engine/view/item~ViewItem item} to remove. If range is provided, after removing, it will be updated\n     * to a collapsed range showing the new position.\n     * @returns Document fragment containing removed nodes.\n     */\n    remove(rangeOrItem) {\n        const range = rangeOrItem instanceof ViewRange ? rangeOrItem : ViewRange._createOn(rangeOrItem);\n        validateRangeContainer(range, this.document);\n        // If range is collapsed - nothing to remove.\n        if (range.isCollapsed) {\n            return new ViewDocumentFragment(this.document);\n        }\n        // Break attributes at range start and end.\n        const { start: breakStart, end: breakEnd } = this._breakAttributesRange(range, true);\n        const parentContainer = breakStart.parent;\n        const count = breakEnd.offset - breakStart.offset;\n        // Remove nodes in range.\n        const removed = parentContainer._removeChildren(breakStart.offset, count);\n        for (const node of removed) {\n            this._removeFromClonedElementsGroup(node);\n        }\n        // Merge after removing.\n        const mergePosition = this.mergeAttributes(breakStart);\n        range.start = mergePosition;\n        range.end = mergePosition.clone();\n        // Return removed nodes.\n        return new ViewDocumentFragment(this.document, removed);\n    }\n    /**\n     * Removes matching elements from given range.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n     * {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}\n     * positions are not placed inside same parent container.\n     *\n     * @param range Range to clear.\n     * @param element Element to remove.\n     */\n    clear(range, element) {\n        validateRangeContainer(range, this.document);\n        // Create walker on given range.\n        // We walk backward because when we remove element during walk it modifies range end position.\n        const walker = range.getWalker({\n            direction: 'backward',\n            ignoreElementEnd: true\n        });\n        // Let's walk.\n        for (const current of walker) {\n            const item = current.item;\n            let rangeToRemove;\n            // When current item matches to the given element.\n            if (item.is('element') && element.isSimilar(item)) {\n                // Create range on this element.\n                rangeToRemove = ViewRange._createOn(item);\n                // When range starts inside Text or TextProxy element.\n            }\n            else if (!current.nextPosition.isAfter(range.start) && item.is('$textProxy')) {\n                // We need to check if parent of this text matches to given element.\n                const parentElement = item.getAncestors().find(ancestor => {\n                    return ancestor.is('element') && element.isSimilar(ancestor);\n                });\n                // If it is then create range inside this element.\n                if (parentElement) {\n                    rangeToRemove = ViewRange._createIn(parentElement);\n                }\n            }\n            // If we have found element to remove.\n            if (rangeToRemove) {\n                // We need to check if element range stick out of the given range and truncate if it is.\n                if (rangeToRemove.end.isAfter(range.end)) {\n                    rangeToRemove.end = range.end;\n                }\n                if (rangeToRemove.start.isBefore(range.start)) {\n                    rangeToRemove.start = range.start;\n                }\n                // At the end we remove range with found element.\n                this.remove(rangeToRemove);\n            }\n        }\n    }\n    /**\n     * Moves nodes from provided range to target position.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n     * {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}\n     * positions are not placed inside same parent container.\n     *\n     * @param sourceRange Range containing nodes to move.\n     * @param targetPosition Position to insert.\n     * @returns Range in target container. Inserted nodes are placed between\n     * {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end} positions.\n     */\n    move(sourceRange, targetPosition) {\n        let nodes;\n        if (targetPosition.isAfter(sourceRange.end)) {\n            targetPosition = this._breakAttributes(targetPosition, true);\n            const parent = targetPosition.parent;\n            const countBefore = parent.childCount;\n            sourceRange = this._breakAttributesRange(sourceRange, true);\n            nodes = this.remove(sourceRange);\n            targetPosition.offset += (parent.childCount - countBefore);\n        }\n        else {\n            nodes = this.remove(sourceRange);\n        }\n        return this.insert(targetPosition, nodes);\n    }\n    /**\n     * Wraps elements within range with provided {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.\n     * If a collapsed range is provided, it will be wrapped only if it is equal to view selection.\n     *\n     * If a collapsed range was passed and is same as selection, the selection\n     * will be moved to the inside of the wrapped attribute element.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-invalid-range-container`\n     * when {@link module:engine/view/range~ViewRange#start}\n     * and {@link module:engine/view/range~ViewRange#end} positions are not placed inside same parent container.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not\n     * an instance of {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-nonselection-collapsed-range` when passed range\n     * is collapsed and different than view selection.\n     *\n     * @param range Range to wrap.\n     * @param attribute Attribute element to use as wrapper.\n     * @returns range Range after wrapping, spanning over wrapping attribute element.\n     */\n    wrap(range, attribute) {\n        if (!(attribute instanceof ViewAttributeElement)) {\n            throw new CKEditorError('view-writer-wrap-invalid-attribute', this.document);\n        }\n        validateRangeContainer(range, this.document);\n        if (!range.isCollapsed) {\n            // Non-collapsed range. Wrap it with the attribute element.\n            return this._wrapRange(range, attribute);\n        }\n        else {\n            // Collapsed range. Wrap position.\n            let position = range.start;\n            if (position.parent.is('element') && !_hasNonUiChildren(position.parent)) {\n                position = position.getLastMatchingPosition(value => value.item.is('uiElement'));\n            }\n            position = this._wrapPosition(position, attribute);\n            const viewSelection = this.document.selection;\n            // If wrapping position is equal to view selection, move view selection inside wrapping attribute element.\n            if (viewSelection.isCollapsed && viewSelection.getFirstPosition().isEqual(range.start)) {\n                this.setSelection(position);\n            }\n            return new ViewRange(position);\n        }\n    }\n    /**\n     * Unwraps nodes within provided range from attribute element.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n     * {@link module:engine/view/range~ViewRange#start start} and {@link module:engine/view/range~ViewRange#end end}\n     * positions are not placed inside same parent container.\n     */\n    unwrap(range, attribute) {\n        if (!(attribute instanceof ViewAttributeElement)) {\n            /**\n             * The `attribute` passed to {@link module:engine/view/downcastwriter~ViewDowncastWriter#unwrap `ViewDowncastWriter#unwrap()`}\n             * must be an instance of {@link module:engine/view/attributeelement~ViewAttributeElement `AttributeElement`}.\n             *\n             * @error view-writer-unwrap-invalid-attribute\n             */\n            throw new CKEditorError('view-writer-unwrap-invalid-attribute', this.document);\n        }\n        validateRangeContainer(range, this.document);\n        // If range is collapsed - nothing to unwrap.\n        if (range.isCollapsed) {\n            return range;\n        }\n        // Break attributes at range start and end.\n        const { start: breakStart, end: breakEnd } = this._breakAttributesRange(range, true);\n        const parentContainer = breakStart.parent;\n        // Unwrap children located between break points.\n        const newRange = this._unwrapChildren(parentContainer, breakStart.offset, breakEnd.offset, attribute);\n        // Merge attributes at the both ends and return a new range.\n        const start = this.mergeAttributes(newRange.start);\n        // If start position was merged - move end position back.\n        if (!start.isEqual(newRange.start)) {\n            newRange.end.offset--;\n        }\n        const end = this.mergeAttributes(newRange.end);\n        return new ViewRange(start, end);\n    }\n    /**\n     * Renames element by creating a copy of renamed element but with changed name and then moving contents of the\n     * old element to the new one. Keep in mind that this will invalidate all {@link module:engine/view/position~ViewPosition positions}\n     * which has renamed element as {@link module:engine/view/position~ViewPosition#parent a parent}.\n     *\n     * New element has to be created because `Element#tagName` property in DOM is readonly.\n     *\n     * Since this function creates a new element and removes the given one, the new element is returned to keep reference.\n     *\n     * @param newName New name for element.\n     * @param viewElement Element to be renamed.\n     * @returns Element created due to rename.\n     */\n    rename(newName, viewElement) {\n        const newElement = new ViewContainerElement(this.document, newName, viewElement.getAttributes());\n        this.insert(ViewPosition._createAfter(viewElement), newElement);\n        this.move(ViewRange._createIn(viewElement), ViewPosition._createAt(newElement, 0));\n        this.remove(ViewRange._createOn(viewElement));\n        return newElement;\n    }\n    /**\n     * Cleans up memory by removing obsolete cloned elements group from the writer.\n     *\n     * Should be used whenever all {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}\n     * with the same {@link module:engine/view/attributeelement~ViewAttributeElement#id id} are going to be removed from the view and\n     * the group will no longer be needed.\n     *\n     * Cloned elements group are not removed automatically in case if the group is still needed after all its elements\n     * were removed from the view.\n     *\n     * Keep in mind that group names are equal to the `id` property of the attribute element.\n     *\n     * @param groupName Name of the group to clear.\n     */\n    clearClonedElementsGroup(groupName) {\n        this._cloneGroups.delete(groupName);\n    }\n    /**\n     * Creates position at the given location. The location can be specified as:\n     *\n     * * a {@link module:engine/view/position~ViewPosition position},\n     * * parent element and offset (offset defaults to `0`),\n     * * parent element and `'end'` (sets position at the end of that element),\n     * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).\n     *\n     * This method is a shortcut to other constructors such as:\n     *\n     * * {@link #createPositionBefore},\n     * * {@link #createPositionAfter},\n     *\n     * @param offset Offset or one of the flags. Used only when the first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    createPositionAt(itemOrPosition, offset) {\n        return ViewPosition._createAt(itemOrPosition, offset);\n    }\n    /**\n     * Creates a new position after given view item.\n     *\n     * @param item View item after which the position should be located.\n     */\n    createPositionAfter(item) {\n        return ViewPosition._createAfter(item);\n    }\n    /**\n     * Creates a new position before given view item.\n     *\n     * @param item View item before which the position should be located.\n     */\n    createPositionBefore(item) {\n        return ViewPosition._createBefore(item);\n    }\n    /**\n     * Creates a range spanning from `start` position to `end` position.\n     *\n     * **Note:** This factory method creates its own {@link module:engine/view/position~ViewPosition} instances basing on passed values.\n     *\n     * @param start Start position.\n     * @param end End position. If not set, range will be collapsed at `start` position.\n     */\n    createRange(start, end) {\n        return new ViewRange(start, end);\n    }\n    /**\n     * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.\n     */\n    createRangeOn(item) {\n        return ViewRange._createOn(item);\n    }\n    /**\n     * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * @param element Element which is a parent for the range.\n     */\n    createRangeIn(element) {\n        return ViewRange._createIn(element);\n    }\n    createSelection(...args) {\n        return new ViewSelection(...args);\n    }\n    /**\n     * Creates placeholders for child elements of the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure\n     * `elementToStructure()`} conversion helper.\n     *\n     * ```ts\n     * const viewSlot = conversionApi.writer.createSlot();\n     * const viewPosition = conversionApi.writer.createPositionAt( viewElement, 0 );\n     *\n     * conversionApi.writer.insert( viewPosition, viewSlot );\n     * ```\n     *\n     * It could be filtered down to a specific subset of children (only `<foo>` model elements in this case):\n     *\n     * ```ts\n     * const viewSlot = conversionApi.writer.createSlot( node => node.is( 'element', 'foo' ) );\n     * const viewPosition = conversionApi.writer.createPositionAt( viewElement, 0 );\n     *\n     * conversionApi.writer.insert( viewPosition, viewSlot );\n     * ```\n     *\n     * While providing a filtered slot, make sure to provide slots for all child nodes. A single node cannot be downcasted into\n     * multiple slots.\n     *\n     * **Note**: You should not change the order of nodes. View elements should be in the same order as model nodes.\n     *\n     * @param modeOrFilter The filter for child nodes.\n     * @returns The slot element to be placed in to the view structure while processing\n     * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure `elementToStructure()`}.\n     */\n    createSlot(modeOrFilter = 'children') {\n        if (!this._slotFactory) {\n            /**\n             * The `createSlot()` method is only allowed inside the `elementToStructure` downcast helper callback.\n             *\n             * @error view-writer-invalid-create-slot-context\n             */\n            throw new CKEditorError('view-writer-invalid-create-slot-context', this.document);\n        }\n        return this._slotFactory(this, modeOrFilter);\n    }\n    /**\n     * Registers a slot factory.\n     *\n     * @internal\n     * @param slotFactory The slot factory.\n     */\n    _registerSlotFactory(slotFactory) {\n        this._slotFactory = slotFactory;\n    }\n    /**\n     * Clears the registered slot factory.\n     *\n     * @internal\n     */\n    _clearSlotFactory() {\n        this._slotFactory = null;\n    }\n    /**\n     * Inserts a node or nodes at the specified position. Takes care of breaking attributes before insertion\n     * and merging them afterwards if requested by the breakAttributes param.\n     *\n     * @param position Insertion position.\n     * @param nodes Node or nodes to insert.\n     * @param breakAttributes Whether attributes should be broken.\n     * @returns Range around inserted nodes.\n     */\n    _insertNodes(position, nodes, breakAttributes) {\n        let parentElement;\n        // Break attributes on nodes that do exist in the model tree so they can have attributes, other elements\n        // can't have an attribute in model and won't get wrapped with an ViewAttributeElement while down-casted.\n        if (breakAttributes) {\n            parentElement = getParentContainer(position);\n        }\n        else {\n            parentElement = position.parent.is('$text') ? position.parent.parent : position.parent;\n        }\n        if (!parentElement) {\n            /**\n             * Position's parent container cannot be found.\n             *\n             * @error view-writer-invalid-position-container\n             */\n            throw new CKEditorError('view-writer-invalid-position-container', this.document);\n        }\n        let insertionPosition;\n        if (breakAttributes) {\n            insertionPosition = this._breakAttributes(position, true);\n        }\n        else {\n            insertionPosition = position.parent.is('$text') ? breakTextNode(position) : position;\n        }\n        const length = parentElement._insertChild(insertionPosition.offset, nodes);\n        for (const node of nodes) {\n            this._addToClonedElementsGroup(node);\n        }\n        const endPosition = insertionPosition.getShiftedBy(length);\n        const start = this.mergeAttributes(insertionPosition);\n        // If start position was merged - move end position.\n        if (!start.isEqual(insertionPosition)) {\n            endPosition.offset--;\n        }\n        const end = this.mergeAttributes(endPosition);\n        return new ViewRange(start, end);\n    }\n    /**\n     * Wraps children with provided `wrapElement`. Only children contained in `parent` element between\n     * `startOffset` and `endOffset` will be wrapped.\n     */\n    _wrapChildren(parent, startOffset, endOffset, wrapElement) {\n        let i = startOffset;\n        const wrapPositions = [];\n        while (i < endOffset) {\n            const child = parent.getChild(i);\n            const isText = child.is('$text');\n            const isAttribute = child.is('attributeElement');\n            //\n            // (In all examples, assume that `wrapElement` is `<span class=\"foo\">` element.)\n            //\n            // Check if `wrapElement` can be joined with the wrapped element. One of requirements is having same name.\n            // If possible, join elements.\n            //\n            // <p><span class=\"bar\">abc</span></p>  -->  <p><span class=\"foo bar\">abc</span></p>\n            //\n            if (isAttribute && child._canMergeAttributesFrom(wrapElement)) {\n                child._mergeAttributesFrom(wrapElement);\n                wrapPositions.push(new ViewPosition(parent, i));\n            }\n            //\n            // Wrap the child if it is not an attribute element or if it is an attribute element that should be inside\n            // `wrapElement` (due to priority).\n            //\n            // <p>abc</p>                   -->  <p><span class=\"foo\">abc</span></p>\n            // <p><strong>abc</strong></p>  -->  <p><span class=\"foo\"><strong>abc</strong></span></p>\n            else if (isText || !isAttribute || shouldABeOutsideB(wrapElement, child)) {\n                // Clone attribute.\n                const newAttribute = wrapElement._clone();\n                // Wrap current node with new attribute.\n                child._remove();\n                newAttribute._appendChild(child);\n                parent._insertChild(i, newAttribute);\n                this._addToClonedElementsGroup(newAttribute);\n                wrapPositions.push(new ViewPosition(parent, i));\n            }\n            //\n            // If other nested attribute is found and it wasn't wrapped (see above), continue wrapping inside it.\n            //\n            // <p><a href=\"foo.html\">abc</a></p>  -->  <p><a href=\"foo.html\"><span class=\"foo\">abc</span></a></p>\n            //\n            else /* if ( isAttribute ) */ {\n                this._wrapChildren(child, 0, child.childCount, wrapElement);\n            }\n            i++;\n        }\n        // Merge at each wrap.\n        let offsetChange = 0;\n        for (const position of wrapPositions) {\n            position.offset -= offsetChange;\n            // Do not merge with elements outside selected children.\n            if (position.offset == startOffset) {\n                continue;\n            }\n            const newPosition = this.mergeAttributes(position);\n            // If nodes were merged - other merge offsets will change.\n            if (!newPosition.isEqual(position)) {\n                offsetChange++;\n                endOffset--;\n            }\n        }\n        return ViewRange._createFromParentsAndOffsets(parent, startOffset, parent, endOffset);\n    }\n    /**\n     * Unwraps children from provided `unwrapElement`. Only children contained in `parent` element between\n     * `startOffset` and `endOffset` will be unwrapped.\n     */\n    _unwrapChildren(parent, startOffset, endOffset, unwrapElement) {\n        let i = startOffset;\n        const unwrapPositions = [];\n        // Iterate over each element between provided offsets inside parent.\n        // We don't use tree walker or range iterator because we will be removing and merging potentially multiple nodes,\n        // so it could get messy. It is safer to it manually in this case.\n        while (i < endOffset) {\n            const child = parent.getChild(i);\n            // Skip all text nodes. There should be no container element's here either.\n            if (!child.is('attributeElement')) {\n                i++;\n                continue;\n            }\n            //\n            // (In all examples, assume that `unwrapElement` is `<span class=\"foo\">` element.)\n            //\n            // If the child is similar to the given attribute element, unwrap it - it will be completely removed.\n            //\n            // <p><span class=\"foo\">abc</span>xyz</p>  -->  <p>abcxyz</p>\n            //\n            if (child.isSimilar(unwrapElement)) {\n                const unwrapped = child.getChildren();\n                const count = child.childCount;\n                // Replace wrapper element with its children\n                child._remove();\n                parent._insertChild(i, unwrapped);\n                this._removeFromClonedElementsGroup(child);\n                // Save start and end position of moved items.\n                unwrapPositions.push(new ViewPosition(parent, i), new ViewPosition(parent, i + count));\n                // Skip elements that were unwrapped. Assuming there won't be another element to unwrap in child elements.\n                i += count;\n                endOffset += count - 1;\n                continue;\n            }\n            //\n            // If the child is not similar but is an attribute element, try partial unwrapping - remove the same attributes/styles/classes.\n            // Partial unwrapping will happen only if the elements have the same name.\n            //\n            // <p><span class=\"foo bar\">abc</span>xyz</p>  -->  <p><span class=\"bar\">abc</span>xyz</p>\n            // <p><i class=\"foo\">abc</i>xyz</p>            -->  <p><i class=\"foo\">abc</i>xyz</p>\n            //\n            if (child._canSubtractAttributesOf(unwrapElement)) {\n                child._subtractAttributesOf(unwrapElement);\n                unwrapPositions.push(new ViewPosition(parent, i), new ViewPosition(parent, i + 1));\n                i++;\n                continue;\n            }\n            //\n            // If other nested attribute is found, look through it's children for elements to unwrap.\n            //\n            // <p><i><span class=\"foo\">abc</span></i><p>  -->  <p><i>abc</i><p>\n            //\n            this._unwrapChildren(child, 0, child.childCount, unwrapElement);\n            i++;\n        }\n        // Merge at each unwrap.\n        let offsetChange = 0;\n        for (const position of unwrapPositions) {\n            position.offset -= offsetChange;\n            // Do not merge with elements outside selected children.\n            if (position.offset == startOffset || position.offset == endOffset) {\n                continue;\n            }\n            const newPosition = this.mergeAttributes(position);\n            // If nodes were merged - other merge offsets will change.\n            if (!newPosition.isEqual(position)) {\n                offsetChange++;\n                endOffset--;\n            }\n        }\n        return ViewRange._createFromParentsAndOffsets(parent, startOffset, parent, endOffset);\n    }\n    /**\n     * Helper function for `view.writer.wrap`. Wraps range with provided attribute element.\n     * This method will also merge newly added attribute element with its siblings whenever possible.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not\n     * an instance of {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.\n     *\n     * @returns New range after wrapping, spanning over wrapping attribute element.\n     */\n    _wrapRange(range, attribute) {\n        // Break attributes at range start and end.\n        const { start: breakStart, end: breakEnd } = this._breakAttributesRange(range, true);\n        const parentContainer = breakStart.parent;\n        // Wrap all children with attribute.\n        const newRange = this._wrapChildren(parentContainer, breakStart.offset, breakEnd.offset, attribute);\n        // Merge attributes at the both ends and return a new range.\n        const start = this.mergeAttributes(newRange.start);\n        // If start position was merged - move end position back.\n        if (!start.isEqual(newRange.start)) {\n            newRange.end.offset--;\n        }\n        const end = this.mergeAttributes(newRange.end);\n        return new ViewRange(start, end);\n    }\n    /**\n     * Helper function for {@link #wrap}. Wraps position with provided attribute element.\n     * This method will also merge newly added attribute element with its siblings whenever possible.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not\n     * an instance of {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement}.\n     *\n     * @returns New position after wrapping.\n     */\n    _wrapPosition(position, attribute) {\n        // Return same position when trying to wrap with attribute similar to position parent.\n        if (attribute.isSimilar(position.parent)) {\n            return movePositionToTextNode(position.clone());\n        }\n        // When position is inside text node - break it and place new position between two text nodes.\n        if (position.parent.is('$text')) {\n            position = breakTextNode(position);\n        }\n        // Create fake element that will represent position, and will not be merged with other attributes.\n        const fakeElement = this.createAttributeElement('_wrapPosition-fake-element');\n        fakeElement._priority = Number.POSITIVE_INFINITY;\n        fakeElement.isSimilar = () => false;\n        // Insert fake element in position location.\n        position.parent._insertChild(position.offset, fakeElement);\n        // Range around inserted fake attribute element.\n        const wrapRange = new ViewRange(position, position.getShiftedBy(1));\n        // Wrap fake element with attribute (it will also merge if possible).\n        this.wrap(wrapRange, attribute);\n        // Remove fake element and place new position there.\n        const newPosition = new ViewPosition(fakeElement.parent, fakeElement.index);\n        fakeElement._remove();\n        // If position is placed between text nodes - merge them and return position inside.\n        const nodeBefore = newPosition.nodeBefore;\n        const nodeAfter = newPosition.nodeAfter;\n        if (nodeBefore && nodeBefore.is('view:$text') && nodeAfter && nodeAfter.is('view:$text')) {\n            return mergeTextNodes(nodeBefore, nodeAfter);\n        }\n        // If position is next to text node - move position inside.\n        return movePositionToTextNode(newPosition);\n    }\n    /**\n     * Helper function used by other `ViewDowncastWriter` methods. Breaks attribute elements at the boundaries of given range.\n     *\n     * @param range Range which `start` and `end` positions will be used to break attributes.\n     * @param forceSplitText If set to `true`, will break text nodes even if they are directly in container element.\n     * This behavior will result in incorrect view state, but is needed by other view writing methods which then fixes view state.\n     * @returns New range with located at break positions.\n     */\n    _breakAttributesRange(range, forceSplitText = false) {\n        const rangeStart = range.start;\n        const rangeEnd = range.end;\n        validateRangeContainer(range, this.document);\n        // Break at the collapsed position. Return new collapsed range.\n        if (range.isCollapsed) {\n            const position = this._breakAttributes(range.start, forceSplitText);\n            return new ViewRange(position, position);\n        }\n        const breakEnd = this._breakAttributes(rangeEnd, forceSplitText);\n        const count = breakEnd.parent.childCount;\n        const breakStart = this._breakAttributes(rangeStart, forceSplitText);\n        // Calculate new break end offset.\n        breakEnd.offset += breakEnd.parent.childCount - count;\n        return new ViewRange(breakStart, breakEnd);\n    }\n    /**\n     * Helper function used by other `ViewDowncastWriter` methods. Breaks attribute elements at given position.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-empty-element` when break position\n     * is placed inside {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElement}.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-ui-element` when break position\n     * is placed inside {@link module:engine/view/uielement~ViewUIElement UIElement}.\n     *\n     * @param position Position where to break attributes.\n     * @param forceSplitText If set to `true`, will break text nodes even if they are directly in container element.\n     * This behavior will result in incorrect view state, but is needed by other view writing methods which then fixes view state.\n     * @returns New position after breaking the attributes.\n     */\n    _breakAttributes(position, forceSplitText = false) {\n        const positionOffset = position.offset;\n        const positionParent = position.parent;\n        // If position is placed inside ViewEmptyElement - throw an exception as we cannot break inside.\n        if (position.parent.is('emptyElement')) {\n            /**\n             * Cannot break an `EmptyElement` instance.\n             *\n             * This error is thrown if\n             * {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes `ViewDowncastWriter#breakAttributes()`}\n             * was executed in an incorrect position.\n             *\n             * @error view-writer-cannot-break-empty-element\n             */\n            throw new CKEditorError('view-writer-cannot-break-empty-element', this.document);\n        }\n        // If position is placed inside UIElement - throw an exception as we cannot break inside.\n        if (position.parent.is('uiElement')) {\n            /**\n             * Cannot break a `UIElement` instance.\n             *\n             * This error is thrown if\n             * {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes `ViewDowncastWriter#breakAttributes()`}\n             * was executed in an incorrect position.\n             *\n             * @error view-writer-cannot-break-ui-element\n             */\n            throw new CKEditorError('view-writer-cannot-break-ui-element', this.document);\n        }\n        // If position is placed inside RawElement - throw an exception as we cannot break inside.\n        if (position.parent.is('rawElement')) {\n            /**\n             * Cannot break a `RawElement` instance.\n             *\n             * This error is thrown if\n             * {@link module:engine/view/downcastwriter~ViewDowncastWriter#breakAttributes `ViewDowncastWriter#breakAttributes()`}\n             * was executed in an incorrect position.\n             *\n             * @error view-writer-cannot-break-raw-element\n             */\n            throw new CKEditorError('view-writer-cannot-break-raw-element', this.document);\n        }\n        // There are no attributes to break and text nodes breaking is not forced.\n        if (!forceSplitText && positionParent.is('$text') && isContainerOrFragment(positionParent.parent)) {\n            return position.clone();\n        }\n        // Position's parent is container, so no attributes to break.\n        if (isContainerOrFragment(positionParent)) {\n            return position.clone();\n        }\n        // Break text and start again in new position.\n        if (positionParent.is('$text')) {\n            return this._breakAttributes(breakTextNode(position), forceSplitText);\n        }\n        const length = positionParent.childCount;\n        // <p>foo<b><u>bar{}</u></b></p>\n        // <p>foo<b><u>bar</u>[]</b></p>\n        // <p>foo<b><u>bar</u></b>[]</p>\n        if (positionOffset == length) {\n            const newPosition = new ViewPosition(positionParent.parent, positionParent.index + 1);\n            return this._breakAttributes(newPosition, forceSplitText);\n        }\n        else {\n            // <p>foo<b><u>{}bar</u></b></p>\n            // <p>foo<b>[]<u>bar</u></b></p>\n            // <p>foo{}<b><u>bar</u></b></p>\n            if (positionOffset === 0) {\n                const newPosition = new ViewPosition(positionParent.parent, positionParent.index);\n                return this._breakAttributes(newPosition, forceSplitText);\n            }\n            // <p>foo<b><u>b{}ar</u></b></p>\n            // <p>foo<b><u>b[]ar</u></b></p>\n            // <p>foo<b><u>b</u>[]<u>ar</u></b></p>\n            // <p>foo<b><u>b</u></b>[]<b><u>ar</u></b></p>\n            else {\n                const offsetAfter = positionParent.index + 1;\n                // Break element.\n                const clonedNode = positionParent._clone();\n                // Insert cloned node to position's parent node.\n                positionParent.parent._insertChild(offsetAfter, clonedNode);\n                this._addToClonedElementsGroup(clonedNode);\n                // Get nodes to move.\n                const count = positionParent.childCount - positionOffset;\n                const nodesToMove = positionParent._removeChildren(positionOffset, count);\n                // Move nodes to cloned node.\n                clonedNode._appendChild(nodesToMove);\n                // Create new position to work on.\n                const newPosition = new ViewPosition(positionParent.parent, offsetAfter);\n                return this._breakAttributes(newPosition, forceSplitText);\n            }\n        }\n    }\n    /**\n     * Stores the information that an {@link module:engine/view/attributeelement~ViewAttributeElement attribute element} was\n     * added to the tree. Saves the reference to the group in the given element and updates the group, so other elements\n     * from the group now keep a reference to the given attribute element.\n     *\n     * The clones group can be obtained using {@link module:engine/view/attributeelement~ViewAttributeElement#getElementsWithSameId}.\n     *\n     * Does nothing if added element has no {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.\n     *\n     * @param element Attribute element to save.\n     */\n    _addToClonedElementsGroup(element) {\n        // Add only if the element is in document tree.\n        if (!element.root.is('rootElement')) {\n            return;\n        }\n        // Traverse the element's children recursively to find other attribute elements that also might got inserted.\n        // The loop is at the beginning so we can make fast returns later in the code.\n        if (element.is('element')) {\n            for (const child of element.getChildren()) {\n                this._addToClonedElementsGroup(child);\n            }\n        }\n        const id = element.id;\n        if (!id) {\n            return;\n        }\n        let group = this._cloneGroups.get(id);\n        if (!group) {\n            group = new Set();\n            this._cloneGroups.set(id, group);\n        }\n        group.add(element);\n        element._clonesGroup = group;\n    }\n    /**\n     * Removes all the information about the given {@link module:engine/view/attributeelement~ViewAttributeElement attribute element}\n     * from its clones group.\n     *\n     * Keep in mind, that the element will still keep a reference to the group (but the group will not keep a reference to it).\n     * This allows to reference the whole group even if the element was already removed from the tree.\n     *\n     * Does nothing if the element has no {@link module:engine/view/attributeelement~ViewAttributeElement#id id}.\n     *\n     * @param element Attribute element to remove.\n     */\n    _removeFromClonedElementsGroup(element) {\n        // Traverse the element's children recursively to find other attribute elements that also got removed.\n        // The loop is at the beginning so we can make fast returns later in the code.\n        if (element.is('element')) {\n            for (const child of element.getChildren()) {\n                this._removeFromClonedElementsGroup(child);\n            }\n        }\n        const id = element.id;\n        if (!id) {\n            return;\n        }\n        const group = this._cloneGroups.get(id);\n        if (!group) {\n            return;\n        }\n        group.delete(element);\n        // Not removing group from element on purpose!\n        // If other parts of code have reference to this element, they will be able to get references to other elements from the group.\n    }\n}\n// Helper function for `view.writer.wrap`. Checks if given element has any children that are not ui elements.\nfunction _hasNonUiChildren(parent) {\n    return Array.from(parent.getChildren()).some(child => !child.is('uiElement'));\n}\n/**\n * The `attribute` passed to {@link module:engine/view/downcastwriter~ViewDowncastWriter#wrap `ViewDowncastWriter#wrap()`}\n * must be an instance of {@link module:engine/view/attributeelement~ViewAttributeElement `AttributeElement`}.\n *\n * @error view-writer-wrap-invalid-attribute\n */\n/**\n * Returns first parent container of specified {@link module:engine/view/position~ViewPosition Position}.\n * Position's parent node is checked as first, then next parents are checked.\n * Note that {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment} is treated like a container.\n *\n * @param position Position used as a start point to locate parent container.\n * @returns Parent container element or `undefined` if container is not found.\n */\nfunction getParentContainer(position) {\n    let parent = position.parent;\n    while (!isContainerOrFragment(parent)) {\n        if (!parent) {\n            return undefined;\n        }\n        parent = parent.parent;\n    }\n    return parent;\n}\n/**\n * Checks if first {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement} provided to the function\n * can be wrapped outside second element. It is done by comparing elements'\n * {@link module:engine/view/attributeelement~ViewAttributeElement#priority priorities}, if both have same priority\n * {@link module:engine/view/element~ViewElement#getIdentity identities} are compared.\n */\nfunction shouldABeOutsideB(a, b) {\n    if (a.priority < b.priority) {\n        return true;\n    }\n    else if (a.priority > b.priority) {\n        return false;\n    }\n    // When priorities are equal and names are different - use identities.\n    return a.getIdentity() < b.getIdentity();\n}\n/**\n * Returns new position that is moved to near text node. Returns same position if there is no text node before of after\n * specified position.\n *\n * ```html\n * <p>foo[]</p>  ->  <p>foo{}</p>\n * <p>[]foo</p>  ->  <p>{}foo</p>\n * ```\n *\n * @returns Position located inside text node or same position if there is no text nodes\n * before or after position location.\n */\nfunction movePositionToTextNode(position) {\n    const nodeBefore = position.nodeBefore;\n    if (nodeBefore && nodeBefore.is('$text')) {\n        return new ViewPosition(nodeBefore, nodeBefore.data.length);\n    }\n    const nodeAfter = position.nodeAfter;\n    if (nodeAfter && nodeAfter.is('$text')) {\n        return new ViewPosition(nodeAfter, 0);\n    }\n    return position;\n}\n/**\n * Breaks text node into two text nodes when possible.\n *\n * ```html\n * <p>foo{}bar</p> -> <p>foo[]bar</p>\n * <p>{}foobar</p> -> <p>[]foobar</p>\n * <p>foobar{}</p> -> <p>foobar[]</p>\n * ```\n *\n * @param position Position that need to be placed inside text node.\n * @returns New position after breaking text node.\n */\nfunction breakTextNode(position) {\n    if (position.offset == position.parent.data.length) {\n        return new ViewPosition(position.parent.parent, position.parent.index + 1);\n    }\n    if (position.offset === 0) {\n        return new ViewPosition(position.parent.parent, position.parent.index);\n    }\n    // Get part of the text that need to be moved.\n    const textToMove = position.parent.data.slice(position.offset);\n    // Leave rest of the text in position's parent.\n    position.parent._data = position.parent.data.slice(0, position.offset);\n    // Insert new text node after position's parent text node.\n    position.parent.parent._insertChild(position.parent.index + 1, new ViewText(position.root.document, textToMove));\n    // Return new position between two newly created text nodes.\n    return new ViewPosition(position.parent.parent, position.parent.index + 1);\n}\n/**\n * Merges two text nodes into first node. Removes second node and returns merge position.\n *\n * @param t1 First text node to merge. Data from second text node will be moved at the end of this text node.\n * @param t2 Second text node to merge. This node will be removed after merging.\n * @returns Position after merging text nodes.\n */\nfunction mergeTextNodes(t1, t2) {\n    // Merge text data into first text node and remove second one.\n    const nodeBeforeLength = t1.data.length;\n    t1._data += t2.data;\n    t2._remove();\n    return new ViewPosition(t1, nodeBeforeLength);\n}\nconst validNodesToInsert = [ViewText, ViewAttributeElement, ViewContainerElement, ViewEmptyElement, ViewRawElement, ViewUIElement];\n/**\n * Checks if provided nodes are valid to insert.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-insert-invalid-node` when nodes to insert\n * contains instances that are not supported ones (see error description for valid ones.\n */\nfunction validateNodesToInsert(nodes, errorContext) {\n    for (const node of nodes) {\n        if (!validNodesToInsert.some(validNode => node instanceof validNode)) {\n            /**\n             * One of the nodes to be inserted is of an invalid type.\n             *\n             * Nodes to be inserted with {@link module:engine/view/downcastwriter~ViewDowncastWriter#insert `ViewDowncastWriter#insert()`}\n             * should be of the following types:\n             *\n             * * {@link module:engine/view/attributeelement~ViewAttributeElement ViewAttributeElement},\n             * * {@link module:engine/view/containerelement~ViewContainerElement ViewContainerElement},\n             * * {@link module:engine/view/emptyelement~ViewEmptyElement ViewEmptyElement},\n             * * {@link module:engine/view/uielement~ViewUIElement UIElement},\n             * * {@link module:engine/view/rawelement~ViewRawElement RawElement},\n             * * {@link module:engine/view/text~ViewText Text}.\n             *\n             * @error view-writer-insert-invalid-node-type\n             */\n            throw new CKEditorError('view-writer-insert-invalid-node-type', errorContext);\n        }\n        if (!node.is('$text')) {\n            validateNodesToInsert(node.getChildren(), errorContext);\n        }\n    }\n}\n/**\n * Checks if node is ViewContainerElement or DocumentFragment, because in most cases they should be treated the same way.\n *\n * @returns Returns `true` if node is instance of ViewContainerElement or DocumentFragment.\n */\nfunction isContainerOrFragment(node) {\n    return node && (node.is('containerElement') || node.is('documentFragment'));\n}\n/**\n * Checks if {@link module:engine/view/range~ViewRange#start range start} and {@link module:engine/view/range~ViewRange#end range end}\n * are placed inside same {@link module:engine/view/containerelement~ViewContainerElement container element}.\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when validation fails.\n */\nfunction validateRangeContainer(range, errorContext) {\n    const startContainer = getParentContainer(range.start);\n    const endContainer = getParentContainer(range.end);\n    if (!startContainer || !endContainer || startContainer !== endContainer) {\n        /**\n         * The container of the given range is invalid.\n         *\n         * This may happen if {@link module:engine/view/range~ViewRange#start range start} and\n         * {@link module:engine/view/range~ViewRange#end range end} positions are not placed inside the same container element or\n         * a parent container for these positions cannot be found.\n         *\n         * Methods like {@link module:engine/view/downcastwriter~ViewDowncastWriter#wrap `ViewDowncastWriter#remove()`},\n         * {@link module:engine/view/downcastwriter~ViewDowncastWriter#wrap `ViewDowncastWriter#clean()`},\n         * {@link module:engine/view/downcastwriter~ViewDowncastWriter#wrap `ViewDowncastWriter#wrap()`},\n         * {@link module:engine/view/downcastwriter~ViewDowncastWriter#wrap `ViewDowncastWriter#unwrap()`} need to be called\n         * on a range that has its start and end positions located in the same container element. Both positions can be\n         * nested within other elements (e.g. an attribute element) but the closest container ancestor must be the same.\n         *\n         * @error view-writer-invalid-range-container\n         */\n        throw new CKEditorError('view-writer-invalid-range-container', errorContext);\n    }\n}\n/**\n * Checks if the provided argument is a plain object that can be used as options for container element.\n */\nfunction isContainerOptions(childrenOrOptions) {\n    return isPlainObject(childrenOrOptions);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { keyCodes, isText } from '@ckeditor/ckeditor5-utils';\n/**\n * Set of utilities related to handling block and inline fillers.\n *\n * Browsers do not allow to put caret in elements which does not have height. Because of it, we need to fill all\n * empty elements which should be selectable with elements or characters called \"fillers\". Unfortunately there is no one\n * universal filler, this is why two types are uses:\n *\n * * Block filler is an element which fill block elements, like `<p>`. CKEditor uses `<br>` as a block filler during the editing,\n * as browsers do natively. So instead of an empty `<p>` there will be `<p><br></p>`. The advantage of block filler is that\n * it is transparent for the selection, so when the caret is before the `<br>` and user presses right arrow he will be\n * moved to the next paragraph, not after the `<br>`. The disadvantage is that it breaks a block, so it cannot be used\n * in the middle of a line of text. The {@link module:engine/view/filler~BR_FILLER `<br>` filler} can be replaced with any other\n * character in the data output, for instance {@link module:engine/view/filler~NBSP_FILLER non-breaking space} or\n * {@link module:engine/view/filler~MARKED_NBSP_FILLER marked non-breaking space}.\n *\n * * Inline filler is a filler which does not break a line of text, so it can be used inside the text, for instance in the empty\n * `<b>` surrendered by text: `foo<b></b>bar`, if we want to put the caret there. CKEditor uses a sequence of the zero-width\n * spaces as an {@link module:engine/view/filler~INLINE_FILLER inline filler} having the predetermined\n * {@link module:engine/view/filler~INLINE_FILLER_LENGTH length}. A sequence is used, instead of a single character to\n * avoid treating random zero-width spaces as the inline filler. Disadvantage of the inline filler is that it is not\n * transparent for the selection. The arrow key moves the caret between zero-width spaces characters, so the additional\n * code is needed to handle the caret.\n *\n * Both inline and block fillers are handled by the {@link module:engine/view/renderer~ViewRenderer renderer} and are not present in the\n * view.\n *\n * @module engine/view/filler\n */\n/**\n * Non-breaking space filler creator. This function creates the `&nbsp;` text node.\n * It defines how the filler is created.\n *\n * @see module:engine/view/filler~MARKED_NBSP_FILLER\n * @see module:engine/view/filler~BR_FILLER\n * @internal\n */\nexport const NBSP_FILLER = (domDocument) => domDocument.createTextNode('\\u00A0');\n/**\n * Marked non-breaking space filler creator. This function creates the `<span data-cke-filler=\"true\">&nbsp;</span>` element.\n * It defines how the filler is created.\n *\n * @see module:engine/view/filler~NBSP_FILLER\n * @see module:engine/view/filler~BR_FILLER\n * @internal\n */\nexport const MARKED_NBSP_FILLER = (domDocument) => {\n    const span = domDocument.createElement('span');\n    span.dataset.ckeFiller = 'true';\n    span.innerText = '\\u00A0';\n    return span;\n};\n/**\n * `<br>` filler creator. This function creates the `<br data-cke-filler=\"true\">` element.\n * It defines how the filler is created.\n *\n * @see module:engine/view/filler~NBSP_FILLER\n * @see module:engine/view/filler~MARKED_NBSP_FILLER\n * @internal\n */\nexport const BR_FILLER = (domDocument) => {\n    const fillerBr = domDocument.createElement('br');\n    fillerBr.dataset.ckeFiller = 'true';\n    return fillerBr;\n};\n/**\n * Length of the {@link module:engine/view/filler~INLINE_FILLER INLINE_FILLER}.\n *\n * @internal\n */\nexport const INLINE_FILLER_LENGTH = 7;\n/**\n * Inline filler which is a sequence of the word joiners.\n *\n * @internal\n */\nexport const INLINE_FILLER = '\\u2060'.repeat(INLINE_FILLER_LENGTH);\n/**\n * Checks if the node is a text node which starts with the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n *\n * ```ts\n * startsWithFiller( document.createTextNode( INLINE_FILLER ) ); // true\n * startsWithFiller( document.createTextNode( INLINE_FILLER + 'foo' ) ); // true\n * startsWithFiller( document.createTextNode( 'foo' ) ); // false\n * startsWithFiller( document.createElement( 'p' ) ); // false\n * ```\n *\n * @param domNode DOM node.\n * @returns True if the text node starts with the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n * @internal\n */\nexport function startsWithFiller(domNode) {\n    if (typeof domNode == 'string') {\n        return domNode.substr(0, INLINE_FILLER_LENGTH) === INLINE_FILLER;\n    }\n    return isText(domNode) && (domNode.data.substr(0, INLINE_FILLER_LENGTH) === INLINE_FILLER);\n}\n/**\n * Checks if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n *\n * ```ts\n * isInlineFiller( document.createTextNode( INLINE_FILLER ) ); // true\n * isInlineFiller( document.createTextNode( INLINE_FILLER + 'foo' ) ); // false\n * ```\n *\n * @param domText DOM text node.\n * @returns True if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n * @internal\n */\nexport function isInlineFiller(domText) {\n    return domText.data.length == INLINE_FILLER_LENGTH && startsWithFiller(domText);\n}\n/**\n * Get string data from the text node, removing an {@link module:engine/view/filler~INLINE_FILLER inline filler} from it,\n * if text node contains it.\n *\n * ```ts\n * getDataWithoutFiller( document.createTextNode( INLINE_FILLER + 'foo' ) ) == 'foo' // true\n * getDataWithoutFiller( document.createTextNode( 'foo' ) ) == 'foo' // true\n * ```\n *\n * @param domText DOM text node, possible with inline filler.\n * @returns Data without filler.\n * @internal\n */\nexport function getDataWithoutFiller(domText) {\n    const data = typeof domText == 'string' ? domText : domText.data;\n    if (startsWithFiller(domText)) {\n        return data.slice(INLINE_FILLER_LENGTH);\n    }\n    return data;\n}\n/**\n * Assign key observer which move cursor from the end of the inline filler to the beginning of it when\n * the left arrow is pressed, so the filler does not break navigation.\n *\n * @param view View controller instance we should inject quirks handling on.\n * @internal\n */\nexport function injectQuirksHandling(view) {\n    view.document.on('arrowKey', jumpOverInlineFiller, { priority: 'low' });\n}\n/**\n * Move cursor from the end of the inline filler to the beginning of it when, so the filler does not break navigation.\n */\nfunction jumpOverInlineFiller(evt, data) {\n    if (data.keyCode == keyCodes.arrowleft) {\n        const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();\n        if (domSelection.rangeCount == 1 && domSelection.getRangeAt(0).collapsed) {\n            const domParent = domSelection.getRangeAt(0).startContainer;\n            const domOffset = domSelection.getRangeAt(0).startOffset;\n            if (startsWithFiller(domParent) && domOffset <= INLINE_FILLER_LENGTH) {\n                domSelection.collapse(domParent, 0);\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/renderer\n */\nimport { ViewText } from './text.js';\nimport { ViewPosition } from './position.js';\nimport { INLINE_FILLER, INLINE_FILLER_LENGTH, startsWithFiller, isInlineFiller } from './filler.js';\nimport { CKEditorError, ObservableMixin, diff, env, fastDiff, insertAt, isComment, isNode, isText, remove, indexOf } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_TYPING // const { _buildLogMessage } = require( '../dev-utils/utils.js' );\nimport '../../theme/renderer.css';\n/**\n * Renderer is responsible for updating the DOM structure and the DOM selection based on\n * the {@link module:engine/view/renderer~ViewRenderer#markToSync information about updated view nodes}.\n * In other words, it renders the view to the DOM.\n *\n * Its main responsibility is to make only the necessary, minimal changes to the DOM. However, unlike in many\n * virtual DOM implementations, the primary reason for doing minimal changes is not the performance but ensuring\n * that native editing features such as text composition, autocompletion, spell checking, selection's x-index are\n * affected as little as possible.\n *\n * Renderer uses {@link module:engine/view/domconverter~ViewDomConverter} to transform view nodes and positions\n * to and from the DOM.\n */\nexport class ViewRenderer extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Set of DOM Documents instances.\n     */\n    domDocuments = new Set();\n    /**\n     * Converter instance.\n     */\n    domConverter;\n    /**\n     * Set of nodes which attributes changed and may need to be rendered.\n     */\n    markedAttributes = new Set();\n    /**\n     * Set of elements which child lists changed and may need to be rendered.\n     */\n    markedChildren = new Set();\n    /**\n     * Set of text nodes which text data changed and may need to be rendered.\n     */\n    markedTexts = new Set();\n    /**\n     * View selection. Renderer updates DOM selection based on the view selection.\n     */\n    selection;\n    /**\n     * The text node in which the inline filler was rendered.\n     */\n    _inlineFiller = null;\n    /**\n     * DOM element containing fake selection.\n     */\n    _fakeSelectionContainer = null;\n    /**\n     * Creates a renderer instance.\n     *\n     * @param domConverter Converter instance.\n     * @param selection View selection.\n     */\n    constructor(domConverter, selection) {\n        super();\n        this.domConverter = domConverter;\n        this.selection = selection;\n        this.set('isFocused', false);\n        this.set('isSelecting', false);\n        this.set('isComposing', false);\n        // Rendering the selection and inline filler manipulation should be postponed in (non-Android) Blink until the user finishes\n        // creating the selection in DOM to avoid accidental selection collapsing\n        // (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).\n        // When the user stops selecting, all pending changes should be rendered ASAP, though.\n        if (env.isBlink && !env.isAndroid) {\n            this.on('change:isSelecting', () => {\n                if (!this.isSelecting) {\n                    this.render();\n                }\n            });\n        }\n    }\n    /**\n     * Marks a view node to be updated in the DOM by {@link #render `render()`}.\n     *\n     * Note that only view nodes whose parents have corresponding DOM elements need to be marked to be synchronized.\n     *\n     * @see #markedAttributes\n     * @see #markedChildren\n     * @see #markedTexts\n     *\n     * @param type Type of the change.\n     * @param node ViewNode to be marked.\n     */\n    markToSync(type, node) {\n        if (type === 'text') {\n            if (this.domConverter.mapViewToDom(node.parent)) {\n                this.markedTexts.add(node);\n            }\n        }\n        else {\n            // If the node has no DOM element it is not rendered yet,\n            // its children/attributes do not need to be marked to be sync.\n            if (!this.domConverter.mapViewToDom(node)) {\n                return;\n            }\n            if (type === 'attributes') {\n                this.markedAttributes.add(node);\n            }\n            else if (type === 'children') {\n                this.markedChildren.add(node);\n            }\n            else {\n                // eslint-disable-next-line @typescript-eslint/no-unused-vars\n                const unreachable = type;\n                /**\n                 * Unknown type passed to Renderer.markToSync.\n                 *\n                 * @error view-renderer-unknown-type\n                 */\n                throw new CKEditorError('view-renderer-unknown-type', this);\n            }\n        }\n    }\n    /**\n     * Renders all buffered changes ({@link #markedAttributes}, {@link #markedChildren} and {@link #markedTexts}) and\n     * the current view selection (if needed) to the DOM by applying a minimal set of changes to it.\n     *\n     * Renderer tries not to break the text composition (e.g. IME) and x-index of the selection,\n     * so it does as little as it is needed to update the DOM.\n     *\n     * Renderer also handles {@link module:engine/view/filler fillers}. Especially, it checks if the inline filler is needed\n     * at the selection position and adds or removes it. To prevent breaking text composition inline filler will not be\n     * removed as long as the selection is in the text node which needed it at first.\n     */\n    render() {\n        // Ignore rendering while in the composition mode. Composition events are not cancellable and browser will modify the DOM tree.\n        // All marked elements, attributes, etc. will wait until next render after the composition ends.\n        // On Android composition events are immediately applied to the model, so we don't need to skip rendering,\n        // and we should not do it because the difference between view and DOM could lead to position mapping problems.\n        if (this.isComposing && !env.isAndroid) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'%cRendering aborted while isComposing.',\n            // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'%cRendering',\n        // @if CK_DEBUG_TYPING // \t\t'font-weight: bold'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        let inlineFillerPosition = null;\n        const isInlineFillerRenderingPossible = env.isBlink && !env.isAndroid ? !this.isSelecting : true;\n        // Refresh mappings.\n        for (const element of this.markedChildren) {\n            this._updateChildrenMappings(element);\n        }\n        // Don't manipulate inline fillers while the selection is being made in (non-Android) Blink to prevent accidental\n        // DOM selection collapsing\n        // (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).\n        if (isInlineFillerRenderingPossible) {\n            // There was inline filler rendered in the DOM but it's not\n            // at the selection position any more, so we can remove it\n            // (cause even if it's needed, it must be placed in another location).\n            if (this._inlineFiller && !this._isSelectionInInlineFiller()) {\n                this._removeInlineFiller();\n            }\n            // If we've got the filler, let's try to guess its position in the view.\n            if (this._inlineFiller) {\n                inlineFillerPosition = this._getInlineFillerPosition();\n            }\n            // Otherwise, if it's needed, create it at the selection position.\n            else if (this._needsInlineFillerAtSelection()) {\n                inlineFillerPosition = this.selection.getFirstPosition();\n                // Do not use `markToSync` so it will be added even if the parent is already added.\n                this.markedChildren.add(inlineFillerPosition.parent);\n            }\n        }\n        // Make sure the inline filler has any parent, so it can be mapped to view position by ViewDomConverter.\n        else if (this._inlineFiller && this._inlineFiller.parentNode) {\n            // While the user is making selection, preserve the inline filler at its original position.\n            inlineFillerPosition = this.domConverter.domPositionToView(this._inlineFiller);\n            // While down-casting the document selection attributes, all existing empty\n            // attribute elements (for selection position) are removed from the view and DOM,\n            // so make sure that we were able to map filler position.\n            // https://github.com/ckeditor/ckeditor5/issues/12026\n            if (inlineFillerPosition && inlineFillerPosition.parent.is('$text')) {\n                // The inline filler position is expected to be before the text node.\n                inlineFillerPosition = ViewPosition._createBefore(inlineFillerPosition.parent);\n            }\n        }\n        for (const element of this.markedAttributes) {\n            this._updateAttrs(element);\n        }\n        for (const element of this.markedChildren) {\n            this._updateChildren(element, { inlineFillerPosition });\n        }\n        for (const node of this.markedTexts) {\n            if (!this.markedChildren.has(node.parent) && this.domConverter.mapViewToDom(node.parent)) {\n                this._updateText(node, { inlineFillerPosition });\n            }\n        }\n        // * Check whether the inline filler is required and where it really is in the DOM.\n        //   At this point in most cases it will be in the DOM, but there are exceptions.\n        //   For example, if the inline filler was deep in the created DOM structure, it will not be created.\n        //   Similarly, if it was removed at the beginning of this function and then neither text nor children were updated,\n        //   it will not be present. Fix those and similar scenarios.\n        // * Don't manipulate inline fillers while the selection is being made in (non-Android) Blink to prevent accidental\n        //   DOM selection collapsing\n        //   (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).\n        if (isInlineFillerRenderingPossible) {\n            if (inlineFillerPosition) {\n                const fillerDomPosition = this.domConverter.viewPositionToDom(inlineFillerPosition);\n                const domDocument = fillerDomPosition.parent.ownerDocument;\n                if (!startsWithFiller(fillerDomPosition.parent)) {\n                    // Filler has not been created at filler position. Create it now.\n                    this._inlineFiller = addInlineFiller(domDocument, fillerDomPosition.parent, fillerDomPosition.offset);\n                }\n                else {\n                    // Filler has been found, save it.\n                    this._inlineFiller = fillerDomPosition.parent;\n                }\n            }\n            else {\n                // There is no filler needed.\n                this._inlineFiller = null;\n            }\n        }\n        // First focus the new editing host, then update the selection.\n        // Otherwise, FF may throw an error (https://github.com/ckeditor/ckeditor5/issues/721).\n        this._updateFocus();\n        this._updateSelection();\n        this.domConverter._clearTemporaryCustomProperties();\n        this.markedTexts.clear();\n        this.markedAttributes.clear();\n        this.markedChildren.clear();\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n    /**\n     * Updates mappings of view element's children.\n     *\n     * Children that were replaced in the view structure by similar elements (same tag name) are treated as 'replaced'.\n     * This means that their mappings can be updated so the new view elements are mapped to the existing DOM elements.\n     * Thanks to that these elements do not need to be re-rendered completely.\n     *\n     * @param viewElement The view element whose children mappings will be updated.\n     */\n    _updateChildrenMappings(viewElement) {\n        const domElement = this.domConverter.mapViewToDom(viewElement);\n        if (!domElement) {\n            // If there is no `domElement` it means that it was already removed from DOM and there is no need to process it.\n            return;\n        }\n        // Removing nodes from the DOM as we iterate can cause `actualDomChildren`\n        // (which is a live-updating `NodeList`) to get out of sync with the\n        // indices that we compute as we iterate over `actions`.\n        // This would produce incorrect element mappings.\n        //\n        // Converting live list to an array to make the list static.\n        const actualDomChildren = Array.from(domElement.childNodes);\n        const expectedDomChildren = Array.from(this.domConverter.viewChildrenToDom(viewElement, { withChildren: false }));\n        const diff = this._diffNodeLists(actualDomChildren, expectedDomChildren);\n        const actions = this._findUpdateActions(diff, actualDomChildren, expectedDomChildren, areSimilarElements);\n        if (actions.indexOf('update') !== -1) {\n            const counter = { equal: 0, insert: 0, delete: 0 };\n            for (const action of actions) {\n                if (action === 'update') {\n                    const insertIndex = counter.equal + counter.insert;\n                    const deleteIndex = counter.equal + counter.delete;\n                    const viewChild = viewElement.getChild(insertIndex);\n                    // UIElement and RawElement are special cases. Their children are not stored in a view (#799)\n                    // so we cannot use them with replacing flow (since they use view children during rendering\n                    // which will always result in rendering empty elements).\n                    if (viewChild && !viewChild.is('uiElement') && !viewChild.is('rawElement')) {\n                        this._updateElementMappings(viewChild, actualDomChildren[deleteIndex]);\n                    }\n                    remove(expectedDomChildren[insertIndex]);\n                    counter.equal++;\n                }\n                else {\n                    counter[action]++;\n                }\n            }\n        }\n    }\n    /**\n     * Updates mappings of a given view element.\n     *\n     * @param viewElement The view element whose mappings will be updated.\n     * @param domElement The DOM element representing the given view element.\n     */\n    _updateElementMappings(viewElement, domElement) {\n        // Remap 'DomConverter' bindings.\n        this.domConverter.unbindDomElement(domElement);\n        this.domConverter.bindElements(domElement, viewElement);\n        // View element may have children which needs to be updated, but are not marked, mark them to update.\n        this.markedChildren.add(viewElement);\n        // Because we replace new view element mapping with the existing one, the corresponding DOM element\n        // will not be rerendered. The new view element may have different attributes than the previous one.\n        // Since its corresponding DOM element will not be rerendered, new attributes will not be added\n        // to the DOM, so we need to mark it here to make sure its attributes gets updated. See #1427 for more\n        // detailed case study.\n        // Also there are cases where replaced element is removed from the view structure and then has\n        // its attributes changed or removed. In such cases the element will not be present in `markedAttributes`\n        // and also may be the same (`element.isSimilar()`) as the reused element not having its attributes updated.\n        // To prevent such situations we always mark reused element to have its attributes rerenderd (#1560).\n        this.markedAttributes.add(viewElement);\n    }\n    /**\n     * Gets the position of the inline filler based on the current selection.\n     * Here, we assume that we know that the filler is needed and\n     * {@link #_isSelectionInInlineFiller is at the selection position}, and, since it is needed,\n     * it is somewhere at the selection position.\n     *\n     * Note: The filler position cannot be restored based on the filler's DOM text node, because\n     * when this method is called (before rendering), the bindings will often be broken. View-to-DOM\n     * bindings are only dependable after rendering.\n     */\n    _getInlineFillerPosition() {\n        const firstPos = this.selection.getFirstPosition();\n        if (firstPos.parent.is('$text')) {\n            return ViewPosition._createBefore(firstPos.parent);\n        }\n        else {\n            return firstPos;\n        }\n    }\n    /**\n     * Returns `true` if the selection has not left the inline filler's text node.\n     * If it is `true`, it means that the filler had been added for a reason and the selection did not\n     * leave the filler's text node. For example, the user can be in the middle of a composition so it should not be touched.\n     *\n     * @returns `true` if the inline filler and selection are in the same place.\n     */\n    _isSelectionInInlineFiller() {\n        if (this.selection.rangeCount != 1 || !this.selection.isCollapsed) {\n            return false;\n        }\n        // Note, we can't check if selection's position equals position of the\n        // this._inlineFiller node, because of #663. We may not be able to calculate\n        // the filler's position in the view at this stage.\n        // Instead, we check it the other way – whether selection is anchored in\n        // that text node or next to it.\n        // Possible options are:\n        // \"FILLER{}\"\n        // \"FILLERadded-text{}\"\n        const selectionPosition = this.selection.getFirstPosition();\n        const position = this.domConverter.viewPositionToDom(selectionPosition);\n        if (position && isText(position.parent) && startsWithFiller(position.parent)) {\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Removes the inline filler.\n     */\n    _removeInlineFiller() {\n        const domFillerNode = this._inlineFiller;\n        // Something weird happened and the stored node doesn't contain the filler's text.\n        if (!startsWithFiller(domFillerNode)) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'Inline filler node: ' +\n            // @if CK_DEBUG_TYPING // \t\t`%c${ _escapeTextNodeData( domFillerNode.data ) }%c (${ domFillerNode.data.length })`,\n            // @if CK_DEBUG_TYPING // \t\t'color: blue',\n            // @if CK_DEBUG_TYPING // \t\t''\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            /**\n             * The inline filler node was lost. Most likely, something overwrote the filler text node\n             * in the DOM.\n             *\n             * @error view-renderer-filler-was-lost\n             */\n            throw new CKEditorError('view-renderer-filler-was-lost', this);\n        }\n        if (isInlineFiller(domFillerNode)) {\n            domFillerNode.remove();\n        }\n        else {\n            domFillerNode.data = domFillerNode.data.substr(INLINE_FILLER_LENGTH);\n        }\n        this._inlineFiller = null;\n    }\n    /**\n     * Checks if the inline {@link module:engine/view/filler filler} should be added.\n     *\n     * @returns `true` if the inline filler should be added.\n     */\n    _needsInlineFillerAtSelection() {\n        if (this.selection.rangeCount != 1 || !this.selection.isCollapsed) {\n            return false;\n        }\n        const selectionPosition = this.selection.getFirstPosition();\n        const selectionParent = selectionPosition.parent;\n        const selectionOffset = selectionPosition.offset;\n        // If there is no DOM root we do not care about fillers.\n        if (!this.domConverter.mapViewToDom(selectionParent.root)) {\n            return false;\n        }\n        if (!(selectionParent.is('element'))) {\n            return false;\n        }\n        // Prevent adding inline filler inside elements with contenteditable=false.\n        // https://github.com/ckeditor/ckeditor5-engine/issues/1170\n        if (!isEditable(selectionParent)) {\n            return false;\n        }\n        const nodeBefore = selectionPosition.nodeBefore;\n        const nodeAfter = selectionPosition.nodeAfter;\n        if (nodeBefore instanceof ViewText || nodeAfter instanceof ViewText) {\n            return false;\n        }\n        // We have block filler, we do not need inline one.\n        if (selectionOffset === selectionParent.getFillerOffset() && (!nodeBefore || !nodeBefore.is('element', 'br'))) {\n            return false;\n        }\n        // Do not use inline filler while typing outside inline elements on Android.\n        // The deleteContentBackward would remove part of the inline filler instead of removing last letter in a link.\n        if (env.isAndroid && (nodeBefore || nodeAfter)) {\n            return false;\n        }\n        return true;\n    }\n    /**\n     * Checks if text needs to be updated and possibly updates it.\n     *\n     * @param viewText View text to update.\n     * @param options.inlineFillerPosition The position where the inline filler should be rendered.\n     */\n    _updateText(viewText, options) {\n        const domText = this.domConverter.findCorrespondingDomText(viewText);\n        const newDomText = this.domConverter.viewToDom(viewText);\n        let expectedText = newDomText.data;\n        const filler = options.inlineFillerPosition;\n        if (filler && filler.parent == viewText.parent && filler.offset == viewText.index) {\n            expectedText = INLINE_FILLER + expectedText;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'%cUpdate text',\n        // @if CK_DEBUG_TYPING // \t\t'font-weight: normal'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        this._updateTextNode(domText, expectedText);\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n    /**\n     * Checks if attribute list needs to be updated and possibly updates it.\n     *\n     * @param viewElement The view element to update.\n     */\n    _updateAttrs(viewElement) {\n        const domElement = this.domConverter.mapViewToDom(viewElement);\n        if (!domElement) {\n            // If there is no `domElement` it means that 'viewElement' is outdated as its mapping was updated\n            // in 'this._updateChildrenMappings()'. There is no need to process it as new view element which\n            // replaced old 'viewElement' mapping was also added to 'this.markedAttributes'\n            // in 'this._updateChildrenMappings()' so it will be processed separately.\n            return;\n        }\n        // Remove attributes from DOM elements if they do not exist in the view.\n        //\n        // Note: It is important to first remove DOM attributes and then set new ones, because some view attributes may be renamed\n        // as they are set on DOM (due to unsafe attributes handling). If we set the view attribute first, and then remove\n        // non-existing DOM attributes, then we would remove the attribute that we just set.\n        //\n        // Note: The domElement.attributes is a live collection, so we need to convert it to an array to avoid issues.\n        for (const domAttr of Array.from(domElement.attributes)) {\n            const key = domAttr.name;\n            // All other attributes not present in the DOM should be removed.\n            if (!viewElement.hasAttribute(key)) {\n                this.domConverter.removeDomElementAttribute(domElement, key);\n            }\n        }\n        // Add or overwrite attributes.\n        for (const key of viewElement.getAttributeKeys()) {\n            this.domConverter.setDomElementAttribute(domElement, key, viewElement.getAttribute(key), viewElement);\n        }\n    }\n    /**\n     * Checks if elements child list needs to be updated and possibly updates it.\n     *\n     * Note that on Android, to reduce the risk of composition breaks, it tries to update data of an existing\n     * child text nodes instead of replacing them completely.\n     *\n     * @param viewElement View element to update.\n     * @param options.inlineFillerPosition The position where the inline filler should be rendered.\n     */\n    _updateChildren(viewElement, options) {\n        const domElement = this.domConverter.mapViewToDom(viewElement);\n        if (!domElement) {\n            // If there is no `domElement` it means that it was already removed from DOM.\n            // There is no need to process it. It will be processed when re-inserted.\n            return;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'%cUpdate children',\n        // @if CK_DEBUG_TYPING // \t\t'font-weight: normal'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        // IME on Android inserts a new text node while typing after a link\n        // instead of updating an existing text node that follows the link.\n        // We must normalize those text nodes so the diff won't get confused.\n        // https://github.com/ckeditor/ckeditor5/issues/12574.\n        if (env.isAndroid) {\n            let previousDomNode = null;\n            for (const domNode of Array.from(domElement.childNodes)) {\n                if (previousDomNode && isText(previousDomNode) && isText(domNode)) {\n                    domElement.normalize();\n                    break;\n                }\n                previousDomNode = domNode;\n            }\n        }\n        const inlineFillerPosition = options.inlineFillerPosition;\n        const actualDomChildren = domElement.childNodes;\n        const expectedDomChildren = Array.from(this.domConverter.viewChildrenToDom(viewElement, { bind: true }));\n        // Inline filler element has to be created as it is present in the DOM, but not in the view. It is required\n        // during diffing so text nodes could be compared correctly and also during rendering to maintain\n        // proper order and indexes while updating the DOM.\n        if (inlineFillerPosition && inlineFillerPosition.parent === viewElement) {\n            addInlineFiller(domElement.ownerDocument, expectedDomChildren, inlineFillerPosition.offset);\n        }\n        const diff = this._diffNodeLists(actualDomChildren, expectedDomChildren);\n        // We need to make sure that we update the existing text node and not replace it with another one.\n        // The composition and different \"language\" browser extensions are fragile to text node being completely replaced.\n        const actions = this._findUpdateActions(diff, actualDomChildren, expectedDomChildren, areTextNodes);\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping && actions.every( a => a == 'equal' ) ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'%cNothing to update.',\n        // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        let i = 0;\n        const nodesToUnbind = new Set();\n        // Handle deletions first.\n        // This is to prevent a situation where an element that already exists in `actualDomChildren` is inserted at a different\n        // index in `actualDomChildren`. Since `actualDomChildren` is a `NodeList`, this works like move, not like an insert,\n        // and it disrupts the whole algorithm. See https://github.com/ckeditor/ckeditor5/issues/6367.\n        //\n        // It doesn't matter in what order we remove or add nodes, as long as we remove and add correct nodes at correct indexes.\n        for (const action of actions) {\n            if (action === 'delete') {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING //\tconst node = actualDomChildren[ i ];\n                // @if CK_DEBUG_TYPING // \tif ( isText( node ) ) {\n                // @if CK_DEBUG_TYPING // \t\tconsole.info( ..._buildLogMessage( this, 'Renderer',\n                // @if CK_DEBUG_TYPING // \t\t\t'%cRemove text node' +\n                // @if CK_DEBUG_TYPING // \t\t\t`${ this.isComposing ? ' while composing (may break composition)' : '' }: ` +\n                // @if CK_DEBUG_TYPING // \t\t\t`%c${ _escapeTextNodeData( node.data ) }%c (${ node.data.length })`,\n                // @if CK_DEBUG_TYPING // \t\t\tthis.isComposing ? 'color: red; font-weight: bold' : '',\n                // @if CK_DEBUG_TYPING // \t\t\t'color: blue', ''\n                // @if CK_DEBUG_TYPING // \t\t) );\n                // @if CK_DEBUG_TYPING // \t} else {\n                // @if CK_DEBUG_TYPING // \t\tconsole.info( ..._buildLogMessage( this, 'Renderer',\n                // @if CK_DEBUG_TYPING // \t\t\t'%cRemove element' +\n                // @if CK_DEBUG_TYPING // \t\t\t`${ this.isComposing ? ' while composing (may break composition)' : '' }: `,\n                // @if CK_DEBUG_TYPING // \t\t\tthis.isComposing ? 'color: red; font-weight: bold' : '',\n                // @if CK_DEBUG_TYPING // \t\t\tnode\n                // @if CK_DEBUG_TYPING // \t\t) );\n                // @if CK_DEBUG_TYPING // \t}\n                // @if CK_DEBUG_TYPING // }\n                nodesToUnbind.add(actualDomChildren[i]);\n                remove(actualDomChildren[i]);\n            }\n            else if (action === 'equal' || action === 'update') {\n                i++;\n            }\n        }\n        i = 0;\n        for (const action of actions) {\n            if (action === 'insert') {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING //\tconst node = expectedDomChildren[ i ];\n                // @if CK_DEBUG_TYPING //\tif ( isText( node ) ) {\n                // @if CK_DEBUG_TYPING //\t\tconsole.info( ..._buildLogMessage( this, 'Renderer',\n                // @if CK_DEBUG_TYPING //\t\t\t'%cInsert text node' +\n                // @if CK_DEBUG_TYPING //\t\t\t`${ this.isComposing ? ' while composing (may break composition)' : '' }: ` +\n                // @if CK_DEBUG_TYPING //\t\t\t`%c${ _escapeTextNodeData( node.data ) }%c (${ node.data.length })`,\n                // @if CK_DEBUG_TYPING //\t\t\tthis.isComposing ? 'color: red; font-weight: bold' : '',\n                // @if CK_DEBUG_TYPING //\t\t\t'color: blue',\n                // @if CK_DEBUG_TYPING //\t\t\t''\n                // @if CK_DEBUG_TYPING //\t\t) );\n                // @if CK_DEBUG_TYPING //\t} else {\n                // @if CK_DEBUG_TYPING //\t\tconsole.info( ..._buildLogMessage( this, 'Renderer',\n                // @if CK_DEBUG_TYPING //\t\t\t'%cInsert element:',\n                // @if CK_DEBUG_TYPING //\t\t\t'font-weight: normal',\n                // @if CK_DEBUG_TYPING //\t\t\tnode\n                // @if CK_DEBUG_TYPING //\t\t) );\n                // @if CK_DEBUG_TYPING //\t}\n                // @if CK_DEBUG_TYPING // }\n                insertAt(domElement, i, expectedDomChildren[i]);\n                i++;\n            }\n            // Update the existing text node data.\n            else if (action === 'update') {\n                this._updateTextNode(actualDomChildren[i], expectedDomChildren[i].data);\n                i++;\n            }\n            else if (action === 'equal') {\n                // Force updating text nodes inside elements which did not change and do not need to be re-rendered (#1125).\n                // Do it here (not in the loop above) because only after insertions the `i` index is correct.\n                this._markDescendantTextToSync(this.domConverter.domToView(expectedDomChildren[i]));\n                i++;\n            }\n        }\n        // Unbind removed nodes. When node does not have a parent it means that it was removed from DOM tree during\n        // comparison with the expected DOM. We don't need to check child nodes, because if child node was reinserted,\n        // it was moved to DOM tree out of the removed node.\n        for (const node of nodesToUnbind) {\n            if (!node.parentNode) {\n                this.domConverter.unbindDomElement(node);\n            }\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n    /**\n     * Shorthand for diffing two arrays or node lists of DOM nodes.\n     *\n     * @param actualDomChildren Actual DOM children\n     * @param expectedDomChildren Expected DOM children.\n     * @returns The list of actions based on the {@link module:utils/diff~diff} function.\n     */\n    _diffNodeLists(actualDomChildren, expectedDomChildren) {\n        actualDomChildren = filterOutFakeSelectionContainer(actualDomChildren, this._fakeSelectionContainer);\n        return diff(actualDomChildren, expectedDomChildren, sameNodes.bind(null, this.domConverter));\n    }\n    /**\n     * Finds DOM nodes that were replaced with the similar nodes (same tag name) in the view. All nodes are compared\n     * within one `insert`/`delete` action group, for example:\n     *\n     * ```\n     * Actual DOM:\t\t<p><b>Foo</b>Bar<i>Baz</i><b>Bax</b></p>\n     * Expected DOM:\t<p>Bar<b>123</b><i>Baz</i><b>456</b></p>\n     * Input actions:\t[ insert, insert, delete, delete, equal, insert, delete ]\n     * Output actions:\t[ insert, replace, delete, equal, replace ]\n     * ```\n     *\n     * @param actions Actions array which is a result of the {@link module:utils/diff~diff} function.\n     * @param actualDom Actual DOM children\n     * @param expectedDom Expected DOM children.\n     * @param comparator A comparator function that should return `true` if the given node should be reused\n     * (either by the update of a text node data or an element children list for similar elements).\n     * @returns Actions array modified with the `update` actions.\n     */\n    _findUpdateActions(actions, actualDom, expectedDom, comparator) {\n        // If there is no both 'insert' and 'delete' actions, no need to check for replaced elements.\n        if (actions.indexOf('insert') === -1 || actions.indexOf('delete') === -1) {\n            return actions;\n        }\n        let newActions = [];\n        let actualSlice = [];\n        let expectedSlice = [];\n        const counter = { equal: 0, insert: 0, delete: 0 };\n        for (const action of actions) {\n            if (action === 'insert') {\n                expectedSlice.push(expectedDom[counter.equal + counter.insert]);\n            }\n            else if (action === 'delete') {\n                actualSlice.push(actualDom[counter.equal + counter.delete]);\n            }\n            else { // equal\n                newActions = newActions.concat(diff(actualSlice, expectedSlice, comparator)\n                    .map(action => action === 'equal' ? 'update' : action));\n                newActions.push('equal');\n                // Reset stored elements on 'equal'.\n                actualSlice = [];\n                expectedSlice = [];\n            }\n            counter[action]++;\n        }\n        return newActions.concat(diff(actualSlice, expectedSlice, comparator)\n            .map(action => action === 'equal' ? 'update' : action));\n    }\n    /**\n     * Checks if text needs to be updated and possibly updates it by removing and inserting only parts\n     * of the data from the existing text node to reduce impact on the IME composition.\n     *\n     * @param domText DOM text node to update.\n     * @param expectedText The expected data of a text node.\n     */\n    _updateTextNode(domText, expectedText) {\n        const actualText = domText.data;\n        if (actualText == expectedText) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'%cText node does not need update:%c ' +\n            // @if CK_DEBUG_TYPING // \t\t`${ _escapeTextNodeData( actualText ) }%c (${ actualText.length })`,\n            // @if CK_DEBUG_TYPING // \t\t'font-style: italic',\n            // @if CK_DEBUG_TYPING // \t\t'color: blue',\n            // @if CK_DEBUG_TYPING // \t\t''\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // Our approach to interleaving space character with NBSP might differ with the one implemented by the browser.\n        // Avoid modifying the text node in the DOM if only NBSPs and spaces are interchanged.\n        // We should avoid DOM modifications while composing to avoid breakage of composition.\n        // See: https://github.com/ckeditor/ckeditor5/issues/13994.\n        if (env.isAndroid && this.isComposing && actualText.replace(/\\u00A0/g, ' ') == expectedText.replace(/\\u00A0/g, ' ')) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'%cText node ignore NBSP changes while composing: ' +\n            // @if CK_DEBUG_TYPING // \t\t`%c${ _escapeTextNodeData( actualText ) }%c (${ actualText.length }) -> ` +\n            // @if CK_DEBUG_TYPING // \t\t`%c${ _escapeTextNodeData( expectedText ) }%c (${ expectedText.length })`,\n            // @if CK_DEBUG_TYPING // \t\t'font-style: italic',\n            // @if CK_DEBUG_TYPING // \t\t'color: blue',\n            // @if CK_DEBUG_TYPING // \t\t'',\n            // @if CK_DEBUG_TYPING // \t\t'color: blue',\n            // @if CK_DEBUG_TYPING // \t\t''\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'%cUpdate text node' +\n        // @if CK_DEBUG_TYPING // \t\t`${ this.isComposing ? ' while composing (may break composition)' : '' }: ` +\n        // @if CK_DEBUG_TYPING // \t\t`%c${ _escapeTextNodeData( actualText ) }%c (${ actualText.length }) -> ` +\n        // @if CK_DEBUG_TYPING // \t\t`%c${ _escapeTextNodeData( expectedText ) }%c (${ expectedText.length })`,\n        // @if CK_DEBUG_TYPING // \t\tthis.isComposing ? 'color: red; font-weight: bold' : '',\n        // @if CK_DEBUG_TYPING // \t\t'color: blue',\n        // @if CK_DEBUG_TYPING // \t\t'',\n        // @if CK_DEBUG_TYPING // \t\t'color: blue',\n        // @if CK_DEBUG_TYPING // \t\t''\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        this._updateTextNodeInternal(domText, expectedText);\n    }\n    /**\n     * Part of the `_updateTextNode` method extracted for easier testing.\n     */\n    _updateTextNodeInternal(domText, expectedText) {\n        const actions = fastDiff(domText.data, expectedText);\n        for (const action of actions) {\n            if (action.type === 'insert') {\n                domText.insertData(action.index, action.values.join(''));\n            }\n            else { // 'delete'\n                domText.deleteData(action.index, action.howMany);\n            }\n        }\n    }\n    /**\n     * Marks text nodes to be synchronized.\n     *\n     * If a text node is passed, it will be marked. If an element is passed, all descendant text nodes inside it will be marked.\n     *\n     * @param viewNode View node to sync.\n     */\n    _markDescendantTextToSync(viewNode) {\n        if (!viewNode) {\n            return;\n        }\n        if (viewNode.is('$text')) {\n            this.markedTexts.add(viewNode);\n        }\n        else if (viewNode.is('element')) {\n            for (const child of viewNode.getChildren()) {\n                this._markDescendantTextToSync(child);\n            }\n        }\n    }\n    /**\n     * Checks if the selection needs to be updated and possibly updates it.\n     */\n    _updateSelection() {\n        // Block updating DOM selection in (non-Android) Blink while the user is selecting to prevent accidental selection collapsing.\n        // Note: Structural changes in DOM must trigger selection rendering, though. Nodes the selection was anchored\n        // to, may disappear in DOM which would break the selection (e.g. in real-time collaboration scenarios).\n        // https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723\n        if (env.isBlink && !env.isAndroid && this.isSelecting && !this.markedChildren.size) {\n            return;\n        }\n        // If there is no selection - remove DOM and fake selections.\n        if (this.selection.rangeCount === 0) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'Update DOM selection: remove all ranges'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this._removeDomSelection();\n            this._removeFakeSelection();\n            return;\n        }\n        const domEditable = this.domConverter.mapViewToDom(this.selection.editableElement);\n        // Do not update DOM selection if there is no focus, or there is no DOM element corresponding to selection's editable element.\n        if (!this.isFocused || !domEditable) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'Skip updating DOM selection:',\n            // @if CK_DEBUG_TYPING // \t\t`isFocused: ${ this.isFocused }, hasDomEditable: ${ !!domEditable }`\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            // But if there was a fake selection, and it is not fake anymore - remove it as it can map to no longer existing widget.\n            // See https://github.com/ckeditor/ckeditor5/issues/18123.\n            if (!this.selection.isFake && this._fakeSelectionContainer && this._fakeSelectionContainer.isConnected) {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n                // @if CK_DEBUG_TYPING // \t\t'Remove fake selection (not focused editable)'\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                this._removeFakeSelection();\n            }\n            return;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'Update DOM selection'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        // Render fake selection - create the fake selection container (if needed) and move DOM selection to it.\n        if (this.selection.isFake) {\n            this._updateFakeSelection(domEditable);\n        }\n        // There was a fake selection so remove it and update the DOM selection.\n        // This is especially important on Android because otherwise IME will try to compose over the fake selection container.\n        else if (this._fakeSelectionContainer && this._fakeSelectionContainer.isConnected) {\n            this._removeFakeSelection();\n            this._updateDomSelection(domEditable);\n        }\n        // Update the DOM selection in case of a plain selection change (no fake selection is involved).\n        // On non-Android the whole rendering is disabled in composition mode (including DOM selection update),\n        // but updating DOM selection should be also disabled on Android if in the middle of the composition\n        // (to not interrupt it).\n        else if (!(this.isComposing && env.isAndroid)) {\n            this._updateDomSelection(domEditable);\n        }\n    }\n    /**\n     * Updates the fake selection.\n     *\n     * @param domEditable A valid DOM editable where the fake selection container should be added.\n     */\n    _updateFakeSelection(domEditable) {\n        const domDocument = domEditable.ownerDocument;\n        if (!this._fakeSelectionContainer) {\n            this._fakeSelectionContainer = createFakeSelectionContainer(domDocument);\n        }\n        const container = this._fakeSelectionContainer;\n        // Bind fake selection container with the current selection *position*.\n        this.domConverter.bindFakeSelection(container, this.selection);\n        if (!this._fakeSelectionNeedsUpdate(domEditable)) {\n            return;\n        }\n        if (!container.parentElement || container.parentElement != domEditable) {\n            domEditable.appendChild(container);\n        }\n        container.textContent = this.selection.fakeSelectionLabel || '\\u00A0';\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'Set DOM fake selection'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        const domSelection = domDocument.getSelection();\n        const domRange = domDocument.createRange();\n        domSelection.removeAllRanges();\n        domRange.selectNodeContents(container);\n        domSelection.addRange(domRange);\n    }\n    /**\n     * Updates the DOM selection.\n     *\n     * @param domEditable A valid DOM editable where the DOM selection should be rendered.\n     */\n    _updateDomSelection(domEditable) {\n        const domSelection = domEditable.ownerDocument.defaultView.getSelection();\n        // Let's check whether DOM selection needs updating at all.\n        if (!this._domSelectionNeedsUpdate(domSelection)) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'%cDOM selection is already correct',\n            // @if CK_DEBUG_TYPING // \t\t'font-style: italic;'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // Multi-range selection is not available in most browsers, and, at least in Chrome, trying to\n        // set such selection, that is not continuous, throws an error. Because of that, we will just use anchor\n        // and focus of view selection.\n        // Since we are not supporting multi-range selection, we also do not need to check if proper editable is\n        // selected. If there is any editable selected, it is okay (editable is taken from selection anchor).\n        const anchor = this.domConverter.viewPositionToDom(this.selection.anchor);\n        const focus = this.domConverter.viewPositionToDom(this.selection.focus);\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t'Update DOM selection:',\n        // @if CK_DEBUG_TYPING // \t\tanchor,\n        // @if CK_DEBUG_TYPING // \t\tfocus\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        domSelection.setBaseAndExtent(anchor.parent, anchor.offset, focus.parent, focus.offset);\n        // Firefox–specific hack (https://github.com/ckeditor/ckeditor5-engine/issues/1439).\n        if (env.isGecko) {\n            fixGeckoSelectionAfterBr(focus, domSelection);\n        }\n    }\n    /**\n     * Checks whether a given DOM selection needs to be updated.\n     *\n     * @param domSelection The DOM selection to check.\n     */\n    _domSelectionNeedsUpdate(domSelection) {\n        if (!this.domConverter.isDomSelectionCorrect(domSelection)) {\n            // Current DOM selection is in incorrect position. We need to update it.\n            return true;\n        }\n        const oldViewSelection = domSelection && this.domConverter.domSelectionToView(domSelection);\n        if (oldViewSelection && this.selection.isEqual(oldViewSelection)) {\n            return false;\n        }\n        // If selection is not collapsed, it does not need to be updated if it is similar.\n        if (!this.selection.isCollapsed && this.selection.isSimilar(oldViewSelection)) {\n            // Selection did not changed and is correct, do not update.\n            return false;\n        }\n        // Selections are not similar.\n        return true;\n    }\n    /**\n     * Checks whether the fake selection needs to be updated.\n     *\n     * @param domEditable A valid DOM editable where a new fake selection container should be added.\n     */\n    _fakeSelectionNeedsUpdate(domEditable) {\n        const container = this._fakeSelectionContainer;\n        const domSelection = domEditable.ownerDocument.getSelection();\n        // Fake selection needs to be updated if there's no fake selection container, or the container currently sits\n        // in a different root.\n        if (!container || container.parentElement !== domEditable) {\n            return true;\n        }\n        // Make sure that the selection actually is within the fake selection.\n        if (domSelection.anchorNode !== container && !container.contains(domSelection.anchorNode)) {\n            return true;\n        }\n        return container.textContent !== this.selection.fakeSelectionLabel;\n    }\n    /**\n     * Removes the DOM selection.\n     */\n    _removeDomSelection() {\n        for (const doc of this.domDocuments) {\n            const domSelection = doc.getSelection();\n            if (domSelection.rangeCount) {\n                const activeDomElement = doc.activeElement;\n                const viewElement = this.domConverter.mapDomToView(activeDomElement);\n                if (activeDomElement && viewElement) {\n                    domSelection.removeAllRanges();\n                }\n            }\n        }\n    }\n    /**\n     * Removes the fake selection.\n     */\n    _removeFakeSelection() {\n        const container = this._fakeSelectionContainer;\n        if (container) {\n            container.remove();\n        }\n    }\n    /**\n     * Checks if focus needs to be updated and possibly updates it.\n     */\n    _updateFocus() {\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'Renderer',\n        // @if CK_DEBUG_TYPING // \t\t`update focus: ${ this.isFocused ? 'focused' : 'not focused' }`\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        if (this.isFocused) {\n            const editable = this.selection.editableElement;\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'Renderer',\n            // @if CK_DEBUG_TYPING // \t\t'focus editable:',\n            // @if CK_DEBUG_TYPING // \t\t{ editable }\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            if (editable) {\n                this.domConverter.focus(editable);\n            }\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n}\n/**\n * Checks if provided element is editable.\n */\nfunction isEditable(element) {\n    if (element.getAttribute('contenteditable') == 'false') {\n        return false;\n    }\n    const parent = element.findAncestor(element => element.hasAttribute('contenteditable'));\n    return !parent || parent.getAttribute('contenteditable') == 'true';\n}\n/**\n * Adds inline filler at a given position.\n *\n * The position can be given as an array of DOM nodes and an offset in that array,\n * or a DOM parent element and an offset in that element.\n *\n * @returns The DOM text node that contains an inline filler.\n */\nfunction addInlineFiller(domDocument, domParentOrArray, offset) {\n    const childNodes = domParentOrArray instanceof Array ? domParentOrArray : domParentOrArray.childNodes;\n    const nodeAfterFiller = childNodes[offset];\n    if (isText(nodeAfterFiller)) {\n        nodeAfterFiller.data = INLINE_FILLER + nodeAfterFiller.data;\n        return nodeAfterFiller;\n    }\n    else {\n        const fillerNode = domDocument.createTextNode(INLINE_FILLER);\n        if (Array.isArray(domParentOrArray)) {\n            childNodes.splice(offset, 0, fillerNode);\n        }\n        else {\n            insertAt(domParentOrArray, offset, fillerNode);\n        }\n        return fillerNode;\n    }\n}\n/**\n * Whether two DOM nodes should be considered as similar.\n * Nodes are considered similar if they have the same tag name.\n */\nfunction areSimilarElements(node1, node2) {\n    return isNode(node1) && isNode(node2) &&\n        !isText(node1) && !isText(node2) &&\n        !isComment(node1) && !isComment(node2) &&\n        node1.tagName.toLowerCase() === node2.tagName.toLowerCase();\n}\n/**\n * Whether two DOM nodes are text nodes.\n */\nfunction areTextNodes(node1, node2) {\n    return isNode(node1) && isNode(node2) &&\n        isText(node1) && isText(node2);\n}\n/**\n * Whether two dom nodes should be considered as the same.\n * Two nodes which are considered the same are:\n *\n * * Text nodes with the same text.\n * * Element nodes represented by the same object.\n * * Two block filler elements.\n *\n * @param blockFillerMode Block filler mode, see {@link module:engine/view/domconverter~ViewDomConverter#blockFillerMode}.\n */\nfunction sameNodes(domConverter, actualDomChild, expectedDomChild) {\n    // Elements.\n    if (actualDomChild === expectedDomChild) {\n        return true;\n    }\n    // Texts.\n    else if (isText(actualDomChild) && isText(expectedDomChild)) {\n        return actualDomChild.data === expectedDomChild.data;\n    }\n    // Block fillers.\n    else if (domConverter.isBlockFiller(actualDomChild) &&\n        domConverter.isBlockFiller(expectedDomChild)) {\n        return true;\n    }\n    // Not matching types.\n    return false;\n}\n/**\n * The following is a Firefox–specific hack (https://github.com/ckeditor/ckeditor5-engine/issues/1439).\n * When the native DOM selection is at the end of the block and preceded by <br /> e.g.\n *\n * ```html\n * <p>foo<br/>[]</p>\n * ```\n *\n * which happens a lot when using the soft line break, the browser fails to (visually) move the\n * caret to the new line. A quick fix is as simple as force–refreshing the selection with the same range.\n */\nfunction fixGeckoSelectionAfterBr(focus, domSelection) {\n    let parent = focus.parent;\n    let offset = focus.offset;\n    if (isText(parent) && isInlineFiller(parent)) {\n        offset = indexOf(parent) + 1;\n        parent = parent.parentNode;\n    }\n    // This fix works only when the focus point is at the very end of an element.\n    // There is no point in running it in cases unrelated to the browser bug.\n    if (parent.nodeType != Node.ELEMENT_NODE || offset != parent.childNodes.length - 1) {\n        return;\n    }\n    const childAtOffset = parent.childNodes[offset];\n    // To stay on the safe side, the fix being as specific as possible, it targets only the\n    // selection which is at the very end of the element and preceded by <br />.\n    if (childAtOffset && childAtOffset.tagName == 'BR') {\n        domSelection.addRange(domSelection.getRangeAt(0));\n    }\n}\nfunction filterOutFakeSelectionContainer(domChildList, fakeSelectionContainer) {\n    const childList = Array.from(domChildList);\n    if (childList.length == 0 || !fakeSelectionContainer) {\n        return childList;\n    }\n    const last = childList[childList.length - 1];\n    if (last == fakeSelectionContainer) {\n        childList.pop();\n    }\n    return childList;\n}\n/**\n * Creates a fake selection container for a given document.\n */\nfunction createFakeSelectionContainer(domDocument) {\n    const container = domDocument.createElement('div');\n    container.className = 'ck-fake-selection-container';\n    Object.assign(container.style, {\n        position: 'fixed',\n        top: 0,\n        left: '-9999px',\n        // See https://github.com/ckeditor/ckeditor5/issues/752.\n        width: '42px'\n    });\n    // Fill it with a text node so we can update it later.\n    container.textContent = '\\u00A0';\n    return container;\n}\n// @if CK_DEBUG_TYPING // function _escapeTextNodeData( text ) {\n// @if CK_DEBUG_TYPING // \tconst escapedText = text\n// @if CK_DEBUG_TYPING // \t\t.replace( /&/g, '&amp;' )\n// @if CK_DEBUG_TYPING // \t\t.replace( /\\u00A0/g, '&nbsp;' )\n// @if CK_DEBUG_TYPING // \t\t.replace( /\\u2060/g, '&NoBreak;' );\n// @if CK_DEBUG_TYPING //\n// @if CK_DEBUG_TYPING // \treturn `\"${ escapedText }\"`;\n// @if CK_DEBUG_TYPING // }\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/domconverter\n */\nimport { ViewText } from './text.js';\nimport { ViewElement } from './element.js';\nimport { ViewUIElement } from './uielement.js';\nimport { ViewPosition } from './position.js';\nimport { ViewRange } from './range.js';\nimport { ViewSelection } from './selection.js';\nimport { ViewDocumentFragment } from './documentfragment.js';\nimport { ViewTreeWalker } from './treewalker.js';\nimport { Matcher } from './matcher.js';\nimport { BR_FILLER, INLINE_FILLER_LENGTH, NBSP_FILLER, MARKED_NBSP_FILLER, getDataWithoutFiller, isInlineFiller, startsWithFiller } from './filler.js';\nimport { global, logWarning, indexOf, getAncestors, isText, isComment, isValidAttributeName, first, env } from '@ckeditor/ckeditor5-utils';\nconst BR_FILLER_REF = BR_FILLER(global.document); // eslint-disable-line new-cap\nconst NBSP_FILLER_REF = NBSP_FILLER(global.document); // eslint-disable-line new-cap\nconst MARKED_NBSP_FILLER_REF = MARKED_NBSP_FILLER(global.document); // eslint-disable-line new-cap\nconst UNSAFE_ATTRIBUTE_NAME_PREFIX = 'data-ck-unsafe-attribute-';\nconst UNSAFE_ELEMENT_REPLACEMENT_ATTRIBUTE = 'data-ck-unsafe-element';\n/**\n * `ViewDomConverter` is a set of tools to do transformations between DOM nodes and view nodes. It also handles\n * {@link module:engine/view/domconverter~ViewDomConverter#bindElements bindings} between these nodes.\n *\n * An instance of the DOM converter is available under\n * {@link module:engine/view/view~EditingView#domConverter `editor.editing.view.domConverter`}.\n *\n * The DOM converter does not check which nodes should be rendered (use {@link module:engine/view/renderer~ViewRenderer}), does not keep the\n * state of a tree nor keeps the synchronization between the tree view and\n * the DOM tree (use {@link module:engine/view/document~ViewDocument}).\n *\n * The DOM converter keeps DOM elements to view element bindings, so when the converter gets destroyed, the bindings are lost.\n * Two converters will keep separate binding maps, so one tree view can be bound with two DOM trees.\n */\nexport class ViewDomConverter {\n    document;\n    /**\n     * Whether to leave the View-to-DOM conversion result unchanged or improve editing experience by filtering out interactive data.\n     */\n    renderingMode;\n    /**\n     * The mode of a block filler used by the DOM converter.\n     */\n    blockFillerMode;\n    /**\n     * Elements which are considered pre-formatted elements.\n     */\n    preElements;\n    /**\n     * Elements which are considered block elements (and hence should be filled with a\n     * {@link #isBlockFiller block filler}).\n     *\n     * Whether an element is considered a block element also affects handling of trailing whitespaces.\n     *\n     * You can extend this array if you introduce support for block elements which are not yet recognized here.\n     */\n    blockElements;\n    /**\n     * A list of elements that exist inline (in text) but their inner structure cannot be edited because\n     * of the way they are rendered by the browser. They are mostly HTML form elements but there are other\n     * elements such as `<img>` or `<iframe>` that also have non-editable children or no children whatsoever.\n     *\n     * Whether an element is considered an inline object has an impact on white space rendering (trimming)\n     * around (and inside of it). In short, white spaces in text nodes next to inline objects are not trimmed.\n     *\n     * You can extend this array if you introduce support for inline object elements which are not yet recognized here.\n     */\n    inlineObjectElements;\n    /**\n     * A list of elements which may affect the editing experience. To avoid this, those elements are replaced with\n     * `<span data-ck-unsafe-element=\"[element name]\"></span>` while rendering in the editing mode.\n     */\n    unsafeElements;\n    /**\n     * The DOM Document used by `ViewDomConverter` to create DOM nodes.\n     */\n    _domDocument;\n    /**\n     * The DOM-to-view mapping.\n     */\n    _domToViewMapping = new WeakMap();\n    /**\n     * The view-to-DOM mapping.\n     */\n    _viewToDomMapping = new WeakMap();\n    /**\n     * Holds the mapping between fake selection containers and corresponding view selections.\n     */\n    _fakeSelectionMapping = new WeakMap();\n    /**\n     * Matcher for view elements whose content should be treated as raw data\n     * and not processed during the conversion from DOM nodes to view elements.\n     */\n    _rawContentElementMatcher = new Matcher();\n    /**\n     * Matcher for inline object view elements. This is an extension of a simple {@link #inlineObjectElements} array of element names.\n     */\n    _inlineObjectElementMatcher = new Matcher();\n    /**\n     * Set of elements with temporary custom properties that require clearing after render.\n     */\n    _elementsWithTemporaryCustomProperties = new Set();\n    /**\n     * Creates a DOM converter.\n     *\n     * @param document The view document instance.\n     * @param options An object with configuration options.\n     * @param options.blockFillerMode The type of the block filler to use.\n     * Default value depends on the options.renderingMode:\n     *  'nbsp' when options.renderingMode == 'data',\n     *  'br' when options.renderingMode == 'editing'.\n     * @param options.renderingMode Whether to leave the View-to-DOM conversion result unchanged\n     * or improve editing experience by filtering out interactive data.\n     */\n    constructor(document, { blockFillerMode, renderingMode = 'editing' } = {}) {\n        this.document = document;\n        this.renderingMode = renderingMode;\n        this.blockFillerMode = blockFillerMode || (renderingMode === 'editing' ? 'br' : 'nbsp');\n        this.preElements = ['pre', 'textarea'];\n        this.blockElements = [\n            'address', 'article', 'aside', 'blockquote', 'caption', 'center', 'dd', 'details', 'dir', 'div',\n            'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header',\n            'hgroup', 'legend', 'li', 'main', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'summary', 'table', 'tbody',\n            'td', 'tfoot', 'th', 'thead', 'tr', 'ul'\n        ];\n        this.inlineObjectElements = [\n            'object', 'iframe', 'input', 'button', 'textarea', 'select', 'option', 'video', 'embed', 'audio', 'img', 'canvas'\n        ];\n        this.unsafeElements = ['script', 'style'];\n        this._domDocument = this.renderingMode === 'editing' ? global.document : global.document.implementation.createHTMLDocument('');\n    }\n    /**\n     * The DOM Document used by `ViewDomConverter` to create DOM nodes.\n     */\n    get domDocument() {\n        return this._domDocument;\n    }\n    /**\n     * Binds a given DOM element that represents fake selection to a **position** of a\n     * {@link module:engine/view/documentselection~ViewDocumentSelection document selection}.\n     * Document selection copy is stored and can be retrieved by the\n     * {@link module:engine/view/domconverter~ViewDomConverter#fakeSelectionToView} method.\n     */\n    bindFakeSelection(domElement, viewDocumentSelection) {\n        this._fakeSelectionMapping.set(domElement, new ViewSelection(viewDocumentSelection));\n    }\n    /**\n     * Returns a {@link module:engine/view/selection~ViewSelection view selection} instance corresponding to a given\n     * DOM element that represents fake selection. Returns `undefined` if binding to the given DOM element does not exist.\n     */\n    fakeSelectionToView(domElement) {\n        return this._fakeSelectionMapping.get(domElement);\n    }\n    /**\n     * Binds DOM and view elements, so it will be possible to get corresponding elements using\n     * {@link module:engine/view/domconverter~ViewDomConverter#mapDomToView} and\n     * {@link module:engine/view/domconverter~ViewDomConverter#mapViewToDom}.\n     *\n     * @param domElement The DOM element to bind.\n     * @param viewElement The view element to bind.\n     */\n    bindElements(domElement, viewElement) {\n        this._domToViewMapping.set(domElement, viewElement);\n        this._viewToDomMapping.set(viewElement, domElement);\n    }\n    /**\n     * Unbinds a given DOM element from the view element it was bound to. Unbinding is deep, meaning that all children of\n     * the DOM element will be unbound too.\n     *\n     * @param domElement The DOM element to unbind.\n     */\n    unbindDomElement(domElement) {\n        const viewElement = this._domToViewMapping.get(domElement);\n        if (viewElement) {\n            this._domToViewMapping.delete(domElement);\n            this._viewToDomMapping.delete(viewElement);\n            for (const child of domElement.children) {\n                this.unbindDomElement(child);\n            }\n        }\n    }\n    /**\n     * Binds DOM and view document fragments, so it will be possible to get corresponding document fragments using\n     * {@link module:engine/view/domconverter~ViewDomConverter#mapDomToView} and\n     * {@link module:engine/view/domconverter~ViewDomConverter#mapViewToDom}.\n     *\n     * @param domFragment The DOM document fragment to bind.\n     * @param viewFragment The view document fragment to bind.\n     */\n    bindDocumentFragments(domFragment, viewFragment) {\n        this._domToViewMapping.set(domFragment, viewFragment);\n        this._viewToDomMapping.set(viewFragment, domFragment);\n    }\n    /**\n     * Decides whether a given pair of attribute key and value should be passed further down the pipeline.\n     *\n     * @param elementName Element name in lower case.\n     */\n    shouldRenderAttribute(attributeKey, attributeValue, elementName) {\n        if (this.renderingMode === 'data') {\n            return true;\n        }\n        attributeKey = attributeKey.toLowerCase();\n        if (attributeKey.startsWith('on')) {\n            return false;\n        }\n        if (attributeKey === 'srcdoc' &&\n            attributeValue.match(/\\bon\\S+\\s*=|javascript:|<\\s*\\/*script/i)) {\n            return false;\n        }\n        if (elementName === 'img' &&\n            (attributeKey === 'src' || attributeKey === 'srcset')) {\n            return true;\n        }\n        if (elementName === 'source' && attributeKey === 'srcset') {\n            return true;\n        }\n        if (attributeValue.match(/^\\s*(javascript:|data:(image\\/svg|text\\/x?html))/i)) {\n            return false;\n        }\n        return true;\n    }\n    /**\n     * Set `domElement`'s content using provided `html` argument. Apply necessary filtering for the editing pipeline.\n     *\n     * @param domElement DOM element that should have `html` set as its content.\n     * @param html Textual representation of the HTML that will be set on `domElement`.\n     */\n    setContentOf(domElement, html) {\n        // For data pipeline we pass the HTML as-is.\n        if (this.renderingMode === 'data') {\n            domElement.innerHTML = html;\n            return;\n        }\n        const document = new DOMParser().parseFromString(html, 'text/html');\n        const fragment = document.createDocumentFragment();\n        const bodyChildNodes = document.body.childNodes;\n        while (bodyChildNodes.length > 0) {\n            fragment.appendChild(bodyChildNodes[0]);\n        }\n        const treeWalker = document.createTreeWalker(fragment, NodeFilter.SHOW_ELEMENT);\n        const nodes = [];\n        let currentNode;\n        // eslint-disable-next-line no-cond-assign\n        while (currentNode = treeWalker.nextNode()) {\n            nodes.push(currentNode);\n        }\n        for (const currentNode of nodes) {\n            // Go through nodes to remove those that are prohibited in editing pipeline.\n            for (const attributeName of currentNode.getAttributeNames()) {\n                this.setDomElementAttribute(currentNode, attributeName, currentNode.getAttribute(attributeName));\n            }\n            const elementName = currentNode.tagName.toLowerCase();\n            // There are certain nodes, that should be renamed to <span> in editing pipeline.\n            if (this._shouldRenameElement(elementName)) {\n                _logUnsafeElement(elementName);\n                currentNode.replaceWith(this._createReplacementDomElement(elementName, currentNode));\n            }\n        }\n        // Empty the target element.\n        while (domElement.firstChild) {\n            domElement.firstChild.remove();\n        }\n        domElement.append(fragment);\n    }\n    /**\n     * Converts the view to the DOM. For all text nodes, not bound elements and document fragments new items will\n     * be created. For bound elements and document fragments the method will return corresponding items.\n     *\n     * @param viewNode View node or document fragment to transform.\n     * @param options Conversion options.\n     * @param options.bind Determines whether new elements will be bound.\n     * @param options.withChildren If `false`, node's and document fragment's children will not be converted.\n     * @returns Converted node or DocumentFragment.\n     */\n    viewToDom(viewNode, options = {}) {\n        if (viewNode.is('$text')) {\n            const textData = this._processDataFromViewText(viewNode);\n            return this._domDocument.createTextNode(textData);\n        }\n        else {\n            const viewElementOrFragment = viewNode;\n            if (this.mapViewToDom(viewElementOrFragment)) {\n                // Do not reuse element that is marked to not reuse (for example an IMG element\n                // so it can immediately display a placeholder background instead of waiting for the new src to load).\n                if (viewElementOrFragment.getCustomProperty('editingPipeline:doNotReuseOnce')) {\n                    this._elementsWithTemporaryCustomProperties.add(viewElementOrFragment);\n                }\n                else {\n                    return this.mapViewToDom(viewElementOrFragment);\n                }\n            }\n            let domElement;\n            if (viewElementOrFragment.is('documentFragment')) {\n                // Create DOM document fragment.\n                domElement = this._domDocument.createDocumentFragment();\n                if (options.bind) {\n                    this.bindDocumentFragments(domElement, viewElementOrFragment);\n                }\n            }\n            else if (viewElementOrFragment.is('uiElement')) {\n                if (viewElementOrFragment.name === '$comment') {\n                    domElement = this._domDocument.createComment(viewElementOrFragment.getCustomProperty('$rawContent'));\n                }\n                else {\n                    // UIElement has its own render() method (see #799).\n                    domElement = viewElementOrFragment.render(this._domDocument, this);\n                }\n                if (options.bind) {\n                    this.bindElements(domElement, viewElementOrFragment);\n                }\n                return domElement;\n            }\n            else {\n                // Create DOM element.\n                if (this._shouldRenameElement(viewElementOrFragment.name)) {\n                    _logUnsafeElement(viewElementOrFragment.name);\n                    domElement = this._createReplacementDomElement(viewElementOrFragment.name);\n                }\n                else if (viewElementOrFragment.hasAttribute('xmlns')) {\n                    domElement = this._domDocument.createElementNS(viewElementOrFragment.getAttribute('xmlns'), viewElementOrFragment.name);\n                }\n                else {\n                    domElement = this._domDocument.createElement(viewElementOrFragment.name);\n                }\n                // RawElement take care of their children in RawElement#render() method which can be customized\n                // (see https://github.com/ckeditor/ckeditor5/issues/4469).\n                if (viewElementOrFragment.is('rawElement')) {\n                    viewElementOrFragment.render(domElement, this);\n                }\n                if (options.bind) {\n                    this.bindElements(domElement, viewElementOrFragment);\n                }\n                // Copy element's attributes.\n                for (const key of viewElementOrFragment.getAttributeKeys()) {\n                    this.setDomElementAttribute(domElement, key, viewElementOrFragment.getAttribute(key), viewElementOrFragment);\n                }\n            }\n            if (options.withChildren !== false) {\n                for (const child of this.viewChildrenToDom(viewElementOrFragment, options)) {\n                    if (domElement instanceof HTMLTemplateElement) {\n                        domElement.content.appendChild(child);\n                    }\n                    else {\n                        domElement.appendChild(child);\n                    }\n                }\n            }\n            return domElement;\n        }\n    }\n    /**\n     * Sets the attribute on a DOM element.\n     *\n     * **Note**: To remove the attribute, use {@link #removeDomElementAttribute}.\n     *\n     * @param domElement The DOM element the attribute should be set on.\n     * @param key The name of the attribute.\n     * @param value The value of the attribute.\n     * @param relatedViewElement The view element related to the `domElement` (if there is any).\n     * It helps decide whether the attribute set is unsafe. For instance, view elements created via the\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter} methods can allow certain attributes\n     * that would normally be filtered out.\n     */\n    setDomElementAttribute(domElement, key, value, relatedViewElement) {\n        const shouldRenderAttribute = this.shouldRenderAttribute(key, value, domElement.tagName.toLowerCase()) ||\n            relatedViewElement && relatedViewElement.shouldRenderUnsafeAttribute(key);\n        if (!shouldRenderAttribute) {\n            logWarning('domconverter-unsafe-attribute-detected', { domElement, key, value });\n        }\n        if (!isValidAttributeName(key)) {\n            /**\n             * Invalid attribute name was ignored during rendering.\n             *\n             * @error domconverter-invalid-attribute-detected\n             */\n            logWarning('domconverter-invalid-attribute-detected', { domElement, key, value });\n            return;\n        }\n        // The old value was safe but the new value is unsafe.\n        if (domElement.hasAttribute(key) && !shouldRenderAttribute) {\n            domElement.removeAttribute(key);\n        }\n        // The old value was unsafe (but prefixed) but the new value will be safe (will be unprefixed).\n        else if (domElement.hasAttribute(UNSAFE_ATTRIBUTE_NAME_PREFIX + key) && shouldRenderAttribute) {\n            domElement.removeAttribute(UNSAFE_ATTRIBUTE_NAME_PREFIX + key);\n        }\n        // If the attribute should not be rendered, rename it (instead of removing) to give developers some idea of what\n        // is going on (https://github.com/ckeditor/ckeditor5/issues/10801).\n        domElement.setAttribute(shouldRenderAttribute ? key : UNSAFE_ATTRIBUTE_NAME_PREFIX + key, value);\n    }\n    /**\n     * Removes an attribute from a DOM element.\n     *\n     * **Note**: To set the attribute, use {@link #setDomElementAttribute}.\n     *\n     * @param domElement The DOM element the attribute should be removed from.\n     * @param key The name of the attribute.\n     */\n    removeDomElementAttribute(domElement, key) {\n        // See #_createReplacementDomElement() to learn what this is.\n        if (key == UNSAFE_ELEMENT_REPLACEMENT_ATTRIBUTE) {\n            return;\n        }\n        domElement.removeAttribute(key);\n        // See setDomElementAttribute() to learn what this is.\n        domElement.removeAttribute(UNSAFE_ATTRIBUTE_NAME_PREFIX + key);\n    }\n    /**\n     * Converts children of the view element to DOM using the\n     * {@link module:engine/view/domconverter~ViewDomConverter#viewToDom} method.\n     * Additionally, this method adds block {@link module:engine/view/filler filler} to the list of children, if needed.\n     *\n     * @param viewElement Parent view element.\n     * @param options See {@link module:engine/view/domconverter~ViewDomConverter#viewToDom} options parameter.\n     * @returns DOM nodes.\n     */\n    *viewChildrenToDom(viewElement, options = {}) {\n        const fillerPositionOffset = viewElement.getFillerOffset && viewElement.getFillerOffset();\n        let offset = 0;\n        for (const childView of viewElement.getChildren()) {\n            if (fillerPositionOffset === offset) {\n                yield this._getBlockFiller();\n            }\n            const transparentRendering = childView.is('element') &&\n                !!childView.getCustomProperty('dataPipeline:transparentRendering') &&\n                !first(childView.getAttributes());\n            if (transparentRendering && this.renderingMode == 'data') {\n                // `RawElement` doesn't have #children defined, so they need to be temporarily rendered\n                // and extracted directly.\n                if (childView.is('rawElement')) {\n                    const tempElement = this._domDocument.createElement(childView.name);\n                    childView.render(tempElement, this);\n                    yield* [...tempElement.childNodes];\n                }\n                else {\n                    yield* this.viewChildrenToDom(childView, options);\n                }\n            }\n            else {\n                if (transparentRendering) {\n                    /**\n                     * The `dataPipeline:transparentRendering` flag is supported only in the data pipeline.\n                     *\n                     * @error domconverter-transparent-rendering-unsupported-in-editing-pipeline\n                     */\n                    logWarning('domconverter-transparent-rendering-unsupported-in-editing-pipeline', { viewElement: childView });\n                }\n                yield this.viewToDom(childView, options);\n            }\n            offset++;\n        }\n        if (fillerPositionOffset === offset) {\n            yield this._getBlockFiller();\n        }\n    }\n    /**\n     * Converts view {@link module:engine/view/range~ViewRange} to DOM range.\n     * Inline and block {@link module:engine/view/filler fillers} are handled during the conversion.\n     *\n     * @param viewRange View range.\n     * @returns DOM range.\n     */\n    viewRangeToDom(viewRange) {\n        const domStart = this.viewPositionToDom(viewRange.start);\n        const domEnd = this.viewPositionToDom(viewRange.end);\n        const domRange = this._domDocument.createRange();\n        domRange.setStart(domStart.parent, domStart.offset);\n        domRange.setEnd(domEnd.parent, domEnd.offset);\n        return domRange;\n    }\n    /**\n     * Converts view {@link module:engine/view/position~ViewPosition} to DOM parent and offset.\n     *\n     * Inline and block {@link module:engine/view/filler fillers} are handled during the conversion.\n     * If the converted position is directly before inline filler it is moved inside the filler.\n     *\n     * @param viewPosition View position.\n     * @returns DOM position or `null` if view position could not be converted to DOM.\n     * DOM position has two properties:\n     * * `parent` - DOM position parent.\n     * * `offset` - DOM position offset.\n     */\n    viewPositionToDom(viewPosition) {\n        const viewParent = viewPosition.parent;\n        if (viewParent.is('$text')) {\n            const domParent = this.findCorrespondingDomText(viewParent);\n            if (!domParent) {\n                // Position is in a view text node that has not been rendered to DOM yet.\n                return null;\n            }\n            let offset = viewPosition.offset;\n            if (startsWithFiller(domParent)) {\n                offset += INLINE_FILLER_LENGTH;\n            }\n            // In case someone uses outdated view position, but DOM text node was already changed while typing.\n            // See: https://github.com/ckeditor/ckeditor5/issues/18648.\n            // Note that when checking Renderer#_isSelectionInInlineFiller() this might be other element\n            // than a text node as it is triggered before applying view changes to the DOM.\n            if (domParent.data && offset > domParent.data.length) {\n                offset = domParent.data.length;\n            }\n            return { parent: domParent, offset };\n        }\n        else {\n            // viewParent is instance of ViewElement.\n            let domParent, domBefore, domAfter;\n            if (viewPosition.offset === 0) {\n                domParent = this.mapViewToDom(viewParent);\n                if (!domParent) {\n                    // Position is in a view element that has not been rendered to DOM yet.\n                    return null;\n                }\n                domAfter = domParent.childNodes[0];\n            }\n            else {\n                const nodeBefore = viewPosition.nodeBefore;\n                domBefore = nodeBefore.is('$text') ?\n                    this.findCorrespondingDomText(nodeBefore) :\n                    this.mapViewToDom(nodeBefore);\n                if (!domBefore) {\n                    // Position is after a view element that has not been rendered to DOM yet.\n                    return null;\n                }\n                domParent = domBefore.parentNode;\n                domAfter = domBefore.nextSibling;\n            }\n            // If there is an inline filler at position return position inside the filler. We should never return\n            // the position before the inline filler.\n            if (isText(domAfter) && startsWithFiller(domAfter)) {\n                return { parent: domAfter, offset: INLINE_FILLER_LENGTH };\n            }\n            const offset = domBefore ? indexOf(domBefore) + 1 : 0;\n            return { parent: domParent, offset };\n        }\n    }\n    /**\n     * Converts DOM to view. For all text nodes, not bound elements and document fragments new items will\n     * be created. For bound elements and document fragments function will return corresponding items. For\n     * {@link module:engine/view/filler fillers} `null` will be returned.\n     * For all DOM elements rendered by {@link module:engine/view/uielement~ViewUIElement} that UIElement will be returned.\n     *\n     * @param domNode DOM node or document fragment to transform.\n     * @param options Conversion options.\n     * @param options.bind Determines whether new elements will be bound. False by default.\n     * @param options.withChildren If `true`, node's and document fragment's children will be converted too. True by default.\n     * @param options.keepOriginalCase If `false`, node's tag name will be converted to lower case. False by default.\n     * @param options.skipComments If `false`, comment nodes will be converted to `$comment`\n     * {@link module:engine/view/uielement~ViewUIElement view UI elements}. False by default.\n     * @returns Converted node or document fragment or `null` if DOM node is a {@link module:engine/view/filler filler}\n     * or the given node is an empty text node.\n     */\n    domToView(domNode, options = {}) {\n        const inlineNodes = [];\n        const generator = this._domToView(domNode, options, inlineNodes);\n        // Get the first yielded value or a returned value.\n        const node = generator.next().value;\n        if (!node) {\n            return null;\n        }\n        // Trigger children handling.\n        generator.next();\n        // Whitespace cleaning.\n        this._processDomInlineNodes(null, inlineNodes, options);\n        // This was a single block filler so just remove it.\n        if (this.blockFillerMode == 'br' && isViewBrFiller(node)) {\n            return null;\n        }\n        // Text not got trimmed to an empty string so there is no result node.\n        if (node.is('$text') && node.data.length == 0) {\n            return null;\n        }\n        return node;\n    }\n    /**\n     * Converts children of the DOM element to view nodes using\n     * the {@link module:engine/view/domconverter~ViewDomConverter#domToView} method.\n     * Additionally this method omits block {@link module:engine/view/filler filler}, if it exists in the DOM parent.\n     *\n     * @param domElement Parent DOM element.\n     * @param options See {@link module:engine/view/domconverter~ViewDomConverter#domToView} options parameter.\n     * @param inlineNodes An array that will be populated with inline nodes. It's used internally for whitespace processing.\n     * @returns View nodes.\n     */\n    *domChildrenToView(domElement, options = {}, inlineNodes = []) {\n        // Get child nodes from content document fragment if element is template\n        let childNodes = [];\n        if (domElement instanceof HTMLTemplateElement) {\n            childNodes = [...domElement.content.childNodes];\n        }\n        else {\n            childNodes = [...domElement.childNodes];\n        }\n        for (let i = 0; i < childNodes.length; i++) {\n            const domChild = childNodes[i];\n            const generator = this._domToView(domChild, options, inlineNodes);\n            // Get the first yielded value or a returned value.\n            const viewChild = generator.next().value;\n            if (viewChild !== null) {\n                // Whitespace cleaning before entering a block element (between block elements).\n                if (this._isBlockViewElement(viewChild)) {\n                    this._processDomInlineNodes(domElement, inlineNodes, options);\n                }\n                // Yield only if this is not a block filler.\n                if (!(this.blockFillerMode == 'br' && isViewBrFiller(viewChild))) {\n                    yield viewChild;\n                }\n                // Trigger children handling.\n                generator.next();\n            }\n        }\n        // Whitespace cleaning before leaving a block element (content of block element).\n        this._processDomInlineNodes(domElement, inlineNodes, options);\n    }\n    /**\n     * Converts DOM selection to view {@link module:engine/view/selection~ViewSelection}.\n     * Ranges which cannot be converted will be omitted.\n     *\n     * @param domSelection DOM selection.\n     * @returns View selection.\n     */\n    domSelectionToView(domSelection) {\n        // See: https://github.com/ckeditor/ckeditor5/issues/9635.\n        if (isGeckoRestrictedDomSelection(domSelection)) {\n            return new ViewSelection([]);\n        }\n        // DOM selection might be placed in fake selection container.\n        // If container contains fake selection - return corresponding view selection.\n        if (domSelection.rangeCount === 1) {\n            let container = domSelection.getRangeAt(0).startContainer;\n            // The DOM selection might be moved to the text node inside the fake selection container.\n            if (isText(container)) {\n                container = container.parentNode;\n            }\n            const viewSelection = this.fakeSelectionToView(container);\n            if (viewSelection) {\n                return viewSelection;\n            }\n        }\n        const isBackward = this.isDomSelectionBackward(domSelection);\n        const viewRanges = [];\n        for (let i = 0; i < domSelection.rangeCount; i++) {\n            // DOM Range have correct start and end, no matter what is the DOM Selection direction. So we don't have to fix anything.\n            const domRange = domSelection.getRangeAt(i);\n            const viewRange = this.domRangeToView(domRange);\n            if (viewRange) {\n                viewRanges.push(viewRange);\n            }\n        }\n        return new ViewSelection(viewRanges, { backward: isBackward });\n    }\n    /**\n     * Converts DOM Range to view {@link module:engine/view/range~ViewRange}.\n     * If the start or end position cannot be converted `null` is returned.\n     *\n     * @param domRange DOM range.\n     * @returns View range.\n     */\n    domRangeToView(domRange) {\n        const viewStart = this.domPositionToView(domRange.startContainer, domRange.startOffset);\n        const viewEnd = this.domPositionToView(domRange.endContainer, domRange.endOffset);\n        if (viewStart && viewEnd) {\n            return new ViewRange(viewStart, viewEnd);\n        }\n        return null;\n    }\n    /**\n     * Converts DOM parent and offset to view {@link module:engine/view/position~ViewPosition}.\n     *\n     * If the position is inside a {@link module:engine/view/filler filler} which has no corresponding view node,\n     * position of the filler will be converted and returned.\n     *\n     * If the position is inside DOM element rendered by {@link module:engine/view/uielement~ViewUIElement}\n     * that position will be converted to view position before that UIElement.\n     *\n     * If structures are too different and it is not possible to find corresponding position then `null` will be returned.\n     *\n     * @param domParent DOM position parent.\n     * @param domOffset DOM position offset. You can skip it when converting the inline filler node.\n     * @returns View position.\n     */\n    domPositionToView(domParent, domOffset = 0) {\n        if (this.isBlockFiller(domParent)) {\n            return this.domPositionToView(domParent.parentNode, indexOf(domParent));\n        }\n        // If position is somewhere inside UIElement or a RawElement - return position before that element.\n        const viewElement = this.mapDomToView(domParent);\n        if (viewElement && (viewElement.is('uiElement') || viewElement.is('rawElement'))) {\n            return ViewPosition._createBefore(viewElement);\n        }\n        if (isText(domParent)) {\n            if (isInlineFiller(domParent)) {\n                return this.domPositionToView(domParent.parentNode, indexOf(domParent));\n            }\n            const viewParent = this.findCorrespondingViewText(domParent);\n            let offset = domOffset;\n            if (!viewParent) {\n                return null;\n            }\n            if (startsWithFiller(domParent)) {\n                offset -= INLINE_FILLER_LENGTH;\n                offset = offset < 0 ? 0 : offset;\n            }\n            return new ViewPosition(viewParent, offset);\n        }\n        // domParent instanceof HTMLElement.\n        else {\n            if (domOffset === 0) {\n                const viewParent = this.mapDomToView(domParent);\n                if (viewParent) {\n                    return new ViewPosition(viewParent, 0);\n                }\n            }\n            else {\n                const domBefore = domParent.childNodes[domOffset - 1];\n                // Jump over an inline filler (and also on Firefox jump over a block filler while pressing backspace in an empty paragraph).\n                if (isText(domBefore) && isInlineFiller(domBefore) || domBefore && this.isBlockFiller(domBefore)) {\n                    return this.domPositionToView(domBefore.parentNode, indexOf(domBefore));\n                }\n                const viewBefore = isText(domBefore) ?\n                    this.findCorrespondingViewText(domBefore) :\n                    this.mapDomToView(domBefore);\n                // TODO #663\n                if (viewBefore && viewBefore.parent) {\n                    return new ViewPosition(viewBefore.parent, viewBefore.index + 1);\n                }\n            }\n            return null;\n        }\n    }\n    /**\n     * Returns corresponding view {@link module:engine/view/element~ViewElement Element} or\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment} for provided DOM element or\n     * document fragment. If there is no view item {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound}\n     * to the given DOM - `undefined` is returned.\n     *\n     * For all DOM elements rendered by a {@link module:engine/view/uielement~ViewUIElement} or\n     * a {@link module:engine/view/rawelement~ViewRawElement}, the parent `UIElement` or `RawElement` will be returned.\n     *\n     * @param domElementOrDocumentFragment DOM element or document fragment.\n     * @returns Corresponding view element, document fragment or `undefined` if no element was bound.\n     */\n    mapDomToView(domElementOrDocumentFragment) {\n        const hostElement = this.getHostViewElement(domElementOrDocumentFragment);\n        return hostElement || this._domToViewMapping.get(domElementOrDocumentFragment);\n    }\n    /**\n     * Finds corresponding text node. Text nodes are not {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound},\n     * corresponding text node is returned based on the sibling or parent.\n     *\n     * If the directly previous sibling is a {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound} element, it is used\n     * to find the corresponding text node.\n     *\n     * If this is a first child in the parent and the parent is a\n     * {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound}\n     * element, it is used to find the corresponding text node.\n     *\n     * For all text nodes rendered by a {@link module:engine/view/uielement~ViewUIElement} or\n     * a {@link module:engine/view/rawelement~ViewRawElement}, the parent `UIElement` or `RawElement` will be returned.\n     *\n     * Otherwise `null` is returned.\n     *\n     * Note that for the block or inline {@link module:engine/view/filler filler} this method returns `null`.\n     *\n     * @param domText DOM text node.\n     * @returns Corresponding view text node or `null`, if it was not possible to find a corresponding node.\n     */\n    findCorrespondingViewText(domText) {\n        if (isInlineFiller(domText)) {\n            return null;\n        }\n        // If DOM text was rendered by a UIElement or a RawElement - return this parent element.\n        const hostElement = this.getHostViewElement(domText);\n        if (hostElement) {\n            return hostElement;\n        }\n        const previousSibling = domText.previousSibling;\n        // Try to use previous sibling to find the corresponding text node.\n        if (previousSibling) {\n            if (!(this.isElement(previousSibling))) {\n                // The previous is text or comment.\n                return null;\n            }\n            const viewElement = this.mapDomToView(previousSibling);\n            if (viewElement) {\n                const nextSibling = viewElement.nextSibling;\n                // It might be filler which has no corresponding view node.\n                if (nextSibling instanceof ViewText) {\n                    return nextSibling;\n                }\n                else {\n                    return null;\n                }\n            }\n        }\n        // Try to use parent to find the corresponding text node.\n        else {\n            const viewElement = this.mapDomToView(domText.parentNode);\n            if (viewElement) {\n                const firstChild = viewElement.getChild(0);\n                // It might be filler which has no corresponding view node.\n                if (firstChild instanceof ViewText) {\n                    return firstChild;\n                }\n                else {\n                    return null;\n                }\n            }\n        }\n        return null;\n    }\n    mapViewToDom(documentFragmentOrElement) {\n        return this._viewToDomMapping.get(documentFragmentOrElement);\n    }\n    /**\n     * Finds corresponding text node. Text nodes are not {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound},\n     * corresponding text node is returned based on the sibling or parent.\n     *\n     * If the directly previous sibling is a {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound} element, it is used\n     * to find the corresponding text node.\n     *\n     * If this is a first child in the parent and the parent is a\n     * {@link module:engine/view/domconverter~ViewDomConverter#bindElements bound}\n     * element, it is used to find the corresponding text node.\n     *\n     * Otherwise `null` is returned.\n     *\n     * @param viewText View text node.\n     * @returns Corresponding DOM text node or `null`, if it was not possible to find a corresponding node.\n     */\n    findCorrespondingDomText(viewText) {\n        const previousSibling = viewText.previousSibling;\n        // Try to use previous sibling to find the corresponding text node.\n        if (previousSibling && this.mapViewToDom(previousSibling)) {\n            return this.mapViewToDom(previousSibling).nextSibling;\n        }\n        // If this is a first node, try to use parent to find the corresponding text node.\n        if (!previousSibling && viewText.parent && this.mapViewToDom(viewText.parent)) {\n            return this.mapViewToDom(viewText.parent).childNodes[0];\n        }\n        return null;\n    }\n    /**\n     * Focuses DOM editable that is corresponding to provided {@link module:engine/view/editableelement~ViewEditableElement}.\n     */\n    focus(viewEditable) {\n        const domEditable = this.mapViewToDom(viewEditable);\n        if (!domEditable || domEditable.ownerDocument.activeElement === domEditable) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'ViewDomConverter',\n            // @if CK_DEBUG_TYPING // \t\t'%cDOM editable is already active or does not exist',\n            // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'ViewDomConverter',\n        // @if CK_DEBUG_TYPING // \t\t'Focus DOM editable:',\n        // @if CK_DEBUG_TYPING // \t\t{ domEditable }\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        // Save the scrollX and scrollY positions before the focus.\n        const { scrollX, scrollY } = global.window;\n        const scrollPositions = [];\n        // Save all scrollLeft and scrollTop values starting from domEditable up to\n        // document#documentElement.\n        forEachDomElementAncestor(domEditable, node => {\n            const { scrollLeft, scrollTop } = node;\n            scrollPositions.push([scrollLeft, scrollTop]);\n        });\n        domEditable.focus({ preventScroll: true });\n        // Restore scrollLeft and scrollTop values starting from domEditable up to\n        // document#documentElement.\n        // https://github.com/ckeditor/ckeditor5-engine/issues/951\n        // https://github.com/ckeditor/ckeditor5-engine/issues/957\n        forEachDomElementAncestor(domEditable, node => {\n            const [scrollLeft, scrollTop] = scrollPositions.shift();\n            node.scrollLeft = scrollLeft;\n            node.scrollTop = scrollTop;\n        });\n        // Restore the scrollX and scrollY positions after the focus.\n        // https://github.com/ckeditor/ckeditor5-engine/issues/951\n        global.window.scrollTo(scrollX, scrollY);\n    }\n    /**\n     * Remove DOM selection from blurred editable, so it won't interfere with clicking on dropdowns (especially on iOS).\n     *\n     * @internal\n     */\n    _clearDomSelection() {\n        const domEditable = this.mapViewToDom(this.document.selection.editableElement);\n        if (!domEditable) {\n            return;\n        }\n        // Check if DOM selection is inside editor editable element.\n        const domSelection = domEditable.ownerDocument.defaultView.getSelection();\n        const newViewSelection = this.domSelectionToView(domSelection);\n        const selectionInEditable = newViewSelection && newViewSelection.rangeCount > 0;\n        if (selectionInEditable) {\n            domSelection.removeAllRanges();\n        }\n    }\n    /**\n     * Returns `true` when `node.nodeType` equals `Node.ELEMENT_NODE`.\n     *\n     * @param node Node to check.\n     */\n    isElement(node) {\n        return node && node.nodeType == Node.ELEMENT_NODE;\n    }\n    /**\n     * Returns `true` when `node.nodeType` equals `Node.DOCUMENT_FRAGMENT_NODE`.\n     *\n     * @param node Node to check.\n     */\n    isDocumentFragment(node) {\n        return node && node.nodeType == Node.DOCUMENT_FRAGMENT_NODE;\n    }\n    /**\n     * Checks if the node is an instance of the block filler for this DOM converter.\n     *\n     * ```ts\n     * const converter = new ViewDomConverter( viewDocument, { blockFillerMode: 'br' } );\n     *\n     * converter.isBlockFiller( BR_FILLER( document ) ); // true\n     * converter.isBlockFiller( NBSP_FILLER( document ) ); // false\n     * ```\n     *\n     * **Note:**: For the `'nbsp'` mode the method also checks context of a node so it cannot be a detached node.\n     *\n     * **Note:** A special case in the `'nbsp'` mode exists where the `<br>` in `<p><br></p>` is treated as a block filler.\n     *\n     * @param domNode DOM node to check.\n     * @returns True if a node is considered a block filler for given mode.\n     */\n    isBlockFiller(domNode) {\n        if (this.blockFillerMode == 'br') {\n            return domNode.isEqualNode(BR_FILLER_REF);\n        }\n        // Special case for <p><br></p> in which <br> should be treated as filler even when we are not in the 'br' mode.\n        // See https://github.com/ckeditor/ckeditor5/issues/5564.\n        if (isOnlyBrInBlock(domNode, this.blockElements)) {\n            return true;\n        }\n        // If not in 'br' mode, try recognizing both marked and regular nbsp block fillers.\n        return domNode.isEqualNode(MARKED_NBSP_FILLER_REF) || isNbspBlockFiller(domNode, this.blockElements);\n    }\n    /**\n     * Returns `true` if given selection is a backward selection, that is, if it's `focus` is before `anchor`.\n     *\n     * @param selection Selection instance to check.\n     */\n    isDomSelectionBackward(selection) {\n        if (selection.isCollapsed) {\n            return false;\n        }\n        // Since it takes multiple lines of code to check whether a \"DOM Position\" is before/after another \"DOM Position\",\n        // we will use the fact that range will collapse if it's end is before it's start.\n        const range = this._domDocument.createRange();\n        try {\n            range.setStart(selection.anchorNode, selection.anchorOffset);\n            range.setEnd(selection.focusNode, selection.focusOffset);\n        }\n        catch {\n            // Safari sometimes gives us a selection that makes Range.set{Start,End} throw.\n            // See https://github.com/ckeditor/ckeditor5/issues/12375.\n            return false;\n        }\n        const backward = range.collapsed;\n        range.detach();\n        return backward;\n    }\n    /**\n     * Returns a parent {@link module:engine/view/uielement~ViewUIElement} or {@link module:engine/view/rawelement~ViewRawElement}\n     * that hosts the provided DOM node. Returns `null` if there is no such parent.\n     */\n    getHostViewElement(domNode) {\n        const ancestors = getAncestors(domNode);\n        // Remove domNode from the list.\n        ancestors.pop();\n        while (ancestors.length) {\n            const domNode = ancestors.pop();\n            const viewNode = this._domToViewMapping.get(domNode);\n            if (viewNode && (viewNode.is('uiElement') || viewNode.is('rawElement'))) {\n                return viewNode;\n            }\n        }\n        return null;\n    }\n    /**\n     * Checks if the given selection's boundaries are at correct places.\n     *\n     * The following places are considered as incorrect for selection boundaries:\n     *\n     * * before or in the middle of an inline filler sequence,\n     * * inside a DOM element which represents {@link module:engine/view/uielement~ViewUIElement a view UI element},\n     * * inside a DOM element which represents {@link module:engine/view/rawelement~ViewRawElement a view raw element}.\n     *\n     * @param domSelection The DOM selection object to be checked.\n     * @returns `true` if the given selection is at a correct place, `false` otherwise.\n     */\n    isDomSelectionCorrect(domSelection) {\n        return this._isDomSelectionPositionCorrect(domSelection.anchorNode, domSelection.anchorOffset) &&\n            this._isDomSelectionPositionCorrect(domSelection.focusNode, domSelection.focusOffset);\n    }\n    /**\n     * Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data\n     * and not processed during the conversion from DOM nodes to view elements.\n     *\n     * This is affecting how {@link module:engine/view/domconverter~ViewDomConverter#domToView} and\n     * {@link module:engine/view/domconverter~ViewDomConverter#domChildrenToView} process DOM nodes.\n     *\n     * The raw data can be later accessed by a\n     * {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `\"$rawContent\"`.\n     *\n     * @param pattern Pattern matching a view element whose content should\n     * be treated as raw data.\n     */\n    registerRawContentMatcher(pattern) {\n        this._rawContentElementMatcher.add(pattern);\n    }\n    /**\n     * Registers a {@link module:engine/view/matcher~MatcherPattern} for inline object view elements.\n     *\n     * This is affecting how {@link module:engine/view/domconverter~ViewDomConverter#domToView} and\n     * {@link module:engine/view/domconverter~ViewDomConverter#domChildrenToView} process DOM nodes.\n     *\n     * This is an extension of a simple {@link #inlineObjectElements} array of element names.\n     *\n     * @param pattern Pattern matching a view element which should be treated as an inline object.\n     */\n    registerInlineObjectMatcher(pattern) {\n        this._inlineObjectElementMatcher.add(pattern);\n    }\n    /**\n     * Clear temporary custom properties.\n     *\n     * @internal\n     */\n    _clearTemporaryCustomProperties() {\n        for (const element of this._elementsWithTemporaryCustomProperties) {\n            element._removeCustomProperty('editingPipeline:doNotReuseOnce');\n        }\n        this._elementsWithTemporaryCustomProperties.clear();\n    }\n    /**\n     * Returns the block {@link module:engine/view/filler filler} node based on the current {@link #blockFillerMode} setting.\n     */\n    _getBlockFiller() {\n        switch (this.blockFillerMode) {\n            case 'nbsp':\n                return NBSP_FILLER(this._domDocument); // eslint-disable-line new-cap\n            case 'markedNbsp':\n                return MARKED_NBSP_FILLER(this._domDocument); // eslint-disable-line new-cap\n            case 'br':\n                return BR_FILLER(this._domDocument); // eslint-disable-line new-cap\n        }\n    }\n    /**\n     * Checks if the given DOM position is a correct place for selection boundary. See {@link #isDomSelectionCorrect}.\n     *\n     * @param domParent Position parent.\n     * @param offset Position offset.\n     * @returns `true` if given position is at a correct place for selection boundary, `false` otherwise.\n     */\n    _isDomSelectionPositionCorrect(domParent, offset) {\n        // If selection is before or in the middle of inline filler string, it is incorrect.\n        if (isText(domParent) && startsWithFiller(domParent) && offset < INLINE_FILLER_LENGTH) {\n            // Selection in a text node, at wrong position (before or in the middle of filler).\n            return false;\n        }\n        if (this.isElement(domParent) && startsWithFiller(domParent.childNodes[offset])) {\n            // Selection in an element node, before filler text node.\n            return false;\n        }\n        const viewParent = this.mapDomToView(domParent);\n        // The position is incorrect when anchored inside a UIElement or a RawElement.\n        // Note: In case of UIElement and RawElement, mapDomToView() returns a parent element for any DOM child\n        // so there's no need to perform any additional checks.\n        if (viewParent && (viewParent.is('uiElement') || viewParent.is('rawElement'))) {\n            return false;\n        }\n        return true;\n    }\n    /**\n     * Internal generator for {@link #domToView}. Also used by {@link #domChildrenToView}.\n     * Separates DOM nodes conversion from whitespaces processing.\n     *\n     * @param domNode DOM node or document fragment to transform.\n     * @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.\n     * Used later to process whitespaces.\n     */\n    *_domToView(domNode, options, inlineNodes) {\n        // Special case for <p><br></p> in which <br> should be treated as filler even when we are not in the 'br' mode.\n        // See https://github.com/ckeditor/ckeditor5/issues/5564.\n        if (this.blockFillerMode != 'br' && isOnlyBrInBlock(domNode, this.blockElements)) {\n            return null;\n        }\n        // When node is inside a UIElement or a RawElement return that parent as it's view representation.\n        const hostElement = this.getHostViewElement(domNode);\n        if (hostElement) {\n            return hostElement;\n        }\n        if (isComment(domNode) && options.skipComments) {\n            return null;\n        }\n        if (isText(domNode)) {\n            if (isInlineFiller(domNode)) {\n                return null;\n            }\n            else {\n                const textData = domNode.data;\n                if (textData === '') {\n                    return null;\n                }\n                const textNode = new ViewText(this.document, textData);\n                inlineNodes.push(textNode);\n                return textNode;\n            }\n        }\n        else {\n            let viewElement = this.mapDomToView(domNode);\n            if (viewElement) {\n                if (this._isInlineObjectElement(viewElement)) {\n                    inlineNodes.push(viewElement);\n                }\n                return viewElement;\n            }\n            if (this.isDocumentFragment(domNode)) {\n                // Create view document fragment.\n                viewElement = new ViewDocumentFragment(this.document);\n                if (options.bind) {\n                    this.bindDocumentFragments(domNode, viewElement);\n                }\n            }\n            else {\n                // Create view element.\n                viewElement = this._createViewElement(domNode, options);\n                if (options.bind) {\n                    this.bindElements(domNode, viewElement);\n                }\n                // Copy element's attributes.\n                const attrs = domNode.attributes;\n                if (attrs) {\n                    for (let l = attrs.length, i = 0; i < l; i++) {\n                        viewElement._setAttribute(attrs[i].name, attrs[i].value);\n                    }\n                }\n                // Treat this element's content as a raw data if it was registered as such.\n                if (this._isViewElementWithRawContent(viewElement, options)) {\n                    viewElement._setCustomProperty('$rawContent', domNode.innerHTML);\n                    if (!this._isBlockViewElement(viewElement)) {\n                        inlineNodes.push(viewElement);\n                    }\n                    return viewElement;\n                }\n                // Comment node is also treated as an element with raw data.\n                if (isComment(domNode)) {\n                    viewElement._setCustomProperty('$rawContent', domNode.data);\n                    return viewElement;\n                }\n            }\n            // Yield the element first so the flow of nested inline nodes is not reversed inside elements.\n            yield viewElement;\n            const nestedInlineNodes = [];\n            if (options.withChildren !== false) {\n                for (const child of this.domChildrenToView(domNode, options, nestedInlineNodes)) {\n                    viewElement._appendChild(child);\n                }\n            }\n            // Check if this is an inline object after processing child nodes so matcher\n            // for inline objects can verify if the element is empty.\n            if (this._isInlineObjectElement(viewElement)) {\n                inlineNodes.push(viewElement);\n                // Inline object content should be handled as a flow-root.\n                this._processDomInlineNodes(null, nestedInlineNodes, options);\n            }\n            else {\n                // It's an inline element that is not an object (like <b>, <i>) or a block element.\n                for (const inlineNode of nestedInlineNodes) {\n                    inlineNodes.push(inlineNode);\n                }\n            }\n        }\n    }\n    /**\n     * Internal helper that walks the list of inline view nodes already generated from DOM nodes\n     * and handles whitespaces and NBSPs.\n     *\n     * @param domParent The DOM parent of the given inline nodes. This should be a document fragment or\n     * a block element to whitespace processing start cleaning.\n     * @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.\n     */\n    _processDomInlineNodes(domParent, inlineNodes, options) {\n        if (!inlineNodes.length) {\n            return;\n        }\n        // Process text nodes only after reaching a block or document fragment,\n        // do not alter whitespaces while processing an inline element like <b> or <i>.\n        if (domParent && !this.isDocumentFragment(domParent) && !this._isBlockDomElement(domParent)) {\n            return;\n        }\n        let prevNodeEndsWithSpace = false;\n        for (let i = 0; i < inlineNodes.length; i++) {\n            const node = inlineNodes[i];\n            if (!node.is('$text')) {\n                prevNodeEndsWithSpace = false;\n                continue;\n            }\n            let data;\n            let nodeEndsWithSpace = false;\n            if (this._isPreFormatted(node)) {\n                data = getDataWithoutFiller(node.data);\n            }\n            else {\n                // Change all consecutive whitespace characters (from the [ \\n\\t\\r] set –\n                // see https://github.com/ckeditor/ckeditor5-engine/issues/822#issuecomment-311670249) to a single space character.\n                // That's how multiple whitespaces are treated when rendered, so we normalize those whitespaces.\n                // We're replacing 1+ (and not 2+) to also normalize singular \\n\\t\\r characters (#822).\n                data = node.data.replace(/[ \\n\\t\\r]{1,}/g, ' ');\n                nodeEndsWithSpace = /[^\\S\\u00A0]/.test(data.charAt(data.length - 1));\n                const prevNode = i > 0 ? inlineNodes[i - 1] : null;\n                const nextNode = i + 1 < inlineNodes.length ? inlineNodes[i + 1] : null;\n                const shouldLeftTrim = !prevNode || prevNode.is('element') && prevNode.name == 'br' || prevNodeEndsWithSpace;\n                const shouldRightTrim = nextNode ? false : !startsWithFiller(node.data);\n                // Do not try to clear whitespaces if this is flat mapping for the purpose of mutation observer and differ in rendering.\n                if (options.withChildren !== false) {\n                    // If the previous dom text node does not exist or it ends by whitespace character, remove space character from the\n                    // beginning of this text node. Such space character is treated as a whitespace.\n                    if (shouldLeftTrim) {\n                        data = data.replace(/^ /, '');\n                    }\n                    // If the next text node does not exist remove space character from the end of this text node.\n                    if (shouldRightTrim) {\n                        data = data.replace(/ $/, '');\n                    }\n                }\n                // At the beginning and end of a block element, Firefox inserts normal space + <br> instead of non-breaking space.\n                // This means that the text node starts/end with normal space instead of non-breaking space.\n                // This causes a problem because the normal space would be removed in `.replace` calls above. To prevent that,\n                // the inline filler is removed only after the data is initially processed (by the `.replace` above). See ckeditor5#692.\n                data = getDataWithoutFiller(data);\n                // Block filler handling.\n                if (this.blockFillerMode != 'br' && node.parent) {\n                    if (isViewMarkedNbspFiller(node.parent, data)) {\n                        data = '';\n                        // Mark block element as it has a block filler and remove the `<span data-cke-filler=\"true\">` element.\n                        if (node.parent.parent) {\n                            node.parent.parent._setCustomProperty('$hasBlockFiller', true);\n                            node.parent._remove();\n                        }\n                    }\n                    else if (isViewNbspFiller(node.parent, data, this.blockElements)) {\n                        data = '';\n                        node.parent._setCustomProperty('$hasBlockFiller', true);\n                    }\n                }\n                // At this point we should have removed all whitespaces from DOM text data.\n                //\n                // Now, We will reverse the process that happens in `_processDataFromViewText`.\n                //\n                // We have to change &nbsp; chars, that were in DOM text data because of rendering reasons, to spaces.\n                // First, change all ` \\u00A0` pairs (space + &nbsp;) to two spaces. DOM converter changes two spaces from model/view to\n                // ` \\u00A0` to ensure proper rendering. Since here we convert back, we recognize those pairs and change them back to `  `.\n                data = data.replace(/ \\u00A0/g, '  ');\n                const isNextNodeInlineObjectElement = nextNode && nextNode.is('element') && nextNode.name != 'br';\n                const isNextNodeStartingWithSpace = nextNode && nextNode.is('$text') && nextNode.data.charAt(0) == ' ';\n                // Then, let's change the last nbsp to a space.\n                if (/[ \\u00A0]\\u00A0$/.test(data) || !nextNode || isNextNodeInlineObjectElement || isNextNodeStartingWithSpace) {\n                    data = data.replace(/\\u00A0$/, ' ');\n                }\n                // Then, change &nbsp; character that is at the beginning of the text node to space character.\n                // We do that replacement only if this is the first node or the previous node ends on whitespace character.\n                if (shouldLeftTrim || prevNode && prevNode.is('element') && prevNode.name != 'br') {\n                    data = data.replace(/^\\u00A0/, ' ');\n                }\n            }\n            // At this point, all whitespaces should be removed and all &nbsp; created for rendering reasons should be\n            // changed to normal space. All left &nbsp; are &nbsp; inserted intentionally.\n            if (data.length == 0 && node.parent) {\n                node._remove();\n                inlineNodes.splice(i, 1);\n                i--;\n            }\n            else {\n                node._data = data;\n                prevNodeEndsWithSpace = nodeEndsWithSpace;\n            }\n        }\n        inlineNodes.length = 0;\n    }\n    /**\n     * Takes text data from a given {@link module:engine/view/text~ViewText#data} and processes it so\n     * it is correctly displayed in the DOM.\n     *\n     * Following changes are done:\n     *\n     * * a space at the beginning is changed to `&nbsp;` if this is the first text node in its container\n     * element or if a previous text node ends with a space character,\n     * * space at the end of the text node is changed to `&nbsp;` if there are two spaces at the end of a node or if next node\n     * starts with a space or if it is the last text node in its container,\n     * * remaining spaces are replaced to a chain of spaces and `&nbsp;` (e.g. `'x   x'` becomes `'x &nbsp; x'`).\n     *\n     * Content of {@link #preElements} is not processed.\n     *\n     * @param node View text node to process.\n     * @returns Processed text data.\n     */\n    _processDataFromViewText(node) {\n        let data = node.data;\n        // If the currently processed view text node is preformatted, we should not change whitespaces.\n        if (this._isPreFormatted(node)) {\n            return data;\n        }\n        // 1. Replace the first space with a nbsp if the previous node ends with a space or there is no previous node\n        // (container element boundary).\n        if (data.charAt(0) == ' ') {\n            const prevNode = this._getTouchingInlineViewNode(node, false);\n            const prevEndsWithSpace = prevNode && prevNode.is('$textProxy') && this._nodeEndsWithSpace(prevNode);\n            if (prevEndsWithSpace || !prevNode) {\n                data = '\\u00A0' + data.substr(1);\n            }\n        }\n        // 2. Replace the last space with nbsp if there are two spaces at the end or if the next node starts with space or there is no\n        // next node (container element boundary).\n        //\n        // Keep in mind that Firefox prefers $nbsp; before tag, not inside it:\n        //\n        // Foo <span>&nbsp;bar</span>  <-- bad.\n        // Foo&nbsp;<span> bar</span>  <-- good.\n        //\n        // More here: https://github.com/ckeditor/ckeditor5-engine/issues/1747.\n        if (data.charAt(data.length - 1) == ' ') {\n            const nextNode = this._getTouchingInlineViewNode(node, true);\n            const nextStartsWithSpace = nextNode && nextNode.is('$textProxy') && nextNode.data.charAt(0) == ' ';\n            if (data.charAt(data.length - 2) == ' ' || !nextNode || nextStartsWithSpace) {\n                data = data.substr(0, data.length - 1) + '\\u00A0';\n            }\n        }\n        // 3. Create space+nbsp pairs.\n        return data.replace(/ {2}/g, ' \\u00A0');\n    }\n    /**\n     * Checks whether given node ends with a space character after changing appropriate space characters to `&nbsp;`s.\n     *\n     * @param  node Node to check.\n     * @returns `true` if given `node` ends with space, `false` otherwise.\n     */\n    _nodeEndsWithSpace(node) {\n        if (this._isPreFormatted(node)) {\n            return false;\n        }\n        const data = this._processDataFromViewText(node);\n        return data.charAt(data.length - 1) == ' ';\n    }\n    /**\n     * Checks whether given text contains preformatted white space. This is the case if\n     * * any of node ancestors has a name which is in `preElements` array, or\n     * * the closest ancestor that has the `white-space` CSS property sets it to a value that preserves spaces\n     *\n     * @param node Node to check\n     * @returns `true` if given node contains preformatted white space, `false` otherwise.\n     */\n    _isPreFormatted(node) {\n        if (_hasViewParentOfType(node, this.preElements)) {\n            return true;\n        }\n        for (const ancestor of node.getAncestors({ parentFirst: true })) {\n            if (!ancestor.is('element') || !ancestor.hasStyle('white-space') || ancestor.getStyle('white-space') === 'inherit') {\n                continue;\n            }\n            // If the node contains the `white-space` property with a value that does not preserve spaces, it will take\n            // precedence over any white-space settings its ancestors contain, so no further parent checking needs to\n            // be done.\n            return ['pre', 'pre-wrap', 'break-spaces'].includes(ancestor.getStyle('white-space'));\n        }\n        return false;\n    }\n    /**\n     * Helper function. For given {@link module:engine/view/text~ViewText view text node}, it finds previous or next sibling\n     * that is contained in the same container element. If there is no such sibling, `null` is returned.\n     *\n     * @param node Reference node.\n     * @returns Touching text node, an inline object\n     * or `null` if there is no next or previous touching text node.\n     */\n    _getTouchingInlineViewNode(node, getNext) {\n        const treeWalker = new ViewTreeWalker({\n            startPosition: getNext ? ViewPosition._createAfter(node) : ViewPosition._createBefore(node),\n            direction: getNext ? 'forward' : 'backward'\n        });\n        for (const { item } of treeWalker) {\n            // Found a text node in the same container element.\n            if (item.is('$textProxy')) {\n                return item;\n            }\n            // Found a transparent element, skip it and continue inside it.\n            else if (item.is('element') && item.getCustomProperty('dataPipeline:transparentRendering')) {\n                continue;\n            }\n            // <br> found – it works like a block boundary, so do not scan further.\n            else if (item.is('element', 'br')) {\n                return null;\n            }\n            // Found an inline object (for example an image).\n            else if (this._isInlineObjectElement(item)) {\n                return item;\n            }\n            // ViewContainerElement is found on a way to next ViewText node, so given `node` was first/last\n            // text node in its container element.\n            // The ol, ul, and li elements are rendered as an attribute element so we should check list of known block elements.\n            // See: https://github.com/ckeditor/ckeditor5/issues/18960.\n            else if (item.is('containerElement') || this._isBlockViewElement(item)) {\n                return null;\n            }\n        }\n        return null;\n    }\n    /**\n     * Returns `true` if a DOM node belongs to {@link #blockElements}. `false` otherwise.\n     */\n    _isBlockDomElement(node) {\n        return this.isElement(node) && this.blockElements.includes(node.tagName.toLowerCase());\n    }\n    /**\n     * Returns `true` if a view node belongs to {@link #blockElements}. `false` otherwise.\n     */\n    _isBlockViewElement(node) {\n        return node.is('element') && this.blockElements.includes(node.name);\n    }\n    /**\n     * Returns `true` if a DOM node belongs to {@link #inlineObjectElements}. `false` otherwise.\n     */\n    _isInlineObjectElement(node) {\n        if (!node.is('element')) {\n            return false;\n        }\n        return node.name == 'br' ||\n            this.inlineObjectElements.includes(node.name) ||\n            !!this._inlineObjectElementMatcher.match(node);\n    }\n    /**\n     * Creates view element basing on the node type.\n     *\n     * @param node DOM node to check.\n     * @param options Conversion options. See {@link module:engine/view/domconverter~ViewDomConverter#domToView} options parameter.\n     */\n    _createViewElement(node, options) {\n        if (isComment(node)) {\n            return new ViewUIElement(this.document, '$comment');\n        }\n        const viewName = options.keepOriginalCase ? node.tagName : node.tagName.toLowerCase();\n        return new ViewElement(this.document, viewName);\n    }\n    /**\n     * Checks if view element's content should be treated as a raw data.\n     *\n     * @param viewElement View element to check.\n     * @param options Conversion options. See {@link module:engine/view/domconverter~ViewDomConverter#domToView} options parameter.\n     */\n    _isViewElementWithRawContent(viewElement, options) {\n        return options.withChildren !== false && viewElement.is('element') && !!this._rawContentElementMatcher.match(viewElement);\n    }\n    /**\n     * Checks whether a given element name should be renamed in a current rendering mode.\n     *\n     * @param elementName The name of view element.\n     */\n    _shouldRenameElement(elementName) {\n        const name = elementName.toLowerCase();\n        return this.renderingMode === 'editing' && this.unsafeElements.includes(name);\n    }\n    /**\n     * Return a <span> element with a special attribute holding the name of the original element.\n     * Optionally, copy all the attributes of the original element if that element is provided.\n     *\n     * @param elementName The name of view element.\n     * @param originalDomElement The original DOM element to copy attributes and content from.\n     */\n    _createReplacementDomElement(elementName, originalDomElement) {\n        const newDomElement = this._domDocument.createElement('span');\n        // Mark the span replacing a script as hidden.\n        newDomElement.setAttribute(UNSAFE_ELEMENT_REPLACEMENT_ATTRIBUTE, elementName);\n        if (originalDomElement) {\n            while (originalDomElement.firstChild) {\n                newDomElement.appendChild(originalDomElement.firstChild);\n            }\n            for (const attributeName of originalDomElement.getAttributeNames()) {\n                newDomElement.setAttribute(attributeName, originalDomElement.getAttribute(attributeName));\n            }\n        }\n        return newDomElement;\n    }\n}\n/**\n * Helper function.\n * Used to check if given native `Element` or `Text` node has parent with tag name from `types` array.\n *\n * @returns`true` if such parent exists or `false` if it does not.\n */\nfunction _hasViewParentOfType(node, types) {\n    return node.getAncestors().some(parent => parent.is('element') && types.includes(parent.name));\n}\n/**\n * A helper that executes given callback for each DOM node's ancestor, starting from the given node\n * and ending in document#documentElement.\n *\n * @param callback A callback to be executed for each ancestor.\n */\nfunction forEachDomElementAncestor(element, callback) {\n    let node = element;\n    while (node) {\n        callback(node);\n        node = node.parentElement;\n    }\n}\n/**\n * Checks if given DOM node is a nbsp block filler.\n *\n * A &nbsp; is a block filler only if it is a single child of a block element.\n *\n * @param domNode DOM node.\n */\nfunction isNbspBlockFiller(domNode, blockElements) {\n    const isNBSP = domNode.isEqualNode(NBSP_FILLER_REF);\n    return isNBSP && hasBlockParent(domNode, blockElements) && domNode.parentNode.childNodes.length === 1;\n}\n/**\n * Checks if domNode has block parent.\n *\n * @param domNode DOM node.\n */\nfunction hasBlockParent(domNode, blockElements) {\n    const parent = domNode.parentNode;\n    return !!parent && !!parent.tagName && blockElements.includes(parent.tagName.toLowerCase());\n}\n/**\n * Checks if given view node is a nbsp block filler.\n *\n * A &nbsp; is a block filler only if it is a single child of a block element.\n */\nfunction isViewNbspFiller(parent, data, blockElements) {\n    return (data == '\\u00A0' &&\n        parent &&\n        parent.is('element') &&\n        parent.childCount == 1 &&\n        blockElements.includes(parent.name));\n}\n/**\n * Checks if given view node is a marked-nbsp block filler.\n *\n * A &nbsp; is a block filler only if it is wrapped in `<span data-cke-filler=\"true\">` element.\n */\nfunction isViewMarkedNbspFiller(parent, data) {\n    return (data == '\\u00A0' &&\n        parent &&\n        parent.is('element', 'span') &&\n        parent.childCount == 1 &&\n        parent.hasAttribute('data-cke-filler'));\n}\n/**\n * Checks if given view node is a br block filler.\n *\n * A <br> is a block filler only if it has data-cke-filler attribute set.\n */\nfunction isViewBrFiller(node) {\n    return (node.is('element', 'br') &&\n        node.hasAttribute('data-cke-filler'));\n}\n/**\n * Special case for `<p><br></p>` in which `<br>` should be treated as filler even when we are not in the 'br' mode.\n */\nfunction isOnlyBrInBlock(domNode, blockElements) {\n    // See https://github.com/ckeditor/ckeditor5/issues/5564.\n    return (domNode.tagName === 'BR' &&\n        hasBlockParent(domNode, blockElements) &&\n        domNode.parentNode.childNodes.length === 1);\n}\n/**\n * Log to console the information about element that was replaced.\n * Check UNSAFE_ELEMENTS for all recognized unsafe elements.\n *\n * @param elementName The name of the view element.\n */\nfunction _logUnsafeElement(elementName) {\n    if (elementName === 'script') {\n        logWarning('domconverter-unsafe-script-element-detected');\n    }\n    if (elementName === 'style') {\n        logWarning('domconverter-unsafe-style-element-detected');\n    }\n}\n/**\n * In certain cases, Firefox mysteriously assigns so called \"restricted objects\" to native DOM Range properties.\n * Any attempt at accessing restricted object's properties causes errors.\n * See: https://github.com/ckeditor/ckeditor5/issues/9635.\n */\nfunction isGeckoRestrictedDomSelection(domSelection) {\n    if (!env.isGecko) {\n        return false;\n    }\n    if (!domSelection.rangeCount) {\n        return false;\n    }\n    const container = domSelection.getRangeAt(0).startContainer;\n    try {\n        Object.prototype.toString.call(container);\n    }\n    catch {\n        return true;\n    }\n    return false;\n}\n/**\n * While rendering the editor content, the {@link module:engine/view/domconverter~ViewDomConverter} detected a `<script>` element that may\n * disrupt the editing experience. To avoid this, the `<script>` element was replaced with `<span data-ck-unsafe-element=\"script\"></span>`.\n *\n * @error domconverter-unsafe-script-element-detected\n */\n/**\n * While rendering the editor content, the\n * {@link module:engine/view/domconverter~ViewDomConverter} detected a `<style>` element that may affect\n * the editing experience. To avoid this, the `<style>` element was replaced with `<span data-ck-unsafe-element=\"style\"></span>`.\n *\n * @error domconverter-unsafe-style-element-detected\n */\n/**\n * The {@link module:engine/view/domconverter~ViewDomConverter} detected an interactive attribute in the\n * {@glink framework/architecture/editing-engine#editing-pipeline editing pipeline}. For the best\n * editing experience, the attribute was renamed to `data-ck-unsafe-attribute-[original attribute name]`.\n *\n * If you are the author of the plugin that generated this attribute and you want it to be preserved\n * in the editing pipeline, you can configure this when creating the element\n * using {@link module:engine/view/downcastwriter~ViewDowncastWriter} during the\n * {@glink framework/architecture/editing-engine#conversion model–view conversion}. Methods such as\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement},\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement}, or\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEmptyElement}\n * accept an option that will disable filtering of specific attributes:\n *\n * ```ts\n * const paragraph = writer.createContainerElement( 'p',\n * \t{\n * \t\tclass: 'clickable-paragraph',\n * \t\tonclick: 'alert( \"Paragraph clicked!\" )'\n * \t},\n * \t{\n * \t\t// Make sure the \"onclick\" attribute will pass through.\n * \t\trenderUnsafeAttributes: [ 'onclick' ]\n * \t}\n * );\n * ```\n *\n * @error domconverter-unsafe-attribute-detected\n * @param {HTMLElement} domElement The DOM element the attribute was set on.\n * @param {string} key The original name of the attribute\n * @param {string} value The value of the original attribute\n */\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/getancestors\n */\n/**\n * Returns all ancestors of given DOM node, starting from the top-most (root). Includes the given node itself. If the\n * node is a part of `DocumentFragment` that `DocumentFragment` will be returned. In contrary, if the node is\n * appended to a `Document`, that `Document` will not be returned (algorithms operating on DOM tree care for `Document#documentElement`\n * at most, which will be returned).\n *\n * @param node DOM node.\n * @returns Array of given `node` parents.\n */\nexport function getAncestors(node) {\n    const nodes = [];\n    let currentNode = node;\n    // We are interested in `Node`s `DocumentFragment`s only.\n    while (currentNode && currentNode.nodeType != Node.DOCUMENT_NODE) {\n        nodes.unshift(currentNode);\n        currentNode = currentNode.parentNode;\n    }\n    return nodes;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/observer\n */\nimport { DomEmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Abstract base observer class. Observers are classes which listen to DOM events, do the preliminary\n * processing and fire events on the {@link module:engine/view/document~ViewDocument} objects.\n * Observers can also add features to the view, for instance by updating its status or marking elements\n * which need a refresh on DOM events.\n */\nexport class Observer extends /* #__PURE__ */ DomEmitterMixin() {\n    /**\n     * An instance of the view controller.\n     */\n    view;\n    /**\n     * A reference to the {@link module:engine/view/document~ViewDocument} object.\n     */\n    document;\n    /**\n     * The state of the observer. If it is disabled, no events will be fired.\n     */\n    _isEnabled = false;\n    /**\n     * Creates an instance of the observer.\n     */\n    constructor(view) {\n        super();\n        this.view = view;\n        this.document = view.document;\n    }\n    /**\n     * The state of the observer. If it is disabled, no events will be fired.\n     */\n    get isEnabled() {\n        return this._isEnabled;\n    }\n    /**\n     * Enables the observer. This method is called when the observer is registered to the\n     * {@link module:engine/view/view~EditingView} and after {@link module:engine/view/view~EditingView#forceRender rendering}\n     * (all observers are {@link #disable disabled} before rendering).\n     *\n     * A typical use case for disabling observers is that mutation observers need to be disabled for the rendering.\n     * However, a child class may not need to be disabled, so it can implement an empty method.\n     *\n     * @see module:engine/view/observer/observer~Observer#disable\n     */\n    enable() {\n        this._isEnabled = true;\n    }\n    /**\n     * Disables the observer. This method is called before\n     * {@link module:engine/view/view~EditingView#forceRender rendering} to prevent firing events during rendering.\n     *\n     * @see module:engine/view/observer/observer~Observer#enable\n     */\n    disable() {\n        this._isEnabled = false;\n    }\n    /**\n     * Disables and destroys the observer, among others removes event listeners created by the observer.\n     */\n    destroy() {\n        this.disable();\n        this.stopListening();\n    }\n    /**\n     * Checks whether a given DOM event should be ignored (should not be turned into a synthetic view document event).\n     *\n     * Currently, an event will be ignored only if its target or any of its ancestors has the `data-cke-ignore-events` attribute.\n     * This attribute can be used inside the structures generated by\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `ViewDowncastWriter#createUIElement()`} to ignore events\n     * fired within a UI that should be excluded from CKEditor 5's realms.\n     *\n     * @param domTarget The DOM event target to check (usually an element, sometimes a text node and\n     * potentially sometimes a document, too).\n     * @returns Whether this event should be ignored by the observer.\n     */\n    checkShouldIgnoreEventFromTarget(domTarget) {\n        if (domTarget && domTarget.nodeType === 3) {\n            domTarget = domTarget.parentNode;\n        }\n        if (!domTarget || domTarget.nodeType !== 1) {\n            return false;\n        }\n        return domTarget.matches('[data-cke-ignore-events], [data-cke-ignore-events] *');\n    }\n}\n","import { toInteger } from './toInteger.mjs';\n\nfunction times(n, getValue) {\n    n = toInteger(n);\n    if (n < 1 || !Number.isSafeInteger(n)) {\n        return [];\n    }\n    const result = new Array(n);\n    for (let i = 0; i < n; i++) {\n        result[i] = typeof getValue === 'function' ? getValue(i) : i;\n    }\n    return result;\n}\n\nexport { times };\n","import { toFinite } from './toFinite.mjs';\n\nfunction toInteger(value) {\n    const finite = toFinite(value);\n    const remainder = finite % 1;\n    return remainder ? finite - remainder : finite;\n}\n\nexport { toInteger };\n","import { toNumber } from './toNumber.mjs';\n\nfunction toFinite(value) {\n    if (!value) {\n        return value === 0 ? value : 0;\n    }\n    value = toNumber(value);\n    if (value === Infinity || value === -Infinity) {\n        const sign = value < 0 ? -1 : 1;\n        return sign * Number.MAX_VALUE;\n    }\n    return value === value ? value : 0;\n}\n\nexport { toFinite };\n","import { isSymbol } from '../predicate/isSymbol.mjs';\n\nfunction toNumber(value) {\n    if (isSymbol(value)) {\n        return NaN;\n    }\n    return Number(value);\n}\n\nexport { toNumber };\n","import { isBuffer } from '../../predicate/isBuffer.mjs';\nimport { isPrototype } from '../_internal/isPrototype.mjs';\nimport { isArrayLike } from '../predicate/isArrayLike.mjs';\nimport { isTypedArray } from '../predicate/isTypedArray.mjs';\nimport { times } from '../util/times.mjs';\n\nfunction keysIn(object) {\n    if (object == null) {\n        return [];\n    }\n    switch (typeof object) {\n        case 'object':\n        case 'function': {\n            if (isArrayLike(object)) {\n                return arrayLikeKeysIn(object);\n            }\n            if (isPrototype(object)) {\n                return prototypeKeysIn(object);\n            }\n            return keysInImpl(object);\n        }\n        default: {\n            return keysInImpl(Object(object));\n        }\n    }\n}\nfunction keysInImpl(object) {\n    const result = [];\n    for (const key in object) {\n        result.push(key);\n    }\n    return result;\n}\nfunction prototypeKeysIn(object) {\n    const keys = keysInImpl(object);\n    return keys.filter(key => key !== 'constructor');\n}\nfunction arrayLikeKeysIn(object) {\n    const indices = times(object.length, index => `${index}`);\n    const filteredKeys = new Set(indices);\n    if (isBuffer(object)) {\n        filteredKeys.add('offset');\n        filteredKeys.add('parent');\n    }\n    if (isTypedArray(object)) {\n        filteredKeys.add('buffer');\n        filteredKeys.add('byteLength');\n        filteredKeys.add('byteOffset');\n    }\n    return [...indices, ...keysInImpl(object).filter(key => !filteredKeys.has(key))];\n}\n\nexport { keysIn };\n","import { isLength } from '../../predicate/isLength.mjs';\n\nfunction isArrayLike(value) {\n    return value != null && typeof value !== 'function' && isLength(value.length);\n}\n\nexport { isArrayLike };\n","function isLength(value) {\n    return Number.isSafeInteger(value) && value >= 0;\n}\n\nexport { isLength };\n","function isBuffer(x) {\n    return typeof Buffer !== 'undefined' && Buffer.isBuffer(x);\n}\n\nexport { isBuffer };\n","function isPrototype(value) {\n    const constructor = value?.constructor;\n    const prototype = typeof constructor === 'function' ? constructor.prototype : Object.prototype;\n    return value === prototype;\n}\n\nexport { isPrototype };\n","import { keysIn } from './keysIn.mjs';\nimport { eq } from '../util/eq.mjs';\n\nfunction assignIn(object, ...sources) {\n    for (let i = 0; i < sources.length; i++) {\n        assignInImpl(object, sources[i]);\n    }\n    return object;\n}\nfunction assignInImpl(object, source) {\n    const keys = keysIn(source);\n    for (let i = 0; i < keys.length; i++) {\n        const key = keys[i];\n        if (!(key in object) || !eq(object[key], source[key])) {\n            object[key] = source[key];\n        }\n    }\n}\n\nexport { assignIn };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/domeventdata\n */\nimport { extend } from 'es-toolkit/compat';\n/**\n * Information about a DOM event in context of the {@link module:engine/view/document~ViewDocument}.\n * It wraps the native event, which usually should not be used as the wrapper contains\n * additional data (like key code for keyboard events).\n *\n * @typeParam TEvent The type of DOM Event that this class represents.\n */\nexport class ViewDocumentDomEventData {\n    /**\n     * Instance of the view controller.\n     */\n    view;\n    /**\n     * The instance of the document.\n     */\n    document;\n    /**\n     * The DOM event.\n     */\n    domEvent;\n    /**\n     * The DOM target.\n     */\n    domTarget;\n    /**\n     * @param view The instance of the view controller.\n     * @param domEvent The DOM event.\n     * @param additionalData Additional properties that the instance should contain.\n     */\n    constructor(view, domEvent, additionalData) {\n        this.view = view;\n        this.document = view.document;\n        this.domEvent = domEvent;\n        this.domTarget = domEvent.target;\n        extend(this, additionalData);\n    }\n    /**\n     * The tree view element representing the target.\n     */\n    get target() {\n        return this.view.domConverter.mapDomToView(this.domTarget);\n    }\n    /**\n     * Prevents the native's event default action.\n     */\n    preventDefault() {\n        this.domEvent.preventDefault();\n    }\n    /**\n     * Stops native event propagation.\n     */\n    stopPropagation() {\n        this.domEvent.stopPropagation();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/domeventobserver\n */\nimport { Observer } from './observer.js';\nimport { ViewDocumentDomEventData } from './domeventdata.js';\n/**\n * Base class for DOM event observers. This class handles\n * {@link module:engine/view/observer/observer~Observer#observe adding} listeners to DOM elements,\n * {@link module:engine/view/observer/observer~Observer#disable disabling} and\n * {@link module:engine/view/observer/observer~Observer#enable re-enabling} events.\n * Child class needs to define\n * {@link module:engine/view/observer/domeventobserver~DomEventObserver#domEventType DOM event type} and\n * {@link module:engine/view/observer/domeventobserver~DomEventObserver#onDomEvent callback}.\n *\n * For instance:\n *\n * ```ts\n * class ClickObserver extends DomEventObserver<'click'> {\n * \t// It can also be defined as a normal property in the constructor.\n * \tget domEventType(): 'click' {\n * \t\treturn 'click';\n * \t}\n *\n * \tonDomEvent( domEvent: MouseEvent ): void {\n * \t\tthis.fire( 'click', domEvent );\n * \t}\n * }\n * ```\n *\n * @typeParam EventType DOM Event type name or an union of those.\n * @typeParam AdditionalData Additional data passed along with the event.\n */\nexport class DomEventObserver extends Observer {\n    /**\n     * If set to `true` DOM events will be listened on the capturing phase.\n     * Default value is `false`.\n     */\n    useCapture = false;\n    /**\n     * If set to `true`, indicates that the function specified by listener will never call `preventDefault()`.\n     * Default value is `false`.\n     */\n    usePassive = false;\n    /**\n     * @inheritDoc\n     */\n    observe(domElement) {\n        const types = typeof this.domEventType == 'string' ? [this.domEventType] : this.domEventType;\n        types.forEach(type => {\n            this.listenTo(domElement, type, (eventInfo, domEvent) => {\n                if (this.isEnabled && !this.checkShouldIgnoreEventFromTarget(domEvent.target)) {\n                    this.onDomEvent(domEvent);\n                }\n            }, { useCapture: this.useCapture, usePassive: this.usePassive });\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    stopObserving(domElement) {\n        this.stopListening(domElement);\n    }\n    /**\n     * Calls `Document#fire()` if observer {@link #isEnabled is enabled}.\n     *\n     * @see module:utils/emittermixin~Emitter#fire\n     * @param eventType The event type (name).\n     * @param domEvent The DOM event.\n     * @param additionalData The additional data which should extend the\n     * {@link module:engine/view/observer/domeventdata~ViewDocumentDomEventData event data} object.\n     */\n    fire(eventType, domEvent, additionalData) {\n        if (this.isEnabled) {\n            this.document.fire(eventType, new ViewDocumentDomEventData(this.view, domEvent, additionalData));\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/keyobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\nimport { getCode } from '@ckeditor/ckeditor5-utils';\n/**\n * Observer for events connected with pressing keyboard keys.\n *\n * Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.\n */\nexport class KeyObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['keydown', 'keyup'];\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvt) {\n        const data = {\n            keyCode: domEvt.keyCode,\n            altKey: domEvt.altKey,\n            ctrlKey: domEvt.ctrlKey,\n            shiftKey: domEvt.shiftKey,\n            metaKey: domEvt.metaKey,\n            get keystroke() {\n                return getCode(this);\n            }\n        };\n        this.fire(domEvt.type, domEvt, data);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/fakeselectionobserver\n */\nimport { Observer } from './observer.js';\nimport { ViewSelection } from '../selection.js';\nimport { keyCodes } from '@ckeditor/ckeditor5-utils';\nimport { debounce } from 'es-toolkit/compat';\n/**\n * Fake selection observer class. If view selection is fake it is placed in dummy DOM container. This observer listens\n * on {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and handles moving\n * fake view selection to the correct place if arrow keys are pressed.\n * Fires {@link module:engine/view/document~ViewDocument#event:selectionChange selectionChange event} simulating natural behaviour of\n * {@link module:engine/view/observer/selectionobserver~SelectionObserver SelectionObserver}.\n */\nexport class FakeSelectionObserver extends Observer {\n    /**\n     * Fires debounced event `selectionChangeDone`. It uses `es-toolkit#debounce` method to delay function call.\n     */\n    _fireSelectionChangeDoneDebounced;\n    /**\n     * Creates new FakeSelectionObserver instance.\n     */\n    constructor(view) {\n        super(view);\n        this._fireSelectionChangeDoneDebounced = debounce(data => {\n            this.document.fire('selectionChangeDone', data);\n        }, 200);\n    }\n    /**\n     * @inheritDoc\n     */\n    observe() {\n        const document = this.document;\n        document.on('arrowKey', (eventInfo, data) => {\n            const selection = document.selection;\n            if (selection.isFake && this.isEnabled) {\n                // Prevents default key down handling - no selection change will occur.\n                data.preventDefault();\n            }\n        }, { context: '$capture' });\n        document.on('arrowKey', (eventInfo, data) => {\n            const selection = document.selection;\n            if (selection.isFake && this.isEnabled) {\n                this._handleSelectionMove(data.keyCode);\n            }\n        }, { priority: 'lowest' });\n    }\n    /**\n     * @inheritDoc\n     */\n    stopObserving() { }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._fireSelectionChangeDoneDebounced.cancel();\n    }\n    /**\n     * Handles collapsing view selection according to given key code. If left or up key is provided - new selection will be\n     * collapsed to left. If right or down key is pressed - new selection will be collapsed to right.\n     *\n     * This method fires {@link module:engine/view/document~ViewDocument#event:selectionChange} and\n     * {@link module:engine/view/document~ViewDocument#event:selectionChangeDone} events imitating behaviour of\n     * {@link module:engine/view/observer/selectionobserver~SelectionObserver}.\n     */\n    _handleSelectionMove(keyCode) {\n        const selection = this.document.selection;\n        const newSelection = new ViewSelection(selection.getRanges(), { backward: selection.isBackward, fake: false });\n        // Left or up arrow pressed - move selection to start.\n        if (keyCode == keyCodes.arrowleft || keyCode == keyCodes.arrowup) {\n            newSelection.setTo(newSelection.getFirstPosition());\n        }\n        // Right or down arrow pressed - move selection to end.\n        if (keyCode == keyCodes.arrowright || keyCode == keyCodes.arrowdown) {\n            newSelection.setTo(newSelection.getLastPosition());\n        }\n        const data = {\n            oldSelection: selection,\n            newSelection,\n            domSelection: null\n        };\n        // Fire dummy selection change event.\n        this.document.fire('selectionChange', data);\n        // Call` #_fireSelectionChangeDoneDebounced` every time when `selectionChange` event is fired.\n        // This function is debounced what means that `selectionChangeDone` event will be fired only when\n        // defined int the function time will elapse since the last time the function was called.\n        // So `selectionChangeDone` will be fired when selection will stop changing.\n        this._fireSelectionChangeDoneDebounced(data);\n    }\n}\n","function isPlainObject(value) {\n    if (!value || typeof value !== 'object') {\n        return false;\n    }\n    const proto = Object.getPrototypeOf(value);\n    const hasObjectPrototype = proto === null ||\n        proto === Object.prototype ||\n        Object.getPrototypeOf(proto) === null;\n    if (!hasObjectPrototype) {\n        return false;\n    }\n    return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","import { isPlainObject } from './isPlainObject.mjs';\nimport { getSymbols } from '../compat/_internal/getSymbols.mjs';\nimport { getTag } from '../compat/_internal/getTag.mjs';\nimport { functionTag, regexpTag, symbolTag, dateTag, booleanTag, numberTag, stringTag, objectTag, errorTag, dataViewTag, arrayBufferTag, float64ArrayTag, float32ArrayTag, bigInt64ArrayTag, int32ArrayTag, int16ArrayTag, int8ArrayTag, bigUint64ArrayTag, uint32ArrayTag, uint16ArrayTag, uint8ClampedArrayTag, uint8ArrayTag, arrayTag, setTag, mapTag, argumentsTag } from '../compat/_internal/tags.mjs';\nimport { eq } from '../compat/util/eq.mjs';\n\nfunction isEqualWith(a, b, areValuesEqual) {\n    return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);\n}\nfunction isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {\n    const result = areValuesEqual(a, b, property, aParent, bParent, stack);\n    if (result !== undefined) {\n        return result;\n    }\n    if (typeof a === typeof b) {\n        switch (typeof a) {\n            case 'bigint':\n            case 'string':\n            case 'boolean':\n            case 'symbol':\n            case 'undefined': {\n                return a === b;\n            }\n            case 'number': {\n                return a === b || Object.is(a, b);\n            }\n            case 'function': {\n                return a === b;\n            }\n            case 'object': {\n                return areObjectsEqual(a, b, stack, areValuesEqual);\n            }\n        }\n    }\n    return areObjectsEqual(a, b, stack, areValuesEqual);\n}\nfunction areObjectsEqual(a, b, stack, areValuesEqual) {\n    if (Object.is(a, b)) {\n        return true;\n    }\n    let aTag = getTag(a);\n    let bTag = getTag(b);\n    if (aTag === argumentsTag) {\n        aTag = objectTag;\n    }\n    if (bTag === argumentsTag) {\n        bTag = objectTag;\n    }\n    if (aTag !== bTag) {\n        return false;\n    }\n    switch (aTag) {\n        case stringTag:\n            return a.toString() === b.toString();\n        case numberTag: {\n            const x = a.valueOf();\n            const y = b.valueOf();\n            return eq(x, y);\n        }\n        case booleanTag:\n        case dateTag:\n        case symbolTag:\n            return Object.is(a.valueOf(), b.valueOf());\n        case regexpTag: {\n            return a.source === b.source && a.flags === b.flags;\n        }\n        case functionTag: {\n            return a === b;\n        }\n    }\n    stack = stack ?? new Map();\n    const aStack = stack.get(a);\n    const bStack = stack.get(b);\n    if (aStack != null && bStack != null) {\n        return aStack === b;\n    }\n    stack.set(a, b);\n    stack.set(b, a);\n    try {\n        switch (aTag) {\n            case mapTag: {\n                if (a.size !== b.size) {\n                    return false;\n                }\n                for (const [key, value] of a.entries()) {\n                    if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            case setTag: {\n                if (a.size !== b.size) {\n                    return false;\n                }\n                const aValues = Array.from(a.values());\n                const bValues = Array.from(b.values());\n                for (let i = 0; i < aValues.length; i++) {\n                    const aValue = aValues[i];\n                    const index = bValues.findIndex(bValue => {\n                        return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);\n                    });\n                    if (index === -1) {\n                        return false;\n                    }\n                    bValues.splice(index, 1);\n                }\n                return true;\n            }\n            case arrayTag:\n            case uint8ArrayTag:\n            case uint8ClampedArrayTag:\n            case uint16ArrayTag:\n            case uint32ArrayTag:\n            case bigUint64ArrayTag:\n            case int8ArrayTag:\n            case int16ArrayTag:\n            case int32ArrayTag:\n            case bigInt64ArrayTag:\n            case float32ArrayTag:\n            case float64ArrayTag: {\n                if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {\n                    return false;\n                }\n                if (a.length !== b.length) {\n                    return false;\n                }\n                for (let i = 0; i < a.length; i++) {\n                    if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            case arrayBufferTag: {\n                if (a.byteLength !== b.byteLength) {\n                    return false;\n                }\n                return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);\n            }\n            case dataViewTag: {\n                if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {\n                    return false;\n                }\n                return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);\n            }\n            case errorTag: {\n                return a.name === b.name && a.message === b.message;\n            }\n            case objectTag: {\n                const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||\n                    (isPlainObject(a) && isPlainObject(b));\n                if (!areEqualInstances) {\n                    return false;\n                }\n                const aKeys = [...Object.keys(a), ...getSymbols(a)];\n                const bKeys = [...Object.keys(b), ...getSymbols(b)];\n                if (aKeys.length !== bKeys.length) {\n                    return false;\n                }\n                for (let i = 0; i < aKeys.length; i++) {\n                    const propKey = aKeys[i];\n                    const aProp = a[propKey];\n                    if (!Object.hasOwn(b, propKey)) {\n                        return false;\n                    }\n                    const bProp = b[propKey];\n                    if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            default: {\n                return false;\n            }\n        }\n    }\n    finally {\n        stack.delete(a);\n        stack.delete(b);\n    }\n}\n\nexport { isEqualWith };\n","import { after } from '../../function/after.mjs';\nimport { isEqualWith as isEqualWith$1 } from '../../predicate/isEqualWith.mjs';\n\nfunction isEqualWith(a, b, areValuesEqual) {\n    if (typeof areValuesEqual !== 'function') {\n        areValuesEqual = () => undefined;\n    }\n    return isEqualWith$1(a, b, (...args) => {\n        const result = areValuesEqual(...args);\n        if (result !== undefined) {\n            return Boolean(result);\n        }\n        if (a instanceof Map && b instanceof Map) {\n            return isEqualWith(Array.from(a), Array.from(b), after(2, areValuesEqual));\n        }\n        if (a instanceof Set && b instanceof Set) {\n            return isEqualWith(Array.from(a), Array.from(b), after(2, areValuesEqual));\n        }\n    });\n}\n\nexport { isEqualWith };\n","function after(n, func) {\n    if (!Number.isInteger(n) || n < 0) {\n        throw new Error(`n must be a non-negative integer.`);\n    }\n    let counter = 0;\n    return (...args) => {\n        if (++counter >= n) {\n            return func(...args);\n        }\n        return undefined;\n    };\n}\n\nexport { after };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/mutationobserver\n */\nimport { Observer } from './observer.js';\nimport { startsWithFiller } from '../filler.js';\nimport { isEqualWith } from 'es-toolkit/compat';\n// @if CK_DEBUG_TYPING // const { _debouncedLine, _buildLogMessage } = require( '../../dev-utils/utils.js' );\n/**\n * Mutation observer's role is to watch for any DOM changes inside the editor that weren't\n * done by the editor's {@link module:engine/view/renderer~ViewRenderer} itself and reverting these changes.\n *\n * It does this by observing all mutations in the DOM, marking related view elements as changed and calling\n * {@link module:engine/view/renderer~ViewRenderer#render}. Because all mutated nodes are marked as\n * \"to be rendered\" and the {@link module:engine/view/renderer~ViewRenderer#render `render()`} method is called,\n * all changes are reverted in the DOM (the DOM is synced with the editor's view structure).\n *\n * Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.\n */\nexport class MutationObserver extends Observer {\n    /**\n     * Reference to the {@link module:engine/view/view~EditingView#domConverter}.\n     */\n    domConverter;\n    /**\n     * Native mutation observer config.\n     */\n    _config;\n    /**\n     * Observed DOM elements.\n     */\n    _domElements;\n    /**\n     * Native mutation observer.\n     */\n    _mutationObserver;\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        this._config = {\n            childList: true,\n            characterData: true,\n            subtree: true\n        };\n        this.domConverter = view.domConverter;\n        this._domElements = new Set();\n        this._mutationObserver = new window.MutationObserver(this._onMutations.bind(this));\n    }\n    /**\n     * Synchronously handles mutations and empties the queue.\n     */\n    flush() {\n        this._onMutations(this._mutationObserver.takeRecords());\n    }\n    /**\n     * @inheritDoc\n     */\n    observe(domElement) {\n        this._domElements.add(domElement);\n        if (this.isEnabled) {\n            this._mutationObserver.observe(domElement, this._config);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    stopObserving(domElement) {\n        this._domElements.delete(domElement);\n        if (this.isEnabled) {\n            // Unfortunately, it is not possible to stop observing particular DOM element.\n            // In order to stop observing one of multiple DOM elements, we need to re-connect the mutation observer.\n            this._mutationObserver.disconnect();\n            for (const domElement of this._domElements) {\n                this._mutationObserver.observe(domElement, this._config);\n            }\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    enable() {\n        super.enable();\n        for (const domElement of this._domElements) {\n            this._mutationObserver.observe(domElement, this._config);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    disable() {\n        super.disable();\n        this._mutationObserver.disconnect();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._mutationObserver.disconnect();\n    }\n    /**\n     * Handles mutations. Mark view elements to sync and call render.\n     *\n     * @param domMutations Array of native mutations.\n     */\n    _onMutations(domMutations) {\n        // As a result of this.flush() we can have an empty collection.\n        if (domMutations.length === 0) {\n            return;\n        }\n        const domConverter = this.domConverter;\n        // Use map and set for deduplication.\n        const mutatedTextNodes = new Set();\n        const elementsWithMutatedChildren = new Set();\n        // Handle `childList` mutations first, so we will be able to check if the `characterData` mutation is in the\n        // element with changed structure anyway.\n        for (const mutation of domMutations) {\n            const element = domConverter.mapDomToView(mutation.target);\n            if (!element) {\n                continue;\n            }\n            // Do not collect mutations from UIElements and RawElements.\n            if (element.is('uiElement') || element.is('rawElement')) {\n                continue;\n            }\n            if (mutation.type === 'childList' && !this._isBogusBrMutation(mutation)) {\n                elementsWithMutatedChildren.add(element);\n            }\n        }\n        // Handle `characterData` mutations later, when we have the full list of nodes which changed structure.\n        for (const mutation of domMutations) {\n            const element = domConverter.mapDomToView(mutation.target);\n            // Do not collect mutations from UIElements and RawElements.\n            if (element && (element.is('uiElement') || element.is('rawElement'))) {\n                continue;\n            }\n            if (mutation.type === 'characterData') {\n                const text = domConverter.findCorrespondingViewText(mutation.target);\n                if (text && !elementsWithMutatedChildren.has(text.parent)) {\n                    mutatedTextNodes.add(text);\n                }\n                // When we added first letter to the text node which had only inline filler, for the DOM it is mutation\n                // on text, but for the view, where filler text node did not exist, new text node was created, so we\n                // need to handle it as a 'children' mutation instead of 'text'.\n                else if (!text && startsWithFiller(mutation.target)) {\n                    elementsWithMutatedChildren.add(domConverter.mapDomToView(mutation.target.parentNode));\n                }\n            }\n        }\n        // Now we build the list of mutations to mark elements. We did not do it earlier to avoid marking the\n        // same node multiple times in case of duplication.\n        const mutations = [];\n        for (const textNode of mutatedTextNodes) {\n            mutations.push({ type: 'text', node: textNode });\n        }\n        for (const viewElement of elementsWithMutatedChildren) {\n            const domElement = domConverter.mapViewToDom(viewElement);\n            const viewChildren = Array.from(viewElement.getChildren());\n            const newViewChildren = Array.from(domConverter.domChildrenToView(domElement, { withChildren: false }));\n            // It may happen that as a result of many changes (sth was inserted and then removed),\n            // both elements haven't really changed. #1031\n            if (!isEqualWith(viewChildren, newViewChildren, sameNodes)) {\n                mutations.push({ type: 'children', node: viewElement });\n            }\n        }\n        // In case only non-relevant mutations were recorded it skips the event and force render (#5600).\n        if (mutations.length) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \t_debouncedLine();\n            // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'MutationObserver',\n            // @if CK_DEBUG_TYPING // \t\t'%cMutations detected',\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this.document.fire('mutations', { mutations });\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n        }\n    }\n    /**\n     * Checks if mutation was generated by the browser inserting bogus br on the end of the block element.\n     * Such mutations are generated while pressing space or performing native spellchecker correction\n     * on the end of the block element in Firefox browser.\n     *\n     * @param mutation Native mutation object.\n     */\n    _isBogusBrMutation(mutation) {\n        let addedNode = null;\n        // Check if mutation added only one node on the end of its parent.\n        if (mutation.nextSibling === null && mutation.removedNodes.length === 0 && mutation.addedNodes.length == 1) {\n            addedNode = this.domConverter.domToView(mutation.addedNodes[0], {\n                withChildren: false\n            });\n        }\n        return addedNode && addedNode.is('element', 'br');\n    }\n}\nfunction sameNodes(child1, child2) {\n    // First level of comparison (array of children vs array of children) – use the es-toolkit's default behavior.\n    if (Array.isArray(child1)) {\n        return;\n    }\n    // Elements.\n    if (child1 === child2) {\n        return true;\n    }\n    // Texts.\n    else if (child1.is('$text') && child2.is('$text')) {\n        return child1.data === child2.data;\n    }\n    // Not matching types.\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/focusobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\n// @if CK_DEBUG_TYPING // const { _debouncedLine, _buildLogMessage } = require( '../../dev-utils/utils.js' );\n/**\n * {@link module:engine/view/document~ViewDocument#event:focus Focus}\n * and {@link module:engine/view/document~ViewDocument#event:blur blur} events observer.\n * Focus observer handle also {@link module:engine/view/rooteditableelement~ViewRootEditableElement#isFocused isFocused} property of the\n * {@link module:engine/view/rooteditableelement~ViewRootEditableElement root elements}.\n *\n * Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.\n */\nexport class FocusObserver extends DomEventObserver {\n    /**\n     * Identifier of the timeout currently used by focus listener to delay rendering execution.\n     */\n    _renderTimeoutId = null;\n    /**\n     * Set to `true` if the document is in the process of setting the focus.\n     *\n     * The flag is used to indicate that setting the focus is in progress.\n     */\n    _isFocusChanging = false;\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['focus', 'blur'];\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        this.useCapture = true;\n        const document = this.document;\n        document.on('focus', () => this._handleFocus());\n        document.on('blur', (evt, data) => this._handleBlur(data));\n        // Focus the editor in cases where browser dispatches `beforeinput` event to a not-focused editable element.\n        // This is flushed by the beforeinput listener in the `InsertTextObserver`.\n        // Note that focus is set only if the document is not focused yet.\n        // See https://github.com/ckeditor/ckeditor5/issues/14702.\n        document.on('beforeinput', () => {\n            if (!document.isFocused) {\n                this._handleFocus();\n            }\n        }, { priority: 'highest' });\n    }\n    /**\n     * Finishes setting the document focus state.\n     */\n    flush() {\n        if (this._isFocusChanging) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \t_debouncedLine();\n            // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'FocusObserver',\n            // @if CK_DEBUG_TYPING // \t\t'flush focus'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this._isFocusChanging = false;\n            this.document.isFocused = true;\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \t_debouncedLine();\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'FocusObserver',\n        // @if CK_DEBUG_TYPING // \t\t`${ domEvent.type } event`\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'FocusObserver',\n        // @if CK_DEBUG_TYPING // \t\t'DOM target:',\n        // @if CK_DEBUG_TYPING // \t\t{ target: domEvent.target, relatedTarget: domEvent.relatedTarget }\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // \tconst domSelection = window.getSelection();\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'FocusObserver',\n        // @if CK_DEBUG_TYPING // \t\t'DOM Selection:',\n        // @if CK_DEBUG_TYPING // \t\t{ node: domSelection!.anchorNode, offset: domSelection!.anchorOffset },\n        // @if CK_DEBUG_TYPING // \t\t{ node: domSelection!.focusNode, offset: domSelection!.focusOffset }\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        this.fire(domEvent.type, domEvent);\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this._clearTimeout();\n        super.destroy();\n    }\n    /**\n     * The `focus` event handler.\n     */\n    _handleFocus() {\n        this._clearTimeout();\n        this._isFocusChanging = true;\n        // Unfortunately native `selectionchange` event is fired asynchronously.\n        // We need to wait until `SelectionObserver` handle the event and then render. Otherwise rendering will\n        // overwrite new DOM selection with selection from the view.\n        // See https://github.com/ckeditor/ckeditor5-engine/issues/795 for more details.\n        // Long timeout is needed to solve #676 and https://github.com/ckeditor/ckeditor5-engine/issues/1157 issues.\n        //\n        // Using `view.change()` instead of `view.forceRender()` to prevent double rendering\n        // in a situation where `selectionchange` already caused selection change.\n        this._renderTimeoutId = setTimeout(() => {\n            this._renderTimeoutId = null;\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'FocusObserver',\n            // @if CK_DEBUG_TYPING // \t\t'flush on timeout'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this.flush();\n            this.view.change(() => { });\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n        }, 50);\n    }\n    /**\n     * The `blur` event handler.\n     */\n    _handleBlur(data) {\n        const selectedEditable = this.document.selection.editableElement;\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'FocusObserver',\n        // @if CK_DEBUG_TYPING // \t\t'selectedEditable:',\n        // @if CK_DEBUG_TYPING // \t\t{ selectedEditable }\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        if (selectedEditable === null || selectedEditable === data.target) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'FocusObserver',\n            // @if CK_DEBUG_TYPING // \t\t'document no longer focused'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this.document.isFocused = false;\n            this._isFocusChanging = false;\n            // Re-render the document to update view elements\n            // (changing document.isFocused already marked view as changed since last rendering).\n            this.view.change(() => { });\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n        }\n    }\n    /**\n     * Clears timeout.\n     */\n    _clearTimeout() {\n        if (this._renderTimeoutId) {\n            clearTimeout(this._renderTimeoutId);\n            this._renderTimeoutId = null;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/selectionobserver\n */\nimport { Observer } from './observer.js';\nimport { MutationObserver } from './mutationobserver.js';\nimport { FocusObserver } from './focusobserver.js';\nimport { env } from '@ckeditor/ckeditor5-utils';\nimport { debounce } from 'es-toolkit/compat';\n/**\n * Selection observer class observes selection changes in the document. If a selection changes on the document this\n * observer checks if the DOM selection is different from the {@link module:engine/view/document~ViewDocument#selection view selection}.\n * The selection observer fires {@link module:engine/view/document~ViewDocument#event:selectionChange} event only if\n * a selection change was the only change in the document and the DOM selection is different from the view selection.\n *\n * This observer also manages the {@link module:engine/view/document~ViewDocument#isSelecting} property of the view document.\n *\n * Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.\n */\nexport class SelectionObserver extends Observer {\n    /**\n     * Instance of the mutation observer. Selection observer calls\n     * {@link module:engine/view/observer/mutationobserver~MutationObserver#flush} to ensure that the mutations will be handled\n     * before the {@link module:engine/view/document~ViewDocument#event:selectionChange} event is fired.\n     */\n    mutationObserver;\n    /**\n     * Instance of the focus observer. Focus observer calls\n     * {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.\n     */\n    focusObserver;\n    /**\n     * Reference to the view {@link module:engine/view/documentselection~ViewDocumentSelection} object used to compare\n     * new selection with it.\n     */\n    selection;\n    /**\n     * Reference to the {@link module:engine/view/view~EditingView#domConverter}.\n     */\n    domConverter;\n    /**\n     * A set of documents which have added `selectionchange` listener to avoid adding a listener twice to the same\n     * document.\n     */\n    _documents = new WeakSet();\n    /**\n     * Fires debounced event `selectionChangeDone`. It uses `es-toolkit#debounce` method to delay function call.\n     */\n    _fireSelectionChangeDoneDebounced;\n    /**\n     * When called, starts clearing the {@link #_loopbackCounter} counter in time intervals. When the number of selection\n     * changes exceeds a certain limit within the interval of time, the observer will not fire `selectionChange` but warn about\n     * possible infinite selection loop.\n     */\n    _clearInfiniteLoopInterval;\n    /**\n     * Unlocks the `isSelecting` state of the view document in case the selection observer did not record this fact\n     * correctly (for whatever reason). It is a safeguard (paranoid check), that returns document to the normal state\n     * after a certain period of time (debounced, postponed by each selectionchange event).\n     */\n    _documentIsSelectingInactivityTimeoutDebounced;\n    /**\n     * Private property to check if the code does not enter infinite loop.\n     */\n    _loopbackCounter = 0;\n    /**\n     * A set of DOM documents that have a pending selection change.\n     * Pending selection change is recorded while selection change event is detected on non focused editable.\n     */\n    _pendingSelectionChange = new Set();\n    constructor(view) {\n        super(view);\n        this.mutationObserver = view.getObserver(MutationObserver);\n        this.focusObserver = view.getObserver(FocusObserver);\n        this.selection = this.document.selection;\n        this.domConverter = view.domConverter;\n        this._fireSelectionChangeDoneDebounced = debounce(data => {\n            this.document.fire('selectionChangeDone', data);\n        }, 200);\n        this._clearInfiniteLoopInterval = setInterval(() => this._clearInfiniteLoop(), 1000);\n        this._documentIsSelectingInactivityTimeoutDebounced = debounce(() => (this.document.isSelecting = false), 5000);\n        this.view.document.on('change:isFocused', (evt, name, isFocused) => {\n            if (isFocused && this._pendingSelectionChange.size) {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'SelectionObserver',\n                // @if CK_DEBUG_TYPING // \t\t'Flush pending selection change'\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                // Iterate over a copy of set because it is modified in selection change handler.\n                for (const domDocument of Array.from(this._pendingSelectionChange)) {\n                    this._handleSelectionChange(domDocument);\n                }\n                this._pendingSelectionChange.clear();\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    observe(domElement) {\n        const domDocument = domElement.ownerDocument;\n        const startDocumentIsSelecting = () => {\n            this.document.isSelecting = true;\n            // Let's activate the safety timeout each time the document enters the \"is selecting\" state.\n            this._documentIsSelectingInactivityTimeoutDebounced();\n        };\n        const endDocumentIsSelecting = () => {\n            if (!this.document.isSelecting) {\n                return;\n            }\n            // Make sure that model selection is up-to-date at the end of selecting process.\n            // Sometimes `selectionchange` events could arrive after the `mouseup` event and that selection could be already outdated.\n            this._handleSelectionChange(domDocument);\n            this.document.isSelecting = false;\n            // The safety timeout can be canceled when the document leaves the \"is selecting\" state.\n            this._documentIsSelectingInactivityTimeoutDebounced.cancel();\n        };\n        // The document has the \"is selecting\" state while the user keeps making (extending) the selection\n        // (e.g. by holding the mouse button and moving the cursor). The state resets when they either released\n        // the mouse button or interrupted the process by pressing or releasing any key.\n        this.listenTo(domElement, 'selectstart', startDocumentIsSelecting, { priority: 'highest' });\n        this.listenTo(domElement, 'keydown', endDocumentIsSelecting, { priority: 'highest', useCapture: true });\n        this.listenTo(domElement, 'keyup', endDocumentIsSelecting, { priority: 'highest', useCapture: true });\n        // Add document-wide listeners only once. This method could be called for multiple editing roots.\n        if (this._documents.has(domDocument)) {\n            return;\n        }\n        // This listener is using capture mode to make sure that selection is upcasted before any other\n        // handler would like to check it and update (for example table multi cell selection).\n        this.listenTo(domDocument, 'mouseup', endDocumentIsSelecting, { priority: 'highest', useCapture: true });\n        this.listenTo(domDocument, 'selectionchange', () => {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \t_debouncedLine();\n            // @if CK_DEBUG_TYPING // \tconst domSelection = domDocument.defaultView!.getSelection();\n            // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'SelectionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'selectionchange'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'SelectionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'DOM Selection:',\n            // @if CK_DEBUG_TYPING // \t\t{ node: domSelection!.anchorNode, offset: domSelection!.anchorOffset },\n            // @if CK_DEBUG_TYPING // \t\t{ node: domSelection!.focusNode, offset: domSelection!.focusOffset }\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            // The Renderer is disabled while composing on non-android browsers, so we can't update the view selection\n            // because the DOM and view tree drifted apart. Position mapping could fail because of it.\n            if (this.document.isComposing && !env.isAndroid) {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'SelectionObserver',\n                // @if CK_DEBUG_TYPING //\t\t'Selection change ignored (isComposing)'\n                // @if CK_DEBUG_TYPING //\t) );\n                // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n                // @if CK_DEBUG_TYPING // }\n                return;\n            }\n            this._handleSelectionChange(domDocument);\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n            // Defer the safety timeout when the selection changes (e.g. the user keeps extending the selection\n            // using their mouse).\n            this._documentIsSelectingInactivityTimeoutDebounced();\n        });\n        // Update the model ViewDocumentSelection just after the Renderer and the SelectionObserver are locked.\n        // We do this synchronously (without waiting for the `selectionchange` DOM event) as browser updates\n        // the DOM selection (but not visually) to span the text that is under composition and could be replaced.\n        this.listenTo(this.view.document, 'compositionstart', () => {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconst domSelection = domDocument.defaultView!.getSelection();\n            // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'SelectionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'update selection on compositionstart'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'SelectionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'DOM Selection:',\n            // @if CK_DEBUG_TYPING // \t\t{ node: domSelection!.anchorNode, offset: domSelection!.anchorOffset },\n            // @if CK_DEBUG_TYPING // \t\t{ node: domSelection!.focusNode, offset: domSelection!.focusOffset }\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this._handleSelectionChange(domDocument);\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n        }, { priority: 'lowest' });\n        this._documents.add(domDocument);\n    }\n    /**\n     * @inheritDoc\n     */\n    stopObserving(domElement) {\n        this.stopListening(domElement);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        clearInterval(this._clearInfiniteLoopInterval);\n        this._fireSelectionChangeDoneDebounced.cancel();\n        this._documentIsSelectingInactivityTimeoutDebounced.cancel();\n    }\n    /* istanbul ignore next -- @preserve */\n    _reportInfiniteLoop() {\n        // @if CK_DEBUG //\t\tthrow new Error(\n        // @if CK_DEBUG //\t\t\t'Selection change observer detected an infinite rendering loop.\\n\\n' +\n        // @if CK_DEBUG //\t \t\t'⚠️⚠️ Report this error on https://github.com/ckeditor/ckeditor5/issues/11658.'\n        // @if CK_DEBUG //\t\t);\n    }\n    /**\n     * Selection change listener. {@link module:engine/view/observer/mutationobserver~MutationObserver#flush Flush} mutations, check if\n     * a selection changes and fires {@link module:engine/view/document~ViewDocument#event:selectionChange} event on every change\n     * and {@link module:engine/view/document~ViewDocument#event:selectionChangeDone} when a selection stop changing.\n     *\n     * @param domDocument DOM document.\n     */\n    _handleSelectionChange(domDocument) {\n        if (!this.isEnabled) {\n            return;\n        }\n        const domSelection = domDocument.defaultView.getSelection();\n        if (this.checkShouldIgnoreEventFromTarget(domSelection.anchorNode)) {\n            return;\n        }\n        // Ensure the mutation event will be before selection event on all browsers.\n        this.mutationObserver.flush();\n        const newViewSelection = this.domConverter.domSelectionToView(domSelection);\n        // Do not convert selection change if the new view selection has no ranges in it.\n        //\n        // It means that the DOM selection is in some way incorrect. Ranges that were in the DOM selection could not be\n        // converted to the view. This happens when the DOM selection was moved outside of the editable element.\n        if (newViewSelection.rangeCount == 0) {\n            this.view.hasDomSelection = false;\n            return;\n        }\n        this.view.hasDomSelection = true;\n        // Mark the latest focus change as complete (we got new selection after the focus so the selection is in the focused element).\n        this.focusObserver.flush();\n        // Ignore selection change as the editable is not focused. Note that in read-only mode, we have to update\n        // the model selection as there won't be any focus change to flush the pending selection changes.\n        if (!this.view.document.isFocused && !this.view.document.isReadOnly) {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'SelectionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'Ignore selection change while editable is not focused'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this._pendingSelectionChange.add(domDocument);\n            return;\n        }\n        this._pendingSelectionChange.delete(domDocument);\n        if (this.selection.isEqual(newViewSelection) && this.domConverter.isDomSelectionCorrect(domSelection)) {\n            return;\n        }\n        // Ensure we are not in the infinite loop (#400).\n        // This counter is reset each second. 60 selection changes in 1 second is enough high number\n        // to be very difficult (impossible) to achieve using just keyboard keys (during normal editor use).\n        if (++this._loopbackCounter > 60) {\n            // Selection change observer detected an infinite rendering loop.\n            // Most probably you try to put the selection in the position which is not allowed\n            // by the browser and browser fixes it automatically what causes `selectionchange` event on\n            // which a loopback through a model tries to re-render the wrong selection and again.\n            this._reportInfiniteLoop();\n            return;\n        }\n        if (!isSelectionWithinRootElements(newViewSelection)) {\n            // Occasionally, such as when removing markers during a focus change, the selection may end up inside a view element\n            // whose parent has already been detached from the DOM. In most cases this is harmless, but if the selectionchange\n            // event fires before the view is fully synchronized with the DOM converter, some elements in the selection may become orphans.\n            // This can result in the view being out of sync with the actual DOM structure.\n            // See: https://github.com/ckeditor/ckeditor5/issues/18744\n            this.view.forceRender();\n        }\n        else if (this.selection.isSimilar(newViewSelection)) {\n            // If selection was equal and we are at this point of algorithm, it means that it was incorrect.\n            // Just re-render it, no need to fire any events, etc.\n            this.view.forceRender();\n        }\n        else {\n            const data = {\n                oldSelection: this.selection,\n                newSelection: newViewSelection,\n                domSelection\n            };\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'SelectionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'Fire selection change:',\n            // @if CK_DEBUG_TYPING // \t\tnewViewSelection.getFirstRange()\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            // Prepare data for new selection and fire appropriate events.\n            this.document.fire('selectionChange', data);\n            // Call `#_fireSelectionChangeDoneDebounced` every time when `selectionChange` event is fired.\n            // This function is debounced what means that `selectionChangeDone` event will be fired only when\n            // defined int the function time will elapse since the last time the function was called.\n            // So `selectionChangeDone` will be fired when selection will stop changing.\n            this._fireSelectionChangeDoneDebounced(data);\n        }\n    }\n    /**\n     * Clears `SelectionObserver` internal properties connected with preventing infinite loop.\n     */\n    _clearInfiniteLoop() {\n        this._loopbackCounter = 0;\n    }\n}\n/**\n * Checks if all roots of the selection's range boundaries are root elements.\n * Returns true if the selection is fully contained within root elements (not orphaned).\n *\n * @param selection The view selection to check.\n * @returns True if all range boundaries are within root elements, false otherwise.\n */\nfunction isSelectionWithinRootElements(selection) {\n    return Array\n        .from(selection.getRanges())\n        .flatMap(range => [range.start.root, range.end.root])\n        .every(root => root && root.is('rootElement'));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/compositionobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\n// @if CK_DEBUG_TYPING // const { _debouncedLine, _buildLogMessage } = require( '../../dev-utils/utils.js' );\n/**\n * {@link module:engine/view/document~ViewDocument#event:compositionstart Compositionstart},\n * {@link module:engine/view/document~ViewDocument#event:compositionupdate compositionupdate} and\n * {@link module:engine/view/document~ViewDocument#event:compositionend compositionend} events observer.\n *\n * Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.\n */\nexport class CompositionObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['compositionstart', 'compositionupdate', 'compositionend'];\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        const document = this.document;\n        document.on('compositionstart', () => {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'CompositionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'%c┌───────────────────────────── isComposing = true ─────────────────────────────┐',\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold; color: green'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            document.isComposing = true;\n        });\n        document.on('compositionend', () => {\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'CompositionObserver',\n            // @if CK_DEBUG_TYPING // \t\t'%c└───────────────────────────── isComposing = false ─────────────────────────────┘',\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold; color: green'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            document.isComposing = false;\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \t_debouncedLine();\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'CompositionObserver',\n        // @if CK_DEBUG_TYPING // \t\t`${ domEvent.type }`\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        this.fire(domEvent.type, domEvent, {\n            data: domEvent.data\n        });\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * A facade over the native [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object.\n */\nexport class ViewDataTransfer {\n    /**\n     * The array of files created from the native `DataTransfer#files` or `DataTransfer#items`.\n     */\n    _files;\n    /**\n     * The native DataTransfer object.\n     */\n    _native;\n    /**\n     * @param nativeDataTransfer The native [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object.\n     * @param options.cacheFiles Whether `files` list should be initialized in the constructor.\n     */\n    constructor(nativeDataTransfer, options = {}) {\n        // We should store references to the File instances in case someone would like to process this files\n        // outside the event handler. Files are stored only for `drop` and `paste` events because they are not usable\n        // in other events and are generating a huge delay on Firefox while dragging.\n        // See https://github.com/ckeditor/ckeditor5/issues/13366.\n        this._files = options.cacheFiles ? getFiles(nativeDataTransfer) : null;\n        this._native = nativeDataTransfer;\n    }\n    /**\n     * The array of files created from the native `DataTransfer#files` or `DataTransfer#items`.\n     */\n    get files() {\n        if (!this._files) {\n            this._files = getFiles(this._native);\n        }\n        return this._files;\n    }\n    /**\n     * Returns an array of available native content types.\n     */\n    get types() {\n        return this._native.types;\n    }\n    /**\n     * Gets the data from the data transfer by its MIME type.\n     *\n     * ```ts\n     * dataTransfer.getData( 'text/plain' );\n     * ```\n     *\n     * @param type The MIME type. E.g. `text/html` or `text/plain`.\n     */\n    getData(type) {\n        return this._native.getData(type);\n    }\n    /**\n     * Sets the data in the data transfer.\n     *\n     * @param type The MIME type. E.g. `text/html` or `text/plain`.\n     */\n    setData(type, data) {\n        this._native.setData(type, data);\n    }\n    /**\n     * The effect that is allowed for a drag operation.\n     */\n    set effectAllowed(value) {\n        this._native.effectAllowed = value;\n    }\n    get effectAllowed() {\n        return this._native.effectAllowed;\n    }\n    /**\n     * The actual drop effect.\n     */\n    set dropEffect(value) {\n        this._native.dropEffect = value;\n    }\n    get dropEffect() {\n        return this._native.dropEffect;\n    }\n    /**\n     * Set a preview image of the dragged content.\n     */\n    setDragImage(image, x, y) {\n        this._native.setDragImage(image, x, y);\n    }\n    /**\n     * Whether the dragging operation was canceled.\n     */\n    get isCanceled() {\n        return this._native.dropEffect == 'none' || !!this._native.mozUserCancelled;\n    }\n}\nfunction getFiles(nativeDataTransfer) {\n    // DataTransfer.files and items are array-like and might not have an iterable interface.\n    const files = Array.from(nativeDataTransfer.files || []);\n    const items = Array.from(nativeDataTransfer.items || []);\n    if (files.length) {\n        return files;\n    }\n    // Chrome has empty DataTransfer.files, but allows getting files through the items interface.\n    return items\n        .filter(item => item.kind === 'file')\n        .map(item => item.getAsFile());\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/inputobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\nimport { ViewDataTransfer } from '../datatransfer.js';\nimport { env, isText, indexOf } from '@ckeditor/ckeditor5-utils';\nimport { INLINE_FILLER_LENGTH, startsWithFiller } from '../filler.js';\n// @if CK_DEBUG_TYPING // const { _debouncedLine, _buildLogMessage } = require( '../../dev-utils/utils.js' );\n/**\n * Observer for events connected with data input.\n *\n * **Note**: This observer is attached by {@link module:engine/view/view~EditingView} and available by default in all\n * editor instances.\n */\nexport class InputObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = 'beforeinput';\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \t_debouncedLine();\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'InputObserver',\n        // @if CK_DEBUG_TYPING // \t\t`${ domEvent.type }: ${ domEvent.inputType } - ${ domEvent.isComposing ? 'is' : 'not' } composing`,\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        const domTargetRanges = domEvent.getTargetRanges();\n        const view = this.view;\n        const viewDocument = view.document;\n        let dataTransfer = null;\n        let data = null;\n        let targetRanges = [];\n        if (domEvent.dataTransfer) {\n            dataTransfer = new ViewDataTransfer(domEvent.dataTransfer);\n        }\n        if (domEvent.data !== null) {\n            data = domEvent.data;\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n            // @if CK_DEBUG_TYPING // \t\t`%cevent data: %c${ JSON.stringify( data ) }`,\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n            // @if CK_DEBUG_TYPING // \t\t'color: blue;'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n        }\n        else if (dataTransfer) {\n            data = dataTransfer.getData('text/plain');\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n            // @if CK_DEBUG_TYPING // \t\t`%cevent data transfer: %c${ JSON.stringify( data ) }`,\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n            // @if CK_DEBUG_TYPING // \t\t'color: blue;'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n        }\n        // If the editor selection is fake (an object is selected), the DOM range does not make sense because it is anchored\n        // in the fake selection container.\n        if (viewDocument.selection.isFake) {\n            // Future-proof: in case of multi-range fake selections being possible.\n            targetRanges = Array.from(viewDocument.selection.getRanges());\n            // Do not allow typing inside a fake selection container, we will handle it manually.\n            domEvent.preventDefault();\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n            // @if CK_DEBUG_TYPING // \t\t'%cusing fake selection:',\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n            // @if CK_DEBUG_TYPING // \t\ttargetRanges,\n            // @if CK_DEBUG_TYPING // \t\tviewDocument.selection.isFake ? 'fake view selection' : 'fake DOM parent'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n        }\n        else if (domTargetRanges.length) {\n            targetRanges = domTargetRanges.map(domRange => {\n                // Sometimes browser provides range that starts before editable node.\n                // We try to fall back to collapsed range at the valid end position.\n                // See https://github.com/ckeditor/ckeditor5/issues/14411.\n                // See https://github.com/ckeditor/ckeditor5/issues/14050.\n                let viewStart = view.domConverter.domPositionToView(domRange.startContainer, domRange.startOffset);\n                const viewEnd = view.domConverter.domPositionToView(domRange.endContainer, domRange.endOffset);\n                // When text replacement is enabled and browser tries to replace double space with dot, and space,\n                // but the first space is no longer where browser put it (it was moved to an attribute element),\n                // then we must extend the target range so it does not include a part of an inline filler.\n                if (viewStart && startsWithFiller(domRange.startContainer) && domRange.startOffset < INLINE_FILLER_LENGTH) {\n                    // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                    // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n                    // @if CK_DEBUG_TYPING // \t\t'%cTarget range starts in an inline filler - adjusting it',\n                    // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n                    // @if CK_DEBUG_TYPING // \t) );\n                    // @if CK_DEBUG_TYPING // }\n                    domEvent.preventDefault();\n                    let count = INLINE_FILLER_LENGTH - domRange.startOffset;\n                    viewStart = viewStart.getLastMatchingPosition(value => {\n                        // Ignore attribute and UI elements but stop on container elements.\n                        if (value.item.is('attributeElement') || value.item.is('uiElement')) {\n                            return true;\n                        }\n                        // Skip as many characters as inline filler was overlapped.\n                        if (value.item.is('$textProxy') && count--) {\n                            return true;\n                        }\n                        return false;\n                    }, { direction: 'backward', singleCharacters: true });\n                }\n                // Check if there is no an inline filler just after the target range.\n                if (isFollowedByInlineFiller(domRange.endContainer, domRange.endOffset)) {\n                    // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                    // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n                    // @if CK_DEBUG_TYPING // \t\t'%cTarget range ends just before an inline filler - prevent default behavior',\n                    // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n                    // @if CK_DEBUG_TYPING // \t) );\n                    // @if CK_DEBUG_TYPING // }\n                    domEvent.preventDefault();\n                }\n                if (viewStart) {\n                    return view.createRange(viewStart, viewEnd);\n                }\n                else if (viewEnd) {\n                    return view.createRange(viewEnd);\n                }\n            }).filter((range) => !!range);\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n            // @if CK_DEBUG_TYPING // \t\t'%cusing target ranges:',\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n            // @if CK_DEBUG_TYPING // \t\ttargetRanges\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n        }\n        // For Android devices we use a fallback to the current DOM selection, Android modifies it according\n        // to the expected target ranges of input event.\n        else if (env.isAndroid) {\n            const domSelection = domEvent.target.ownerDocument.defaultView.getSelection();\n            targetRanges = Array.from(view.domConverter.domSelectionToView(domSelection).getRanges());\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'InputObserver',\n            // @if CK_DEBUG_TYPING // \t\t'%cusing selection ranges:',\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n            // @if CK_DEBUG_TYPING // \t\ttargetRanges\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n        }\n        // Android sometimes fires insertCompositionText with a new-line character at the end of the data\n        // instead of firing insertParagraph beforeInput event.\n        // Fire the correct type of beforeInput event and ignore the replaced fragment of text because\n        // it wants to replace \"test\" with \"test\\n\".\n        // https://github.com/ckeditor/ckeditor5/issues/12368.\n        if (env.isAndroid && domEvent.inputType == 'insertCompositionText' && data && data.endsWith('\\n')) {\n            this.fire(domEvent.type, domEvent, {\n                inputType: 'insertParagraph',\n                targetRanges: [view.createRange(targetRanges[0].end)]\n            });\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // Normalize the insertText data that includes new-line characters.\n        // https://github.com/ckeditor/ckeditor5/issues/2045.\n        if (['insertText', 'insertReplacementText'].includes(domEvent.inputType) && data && data.includes('\\n')) {\n            // There might be a single new-line or double for new paragraph, but we translate\n            // it to paragraphs as it is our default action for enter handling.\n            const parts = data.split(/\\n{1,2}/g);\n            let partTargetRanges = targetRanges;\n            // Handle all parts on our side as we rely on paragraph inserting and synchronously updated view selection.\n            domEvent.preventDefault();\n            for (let i = 0; i < parts.length; i++) {\n                const dataPart = parts[i];\n                if (dataPart != '') {\n                    this.fire(domEvent.type, domEvent, {\n                        data: dataPart,\n                        dataTransfer,\n                        targetRanges: partTargetRanges,\n                        inputType: domEvent.inputType,\n                        isComposing: domEvent.isComposing\n                    });\n                    // Use the result view selection so following events will be added one after another.\n                    partTargetRanges = [viewDocument.selection.getFirstRange()];\n                }\n                if (i + 1 < parts.length) {\n                    this.fire(domEvent.type, domEvent, {\n                        inputType: 'insertParagraph',\n                        targetRanges: partTargetRanges\n                    });\n                    // Use the result view selection so following events will be added one after another.\n                    partTargetRanges = [viewDocument.selection.getFirstRange()];\n                }\n            }\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n            // @if CK_DEBUG_TYPING // }\n            return;\n        }\n        // Fire the normalized beforeInput event.\n        this.fire(domEvent.type, domEvent, {\n            data,\n            dataTransfer,\n            targetRanges,\n            inputType: domEvent.inputType,\n            isComposing: domEvent.isComposing\n        });\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n}\n/**\n * Returns `true` if there is an inline filler just after the position in DOM.\n * It walks up the DOM tree if the offset is at the end of the node.\n */\nfunction isFollowedByInlineFiller(node, offset) {\n    while (node.parentNode) {\n        if (isText(node)) {\n            if (offset != node.data.length) {\n                return false;\n            }\n        }\n        else {\n            if (offset != node.childNodes.length) {\n                return false;\n            }\n        }\n        offset = indexOf(node) + 1;\n        node = node.parentNode;\n        if (offset < node.childNodes.length && startsWithFiller(node.childNodes[offset])) {\n            return true;\n        }\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/arrowkeysobserver\n */\nimport { Observer } from './observer.js';\nimport { BubblingEventInfo } from './bubblingeventinfo.js';\nimport { isArrowKeyCode } from '@ckeditor/ckeditor5-utils';\n/**\n * Arrow keys observer introduces the {@link module:engine/view/document~ViewDocument#event:arrowKey `Document#arrowKey`} event.\n *\n * Note that this observer is attached by the {@link module:engine/view/view~EditingView} and is available by default.\n */\nexport class ArrowKeysObserver extends Observer {\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        this.document.on('keydown', (event, data) => {\n            if (this.isEnabled && isArrowKeyCode(data.keyCode)) {\n                const eventInfo = new BubblingEventInfo(this.document, 'arrowKey', this.document.selection.getFirstRange());\n                this.document.fire(eventInfo, data);\n                if (eventInfo.stop.called) {\n                    event.stop();\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    observe() { }\n    /**\n     * @inheritDoc\n     */\n    stopObserving() { }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Observer } from './observer.js';\nimport { BubblingEventInfo } from './bubblingeventinfo.js';\nimport { keyCodes } from '@ckeditor/ckeditor5-utils';\n/**\n * Tab observer introduces the {@link module:engine/view/document~ViewDocument#event:tab `Document#tab`} event.\n *\n * Note that because {@link module:engine/view/observer/tabobserver~TabObserver} is attached by the\n * {@link module:engine/view/view~EditingView}, this event is available by default.\n */\nexport class TabObserver extends Observer {\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        const doc = this.document;\n        doc.on('keydown', (evt, data) => {\n            if (!this.isEnabled ||\n                data.keyCode != keyCodes.tab ||\n                data.ctrlKey) {\n                return;\n            }\n            const event = new BubblingEventInfo(doc, 'tab', doc.selection.getFirstRange());\n            doc.fire(event, data);\n            if (event.stop.called) {\n                evt.stop();\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    observe() { }\n    /**\n     * @inheritDoc\n     */\n    stopObserving() { }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/view\n */\nimport { ViewDocument } from './document.js';\nimport { ViewDowncastWriter } from './downcastwriter.js';\nimport { ViewRenderer } from './renderer.js';\nimport { ViewDomConverter } from './domconverter.js';\nimport { ViewPosition } from './position.js';\nimport { ViewRange } from './range.js';\nimport { ViewSelection } from './selection.js';\nimport { KeyObserver } from './observer/keyobserver.js';\nimport { FakeSelectionObserver } from './observer/fakeselectionobserver.js';\nimport { MutationObserver } from './observer/mutationobserver.js';\nimport { SelectionObserver } from './observer/selectionobserver.js';\nimport { FocusObserver } from './observer/focusobserver.js';\nimport { CompositionObserver } from './observer/compositionobserver.js';\nimport { InputObserver } from './observer/inputobserver.js';\nimport { ArrowKeysObserver } from './observer/arrowkeysobserver.js';\nimport { TabObserver } from './observer/tabobserver.js';\nimport { CKEditorError, env, ObservableMixin, scrollViewportToShowTarget } from '@ckeditor/ckeditor5-utils';\nimport { injectUiElementHandling } from './uielement.js';\nimport { injectQuirksHandling } from './filler.js';\nimport { cloneDeep } from 'es-toolkit/compat';\n/**\n * Editor's view controller class. Its main responsibility is DOM - View management for editing purposes, to provide\n * abstraction over the DOM structure and events and hide all browsers quirks.\n *\n * View controller renders view document to DOM whenever view structure changes. To determine when view can be rendered,\n * all changes need to be done using the {@link module:engine/view/view~EditingView#change} method, using\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter}:\n *\n * ```ts\n * view.change( writer => {\n * \twriter.insert( position, writer.createText( 'foo' ) );\n * } );\n * ```\n *\n * View controller also register {@link module:engine/view/observer/observer~Observer observers} which observes changes\n * on DOM and fire events on the {@link module:engine/view/document~ViewDocument Document}.\n * Note that the following observers are added by the class constructor and are always available:\n *\n * * {@link module:engine/view/observer/selectionobserver~SelectionObserver},\n * * {@link module:engine/view/observer/focusobserver~FocusObserver},\n * * {@link module:engine/view/observer/keyobserver~KeyObserver},\n * * {@link module:engine/view/observer/fakeselectionobserver~FakeSelectionObserver}.\n * * {@link module:engine/view/observer/compositionobserver~CompositionObserver}.\n * * {@link module:engine/view/observer/inputobserver~InputObserver}.\n * * {@link module:engine/view/observer/arrowkeysobserver~ArrowKeysObserver}.\n * * {@link module:engine/view/observer/tabobserver~TabObserver}.\n *\n * This class also {@link module:engine/view/view~EditingView#attachDomRoot binds the DOM and the view elements}.\n *\n * If you do not need full a DOM - view management, and only want to transform a tree of view elements to a tree of DOM\n * elements you do not need this controller. You can use the {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}\n * instead.\n */\nexport class EditingView extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Instance of the {@link module:engine/view/document~ViewDocument} associated with this view controller.\n     */\n    document;\n    /**\n     * Instance of the {@link module:engine/view/domconverter~ViewDomConverter domConverter} used by\n     * {@link module:engine/view/view~EditingView#_renderer renderer}\n     * and {@link module:engine/view/observer/observer~Observer observers}.\n     */\n    domConverter;\n    /**\n     * Roots of the DOM tree. Map on the `HTMLElement`s with roots names as keys.\n     */\n    domRoots = new Map();\n    /**\n     * Instance of the {@link module:engine/view/renderer~ViewRenderer renderer}.\n     */\n    _renderer;\n    /**\n     * A DOM root attributes cache. It saves the initial values of DOM root attributes before the DOM element\n     * is {@link module:engine/view/view~EditingView#attachDomRoot attached} to the view so later on, when\n     * the view is destroyed ({@link module:engine/view/view~EditingView#detachDomRoot}), they can be easily restored.\n     * This way, the DOM element can go back to the (clean) state as if the editing view never used it.\n     */\n    _initialDomRootAttributes = new WeakMap();\n    /**\n     * Map of registered {@link module:engine/view/observer/observer~Observer observers}.\n     */\n    _observers = new Map();\n    /**\n     * ViewDowncastWriter instance used in {@link #change change method} callbacks.\n     */\n    _writer;\n    /**\n     * Is set to `true` when {@link #change view changes} are currently in progress.\n     */\n    _ongoingChange = false;\n    /**\n     * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.\n     */\n    _postFixersInProgress = false;\n    /**\n     * Internal flag to temporary disable rendering. See the usage in the {@link #_disableRendering}.\n     */\n    _renderingDisabled = false;\n    /**\n     * Internal flag that disables rendering when there are no changes since the last rendering.\n     * It stores information about changed selection and changed elements from attached document roots.\n     */\n    _hasChangedSinceTheLastRendering = false;\n    /**\n     * @param stylesProcessor The styles processor instance.\n     */\n    constructor(stylesProcessor) {\n        super();\n        this.document = new ViewDocument(stylesProcessor);\n        this.domConverter = new ViewDomConverter(this.document);\n        this.set('isRenderingInProgress', false);\n        this.set('hasDomSelection', false);\n        this._renderer = new ViewRenderer(this.domConverter, this.document.selection);\n        this._renderer.bind('isFocused', 'isSelecting', 'isComposing')\n            .to(this.document, 'isFocused', 'isSelecting', 'isComposing');\n        this._writer = new ViewDowncastWriter(this.document);\n        // Add default observers.\n        // Make sure that this list matches AlwaysRegisteredViewObservers type.\n        this.addObserver(MutationObserver);\n        this.addObserver(FocusObserver);\n        this.addObserver(SelectionObserver);\n        this.addObserver(KeyObserver);\n        this.addObserver(FakeSelectionObserver);\n        this.addObserver(CompositionObserver);\n        this.addObserver(ArrowKeysObserver);\n        this.addObserver(InputObserver);\n        this.addObserver(TabObserver);\n        // Inject quirks handlers.\n        injectQuirksHandling(this);\n        injectUiElementHandling(this);\n        // Use 'normal' priority so that rendering is performed as first when using that priority.\n        this.on('render', () => {\n            this._render();\n            // Informs that layout has changed after render.\n            this.document.fire('layoutChanged');\n            // Reset the `_hasChangedSinceTheLastRendering` flag after rendering.\n            this._hasChangedSinceTheLastRendering = false;\n        });\n        // Listen to the document selection changes directly.\n        this.listenTo(this.document.selection, 'change', () => {\n            this._hasChangedSinceTheLastRendering = true;\n        });\n        // Trigger re-render if only the focus changed.\n        this.listenTo(this.document, 'change:isFocused', () => {\n            this._hasChangedSinceTheLastRendering = true;\n        });\n        // Remove ranges from DOM selection if editor is blurred.\n        // See https://github.com/ckeditor/ckeditor5/issues/5753.\n        if (env.isiOS) {\n            this.listenTo(this.document, 'blur', (evt, data) => {\n                const relatedViewElement = this.domConverter.mapDomToView(data.domEvent.relatedTarget);\n                // Do not modify DOM selection if focus is moved to other editable of the same editor.\n                if (!relatedViewElement) {\n                    this.domConverter._clearDomSelection();\n                }\n            });\n        }\n        // Listen to external content mutations (directly in the DOM) and mark them to get verified by the renderer.\n        this.listenTo(this.document, 'mutations', (evt, { mutations }) => {\n            mutations.forEach(mutation => this._renderer.markToSync(mutation.type, mutation.node));\n        }, { priority: 'low' });\n        // After all mutated nodes were marked to sync we can trigger view to DOM synchronization\n        // to make sure the DOM structure matches the view.\n        this.listenTo(this.document, 'mutations', () => {\n            this.forceRender();\n        }, { priority: 'lowest' });\n    }\n    /**\n     * Attaches a DOM root element to the view element and enable all observers on that element.\n     * Also {@link module:engine/view/renderer~ViewRenderer#markToSync mark element} to be synchronized\n     * with the view what means that all child nodes will be removed and replaced with content of the view root.\n     *\n     * This method also will change view element name as the same as tag name of given dom root.\n     * Name is always transformed to lower case.\n     *\n     * **Note:** Use {@link #detachDomRoot `detachDomRoot()`} to revert this action.\n     *\n     * @param domRoot DOM root element.\n     * @param name Name of the root.\n     */\n    attachDomRoot(domRoot, name = 'main') {\n        const viewRoot = this.document.getRoot(name);\n        // Set view root name the same as DOM root tag name.\n        viewRoot._name = domRoot.tagName.toLowerCase();\n        const initialDomRootAttributes = {};\n        // 1. Copy and cache the attributes to remember the state of the element before attaching.\n        //    The cached attributes will be restored in detachDomRoot() so the element goes to the\n        //    clean state as if the editing view never used it.\n        // 2. Apply the attributes using the view writer, so they all go under the control of the engine.\n        //    The editing view takes over the attribute management completely because various\n        //    features (e.g. addPlaceholder()) require dynamic changes of those attributes and they\n        //    cannot be managed by the engine and the UI library at the same time.\n        for (const { name, value } of Array.from(domRoot.attributes)) {\n            initialDomRootAttributes[name] = value;\n            // Do not use writer.setAttribute() for the class attribute. The EditableUIView class\n            // and its descendants could have already set some using the writer.addClass() on the view\n            // document root. They haven't been rendered yet so they are not present in the DOM root.\n            // Using writer.setAttribute( 'class', ... ) would override them completely.\n            if (name === 'class') {\n                this._writer.addClass(value.split(' '), viewRoot);\n            }\n            else {\n                // There is a chance that some attributes have already been set on the view root before attaching\n                // the DOM root and should be preserved. This is a similar case to the \"class\" attribute except\n                // this time there is no workaround using a some low-level API.\n                if (!viewRoot.hasAttribute(name)) {\n                    this._writer.setAttribute(name, value, viewRoot);\n                }\n            }\n        }\n        this._initialDomRootAttributes.set(domRoot, initialDomRootAttributes);\n        const updateContenteditableAttribute = () => {\n            this._writer.setAttribute('contenteditable', (!viewRoot.isReadOnly).toString(), viewRoot);\n            if (viewRoot.isReadOnly) {\n                this._writer.addClass('ck-read-only', viewRoot);\n            }\n            else {\n                this._writer.removeClass('ck-read-only', viewRoot);\n            }\n        };\n        // Set initial value.\n        updateContenteditableAttribute();\n        this.domRoots.set(name, domRoot);\n        this.domConverter.bindElements(domRoot, viewRoot);\n        this._renderer.markToSync('children', viewRoot);\n        this._renderer.markToSync('attributes', viewRoot);\n        this._renderer.domDocuments.add(domRoot.ownerDocument);\n        viewRoot.on('change:children', (evt, node) => this._renderer.markToSync('children', node));\n        viewRoot.on('change:attributes', (evt, node) => this._renderer.markToSync('attributes', node));\n        viewRoot.on('change:text', (evt, node) => this._renderer.markToSync('text', node));\n        viewRoot.on('change:isReadOnly', () => this.change(updateContenteditableAttribute));\n        viewRoot.on('change', () => {\n            this._hasChangedSinceTheLastRendering = true;\n        });\n        for (const observer of this._observers.values()) {\n            observer.observe(domRoot, name);\n        }\n    }\n    /**\n     * Detaches a DOM root element from the view element and restores its attributes to the state before\n     * {@link #attachDomRoot `attachDomRoot()`}.\n     *\n     * @param name Name of the root to detach.\n     */\n    detachDomRoot(name) {\n        const domRoot = this.domRoots.get(name);\n        // Remove all root attributes so the DOM element is \"bare\".\n        Array.from(domRoot.attributes).forEach(({ name }) => domRoot.removeAttribute(name));\n        const initialDomRootAttributes = this._initialDomRootAttributes.get(domRoot);\n        // Revert all view root attributes back to the state before attachDomRoot was called.\n        for (const attribute in initialDomRootAttributes) {\n            domRoot.setAttribute(attribute, initialDomRootAttributes[attribute]);\n        }\n        this.domRoots.delete(name);\n        this.domConverter.unbindDomElement(domRoot);\n        for (const observer of this._observers.values()) {\n            observer.stopObserving(domRoot);\n        }\n    }\n    /**\n     * Gets DOM root element.\n     *\n     * @param name  Name of the root.\n     * @returns DOM root element instance.\n     */\n    getDomRoot(name = 'main') {\n        return this.domRoots.get(name);\n    }\n    /**\n     * Creates observer of the given type if not yet created, {@link module:engine/view/observer/observer~Observer#enable enables} it\n     * and {@link module:engine/view/observer/observer~Observer#observe attaches} to all existing and future\n     * {@link #domRoots DOM roots}.\n     *\n     * Note: Observers are recognized by their constructor (classes). A single observer will be instantiated and used only\n     * when registered for the first time. This means that features and other components can register a single observer\n     * multiple times without caring whether it has been already added or not.\n     *\n     * @param ObserverConstructor The constructor of an observer to add.\n     * Should create an instance inheriting from {@link module:engine/view/observer/observer~Observer}.\n     * @returns Added observer instance.\n     */\n    addObserver(ObserverConstructor) {\n        let observer = this._observers.get(ObserverConstructor);\n        if (observer) {\n            return observer;\n        }\n        observer = new ObserverConstructor(this);\n        this._observers.set(ObserverConstructor, observer);\n        for (const [name, domElement] of this.domRoots) {\n            observer.observe(domElement, name);\n        }\n        observer.enable();\n        return observer;\n    }\n    /**\n     * Returns observer of the given type or `undefined` if such observer has not been added yet.\n     *\n     * @param ObserverConstructor The constructor of an observer to get.\n     * @returns Observer instance or undefined.\n     */\n    getObserver(ObserverConstructor) {\n        return this._observers.get(ObserverConstructor);\n    }\n    /**\n     * Disables all added observers.\n     */\n    disableObservers() {\n        for (const observer of this._observers.values()) {\n            observer.disable();\n        }\n    }\n    /**\n     * Enables all added observers.\n     */\n    enableObservers() {\n        for (const observer of this._observers.values()) {\n            observer.enable();\n        }\n    }\n    /**\n     * Scrolls the page viewport and {@link #domRoots} with their ancestors to reveal the\n     * caret, **if not already visible to the user**.\n     *\n     * **Note**: Calling this method fires the {@link module:engine/view/view~ViewScrollToTheSelectionEvent} event that\n     * allows custom behaviors.\n     *\n     * @param options Additional configuration of the scrolling behavior.\n     * @param options.viewportOffset A distance between the DOM selection and the viewport boundary to be maintained\n     * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at\n     * the viewport boundary.\n     * @param options.ancestorOffset A distance between the DOM selection and scrollable DOM root ancestor(s) to be maintained\n     * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at\n     * the scrollable ancestor(s) boundary.\n     * @param options.alignToTop When set `true`, the DOM selection will be aligned to the top of the viewport if not already visible\n     * (see `forceScroll` to learn more).\n     * @param options.forceScroll When set `true`, the DOM selection will be aligned to the top of the viewport and scrollable ancestors\n     * whether it is already visible or not. This option will only work when `alignToTop` is `true`.\n     */\n    scrollToTheSelection({ alignToTop, forceScroll, viewportOffset = 20, ancestorOffset = 20 } = {}) {\n        const range = this.document.selection.getFirstRange();\n        if (!range) {\n            return;\n        }\n        // Clone to make sure properties like `viewportOffset` are not mutated in the event listeners.\n        const originalArgs = cloneDeep({ alignToTop, forceScroll, viewportOffset, ancestorOffset });\n        if (typeof viewportOffset === 'number') {\n            viewportOffset = {\n                top: viewportOffset,\n                bottom: viewportOffset,\n                left: viewportOffset,\n                right: viewportOffset\n            };\n        }\n        const options = {\n            target: this.domConverter.viewRangeToDom(range),\n            viewportOffset,\n            ancestorOffset,\n            alignToTop,\n            forceScroll\n        };\n        this.fire('scrollToTheSelection', options, originalArgs);\n        scrollViewportToShowTarget(options);\n    }\n    /**\n     * It will focus DOM element representing {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement}\n     * that is currently having selection inside.\n     */\n    focus() {\n        if (!this.document.isFocused) {\n            const editable = this.document.selection.editableElement;\n            if (editable) {\n                this.domConverter.focus(editable);\n                this.forceRender();\n            }\n            else {\n                // Before focusing view document, selection should be placed inside one of the view's editables.\n                // Normally its selection will be converted from model document (which have default selection), but\n                // when using view document on its own, we need to manually place selection before focusing it.\n                //\n                // @if CK_DEBUG // console.warn( 'There is no selection in any editable to focus.' );\n            }\n        }\n    }\n    /**\n     * The `change()` method is the primary way of changing the view. You should use it to modify any node in the view tree.\n     * It makes sure that after all changes are made the view is rendered to the DOM (assuming that the view will be changed\n     * inside the callback). It prevents situations when the DOM is updated when the view state is not yet correct. It allows\n     * to nest calls one inside another and still performs a single rendering after all those changes are made.\n     * It also returns the return value of its callback.\n     *\n     * ```ts\n     * const text = view.change( writer => {\n     * \tconst newText = writer.createText( 'foo' );\n     * \twriter.insert( position1, newText );\n     *\n     * \tview.change( writer => {\n     * \t\twriter.insert( position2, writer.createText( 'bar' ) );\n     * \t} );\n     *\n     * \twriter.remove( range );\n     *\n     * \treturn newText;\n     * } );\n     * ```\n     *\n     * When the outermost change block is done and rendering to the DOM is over the\n     * {@link module:engine/view/view~EditingView#event:render `View#render`} event is fired.\n     *\n     * This method throws a `applying-view-changes-on-rendering` error when\n     * the change block is used after rendering to the DOM has started.\n     *\n     * @param callback Callback function which may modify the view.\n     * @returns Value returned by the callback.\n     */\n    change(callback) {\n        if (this.isRenderingInProgress || this._postFixersInProgress) {\n            /**\n             * Thrown when there is an attempt to make changes to the view tree when it is in incorrect state. This may\n             * cause some unexpected behaviour and inconsistency between the DOM and the view.\n             * This may be caused by:\n             *\n             * * calling {@link module:engine/view/view~EditingView#change} or {@link module:engine/view/view~EditingView#forceRender}\n             * during rendering process,\n             * * calling {@link module:engine/view/view~EditingView#change} or {@link module:engine/view/view~EditingView#forceRender}\n             * inside of {@link module:engine/view/document~ViewDocument#registerPostFixer post-fixer function}.\n             *\n             * @error cannot-change-view-tree\n             */\n            throw new CKEditorError('cannot-change-view-tree', this);\n        }\n        try {\n            // Recursive call to view.change() method - execute listener immediately.\n            if (this._ongoingChange) {\n                return callback(this._writer);\n            }\n            // This lock will assure that all recursive calls to view.change() will end up in same block - one \"render\"\n            // event for all nested calls.\n            this._ongoingChange = true;\n            const callbackResult = callback(this._writer);\n            this._ongoingChange = false;\n            // This lock is used by editing controller to render changes from outer most model.change() once. As plugins might call\n            // view.change() inside model.change() block - this will ensures that postfixers and rendering are called once after all\n            // changes. Also, we don't need to render anything if there're no changes since last rendering.\n            if (!this._renderingDisabled && this._hasChangedSinceTheLastRendering) {\n                this._postFixersInProgress = true;\n                this.document._callPostFixers(this._writer);\n                this._postFixersInProgress = false;\n                this.fire('render');\n            }\n            return callbackResult;\n        }\n        catch (err) {\n            // @if CK_DEBUG // throw err;\n            /* istanbul ignore next -- @preserve */\n            CKEditorError.rethrowUnexpectedError(err, this);\n        }\n    }\n    /**\n     * Forces rendering {@link module:engine/view/document~ViewDocument view document} to DOM. If any view changes are\n     * currently in progress, rendering will start after all {@link #change change blocks} are processed.\n     *\n     * Note that this method is dedicated for special cases. All view changes should be wrapped in the {@link #change}\n     * block and the view will automatically check whether it needs to render DOM or not.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `applying-view-changes-on-rendering` when\n     * trying to re-render when rendering to DOM has already started.\n     */\n    forceRender() {\n        this._hasChangedSinceTheLastRendering = true;\n        this.getObserver(FocusObserver).flush();\n        this.change(() => { });\n    }\n    /**\n     * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.\n     */\n    destroy() {\n        for (const observer of this._observers.values()) {\n            observer.destroy();\n        }\n        this.document.destroy();\n        this.stopListening();\n    }\n    /**\n     * Creates position at the given location. The location can be specified as:\n     *\n     * * a {@link module:engine/view/position~ViewPosition position},\n     * * parent element and offset (offset defaults to `0`),\n     * * parent element and `'end'` (sets position at the end of that element),\n     * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).\n     *\n     * This method is a shortcut to other constructors such as:\n     *\n     * * {@link #createPositionBefore},\n     * * {@link #createPositionAfter},\n     *\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    createPositionAt(itemOrPosition, offset) {\n        return ViewPosition._createAt(itemOrPosition, offset);\n    }\n    /**\n     * Creates a new position after given view item.\n     *\n     * @param item View item after which the position should be located.\n     */\n    createPositionAfter(item) {\n        return ViewPosition._createAfter(item);\n    }\n    /**\n     * Creates a new position before given view item.\n     *\n     * @param item View item before which the position should be located.\n     */\n    createPositionBefore(item) {\n        return ViewPosition._createBefore(item);\n    }\n    /**\n     * Creates a range spanning from `start` position to `end` position.\n     *\n     * **Note:** This factory method creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.\n     *\n     * @param start Start position.\n     * @param end End position. If not set, range will be collapsed at `start` position.\n     */\n    createRange(start, end) {\n        return new ViewRange(start, end);\n    }\n    /**\n     * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.\n     */\n    createRangeOn(item) {\n        return ViewRange._createOn(item);\n    }\n    /**\n     * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * @param element Element which is a parent for the range.\n     */\n    createRangeIn(element) {\n        return ViewRange._createIn(element);\n    }\n    createSelection(...args) {\n        return new ViewSelection(...args);\n    }\n    /**\n     * Disables or enables rendering. If the flag is set to `true` then the rendering will be disabled.\n     * If the flag is set to `false` and if there was some change in the meantime, then the rendering action will be performed.\n     *\n     * @internal\n     * @param flag A flag indicates whether the rendering should be disabled.\n     */\n    _disableRendering(flag) {\n        this._renderingDisabled = flag;\n        if (flag == false) {\n            // Render when you stop blocking rendering.\n            this.change(() => { });\n        }\n    }\n    /**\n     * Renders all changes. In order to avoid triggering the observers (e.g. selection) all observers are disabled\n     * before rendering and re-enabled after that.\n     */\n    _render() {\n        this.isRenderingInProgress = true;\n        this.disableObservers();\n        this._renderer.render();\n        this.enableObservers();\n        this.isRenderingInProgress = false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nexport class ModelTypeCheckable {\n    /* istanbul ignore next -- @preserve */\n    is() {\n        // There are a lot of overloads above.\n        // Overriding method in derived classes remove them and only `is( type: string ): boolean` is visible which we don't want.\n        // One option would be to copy them all to all classes, but that's ugly.\n        // It's best when TypeScript compiler doesn't see those overloads, except the one in the top base class.\n        // To overload a method, but not let the compiler see it, do after class definition:\n        // `MyClass.prototype.is = function( type: string ) {...}`\n        throw new Error('is() method is abstract');\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/textproxy\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const { convertMapToStringifiedObject } = require( '../dev-utils/utils' );\n/**\n * `ModelTextProxy` represents a part of {@link module:engine/model/text~ModelText text node}.\n *\n * Since {@link module:engine/model/position~ModelPosition positions} can be placed between characters of a text node,\n * {@link module:engine/model/range~ModelRange ranges} may contain only parts of text nodes.\n * When {@link module:engine/model/range~ModelRange#getItems getting items}\n * contained in such range, we need to represent a part of that text node, since returning the whole text node would be incorrect.\n * `ModelTextProxy` solves this issue.\n *\n * `ModelTextProxy` has an API similar to {@link module:engine/model/text~ModelText Text} and allows to do\n * most of the common tasks performed on model nodes.\n *\n * **Note:** Some `ModelTextProxy` instances may represent whole text node, not just a part of it.\n * See {@link module:engine/model/textproxy~ModelTextProxy#isPartial}.\n *\n * **Note:** `ModelTextProxy` is not an instance of {@link module:engine/model/node~ModelNode node}. Keep this in mind when using it as a\n * parameter of methods.\n *\n * **Note:** `ModelTextProxy` is a readonly interface. If you want to perform changes on model data represented by a `ModelTextProxy`\n * use {@link module:engine/model/writer~ModelWriter model writer API}.\n *\n * **Note:** `ModelTextProxy` instances are created on the fly, basing on the current state of model. Because of this, it is\n * highly unrecommended to store references to `ModelTextProxy` instances. `ModelTextProxy` instances are not refreshed when\n * model changes, so they might get invalidated. Instead, consider creating {@link module:engine/model/liveposition~ModelLivePosition live\n * position}.\n *\n * `ModelTextProxy` instances are created by {@link module:engine/model/treewalker~ModelTreeWalker model tree walker}.\n * You should not need to create an instance of this class by your own.\n */\nexport class ModelTextProxy extends ModelTypeCheckable {\n    /**\n     * Text node which part is represented by this text proxy.\n     */\n    textNode;\n    /**\n     * Text data represented by this text proxy.\n     */\n    data;\n    /**\n     * Offset in {@link module:engine/model/textproxy~ModelTextProxy#textNode text node} from which the text proxy starts.\n     */\n    offsetInText;\n    /**\n     * Creates a text proxy.\n     *\n     * @internal\n     * @param textNode Text node which part is represented by this text proxy.\n     * @param offsetInText Offset in {@link module:engine/model/textproxy~ModelTextProxy#textNode text node} from which the text proxy\n     * starts.\n     * @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.\n     */\n    constructor(textNode, offsetInText, length) {\n        super();\n        this.textNode = textNode;\n        if (offsetInText < 0 || offsetInText > textNode.offsetSize) {\n            /**\n             * Given `offsetInText` value is incorrect.\n             *\n             * @error model-textproxy-wrong-offsetintext\n             */\n            throw new CKEditorError('model-textproxy-wrong-offsetintext', this);\n        }\n        if (length < 0 || offsetInText + length > textNode.offsetSize) {\n            /**\n             * Given `length` value is incorrect.\n             *\n             * @error model-textproxy-wrong-length\n             */\n            throw new CKEditorError('model-textproxy-wrong-length', this);\n        }\n        this.data = textNode.data.substring(offsetInText, offsetInText + length);\n        this.offsetInText = offsetInText;\n    }\n    /**\n     * Offset at which this text proxy starts in it's parent.\n     *\n     * @see module:engine/model/node~ModelNode#startOffset\n     */\n    get startOffset() {\n        return this.textNode.startOffset !== null ? this.textNode.startOffset + this.offsetInText : null;\n    }\n    /**\n     * Offset size of this text proxy. Equal to the number of characters represented by the text proxy.\n     *\n     * @see module:engine/model/node~ModelNode#offsetSize\n     */\n    get offsetSize() {\n        return this.data.length;\n    }\n    /**\n     * Offset at which this text proxy ends in it's parent.\n     *\n     * @see module:engine/model/node~ModelNode#endOffset\n     */\n    get endOffset() {\n        return this.startOffset !== null ? this.startOffset + this.offsetSize : null;\n    }\n    /**\n     * Flag indicating whether `ModelTextProxy` instance covers only part of the original\n     * {@link module:engine/model/text~ModelText text node} (`true`) or the whole text node (`false`).\n     *\n     * This is `false` when text proxy starts at the very beginning of\n     * {@link module:engine/model/textproxy~ModelTextProxy#textNode textNode}\n     * ({@link module:engine/model/textproxy~ModelTextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to\n     * text node size.\n     */\n    get isPartial() {\n        return this.offsetSize !== this.textNode.offsetSize;\n    }\n    /**\n     * Parent of this text proxy, which is same as parent of text node represented by this text proxy.\n     */\n    get parent() {\n        return this.textNode.parent;\n    }\n    /**\n     * Root of this text proxy, which is same as root of text node represented by this text proxy.\n     */\n    get root() {\n        return this.textNode.root;\n    }\n    /**\n     * Gets path to this text proxy.\n     *\n     * @see module:engine/model/node~ModelNode#getPath\n     */\n    getPath() {\n        const path = this.textNode.getPath();\n        if (path.length > 0) {\n            path[path.length - 1] += this.offsetInText;\n        }\n        return path;\n    }\n    /**\n     * Returns ancestors array of this text proxy.\n     *\n     * @param options Options object.\n     * @param options.includeSelf When set to `true` this text proxy will be also included in parent's array.\n     * @param options.parentFirst When set to `true`, array will be sorted from text proxy parent to root element,\n     * otherwise root element will be the first item in the array.\n     * @returns Array with ancestors.\n     */\n    getAncestors(options = {}) {\n        const ancestors = [];\n        let parent = options.includeSelf ? this : this.parent;\n        while (parent) {\n            ancestors[options.parentFirst ? 'push' : 'unshift'](parent);\n            parent = parent.parent;\n        }\n        return ancestors;\n    }\n    /**\n     * Checks if this text proxy has an attribute for given key.\n     *\n     * @param key Key of attribute to check.\n     * @returns `true` if attribute with given key is set on text proxy, `false` otherwise.\n     */\n    hasAttribute(key) {\n        return this.textNode.hasAttribute(key);\n    }\n    /**\n     * Gets an attribute value for given key or `undefined` if that attribute is not set on text proxy.\n     *\n     * @param key Key of attribute to look for.\n     * @returns Attribute value or `undefined`.\n     */\n    getAttribute(key) {\n        return this.textNode.getAttribute(key);\n    }\n    /**\n     * Returns iterator that iterates over this node's attributes. Attributes are returned as arrays containing two\n     * items. First one is attribute key and second is attribute value.\n     *\n     * This format is accepted by native `Map` object and also can be passed in `Node` constructor.\n     */\n    getAttributes() {\n        return this.textNode.getAttributes();\n    }\n    /**\n     * Returns iterator that iterates over this node's attribute keys.\n     */\n    getAttributeKeys() {\n        return this.textNode.getAttributeKeys();\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelTextProxy.prototype.is = function (type) {\n    return type === '$textProxy' || type === 'model:$textProxy' ||\n        // This are legacy values kept for backward compatibility.\n        type === 'textProxy' || type === 'model:textProxy';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ModelPosition, getTextNodeAtPosition, getNodeAfterPosition, getNodeBeforePosition } from './position.js';\nimport { ModelTextProxy } from './textproxy.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Position iterator class. It allows to iterate forward and backward over the document.\n */\nexport class ModelTreeWalker {\n    /**\n     * Walking direction. Defaults `'forward'`.\n     */\n    direction;\n    /**\n     * Iterator boundaries.\n     *\n     * When the iterator is walking `'forward'` on the end of boundary or is walking `'backward'`\n     * on the start of boundary, then `{ done: true }` is returned.\n     *\n     * If boundaries are not defined they are set before first and after last child of the root node.\n     */\n    boundaries;\n    /**\n     * Flag indicating whether all consecutive characters with the same attributes should be\n     * returned as one {@link module:engine/model/textproxy~ModelTextProxy} (`true`) or one by one (`false`).\n     */\n    singleCharacters;\n    /**\n     * Flag indicating whether iterator should enter elements or not. If the iterator is shallow child nodes of any\n     * iterated node will not be returned along with `elementEnd` tag.\n     */\n    shallow;\n    /**\n     * Flag indicating whether iterator should ignore `elementEnd` tags. If the option is true walker will not\n     * return a parent node of the start position. If this option is `true` each {@link module:engine/model/element~ModelElement} will\n     * be returned once, while if the option is `false` they might be returned twice:\n     * for `'elementStart'` and `'elementEnd'`.\n     */\n    ignoreElementEnd;\n    /**\n     * Iterator position. This is always static position, even if the initial position was a\n     * {@link module:engine/model/liveposition~ModelLivePosition live position}. If start position is not defined then position depends\n     * on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction\n     * is `'backward'` position starts from the end.\n     */\n    _position;\n    /**\n     * Start boundary cached for optimization purposes.\n     */\n    _boundaryStartParent;\n    /**\n     * End boundary cached for optimization purposes.\n     */\n    _boundaryEndParent;\n    /**\n     * Parent of the most recently visited node. Cached for optimization purposes.\n     */\n    _visitedParent;\n    /**\n     * Creates a range iterator. All parameters are optional, but you have to specify either `boundaries` or `startPosition`.\n     *\n     * @param options Object with configuration.\n     */\n    constructor(options) {\n        if (!options || (!options.boundaries && !options.startPosition)) {\n            /**\n             * Neither boundaries nor starting position of a `TreeWalker` have been defined.\n             *\n             * @error model-tree-walker-no-start-position\n             */\n            throw new CKEditorError('model-tree-walker-no-start-position', null);\n        }\n        const direction = options.direction || 'forward';\n        if (direction != 'forward' && direction != 'backward') {\n            /**\n             * Only `backward` and `forward` direction allowed.\n             *\n             * @error model-tree-walker-unknown-direction\n             */\n            throw new CKEditorError('model-tree-walker-unknown-direction', options, { direction });\n        }\n        this.direction = direction;\n        this.boundaries = options.boundaries || null;\n        if (options.startPosition) {\n            this._position = options.startPosition.clone();\n        }\n        else {\n            this._position = ModelPosition._createAt(this.boundaries[this.direction == 'backward' ? 'end' : 'start']);\n        }\n        // Reset position stickiness in case it was set to other value, as the stickiness is kept after cloning.\n        this.position.stickiness = 'toNone';\n        this.singleCharacters = !!options.singleCharacters;\n        this.shallow = !!options.shallow;\n        this.ignoreElementEnd = !!options.ignoreElementEnd;\n        this._boundaryStartParent = this.boundaries ? this.boundaries.start.parent : null;\n        this._boundaryEndParent = this.boundaries ? this.boundaries.end.parent : null;\n        this._visitedParent = this.position.parent;\n    }\n    /**\n     * Iterable interface.\n     *\n     * @returns {Iterable.<module:engine/model/treewalker~ModelTreeWalkerValue>}\n     */\n    [Symbol.iterator]() {\n        return this;\n    }\n    /**\n     * Iterator position. This is always static position, even if the initial position was a\n     * {@link module:engine/model/liveposition~ModelLivePosition live position}. If start position is not defined then position depends\n     * on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction\n     * is `'backward'` position starts from the end.\n     */\n    get position() {\n        return this._position;\n    }\n    /**\n     * Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.\n     *\n     * For example:\n     *\n     * ```ts\n     * walker.skip( value => value.type == 'text' ); // <paragraph>[]foo</paragraph> -> <paragraph>foo[]</paragraph>\n     * walker.skip( () => true ); // Move the position to the end: <paragraph>[]foo</paragraph> -> <paragraph>foo</paragraph>[]\n     * walker.skip( () => false ); // Do not move the position.\n     * ```\n     *\n     * @param skip Callback function. Gets {@link module:engine/model/treewalker~ModelTreeWalkerValue} and should\n     * return `true` if the value should be skipped or `false` if not.\n     */\n    skip(skip) {\n        let done, value, prevPosition, prevVisitedParent;\n        do {\n            prevPosition = this.position;\n            prevVisitedParent = this._visitedParent;\n            ({ done, value } = this.next());\n        } while (!done && skip(value));\n        if (!done) {\n            this._position = prevPosition;\n            this._visitedParent = prevVisitedParent;\n        }\n    }\n    /**\n     * Moves tree walker {@link #position} to provided `position`. Tree walker will\n     * continue traversing from that position.\n     *\n     * Note: in contrary to {@link ~ModelTreeWalker#skip}, this method does not iterate over the nodes along the way.\n     * It simply sets the current tree walker position to a new one.\n     * From the performance standpoint, it is better to use {@link ~ModelTreeWalker#jumpTo} rather than {@link ~ModelTreeWalker#skip}.\n     *\n     * If the provided position is before the start boundary, the position will be\n     * set to the start boundary. If the provided position is after the end boundary,\n     * the position will be set to the end boundary.\n     * This is done to prevent the treewalker from traversing outside the boundaries.\n     *\n     * @param position Position to jump to.\n     */\n    jumpTo(position) {\n        if (this._boundaryStartParent && position.isBefore(this.boundaries.start)) {\n            position = this.boundaries.start;\n        }\n        else if (this._boundaryEndParent && position.isAfter(this.boundaries.end)) {\n            position = this.boundaries.end;\n        }\n        this._position = position.clone();\n        this._visitedParent = position.parent;\n    }\n    /**\n     * Gets the next tree walker's value.\n     */\n    next() {\n        if (this.direction == 'forward') {\n            return this._next();\n        }\n        else {\n            return this._previous();\n        }\n    }\n    /**\n     * Makes a step forward in model. Moves the {@link #position} to the next position and returns the encountered value.\n     */\n    _next() {\n        const previousPosition = this.position;\n        const position = this.position.clone();\n        const parent = this._visitedParent;\n        // We are at the end of the root.\n        if (parent.parent === null && position.offset === parent.maxOffset) {\n            return { done: true, value: undefined };\n        }\n        // We reached the walker boundary.\n        if (parent === this._boundaryEndParent && position.offset == this.boundaries.end.offset) {\n            return { done: true, value: undefined };\n        }\n        // Get node just after the current position.\n        // Use a highly optimized version instead of checking the text node first and then getting the node after. See #6582.\n        const textNodeAtPosition = getTextNodeAtPosition(position, parent);\n        const node = textNodeAtPosition || getNodeAfterPosition(position, parent, textNodeAtPosition);\n        if (node && node.is('model:element')) {\n            if (!this.shallow) {\n                // Manual operations on path internals for optimization purposes. Here and in the rest of the method.\n                position.path.push(0);\n                this._visitedParent = node;\n            }\n            else {\n                // We are past the walker boundaries.\n                if (this.boundaries && this.boundaries.end.isBefore(position)) {\n                    return { done: true, value: undefined };\n                }\n                position.offset++;\n            }\n            this._position = position;\n            return formatReturnValue('elementStart', node, previousPosition, position, 1);\n        }\n        if (node && node.is('model:$text')) {\n            let charactersCount;\n            if (this.singleCharacters) {\n                charactersCount = 1;\n            }\n            else {\n                let offset = node.endOffset;\n                if (this._boundaryEndParent == parent && this.boundaries.end.offset < offset) {\n                    offset = this.boundaries.end.offset;\n                }\n                charactersCount = offset - position.offset;\n            }\n            const offsetInTextNode = position.offset - node.startOffset;\n            const item = new ModelTextProxy(node, offsetInTextNode, charactersCount);\n            position.offset += charactersCount;\n            this._position = position;\n            return formatReturnValue('text', item, previousPosition, position, charactersCount);\n        }\n        // `node` is not set, we reached the end of current `parent`.\n        position.path.pop();\n        position.offset++;\n        this._position = position;\n        this._visitedParent = parent.parent;\n        if (this.ignoreElementEnd) {\n            return this._next();\n        }\n        return formatReturnValue('elementEnd', parent, previousPosition, position);\n    }\n    /**\n     * Makes a step backward in model. Moves the {@link #position} to the previous position and returns the encountered value.\n     */\n    _previous() {\n        const previousPosition = this.position;\n        const position = this.position.clone();\n        const parent = this._visitedParent;\n        // We are at the beginning of the root.\n        if (parent.parent === null && position.offset === 0) {\n            return { done: true, value: undefined };\n        }\n        // We reached the walker boundary.\n        if (parent == this._boundaryStartParent && position.offset == this.boundaries.start.offset) {\n            return { done: true, value: undefined };\n        }\n        // Get node just before the current position.\n        // Use a highly optimized version instead of checking the text node first and then getting the node before. See #6582.\n        const positionParent = position.parent;\n        const textNodeAtPosition = getTextNodeAtPosition(position, positionParent);\n        const node = textNodeAtPosition || getNodeBeforePosition(position, positionParent, textNodeAtPosition);\n        if (node && node.is('model:element')) {\n            position.offset--;\n            if (this.shallow) {\n                this._position = position;\n                return formatReturnValue('elementStart', node, previousPosition, position, 1);\n            }\n            position.path.push(node.maxOffset);\n            this._position = position;\n            this._visitedParent = node;\n            if (this.ignoreElementEnd) {\n                return this._previous();\n            }\n            return formatReturnValue('elementEnd', node, previousPosition, position);\n        }\n        if (node && node.is('model:$text')) {\n            let charactersCount;\n            if (this.singleCharacters) {\n                charactersCount = 1;\n            }\n            else {\n                let offset = node.startOffset;\n                if (this._boundaryStartParent == parent && this.boundaries.start.offset > offset) {\n                    offset = this.boundaries.start.offset;\n                }\n                charactersCount = position.offset - offset;\n            }\n            const offsetInTextNode = position.offset - node.startOffset;\n            const item = new ModelTextProxy(node, offsetInTextNode - charactersCount, charactersCount);\n            position.offset -= charactersCount;\n            this._position = position;\n            return formatReturnValue('text', item, previousPosition, position, charactersCount);\n        }\n        // `node` is not set, we reached the beginning of current `parent`.\n        position.path.pop();\n        this._position = position;\n        this._visitedParent = parent.parent;\n        return formatReturnValue('elementStart', parent, previousPosition, position, 1);\n    }\n}\nfunction formatReturnValue(type, item, previousPosition, nextPosition, length) {\n    return {\n        done: false,\n        value: {\n            type,\n            item,\n            previousPosition,\n            nextPosition,\n            length\n        }\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/position\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { ModelTreeWalker } from './treewalker.js';\nimport { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';\n/**\n * Represents a position in the model tree.\n *\n * A position is represented by its {@link module:engine/model/position~ModelPosition#root} and\n * a {@link module:engine/model/position~ModelPosition#path} in that root.\n *\n * You can create position instances via its constructor or the `createPosition*()` factory methods of\n * {@link module:engine/model/model~Model} and {@link module:engine/model/writer~ModelWriter}.\n *\n * **Note:** Position is based on offsets, not indexes. This means that a position between two text nodes\n * `foo` and `bar` has offset `3`, not `1`. See {@link module:engine/model/position~ModelPosition#path} for more information.\n *\n * Since a position in the model is represented by a {@link module:engine/model/position~ModelPosition#root position root} and\n * {@link module:engine/model/position~ModelPosition#path position path} it is possible to create positions placed in non-existing places.\n * This requirement is important for operational transformation algorithms.\n *\n * Also, {@link module:engine/model/operation/operation~Operation operations}\n * kept in the {@link module:engine/model/document~ModelDocument#history document history}\n * are storing positions (and ranges) which were correct when those operations were applied, but may not be correct\n * after the document has changed.\n *\n * When changes are applied to the model, it may also happen that {@link module:engine/model/position~ModelPosition#parent position parent}\n * will change even if position path has not changed. Keep in mind, that if a position leads to non-existing element,\n * {@link module:engine/model/position~ModelPosition#parent} and some other properties and methods will throw errors.\n *\n * In most cases, position with wrong path is caused by an error in code, but it is sometimes needed, as described above.\n */\nexport class ModelPosition extends ModelTypeCheckable {\n    /**\n     * Root of the position path.\n     */\n    root;\n    /**\n     * Position of the node in the tree. **Path contains offsets, not indexes.**\n     *\n     * Position can be placed before, after or in a {@link module:engine/model/node~ModelNode node} if that node has\n     * {@link module:engine/model/node~ModelNode#offsetSize} greater than `1`. Items in position path are\n     * {@link module:engine/model/node~ModelNode#startOffset starting offsets} of position ancestors, starting from direct root children,\n     * down to the position offset in it's parent.\n     *\n     * ```\n     * ROOT\n     *  |- P            before: [ 0 ]         after: [ 1 ]\n     *  |- UL           before: [ 1 ]         after: [ 2 ]\n     *     |- LI        before: [ 1, 0 ]      after: [ 1, 1 ]\n     *     |  |- foo    before: [ 1, 0, 0 ]   after: [ 1, 0, 3 ]\n     *     |- LI        before: [ 1, 1 ]      after: [ 1, 2 ]\n     *        |- bar    before: [ 1, 1, 0 ]   after: [ 1, 1, 3 ]\n     * ```\n     *\n     * `foo` and `bar` are representing {@link module:engine/model/text~ModelText text nodes}. Since text nodes has offset size\n     * greater than `1` you can place position offset between their start and end:\n     *\n     * ```\n     * ROOT\n     *  |- P\n     *  |- UL\n     *     |- LI\n     *     |  |- f^o|o  ^ has path: [ 1, 0, 1 ]   | has path: [ 1, 0, 2 ]\n     *     |- LI\n     *        |- b^a|r  ^ has path: [ 1, 1, 1 ]   | has path: [ 1, 1, 2 ]\n     * ```\n     */\n    path;\n    /**\n     * Position stickiness. See {@link module:engine/model/position~ModelPositionStickiness}.\n     */\n    stickiness;\n    /**\n     * Creates a position.\n     *\n     * @param root Root of the position.\n     * @param path Position path. See {@link module:engine/model/position~ModelPosition#path}.\n     * @param stickiness Position stickiness. See {@link module:engine/model/position~ModelPositionStickiness}.\n     */\n    constructor(root, path, stickiness = 'toNone') {\n        super();\n        if (!root.is('element') && !root.is('documentFragment')) {\n            /**\n             * Position root is invalid.\n             *\n             * Positions can only be anchored in elements or document fragments.\n             *\n             * @error model-position-root-invalid\n             */\n            throw new CKEditorError('model-position-root-invalid', root);\n        }\n        if (!Array.isArray(path) || path.length === 0) {\n            /**\n             * Position path must be an array with at least one item.\n             *\n             * @error model-position-path-incorrect-format\n             * @param {Array.<number>} path A path to the position.\n             */\n            throw new CKEditorError('model-position-path-incorrect-format', root, { path });\n        }\n        // Normalize the root and path when element (not root) is passed.\n        if (root.is('rootElement')) {\n            path = path.slice();\n        }\n        else {\n            path = [...root.getPath(), ...path];\n            root = root.root;\n        }\n        this.root = root;\n        this.path = path;\n        this.stickiness = stickiness;\n    }\n    /**\n     * Offset at which this position is located in its {@link module:engine/model/position~ModelPosition#parent parent}. It is equal\n     * to the last item in position {@link module:engine/model/position~ModelPosition#path path}.\n     *\n     * @type {Number}\n     */\n    get offset() {\n        return this.path[this.path.length - 1];\n    }\n    set offset(newOffset) {\n        this.path[this.path.length - 1] = newOffset;\n    }\n    /**\n     * Parent element of this position.\n     *\n     * Keep in mind that `parent` value is calculated when the property is accessed.\n     * If {@link module:engine/model/position~ModelPosition#path position path}\n     * leads to a non-existing element, `parent` property will throw error.\n     *\n     * Also it is a good idea to cache `parent` property if it is used frequently in an algorithm (i.e. in a long loop).\n     */\n    get parent() {\n        let parent = this.root;\n        for (let i = 0; i < this.path.length - 1; i++) {\n            parent = parent.getChildAtOffset(this.path[i]);\n            if (!parent) {\n                /**\n                 * The position's path is incorrect. This means that a position does not point to\n                 * a correct place in the tree and hence, some of its methods and getters cannot work correctly.\n                 *\n                 * **Note**: Unlike DOM and view positions, in the model, the\n                 * {@link module:engine/model/position~ModelPosition#parent position's parent} is always an element or a document fragment.\n                 * The last offset in the\n                 * {@link module:engine/model/position~ModelPosition#path position's path} is the point in this element\n                 * where this position points.\n                 *\n                 * Read more about model positions and offsets in\n                 * the {@glink framework/architecture/editing-engine#indexes-and-offsets Editing engine architecture} guide.\n                 *\n                 * @error model-position-path-incorrect\n                 * @param {module:engine/model/position~ModelPosition} position The incorrect position.\n                 */\n                throw new CKEditorError('model-position-path-incorrect', this, { position: this });\n            }\n        }\n        if (parent.is('$text')) {\n            throw new CKEditorError('model-position-path-incorrect', this, { position: this });\n        }\n        return parent;\n    }\n    /**\n     * Position {@link module:engine/model/position~ModelPosition#offset offset} converted to an index in position's parent node. It is\n     * equal to the {@link module:engine/model/node~ModelNode#index index} of a node after this position. If position is placed\n     * in text node, position index is equal to the index of that text node.\n     */\n    get index() {\n        return this.parent.offsetToIndex(this.offset);\n    }\n    /**\n     * Returns {@link module:engine/model/text~ModelText text node} instance in which this position is placed or `null` if this\n     * position is not in a text node.\n     */\n    get textNode() {\n        return getTextNodeAtPosition(this, this.parent);\n    }\n    /**\n     * Node directly after this position. Returns `null` if this position is at the end of its parent, or if it is in a text node.\n     */\n    get nodeAfter() {\n        // Cache the parent and reuse for performance reasons. See #6579 and #6582.\n        const parent = this.parent;\n        return getNodeAfterPosition(this, parent, getTextNodeAtPosition(this, parent));\n    }\n    /**\n     * Node directly before this position. Returns `null` if this position is at the start of its parent, or if it is in a text node.\n     */\n    get nodeBefore() {\n        // Cache the parent and reuse for performance reasons. See #6579 and #6582.\n        const parent = this.parent;\n        return getNodeBeforePosition(this, parent, getTextNodeAtPosition(this, parent));\n    }\n    /**\n     * Is `true` if position is at the beginning of its {@link module:engine/model/position~ModelPosition#parent parent}, `false` otherwise.\n     */\n    get isAtStart() {\n        return this.offset === 0;\n    }\n    /**\n     * Is `true` if position is at the end of its {@link module:engine/model/position~ModelPosition#parent parent}, `false` otherwise.\n     */\n    get isAtEnd() {\n        return this.offset == this.parent.maxOffset;\n    }\n    /**\n     * Checks whether the position is valid in current model tree, that is whether it points to an existing place in the model.\n     */\n    isValid() {\n        if (this.offset < 0) {\n            return false;\n        }\n        let parent = this.root;\n        for (let i = 0; i < this.path.length - 1; i++) {\n            parent = parent.getChildAtOffset(this.path[i]);\n            if (!parent) {\n                return false;\n            }\n        }\n        return this.offset <= parent.maxOffset;\n    }\n    /**\n     * Checks whether this position is before or after given position.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     */\n    compareWith(otherPosition) {\n        if (this.root != otherPosition.root) {\n            return 'different';\n        }\n        const result = compareArrays(this.path, otherPosition.path);\n        switch (result) {\n            case 'same':\n                return 'same';\n            case 'prefix':\n                return 'before';\n            case 'extension':\n                return 'after';\n            default:\n                return this.path[result] < otherPosition.path[result] ? 'before' : 'after';\n        }\n    }\n    /**\n     * Gets the farthest position which matches the callback using\n     * {@link module:engine/model/treewalker~ModelTreeWalker TreeWalker}.\n     *\n     * For example:\n     *\n     * ```ts\n     * getLastMatchingPosition( value => value.type == 'text' );\n     * // <paragraph>[]foo</paragraph> -> <paragraph>foo[]</paragraph>\n     *\n     * getLastMatchingPosition( value => value.type == 'text', { direction: 'backward' } );\n     * // <paragraph>foo[]</paragraph> -> <paragraph>[]foo</paragraph>\n     *\n     * getLastMatchingPosition( value => false );\n     * // Do not move the position.\n     * ```\n     *\n     * @param skip Callback function. Gets {@link module:engine/model/treewalker~ModelTreeWalkerValue} and should\n     * return `true` if the value should be skipped or `false` if not.\n     * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.\n     *\n     * @returns The position after the last item which matches the `skip` callback test.\n     */\n    getLastMatchingPosition(skip, options = {}) {\n        options.startPosition = this;\n        const treeWalker = new ModelTreeWalker(options);\n        treeWalker.skip(skip);\n        return treeWalker.position;\n    }\n    /**\n     * Returns a path to this position's parent. Parent path is equal to position\n     * {@link module:engine/model/position~ModelPosition#path path} but without the last item.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @returns Path to the parent.\n     */\n    getParentPath() {\n        return this.path.slice(0, -1);\n    }\n    /**\n     * Returns ancestors array of this position, that is this position's parent and its ancestors.\n     *\n     * @returns Array with ancestors.\n     */\n    getAncestors() {\n        const parent = this.parent;\n        if (parent.is('documentFragment')) {\n            return [parent];\n        }\n        else {\n            return parent.getAncestors({ includeSelf: true });\n        }\n    }\n    /**\n     * Returns the parent element of the given name. Returns null if the position is not inside the desired parent.\n     *\n     * @param parentName The name of the parent element to find.\n     */\n    findAncestor(parentName) {\n        const parent = this.parent;\n        if (parent.is('element')) {\n            return parent.findAncestor(parentName, { includeSelf: true });\n        }\n        return null;\n    }\n    /**\n     * Returns the slice of two position {@link #path paths} which is identical. The {@link #root roots}\n     * of these two paths must be identical.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @param position The second position.\n     * @returns The common path.\n     */\n    getCommonPath(position) {\n        if (this.root != position.root) {\n            return [];\n        }\n        // We find on which tree-level start and end have the lowest common ancestor\n        const cmp = compareArrays(this.path, position.path);\n        // If comparison returned string it means that arrays are same.\n        const diffAt = (typeof cmp == 'string') ? Math.min(this.path.length, position.path.length) : cmp;\n        return this.path.slice(0, diffAt);\n    }\n    /**\n     * Returns an {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}\n     * which is a common ancestor of both positions. The {@link #root roots} of these two positions must be identical.\n     *\n     * @param position The second position.\n     */\n    getCommonAncestor(position) {\n        const ancestorsA = this.getAncestors();\n        const ancestorsB = position.getAncestors();\n        let i = 0;\n        while (ancestorsA[i] == ancestorsB[i] && ancestorsA[i]) {\n            i++;\n        }\n        return i === 0 ? null : ancestorsA[i - 1];\n    }\n    /**\n     * Returns a new instance of `Position`, that has same {@link #parent parent} but it's offset\n     * is shifted by `shift` value (can be a negative value).\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @param shift Offset shift. Can be a negative value.\n     * @returns Shifted position.\n     */\n    getShiftedBy(shift) {\n        const shifted = this.clone();\n        const offset = shifted.offset + shift;\n        shifted.offset = offset < 0 ? 0 : offset;\n        return shifted;\n    }\n    /**\n     * Checks whether this position is after given position.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @see module:engine/model/position~ModelPosition#isBefore\n     * @param  otherPosition Position to compare with.\n     * @returns True if this position is after given position.\n     */\n    isAfter(otherPosition) {\n        return this.compareWith(otherPosition) == 'after';\n    }\n    /**\n     * Checks whether this position is before given position.\n     *\n     * **Note:** watch out when using negation of the value returned by this method, because the negation will also\n     * be `true` if positions are in different roots and you might not expect this. You should probably use\n     * `a.isAfter( b ) || a.isEqual( b )` or `!a.isBefore( p ) && a.root == b.root` in most scenarios. If your\n     * condition uses multiple `isAfter` and `isBefore` checks, build them so they do not use negated values, i.e.:\n     *\n     * ```ts\n     * if ( a.isBefore( b ) && c.isAfter( d ) ) {\n     * \t// do A.\n     * } else {\n     * \t// do B.\n     * }\n     * ```\n     *\n     * or, if you have only one if-branch:\n     *\n     * ```ts\n     * if ( !( a.isBefore( b ) && c.isAfter( d ) ) {\n     * \t// do B.\n     * }\n     * ```\n     *\n     * rather than:\n     *\n     * ```ts\n     * if ( !a.isBefore( b ) || && !c.isAfter( d ) ) {\n     * \t// do B.\n     * } else {\n     * \t// do A.\n     * }\n     * ```\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @param otherPosition Position to compare with.\n     * @returns True if this position is before given position.\n     */\n    isBefore(otherPosition) {\n        return this.compareWith(otherPosition) == 'before';\n    }\n    /**\n     * Checks whether this position is equal to given position.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @param otherPosition Position to compare with.\n     * @returns True if positions are same.\n     */\n    isEqual(otherPosition) {\n        return this.compareWith(otherPosition) == 'same';\n    }\n    /**\n     * Checks whether this position is touching given position. Positions touch when there are no text nodes\n     * or empty nodes in a range between them. Technically, those positions are not equal but in many cases\n     * they are very similar or even indistinguishable.\n     *\n     * @param otherPosition Position to compare with.\n     * @returns True if positions touch.\n     */\n    isTouching(otherPosition) {\n        if (this.root !== otherPosition.root) {\n            return false;\n        }\n        const commonLevel = Math.min(this.path.length, otherPosition.path.length);\n        for (let level = 0; level < commonLevel; level++) {\n            const diff = this.path[level] - otherPosition.path[level];\n            // Positions are spread by a node, so they are not touching.\n            if (diff < -1 || diff > 1) {\n                return false;\n            }\n            else if (diff === 1) {\n                // `otherPosition` is on the left.\n                // `this` is on the right.\n                return checkTouchingBranch(otherPosition, this, level);\n            }\n            else if (diff === -1) {\n                // `this` is on the left.\n                // `otherPosition` is on the right.\n                return checkTouchingBranch(this, otherPosition, level);\n            }\n            // `diff === 0`.\n            // Positions are inside the same element on this level, compare deeper.\n        }\n        // If we ended up here, it means that positions paths have the same beginning.\n        // If the paths have the same length, then it means that they are identical, so the positions are same.\n        if (this.path.length === otherPosition.path.length) {\n            return true;\n        }\n        // If positions have different length of paths, then the common part is the same.\n        // In this case, the \"shorter\" position is on the left, the \"longer\" position is on the right.\n        //\n        // If the positions are touching, the \"longer\" position must have only zeroes. For example:\n        // [ 1, 2 ] vs [ 1, 2, 0 ]\n        // [ 1, 2 ] vs [ 1, 2, 0, 0, 0 ]\n        else if (this.path.length > otherPosition.path.length) {\n            return checkOnlyZeroes(this.path, commonLevel);\n        }\n        else {\n            return checkOnlyZeroes(otherPosition.path, commonLevel);\n        }\n    }\n    /**\n     * Checks if two positions are in the same parent.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @param position Position to compare with.\n     * @returns `true` if positions have the same parent, `false` otherwise.\n     */\n    hasSameParentAs(position) {\n        if (this.root !== position.root) {\n            return false;\n        }\n        const thisParentPath = this.getParentPath();\n        const posParentPath = position.getParentPath();\n        return compareArrays(thisParentPath, posParentPath) == 'same';\n    }\n    /**\n     * Returns a copy of this position that is transformed by given `operation`.\n     *\n     * The new position's parameters are updated accordingly to the effect of the `operation`.\n     *\n     * For example, if `n` nodes are inserted before the position, the returned position {@link ~ModelPosition#offset} will be\n     * increased by `n`. If the position was in a merged element, it will be accordingly moved to the new element, etc.\n     *\n     * This method is safe to use it on non-existing positions (for example during operational transformation).\n     *\n     * @param operation Operation to transform by.\n     * @returns Transformed position.\n     */\n    getTransformedByOperation(operation) {\n        let result;\n        switch (operation.type) {\n            case 'insert':\n                result = this._getTransformedByInsertOperation(operation);\n                break;\n            case 'move':\n            case 'remove':\n            case 'reinsert':\n                result = this._getTransformedByMoveOperation(operation);\n                break;\n            case 'split':\n                result = this._getTransformedBySplitOperation(operation);\n                break;\n            case 'merge':\n                result = this._getTransformedByMergeOperation(operation);\n                break;\n            default:\n                result = ModelPosition._createAt(this);\n                break;\n        }\n        return result;\n    }\n    /**\n     * Returns a copy of this position transformed by an insert operation.\n     *\n     * @internal\n     */\n    _getTransformedByInsertOperation(operation) {\n        return this._getTransformedByInsertion(operation.position, operation.howMany);\n    }\n    /**\n     * Returns a copy of this position transformed by a move operation.\n     *\n     * @internal\n     */\n    _getTransformedByMoveOperation(operation) {\n        return this._getTransformedByMove(operation.sourcePosition, operation.targetPosition, operation.howMany);\n    }\n    /**\n     * Returns a copy of this position transformed by a split operation.\n     *\n     * @internal\n     */\n    _getTransformedBySplitOperation(operation) {\n        const movedRange = operation.movedRange;\n        const isContained = movedRange.containsPosition(this) ||\n            (movedRange.start.isEqual(this) && this.stickiness == 'toNext');\n        if (isContained) {\n            return this._getCombined(operation.splitPosition, operation.moveTargetPosition);\n        }\n        else {\n            if (operation.graveyardPosition) {\n                return this._getTransformedByMove(operation.graveyardPosition, operation.insertionPosition, 1);\n            }\n            else {\n                return this._getTransformedByInsertion(operation.insertionPosition, 1);\n            }\n        }\n    }\n    /**\n     * Returns a copy of this position transformed by merge operation.\n     *\n     * @internal\n     */\n    _getTransformedByMergeOperation(operation) {\n        const movedRange = operation.movedRange;\n        const isContained = movedRange.containsPosition(this) || movedRange.start.isEqual(this);\n        let pos;\n        if (isContained) {\n            pos = this._getCombined(operation.sourcePosition, operation.targetPosition);\n            if (operation.sourcePosition.isBefore(operation.targetPosition)) {\n                // Above happens during OT when the merged element is moved before the merged-to element.\n                pos = pos._getTransformedByDeletion(operation.deletionPosition, 1);\n            }\n        }\n        else if (this.isEqual(operation.deletionPosition)) {\n            pos = ModelPosition._createAt(operation.deletionPosition);\n        }\n        else {\n            pos = this._getTransformedByMove(operation.deletionPosition, operation.graveyardPosition, 1);\n        }\n        return pos;\n    }\n    /**\n     * Returns a copy of this position that is updated by removing `howMany` nodes starting from `deletePosition`.\n     * It may happen that this position is in a removed node. If that is the case, `null` is returned instead.\n     *\n     * @internal\n     * @param deletePosition Position before the first removed node.\n     * @param howMany How many nodes are removed.\n     * @returns Transformed position or `null`.\n     */\n    _getTransformedByDeletion(deletePosition, howMany) {\n        const transformed = ModelPosition._createAt(this);\n        // This position can't be affected if deletion was in a different root.\n        if (this.root != deletePosition.root) {\n            return transformed;\n        }\n        if (compareArrays(deletePosition.getParentPath(), this.getParentPath()) == 'same') {\n            // If nodes are removed from the node that is pointed by this position...\n            if (deletePosition.offset < this.offset) {\n                // And are removed from before an offset of that position...\n                if (deletePosition.offset + howMany > this.offset) {\n                    // Position is in removed range, it's no longer in the tree.\n                    return null;\n                }\n                else {\n                    // Decrement the offset accordingly.\n                    transformed.offset -= howMany;\n                }\n            }\n        }\n        else if (compareArrays(deletePosition.getParentPath(), this.getParentPath()) == 'prefix') {\n            // If nodes are removed from a node that is on a path to this position...\n            const i = deletePosition.path.length - 1;\n            if (deletePosition.offset <= this.path[i]) {\n                // And are removed from before next node of that path...\n                if (deletePosition.offset + howMany > this.path[i]) {\n                    // If the next node of that path is removed return null\n                    // because the node containing this position got removed.\n                    return null;\n                }\n                else {\n                    // Otherwise, decrement index on that path.\n                    transformed.path[i] -= howMany;\n                }\n            }\n        }\n        return transformed;\n    }\n    /**\n     * Returns a copy of this position that is updated by inserting `howMany` nodes at `insertPosition`.\n     *\n     * @internal\n     * @param insertPosition Position where nodes are inserted.\n     * @param howMany How many nodes are inserted.\n     * @returns Transformed position.\n     */\n    _getTransformedByInsertion(insertPosition, howMany) {\n        const transformed = ModelPosition._createAt(this);\n        // This position can't be affected if insertion was in a different root.\n        if (this.root != insertPosition.root) {\n            return transformed;\n        }\n        if (compareArrays(insertPosition.getParentPath(), this.getParentPath()) == 'same') {\n            // If nodes are inserted in the node that is pointed by this position...\n            if (insertPosition.offset < this.offset || (insertPosition.offset == this.offset && this.stickiness != 'toPrevious')) {\n                // And are inserted before an offset of that position...\n                // \"Push\" this positions offset.\n                transformed.offset += howMany;\n            }\n        }\n        else if (compareArrays(insertPosition.getParentPath(), this.getParentPath()) == 'prefix') {\n            // If nodes are inserted in a node that is on a path to this position...\n            const i = insertPosition.path.length - 1;\n            if (insertPosition.offset <= this.path[i]) {\n                // And are inserted before next node of that path...\n                // \"Push\" the index on that path.\n                transformed.path[i] += howMany;\n            }\n        }\n        return transformed;\n    }\n    /**\n     * Returns a copy of this position that is updated by moving `howMany` nodes from `sourcePosition` to `targetPosition`.\n     *\n     * @internal\n     * @param sourcePosition Position before the first element to move.\n     * @param targetPosition Position where moved elements will be inserted.\n     * @param howMany How many consecutive nodes to move, starting from `sourcePosition`.\n     * @returns Transformed position.\n     */\n    _getTransformedByMove(sourcePosition, targetPosition, howMany) {\n        // Update target position, as it could be affected by nodes removal.\n        targetPosition = targetPosition._getTransformedByDeletion(sourcePosition, howMany);\n        if (sourcePosition.isEqual(targetPosition)) {\n            // If `targetPosition` is equal to `sourcePosition` this isn't really any move. Just return position as it is.\n            return ModelPosition._createAt(this);\n        }\n        // Moving a range removes nodes from their original position. We acknowledge this by proper transformation.\n        const transformed = this._getTransformedByDeletion(sourcePosition, howMany);\n        const isMoved = transformed === null ||\n            (sourcePosition.isEqual(this) && this.stickiness == 'toNext') ||\n            (sourcePosition.getShiftedBy(howMany).isEqual(this) && this.stickiness == 'toPrevious');\n        if (isMoved) {\n            // This position is inside moved range (or sticks to it).\n            // In this case, we calculate a combination of this position, move source position and target position.\n            return this._getCombined(sourcePosition, targetPosition);\n        }\n        else {\n            // This position is not inside a removed range.\n            //\n            // In next step, we simply reflect inserting `howMany` nodes, which might further affect the position.\n            return transformed._getTransformedByInsertion(targetPosition, howMany);\n        }\n    }\n    /**\n     * Returns a new position that is a combination of this position and given positions.\n     *\n     * The combined position is a copy of this position transformed by moving a range starting at `source` position\n     * to the `target` position. It is expected that this position is inside the moved range.\n     *\n     * Example:\n     *\n     * ```ts\n     * let original = model.createPositionFromPath( root, [ 2, 3, 1 ] );\n     * let source = model.createPositionFromPath( root, [ 2, 2 ] );\n     * let target = model.createPositionFromPath( otherRoot, [ 1, 1, 3 ] );\n     * original._getCombined( source, target ); // path is [ 1, 1, 4, 1 ], root is `otherRoot`\n     * ```\n     *\n     * Explanation:\n     *\n     * We have a position `[ 2, 3, 1 ]` and move some nodes from `[ 2, 2 ]` to `[ 1, 1, 3 ]`. The original position\n     * was inside moved nodes and now should point to the new place. The moved nodes will be after\n     * positions `[ 1, 1, 3 ]`, `[ 1, 1, 4 ]`, `[ 1, 1, 5 ]`. Since our position was in the second moved node,\n     * the transformed position will be in a sub-tree of a node at `[ 1, 1, 4 ]`. Looking at original path, we\n     * took care of `[ 2, 3 ]` part of it. Now we have to add the rest of the original path to the transformed path.\n     * Finally, the transformed position will point to `[ 1, 1, 4, 1 ]`.\n     *\n     * @internal\n     * @param source Beginning of the moved range.\n     * @param target Position where the range is moved.\n     * @returns Combined position.\n     */\n    _getCombined(source, target) {\n        const i = source.path.length - 1;\n        // The first part of a path to combined position is a path to the place where nodes were moved.\n        const combined = ModelPosition._createAt(target);\n        combined.stickiness = this.stickiness;\n        // Then we have to update the rest of the path.\n        // Fix the offset because this position might be after `from` position and we have to reflect that.\n        combined.offset = combined.offset + this.path[i] - source.offset;\n        // Then, add the rest of the path.\n        // If this position is at the same level as `from` position nothing will get added.\n        combined.path = [...combined.path, ...this.path.slice(i + 1)];\n        return combined;\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        return {\n            root: this.root.toJSON(),\n            path: Array.from(this.path),\n            stickiness: this.stickiness\n        };\n    }\n    /**\n     * Returns a new position that is equal to current position.\n     */\n    clone() {\n        return new this.constructor(this.root, this.path, this.stickiness);\n    }\n    /**\n     * Creates position at the given location. The location can be specified as:\n     *\n     * * a {@link module:engine/model/position~ModelPosition position},\n     * * parent element and offset (offset defaults to `0`),\n     * * parent element and `'end'` (sets position at the end of that element),\n     * * {@link module:engine/model/item~ModelItem model item} and `'before'` or `'after'` (sets position before or after given model item).\n     *\n     * This method is a shortcut to other factory methods such as:\n     *\n     * * {@link module:engine/model/position~ModelPosition._createBefore},\n     * * {@link module:engine/model/position~ModelPosition._createAfter}.\n     *\n     * @internal\n     * @param offset Offset or one of the flags. Used only when the first parameter\n     * is a {@link module:engine/model/item~ModelItem model item}.\n     * @param stickiness Position stickiness. Used only when the first parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    static _createAt(itemOrPosition, offset, stickiness = 'toNone') {\n        if (itemOrPosition.is('model:position')) {\n            return new ModelPosition(itemOrPosition.root, itemOrPosition.path, itemOrPosition.stickiness);\n        }\n        else {\n            const node = itemOrPosition;\n            if (offset == 'end') {\n                offset = node.maxOffset;\n            }\n            else if (offset == 'before') {\n                return this._createBefore(node, stickiness);\n            }\n            else if (offset == 'after') {\n                return this._createAfter(node, stickiness);\n            }\n            else if (offset !== 0 && !offset) {\n                /**\n                 * {@link module:engine/model/model~Model#createPositionAt `Model#createPositionAt()`}\n                 * requires the offset to be specified when the first parameter is a model item.\n                 *\n                 * @error model-createpositionat-offset-required\n                 */\n                throw new CKEditorError('model-createpositionat-offset-required', [this, itemOrPosition]);\n            }\n            if (!node.is('element') && !node.is('documentFragment')) {\n                /**\n                 * Position parent have to be a model element or model document fragment.\n                 *\n                 * @error model-position-parent-incorrect\n                 */\n                throw new CKEditorError('model-position-parent-incorrect', [this, itemOrPosition]);\n            }\n            const path = node.getPath();\n            path.push(offset);\n            return new this(node.root, path, stickiness);\n        }\n    }\n    /**\n     * Creates a new position, after given {@link module:engine/model/item~ModelItem model item}.\n     *\n     * @internal\n     * @param item Item after which the position should be placed.\n     * @param stickiness Position stickiness.\n     */\n    static _createAfter(item, stickiness) {\n        if (!item.parent) {\n            /**\n             * You cannot make a position after a root element.\n             *\n             * @error model-position-after-root\n             * @param {module:engine/model/rootelement~ModelRootElement} root The root element..\n             */\n            throw new CKEditorError('model-position-after-root', [this, item], { root: item });\n        }\n        return this._createAt(item.parent, item.endOffset, stickiness);\n    }\n    /**\n     * Creates a new position, before the given {@link module:engine/model/item~ModelItem model item}.\n     *\n     * @internal\n     * @param item Item before which the position should be placed.\n     * @param stickiness Position stickiness.\n     */\n    static _createBefore(item, stickiness) {\n        if (!item.parent) {\n            /**\n             * You cannot make a position before a root element.\n             *\n             * @error model-position-before-root\n             * @param {module:engine/model/rootelement~ModelRootElement} root The root element..\n             */\n            throw new CKEditorError('model-position-before-root', item, { root: item });\n        }\n        return this._createAt(item.parent, item.startOffset, stickiness);\n    }\n    /**\n     * Creates a `Position` instance from given plain object (i.e. parsed JSON string).\n     *\n     * @param json Plain object to be converted to `Position`.\n     * @param doc Document object that will be position owner.\n     * @returns `Position` instance created using given plain object.\n     */\n    static fromJSON(json, doc) {\n        if (json.root === '$graveyard') {\n            const pos = new ModelPosition(doc.graveyard, json.path);\n            pos.stickiness = json.stickiness;\n            return pos;\n        }\n        if (!doc.getRoot(json.root)) {\n            /**\n             * Cannot create position for document. Root with specified name does not exist.\n             *\n             * @error model-position-fromjson-no-root\n             * @param {string} rootName The root name.\n             */\n            throw new CKEditorError('model-position-fromjson-no-root', doc, { rootName: json.root });\n        }\n        return new ModelPosition(doc.getRoot(json.root), json.path, json.stickiness);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelPosition.prototype.is = function (type) {\n    return type === 'position' || type === 'model:position';\n};\n/**\n * Returns a text node at the given position.\n *\n * This is a helper function optimized to reuse the position parent instance for performance reasons.\n *\n * Normally, you should use {@link module:engine/model/position~ModelPosition#textNode `Position#textNode`}.\n * If you start hitting performance issues with {@link module:engine/model/position~ModelPosition#parent `Position#parent`}\n * check if your algorithm does not access it multiple times (which can happen directly or indirectly via other position properties).\n *\n * See https://github.com/ckeditor/ckeditor5/issues/6579.\n *\n * See also:\n *\n * * {@link module:engine/model/position~getNodeAfterPosition}\n * * {@link module:engine/model/position~getNodeBeforePosition}\n *\n * @param position\n * @param positionParent The parent of the given position.\n * @internal\n */\nexport function getTextNodeAtPosition(position, positionParent) {\n    const node = positionParent.getChildAtOffset(position.offset);\n    if (node && node.is('$text') && node.startOffset < position.offset) {\n        return node;\n    }\n    return null;\n}\n/**\n * Returns the node after the given position.\n *\n * This is a helper function optimized to reuse the position parent instance and the calculation of the text node at the\n * specific position for performance reasons.\n *\n * Normally, you should use {@link module:engine/model/position~ModelPosition#nodeAfter `Position#nodeAfter`}.\n * If you start hitting performance issues with {@link module:engine/model/position~ModelPosition#parent `Position#parent`} and/or\n * {@link module:engine/model/position~ModelPosition#textNode `Position#textNode`}\n * check if your algorithm does not access those properties multiple times\n * (which can happen directly or indirectly via other position properties).\n *\n * See https://github.com/ckeditor/ckeditor5/issues/6579 and https://github.com/ckeditor/ckeditor5/issues/6582.\n *\n * See also:\n *\n * * {@link module:engine/model/position~getTextNodeAtPosition}\n * * {@link module:engine/model/position~getNodeBeforePosition}\n *\n * @param position Position to check.\n * @param positionParent The parent of the given position.\n * @param textNode Text node at the given position.\n * @internal\n */\nexport function getNodeAfterPosition(position, positionParent, textNode) {\n    if (textNode !== null) {\n        return null;\n    }\n    return positionParent.getChildAtOffset(position.offset);\n}\n/**\n * Returns the node before the given position.\n *\n * Refer to {@link module:engine/model/position~getNodeBeforePosition} for documentation on when to use this util method.\n *\n * See also:\n *\n * * {@link module:engine/model/position~getTextNodeAtPosition}\n * * {@link module:engine/model/position~getNodeAfterPosition}\n *\n * @param position Position to check.\n * @param positionParent The parent of the given position.\n * @param textNode Text node at the given position.\n * @internal\n */\nexport function getNodeBeforePosition(position, positionParent, textNode) {\n    if (textNode !== null) {\n        return null;\n    }\n    return positionParent.getChild(positionParent.offsetToIndex(position.offset) - 1);\n}\n/**\n * This is a helper function for `Position#isTouching()`.\n *\n * It checks whether to given positions are touching, considering that they have the same root and paths\n * until given level, and at given level they differ by 1 (so they are branching at `level` point).\n *\n * The exact requirements for touching positions are described in `Position#isTouching()` and also\n * in the body of this function.\n *\n * @param left Position \"on the left\" (it is before `right`).\n * @param right Position \"on the right\" (it is after `left`).\n * @param level Level on which the positions are different.\n */\nfunction checkTouchingBranch(left, right, level) {\n    if (level + 1 === left.path.length) {\n        // Left position does not have any more entries after the point where the positions differ.\n        // [ 2 ] vs [ 3 ]\n        // [ 2 ] vs [ 3, 0, 0 ]\n        // The positions are spread by node at [ 2 ].\n        return false;\n    }\n    if (!checkOnlyZeroes(right.path, level + 1)) {\n        // Right position does not have only zeroes, so we have situation like:\n        // [ 2, maxOffset ] vs [ 3, 1 ]\n        // [ 2, maxOffset ] vs [ 3, 1, 0, 0 ]\n        // The positions are spread by node at [ 3, 0 ].\n        return false;\n    }\n    if (!checkOnlyMaxOffset(left, level + 1)) {\n        // Left position does not have only max offsets, so we have situation like:\n        // [ 2, 4 ] vs [ 3 ]\n        // [ 2, 4 ] vs [ 3, 0, 0 ]\n        // The positions are spread by node at [ 2, 5 ].\n        return false;\n    }\n    // Left position has only max offsets and right position has only zeroes or nothing.\n    // [ 2, maxOffset ] vs [ 3 ]\n    // [ 2, maxOffset, maxOffset ] vs [ 3, 0 ]\n    // There are not elements between positions. The positions are touching.\n    return true;\n}\n/**\n * Checks whether for given array, starting from given index until the end of the array, all items are `0`s.\n *\n * This is a helper function for `Position#isTouching()`.\n */\nfunction checkOnlyZeroes(arr, idx) {\n    while (idx < arr.length) {\n        if (arr[idx] !== 0) {\n            return false;\n        }\n        idx++;\n    }\n    return true;\n}\n/**\n * Checks whether for given position, starting from given path level, whether the position is at the end of\n * its parent and whether each element on the path to the position is also at at the end of its parent.\n *\n * This is a helper function for `Position#isTouching()`.\n */\nfunction checkOnlyMaxOffset(pos, level) {\n    let parent = pos.parent;\n    let idx = pos.path.length - 1;\n    let add = 0;\n    while (idx >= level) {\n        if (pos.path[idx] + add !== parent.maxOffset) {\n            return false;\n        }\n        // After the first check, we \"go up\", and check whether the position's parent-parent is the last element.\n        // However, we need to add 1 to the value in the path to \"simulate\" moving the path after the parent.\n        // It happens just once.\n        add = 1;\n        idx--;\n        parent = parent.parent;\n    }\n    return true;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/range\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { ModelPosition } from './position.js';\nimport { ModelTreeWalker } from './treewalker.js';\nimport { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';\n/**\n * Represents a range in the model tree.\n *\n * A range is defined by its {@link module:engine/model/range~ModelRange#start} and {@link module:engine/model/range~ModelRange#end}\n * positions.\n *\n * You can create range instances via its constructor or the `createRange*()` factory methods of\n * {@link module:engine/model/model~Model} and {@link module:engine/model/writer~ModelWriter}.\n */\nexport class ModelRange extends ModelTypeCheckable {\n    /**\n     * Start position.\n     */\n    start;\n    /**\n     * End position.\n     */\n    end;\n    /**\n     * Creates a range spanning from `start` position to `end` position.\n     *\n     * @param start The start position.\n     * @param end The end position. If not set, the range will be collapsed at the `start` position.\n     */\n    constructor(start, end) {\n        super();\n        this.start = ModelPosition._createAt(start);\n        this.end = end ? ModelPosition._createAt(end) : ModelPosition._createAt(start);\n        // If the range is collapsed, treat in a similar way as a position and set its boundaries stickiness to 'toNone'.\n        // In other case, make the boundaries stick to the \"inside\" of the range.\n        this.start.stickiness = this.isCollapsed ? 'toNone' : 'toNext';\n        this.end.stickiness = this.isCollapsed ? 'toNone' : 'toPrevious';\n    }\n    /**\n     * Iterable interface.\n     *\n     * Iterates over all {@link module:engine/model/item~ModelItem items} that are in this range and returns\n     * them together with additional information like length or {@link module:engine/model/position~ModelPosition positions},\n     * grouped as {@link module:engine/model/treewalker~ModelTreeWalkerValue}.\n     * It iterates over all {@link module:engine/model/textproxy~ModelTextProxy text contents} that are inside the range\n     * and all the {@link module:engine/model/element~ModelElement}s that are entered into when iterating over this range.\n     *\n     * This iterator uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range\n     * and `ignoreElementEnd` option set to `true`.\n     */\n    *[Symbol.iterator]() {\n        yield* new ModelTreeWalker({ boundaries: this, ignoreElementEnd: true });\n    }\n    /**\n     * Describes whether the range is collapsed, that is if {@link #start} and\n     * {@link #end} positions are equal.\n     */\n    get isCollapsed() {\n        return this.start.isEqual(this.end);\n    }\n    /**\n     * Describes whether this range is flat, that is if {@link #start} position and\n     * {@link #end} position are in the same {@link module:engine/model/position~ModelPosition#parent}.\n     */\n    get isFlat() {\n        const startParentPath = this.start.getParentPath();\n        const endParentPath = this.end.getParentPath();\n        return compareArrays(startParentPath, endParentPath) == 'same';\n    }\n    /**\n     * Range root element.\n     */\n    get root() {\n        return this.start.root;\n    }\n    /**\n     * Checks whether this range contains given {@link module:engine/model/position~ModelPosition position}.\n     *\n     * @param position Position to check.\n     * @returns `true` if given {@link module:engine/model/position~ModelPosition position} is contained\n     * in this range,`false` otherwise.\n     */\n    containsPosition(position) {\n        return position.isAfter(this.start) && position.isBefore(this.end);\n    }\n    /**\n     * Checks whether this range contains given {@link ~ModelRange range}.\n     *\n     * @param otherRange Range to check.\n     * @param loose Whether the check is loose or strict. If the check is strict (`false`), compared range cannot\n     * start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or\n     * even be equal to this range. Note that collapsed ranges are always compared in strict mode.\n     * @returns {Boolean} `true` if given {@link ~ModelRange range} boundaries are contained by this range, `false` otherwise.\n     */\n    containsRange(otherRange, loose = false) {\n        if (otherRange.isCollapsed) {\n            loose = false;\n        }\n        const containsStart = this.containsPosition(otherRange.start) || (loose && this.start.isEqual(otherRange.start));\n        const containsEnd = this.containsPosition(otherRange.end) || (loose && this.end.isEqual(otherRange.end));\n        return containsStart && containsEnd;\n    }\n    /**\n     * Checks whether given {@link module:engine/model/item~ModelItem} is inside this range.\n     */\n    containsItem(item) {\n        const pos = ModelPosition._createBefore(item);\n        return this.containsPosition(pos) || this.start.isEqual(pos);\n    }\n    /**\n     * Two ranges are equal if their {@link #start} and {@link #end} positions are equal.\n     *\n     * @param otherRange Range to compare with.\n     * @returns `true` if ranges are equal, `false` otherwise.\n     */\n    isEqual(otherRange) {\n        return this.start.isEqual(otherRange.start) && this.end.isEqual(otherRange.end);\n    }\n    /**\n     * Checks and returns whether this range intersects with given range.\n     *\n     * @param otherRange Range to compare with.\n     * @returns `true` if ranges intersect, `false` otherwise.\n     */\n    isIntersecting(otherRange) {\n        return this.start.isBefore(otherRange.end) && this.end.isAfter(otherRange.start);\n    }\n    /**\n     * Computes which part(s) of this {@link ~ModelRange range} is not a part of given {@link ~ModelRange range}.\n     * Returned array contains zero, one or two {@link ~ModelRange ranges}.\n     *\n     * Examples:\n     *\n     * ```ts\n     * let range = model.createRange(\n     * \tmodel.createPositionFromPath( root, [ 2, 7 ] ),\n     * \tmodel.createPositionFromPath( root, [ 4, 0, 1 ] )\n     * );\n     * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 5 ] ) );\n     * let transformed = range.getDifference( otherRange );\n     * // transformed array has no ranges because `otherRange` contains `range`\n     *\n     * otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 3 ] ) );\n     * transformed = range.getDifference( otherRange );\n     * // transformed array has one range: from [ 3 ] to [ 4, 0, 1 ]\n     *\n     * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 4 ] ) );\n     * transformed = range.getDifference( otherRange );\n     * // transformed array has two ranges: from [ 2, 7 ] to [ 3 ] and from [ 4 ] to [ 4, 0, 1 ]\n     * ```\n     *\n     * @param otherRange Range to differentiate against.\n     * @returns The difference between ranges.\n     */\n    getDifference(otherRange) {\n        const ranges = [];\n        if (this.isIntersecting(otherRange)) {\n            // Ranges intersect.\n            if (this.containsPosition(otherRange.start)) {\n                // Given range start is inside this range. This means that we have to\n                // add shrunken range - from the start to the middle of this range.\n                ranges.push(new ModelRange(this.start, otherRange.start));\n            }\n            if (this.containsPosition(otherRange.end)) {\n                // Given range end is inside this range. This means that we have to\n                // add shrunken range - from the middle of this range to the end.\n                ranges.push(new ModelRange(otherRange.end, this.end));\n            }\n        }\n        else {\n            // Ranges do not intersect, return the original range.\n            ranges.push(new ModelRange(this.start, this.end));\n        }\n        return ranges;\n    }\n    /**\n     * Returns an intersection of this {@link ~ModelRange range} and given {@link ~ModelRange range}.\n     * Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.\n     *\n     * Examples:\n     *\n     * ```ts\n     * let range = model.createRange(\n     * \tmodel.createPositionFromPath( root, [ 2, 7 ] ),\n     * \tmodel.createPositionFromPath( root, [ 4, 0, 1 ] )\n     * );\n     * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 2 ] ) );\n     * let transformed = range.getIntersection( otherRange ); // null - ranges have no common part\n     *\n     * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 5 ] ) );\n     * transformed = range.getIntersection( otherRange ); // range from [ 3 ] to [ 4, 0, 1 ]\n     * ```\n     *\n     * @param otherRange Range to check for intersection.\n     * @returns A common part of given ranges or `null` if ranges have no common part.\n     */\n    getIntersection(otherRange) {\n        if (this.isIntersecting(otherRange)) {\n            // Ranges intersect, so a common range will be returned.\n            // At most, it will be same as this range.\n            let commonRangeStart = this.start;\n            let commonRangeEnd = this.end;\n            if (this.containsPosition(otherRange.start)) {\n                // Given range start is inside this range. This means thaNt we have to\n                // shrink common range to the given range start.\n                commonRangeStart = otherRange.start;\n            }\n            if (this.containsPosition(otherRange.end)) {\n                // Given range end is inside this range. This means that we have to\n                // shrink common range to the given range end.\n                commonRangeEnd = otherRange.end;\n            }\n            return new ModelRange(commonRangeStart, commonRangeEnd);\n        }\n        // Ranges do not intersect, so they do not have common part.\n        return null;\n    }\n    /**\n     * Returns a range created by joining this {@link ~ModelRange range} with the given {@link ~ModelRange range}.\n     * If ranges have no common part, returns `null`.\n     *\n     * Examples:\n     *\n     * ```ts\n     * let range = model.createRange(\n     * \tmodel.createPositionFromPath( root, [ 2, 7 ] ),\n     * \tmodel.createPositionFromPath( root, [ 4, 0, 1 ] )\n     * );\n     * let otherRange = model.createRange(\n     * \tmodel.createPositionFromPath( root, [ 1 ] ),\n     * \tmodel.createPositionFromPath( root, [ 2 ] )\n     * );\n     * let transformed = range.getJoined( otherRange ); // null - ranges have no common part\n     *\n     * otherRange = model.createRange(\n     * \tmodel.createPositionFromPath( root, [ 3 ] ),\n     * \tmodel.createPositionFromPath( root, [ 5 ] )\n     * );\n     * transformed = range.getJoined( otherRange ); // range from [ 2, 7 ] to [ 5 ]\n     * ```\n     *\n     * @param otherRange Range to be joined.\n     * @param loose Whether the intersection check is loose or strict. If the check is strict (`false`),\n     * ranges are tested for intersection or whether start/end positions are equal. If the check is loose (`true`),\n     * compared range is also checked if it's {@link module:engine/model/position~ModelPosition#isTouching touching} current range.\n     * @returns A sum of given ranges or `null` if ranges have no common part.\n     */\n    getJoined(otherRange, loose = false) {\n        let shouldJoin = this.isIntersecting(otherRange);\n        if (!shouldJoin) {\n            if (this.start.isBefore(otherRange.start)) {\n                shouldJoin = loose ? this.end.isTouching(otherRange.start) : this.end.isEqual(otherRange.start);\n            }\n            else {\n                shouldJoin = loose ? otherRange.end.isTouching(this.start) : otherRange.end.isEqual(this.start);\n            }\n        }\n        if (!shouldJoin) {\n            return null;\n        }\n        let startPosition = this.start;\n        let endPosition = this.end;\n        if (otherRange.start.isBefore(startPosition)) {\n            startPosition = otherRange.start;\n        }\n        if (otherRange.end.isAfter(endPosition)) {\n            endPosition = otherRange.end;\n        }\n        return new ModelRange(startPosition, endPosition);\n    }\n    /**\n     * Computes and returns the smallest set of {@link #isFlat flat} ranges, that covers this range in whole.\n     *\n     * See an example of a model structure (`[` and `]` are range boundaries):\n     *\n     * ```\n     * root                                                            root\n     *  |- element DIV                         DIV             P2              P3             DIV\n     *  |   |- element H                   H        P1        f o o           b a r       H         P4\n     *  |   |   |- \"fir[st\"             fir[st     lorem                               se]cond     ipsum\n     *  |   |- element P1\n     *  |   |   |- \"lorem\"                                              ||\n     *  |- element P2                                                   ||\n     *  |   |- \"foo\"                                                    VV\n     *  |- element P3\n     *  |   |- \"bar\"                                                   root\n     *  |- element DIV                         DIV             [P2             P3]             DIV\n     *  |   |- element H                   H       [P1]       f o o           b a r        H         P4\n     *  |   |   |- \"se]cond\"            fir[st]    lorem                               [se]cond     ipsum\n     *  |   |- element P4\n     *  |   |   |- \"ipsum\"\n     * ```\n     *\n     * As it can be seen, letters contained in the range are: `stloremfoobarse`, spread across different parents.\n     * We are looking for minimal set of flat ranges that contains the same nodes.\n     *\n     * Minimal flat ranges for above range `( [ 0, 0, 3 ], [ 3, 0, 2 ] )` will be:\n     *\n     * ```\n     * ( [ 0, 0, 3 ], [ 0, 0, 5 ] ) = \"st\"\n     * ( [ 0, 1 ], [ 0, 2 ] ) = element P1 (\"lorem\")\n     * ( [ 1 ], [ 3 ] ) = element P2, element P3 (\"foobar\")\n     * ( [ 3, 0, 0 ], [ 3, 0, 2 ] ) = \"se\"\n     * ```\n     *\n     * **Note:** if an {@link module:engine/model/element~ModelElement element} is not wholly contained in this range, it won't be returned\n     * in any of the returned flat ranges. See in the example how `H` elements at the beginning and at the end of the range\n     * were omitted. Only their parts that were wholly in the range were returned.\n     *\n     * **Note:** this method is not returning flat ranges that contain no nodes.\n     *\n     * @returns Array of flat ranges covering this range.\n     */\n    getMinimalFlatRanges() {\n        const ranges = [];\n        const diffAt = this.start.getCommonPath(this.end).length;\n        const pos = ModelPosition._createAt(this.start);\n        let posParent = pos.parent;\n        // Go up.\n        while (pos.path.length > diffAt + 1) {\n            const howMany = posParent.maxOffset - pos.offset;\n            if (howMany !== 0) {\n                ranges.push(new ModelRange(pos, pos.getShiftedBy(howMany)));\n            }\n            pos.path = pos.path.slice(0, -1);\n            pos.offset++;\n            posParent = posParent.parent;\n        }\n        // Go down.\n        while (pos.path.length <= this.end.path.length) {\n            const offset = this.end.path[pos.path.length - 1];\n            const howMany = offset - pos.offset;\n            if (howMany !== 0) {\n                ranges.push(new ModelRange(pos, pos.getShiftedBy(howMany)));\n            }\n            pos.offset = offset;\n            pos.path.push(0);\n        }\n        return ranges;\n    }\n    /**\n     * Creates a {@link module:engine/model/treewalker~ModelTreeWalker TreeWalker} instance with this range as a boundary.\n     *\n     * For example, to iterate over all items in the entire document root:\n     *\n     * ```ts\n     * // Create a range spanning over the entire root content:\n     * const range = editor.model.createRangeIn( editor.model.document.getRoot() );\n     *\n     * // Iterate over all items in this range:\n     * for ( const value of range.getWalker() ) {\n     * \tconsole.log( value.item );\n     * }\n     * ```\n     *\n     * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.\n     */\n    getWalker(options = {}) {\n        options.boundaries = this;\n        return new ModelTreeWalker(options);\n    }\n    /**\n     * Returns an iterator that iterates over all {@link module:engine/model/item~ModelItem items} that are in this range and returns\n     * them.\n     *\n     * This method uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range and\n     * `ignoreElementEnd` option set to `true`. However it returns only {@link module:engine/model/item~ModelItem model items},\n     * not {@link module:engine/model/treewalker~ModelTreeWalkerValue}.\n     *\n     * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~ModelTreeWalker} for\n     * a full list of available options.\n     *\n     * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.\n     */\n    *getItems(options = {}) {\n        options.boundaries = this;\n        options.ignoreElementEnd = true;\n        const treeWalker = new ModelTreeWalker(options);\n        for (const value of treeWalker) {\n            yield value.item;\n        }\n    }\n    /**\n     * Returns an iterator that iterates over all {@link module:engine/model/position~ModelPosition positions} that are boundaries or\n     * contained in this range.\n     *\n     * This method uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range. However it returns only\n     * {@link module:engine/model/position~ModelPosition positions}, not {@link module:engine/model/treewalker~ModelTreeWalkerValue}.\n     *\n     * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~ModelTreeWalker} for\n     * a full list of available options.\n     *\n     * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.\n     */\n    *getPositions(options = {}) {\n        options.boundaries = this;\n        const treeWalker = new ModelTreeWalker(options);\n        yield treeWalker.position;\n        for (const value of treeWalker) {\n            yield value.nextPosition;\n        }\n    }\n    /**\n     * Returns a range that is a result of transforming this range by given `operation`.\n     *\n     * **Note:** transformation may break one range into multiple ranges (for example, when a part of the range is\n     * moved to a different part of document tree). For this reason, an array is returned by this method and it\n     * may contain one or more `Range` instances.\n     *\n     * @param operation Operation to transform range by.\n     * @returns Range which is the result of transformation.\n     */\n    getTransformedByOperation(operation) {\n        switch (operation.type) {\n            case 'insert':\n                return this._getTransformedByInsertOperation(operation);\n            case 'move':\n            case 'remove':\n            case 'reinsert':\n                return this._getTransformedByMoveOperation(operation);\n            case 'split':\n                return [this._getTransformedBySplitOperation(operation)];\n            case 'merge':\n                return [this._getTransformedByMergeOperation(operation)];\n        }\n        return [new ModelRange(this.start, this.end)];\n    }\n    /**\n     * Returns a range that is a result of transforming this range by multiple `operations`.\n     *\n     * @see ~ModelRange#getTransformedByOperation\n     * @param operations Operations to transform the range by.\n     * @returns Range which is the result of transformation.\n     */\n    getTransformedByOperations(operations) {\n        const ranges = [new ModelRange(this.start, this.end)];\n        for (const operation of operations) {\n            for (let i = 0; i < ranges.length; i++) {\n                const result = ranges[i].getTransformedByOperation(operation);\n                ranges.splice(i, 1, ...result);\n                i += result.length - 1;\n            }\n        }\n        // It may happen that a range is split into two, and then the part of second \"piece\" is moved into first\n        // \"piece\". In this case we will have incorrect third range, which should not be included in the result --\n        // because it is already included in the first \"piece\". In this loop we are looking for all such ranges that\n        // are inside other ranges and we simply remove them.\n        for (let i = 0; i < ranges.length; i++) {\n            const range = ranges[i];\n            for (let j = i + 1; j < ranges.length; j++) {\n                const next = ranges[j];\n                if (range.containsRange(next) || next.containsRange(range) || range.isEqual(next)) {\n                    ranges.splice(j, 1);\n                }\n            }\n        }\n        return ranges;\n    }\n    /**\n     * Returns an {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}\n     * which is a common ancestor of the range's both ends (in which the entire range is contained).\n     */\n    getCommonAncestor() {\n        return this.start.getCommonAncestor(this.end);\n    }\n    /**\n     * Returns an {@link module:engine/model/element~ModelElement Element} contained by the range.\n     * The element will be returned when it is the **only** node within the range and **fully–contained**\n     * at the same time.\n     */\n    getContainedElement() {\n        if (this.isCollapsed) {\n            return null;\n        }\n        const nodeAfterStart = this.start.nodeAfter;\n        const nodeBeforeEnd = this.end.nodeBefore;\n        if (nodeAfterStart && nodeAfterStart.is('element') && nodeAfterStart === nodeBeforeEnd) {\n            return nodeAfterStart;\n        }\n        return null;\n    }\n    /**\n     * Converts `Range` to plain object and returns it.\n     *\n     * @returns `Range` converted to plain object.\n     */\n    toJSON() {\n        return {\n            start: this.start.toJSON(),\n            end: this.end.toJSON()\n        };\n    }\n    /**\n     * Returns a new range that is equal to current range.\n     */\n    clone() {\n        return new this.constructor(this.start, this.end);\n    }\n    /**\n     * Returns a result of transforming a copy of this range by insert operation.\n     *\n     * One or more ranges may be returned as a result of this transformation.\n     *\n     * @internal\n     */\n    _getTransformedByInsertOperation(operation, spread = false) {\n        return this._getTransformedByInsertion(operation.position, operation.howMany, spread);\n    }\n    /**\n     * Returns a result of transforming a copy of this range by move operation.\n     *\n     * One or more ranges may be returned as a result of this transformation.\n     *\n     * @internal\n     */\n    _getTransformedByMoveOperation(operation, spread = false) {\n        const sourcePosition = operation.sourcePosition;\n        const howMany = operation.howMany;\n        const targetPosition = operation.targetPosition;\n        return this._getTransformedByMove(sourcePosition, targetPosition, howMany, spread);\n    }\n    /**\n     * Returns a result of transforming a copy of this range by split operation.\n     *\n     * Always one range is returned. The transformation is done in a way to not break the range.\n     *\n     * @internal\n     */\n    _getTransformedBySplitOperation(operation) {\n        const start = this.start._getTransformedBySplitOperation(operation);\n        let end = this.end._getTransformedBySplitOperation(operation);\n        if (this.end.isEqual(operation.insertionPosition)) {\n            end = this.end.getShiftedBy(1);\n        }\n        // Below may happen when range contains graveyard element used by split operation.\n        if (start.root != end.root) {\n            // End position was next to the moved graveyard element and was moved with it.\n            // Fix it by using old `end` which has proper `root`.\n            end = this.end.getShiftedBy(-1);\n        }\n        return new ModelRange(start, end);\n    }\n    /**\n     * Returns a result of transforming a copy of this range by merge operation.\n     *\n     * Always one range is returned. The transformation is done in a way to not break the range.\n     *\n     * @internal\n     */\n    _getTransformedByMergeOperation(operation) {\n        // Special case when the marker is set on \"the closing tag\" of an element. Marker can be set like that during\n        // transformations, especially when a content of a few block elements were removed. For example:\n        //\n        // {} is the transformed range, [] is the removed range.\n        // <p>F[o{o</p><p>B}ar</p><p>Xy]z</p>\n        //\n        // <p>Fo{o</p><p>B}ar</p><p>z</p>\n        // <p>F{</p><p>B}ar</p><p>z</p>\n        // <p>F{</p>}<p>z</p>\n        // <p>F{}z</p>\n        //\n        if (this.start.isEqual(operation.targetPosition) && this.end.isEqual(operation.deletionPosition)) {\n            return new ModelRange(this.start);\n        }\n        let start = this.start._getTransformedByMergeOperation(operation);\n        let end = this.end._getTransformedByMergeOperation(operation);\n        if (start.root != end.root) {\n            // This happens when the end position was next to the merged (deleted) element.\n            // Then, the end position was moved to the graveyard root. In this case we need to fix\n            // the range cause its boundaries would be in different roots.\n            end = this.end.getShiftedBy(-1);\n        }\n        if (start.isAfter(end)) {\n            // This happens in three following cases:\n            //\n            // Case 1: Merge operation source position is before the target position (due to some transformations, OT, etc.)\n            //         This means that start can be moved before the end of the range.\n            //\n            // Before: <p>a{a</p><p>b}b</p><p>cc</p>\n            // Merge:  <p>b}b</p><p>cca{a</p>\n            // Fix:    <p>{b}b</p><p>ccaa</p>\n            //\n            // Case 2: Range start is before merged node but not directly.\n            //         Result should include all nodes that were in the original range.\n            //\n            // Before: <p>aa</p>{<p>cc</p><p>b}b</p>\n            // Merge:  <p>aab}b</p>{<p>cc</p>\n            // Fix:    <p>aa{bb</p><p>cc</p>}\n            //\n            //         The range is expanded by an additional `b` letter but it is better than dropping the whole `cc` paragraph.\n            //\n            // Case 3: Range start is directly before merged node.\n            //         Resulting range should include only nodes from the merged element:\n            //\n            // Before: <p>aa</p>{<p>b}b</p><p>cc</p>\n            // Merge:  <p>aab}b</p>{<p>cc</p>\n            // Fix:    <p>aa{b}b</p><p>cc</p>\n            //\n            if (operation.sourcePosition.isBefore(operation.targetPosition)) {\n                // Case 1.\n                start = ModelPosition._createAt(end);\n                start.offset = 0;\n            }\n            else {\n                if (!operation.deletionPosition.isEqual(start)) {\n                    // Case 2.\n                    end = operation.deletionPosition;\n                }\n                // In both case 2 and 3 start is at the end of the merge-to element.\n                start = operation.targetPosition;\n            }\n            return new ModelRange(start, end);\n        }\n        return new ModelRange(start, end);\n    }\n    /**\n     * Returns an array containing one or two {@link ~ModelRange ranges} that are a result of transforming this\n     * {@link ~ModelRange range} by inserting `howMany` nodes at `insertPosition`. Two {@link ~ModelRange ranges} are\n     * returned if the insertion was inside this {@link ~ModelRange range} and `spread` is set to `true`.\n     *\n     * Examples:\n     *\n     * ```ts\n     * let range = model.createRange(\n     * \tmodel.createPositionFromPath( root, [ 2, 7 ] ),\n     * \tmodel.createPositionFromPath( root, [ 4, 0, 1 ] )\n     * );\n     * let transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 1 ] ), 2 );\n     * // transformed array has one range from [ 4, 7 ] to [ 6, 0, 1 ]\n     *\n     * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 4, 0, 0 ] ), 4 );\n     * // transformed array has one range from [ 2, 7 ] to [ 4, 0, 5 ]\n     *\n     * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4 );\n     * // transformed array has one range, which is equal to original range\n     *\n     * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4, true );\n     * // transformed array has two ranges: from [ 2, 7 ] to [ 3, 2 ] and from [ 3, 6 ] to [ 4, 0, 1 ]\n     * ```\n     *\n     * @internal\n     * @param insertPosition Position where nodes are inserted.\n     * @param howMany How many nodes are inserted.\n     * @param spread Flag indicating whether this range should be spread if insertion\n     * was inside the range. Defaults to `false`.\n     * @returns Result of the transformation.\n     */\n    _getTransformedByInsertion(insertPosition, howMany, spread = false) {\n        if (spread && this.containsPosition(insertPosition)) {\n            // Range has to be spread. The first part is from original start to the spread point.\n            // The other part is from spread point to the original end, but transformed by\n            // insertion to reflect insertion changes.\n            return [\n                new ModelRange(this.start, insertPosition),\n                new ModelRange(insertPosition.getShiftedBy(howMany), this.end._getTransformedByInsertion(insertPosition, howMany))\n            ];\n        }\n        else {\n            const range = new ModelRange(this.start, this.end);\n            range.start = range.start._getTransformedByInsertion(insertPosition, howMany);\n            range.end = range.end._getTransformedByInsertion(insertPosition, howMany);\n            return [range];\n        }\n    }\n    /**\n     * Returns an array containing {@link ~ModelRange ranges} that are a result of transforming this\n     * {@link ~ModelRange range} by moving `howMany` nodes from `sourcePosition` to `targetPosition`.\n     *\n     * @internal\n     * @param sourcePosition Position from which nodes are moved.\n     * @param targetPosition Position to where nodes are moved.\n     * @param howMany How many nodes are moved.\n     * @param spread Whether the range should be spread if the move points inside the range.\n     * @returns  Result of the transformation.\n     */\n    _getTransformedByMove(sourcePosition, targetPosition, howMany, spread = false) {\n        // Special case for transforming a collapsed range. Just transform it like a position.\n        if (this.isCollapsed) {\n            const newPos = this.start._getTransformedByMove(sourcePosition, targetPosition, howMany);\n            return [new ModelRange(newPos)];\n        }\n        // Special case for transformation when a part of the range is moved towards the range.\n        //\n        // Examples:\n        //\n        // <div><p>ab</p><p>c[d</p></div><p>e]f</p> --> <div><p>ab</p></div><p>c[d</p><p>e]f</p>\n        // <p>e[f</p><div><p>a]b</p><p>cd</p></div> --> <p>e[f</p><p>a]b</p><div><p>cd</p></div>\n        //\n        // Without this special condition, the default algorithm leaves an \"artifact\" range from one of `differenceSet` parts:\n        //\n        // <div><p>ab</p><p>c[d</p></div><p>e]f</p> --> <div><p>ab</p>{</div>}<p>c[d</p><p>e]f</p>\n        //\n        // This special case is applied only if the range is to be kept together (not spread).\n        const moveRange = ModelRange._createFromPositionAndShift(sourcePosition, howMany);\n        const insertPosition = targetPosition._getTransformedByDeletion(sourcePosition, howMany);\n        if (this.containsPosition(targetPosition) && !spread) {\n            if (moveRange.containsPosition(this.start) || moveRange.containsPosition(this.end)) {\n                const start = this.start._getTransformedByMove(sourcePosition, targetPosition, howMany);\n                const end = this.end._getTransformedByMove(sourcePosition, targetPosition, howMany);\n                return [new ModelRange(start, end)];\n            }\n        }\n        // Default algorithm.\n        let result;\n        const differenceSet = this.getDifference(moveRange);\n        let difference = null;\n        const common = this.getIntersection(moveRange);\n        if (differenceSet.length == 1) {\n            // `moveRange` and this range may intersect but may be separate.\n            difference = new ModelRange(differenceSet[0].start._getTransformedByDeletion(sourcePosition, howMany), differenceSet[0].end._getTransformedByDeletion(sourcePosition, howMany));\n        }\n        else if (differenceSet.length == 2) {\n            // `moveRange` is inside this range.\n            difference = new ModelRange(this.start, this.end._getTransformedByDeletion(sourcePosition, howMany));\n        } // else, `moveRange` contains this range.\n        if (difference) {\n            result = difference._getTransformedByInsertion(insertPosition, howMany, common !== null || spread);\n        }\n        else {\n            result = [];\n        }\n        if (common) {\n            const transformedCommon = new ModelRange(common.start._getCombined(moveRange.start, insertPosition), common.end._getCombined(moveRange.start, insertPosition));\n            if (result.length == 2) {\n                result.splice(1, 0, transformedCommon);\n            }\n            else {\n                result.push(transformedCommon);\n            }\n        }\n        return result;\n    }\n    /**\n     * Returns a copy of this range that is transformed by deletion of `howMany` nodes from `deletePosition`.\n     *\n     * If the deleted range is intersecting with the transformed range, the transformed range will be shrank.\n     *\n     * If the deleted range contains transformed range, `null` will be returned.\n     *\n     * @internal\n     * @param deletePosition Position from which nodes are removed.\n     * @param howMany How many nodes are removed.\n     * @returns Result of the transformation.\n     */\n    _getTransformedByDeletion(deletePosition, howMany) {\n        let newStart = this.start._getTransformedByDeletion(deletePosition, howMany);\n        let newEnd = this.end._getTransformedByDeletion(deletePosition, howMany);\n        if (newStart == null && newEnd == null) {\n            return null;\n        }\n        if (newStart == null) {\n            newStart = deletePosition;\n        }\n        if (newEnd == null) {\n            newEnd = deletePosition;\n        }\n        return new ModelRange(newStart, newEnd);\n    }\n    /**\n     * Creates a new range, spreading from specified {@link module:engine/model/position~ModelPosition position} to a position moved by\n     * given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.\n     *\n     * @internal\n     * @param position Beginning of the range.\n     * @param shift How long the range should be.\n     */\n    static _createFromPositionAndShift(position, shift) {\n        const start = position;\n        const end = position.getShiftedBy(shift);\n        return shift > 0 ? new this(start, end) : new this(end, start);\n    }\n    /**\n     * Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * @internal\n     * @param element Element which is a parent for the range.\n     */\n    static _createIn(element) {\n        return new this(ModelPosition._createAt(element, 0), ModelPosition._createAt(element, element.maxOffset));\n    }\n    /**\n     * Creates a range that starts before given {@link module:engine/model/item~ModelItem model item} and ends after it.\n     *\n     * @internal\n     */\n    static _createOn(item) {\n        return this._createFromPositionAndShift(ModelPosition._createBefore(item), item.offsetSize);\n    }\n    /**\n     * Combines all ranges from the passed array into a one range. At least one range has to be passed.\n     * Passed ranges must not have common parts.\n     *\n     * The first range from the array is a reference range. If other ranges start or end on the exactly same position where\n     * the reference range, they get combined into one range.\n     *\n     * ```\n     * [  ][]  [    ][ ][             ][ ][]  [  ]  // Passed ranges, shown sorted\n     * [    ]                                       // The result of the function if the first range was a reference range.\n     *         [                           ]        // The result of the function if the third-to-seventh range was a reference range.\n     *                                        [  ]  // The result of the function if the last range was a reference range.\n     * ```\n     *\n     * @internal\n     * @param ranges Ranges to combine.\n     * @returns Combined range.\n     */\n    static _createFromRanges(ranges) {\n        if (ranges.length === 0) {\n            /**\n             * At least one range has to be passed to\n             * {@link module:engine/model/range~ModelRange._createFromRanges `Range._createFromRanges()`}.\n             *\n             * @error range-create-from-ranges-empty-array\n             */\n            throw new CKEditorError('range-create-from-ranges-empty-array', null);\n        }\n        else if (ranges.length == 1) {\n            return ranges[0].clone();\n        }\n        // 1. Set the first range in `ranges` array as a reference range.\n        // If we are going to return just a one range, one of the ranges need to be the reference one.\n        // Other ranges will be stuck to that range, if possible.\n        const ref = ranges[0];\n        // 2. Sort all the ranges, so it's easier to process them.\n        ranges.sort((a, b) => {\n            return a.start.isAfter(b.start) ? 1 : -1;\n        });\n        // 3. Check at which index the reference range is now.\n        const refIndex = ranges.indexOf(ref);\n        // 4. At this moment we don't need the original range.\n        // We are going to modify the result, and we need to return a new instance of Range.\n        // We have to create a copy of the reference range.\n        const result = new this(ref.start, ref.end);\n        // 5. Ranges should be checked and glued starting from the range that is closest to the reference range.\n        // Since ranges are sorted, start with the range with index that is closest to reference range index.\n        for (let i = refIndex - 1; i >= 0; i--) {\n            if (ranges[i].end.isEqual(result.start)) {\n                result.start = ModelPosition._createAt(ranges[i].start);\n            }\n            else {\n                // If ranges are not starting/ending at the same position there is no point in looking further.\n                break;\n            }\n        }\n        // 6. Ranges should be checked and glued starting from the range that is closest to the reference range.\n        // Since ranges are sorted, start with the range with index that is closest to reference range index.\n        for (let i = refIndex + 1; i < ranges.length; i++) {\n            if (ranges[i].start.isEqual(result.end)) {\n                result.end = ModelPosition._createAt(ranges[i].end);\n            }\n            else {\n                // If ranges are not starting/ending at the same position there is no point in looking further.\n                break;\n            }\n        }\n        return result;\n    }\n    /**\n     * Creates a `Range` instance from given plain object (i.e. parsed JSON string).\n     *\n     * @param json Plain object to be converted to `Range`.\n     * @param doc Document object that will be range owner.\n     * @returns `Range` instance created using given plain object.\n     */\n    static fromJSON(json, doc) {\n        return new this(ModelPosition.fromJSON(json.start, doc), ModelPosition.fromJSON(json.end, doc));\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelRange.prototype.is = function (type) {\n    return type === 'range' || type === 'model:range';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/mapper\n */\nimport { ModelPosition } from '../model/position.js';\nimport { ModelRange } from '../model/range.js';\nimport { ViewPosition } from '../view/position.js';\nimport { ViewRange } from '../view/range.js';\nimport { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Maps elements, positions and markers between the {@link module:engine/view/document~ViewDocument view} and\n * the {@link module:engine/model/model model}.\n *\n * The instance of the Mapper used for the editing pipeline is available in\n * {@link module:engine/controller/editingcontroller~EditingController#mapper `editor.editing.mapper`}.\n *\n * Mapper uses bound elements to find corresponding elements and positions, so, to get proper results,\n * all model elements should be {@link module:engine/conversion/mapper~Mapper#bindElements bound}.\n *\n * To map the complex model to/from view relations, you may provide custom callbacks for the\n * {@link module:engine/conversion/mapper~Mapper#event:modelToViewPosition modelToViewPosition event} and\n * {@link module:engine/conversion/mapper~Mapper#event:viewToModelPosition viewToModelPosition event} that are fired whenever\n * a position mapping request occurs.\n * Those events are fired by the {@link module:engine/conversion/mapper~Mapper#toViewPosition toViewPosition}\n * and {@link module:engine/conversion/mapper~Mapper#toModelPosition toModelPosition} methods. `Mapper` adds its own default callbacks\n * with `'lowest'` priority. To override default `Mapper` mapping, add custom callback with higher priority and\n * stop the event.\n */\nexport class Mapper extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * Model element to view element mapping.\n     */\n    _modelToViewMapping = new WeakMap();\n    /**\n     * View element to model element mapping.\n     */\n    _viewToModelMapping = new WeakMap();\n    /**\n     * A map containing callbacks between view element names and functions evaluating length of view elements\n     * in model.\n     */\n    _viewToModelLengthCallbacks = new Map();\n    /**\n     * Model marker name to view elements mapping.\n     *\n     * Keys are `String`s while values are `Set`s with {@link module:engine/view/element~ViewElement view elements}.\n     * One marker (name) can be mapped to multiple elements.\n     */\n    _markerNameToElements = new Map();\n    /**\n     * View element to model marker names mapping.\n     *\n     * This is reverse to {@link ~Mapper#_markerNameToElements} map.\n     */\n    _elementToMarkerNames = new Map();\n    /**\n     * The map of removed view elements with their current root (used for deferred unbinding).\n     */\n    _deferredBindingRemovals = new Map();\n    /**\n     * Stores marker names of markers which have changed due to unbinding a view element (so it is assumed that the view element\n     * has been removed, moved or renamed).\n     */\n    _unboundMarkerNames = new Set();\n    /**\n     * Manages dynamic cache for the `Mapper` to improve the performance.\n     */\n    _cache = new MapperCache();\n    /**\n     * Creates an instance of the mapper.\n     */\n    constructor() {\n        super();\n        // Default mapper algorithm for mapping model position to view position.\n        this.on('modelToViewPosition', (evt, data) => {\n            if (data.viewPosition) {\n                return;\n            }\n            const viewContainer = this._modelToViewMapping.get(data.modelPosition.parent);\n            if (!viewContainer) {\n                /**\n                 * A model position could not be mapped to the view because the parent of the model position\n                 * does not have a mapped view element (might have not been converted yet or it has no converter).\n                 *\n                 * Make sure that the model element is correctly converted to the view.\n                 *\n                 * @error mapping-model-position-view-parent-not-found\n                 */\n                throw new CKEditorError('mapping-model-position-view-parent-not-found', this, { modelPosition: data.modelPosition });\n            }\n            data.viewPosition = this.findPositionIn(viewContainer, data.modelPosition.offset);\n        }, { priority: 'low' });\n        // Default mapper algorithm for mapping view position to model position.\n        this.on('viewToModelPosition', (evt, data) => {\n            if (data.modelPosition) {\n                return;\n            }\n            const viewBlock = this.findMappedViewAncestor(data.viewPosition);\n            const modelParent = this._viewToModelMapping.get(viewBlock);\n            const modelOffset = this._toModelOffset(data.viewPosition.parent, data.viewPosition.offset, viewBlock);\n            data.modelPosition = ModelPosition._createAt(modelParent, modelOffset);\n        }, { priority: 'low' });\n    }\n    /**\n     * Marks model and view elements as corresponding. Corresponding elements can be retrieved by using\n     * the {@link module:engine/conversion/mapper~Mapper#toModelElement toModelElement} and\n     * {@link module:engine/conversion/mapper~Mapper#toViewElement toViewElement} methods.\n     * The information that elements are bound is also used to translate positions.\n     *\n     * @param modelElement Model element.\n     * @param viewElement View element.\n     */\n    bindElements(modelElement, viewElement) {\n        this._modelToViewMapping.set(modelElement, viewElement);\n        this._viewToModelMapping.set(viewElement, modelElement);\n    }\n    /**\n     * Unbinds the given {@link module:engine/view/element~ViewElement view element} from the map.\n     *\n     * **Note:** view-to-model binding will be removed, if it existed. However, corresponding model-to-view binding\n     * will be removed only if model element is still bound to the passed `viewElement`.\n     *\n     * This behavior allows for re-binding model element to another view element without fear of losing the new binding\n     * when the previously bound view element is unbound.\n     *\n     * @param viewElement View element to unbind.\n     * @param options The options object.\n     * @param options.defer Controls whether the binding should be removed immediately or deferred until a\n     * {@link #flushDeferredBindings `flushDeferredBindings()`} call.\n     */\n    unbindViewElement(viewElement, options = {}) {\n        const modelElement = this.toModelElement(viewElement);\n        if (this._elementToMarkerNames.has(viewElement)) {\n            for (const markerName of this._elementToMarkerNames.get(viewElement)) {\n                this._unboundMarkerNames.add(markerName);\n            }\n        }\n        if (options.defer) {\n            this._deferredBindingRemovals.set(viewElement, viewElement.root);\n        }\n        else {\n            const wasFound = this._viewToModelMapping.delete(viewElement);\n            if (wasFound) {\n                // Stop tracking after the element is no longer mapped. We want to track all mapped elements and only mapped elements.\n                this._cache.stopTracking(viewElement);\n            }\n            if (this._modelToViewMapping.get(modelElement) == viewElement) {\n                this._modelToViewMapping.delete(modelElement);\n            }\n        }\n    }\n    /**\n     * Unbinds the given {@link module:engine/model/element~ModelElement model element} from the map.\n     *\n     * **Note:** the model-to-view binding will be removed, if it existed. However, the corresponding view-to-model binding\n     * will be removed only if the view element is still bound to the passed `modelElement`.\n     *\n     * This behavior lets for re-binding view element to another model element without fear of losing the new binding\n     * when the previously bound model element is unbound.\n     *\n     * @param modelElement Model element to unbind.\n     */\n    unbindModelElement(modelElement) {\n        const viewElement = this.toViewElement(modelElement);\n        this._modelToViewMapping.delete(modelElement);\n        if (this._viewToModelMapping.get(viewElement) == modelElement) {\n            const wasFound = this._viewToModelMapping.delete(viewElement);\n            if (wasFound) {\n                // Stop tracking after the element is no longer mapped. We want to track all mapped elements and only mapped elements.\n                this._cache.stopTracking(viewElement);\n            }\n        }\n    }\n    /**\n     * Binds the given marker name with the given {@link module:engine/view/element~ViewElement view element}. The element\n     * will be added to the current set of elements bound with the given marker name.\n     *\n     * @param element Element to bind.\n     * @param name Marker name.\n     */\n    bindElementToMarker(element, name) {\n        const elements = this._markerNameToElements.get(name) || new Set();\n        elements.add(element);\n        const names = this._elementToMarkerNames.get(element) || new Set();\n        names.add(name);\n        this._markerNameToElements.set(name, elements);\n        this._elementToMarkerNames.set(element, names);\n    }\n    /**\n     * Unbinds an element from given marker name.\n     *\n     * @param element Element to unbind.\n     * @param name Marker name.\n     */\n    unbindElementFromMarkerName(element, name) {\n        const nameToElements = this._markerNameToElements.get(name);\n        if (nameToElements) {\n            nameToElements.delete(element);\n            if (nameToElements.size == 0) {\n                this._markerNameToElements.delete(name);\n            }\n        }\n        const elementToNames = this._elementToMarkerNames.get(element);\n        if (elementToNames) {\n            elementToNames.delete(name);\n            if (elementToNames.size == 0) {\n                this._elementToMarkerNames.delete(element);\n            }\n        }\n    }\n    /**\n     * Returns all marker names of markers which have changed due to unbinding a view element (so it is assumed that the view element\n     * has been removed, moved or renamed) since the last flush. After returning, the marker names list is cleared.\n     */\n    flushUnboundMarkerNames() {\n        const markerNames = Array.from(this._unboundMarkerNames);\n        this._unboundMarkerNames.clear();\n        return markerNames;\n    }\n    /**\n     * Unbinds all deferred binding removals of view elements that in the meantime were not re-attached to some root or document fragment.\n     *\n     * See: {@link #unbindViewElement `unbindViewElement()`}.\n     */\n    flushDeferredBindings() {\n        for (const [viewElement, root] of this._deferredBindingRemovals) {\n            // Unbind it only if it wasn't re-attached to some root or document fragment.\n            if (viewElement.root == root) {\n                this.unbindViewElement(viewElement);\n            }\n        }\n        this._deferredBindingRemovals = new Map();\n    }\n    /**\n     * Removes all model to view and view to model bindings.\n     */\n    clearBindings() {\n        this._modelToViewMapping = new WeakMap();\n        this._viewToModelMapping = new WeakMap();\n        this._markerNameToElements = new Map();\n        this._elementToMarkerNames = new Map();\n        this._unboundMarkerNames = new Set();\n        this._deferredBindingRemovals = new Map();\n    }\n    toModelElement(viewElement) {\n        return this._viewToModelMapping.get(viewElement);\n    }\n    toViewElement(modelElement) {\n        return this._modelToViewMapping.get(modelElement);\n    }\n    /**\n     * Gets the corresponding model range.\n     *\n     * @param viewRange View range.\n     * @returns Corresponding model range.\n     */\n    toModelRange(viewRange) {\n        return new ModelRange(this.toModelPosition(viewRange.start), this.toModelPosition(viewRange.end));\n    }\n    /**\n     * Gets the corresponding view range.\n     *\n     * @param modelRange Model range.\n     * @returns Corresponding view range.\n     */\n    toViewRange(modelRange) {\n        return new ViewRange(this.toViewPosition(modelRange.start), this.toViewPosition(modelRange.end));\n    }\n    /**\n     * Gets the corresponding model position.\n     *\n     * @fires viewToModelPosition\n     * @param viewPosition View position.\n     * @returns Corresponding model position.\n     */\n    toModelPosition(viewPosition) {\n        const data = {\n            viewPosition,\n            mapper: this\n        };\n        this.fire('viewToModelPosition', data);\n        return data.modelPosition;\n    }\n    /**\n     * Gets the corresponding view position.\n     *\n     * @fires modelToViewPosition\n     * @param modelPosition Model position.\n     * @param options Additional options for position mapping process.\n     * @param options.isPhantom Should be set to `true` if the model position to map is pointing to a place\n     * in model tree which no longer exists. For example, it could be an end of a removed model range.\n     * @returns Corresponding view position.\n     */\n    toViewPosition(modelPosition, options = {}) {\n        const data = {\n            modelPosition,\n            mapper: this,\n            isPhantom: options.isPhantom\n        };\n        this.fire('modelToViewPosition', data);\n        return data.viewPosition;\n    }\n    /**\n     * Gets all view elements bound to the given marker name.\n     *\n     * @param name Marker name.\n     * @returns View elements bound with the given marker name or `null`\n     * if no elements are bound to the given marker name.\n     */\n    markerNameToElements(name) {\n        const boundElements = this._markerNameToElements.get(name);\n        if (!boundElements) {\n            return null;\n        }\n        const elements = new Set();\n        for (const element of boundElements) {\n            if (element.is('attributeElement')) {\n                for (const clone of element.getElementsWithSameId()) {\n                    elements.add(clone);\n                }\n            }\n            else {\n                elements.add(element);\n            }\n        }\n        return elements;\n    }\n    /**\n     * **This method is deprecated and will be removed in one of the future CKEditor 5 releases.**\n     *\n     * **Using this method will turn off `Mapper` caching system and may degrade performance when operating on bigger documents.**\n     *\n     * Registers a callback that evaluates the length in the model of a view element with the given name.\n     *\n     * The callback is fired with one argument, which is a view element instance. The callback is expected to return\n     * a number representing the length of the view element in the model.\n     *\n     * ```ts\n     * // List item in view may contain nested list, which have other list items. In model though,\n     * // the lists are represented by flat structure. Because of those differences, length of list view element\n     * // may be greater than one. In the callback it's checked how many nested list items are in evaluated list item.\n     *\n     * function getViewListItemLength( element ) {\n     * \tlet length = 1;\n     *\n     * \tfor ( let child of element.getChildren() ) {\n     * \t\tif ( child.name == 'ul' || child.name == 'ol' ) {\n     * \t\t\tfor ( let item of child.getChildren() ) {\n     * \t\t\t\tlength += getViewListItemLength( item );\n     * \t\t\t}\n     * \t\t}\n     * \t}\n     *\n     * \treturn length;\n     * }\n     *\n     * mapper.registerViewToModelLength( 'li', getViewListItemLength );\n     * ```\n     *\n     * @param viewElementName Name of view element for which callback is registered.\n     * @param lengthCallback Function return a length of view element instance in model.\n     * @deprecated\n     */\n    registerViewToModelLength(viewElementName, lengthCallback) {\n        this._viewToModelLengthCallbacks.set(viewElementName, lengthCallback);\n    }\n    /**\n     * For the given `viewPosition`, finds and returns the closest ancestor of this position that has a mapping to\n     * the model.\n     *\n     * @param viewPosition Position for which a mapped ancestor should be found.\n     */\n    findMappedViewAncestor(viewPosition) {\n        let parent = viewPosition.parent;\n        while (!this._viewToModelMapping.has(parent)) {\n            parent = parent.parent;\n        }\n        return parent;\n    }\n    /**\n     * Calculates model offset based on the view position and the block element.\n     *\n     * Example:\n     *\n     * ```html\n     * <p>foo<b>ba|r</b></p> // _toModelOffset( b, 2, p ) -> 5\n     * ```\n     *\n     * Is a sum of:\n     *\n     * ```html\n     * <p>foo|<b>bar</b></p> // _toModelOffset( p, 3, p ) -> 3\n     * <p>foo<b>ba|r</b></p> // _toModelOffset( b, 2, b ) -> 2\n     * ```\n     *\n     * @param viewParent Position parent.\n     * @param viewOffset Position offset.\n     * @param viewBlock Block used as a base to calculate offset.\n     * @returns Offset in the model.\n     */\n    _toModelOffset(viewParent, viewOffset, viewBlock) {\n        if (viewBlock != viewParent) {\n            // See example.\n            const offsetToParentStart = this._toModelOffset(viewParent.parent, viewParent.index, viewBlock);\n            const offsetInParent = this._toModelOffset(viewParent, viewOffset, viewParent);\n            return offsetToParentStart + offsetInParent;\n        }\n        // viewBlock == viewParent, so we need to calculate the offset in the parent element.\n        // If the position is a text it is simple (\"ba|r\" -> 2).\n        if (viewParent.is('$text')) {\n            return viewOffset;\n        }\n        // If the position is in an element we need to sum lengths of siblings ( <b> bar </b> foo | -> 3 + 3 = 6 ).\n        let modelOffset = 0;\n        for (let i = 0; i < viewOffset; i++) {\n            modelOffset += this.getModelLength(viewParent.getChild(i));\n        }\n        return modelOffset;\n    }\n    /**\n     * Gets the length of the view element in the model.\n     *\n     * The length is calculated as follows:\n     * * if a {@link #registerViewToModelLength length mapping callback} is provided for the given `viewNode`, it is used to\n     * evaluate the model length (`viewNode` is used as first and only parameter passed to the callback),\n     * * length of a {@link module:engine/view/text~ViewText text node} is equal to the length of its\n     * {@link module:engine/view/text~ViewText#data data},\n     * * length of a {@link module:engine/view/uielement~ViewUIElement ui element} is equal to 0,\n     * * length of a mapped {@link module:engine/view/element~ViewElement element} is equal to 1,\n     * * length of a non-mapped {@link module:engine/view/element~ViewElement element} is equal to the length of its children.\n     *\n     * Examples:\n     *\n     * ```\n     * foo                          -> 3 // Text length is equal to its data length.\n     * <p>foo</p>                   -> 1 // Length of an element which is mapped is by default equal to 1.\n     * <b>foo</b>                   -> 3 // Length of an element which is not mapped is a length of its children.\n     * <div><p>x</p><p>y</p></div>  -> 2 // Assuming that <div> is not mapped and <p> are mapped.\n     * ```\n     *\n     * @param viewNode View node.\n     * @returns Length of the node in the tree model.\n     */\n    getModelLength(viewNode) {\n        const stack = [viewNode];\n        let len = 0;\n        while (stack.length > 0) {\n            const node = stack.pop();\n            const callback = node.name &&\n                this._viewToModelLengthCallbacks.size > 0 &&\n                this._viewToModelLengthCallbacks.get(node.name);\n            if (callback) {\n                len += callback(node);\n            }\n            else if (this._viewToModelMapping.has(node)) {\n                len += 1;\n            }\n            else if (node.is('$text')) {\n                len += node.data.length;\n            }\n            else if (node.is('uiElement')) {\n                continue;\n            }\n            else {\n                for (const child of node.getChildren()) {\n                    stack.push(child);\n                }\n            }\n        }\n        return len;\n    }\n    /**\n     * Finds the position in a view element or view document fragment node (or in its children) with the expected model offset.\n     *\n     * If the passed `viewContainer` is bound to model, `Mapper` will use caching mechanism to improve performance.\n     *\n     * @param viewContainer Tree view element in which we are looking for the position.\n     * @param modelOffset Expected offset.\n     * @returns Found position.\n     */\n    findPositionIn(viewContainer, modelOffset) {\n        if (modelOffset === 0) {\n            // Quickly return if asked for a position at the beginning of the container. No need to fire complex mechanisms to find it.\n            return this._moveViewPositionToTextNode(new ViewPosition(viewContainer, 0));\n        }\n        // Use cache only if there are no custom view-to-model length callbacks and only for bound elements.\n        // View-to-model length callbacks are deprecated and should be removed in one of the following releases.\n        // Then it will be possible to simplify some logic inside `Mapper`.\n        // Note: we could consider requiring `viewContainer` to be a mapped item.\n        const useCache = this._viewToModelLengthCallbacks.size == 0 && this._viewToModelMapping.has(viewContainer);\n        if (useCache) {\n            const cacheItem = this._cache.getClosest(viewContainer, modelOffset);\n            return this._findPositionStartingFrom(cacheItem.viewPosition, cacheItem.modelOffset, modelOffset, viewContainer, true);\n        }\n        else {\n            return this._findPositionStartingFrom(new ViewPosition(viewContainer, 0), 0, modelOffset, viewContainer, false);\n        }\n    }\n    /**\n     * Performs most of the logic for `Mapper#findPositionIn()`.\n     *\n     * It allows to start looking for the requested model offset from a given starting position, to enable caching. Using the cache,\n     * you can set the starting point and skip all the calculations that were already previously done.\n     *\n     * This method uses recursion to find positions inside deep structures. Example:\n     *\n     * ```\n     * <p>fo<b>bar</b>bom</p>  -> target offset: 4\n     * <p>|fo<b>bar</b>bom</p> -> target offset: 4, traversed offset: 0\n     * <p>fo|<b>bar</b>bom</p> -> target offset: 4, traversed offset: 2\n     * <p>fo<b>bar</b>|bom</p> -> target offset: 4, traversed offset: 5 -> we are too far, look recursively in <b>.\n     *\n     * <p>fo<b>|bar</b>bom</p> -> target offset: 4, traversed offset: 2\n     * <p>fo<b>bar|</b>bom</p> -> target offset: 4, traversed offset: 5 -> we are too far, look inside \"bar\".\n     *\n     * <p>fo<b>ba|r</b>bom</p> -> target offset: 4, traversed offset: 2 -> position is inside text node at offset 4-2 = 2.\n     * ```\n     *\n     * @param startViewPosition View position to start looking from.\n     * @param startModelOffset Model offset related to `startViewPosition`.\n     * @param targetModelOffset Target model offset to find.\n     * @param viewContainer Mapped ancestor of `startViewPosition`. `startModelOffset` is the offset inside a model element or model\n     * document fragment mapped to `viewContainer`.\n     * @param useCache Whether `Mapper` should cache positions while traversing the view tree looking for `expectedModelOffset`.\n     * @returns View position mapped to `targetModelOffset`.\n     */\n    _findPositionStartingFrom(startViewPosition, startModelOffset, targetModelOffset, viewContainer, useCache) {\n        let viewParent = startViewPosition.parent;\n        let viewOffset = startViewPosition.offset;\n        // In the text node it is simple: the offset in the model equals the offset in the text.\n        if (viewParent.is('$text')) {\n            return new ViewPosition(viewParent, targetModelOffset - startModelOffset);\n        }\n        // Last scanned view node.\n        let viewNode;\n        // Total model offset of the view nodes that were visited so far.\n        let traversedModelOffset = startModelOffset;\n        // Model length of the last traversed view node.\n        let lastLength = 0;\n        while (traversedModelOffset < targetModelOffset) {\n            viewNode = viewParent.getChild(viewOffset);\n            if (!viewNode) {\n                // If we still haven't reached the model offset, but we reached end of this `viewParent`, then we need to \"leave\" this\n                // element and \"go up\", looking further for the target model offset. This can happen when cached model offset is \"deeper\"\n                // but target model offset is \"higher\" in the view tree.\n                //\n                // Example: `<p>Foo<strong><em>Bar</em>^Baz</strong>Xyz</p>`\n                //\n                // Consider `^` is last cached position, when the `targetModelOffset` is `12`. In such case, we need to \"go up\" from\n                // `<strong>` and continue traversing in `<p>`.\n                //\n                if (viewParent == viewContainer) {\n                    /**\n                     * A model position could not be mapped to the view because specified model offset was too big and could not be\n                     * found inside the mapped view element or view document fragment.\n                     *\n                     * @error mapping-model-offset-not-found\n                     */\n                    throw new CKEditorError('mapping-model-offset-not-found', this, { modelOffset: targetModelOffset, viewContainer });\n                }\n                else {\n                    viewOffset = viewParent.parent.getChildIndex(viewParent) + 1;\n                    viewParent = viewParent.parent;\n                    // Cache view position after stepping out of the view element to make sure that all visited view positions are cached.\n                    // Otherwise, cache invalidation may work incorrectly.\n                    if (useCache) {\n                        this._cache.save(viewParent, viewOffset, viewContainer, traversedModelOffset);\n                    }\n                    continue;\n                }\n            }\n            if (useCache) {\n                lastLength = this._getModelLengthAndCache(viewNode, viewContainer, traversedModelOffset);\n            }\n            else {\n                lastLength = this.getModelLength(viewNode);\n            }\n            traversedModelOffset += lastLength;\n            viewOffset++;\n        }\n        let viewPosition = new ViewPosition(viewParent, viewOffset);\n        if (useCache) {\n            // Make sure to hoist view position and save cache for all view positions along the way that have the same `modelOffset`.\n            //\n            // Consider example view:\n            //\n            // <p>Foo<strong><i>bar<em>xyz</em></i></strong>abc</p>\n            //\n            // Lets assume that we looked for model offset `9`, starting  from `6` (as it was previously cached value).\n            // In this case we will only traverse over `<em>xyz</em>` and cache view positions after \"xyz\" and after `</em>`.\n            // After stepping over `<em>xyz</em>`, we will stop processing this view, as we will reach target model offset `9`.\n            //\n            // However, position before `</strong>` and before `abc` are also valid positions for model offset `9`.\n            // Additionally, `Mapper` is supposed to return \"hoisted\" view positions, that is, we prefer positions that are closer to\n            // the mapped `viewContainer`. If a position is nested inside attribute elements, it should be \"moved up\" if possible.\n            //\n            // As we hoist the view position, we need to make sure that all view positions valid for model offset `9` are cached.\n            // This is necessary for cache invalidation to work correctly.\n            //\n            // To hoist a view position, we \"go up\" as long as the position is at the end of a non-mapped view element. We also cache\n            // all necessary values. See example:\n            //\n            // <p>Foo<strong><i>bar<em>xyz</em>^</i></strong>abc</p>\n            // <p>Foo<strong><i>bar<em>xyz</em></i>^</strong>abc</p>\n            // <p>Foo<strong><i>bar<em>xyz</em></i></strong>^abc</p>\n            //\n            while (viewPosition.isAtEnd && viewPosition.parent !== viewContainer && viewPosition.parent.parent) {\n                const cacheViewParent = viewPosition.parent.parent;\n                const cacheViewOffset = cacheViewParent.getChildIndex(viewPosition.parent) + 1;\n                this._cache.save(cacheViewParent, cacheViewOffset, viewContainer, traversedModelOffset);\n                viewPosition = new ViewPosition(cacheViewParent, cacheViewOffset);\n            }\n        }\n        if (traversedModelOffset == targetModelOffset) {\n            // If it equals we found the position.\n            //\n            // Try moving view position into a text node if possible, as the editor engine prefers positions inside view text nodes.\n            //\n            // <p>Foo<strong><i>bar<em>xyz</em></i></strong>[]abc</p>    -->     <p>Foo<strong><i>bar<em>xyz</em></i></strong>{}abc</p>\n            //\n            return this._moveViewPositionToTextNode(viewPosition);\n        }\n        else {\n            // If it is higher we overstepped with the last traversed view node.\n            // We need to \"enter\" it, and look for the view position / model offset inside the last visited view node.\n            return this._findPositionStartingFrom(new ViewPosition(viewNode, 0), traversedModelOffset - lastLength, targetModelOffset, viewContainer, useCache);\n        }\n    }\n    /**\n     * Gets the length of the view element in the model and updates cache values after each view item it visits.\n     *\n     * See also {@link #getModelLength}.\n     *\n     * @param viewNode View node.\n     * @param viewContainer Ancestor of `viewNode` that is a mapped view element.\n     * @param modelOffset Model offset at which the `viewNode` starts.\n     * @returns Length of the node in the tree model.\n     */\n    _getModelLengthAndCache(viewNode, viewContainer, modelOffset) {\n        let len = 0;\n        if (this._viewToModelMapping.has(viewNode)) {\n            len = 1;\n        }\n        else if (viewNode.is('$text')) {\n            len = viewNode.data.length;\n        }\n        else if (!viewNode.is('uiElement')) {\n            for (const child of viewNode.getChildren()) {\n                len += this._getModelLengthAndCache(child, viewContainer, modelOffset + len);\n            }\n        }\n        this._cache.save(viewNode.parent, viewNode.index + 1, viewContainer, modelOffset + len);\n        return len;\n    }\n    /**\n     * Because we prefer positions in the text nodes over positions next to text nodes, if the view position was next to a text node,\n     * it moves it into the text node instead.\n     *\n     * ```\n     * <p>[]<b>foo</b></p> -> <p>[]<b>foo</b></p> // do not touch if position is not directly next to text\n     * <p>foo[]<b>foo</b></p> -> <p>foo{}<b>foo</b></p> // move to text node\n     * <p><b>[]foo</b></p> -> <p><b>{}foo</b></p> // move to text node\n     * ```\n     *\n     * @param viewPosition Position potentially next to the text node.\n     * @returns Position in the text node if possible.\n     */\n    _moveViewPositionToTextNode(viewPosition) {\n        // If the position is just after a text node, put it at the end of that text node.\n        // If the position is just before a text node, put it at the beginning of that text node.\n        const nodeBefore = viewPosition.nodeBefore;\n        const nodeAfter = viewPosition.nodeAfter;\n        if (nodeBefore && nodeBefore.is('view:$text')) {\n            return new ViewPosition(nodeBefore, nodeBefore.data.length);\n        }\n        else if (nodeAfter && nodeAfter.is('view:$text')) {\n            return new ViewPosition(nodeAfter, 0);\n        }\n        // Otherwise, just return the given position.\n        return viewPosition;\n    }\n}\n/**\n * Cache mechanism for {@link module:engine/conversion/mapper~Mapper Mapper}.\n *\n * `MapperCache` improves performance for model-to-view position mapping, which is the main `Mapper` task. Asking for a mapping is much\n * more frequent than actually performing changes, and even if the change happens, we can still partially keep the cache. This makes\n * caching a useful strategy for `Mapper`.\n *\n * `MapperCache` will store some data for view elements or view document fragments that are mapped by the `Mapper`. These view items\n * are \"tracked\" by the `MapperCache`. For such view items, we will keep entries of model offsets inside their mapped counterpart. For\n * the cached model offsets, we will keep a view position that is inside the tracked item. This allows us to either get the mapping\n * instantly, or at least in less steps than when calculating it from the beginning.\n *\n * Important problem related to caching is invalidating the cache. The cache must be invalidated each time the tracked view item changes.\n * Additionally, we should invalidate as small part of the cache as possible. Since all the logic is encapsulated inside `MapperCache`,\n * the `MapperCache` listens to view items {@link module:engine/view/node~ViewNodeChangeEvent `change` event} and reacts to it.\n * Then, it invalidates just the part of the cache that is \"after\" the changed part of the view.\n *\n * As mentioned, `MapperCache` currently is used only for model-to-view position mapping as it was much bigger problem than view-to-model\n * mapping. However, it should be possible to use it also for view-to-model.\n *\n * The main assumptions regarding `MapperCache` are:\n *\n * * it is an internal tool, used by `Mapper`, transparent to the outside (no additional effort when developing a plugin or a converter),\n * * it stores all the necessary data internally, which makes it easier to disable or debug,\n * * it is optimized for initial downcast process (long insertions), which is crucial for editor init and data save,\n * * it does not save all possible positions mapping for memory considerations, although it is a possible improvement, which may increase\n *   performance, as well as simplify some parts of the `MapperCache` logic.\n *\n * @internal\n */\nexport class MapperCache extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * For every view element or document fragment tracked by `MapperCache`, it holds currently cached data, or more precisely,\n     * model offset to view position mappings. See also `MappingCache` and `CacheItem`.\n     *\n     * If an item is tracked by `MapperCache` it has an entry in this structure, so this structure can be used to check which items\n     * are tracked by `MapperCache`. When an item is no longer tracked, it is removed from this structure.\n     *\n     * Although `MappingCache` and `CacheItem` structures allows for caching any model offsets and view positions, we only cache\n     * values for model offsets that are after a view node. So, in essence, positions inside text nodes are not cached. However, it takes\n     * from one to at most a few steps, to get from a cached position to a position that is inside a view text node.\n     *\n     * Additionally, only one item per `modelOffset` is cached. There can be several view positions that map to the same `modelOffset`.\n     * Only the first save for `modelOffset` is stored.\n     */\n    _cachedMapping = new WeakMap();\n    /**\n     * When `MapperCache` {@link ~MapperCache#save saves} view position -> model offset mapping, a `CacheItem` is inserted into certain\n     * `MappingCache#cacheList` at some index. Additionally, we store that index with the view node that is before the cached view position.\n     *\n     * This allows to quickly get a cache list item related to certain view node, and hence, for fast cache invalidation.\n     *\n     * For example, consider view: `<p>Some <strong>bold</strong> text.</p>`, where `<p>` is a view element tracked by `MapperCache`.\n     * If all `<p>` children were visited by `MapperCache`, then `<p>` cache list would have four items, related to following model offsets:\n     * `0`, `5`, `9`, `15`. Then, view node `\"Some \"` would have index `1`, `<strong>` index `2`, and `\" text.\" index `3`.\n     *\n     * Note that the index related with a node is always greater than `0`. The first item in cache list is always for model offset `0`\n     * (and view offset `0`), and it is not related to any node.\n     */\n    _nodeToCacheListIndex = new WeakMap();\n    /**\n     * Callback fired whenever there is a direct or indirect children change in tracked view element or tracked view document fragment.\n     *\n     * This is specified as a property to make it easier to set as an event callback and to later turn off that event.\n     */\n    _invalidateOnChildrenChangeCallback = (evt, viewNode, data) => {\n        // View element or document fragment changed its children at `data.index`. Clear all cache starting from before that index.\n        this._clearCacheInsideParent(viewNode, data.index);\n    };\n    /**\n     * Callback fired whenever a view text node directly or indirectly inside a tracked view element or tracked view document fragment\n     * changes its text data.\n     *\n     * This is specified as a property to make it easier to set as an event callback and to later turn off that event.\n     */\n    _invalidateOnTextChangeCallback = (evt, viewNode) => {\n        // It is enough to validate starting from \"after the text node\", because the first cache entry that we might want to invalidate\n        // is the position after this text node.\n        //\n        // For example - assume following view and following view positions cached (marked by `^`): `<p>Foo^<strong>bar^</strong>^abc^</p>`.\n        //\n        // If we change text \"bar\", we only need to invalidate cached positions after it. Cached positions before the text are not changed.\n        //\n        this._clearCacheAfter(viewNode);\n    };\n    /**\n     * Saves cache for given view position mapping <-> model offset mapping. The view position should be after a node (i.e. it cannot\n     * be the first position inside its parent, or in other words, `viewOffset` must be greater than `0`).\n     *\n     * Note, that if `modelOffset` for given `viewContainer` was already saved, the stored view position (i.e. parent+offset) will not\n     * be overwritten. However, it is important to still save it, as we still store additional data related to cached view positions.\n     *\n     * @param viewParent View position parent.\n     * @param viewOffset View position offset. Must be greater than `0`.\n     * @param viewContainer Tracked view position ascendant (it may be the direct parent of the view position).\n     * @param modelOffset Model offset in the model element or document fragment which is mapped to `viewContainer`.\n     */\n    save(viewParent, viewOffset, viewContainer, modelOffset) {\n        // Get current cache for the tracked ancestor.\n        const cache = this._cachedMapping.get(viewContainer);\n        // See if there is already a cache defined for `modelOffset`.\n        const cacheItem = cache.cacheMap.get(modelOffset);\n        if (cacheItem) {\n            // We already cached this offset. Don't overwrite the cache.\n            // However, we still need to set a proper entry in `_nodeToCacheListIndex`. We can figure it out based on existing `cacheItem`.\n            //\n            // We have a `cacheItem` for the `modelOffset`, so we can get a `viewPosition` from there. Before that view position, there\n            // must be a node. That node must have an index set. This will be the index we will want to use.\n            // Since we expect `viewOffset` to be greater than 0, then in almost all cases `modelOffset` will be greater than 0 as well.\n            // As a result, we can expect `cacheItem.viewPosition.nodeBefore` to be set.\n            //\n            // However, in an edge case, were the tracked element contains a 0-model-length view element as the first child (UI element or\n            // an empty attribute element), then `modelOffset` will be 0, and `cacheItem.viewPosition` will be before any view node.\n            // In such edge case, `cacheItem.viewPosition.nodeBefore` is `undefined`, so we set index to `0`.\n            //\n            const viewChild = viewParent.getChild(viewOffset - 1);\n            const index = cacheItem.viewPosition.nodeBefore ? this._nodeToCacheListIndex.get(cacheItem.viewPosition.nodeBefore) : 0;\n            this._nodeToCacheListIndex.set(viewChild, index);\n            return;\n        }\n        const viewPosition = new ViewPosition(viewParent, viewOffset);\n        const newCacheItem = { viewPosition, modelOffset };\n        // Extend the valid cache range.\n        cache.maxModelOffset = modelOffset > cache.maxModelOffset ? modelOffset : cache.maxModelOffset;\n        // Save the new cache item to the `cacheMap`.\n        cache.cacheMap.set(modelOffset, newCacheItem);\n        // Save the new cache item to the `cacheList`.\n        let i = cache.cacheList.length - 1;\n        // Mostly, we cache elements at the end of `cacheList` and the loop does not execute even once. But when we recursively visit nodes\n        // in `Mapper#_findPositionIn()`, then we will first cache the parent, and then it's children, and they will not be added at the\n        // end of `cacheList`. This is why we need to find correct index to insert them.\n        while (i >= 0 && cache.cacheList[i].modelOffset > modelOffset) {\n            i--;\n        }\n        cache.cacheList.splice(i + 1, 0, newCacheItem);\n        if (viewOffset > 0) {\n            const viewChild = viewParent.getChild(viewOffset - 1);\n            // There was an idea to also cache `viewContainer` here but, it could lead to wrong results. If we wanted to cache\n            // `viewContainer`, we probably would need to clear `this._nodeToCacheListIndex` when cache is cleared.\n            // Also, there was no gain from caching this value, the results were almost the same (statistical error).\n            this._nodeToCacheListIndex.set(viewChild, i + 1);\n        }\n    }\n    /**\n     * For given `modelOffset` inside a model element mapped to given `viewContainer`, it returns the closest saved cache item\n     * (view position and related model offset) to the requested one.\n     *\n     * It can be exactly the requested mapping, or it can be mapping that is the closest starting point to look for the requested mapping.\n     *\n     * `viewContainer` must be a view element or document fragment that is mapped by the {@link ~Mapper Mapper}.\n     *\n     * If `viewContainer` is not yet tracked by the `MapperCache`, it will be automatically tracked after calling this method.\n     *\n     * Note: this method will automatically \"hoist\" cached positions, i.e. it will return a position that is closest to the tracked element.\n     *\n     * For example, if `<p>` is tracked element, and `^` is cached position:\n     *\n     * ```\n     * <p>This is <strong>some <em>heavily <u>formatted</u>^</em></strong> text.</p>\n     * ```\n     *\n     * If this position would be returned, instead, a position directly in `<p>` would be returned:\n     *\n     * ```\n     * <p>This is <strong>some <em>heavily <u>formatted</u></em></strong>^ text.</p>\n     * ```\n     *\n     * Note, that `modelOffset` for both positions is the same.\n     *\n     * @param viewContainer Tracked view element or document fragment, which cache will be used.\n     * @param modelOffset Model offset in a model element or document fragment, which is mapped to `viewContainer`.\n     */\n    getClosest(viewContainer, modelOffset) {\n        const cache = this._cachedMapping.get(viewContainer);\n        let result;\n        if (cache) {\n            if (modelOffset > cache.maxModelOffset) {\n                result = cache.cacheList[cache.cacheList.length - 1];\n            }\n            else {\n                const cacheItem = cache.cacheMap.get(modelOffset);\n                if (cacheItem) {\n                    result = cacheItem;\n                }\n                else {\n                    result = this._findInCacheList(cache.cacheList, modelOffset);\n                }\n            }\n        }\n        else {\n            result = this.startTracking(viewContainer);\n        }\n        return {\n            modelOffset: result.modelOffset,\n            viewPosition: result.viewPosition.clone()\n        };\n    }\n    /**\n     * Starts tracking given `viewContainer`, which must be mapped to a model element or model document fragment.\n     *\n     * Note, that this method is automatically called by\n     * {@link module:engine/conversion/mapper~MapperCache#getClosest `MapperCache#getClosest()`} and there is no need to call it manually.\n     *\n     * This method initializes the cache for `viewContainer` and adds callbacks for\n     * {@link module:engine/view/node~ViewNodeChangeEvent `change` event} fired by `viewContainer`. `MapperCache` listens to `change` event\n     * on the tracked elements to invalidate the stored cache.\n     */\n    startTracking(viewContainer) {\n        const viewPosition = new ViewPosition(viewContainer, 0);\n        const initialCacheItem = { viewPosition, modelOffset: 0 };\n        const initialCache = {\n            maxModelOffset: 0,\n            cacheList: [initialCacheItem],\n            cacheMap: new Map([[0, initialCacheItem]])\n        };\n        this._cachedMapping.set(viewContainer, initialCache);\n        // Listen to changes in tracked view containers in order to invalidate the cache.\n        //\n        // Possible performance improvement. This event bubbles, so if there are multiple tracked (mapped) elements that are ancestors\n        // then this will be unnecessarily fired for each ancestor. This could be rewritten to listen only to roots and document fragments.\n        viewContainer.on('change:children', this._invalidateOnChildrenChangeCallback);\n        viewContainer.on('change:text', this._invalidateOnTextChangeCallback);\n        return initialCacheItem;\n    }\n    /**\n     * Stops tracking given `viewContainer`.\n     *\n     * It removes the cached data and stops listening to {@link module:engine/view/node~ViewNodeChangeEvent `change` event} on the\n     * `viewContainer`.\n     */\n    stopTracking(viewContainer) {\n        viewContainer.off('change:children', this._invalidateOnChildrenChangeCallback);\n        viewContainer.off('change:text', this._invalidateOnTextChangeCallback);\n        this._cachedMapping.delete(viewContainer);\n    }\n    /**\n     * Invalidates cache inside `viewParent`, starting from given `index` in that parent.\n     *\n     * This method may clear a bit more cache than just what was saved after given `index`, but it is guaranteed that at least it\n     * will invalidate everything after `index`.\n     */\n    _clearCacheInsideParent(viewParent, index) {\n        if (index == 0) {\n            // Change at the beginning of the parent.\n            if (this._cachedMapping.has(viewParent)) {\n                // If this is a tracked element, clear all cache.\n                this._clearCacheAll(viewParent);\n            }\n            else {\n                // If this is not a tracked element, remove cache starting from before this element.\n                // Since it is not a tracked element, it has to have a parent.\n                this._clearCacheInsideParent(viewParent.parent, viewParent.index);\n            }\n        }\n        else {\n            // Change in the middle of the parent. Get a view node that's before the change.\n            const lastValidNode = viewParent.getChild(index - 1);\n            // Then, clear all cache after this view node.\n            //\n            this._clearCacheAfter(lastValidNode);\n        }\n    }\n    /**\n     * Clears all the cache for given tracked `viewContainer`.\n     */\n    _clearCacheAll(viewContainer) {\n        const cache = this._cachedMapping.get(viewContainer);\n        // TODO: Should clear `_nodeToCacheListIndex` too?\n        if (cache.maxModelOffset > 0) {\n            cache.maxModelOffset = 0;\n            cache.cacheList.length = 1;\n            cache.cacheMap.clear();\n            cache.cacheMap.set(0, cache.cacheList[0]);\n        }\n    }\n    /**\n     * Clears all the stored cache that is after given `viewNode`. The `viewNode` can be any node that is inside a tracked view element\n     * or view document fragment.\n     *\n     * In reality, this function may clear a bit more cache than just \"starting after\" `viewNode`, but it is guaranteed that at least\n     * all cache after `viewNode` is invalidated.\n     */\n    _clearCacheAfter(viewNode) {\n        // To quickly invalidate the cache, we base on the cache list index stored with the node. See docs for `this._nodeToCacheListIndex`.\n        const cacheListIndex = this._nodeToCacheListIndex.get(viewNode);\n        // If there is no index stored, it means that this `viewNode` has not been cached yet.\n        if (cacheListIndex === undefined) {\n            // If the node is not cached, maybe it's parent is. We will try to invalidate the cache using the parent.\n            const viewParent = viewNode.parent;\n            // If the parent is a non-tracked element, try clearing the cache starting from the position before it.\n            //\n            // For example: `<p>Abc<strong>def<em>ghi</em></strong></p>`.\n            //\n            // If `viewNode` is `<em>` in this case, and it was not cached yet, we will try to clear cache starting from before `<strong>`.\n            //\n            // If the parent is a tracked element, then it means there's no cache to clear (nothing after the element is cached).\n            // In this case, there's nothing to do. We assume that there are no \"holes\" in caching in direct children of tracked element\n            // (that is if some children is cached, then its previous sibling is cached too, and we would not end up inside this `if`).\n            //\n            // TODO: Most probably this `if` could be removed altogether, after recent changes in Mapper.\n            // TODO: Now we cache all items one after another, so there aren't any \"holes\" anywhere, not only on top-level.\n            //\n            if (!this._cachedMapping.has(viewParent)) {\n                this._clearCacheInsideParent(viewParent.parent, viewParent.index);\n            }\n            return;\n        }\n        let viewContainer = viewNode.parent;\n        while (!this._cachedMapping.has(viewContainer)) {\n            viewContainer = viewContainer.parent;\n        }\n        this._clearCacheFromCacheIndex(viewContainer, cacheListIndex);\n    }\n    /**\n     * Clears all the cache in the cache list related to given `viewContainer`, starting from `index` (inclusive).\n     */\n    _clearCacheFromCacheIndex(viewContainer, index) {\n        if (index === 0) {\n            // Don't remove the first entry in the cache (this entry is always a mapping between view offset 0 <-> model offset 0,\n            // and it is a default value that is always expected to be in the cache list).\n            //\n            // The cache mechanism may ask to clear from index `0` in a case where a 0-model-length view element (UI element or empty\n            // attribute element) was at the beginning of tracked element. In such scenario, the view element is mapped through\n            // `nodeToCacheListIndex` to index `0`.\n            index = 1;\n        }\n        // Cache is always available here because we initialize it just before adding a listener that fires `_clearCacheFromIndex()`.\n        const cache = this._cachedMapping.get(viewContainer);\n        const cacheItem = cache.cacheList[index - 1];\n        if (!cacheItem) {\n            return;\n        }\n        cache.maxModelOffset = cacheItem.modelOffset;\n        // Remove from cache all `CacheItem`s that are \"after\" the index to clear from.\n        const clearedItems = cache.cacheList.splice(index);\n        // For each removed item, make sure to also remove it from `cacheMap` and clear related entry in `_nodeToCacheListIndex`.\n        for (const item of clearedItems) {\n            cache.cacheMap.delete(item.modelOffset);\n            const viewNode = item.viewPosition.nodeBefore;\n            this._nodeToCacheListIndex.delete(viewNode);\n        }\n    }\n    /**\n     * Finds a cache item in the given cache list, which `modelOffset` is closest (but smaller or equal) to given `offset`.\n     *\n     * Since `cacheList` is a sorted array, this uses binary search to retrieve the item quickly.\n     */\n    _findInCacheList(cacheList, offset) {\n        let start = 0;\n        let end = cacheList.length - 1;\n        let index = (end - start) >> 1;\n        let item = cacheList[index];\n        while (start < end) {\n            if (item.modelOffset < offset) {\n                start = index + 1;\n            }\n            else {\n                end = index - 1;\n            }\n            index = start + ((end - start) >> 1);\n            item = cacheList[index];\n        }\n        return item.modelOffset <= offset ? item : cacheList[index - 1];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/modelconsumable\n */\nimport { ModelTextProxy } from '../model/textproxy.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Manages a list of consumable values for the {@link module:engine/model/item~ModelItem model items}.\n *\n * Consumables are various aspects of the model. A model item can be broken down into separate, single properties that might be\n * taken into consideration when converting that item.\n *\n * `ModelConsumable` is used by {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} while analyzing the changed\n * parts of {@link module:engine/model/document~ModelDocument the document}. The added / changed / removed model items are broken down\n * into singular properties (the item itself and its attributes). All those parts are saved in `ModelConsumable`. Then,\n * during conversion, when the given part of a model item is converted (i.e. the view element has been inserted into the view,\n * but without attributes), the consumable value is removed from `ModelConsumable`.\n *\n * For model items, `ModelConsumable` stores consumable values of one of following types: `insert`, `addattribute:<attributeKey>`,\n * `changeattributes:<attributeKey>`, `removeattributes:<attributeKey>`.\n *\n * In most cases, it is enough to let th {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}\n * gather consumable values, so there is no need to use\n * the {@link module:engine/conversion/modelconsumable~ModelConsumable#add add method} directly.\n * However, it is important to understand how consumable values can be\n * {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed}.\n * See {@link module:engine/conversion/downcasthelpers default downcast converters} for more information.\n *\n * Keep in mind that one conversion event may have multiple callbacks (converters) attached to it. Each of those is\n * able to convert one or more parts of the model. However, when one of those callbacks actually converts\n * something, the others should not, because they would duplicate the results. Using `ModelConsumable` helps to avoid\n * this situation, because callbacks should only convert these values that were not yet consumed from `ModelConsumable`.\n *\n * Consuming multiple values in a single callback:\n *\n * ```ts\n * // Converter for custom `imageBlock` element that might have a `caption` element inside which changes\n * // how the image is displayed in the view:\n * //\n * // Model:\n * //\n * // [imageBlock]\n * //   └─ [caption]\n * //       └─ foo\n * //\n * // View:\n * //\n * // <figure>\n * //   ├─ <img />\n * //   └─ <caption>\n * //       └─ foo\n * modelConversionDispatcher.on( 'insert:imageBlock', ( evt, data, conversionApi ) => {\n * \t// First, consume the `imageBlock` element.\n * \tconversionApi.consumable.consume( data.item, 'insert' );\n *\n * \t// Just create normal image element for the view.\n * \t// Maybe it will be \"decorated\" later.\n * \tconst viewImage = new ViewElement( 'img' );\n * \tconst insertPosition = conversionApi.mapper.toViewPosition( data.range.start );\n * \tconst viewWriter = conversionApi.writer;\n *\n * \t// Check if the `imageBlock` element has children.\n * \tif ( data.item.childCount > 0 ) {\n * \t\tconst modelCaption = data.item.getChild( 0 );\n *\n * \t\t// `modelCaption` insertion change is consumed from consumable values.\n * \t\t// It will not be converted by other converters, but it's children (probably some text) will be.\n * \t\t// Through mapping, converters for text will know where to insert contents of `modelCaption`.\n * \t\tif ( conversionApi.consumable.consume( modelCaption, 'insert' ) ) {\n * \t\t\tconst viewCaption = new ViewElement( 'figcaption' );\n *\n * \t\t\tconst viewImageHolder = new ViewElement( 'figure', null, [ viewImage, viewCaption ] );\n *\n * \t\t\tconversionApi.mapper.bindElements( modelCaption, viewCaption );\n * \t\t\tconversionApi.mapper.bindElements( data.item, viewImageHolder );\n * \t\t\tviewWriter.insert( insertPosition, viewImageHolder );\n * \t\t}\n * \t} else {\n * \t\tconversionApi.mapper.bindElements( data.item, viewImage );\n * \t\tviewWriter.insert( insertPosition, viewImage );\n * \t}\n *\n * \tevt.stop();\n * } );\n * ```\n */\nexport class ModelConsumable {\n    /**\n     * Contains list of consumable values.\n     */\n    _consumable = new Map();\n    /**\n     * For each {@link module:engine/model/textproxy~ModelTextProxy} added to `ModelConsumable`, this registry holds a parent\n     * of that `ModelTextProxy` and the start and end indices of that `ModelTextProxy`. This allows identification of the `ModelTextProxy`\n     * instances that point to the same part of the model but are different instances. Each distinct `ModelTextProxy`\n     * is given a unique `Symbol` which is then registered as consumable. This process is transparent for the `ModelConsumable`\n     * API user because whenever `ModelTextProxy` is added, tested, consumed or reverted, the internal mechanisms of\n     * `ModelConsumable` translate `ModelTextProxy` to that unique `Symbol`.\n     */\n    _textProxyRegistry = new Map();\n    /**\n     * Adds a consumable value to the consumables list and links it with a given model item.\n     *\n     * ```ts\n     * modelConsumable.add( modelElement, 'insert' ); // Add `modelElement` insertion change to consumable values.\n     * modelConsumable.add( modelElement, 'addAttribute:bold' ); // Add `bold` attribute insertion on `modelElement` change.\n     * modelConsumable.add( modelElement, 'removeAttribute:bold' ); // Add `bold` attribute removal on `modelElement` change.\n     * modelConsumable.add( modelSelection, 'selection' ); // Add `modelSelection` to consumable values.\n     * modelConsumable.add( modelRange, 'range' ); // Add `modelRange` to consumable values.\n     * ```\n     *\n     * @param item Model item, range or selection that has the consumable.\n     * @param type Consumable type. Will be normalized to a proper form, that is either `<word>` or `<part>:<part>`.\n     * Second colon and everything after will be cut. Passing event name is a safe and good practice.\n     */\n    add(item, type) {\n        type = _normalizeConsumableType(type);\n        if (item instanceof ModelTextProxy) {\n            item = this._getSymbolForTextProxy(item);\n        }\n        if (!this._consumable.has(item)) {\n            this._consumable.set(item, new Map());\n        }\n        this._consumable.get(item).set(type, true);\n    }\n    /**\n     * Removes a given consumable value from a given model item.\n     *\n     * ```ts\n     * modelConsumable.consume( modelElement, 'insert' ); // Remove `modelElement` insertion change from consumable values.\n     * modelConsumable.consume( modelElement, 'addAttribute:bold' ); // Remove `bold` attribute insertion on `modelElement` change.\n     * modelConsumable.consume( modelElement, 'removeAttribute:bold' ); // Remove `bold` attribute removal on `modelElement` change.\n     * modelConsumable.consume( modelSelection, 'selection' ); // Remove `modelSelection` from consumable values.\n     * modelConsumable.consume( modelRange, 'range' ); // Remove 'modelRange' from consumable values.\n     * ```\n     *\n     * @param item Model item, range or selection from which consumable will be consumed.\n     * @param type Consumable type. Will be normalized to a proper form, that is either `<word>` or `<part>:<part>`.\n     * Second colon and everything after will be cut. Passing event name is a safe and good practice.\n     * @returns `true` if consumable value was available and was consumed, `false` otherwise.\n     */\n    consume(item, type) {\n        type = _normalizeConsumableType(type);\n        if (item instanceof ModelTextProxy) {\n            item = this._getSymbolForTextProxy(item);\n        }\n        if (this.test(item, type)) {\n            this._consumable.get(item).set(type, false);\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    /**\n     * Tests whether there is a consumable value of a given type connected with a given model item.\n     *\n     * ```ts\n     * modelConsumable.test( modelElement, 'insert' ); // Check for `modelElement` insertion change.\n     * modelConsumable.test( modelElement, 'addAttribute:bold' ); // Check for `bold` attribute insertion on `modelElement` change.\n     * modelConsumable.test( modelElement, 'removeAttribute:bold' ); // Check for `bold` attribute removal on `modelElement` change.\n     * modelConsumable.test( modelSelection, 'selection' ); // Check if `modelSelection` is consumable.\n     * modelConsumable.test( modelRange, 'range' ); // Check if `modelRange` is consumable.\n     * ```\n     *\n     * @param item Model item, range or selection to be tested.\n     * @param type Consumable type. Will be normalized to a proper form, that is either `<word>` or `<part>:<part>`.\n     * Second colon and everything after will be cut. Passing event name is a safe and good practice.\n     * @returns `null` if such consumable was never added, `false` if the consumable values was\n     * already consumed or `true` if it was added and not consumed yet.\n     */\n    test(item, type) {\n        type = _normalizeConsumableType(type);\n        if (item instanceof ModelTextProxy) {\n            item = this._getSymbolForTextProxy(item);\n        }\n        const itemConsumables = this._consumable.get(item);\n        if (itemConsumables === undefined) {\n            return null;\n        }\n        const value = itemConsumables.get(type);\n        if (value === undefined) {\n            return null;\n        }\n        return value;\n    }\n    /**\n     * Reverts consuming of a consumable value.\n     *\n     * ```ts\n     * modelConsumable.revert( modelElement, 'insert' ); // Revert consuming `modelElement` insertion change.\n     * modelConsumable.revert( modelElement, 'addAttribute:bold' ); // Revert consuming `bold` attribute insert from `modelElement`.\n     * modelConsumable.revert( modelElement, 'removeAttribute:bold' ); // Revert consuming `bold` attribute remove from `modelElement`.\n     * modelConsumable.revert( modelSelection, 'selection' ); // Revert consuming `modelSelection`.\n     * modelConsumable.revert( modelRange, 'range' ); // Revert consuming `modelRange`.\n     * ```\n     *\n     * @param item Model item, range or selection to be reverted.\n     * @param type Consumable type.\n     * @returns `true` if consumable has been reversed, `false` otherwise. `null` if the consumable has\n     * never been added.\n     */\n    revert(item, type) {\n        type = _normalizeConsumableType(type);\n        if (item instanceof ModelTextProxy) {\n            item = this._getSymbolForTextProxy(item);\n        }\n        const test = this.test(item, type);\n        if (test === false) {\n            this._consumable.get(item).set(type, true);\n            return true;\n        }\n        else if (test === true) {\n            return false;\n        }\n        return null;\n    }\n    /**\n     * Verifies if all events from the specified group were consumed.\n     *\n     * @param eventGroup The events group to verify.\n     */\n    verifyAllConsumed(eventGroup) {\n        const items = [];\n        for (const [item, consumables] of this._consumable) {\n            for (const [event, canConsume] of consumables) {\n                const eventPrefix = event.split(':')[0];\n                if (canConsume && eventGroup == eventPrefix) {\n                    items.push({\n                        event,\n                        item: item.name || item.description\n                    });\n                }\n            }\n        }\n        if (items.length) {\n            /**\n             * Some of the {@link module:engine/model/item~ModelItem model items} were not consumed while downcasting the model to view.\n             *\n             * This might be the effect of:\n             *\n             * * A missing converter for some model elements. Make sure that you registered downcast converters for all model elements.\n             * * A custom converter that does not consume converted items. Make sure that you\n             * {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed} all model elements that you converted\n             * from the model to the view.\n             * * A custom converter that called `event.stop()`. When providing a custom converter, keep in mind that you should not stop\n             * the event. If you stop it then the default converter at the `lowest` priority will not trigger the conversion of this node's\n             * attributes and child nodes.\n             *\n             * @error conversion-model-consumable-not-consumed\n             * @param {Array.<module:engine/model/item~ModelItem>} items Items that were not consumed.\n             */\n            throw new CKEditorError('conversion-model-consumable-not-consumed', null, { items });\n        }\n    }\n    /**\n     * Gets a unique symbol for the passed {@link module:engine/model/textproxy~ModelTextProxy} instance.\n     * All `ModelTextProxy` instances that have same parent, same start index and same end index will get the same symbol.\n     *\n     * Used internally to correctly consume `ModelTextProxy` instances.\n     *\n     * @internal\n     * @param textProxy `ModelTextProxy` instance to get a symbol for.\n     * @returns Symbol representing all equal instances of `ModelTextProxy`.\n     */\n    _getSymbolForTextProxy(textProxy) {\n        let symbol = null;\n        const startMap = this._textProxyRegistry.get(textProxy.startOffset);\n        if (startMap) {\n            const endMap = startMap.get(textProxy.endOffset);\n            if (endMap) {\n                symbol = endMap.get(textProxy.parent);\n            }\n        }\n        if (!symbol) {\n            symbol = this._addSymbolForTextProxy(textProxy);\n        }\n        return symbol;\n    }\n    /**\n     * Adds a symbol for the given {@link module:engine/model/textproxy~ModelTextProxy} instance.\n     *\n     * Used internally to correctly consume `ModelTextProxy` instances.\n     *\n     * @param textProxy Text proxy instance.\n     * @returns Symbol generated for given `ModelTextProxy`.\n     */\n    _addSymbolForTextProxy(textProxy) {\n        const start = textProxy.startOffset;\n        const end = textProxy.endOffset;\n        const parent = textProxy.parent;\n        const symbol = Symbol('$textProxy:' + textProxy.data);\n        let startMap;\n        let endMap;\n        startMap = this._textProxyRegistry.get(start);\n        if (!startMap) {\n            startMap = new Map();\n            this._textProxyRegistry.set(start, startMap);\n        }\n        endMap = startMap.get(end);\n        if (!endMap) {\n            endMap = new Map();\n            startMap.set(end, endMap);\n        }\n        endMap.set(parent, symbol);\n        return symbol;\n    }\n}\n/**\n * Returns a normalized consumable type name from the given string. A normalized consumable type name is a string that has\n * at most one colon, for example: `insert` or `addMarker:highlight`. If a string to normalize has more \"parts\" (more colons),\n * the further parts are dropped, for example: `addattribute:bold:$text` -> `addattributes:bold`.\n *\n * @param type Consumable type.\n * @returns Normalized consumable type.\n */\nfunction _normalizeConsumableType(type) {\n    const parts = type.split(':');\n    // For inserts allow passing event name, it's stored in the context of a specified element so the element name is not needed.\n    if (parts[0] == 'insert') {\n        return parts[0];\n    }\n    // Markers are identified by the whole name (otherwise we would consume the whole markers group).\n    if (parts[0] == 'addMarker' || parts[0] == 'removeMarker') {\n        return type;\n    }\n    return parts.length > 1 ? parts[0] + ':' + parts[1] : parts[0];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/downcastdispatcher\n */\nimport { ModelConsumable } from './modelconsumable.js';\nimport { ModelRange } from '../model/range.js';\nimport { EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * The downcast dispatcher is a central point of downcasting (conversion from the model to the view), which is a process of reacting\n * to changes in the model and firing a set of events. The callbacks listening to these events are called converters. The\n * converters' role is to convert the model changes to changes in view (for example, adding view nodes or\n * changing attributes on view elements).\n *\n * During the conversion process, downcast dispatcher fires events basing on the state of the model and prepares\n * data for these events. It is important to understand that the events are connected with the changes done on the model,\n * for example: \"a node has been inserted\" or \"an attribute has changed\". This is in contrary to upcasting (a view-to-model conversion)\n * where you convert the view state (view nodes) to a model tree.\n *\n * The events are prepared basing on a diff created by the {@link module:engine/model/differ~Differ Differ}, which buffers them\n * and then passes to the downcast dispatcher as a diff between the old model state and the new model state.\n *\n * Note that because the changes are converted, there is a need to have a mapping between the model structure and the view structure.\n * To map positions and elements during the downcast (a model-to-view conversion), use {@link module:engine/conversion/mapper~Mapper}.\n *\n * Downcast dispatcher fires the following events for model tree changes:\n *\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert `insert`} &ndash;\n * If a range of nodes was inserted to the model tree.\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove `remove`} &ndash;\n * If a range of nodes was removed from the model tree.\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute`} &ndash;\n * If an attribute was added, changed or removed from a model node.\n *\n * For {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert `insert`}\n * and {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute`},\n * the downcast dispatcher generates {@link module:engine/conversion/modelconsumable~ModelConsumable consumables}.\n * These are used to have control over which changes have already been consumed. It is useful when some converters\n * overwrite others or convert multiple changes (for example, it converts an insertion of an element and also converts that\n * element's attributes during the insertion).\n *\n * Additionally, downcast dispatcher fires events for {@link module:engine/model/markercollection~Marker marker} changes:\n *\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker `addMarker`} &ndash; If a marker was added.\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:removeMarker `removeMarker`} &ndash; If a marker was\n * removed.\n *\n * Note that changing a marker is done through removing the marker from the old range and adding it to the new range,\n * so both of these events are fired.\n *\n * Finally, a downcast dispatcher also handles firing events for the {@link module:engine/model/selection model selection}\n * conversion:\n *\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:selection `selection`}\n * &ndash; Converts the selection from the model to the view.\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute`}\n * &ndash; Fired for every selection attribute.\n * * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker `addMarker`}\n * &ndash; Fired for every marker that contains a selection.\n *\n * Unlike the model tree and the markers, the events for selection are not fired for changes but for a selection state.\n *\n * When providing custom listeners for a downcast dispatcher, remember to check whether a given change has not been\n * {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed} yet.\n *\n * When providing custom listeners for a downcast dispatcher, keep in mind that you **should not** stop the event. If you stop it,\n * then the default converter at the `lowest` priority will not trigger the conversion of this node's attributes and child nodes.\n *\n * When providing custom listeners for a downcast dispatcher, remember to use the provided\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter view downcast writer} to apply changes to the view document.\n *\n * You can read more about conversion in the following guide:\n *\n * * {@glink framework/deep-dive/conversion/downcast Downcast conversion}\n *\n * An example of a custom converter for the downcast dispatcher:\n *\n * ```ts\n * // You will convert inserting a \"paragraph\" model element into the model.\n * downcastDispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => {\n * \t// Remember to check whether the change has not been consumed yet and consume it.\n * \tif ( !conversionApi.consumable.consume( data.item, 'insert' ) ) {\n * \t\treturn;\n * \t}\n *\n * \t// Translate the position in the model to a position in the view.\n * \tconst viewPosition = conversionApi.mapper.toViewPosition( data.range.start );\n *\n * \t// Create a <p> element that will be inserted into the view at the `viewPosition`.\n * \tconst viewElement = conversionApi.writer.createContainerElement( 'p' );\n *\n * \t// Bind the newly created view element to the model element so positions will map accordingly in the future.\n * \tconversionApi.mapper.bindElements( data.item, viewElement );\n *\n * \t// Add the newly created view element to the view.\n * \tconversionApi.writer.insert( viewPosition, viewElement );\n * } );\n * ```\n */\nexport class DowncastDispatcher extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * A template for an interface passed by the dispatcher to the event callbacks.\n     *\n     * @internal\n     */\n    _conversionApi;\n    /**\n     * A map of already fired events for a given `ModelConsumable`.\n     */\n    _firedEventsMap;\n    /**\n     * Creates a downcast dispatcher instance.\n     *\n     * @see module:engine/conversion/downcastdispatcher~DowncastConversionApi\n     *\n     * @param conversionApi Additional properties for an interface that will be passed to events fired\n     * by the downcast dispatcher.\n     */\n    constructor(conversionApi) {\n        super();\n        this._conversionApi = { dispatcher: this, ...conversionApi };\n        this._firedEventsMap = new WeakMap();\n    }\n    /**\n     * Converts changes buffered in the given {@link module:engine/model/differ~Differ model differ}\n     * and fires conversion events based on it.\n     *\n     * @fires insert\n     * @fires remove\n     * @fires attribute\n     * @fires addMarker\n     * @fires removeMarker\n     * @fires reduceChanges\n     * @param differ The differ object with buffered changes.\n     * @param markers Markers related to the model fragment to convert.\n     * @param writer The view writer that should be used to modify the view document.\n     */\n    convertChanges(differ, markers, writer) {\n        const refreshedItems = differ.getRefreshedItems();\n        const conversionApi = this._createConversionApi(writer, refreshedItems);\n        // Before the view is updated, remove markers which have changed.\n        for (const change of differ.getMarkersToRemove()) {\n            this._convertMarkerRemove(change.name, change.range, conversionApi);\n        }\n        // Let features modify the change list (for example to allow reconversion).\n        const changes = this._reduceChanges(differ.getChanges(), refreshedItems);\n        // Convert changes that happened on model tree.\n        for (const entry of changes) {\n            if (entry.type === 'insert') {\n                this._convertInsert(ModelRange._createFromPositionAndShift(entry.position, entry.length), conversionApi);\n            }\n            else if (entry.type === 'reinsert') {\n                this._convertReinsert(ModelRange._createFromPositionAndShift(entry.position, entry.length), conversionApi);\n            }\n            else if (entry.type === 'remove') {\n                this._convertRemove(entry.position, entry.length, entry.name, conversionApi);\n            }\n            else {\n                // Defaults to 'attribute' change.\n                this._convertAttribute(entry.range, entry.attributeKey, entry.attributeOldValue, entry.attributeNewValue, conversionApi);\n            }\n        }\n        // Remove mappings for all removed view elements.\n        // Remove these mappings as soon as they are not needed (https://github.com/ckeditor/ckeditor5/issues/15411).\n        conversionApi.mapper.flushDeferredBindings();\n        for (const markerName of conversionApi.mapper.flushUnboundMarkerNames()) {\n            const markerRange = markers.get(markerName).getRange();\n            this._convertMarkerRemove(markerName, markerRange, conversionApi);\n            this._convertMarkerAdd(markerName, markerRange, conversionApi);\n        }\n        // After the view is updated, convert markers which have changed.\n        for (const change of differ.getMarkersToAdd()) {\n            this._convertMarkerAdd(change.name, change.range, conversionApi);\n        }\n        // Verify if all insert consumables were consumed.\n        conversionApi.consumable.verifyAllConsumed('insert');\n    }\n    /**\n     * Starts a conversion of a model range and the provided markers.\n     *\n     * @fires insert\n     * @fires attribute\n     * @fires addMarker\n     * @param range The inserted range.\n     * @param markers The map of markers that should be down-casted.\n     * @param writer The view writer that should be used to modify the view document.\n     * @param options Optional options object passed to `convertionApi.options`.\n     */\n    convert(range, markers, writer, options = {}) {\n        const conversionApi = this._createConversionApi(writer, undefined, options);\n        this._convertInsert(range, conversionApi);\n        for (const [name, range] of markers) {\n            this._convertMarkerAdd(name, range, conversionApi);\n        }\n        // Verify if all insert consumables were consumed.\n        conversionApi.consumable.verifyAllConsumed('insert');\n    }\n    /**\n     * Starts the model selection conversion.\n     *\n     * Fires events for a given {@link module:engine/model/selection~ModelSelection selection} to start the selection conversion.\n     *\n     * @fires selection\n     * @fires addMarker\n     * @fires attribute\n     * @param selection The selection to convert.\n     * @param markers Markers connected with the converted model.\n     * @param writer View writer that should be used to modify the view document.\n     */\n    convertSelection(selection, markers, writer) {\n        const conversionApi = this._createConversionApi(writer);\n        // First perform a clean-up at the current position of the selection.\n        this.fire('cleanSelection', { selection }, conversionApi);\n        // Don't convert selection if it is in a model root that does not have a view root (for now this is only the graveyard root).\n        const modelRoot = selection.getFirstPosition().root;\n        if (!conversionApi.mapper.toViewElement(modelRoot)) {\n            return;\n        }\n        // Now, perform actual selection conversion.\n        const markersAtSelection = Array.from(markers.getMarkersAtPosition(selection.getFirstPosition()));\n        this._addConsumablesForSelection(conversionApi.consumable, selection, markersAtSelection);\n        this.fire('selection', { selection }, conversionApi);\n        if (!selection.isCollapsed) {\n            return;\n        }\n        for (const marker of markersAtSelection) {\n            // Do not fire event if the marker has been consumed.\n            if (conversionApi.consumable.test(selection, 'addMarker:' + marker.name)) {\n                const markerRange = marker.getRange();\n                if (!shouldMarkerChangeBeConverted(selection.getFirstPosition(), marker, conversionApi.mapper)) {\n                    continue;\n                }\n                const data = {\n                    item: selection,\n                    markerName: marker.name,\n                    markerRange\n                };\n                this.fire(`addMarker:${marker.name}`, data, conversionApi);\n            }\n        }\n        for (const key of selection.getAttributeKeys()) {\n            // Do not fire event if the attribute has been consumed.\n            if (conversionApi.consumable.test(selection, 'attribute:' + key)) {\n                const data = {\n                    item: selection,\n                    range: selection.getFirstRange(),\n                    attributeKey: key,\n                    attributeOldValue: null,\n                    attributeNewValue: selection.getAttribute(key)\n                };\n                this.fire(`attribute:${key}:$text`, data, conversionApi);\n            }\n        }\n    }\n    /**\n     * Fires insertion conversion of a range of nodes.\n     *\n     * For each node in the range, {@link #event:insert `insert` event is fired}. For each attribute on each node,\n     * {@link #event:attribute `attribute` event is fired}.\n     *\n     * @fires insert\n     * @fires attribute\n     * @param range The inserted range.\n     * @param conversionApi The conversion API object.\n     * @param options.doNotAddConsumables Whether the ModelConsumable should not get populated\n     * for items in the provided range.\n     */\n    _convertInsert(range, conversionApi, options = {}) {\n        if (!options.doNotAddConsumables) {\n            // Collect a list of things that can be consumed, consisting of nodes and their attributes.\n            this._addConsumablesForInsert(conversionApi.consumable, range);\n        }\n        // Fire a separate insert event for each node and text fragment contained in the range.\n        for (const data of range.getWalker({ shallow: true })) {\n            this._testAndFire('insert', walkerValueToEventData(data), conversionApi);\n        }\n    }\n    /**\n     * Fires conversion of a single node removal. Fires {@link #event:remove remove event} with provided data.\n     *\n     * @param position Position from which node was removed.\n     * @param length Offset size of removed node.\n     * @param name Name of removed node.\n     * @param conversionApi The conversion API object.\n     */\n    _convertRemove(position, length, name, conversionApi) {\n        this.fire(`remove:${name}`, { position, length }, conversionApi);\n    }\n    /**\n     * Starts a conversion of an attribute change on a given `range`.\n     *\n     * For each node in the given `range`, {@link #event:attribute attribute event} is fired with the passed data.\n     *\n     * @fires attribute\n     * @param range Changed range.\n     * @param key Key of the attribute that has changed.\n     * @param oldValue Attribute value before the change or `null` if the attribute has not been set before.\n     * @param newValue New attribute value or `null` if the attribute has been removed.\n     * @param conversionApi The conversion API object.\n     */\n    _convertAttribute(range, key, oldValue, newValue, conversionApi) {\n        // Create a list with attributes to consume.\n        this._addConsumablesForRange(conversionApi.consumable, range, `attribute:${key}`);\n        // Create a separate attribute event for each node in the range.\n        for (const value of range) {\n            const data = {\n                item: value.item,\n                range: ModelRange._createFromPositionAndShift(value.previousPosition, value.length),\n                attributeKey: key,\n                attributeOldValue: oldValue,\n                attributeNewValue: newValue\n            };\n            this._testAndFire(`attribute:${key}`, data, conversionApi);\n        }\n    }\n    /**\n     * Fires re-insertion conversion (with a `reconversion` flag passed to `remove` and `insert` events)\n     * of a range of elements (only elements on the range depth, without children).\n     *\n     * For each node in the range on its depth (without children), {@link #event:insert `insert` event} is fired.\n     * For each attribute on each node, {@link #event:attribute `attribute` event} is fired.\n     *\n     * @fires insert\n     * @fires attribute\n     * @param range The range to reinsert.\n     * @param conversionApi The conversion API object.\n     */\n    _convertReinsert(range, conversionApi) {\n        // Convert the elements - without converting children.\n        const walkerValues = Array.from(range.getWalker({ shallow: true }));\n        // Collect a list of things that can be consumed, consisting of nodes and their attributes.\n        this._addConsumablesForInsert(conversionApi.consumable, walkerValues);\n        // Fire a separate insert event for each node and text fragment contained shallowly in the range.\n        for (const data of walkerValues.map(walkerValueToEventData)) {\n            // For backward compatibility and handlers that does not recognize reconversion.\n            this.fire(`remove:${data.item.is('element') ? data.item.name : '$text'}`, { position: data.range.start, length: data.item.offsetSize, reconversion: true }, conversionApi);\n            // Reinsert the view element.\n            this._testAndFire('insert', { ...data, reconversion: true }, conversionApi);\n        }\n    }\n    /**\n     * Converts the added marker. Fires the {@link #event:addMarker `addMarker`} event for each item\n     * in the marker's range. If the range is collapsed, a single event is dispatched. See the event description for more details.\n     *\n     * @fires addMarker\n     * @param markerName Marker name.\n     * @param markerRange The marker range.\n     * @param conversionApi The conversion API object.\n     */\n    _convertMarkerAdd(markerName, markerRange, conversionApi) {\n        // Do not convert if range is in graveyard.\n        if (markerRange.root.rootName == '$graveyard') {\n            return;\n        }\n        // In markers' case, event name == consumable name.\n        const eventName = `addMarker:${markerName}`;\n        //\n        // First, fire an event for the whole marker.\n        //\n        conversionApi.consumable.add(markerRange, eventName);\n        this.fire(eventName, { markerName, markerRange }, conversionApi);\n        //\n        // Do not fire events for each item inside the range if the range got consumed.\n        // Also consume the whole marker consumable if it wasn't consumed.\n        //\n        if (!conversionApi.consumable.consume(markerRange, eventName)) {\n            return;\n        }\n        //\n        // Then, fire an event for each item inside the marker range.\n        //\n        this._addConsumablesForRange(conversionApi.consumable, markerRange, eventName);\n        for (const item of markerRange.getItems()) {\n            // Do not fire event for already consumed items.\n            if (!conversionApi.consumable.test(item, eventName)) {\n                continue;\n            }\n            const data = { item, range: ModelRange._createOn(item), markerName, markerRange };\n            this.fire(eventName, data, conversionApi);\n        }\n    }\n    /**\n     * Fires the conversion of the marker removal. Fires the {@link #event:removeMarker `removeMarker`} event with the provided data.\n     *\n     * @fires removeMarker\n     * @param markerName Marker name.\n     * @param markerRange The marker range.\n     * @param conversionApi The conversion API object.\n     */\n    _convertMarkerRemove(markerName, markerRange, conversionApi) {\n        // Do not convert if range is in graveyard.\n        if (markerRange.root.rootName == '$graveyard') {\n            return;\n        }\n        this.fire(`removeMarker:${markerName}`, { markerName, markerRange }, conversionApi);\n    }\n    /**\n     * Fires the reduction of changes buffered in the {@link module:engine/model/differ~Differ `Differ`}.\n     *\n     * Features can replace selected {@link module:engine/model/differ~DifferItem `DifferItem`}s with `reinsert` entries to trigger\n     * reconversion. The {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure\n     * `DowncastHelpers.elementToStructure()`} is using this event to trigger reconversion.\n     *\n     * @fires reduceChanges\n     */\n    _reduceChanges(changes, refreshedItems) {\n        const data = {\n            changes,\n            refreshedItems\n        };\n        this.fire('reduceChanges', data);\n        return data.changes;\n    }\n    /**\n     * Populates provided {@link module:engine/conversion/modelconsumable~ModelConsumable} with values to consume from a given range,\n     * assuming that the range has just been inserted to the model.\n     *\n     * @param consumable The consumable.\n     * @param walkerValues The walker values for the inserted range.\n     * @returns The values to consume.\n     */\n    _addConsumablesForInsert(consumable, walkerValues) {\n        for (const value of walkerValues) {\n            const item = value.item;\n            // Add consumable if it wasn't there yet.\n            if (consumable.test(item, 'insert') === null) {\n                consumable.add(item, 'insert');\n                for (const key of item.getAttributeKeys()) {\n                    consumable.add(item, 'attribute:' + key);\n                }\n            }\n        }\n        return consumable;\n    }\n    /**\n     * Populates provided {@link module:engine/conversion/modelconsumable~ModelConsumable} with values to consume for a given range.\n     *\n     * @param consumable The consumable.\n     * @param range The affected range.\n     * @param type Consumable type.\n     * @returns The values to consume.\n     */\n    _addConsumablesForRange(consumable, range, type) {\n        for (const item of range.getItems()) {\n            consumable.add(item, type);\n        }\n        return consumable;\n    }\n    /**\n     * Populates provided {@link module:engine/conversion/modelconsumable~ModelConsumable} with selection consumable values.\n     *\n     * @param consumable The consumable.\n     * @param selection The selection to create the consumable from.\n     * @param markers Markers that contain the selection.\n     * @returns The values to consume.\n     */\n    _addConsumablesForSelection(consumable, selection, markers) {\n        consumable.add(selection, 'selection');\n        for (const marker of markers) {\n            consumable.add(selection, 'addMarker:' + marker.name);\n        }\n        for (const key of selection.getAttributeKeys()) {\n            consumable.add(selection, 'attribute:' + key);\n        }\n        return consumable;\n    }\n    /**\n     * Tests whether given event wasn't already fired and if so, fires it.\n     *\n     * @fires insert\n     * @fires attribute\n     * @param type Event type.\n     * @param data Event data.\n     * @param conversionApi The conversion API object.\n     */\n    _testAndFire(type, data, conversionApi) {\n        const eventName = getEventName(type, data);\n        const itemKey = data.item.is('$textProxy') ? conversionApi.consumable._getSymbolForTextProxy(data.item) : data.item;\n        const eventsFiredForConversion = this._firedEventsMap.get(conversionApi);\n        const eventsFiredForItem = eventsFiredForConversion.get(itemKey);\n        if (!eventsFiredForItem) {\n            eventsFiredForConversion.set(itemKey, new Set([eventName]));\n        }\n        else if (!eventsFiredForItem.has(eventName)) {\n            eventsFiredForItem.add(eventName);\n        }\n        else {\n            return;\n        }\n        this.fire(eventName, data, conversionApi);\n    }\n    /**\n     * Fires not already fired events for setting attributes on just inserted item.\n     *\n     * @param item The model item to convert attributes for.\n     * @param conversionApi The conversion API object.\n     */\n    _testAndFireAddAttributes(item, conversionApi) {\n        const data = {\n            item,\n            range: ModelRange._createOn(item)\n        };\n        for (const key of data.item.getAttributeKeys()) {\n            data.attributeKey = key;\n            data.attributeOldValue = null;\n            data.attributeNewValue = data.item.getAttribute(key);\n            this._testAndFire(`attribute:${key}`, data, conversionApi);\n        }\n    }\n    /**\n     * Builds an instance of the {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi} from a template and a given\n     * {@link module:engine/view/downcastwriter~ViewDowncastWriter `ViewDowncastWriter`} and options object.\n     *\n     * @param writer View writer that should be used to modify the view document.\n     * @param refreshedItems A set of model elements that should not reuse their\n     * previous view representations.\n     * @param options Optional options passed to `convertionApi.options`.\n     * @return The conversion API object.\n     */\n    _createConversionApi(writer, refreshedItems = new Set(), options = {}) {\n        const conversionApi = {\n            ...this._conversionApi,\n            consumable: new ModelConsumable(),\n            writer,\n            options,\n            convertItem: item => this._convertInsert(ModelRange._createOn(item), conversionApi),\n            convertChildren: element => this._convertInsert(ModelRange._createIn(element), conversionApi, { doNotAddConsumables: true }),\n            convertAttributes: item => this._testAndFireAddAttributes(item, conversionApi),\n            canReuseView: viewElement => !refreshedItems.has(conversionApi.mapper.toModelElement(viewElement))\n        };\n        this._firedEventsMap.set(conversionApi, new Map());\n        return conversionApi;\n    }\n}\n/**\n * Helper function, checks whether change of `marker` at `modelPosition` should be converted. Marker changes are not\n * converted if they happen inside an element with custom conversion method.\n */\nfunction shouldMarkerChangeBeConverted(modelPosition, marker, mapper) {\n    const range = marker.getRange();\n    const ancestors = Array.from(modelPosition.getAncestors());\n    ancestors.shift(); // Remove root element. It cannot be passed to `model.Range#containsItem`.\n    ancestors.reverse();\n    const hasCustomHandling = ancestors.some(element => {\n        if (range.containsItem(element)) {\n            const viewElement = mapper.toViewElement(element);\n            return !!viewElement.getCustomProperty('addHighlight');\n        }\n    });\n    return !hasCustomHandling;\n}\nfunction getEventName(type, data) {\n    const name = data.item.is('element') ? data.item.name : '$text';\n    return `${type}:${name}`;\n}\nfunction walkerValueToEventData(value) {\n    return {\n        item: value.item,\n        range: ModelRange._createFromPositionAndShift(value.previousPosition, value.length)\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n * @module engine/model/node\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { compareArrays, toMap } from '@ckeditor/ckeditor5-utils';\n/**\n * Model node. Most basic structure of model tree.\n *\n * This is an abstract class that is a base for other classes representing different nodes in model.\n *\n * **Note:** If a node is detached from the model tree, you can manipulate it using it's API.\n * However, it is **very important** that nodes already attached to model tree should be only changed through\n * {@link module:engine/model/writer~ModelWriter Writer API}.\n *\n * Changes done by `Node` methods, like {@link module:engine/model/element~ModelElement#_insertChild _insertChild} or\n * {@link module:engine/model/node~ModelNode#_setAttribute _setAttribute}\n * do not generate {@link module:engine/model/operation/operation~Operation operations}\n * which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~ModelDocument document} root.\n *\n * The flow of working on `Node` (and classes that inherits from it) is as such:\n * 1. You can create a `Node` instance, modify it using it's API.\n * 2. Add `Node` to the model using `Batch` API.\n * 3. Change `Node` that was already added to the model using `Batch` API.\n *\n * Similarly, you cannot use `Batch` API on a node that has not been added to the model tree, with the exception\n * of {@link module:engine/model/writer~ModelWriter#insert inserting} that node to the model tree.\n *\n * Be aware that using {@link module:engine/model/writer~ModelWriter#remove remove from Batch API} does not allow to use `Node` API because\n * the information about `Node` is still kept in model document.\n *\n * In case of {@link module:engine/model/element~ModelElement element node}, adding and removing children also counts as changing a node and\n * follows same rules.\n */\nexport class ModelNode extends ModelTypeCheckable {\n    /**\n     * Parent of this node. It could be {@link module:engine/model/element~ModelElement}\n     * or {@link module:engine/model/documentfragment~ModelDocumentFragment}.\n     * Equals to `null` if the node has no parent.\n     */\n    parent = null;\n    /**\n     * Attributes set on this node.\n     */\n    _attrs;\n    /**\n     * Index of this node in its parent or `null` if the node has no parent.\n     *\n     * @internal\n     */\n    _index = null;\n    /**\n     * Offset at which this node starts in its parent or `null` if the node has no parent.\n     *\n     * @internal\n     */\n    _startOffset = null;\n    /**\n     * Creates a model node.\n     *\n     * This is an abstract class, so this constructor should not be used directly.\n     *\n     * @param attrs Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.\n     */\n    constructor(attrs) {\n        super();\n        this._attrs = toMap(attrs);\n    }\n    /**\n     * {@link module:engine/model/document~ModelDocument Document} that owns this root element.\n     */\n    get document() {\n        return null;\n    }\n    /**\n     * Index of this node in its parent or `null` if the node has no parent.\n     */\n    get index() {\n        return this._index;\n    }\n    /**\n     * Offset at which this node starts in its parent. It is equal to the sum of {@link #offsetSize offsetSize}\n     * of all its previous siblings. Equals to `null` if node has no parent.\n     */\n    get startOffset() {\n        return this._startOffset;\n    }\n    /**\n     * Offset size of this node.\n     *\n     * Represents how much \"offset space\" is occupied by the node in its parent. It is important for\n     * {@link module:engine/model/position~ModelPosition position}. When node has `offsetSize` greater\n     * than `1`, position can be placed between that node start and end. `offsetSize` greater than `1` is for\n     * nodes that represents more than one entity, i.e. a {@link module:engine/model/text~ModelText text node}.\n     */\n    get offsetSize() {\n        return 1;\n    }\n    /**\n     * Offset at which this node ends in its parent. It is equal to the sum of this node's\n     * {@link module:engine/model/node~ModelNode#startOffset start offset} and {@link #offsetSize offset size}.\n     * Equals to `null` if the node has no parent.\n     */\n    get endOffset() {\n        if (this.startOffset === null) {\n            return null;\n        }\n        return this.startOffset + this.offsetSize;\n    }\n    /**\n     * Node's next sibling or `null` if the node is a last child of it's parent or if the node has no parent.\n     */\n    get nextSibling() {\n        const index = this.index;\n        return (index !== null && this.parent.getChild(index + 1)) || null;\n    }\n    /**\n     * Node's previous sibling or `null` if the node is a first child of it's parent or if the node has no parent.\n     */\n    get previousSibling() {\n        const index = this.index;\n        return (index !== null && this.parent.getChild(index - 1)) || null;\n    }\n    /**\n     * The top-most ancestor of the node. If node has no parent it is the root itself. If the node is a part\n     * of {@link module:engine/model/documentfragment~ModelDocumentFragment}, it's `root` is equal to that `DocumentFragment`.\n     */\n    get root() {\n        // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n        let root = this;\n        while (root.parent) {\n            root = root.parent;\n        }\n        return root;\n    }\n    /**\n     * Returns `true` if the node is inside a document root that is attached to the document.\n     */\n    isAttached() {\n        // If the node has no parent it means that it is a root.\n        // But this is not a `RootElement`, so it means that it is not attached.\n        //\n        // If this is not the root, check if this element's root is attached.\n        return this.parent === null ? false : this.root.isAttached();\n    }\n    /**\n     * Gets path to the node. The path is an array containing starting offsets of consecutive ancestors of this node,\n     * beginning from {@link module:engine/model/node~ModelNode#root root}, down to this node's starting offset. The path can be used to\n     * create {@link module:engine/model/position~ModelPosition Position} instance.\n     *\n     * ```ts\n     * const abc = new Text( 'abc' );\n     * const foo = new Text( 'foo' );\n     * const h1 = new ModelElement( 'h1', null, new Text( 'header' ) );\n     * const p = new ModelElement( 'p', null, [ abc, foo ] );\n     * const div = new ModelElement( 'div', null, [ h1, p ] );\n     * foo.getPath(); // Returns [ 1, 3 ]. `foo` is in `p` which is in `div`. `p` starts at offset 1, while `foo` at 3.\n     * h1.getPath(); // Returns [ 0 ].\n     * div.getPath(); // Returns [].\n     * ```\n     */\n    getPath() {\n        const path = [];\n        // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n        let node = this;\n        while (node.parent) {\n            path.unshift(node.startOffset);\n            node = node.parent;\n        }\n        return path;\n    }\n    /**\n     * Returns ancestors array of this node.\n     *\n     * @param options Options object.\n     * @param options.includeSelf When set to `true` this node will be also included in parent's array.\n     * @param options.parentFirst When set to `true`, array will be sorted from node's parent to root element,\n     * otherwise root element will be the first item in the array.\n     * @returns Array with ancestors.\n     */\n    getAncestors(options = {}) {\n        const ancestors = [];\n        let parent = options.includeSelf ? this : this.parent;\n        while (parent) {\n            ancestors[options.parentFirst ? 'push' : 'unshift'](parent);\n            parent = parent.parent;\n        }\n        return ancestors;\n    }\n    /**\n     * Returns a {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}\n     * which is a common ancestor of both nodes.\n     *\n     * @param node The second node.\n     * @param options Options object.\n     * @param options.includeSelf When set to `true` both nodes will be considered \"ancestors\" too.\n     * Which means that if e.g. node A is inside B, then their common ancestor will be B.\n     */\n    getCommonAncestor(node, options = {}) {\n        const ancestorsA = this.getAncestors(options);\n        const ancestorsB = node.getAncestors(options);\n        let i = 0;\n        while (ancestorsA[i] == ancestorsB[i] && ancestorsA[i]) {\n            i++;\n        }\n        return i === 0 ? null : ancestorsA[i - 1];\n    }\n    /**\n     * Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,\n     * in different {@link module:engine/model/documentfragment~ModelDocumentFragment}s).\n     *\n     * @param node Node to compare with.\n     */\n    isBefore(node) {\n        // Given node is not before this node if they are same.\n        if (this == node) {\n            return false;\n        }\n        // Return `false` if it is impossible to compare nodes.\n        if (this.root !== node.root) {\n            return false;\n        }\n        const thisPath = this.getPath();\n        const nodePath = node.getPath();\n        const result = compareArrays(thisPath, nodePath);\n        switch (result) {\n            case 'prefix':\n                return true;\n            case 'extension':\n                return false;\n            default:\n                return thisPath[result] < nodePath[result];\n        }\n    }\n    /**\n     * Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,\n     * in different {@link module:engine/model/documentfragment~ModelDocumentFragment}s).\n     *\n     * @param node Node to compare with.\n     */\n    isAfter(node) {\n        // Given node is not before this node if they are same.\n        if (this == node) {\n            return false;\n        }\n        // Return `false` if it is impossible to compare nodes.\n        if (this.root !== node.root) {\n            return false;\n        }\n        // In other cases, just check if the `node` is before, and return the opposite.\n        return !this.isBefore(node);\n    }\n    /**\n     * Checks if the node has an attribute with given key.\n     *\n     * @param key Key of attribute to check.\n     * @returns `true` if attribute with given key is set on node, `false` otherwise.\n     */\n    hasAttribute(key) {\n        return this._attrs.has(key);\n    }\n    /**\n     * Gets an attribute value for given key or `undefined` if that attribute is not set on node.\n     *\n     * @param key Key of attribute to look for.\n     * @returns Attribute value or `undefined`.\n     */\n    getAttribute(key) {\n        return this._attrs.get(key);\n    }\n    /**\n     * Returns iterator that iterates over this node's attributes.\n     *\n     * Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.\n     * This format is accepted by native `Map` object and also can be passed in `Node` constructor.\n     */\n    getAttributes() {\n        return this._attrs.entries();\n    }\n    /**\n     * Returns iterator that iterates over this node's attribute keys.\n     */\n    getAttributeKeys() {\n        return this._attrs.keys();\n    }\n    /**\n     * Converts `Node` to plain object and returns it.\n     *\n     * @returns `Node` converted to plain object.\n     */\n    toJSON() {\n        const json = {};\n        // Serializes attributes to the object.\n        // attributes = { a: 'foo', b: 1, c: true }.\n        if (this._attrs.size) {\n            json.attributes = Array.from(this._attrs).reduce((result, attr) => {\n                result[attr[0]] = attr[1];\n                return result;\n            }, {});\n        }\n        return json;\n    }\n    /**\n     * Creates a copy of this node, that is a node with exactly same attributes, and returns it.\n     *\n     * @internal\n     * @returns Node with same attributes as this node.\n     */\n    _clone(_deep) {\n        return new this.constructor(this._attrs);\n    }\n    /**\n     * Removes this node from its parent.\n     *\n     * @internal\n     * @see module:engine/model/writer~ModelWriter#remove\n     */\n    _remove() {\n        this.parent._removeChildren(this.index);\n    }\n    /**\n     * Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.\n     *\n     * @see module:engine/model/writer~ModelWriter#setAttribute\n     * @internal\n     * @param key Key of attribute to set.\n     * @param value Attribute value.\n     */\n    _setAttribute(key, value) {\n        this._attrs.set(key, value);\n    }\n    /**\n     * Removes all attributes from the node and sets given attributes.\n     *\n     * @see module:engine/model/writer~ModelWriter#setAttributes\n     * @internal\n     * @param attrs Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.\n     */\n    _setAttributesTo(attrs) {\n        this._attrs = toMap(attrs);\n    }\n    /**\n     * Removes an attribute with given key from the node.\n     *\n     * @see module:engine/model/writer~ModelWriter#removeAttribute\n     * @internal\n     * @param key Key of attribute to remove.\n     * @returns `true` if the attribute was set on the element, `false` otherwise.\n     */\n    _removeAttribute(key) {\n        return this._attrs.delete(key);\n    }\n    /**\n     * Removes all attributes from the node.\n     *\n     * @see module:engine/model/writer~ModelWriter#clearAttributes\n     * @internal\n     */\n    _clearAttributes() {\n        this._attrs.clear();\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelNode.prototype.is = function (type) {\n    return type === 'node' || type === 'model:node';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/selection\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { ModelNode } from './node.js';\nimport { ModelPosition } from './position.js';\nimport { ModelRange } from './range.js';\nimport { CKEditorError, EmitterMixin, isIterable } from '@ckeditor/ckeditor5-utils';\n/**\n * Selection is a set of {@link module:engine/model/range~ModelRange ranges}. It has a direction specified by its\n * {@link module:engine/model/selection~ModelSelection#anchor anchor} and {@link module:engine/model/selection~ModelSelection#focus focus}\n * (it can be {@link module:engine/model/selection~ModelSelection#isBackward forward or backward}).\n * Additionally, selection may have its own attributes (think – whether text typed in in this selection\n * should have those attributes – e.g. whether you type a bolded text).\n */\nexport class ModelSelection extends /* #__PURE__ */ EmitterMixin(ModelTypeCheckable) {\n    /**\n     * Specifies whether the last added range was added as a backward or forward range.\n     */\n    _lastRangeBackward = false;\n    /**\n     * List of attributes set on current selection.\n     */\n    _attrs = new Map();\n    /** @internal */\n    _ranges = [];\n    /**\n     * Creates a new selection instance based on the given {@link module:engine/model/selection~ModelSelectable selectable}\n     * or creates an empty selection if no arguments were passed.\n     *\n     * ```ts\n     * // Creates empty selection without ranges.\n     * const selection = writer.createSelection();\n     *\n     * // Creates selection at the given range.\n     * const range = writer.createRange( start, end );\n     * const selection = writer.createSelection( range );\n     *\n     * // Creates selection at the given ranges\n     * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n     * const selection = writer.createSelection( ranges );\n     *\n     * // Creates selection from the other selection.\n     * // Note: It doesn't copy selection attributes.\n     * const otherSelection = writer.createSelection();\n     * const selection = writer.createSelection( otherSelection );\n     *\n     * // Creates selection from the given document selection.\n     * // Note: It doesn't copy selection attributes.\n     * const documentSelection = model.document.selection;\n     * const selection = writer.createSelection( documentSelection );\n     *\n     * // Creates selection at the given position.\n     * const position = writer.createPositionFromPath( root, path );\n     * const selection = writer.createSelection( position );\n     *\n     * // Creates selection at the given offset in the given element.\n     * const paragraph = writer.createElement( 'paragraph' );\n     * const selection = writer.createSelection( paragraph, offset );\n     *\n     * // Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the\n     * // first child of that element and ends after the last child of that element.\n     * const selection = writer.createSelection( paragraph, 'in' );\n     *\n     * // Creates a range on an {@link module:engine/model/item~ModelItem item} which starts before the item and ends\n     * // just after the item.\n     * const selection = writer.createSelection( paragraph, 'on' );\n     * ```\n     *\n     * Selection's constructor allow passing additional options (`'backward'`) as the last argument.\n     *\n     * ```ts\n     * // Creates backward selection.\n     * const selection = writer.createSelection( range, { backward: true } );\n     * ```\n     *\n     * @internal\n     */\n    constructor(...args) {\n        super();\n        if (args.length) {\n            this.setTo(...args);\n        }\n    }\n    /**\n     * Selection anchor. Anchor is the position from which the selection was started. If a user is making a selection\n     * by dragging the mouse, the anchor is where the user pressed the mouse button (the beginning of the selection).\n     *\n     * Anchor and {@link #focus} define the direction of the selection, which is important\n     * when expanding/shrinking selection. The focus moves, while the anchor should remain in the same place.\n     *\n     * Anchor is always set to the {@link module:engine/model/range~ModelRange#start start} or\n     * {@link module:engine/model/range~ModelRange#end end} position of the last of selection's ranges. Whether it is\n     * the `start` or `end` depends on the specified `options.backward`. See the {@link #setTo `setTo()`} method.\n     *\n     * May be set to `null` if there are no ranges in the selection.\n     *\n     * @see #focus\n     */\n    get anchor() {\n        if (this._ranges.length > 0) {\n            const range = this._ranges[this._ranges.length - 1];\n            return this._lastRangeBackward ? range.end : range.start;\n        }\n        return null;\n    }\n    /**\n     * Selection focus. Focus is the position where the selection ends. If a user is making a selection\n     * by dragging the mouse, the focus is where the mouse cursor is.\n     *\n     * May be set to `null` if there are no ranges in the selection.\n     *\n     * @see #anchor\n     */\n    get focus() {\n        if (this._ranges.length > 0) {\n            const range = this._ranges[this._ranges.length - 1];\n            return this._lastRangeBackward ? range.start : range.end;\n        }\n        return null;\n    }\n    /**\n     * Whether the selection is collapsed. Selection is collapsed when there is exactly one range in it\n     * and it is collapsed.\n     */\n    get isCollapsed() {\n        const length = this._ranges.length;\n        if (length === 1) {\n            return this._ranges[0].isCollapsed;\n        }\n        else {\n            return false;\n        }\n    }\n    /**\n     * Returns the number of ranges in the selection.\n     */\n    get rangeCount() {\n        return this._ranges.length;\n    }\n    /**\n     * Specifies whether the selection's {@link #focus} precedes the selection's {@link #anchor}.\n     */\n    get isBackward() {\n        return !this.isCollapsed && this._lastRangeBackward;\n    }\n    /**\n     * Checks whether this selection is equal to the given selection. Selections are equal if they have the same directions,\n     * the same number of ranges and all ranges from one selection equal to ranges from the another selection.\n     *\n     * @param otherSelection Selection to compare with.\n     * @returns `true` if selections are equal, `false` otherwise.\n     */\n    isEqual(otherSelection) {\n        if (this.rangeCount != otherSelection.rangeCount) {\n            return false;\n        }\n        else if (this.rangeCount === 0) {\n            return true;\n        }\n        if (!this.anchor.isEqual(otherSelection.anchor) || !this.focus.isEqual(otherSelection.focus)) {\n            return false;\n        }\n        for (const thisRange of this._ranges) {\n            let found = false;\n            for (const otherRange of otherSelection._ranges) {\n                if (thisRange.isEqual(otherRange)) {\n                    found = true;\n                    break;\n                }\n            }\n            if (!found) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Returns an iterable object that iterates over copies of selection ranges.\n     */\n    *getRanges() {\n        for (const range of this._ranges) {\n            yield new ModelRange(range.start, range.end);\n        }\n    }\n    /**\n     * Returns a copy of the first range in the selection.\n     * First range is the one which {@link module:engine/model/range~ModelRange#start start} position\n     * {@link module:engine/model/position~ModelPosition#isBefore is before} start position of all other ranges\n     * (not to confuse with the first range added to the selection).\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getFirstRange() {\n        let first = null;\n        for (const range of this._ranges) {\n            if (!first || range.start.isBefore(first.start)) {\n                first = range;\n            }\n        }\n        return first ? new ModelRange(first.start, first.end) : null;\n    }\n    /**\n     * Returns a copy of the last range in the selection.\n     * Last range is the one which {@link module:engine/model/range~ModelRange#end end} position\n     * {@link module:engine/model/position~ModelPosition#isAfter is after} end position of all other\n     * ranges (not to confuse with the range most recently added to the selection).\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getLastRange() {\n        let last = null;\n        for (const range of this._ranges) {\n            if (!last || range.end.isAfter(last.end)) {\n                last = range;\n            }\n        }\n        return last ? new ModelRange(last.start, last.end) : null;\n    }\n    /**\n     * Returns the first position in the selection.\n     * First position is the position that {@link module:engine/model/position~ModelPosition#isBefore is before}\n     * any other position in the selection.\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getFirstPosition() {\n        const first = this.getFirstRange();\n        return first ? first.start.clone() : null;\n    }\n    /**\n     * Returns the last position in the selection.\n     * Last position is the position that {@link module:engine/model/position~ModelPosition#isAfter is after}\n     * any other position in the selection.\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getLastPosition() {\n        const lastRange = this.getLastRange();\n        return lastRange ? lastRange.end.clone() : null;\n    }\n    /**\n     * Sets this selection's ranges and direction to the specified location based on the given\n     * {@link module:engine/model/selection~ModelSelectable selectable}.\n     *\n     * ```ts\n     * // Removes all selection's ranges.\n     * selection.setTo( null );\n     *\n     * // Sets selection to the given range.\n     * const range = writer.createRange( start, end );\n     * selection.setTo( range );\n     *\n     * // Sets selection to given ranges.\n     * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n     * selection.setTo( ranges );\n     *\n     * // Sets selection to other selection.\n     * // Note: It doesn't copy selection attributes.\n     * const otherSelection = writer.createSelection();\n     * selection.setTo( otherSelection );\n     *\n     * // Sets selection to the given document selection.\n     * // Note: It doesn't copy selection attributes.\n     * const documentSelection = new ModelDocumentSelection( doc );\n     * selection.setTo( documentSelection );\n     *\n     * // Sets collapsed selection at the given position.\n     * const position = writer.createPositionFromPath( root, path );\n     * selection.setTo( position );\n     *\n     * // Sets collapsed selection at the position of the given node and an offset.\n     * selection.setTo( paragraph, offset );\n     * ```\n     *\n     * Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * ```ts\n     * selection.setTo( paragraph, 'in' );\n     * ```\n     *\n     * Creates a range on an {@link module:engine/model/item~ModelItem item} which starts before the item and ends just after the item.\n     *\n     * ```ts\n     * selection.setTo( paragraph, 'on' );\n     * ```\n     *\n     * `Selection#setTo()`' method allow passing additional options (`backward`) as the last argument.\n     *\n     * ```ts\n     * // Sets backward selection.\n     * const selection = writer.createSelection( range, { backward: true } );\n     * ```\n     */\n    setTo(...args) {\n        let [selectable, placeOrOffset, options] = args;\n        if (typeof placeOrOffset == 'object') {\n            options = placeOrOffset;\n            placeOrOffset = undefined;\n        }\n        if (selectable === null) {\n            this._setRanges([]);\n        }\n        else if (selectable instanceof ModelSelection) {\n            this._setRanges(selectable.getRanges(), selectable.isBackward);\n        }\n        else if (selectable && typeof selectable.getRanges == 'function') {\n            // We assume that the selectable is a ModelDocumentSelection.\n            // It can't be imported here, because it would lead to circular imports.\n            this._setRanges(selectable.getRanges(), selectable.isBackward);\n        }\n        else if (selectable instanceof ModelRange) {\n            this._setRanges([selectable], !!options && !!options.backward);\n        }\n        else if (selectable instanceof ModelPosition) {\n            this._setRanges([new ModelRange(selectable)]);\n        }\n        else if (selectable instanceof ModelNode) {\n            const backward = !!options && !!options.backward;\n            let range;\n            if (placeOrOffset == 'in') {\n                range = ModelRange._createIn(selectable);\n            }\n            else if (placeOrOffset == 'on') {\n                range = ModelRange._createOn(selectable);\n            }\n            else if (placeOrOffset !== undefined) {\n                range = new ModelRange(ModelPosition._createAt(selectable, placeOrOffset));\n            }\n            else {\n                /**\n                 * selection.setTo requires the second parameter when the first parameter is a node.\n                 *\n                 * @error model-selection-setto-required-second-parameter\n                 */\n                throw new CKEditorError('model-selection-setto-required-second-parameter', [this, selectable]);\n            }\n            this._setRanges([range], backward);\n        }\n        else if (isIterable(selectable)) {\n            // We assume that the selectable is an iterable of ranges.\n            this._setRanges(selectable, options && !!options.backward);\n        }\n        else {\n            /**\n             * Cannot set the selection to the given place.\n             *\n             * Invalid parameters were specified when setting the selection. Common issues:\n             *\n             * * A {@link module:engine/model/textproxy~ModelTextProxy} instance was passed instead of\n             * a real {@link module:engine/model/text~ModelText}.\n             * * View nodes were passed instead of model nodes.\n             * * `null`/`undefined` was passed.\n             *\n             * @error model-selection-setto-not-selectable\n             */\n            throw new CKEditorError('model-selection-setto-not-selectable', [this, selectable]);\n        }\n    }\n    /**\n     * Replaces all ranges that were added to the selection with given array of ranges. Last range of the array\n     * is treated like the last added range and is used to set {@link module:engine/model/selection~ModelSelection#anchor} and\n     * {@link module:engine/model/selection~ModelSelection#focus}. Accepts a flag describing in which direction the selection is made.\n     *\n     * @fires change:range\n     * @param newRanges Ranges to set.\n     * @param isLastBackward Flag describing if last added range was selected forward - from start to end (`false`)\n     * or backward - from end to start (`true`).\n     */\n    _setRanges(newRanges, isLastBackward = false) {\n        const ranges = Array.from(newRanges);\n        // Check whether there is any range in new ranges set that is different than all already added ranges.\n        const anyNewRange = ranges.some(newRange => {\n            if (!(newRange instanceof ModelRange)) {\n                /**\n                 * Selection range set to an object that is not an instance of {@link module:engine/model/range~ModelRange}.\n                 *\n                 * Only {@link module:engine/model/range~ModelRange} instances can be used to set a selection.\n                 * Common mistakes leading to this error are:\n                 *\n                 * * using DOM `Range` object,\n                 * * incorrect CKEditor 5 installation with multiple `ckeditor5-engine` packages having different versions.\n                 *\n                 * @error model-selection-set-ranges-not-range\n                 */\n                throw new CKEditorError('model-selection-set-ranges-not-range', [this, newRanges]);\n            }\n            return this._ranges.every(oldRange => {\n                return !oldRange.isEqual(newRange);\n            });\n        });\n        // Don't do anything if nothing changed.\n        if (ranges.length === this._ranges.length && !anyNewRange) {\n            return;\n        }\n        this._replaceAllRanges(ranges);\n        this._lastRangeBackward = !!isLastBackward;\n        this.fire('change:range', { directChange: true });\n    }\n    /**\n     * Moves {@link module:engine/model/selection~ModelSelection#focus} to the specified location.\n     *\n     * The location can be specified in the same form as\n     * {@link module:engine/model/writer~ModelWriter#createPositionAt writer.createPositionAt()} parameters.\n     *\n     * @fires change:range\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    setFocus(itemOrPosition, offset) {\n        if (this.anchor === null) {\n            /**\n             * Cannot set selection focus if there are no ranges in selection.\n             *\n             * @error model-selection-setfocus-no-ranges\n             */\n            throw new CKEditorError('model-selection-setfocus-no-ranges', [this, itemOrPosition]);\n        }\n        const newFocus = ModelPosition._createAt(itemOrPosition, offset);\n        if (newFocus.compareWith(this.focus) == 'same') {\n            return;\n        }\n        const anchor = this.anchor;\n        if (this._ranges.length) {\n            this._popRange();\n        }\n        if (newFocus.compareWith(anchor) == 'before') {\n            this._pushRange(new ModelRange(newFocus, anchor));\n            this._lastRangeBackward = true;\n        }\n        else {\n            this._pushRange(new ModelRange(anchor, newFocus));\n            this._lastRangeBackward = false;\n        }\n        this.fire('change:range', { directChange: true });\n    }\n    /**\n     * Gets an attribute value for given key or `undefined` if that attribute is not set on the selection.\n     *\n     * @param key Key of attribute to look for.\n     * @returns Attribute value or `undefined`.\n     */\n    getAttribute(key) {\n        return this._attrs.get(key);\n    }\n    /**\n     * Returns iterable that iterates over this selection's attributes.\n     *\n     * Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.\n     * This format is accepted by native `Map` object and also can be passed in `Node` constructor.\n     */\n    getAttributes() {\n        return this._attrs.entries();\n    }\n    /**\n     * Returns iterable that iterates over this selection's attribute keys.\n     */\n    getAttributeKeys() {\n        return this._attrs.keys();\n    }\n    /**\n     * Checks if the selection has an attribute for given key.\n     *\n     * @param key Key of attribute to check.\n     * @returns `true` if attribute with given key is set on selection, `false` otherwise.\n     */\n    hasAttribute(key) {\n        return this._attrs.has(key);\n    }\n    /**\n     * Removes an attribute with given key from the selection.\n     *\n     * If given attribute was set on the selection, fires the {@link #event:change:range} event with\n     * removed attribute key.\n     *\n     * @fires change:attribute\n     * @param key Key of attribute to remove.\n     */\n    removeAttribute(key) {\n        if (this.hasAttribute(key)) {\n            this._attrs.delete(key);\n            this.fire('change:attribute', { attributeKeys: [key], directChange: true });\n        }\n    }\n    /**\n     * Sets attribute on the selection. If attribute with the same key already is set, it's value is overwritten.\n     *\n     * If the attribute value has changed, fires the {@link #event:change:range} event with\n     * the attribute key.\n     *\n     * @fires change:attribute\n     * @param key Key of attribute to set.\n     * @param value Attribute value.\n     */\n    setAttribute(key, value) {\n        if (this.getAttribute(key) !== value) {\n            this._attrs.set(key, value);\n            this.fire('change:attribute', { attributeKeys: [key], directChange: true });\n        }\n    }\n    /**\n     * Returns the selected element. {@link module:engine/model/element~ModelElement Element} is considered as selected if there is only\n     * one range in the selection, and that range contains exactly one element.\n     * Returns `null` if there is no selected element.\n     */\n    getSelectedElement() {\n        if (this.rangeCount !== 1) {\n            return null;\n        }\n        return this.getFirstRange().getContainedElement();\n    }\n    /**\n     * Gets elements of type {@link module:engine/model/schema~ModelSchema#isBlock \"block\"} touched by the selection.\n     *\n     * This method's result can be used for example to apply block styling to all blocks covered by this selection.\n     *\n     * **Note:** `getSelectedBlocks()` returns blocks that are nested in other non-block elements\n     * but will not return blocks nested in other blocks.\n     *\n     * In this case the function will return exactly all 3 paragraphs (note: `<blockQuote>` is not a block itself):\n     *\n     * ```xml\n     * <paragraph>[a</paragraph>\n     * <blockQuote>\n     * \t<paragraph>b</paragraph>\n     * </blockQuote>\n     * <paragraph>c]d</paragraph>\n     * ```\n     *\n     * In this case the paragraph will also be returned, despite the collapsed selection:\n     *\n     * ```xml\n     * <paragraph>[]a</paragraph>\n     * ```\n     *\n     * In such a scenario, however, only blocks A, B & E will be returned as blocks C & D are nested in block B:\n     *\n     * ```xml\n     * [<blockA></blockA>\n     * <blockB>\n     * \t<blockC></blockC>\n     * \t<blockD></blockD>\n     * </blockB>\n     * <blockE></blockE>]\n     * ```\n     *\n     * If the selection is inside a block all the inner blocks (A & B) are returned:\n     *\n     * ```xml\n     * <block>\n     * \t<blockA>[a</blockA>\n     * \t<blockB>b]</blockB>\n     * </block>\n     * ```\n     *\n     * **Special case**: Selection ignores first and/or last blocks if nothing (from user perspective) is selected in them.\n     *\n     * ```xml\n     * // Selection ends and the beginning of the last block.\n     * <paragraph>[a</paragraph>\n     * <paragraph>b</paragraph>\n     * <paragraph>]c</paragraph> // This block will not be returned\n     *\n     * // Selection begins at the end of the first block.\n     * <paragraph>a[</paragraph> // This block will not be returned\n     * <paragraph>b</paragraph>\n     * <paragraph>c]</paragraph>\n     *\n     * // Selection begings at the end of the first block and ends at the beginning of the last block.\n     * <paragraph>a[</paragraph> // This block will not be returned\n     * <paragraph>b</paragraph>\n     * <paragraph>]c</paragraph> // This block will not be returned\n     * ```\n     */\n    *getSelectedBlocks() {\n        const visited = new WeakSet();\n        for (const range of this.getRanges()) {\n            // Get start block of range in case of a collapsed range.\n            const startBlock = getParentBlock(range.start, visited);\n            if (isStartBlockSelected(startBlock, range)) {\n                yield startBlock;\n            }\n            const treewalker = range.getWalker();\n            for (const value of treewalker) {\n                const block = value.item;\n                if (value.type == 'elementEnd' && isUnvisitedTopBlock(block, visited, range)) {\n                    yield block;\n                }\n                // If element is block, we can skip its children and jump to the end of it.\n                else if (value.type == 'elementStart' &&\n                    block.is('model:element') &&\n                    block.root.document.model.schema.isBlock(block)) {\n                    treewalker.jumpTo(ModelPosition._createAt(block, 'end'));\n                }\n            }\n            const endBlock = getParentBlock(range.end, visited);\n            if (isEndBlockSelected(endBlock, range)) {\n                yield endBlock;\n            }\n        }\n    }\n    /**\n     * Checks whether the selection contains the entire content of the given element. This means that selection must start\n     * at a position {@link module:engine/model/position~ModelPosition#isTouching touching} the element's start and ends at position\n     * touching the element's end.\n     *\n     * By default, this method will check whether the entire content of the selection's current root is selected.\n     * Useful to check if e.g. the user has just pressed <kbd>Ctrl</kbd> + <kbd>A</kbd>.\n     */\n    containsEntireContent(element = this.anchor.root) {\n        const limitStartPosition = ModelPosition._createAt(element, 0);\n        const limitEndPosition = ModelPosition._createAt(element, 'end');\n        return limitStartPosition.isTouching(this.getFirstPosition()) &&\n            limitEndPosition.isTouching(this.getLastPosition());\n    }\n    /**\n     * Converts `Selection` to plain object and returns it.\n     *\n     * @returns `Selection` converted to plain object.\n     */\n    toJSON() {\n        const json = {\n            ranges: Array.from(this.getRanges()).map(range => range.toJSON())\n        };\n        const attributes = Object.fromEntries(this.getAttributes());\n        if (Object.keys(attributes).length) {\n            json.attributes = attributes;\n        }\n        if (this.isBackward) {\n            json.isBackward = true;\n        }\n        return json;\n    }\n    /**\n     * Adds given range to internal {@link #_ranges ranges array}. Throws an error\n     * if given range is intersecting with any range that is already stored in this selection.\n     */\n    _pushRange(range) {\n        this._checkRange(range);\n        this._ranges.push(new ModelRange(range.start, range.end));\n    }\n    /**\n     * Checks if given range intersects with ranges that are already in the selection. Throws an error if it does.\n     */\n    _checkRange(range) {\n        for (let i = 0; i < this._ranges.length; i++) {\n            if (range.isIntersecting(this._ranges[i])) {\n                /**\n                 * Trying to add a range that intersects with another range in the selection.\n                 *\n                 * @error model-selection-range-intersects\n                 * @param {module:engine/model/range~ModelRange} addedRange Range that was added to the selection.\n                 * @param {module:engine/model/range~ModelRange} intersectingRange Range in the selection that intersects with `addedRange`.\n                 */\n                throw new CKEditorError('model-selection-range-intersects', [this, range], { addedRange: range, intersectingRange: this._ranges[i] });\n            }\n        }\n    }\n    /**\n     * Replaces all the ranges by the given ones.\n     * Uses {@link #_popRange _popRange} and {@link #_pushRange _pushRange} to ensure proper ranges removal and addition.\n     */\n    _replaceAllRanges(ranges) {\n        this._removeAllRanges();\n        for (const range of ranges) {\n            this._pushRange(range);\n        }\n    }\n    /**\n     * Deletes ranges from internal range array. Uses {@link #_popRange _popRange} to\n     * ensure proper ranges removal.\n     */\n    _removeAllRanges() {\n        while (this._ranges.length > 0) {\n            this._popRange();\n        }\n    }\n    /**\n     * Removes most recently added range from the selection.\n     */\n    _popRange() {\n        this._ranges.pop();\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelSelection.prototype.is = function (type) {\n    return type === 'selection' || type === 'model:selection';\n};\n/**\n * Checks whether the given element extends $block in the schema and has a parent (is not a root).\n * Marks it as already visited.\n */\nfunction isUnvisitedBlock(element, visited) {\n    if (visited.has(element)) {\n        return false;\n    }\n    visited.add(element);\n    return element.root.document.model.schema.isBlock(element) && !!element.parent;\n}\n/**\n * Checks if the given element is a $block was not previously visited and is a top block in a range.\n */\nfunction isUnvisitedTopBlock(element, visited, range) {\n    return isUnvisitedBlock(element, visited) && isTopBlockInRange(element, range);\n}\n/**\n * Finds the lowest element in position's ancestors which is a block.\n * It will search until first ancestor that is a limit element.\n * Marks all ancestors as already visited to not include any of them later on.\n */\nfunction getParentBlock(position, visited) {\n    const element = position.parent;\n    const schema = element.root.document.model.schema;\n    const ancestors = position.parent.getAncestors({ parentFirst: true, includeSelf: true });\n    let hasParentLimit = false;\n    const block = ancestors.find((element) => {\n        // Stop searching after first parent node that is limit element.\n        if (hasParentLimit) {\n            return false;\n        }\n        hasParentLimit = schema.isLimit(element);\n        return !hasParentLimit && isUnvisitedBlock(element, visited);\n    });\n    // Mark all ancestors of this position's parent, because find() might've stopped early and\n    // the found block may be a child of another block.\n    ancestors.forEach(element => visited.add(element));\n    return block;\n}\n/**\n * Checks if the blocks is not nested in other block inside a range.\n */\nfunction isTopBlockInRange(block, range) {\n    const parentBlock = findAncestorBlock(block);\n    if (!parentBlock) {\n        return true;\n    }\n    // Add loose flag to check as parentRange can be equal to range.\n    const isParentInRange = range.containsRange(ModelRange._createOn(parentBlock), true);\n    return !isParentInRange;\n}\n/**\n * If a selection starts at the end of a block, that block is not returned as from the user's perspective this block wasn't selected.\n * See [#11585](https://github.com/ckeditor/ckeditor5/issues/11585) for more details.\n *\n * ```xml\n * <paragraph>a[</paragraph> // This block will not be returned\n * <paragraph>b</paragraph>\n * <paragraph>c]</paragraph>\n * ```\n *\n * Collapsed selection is not affected by it:\n *\n * ```xml\n * <paragraph>a[]</paragraph> // This block will be returned\n * ```\n */\nfunction isStartBlockSelected(startBlock, range) {\n    if (!startBlock) {\n        return false;\n    }\n    if (range.isCollapsed || startBlock.isEmpty) {\n        return true;\n    }\n    if (range.start.isTouching(ModelPosition._createAt(startBlock, startBlock.maxOffset))) {\n        return false;\n    }\n    return isTopBlockInRange(startBlock, range);\n}\n/**\n * If a selection ends at the beginning of a block, that block is not returned as from the user's perspective this block wasn't selected.\n * See [#984](https://github.com/ckeditor/ckeditor5-engine/issues/984) for more details.\n *\n * ```xml\n * <paragraph>[a</paragraph>\n * <paragraph>b</paragraph>\n * <paragraph>]c</paragraph> // this block will not be returned\n * ```\n *\n * Collapsed selection is not affected by it:\n *\n * ```xml\n * <paragraph>[]a</paragraph> // this block will be returned\n * ```\n */\nfunction isEndBlockSelected(endBlock, range) {\n    if (!endBlock) {\n        return false;\n    }\n    if (range.isCollapsed || endBlock.isEmpty) {\n        return true;\n    }\n    if (range.end.isTouching(ModelPosition._createAt(endBlock, 0))) {\n        return false;\n    }\n    return isTopBlockInRange(endBlock, range);\n}\n/**\n * Returns first ancestor block of a node.\n */\nfunction findAncestorBlock(node) {\n    const schema = node.root.document.model.schema;\n    let parent = node.parent;\n    while (parent) {\n        if (schema.isBlock(parent)) {\n            return parent;\n        }\n        parent = parent.parent;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/liverange\n */\nimport { ModelRange } from './range.js';\nimport { EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * `ModelLiveRange` is a type of {@link module:engine/model/range~ModelRange Range}\n * that updates itself as {@link module:engine/model/document~ModelDocument document}\n * is changed through operations. It may be used as a bookmark.\n *\n * **Note:** Be very careful when dealing with `ModelLiveRange`. Each `ModelLiveRange` instance bind events that might\n * have to be unbound. Use {@link module:engine/model/liverange~ModelLiveRange#detach detach} whenever you don't need\n * `ModelLiveRange` anymore.\n */\nexport class ModelLiveRange extends /* #__PURE__ */ EmitterMixin(ModelRange) {\n    /**\n     * Creates a live range.\n     *\n     * @see module:engine/model/range~ModelRange\n     */\n    constructor(start, end) {\n        super(start, end);\n        bindWithDocument.call(this);\n    }\n    /**\n     * Unbinds all events previously bound by `ModelLiveRange`. Use it whenever you don't need `ModelLiveRange` instance\n     * anymore (i.e. when leaving scope in which it was declared or before re-assigning variable that was\n     * referring to it).\n     */\n    detach() {\n        this.stopListening();\n    }\n    /**\n     * Creates a {@link module:engine/model/range~ModelRange range instance} that is equal to this live range.\n     */\n    toRange() {\n        return new ModelRange(this.start, this.end);\n    }\n    /**\n     * Creates a `ModelLiveRange` instance that is equal to the given range.\n     */\n    static fromRange(range) {\n        return new ModelLiveRange(range.start, range.end);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelLiveRange.prototype.is = function (type) {\n    return type === 'liveRange' || type === 'model:liveRange' ||\n        // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n        type == 'range' || type === 'model:range';\n};\n/**\n * Binds this `ModelLiveRange` to the {@link module:engine/model/document~ModelDocument document}\n * that owns this range's {@link module:engine/model/range~ModelRange#root root}.\n */\nfunction bindWithDocument() {\n    this.listenTo(this.root.document.model, 'applyOperation', (event, args) => {\n        const operation = args[0];\n        if (!operation.isDocumentOperation) {\n            return;\n        }\n        transform.call(this, operation);\n    }, { priority: 'low' });\n}\n/**\n * Updates this range accordingly to the updates applied to the model. Bases on change events.\n */\nfunction transform(operation) {\n    // Transform the range by the operation. Join the result ranges if needed.\n    const ranges = this.getTransformedByOperation(operation);\n    const result = ModelRange._createFromRanges(ranges);\n    const boundariesChanged = !result.isEqual(this);\n    const contentChanged = doesOperationChangeRangeContent(this, operation);\n    let deletionPosition = null;\n    if (boundariesChanged) {\n        // If range boundaries have changed, fire `change:range` event.\n        //\n        if (result.root.rootName == '$graveyard') {\n            // If the range was moved to the graveyard root, set `deletionPosition`.\n            if (operation.type == 'remove') {\n                deletionPosition = operation.sourcePosition;\n            }\n            else {\n                // Merge operation.\n                deletionPosition = operation.deletionPosition;\n            }\n        }\n        const oldRange = this.toRange();\n        this.start = result.start;\n        this.end = result.end;\n        this.fire('change:range', oldRange, { deletionPosition });\n    }\n    else if (contentChanged) {\n        // If range boundaries have not changed, but there was change inside the range, fire `change:content` event.\n        this.fire('change:content', this.toRange(), { deletionPosition });\n    }\n}\n/**\n * Checks whether given operation changes something inside the range (even if it does not change boundaries).\n */\nfunction doesOperationChangeRangeContent(range, operation) {\n    switch (operation.type) {\n        case 'insert':\n            return range.containsPosition(operation.position);\n        case 'move':\n        case 'remove':\n        case 'reinsert':\n        case 'merge':\n            return range.containsPosition(operation.sourcePosition) ||\n                range.start.isEqual(operation.sourcePosition) ||\n                range.containsPosition(operation.targetPosition);\n        case 'split':\n            return range.containsPosition(operation.splitPosition) || range.containsPosition(operation.insertionPosition);\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/text\n */\nimport { ModelNode } from './node.js';\n// @if CK_DEBUG_ENGINE // const { convertMapToStringifiedObject } = require( '../dev-utils/utils' );\n/**\n * Model text node. Type of {@link module:engine/model/node~ModelNode node} that\n * contains {@link module:engine/model/text~ModelText#data text data}.\n *\n * **Important:** see {@link module:engine/model/node~ModelNode} to read about restrictions using `Text` and `Node` API.\n *\n * **Note:** keep in mind that `Text` instances might indirectly got removed from model tree when model is changed.\n * This happens when {@link module:engine/model/writer~ModelWriter model writer} is used to change model and the text node is merged with\n * another text node. Then, both text nodes are removed and a new text node is inserted into the model. Because of\n * this behavior, keeping references to `Text` is not recommended. Instead, consider creating\n * {@link module:engine/model/liveposition~ModelLivePosition live position} placed before the text node.\n */\nexport class ModelText extends ModelNode {\n    /**\n     * Text data contained in this text node.\n     *\n     * @internal\n     */\n    _data;\n    /**\n     * Creates a text node.\n     *\n     * **Note:** Constructor of this class shouldn't be used directly in the code.\n     * Use the {@link module:engine/model/writer~ModelWriter#createText} method instead.\n     *\n     * @internal\n     * @param data Node's text.\n     * @param attrs Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.\n     */\n    constructor(data, attrs) {\n        super(attrs);\n        this._data = data || '';\n    }\n    /**\n     * @inheritDoc\n     */\n    get offsetSize() {\n        return this.data.length;\n    }\n    /**\n     * Returns a text data contained in the node.\n     */\n    get data() {\n        return this._data;\n    }\n    /**\n     * Converts `Text` instance to plain object and returns it.\n     *\n     * @returns`Text` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.data = this.data;\n        return json;\n    }\n    /**\n     * Creates a copy of this text node and returns it. Created text node has same text data and attributes as original text node.\n     *\n     * @internal\n     * @returns `Text` instance created using given plain object.\n     */\n    _clone() {\n        return new ModelText(this.data, this.getAttributes());\n    }\n    /**\n     * Creates a `Text` instance from given plain object (i.e. parsed JSON string).\n     *\n     * @param json Plain object to be converted to `Text`.\n     * @returns `Text` instance created using given plain object.\n     */\n    static fromJSON(json) {\n        return new ModelText(json.data, json.attributes);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelText.prototype.is = function (type) {\n    return type === '$text' || type === 'model:$text' ||\n        // This are legacy values kept for backward compatibility.\n        type === 'text' || type === 'model:text' ||\n        // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n        type === 'node' || type === 'model:node';\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/documentselection\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { ModelLiveRange } from './liverange.js';\nimport { ModelSelection } from './selection.js';\nimport { ModelText } from './text.js';\nimport { ModelTextProxy } from './textproxy.js';\nimport { CKEditorError, Collection, EmitterMixin, toMap, uid } from '@ckeditor/ckeditor5-utils';\nconst storePrefix = 'selection:';\n/**\n * `ModelDocumentSelection` is a special selection which is used as the\n * {@link module:engine/model/document~ModelDocument#selection document's selection}.\n * There can be only one instance of `ModelDocumentSelection` per document.\n *\n * Document selection can only be changed by using the {@link module:engine/model/writer~ModelWriter} instance\n * inside the {@link module:engine/model/model~Model#change `change()`} block, as it provides a secure way to modify model.\n *\n * `ModelDocumentSelection` is automatically updated upon changes in the {@link module:engine/model/document~ModelDocument document}\n * to always contain valid ranges. Its attributes are inherited from the text unless set explicitly.\n *\n * Differences between {@link module:engine/model/selection~ModelSelection} and `ModelDocumentSelection` are:\n * * there is always a range in `ModelDocumentSelection` - even if no ranges were added there is a \"default range\"\n * present in the selection,\n * * ranges added to this selection updates automatically when the document changes,\n * * attributes of `ModelDocumentSelection` are updated automatically according to selection ranges.\n *\n * Since `ModelDocumentSelection` uses {@link module:engine/model/liverange~ModelLiveRange live ranges}\n * and is updated when {@link module:engine/model/document~ModelDocument document}\n * changes, it cannot be set on {@link module:engine/model/node~ModelNode nodes}\n * that are inside {@link module:engine/model/documentfragment~ModelDocumentFragment document fragment}.\n * If you need to represent a selection in document fragment,\n * use {@link module:engine/model/selection~ModelSelection Selection class} instead.\n */\nexport class ModelDocumentSelection extends /* #__PURE__ */ EmitterMixin(ModelTypeCheckable) {\n    /**\n     * Selection used internally by that class (`ModelDocumentSelection` is a proxy to that selection).\n     */\n    _selection;\n    /**\n     * Creates an empty live selection for given {@link module:engine/model/document~ModelDocument}.\n     *\n     * @param doc Document which owns this selection.\n     */\n    constructor(doc) {\n        super();\n        this._selection = new LiveSelection(doc);\n        this._selection.delegate('change:range').to(this);\n        this._selection.delegate('change:attribute').to(this);\n        this._selection.delegate('change:marker').to(this);\n    }\n    /**\n     * Describes whether the selection is collapsed. Selection is collapsed when there is exactly one range which is\n     * collapsed.\n     */\n    get isCollapsed() {\n        return this._selection.isCollapsed;\n    }\n    /**\n     * Selection anchor. Anchor may be described as a position where the most recent part of the selection starts.\n     * Together with {@link #focus} they define the direction of selection, which is important\n     * when expanding/shrinking selection. Anchor is always {@link module:engine/model/range~ModelRange#start start} or\n     * {@link module:engine/model/range~ModelRange#end end} position of the most recently added range.\n     *\n     * Is set to `null` if there are no ranges in selection.\n     *\n     * @see #focus\n     */\n    get anchor() {\n        return this._selection.anchor;\n    }\n    /**\n     * Selection focus. Focus is a position where the selection ends.\n     *\n     * Is set to `null` if there are no ranges in selection.\n     *\n     * @see #anchor\n     */\n    get focus() {\n        return this._selection.focus;\n    }\n    /**\n     * Number of ranges in selection.\n     */\n    get rangeCount() {\n        return this._selection.rangeCount;\n    }\n    /**\n     * Describes whether `Documentselection` has own range(s) set, or if it is defaulted to\n     * {@link module:engine/model/document~ModelDocument#_getDefaultRange document's default range}.\n     */\n    get hasOwnRange() {\n        return this._selection.hasOwnRange;\n    }\n    /**\n     * Specifies whether the {@link #focus}\n     * precedes {@link #anchor}.\n     *\n     * @readonly\n     * @type {Boolean}\n     */\n    get isBackward() {\n        return this._selection.isBackward;\n    }\n    /**\n     * Describes whether the gravity is overridden (using {@link module:engine/model/writer~ModelWriter#overrideSelectionGravity}) or not.\n     *\n     * Note that the gravity remains overridden as long as will not be restored the same number of times as it was overridden.\n     */\n    get isGravityOverridden() {\n        return this._selection.isGravityOverridden;\n    }\n    /**\n     * A collection of selection {@link module:engine/model/markercollection~Marker markers}.\n     * Marker is a selection marker when selection range is inside the marker range.\n     *\n     * **Note**: Only markers from {@link ~ModelDocumentSelection#observeMarkers observed markers groups} are collected.\n     */\n    get markers() {\n        return this._selection.markers;\n    }\n    /**\n     * Used for the compatibility with the {@link module:engine/model/selection~ModelSelection#isEqual} method.\n     *\n     * @internal\n     */\n    get _ranges() {\n        return this._selection._ranges;\n    }\n    /**\n     * Returns an iterable that iterates over copies of selection ranges.\n     */\n    getRanges() {\n        return this._selection.getRanges();\n    }\n    /**\n     * Returns the first position in the selection.\n     * First position is the position that {@link module:engine/model/position~ModelPosition#isBefore is before}\n     * any other position in the selection.\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getFirstPosition() {\n        return this._selection.getFirstPosition();\n    }\n    /**\n     * Returns the last position in the selection.\n     * Last position is the position that {@link module:engine/model/position~ModelPosition#isAfter is after}\n     * any other position in the selection.\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getLastPosition() {\n        return this._selection.getLastPosition();\n    }\n    /**\n     * Returns a copy of the first range in the selection.\n     * First range is the one which {@link module:engine/model/range~ModelRange#start start} position\n     * {@link module:engine/model/position~ModelPosition#isBefore is before} start position of all other ranges\n     * (not to confuse with the first range added to the selection).\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getFirstRange() {\n        return this._selection.getFirstRange();\n    }\n    /**\n     * Returns a copy of the last range in the selection.\n     * Last range is the one which {@link module:engine/model/range~ModelRange#end end} position\n     * {@link module:engine/model/position~ModelPosition#isAfter is after} end position of all\n     * other ranges (not to confuse with the range most recently added to the selection).\n     *\n     * Returns `null` if there are no ranges in selection.\n     */\n    getLastRange() {\n        return this._selection.getLastRange();\n    }\n    /**\n     * Gets elements of type {@link module:engine/model/schema~ModelSchema#isBlock \"block\"} touched by the selection.\n     *\n     * This method's result can be used for example to apply block styling to all blocks covered by this selection.\n     *\n     * **Note:** `getSelectedBlocks()` returns blocks that are nested in other non-block elements\n     * but will not return blocks nested in other blocks.\n     *\n     * In this case the function will return exactly all 3 paragraphs (note: `<blockQuote>` is not a block itself):\n     *\n     * ```\n     * <paragraph>[a</paragraph>\n     * <blockQuote>\n     * \t<paragraph>b</paragraph>\n     * </blockQuote>\n     * <paragraph>c]d</paragraph>\n     * ```\n     *\n     * In this case the paragraph will also be returned, despite the collapsed selection:\n     *\n     * ```\n     * <paragraph>[]a</paragraph>\n     * ```\n     *\n     * In such a scenario, however, only blocks A, B & E will be returned as blocks C & D are nested in block B:\n     *\n     * ```\n     * [<blockA></blockA>\n     * <blockB>\n     * \t<blockC></blockC>\n     * \t<blockD></blockD>\n     * </blockB>\n     * <blockE></blockE>]\n     * ```\n     *\n     * If the selection is inside a block all the inner blocks (A & B) are returned:\n     *\n     * ```\n     * <block>\n     * \t<blockA>[a</blockA>\n     * \t<blockB>b]</blockB>\n     * </block>\n     * ```\n     *\n     * **Special case**: If a selection ends at the beginning of a block, that block is not returned as from user perspective\n     * this block wasn't selected. See [#984](https://github.com/ckeditor/ckeditor5-engine/issues/984) for more details.\n     *\n     * ```\n     * <paragraph>[a</paragraph>\n     * <paragraph>b</paragraph>\n     * <paragraph>]c</paragraph> // this block will not be returned\n     * ```\n     */\n    getSelectedBlocks() {\n        return this._selection.getSelectedBlocks();\n    }\n    /**\n     * Returns the selected element. {@link module:engine/model/element~ModelElement Element} is considered as selected if there is only\n     * one range in the selection, and that range contains exactly one element.\n     * Returns `null` if there is no selected element.\n     */\n    getSelectedElement() {\n        return this._selection.getSelectedElement();\n    }\n    /**\n     * Checks whether the selection contains the entire content of the given element. This means that selection must start\n     * at a position {@link module:engine/model/position~ModelPosition#isTouching touching} the element's start and ends at position\n     * touching the element's end.\n     *\n     * By default, this method will check whether the entire content of the selection's current root is selected.\n     * Useful to check if e.g. the user has just pressed <kbd>Ctrl</kbd> + <kbd>A</kbd>.\n     */\n    containsEntireContent(element) {\n        return this._selection.containsEntireContent(element);\n    }\n    /**\n     * Unbinds all events previously bound by document selection.\n     */\n    destroy() {\n        this._selection.destroy();\n    }\n    /**\n     * Returns iterable that iterates over this selection's attribute keys.\n     */\n    getAttributeKeys() {\n        return this._selection.getAttributeKeys();\n    }\n    /**\n     * Returns iterable that iterates over this selection's attributes.\n     *\n     * Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.\n     * This format is accepted by native `Map` object and also can be passed in `Node` constructor.\n     */\n    getAttributes() {\n        return this._selection.getAttributes();\n    }\n    /**\n     * Gets an attribute value for given key or `undefined` if that attribute is not set on the selection.\n     *\n     * @param key Key of attribute to look for.\n     * @returns Attribute value or `undefined`.\n     */\n    getAttribute(key) {\n        return this._selection.getAttribute(key);\n    }\n    /**\n     * Checks if the selection has an attribute for given key.\n     *\n     * @param key Key of attribute to check.\n     * @returns `true` if attribute with given key is set on selection, `false` otherwise.\n     */\n    hasAttribute(key) {\n        return this._selection.hasAttribute(key);\n    }\n    /**\n     * Refreshes selection attributes and markers according to the current position in the model.\n     */\n    refresh() {\n        this._selection.updateMarkers();\n        this._selection._updateAttributes(false);\n    }\n    /**\n     * Registers a marker group prefix or a marker name to be collected in the\n     * {@link ~ModelDocumentSelection#markers selection markers collection}.\n     *\n     * See also {@link module:engine/model/markercollection~MarkerCollection#getMarkersGroup `MarkerCollection#getMarkersGroup()`}.\n     *\n     * @param prefixOrName The marker group prefix or marker name.\n     */\n    observeMarkers(prefixOrName) {\n        this._selection.observeMarkers(prefixOrName);\n    }\n    /**\n     * Converts `DocumentSelection` to plain object and returns it.\n     *\n     * @returns `DocumentSelection` converted to plain object.\n     */\n    toJSON() {\n        return this._selection.toJSON();\n    }\n    /**\n     * Moves {@link module:engine/model/documentselection~ModelDocumentSelection#focus} to the specified location.\n     * Should be used only within the {@link module:engine/model/writer~ModelWriter#setSelectionFocus} method.\n     *\n     * The location can be specified in the same form as\n     * {@link module:engine/model/writer~ModelWriter#createPositionAt writer.createPositionAt()} parameters.\n     *\n     * @see module:engine/model/writer~ModelWriter#setSelectionFocus\n     * @internal\n     * @param offset Offset or one of the flags. Used only when\n     * first parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    _setFocus(itemOrPosition, offset) {\n        this._selection.setFocus(itemOrPosition, offset);\n    }\n    /**\n     * Sets this selection's ranges and direction to the specified location based on the given\n     * {@link module:engine/model/selection~ModelSelectable selectable}.\n     * Should be used only within the {@link module:engine/model/writer~ModelWriter#setSelection} method.\n     *\n     * @see module:engine/model/writer~ModelWriter#setSelection\n     * @internal\n     */\n    _setTo(...args) {\n        this._selection.setTo(...args);\n    }\n    /**\n     * Sets attribute on the selection. If attribute with the same key already is set, it's value is overwritten.\n     * Should be used only within the {@link module:engine/model/writer~ModelWriter#setSelectionAttribute} method.\n     *\n     * @see module:engine/model/writer~ModelWriter#setSelectionAttribute\n     * @internal\n     * @param key Key of the attribute to set.\n     * @param value Attribute value.\n     */\n    _setAttribute(key, value) {\n        this._selection.setAttribute(key, value);\n    }\n    /**\n     * Removes an attribute with given key from the selection.\n     * If the given attribute was set on the selection, fires the {@link module:engine/model/selection~ModelSelection#event:change:range}\n     * event with removed attribute key.\n     * Should be used only within the {@link module:engine/model/writer~ModelWriter#removeSelectionAttribute} method.\n     *\n     * @see module:engine/model/writer~ModelWriter#removeSelectionAttribute\n     * @internal\n     * @param key Key of the attribute to remove.\n     */\n    _removeAttribute(key) {\n        this._selection.removeAttribute(key);\n    }\n    /**\n     * Returns an iterable that iterates through all selection attributes stored in current selection's parent.\n     *\n     * @internal\n     */\n    _getStoredAttributes() {\n        return this._selection.getStoredAttributes();\n    }\n    /**\n     * Temporarily changes the gravity of the selection from the left to the right.\n     *\n     * The gravity defines from which direction the selection inherits its attributes. If it's the default left\n     * gravity, the selection (after being moved by the the user) inherits attributes from its left hand side.\n     * This method allows to temporarily override this behavior by forcing the gravity to the right.\n     *\n     * It returns an unique identifier which is required to restore the gravity. It guarantees the symmetry\n     * of the process.\n     *\n     * @see module:engine/model/writer~ModelWriter#overrideSelectionGravity\n     * @internal\n     * @returns The unique id which allows restoring the gravity.\n     */\n    _overrideGravity() {\n        return this._selection.overrideGravity();\n    }\n    /**\n     * Restores the {@link ~ModelDocumentSelection#_overrideGravity overridden gravity}.\n     *\n     * Restoring the gravity is only possible using the unique identifier returned by\n     * {@link ~ModelDocumentSelection#_overrideGravity}. Note that the gravity remains overridden as long as won't be restored\n     * the same number of times it was overridden.\n     *\n     * @see module:engine/model/writer~ModelWriter#restoreSelectionGravity\n     * @internal\n     * @param uid The unique id returned by {@link #_overrideGravity}.\n     */\n    _restoreGravity(uid) {\n        this._selection.restoreGravity(uid);\n    }\n    /**\n     * Generates and returns an attribute key for selection attributes store, basing on original attribute key.\n     *\n     * @internal\n     * @param key Attribute key to convert.\n     * @returns Converted attribute key, applicable for selection store.\n     */\n    static _getStoreAttributeKey(key) {\n        return storePrefix + key;\n    }\n    /**\n     * Checks whether the given attribute key is an attribute stored on an element.\n     *\n     * @internal\n     */\n    static _isStoreAttributeKey(key) {\n        return key.startsWith(storePrefix);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelDocumentSelection.prototype.is = function (type) {\n    return type === 'selection' ||\n        type == 'model:selection' ||\n        type == 'documentSelection' ||\n        type == 'model:documentSelection';\n};\n/**\n * `LiveSelection` is used internally by {@link module:engine/model/documentselection~ModelDocumentSelection}\n * and shouldn't be used directly.\n *\n * `LiveSelection` is automatically updated upon changes in the {@link module:engine/model/document~ModelDocument document}\n * to always contain valid ranges. Its attributes are inherited from the text unless set explicitly.\n *\n * Differences between {@link module:engine/model/selection~ModelSelection} and `LiveSelection` are:\n * * there is always a range in `LiveSelection` - even if no ranges were added there is a \"default range\"\n * present in the selection,\n * * ranges added to this selection updates automatically when the document changes,\n * * attributes of `LiveSelection` are updated automatically according to selection ranges.\n */\nclass LiveSelection extends ModelSelection {\n    /**\n     * List of selection markers.\n     * Marker is a selection marker when selection range is inside the marker range.\n     */\n    markers = new Collection({ idProperty: 'name' });\n    /**\n     * Document which owns this selection.\n     */\n    _model;\n    /**\n     * Document which owns this selection.\n     */\n    _document;\n    /**\n     * Keeps mapping of attribute name to priority with which the attribute got modified (added/changed/removed)\n     * last time. Possible values of priority are: `'low'` and `'normal'`.\n     *\n     * Priorities are used by internal `LiveSelection` mechanisms. All attributes set using `LiveSelection`\n     * attributes API are set with `'normal'` priority.\n     */\n    _attributePriority = new Map();\n    /**\n     * Position to which the selection should be set if the last selection range was moved to the graveyard.\n     */\n    _selectionRestorePosition = null;\n    /**\n     * Flag that informs whether the selection ranges have changed. It is changed on true when `LiveRange#change:range` event is fired.\n     */\n    _hasChangedRange = false;\n    /**\n     * Each overriding gravity adds an UID to the set and each removal removes it.\n     * Gravity is overridden when there's at least one UID in the set.\n     * Gravity is restored when the set is empty.\n     * This is to prevent conflicts when gravity is overridden by more than one feature at the same time.\n     */\n    _overriddenGravityRegister = new Set();\n    /**\n     * Prefixes of marker names that should affect `LiveSelection#markers` collection.\n     */\n    _observedMarkers = new Set();\n    /**\n     * Creates an empty live selection for given {@link module:engine/model/document~ModelDocument}.\n     *\n     * @param doc Document which owns this selection.\n     */\n    constructor(doc) {\n        super();\n        this._model = doc.model;\n        this._document = doc;\n        // Ensure selection is correct after each operation.\n        this.listenTo(this._model, 'applyOperation', (evt, args) => {\n            const operation = args[0];\n            if (!operation.isDocumentOperation || operation.type == 'marker' || operation.type == 'rename' || operation.type == 'noop') {\n                return;\n            }\n            // Fix selection if the last range was removed from it and we have a position to which we can restore the selection.\n            if (this._ranges.length == 0 && this._selectionRestorePosition) {\n                this._fixGraveyardSelection(this._selectionRestorePosition);\n            }\n            // \"Forget\" the restore position even if it was not \"used\".\n            this._selectionRestorePosition = null;\n            if (this._hasChangedRange) {\n                this._hasChangedRange = false;\n                this.fire('change:range', { directChange: false });\n            }\n        }, { priority: 'lowest' });\n        // Ensure selection is correct and up to date after each range change.\n        this.on('change:range', () => {\n            this._validateSelectionRanges(this.getRanges());\n        });\n        // Update markers data stored by the selection after each marker change.\n        // This handles only marker changes done through marker operations (not model tree changes).\n        this.listenTo(this._model.markers, 'update', (evt, marker, oldRange, newRange) => {\n            this._updateMarker(marker, newRange);\n        });\n        // Ensure selection is up to date after each change block.\n        this.listenTo(this._document, 'change', (evt, batch) => {\n            clearAttributesStoredInElement(this._model, batch);\n        });\n    }\n    get isCollapsed() {\n        const length = this._ranges.length;\n        return length === 0 ? this._document._getDefaultRange().isCollapsed : super.isCollapsed;\n    }\n    get anchor() {\n        return super.anchor || this._document._getDefaultRange().start;\n    }\n    get focus() {\n        return super.focus || this._document._getDefaultRange().end;\n    }\n    get rangeCount() {\n        return this._ranges.length ? this._ranges.length : 1;\n    }\n    /**\n     * Describes whether `LiveSelection` has own range(s) set, or if it is defaulted to\n     * {@link module:engine/model/document~ModelDocument#_getDefaultRange document's default range}.\n     */\n    get hasOwnRange() {\n        return this._ranges.length > 0;\n    }\n    /**\n     * When set to `true` then selection attributes on node before the caret won't be taken\n     * into consideration while updating selection attributes.\n     */\n    get isGravityOverridden() {\n        return !!this._overriddenGravityRegister.size;\n    }\n    /**\n     * Unbinds all events previously bound by live selection.\n     */\n    destroy() {\n        for (let i = 0; i < this._ranges.length; i++) {\n            this._ranges[i].detach();\n        }\n        this.stopListening();\n    }\n    *getRanges() {\n        if (this._ranges.length) {\n            yield* super.getRanges();\n        }\n        else {\n            yield this._document._getDefaultRange();\n        }\n    }\n    getFirstRange() {\n        return super.getFirstRange() || this._document._getDefaultRange();\n    }\n    getLastRange() {\n        return super.getLastRange() || this._document._getDefaultRange();\n    }\n    setTo(...args) {\n        super.setTo(...args);\n        this._updateAttributes(true);\n        this.updateMarkers();\n    }\n    setFocus(itemOrPosition, offset) {\n        super.setFocus(itemOrPosition, offset);\n        this._updateAttributes(true);\n        this.updateMarkers();\n    }\n    setAttribute(key, value) {\n        if (this._setAttribute(key, value)) {\n            // Fire event with exact data.\n            const attributeKeys = [key];\n            this.fire('change:attribute', { attributeKeys, directChange: true });\n        }\n    }\n    removeAttribute(key) {\n        if (this._removeAttribute(key)) {\n            // Fire event with exact data.\n            const attributeKeys = [key];\n            this.fire('change:attribute', { attributeKeys, directChange: true });\n        }\n    }\n    overrideGravity() {\n        const overrideUid = uid();\n        // Remember that another overriding has been requested. It will need to be removed\n        // before the gravity is to be restored.\n        this._overriddenGravityRegister.add(overrideUid);\n        if (this._overriddenGravityRegister.size === 1) {\n            this._updateAttributes(true);\n        }\n        return overrideUid;\n    }\n    restoreGravity(uid) {\n        if (!this._overriddenGravityRegister.has(uid)) {\n            /**\n             * Restoring gravity for an unknown UID is not possible. Make sure you are using a correct\n             * UID obtained from the {@link module:engine/model/writer~ModelWriter#overrideSelectionGravity} to restore.\n             *\n             * @error document-selection-gravity-wrong-restore\n             * @param {string} uid The unique identifier returned by\n             * {@link module:engine/model/documentselection~ModelDocumentSelection#_overrideGravity}.\n             */\n            throw new CKEditorError('document-selection-gravity-wrong-restore', this, { uid });\n        }\n        this._overriddenGravityRegister.delete(uid);\n        // Restore gravity only when all overriding have been restored.\n        if (!this.isGravityOverridden) {\n            this._updateAttributes(true);\n        }\n    }\n    observeMarkers(prefixOrName) {\n        this._observedMarkers.add(prefixOrName);\n        this.updateMarkers();\n    }\n    _replaceAllRanges(ranges) {\n        this._validateSelectionRanges(ranges);\n        super._replaceAllRanges(ranges);\n    }\n    _popRange() {\n        this._ranges.pop().detach();\n    }\n    _pushRange(range) {\n        const liveRange = this._prepareRange(range);\n        // `undefined` is returned when given `range` is in graveyard root.\n        if (liveRange) {\n            this._ranges.push(liveRange);\n        }\n    }\n    /**\n     * Converts `LiveSelection` to plain object and returns it.\n     *\n     * @returns `LiveSelection` converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        if (this.markers.length) {\n            json.markers = this.markers.map(marker => marker.toJSON());\n        }\n        return json;\n    }\n    _validateSelectionRanges(ranges) {\n        for (const range of ranges) {\n            if (!this._document._validateSelectionRange(range)) {\n                /**\n                 * Range from {@link module:engine/model/documentselection~ModelDocumentSelection document selection}\n                 * starts or ends at incorrect position.\n                 *\n                 * @error document-selection-wrong-position\n                 * @param {module:engine/model/range~ModelRange} range The invalid range.\n                 */\n                throw new CKEditorError('document-selection-wrong-position', this, { range });\n            }\n        }\n    }\n    /**\n     * Prepares given range to be added to selection. Checks if it is correct,\n     * converts it to {@link module:engine/model/liverange~ModelLiveRange ModelLiveRange}\n     * and sets listeners listening to the range's change event.\n     */\n    _prepareRange(range) {\n        this._checkRange(range);\n        if (range.root == this._document.graveyard) {\n            // @if CK_DEBUG // console.warn( 'Trying to add a Range that is in the graveyard root. Range rejected.' );\n            return;\n        }\n        const liveRange = ModelLiveRange.fromRange(range);\n        // If selection range is moved to the graveyard remove it from the selection object.\n        // Also, save some data that can be used to restore selection later, on `Model#applyOperation` event.\n        liveRange.on('change:range', (evt, oldRange, data) => {\n            this._hasChangedRange = true;\n            if (liveRange.root == this._document.graveyard) {\n                this._selectionRestorePosition = data.deletionPosition;\n                const index = this._ranges.indexOf(liveRange);\n                this._ranges.splice(index, 1);\n                liveRange.detach();\n            }\n        });\n        return liveRange;\n    }\n    updateMarkers() {\n        if (!this._observedMarkers.size) {\n            return;\n        }\n        const markers = [];\n        let changed = false;\n        for (const marker of this._model.markers) {\n            const markerGroup = marker.name.split(':', 1)[0];\n            if (!this._observedMarkers.has(markerGroup)) {\n                continue;\n            }\n            const markerRange = marker.getRange();\n            for (const selectionRange of this.getRanges()) {\n                if (markerRange.containsRange(selectionRange, !selectionRange.isCollapsed)) {\n                    markers.push(marker);\n                }\n            }\n        }\n        const oldMarkers = Array.from(this.markers);\n        for (const marker of markers) {\n            if (!this.markers.has(marker)) {\n                this.markers.add(marker);\n                changed = true;\n            }\n        }\n        for (const marker of Array.from(this.markers)) {\n            if (!markers.includes(marker)) {\n                this.markers.remove(marker);\n                changed = true;\n            }\n        }\n        if (changed) {\n            this.fire('change:marker', { oldMarkers, directChange: false });\n        }\n    }\n    _updateMarker(marker, markerRange) {\n        const markerGroup = marker.name.split(':', 1)[0];\n        if (!this._observedMarkers.has(markerGroup)) {\n            return;\n        }\n        let changed = false;\n        const oldMarkers = Array.from(this.markers);\n        const hasMarker = this.markers.has(marker);\n        if (!markerRange) {\n            if (hasMarker) {\n                this.markers.remove(marker);\n                changed = true;\n            }\n        }\n        else {\n            let contained = false;\n            for (const selectionRange of this.getRanges()) {\n                if (markerRange.containsRange(selectionRange, !selectionRange.isCollapsed)) {\n                    contained = true;\n                    break;\n                }\n            }\n            if (contained && !hasMarker) {\n                this.markers.add(marker);\n                changed = true;\n            }\n            else if (!contained && hasMarker) {\n                this.markers.remove(marker);\n                changed = true;\n            }\n        }\n        if (changed) {\n            this.fire('change:marker', { oldMarkers, directChange: false });\n        }\n    }\n    /**\n     * Updates this selection attributes according to its ranges and the {@link module:engine/model/document~ModelDocument model document}.\n     */\n    _updateAttributes(clearAll) {\n        const newAttributes = toMap(this._getSurroundingAttributes());\n        const oldAttributes = toMap(this.getAttributes());\n        if (clearAll) {\n            // If `clearAll` remove all attributes and reset priorities.\n            this._attributePriority = new Map();\n            this._attrs = new Map();\n        }\n        else {\n            // If not, remove only attributes added with `low` priority.\n            for (const [key, priority] of this._attributePriority) {\n                if (priority == 'low') {\n                    this._attrs.delete(key);\n                    this._attributePriority.delete(key);\n                }\n            }\n        }\n        this._setAttributesTo(newAttributes);\n        // Let's evaluate which attributes really changed.\n        const changed = [];\n        // First, loop through all attributes that are set on selection right now.\n        // Check which of them are different than old attributes.\n        for (const [newKey, newValue] of this.getAttributes()) {\n            if (!oldAttributes.has(newKey) || oldAttributes.get(newKey) !== newValue) {\n                changed.push(newKey);\n            }\n        }\n        // Then, check which of old attributes got removed.\n        for (const [oldKey] of oldAttributes) {\n            if (!this.hasAttribute(oldKey)) {\n                changed.push(oldKey);\n            }\n        }\n        // Fire event with exact data (fire only if anything changed).\n        if (changed.length > 0) {\n            this.fire('change:attribute', { attributeKeys: changed, directChange: false });\n        }\n    }\n    /**\n     * Internal method for setting `LiveSelection` attribute. Supports attribute priorities (through `directChange`\n     * parameter).\n     */\n    _setAttribute(key, value, directChange = true) {\n        const priority = directChange ? 'normal' : 'low';\n        if (priority == 'low' && this._attributePriority.get(key) == 'normal') {\n            // Priority too low.\n            return false;\n        }\n        const oldValue = super.getAttribute(key);\n        // Don't do anything if value has not changed.\n        if (oldValue === value) {\n            return false;\n        }\n        this._attrs.set(key, value);\n        // Update priorities map.\n        this._attributePriority.set(key, priority);\n        return true;\n    }\n    /**\n     * Internal method for removing `LiveSelection` attribute. Supports attribute priorities (through `directChange`\n     * parameter).\n     *\n     * NOTE: Even if attribute is not present in the selection but is provided to this method, it's priority will\n     * be changed according to `directChange` parameter.\n     */\n    _removeAttribute(key, directChange = true) {\n        const priority = directChange ? 'normal' : 'low';\n        if (priority == 'low' && this._attributePriority.get(key) == 'normal') {\n            // Priority too low.\n            return false;\n        }\n        // Update priorities map.\n        this._attributePriority.set(key, priority);\n        // Don't do anything if value has not changed.\n        if (!super.hasAttribute(key)) {\n            return false;\n        }\n        this._attrs.delete(key);\n        return true;\n    }\n    /**\n     * Internal method for setting multiple `LiveSelection` attributes. Supports attribute priorities (through\n     * `directChange` parameter).\n     */\n    _setAttributesTo(attrs) {\n        const changed = new Set();\n        for (const [oldKey, oldValue] of this.getAttributes()) {\n            // Do not remove attribute if attribute with same key and value is about to be set.\n            if (attrs.get(oldKey) === oldValue) {\n                continue;\n            }\n            // All rest attributes will be removed so changed attributes won't change .\n            this._removeAttribute(oldKey, false);\n        }\n        for (const [key, value] of attrs) {\n            // Attribute may not be set because of attributes or because same key/value is already added.\n            const gotAdded = this._setAttribute(key, value, false);\n            if (gotAdded) {\n                changed.add(key);\n            }\n        }\n        return changed;\n    }\n    /**\n     * Returns an iterable that iterates through all selection attributes stored in current selection's parent.\n     */\n    *getStoredAttributes() {\n        const selectionParent = this.getFirstPosition().parent;\n        if (this.isCollapsed && selectionParent.isEmpty) {\n            for (const key of selectionParent.getAttributeKeys()) {\n                if (key.startsWith(storePrefix)) {\n                    const realKey = key.substr(storePrefix.length);\n                    yield [realKey, selectionParent.getAttribute(key)];\n                }\n            }\n        }\n    }\n    /**\n     * Checks model text nodes that are closest to the selection's first position and returns attributes of first\n     * found element. If there are no text nodes in selection's first position parent, it returns selection\n     * attributes stored in that parent.\n     */\n    _getSurroundingAttributes() {\n        const position = this.getFirstPosition();\n        const schema = this._model.schema;\n        if (position.root.rootName == '$graveyard') {\n            return null;\n        }\n        let attrs = null;\n        if (!this.isCollapsed) {\n            // 1. If selection is a range...\n            const range = this.getFirstRange();\n            // ...look for a first character node in that range and take attributes from it.\n            for (const value of range) {\n                // If the item is an object, we don't want to get attributes from its children...\n                if (value.item.is('element') && schema.isObject(value.item)) {\n                    // ...but collect attributes from inline object.\n                    attrs = getTextAttributes(value.item, schema);\n                    break;\n                }\n                if (value.type == 'text') {\n                    attrs = value.item.getAttributes();\n                    break;\n                }\n            }\n        }\n        else {\n            // 2. If the selection is a caret or the range does not contain a character node...\n            const nodeBefore = position.textNode ? position.textNode : position.nodeBefore;\n            const nodeAfter = position.textNode ? position.textNode : position.nodeAfter;\n            // When gravity is overridden then don't take node before into consideration.\n            if (!this.isGravityOverridden) {\n                // ...look at the node before caret and take attributes from it if it is a character node.\n                attrs = getTextAttributes(nodeBefore, schema);\n            }\n            // 3. If not, look at the node after caret...\n            if (!attrs) {\n                attrs = getTextAttributes(nodeAfter, schema);\n            }\n            // 4. If not, try to find the first character on the left, that is in the same node.\n            // When gravity is overridden then don't take node before into consideration.\n            if (!this.isGravityOverridden && !attrs) {\n                let node = nodeBefore;\n                while (node && !attrs) {\n                    node = node.previousSibling;\n                    attrs = getTextAttributes(node, schema);\n                }\n            }\n            // 5. If not found, try to find the first character on the right, that is in the same node.\n            if (!attrs) {\n                let node = nodeAfter;\n                while (node && !attrs) {\n                    node = node.nextSibling;\n                    attrs = getTextAttributes(node, schema);\n                }\n            }\n            // 6. If not found, selection should retrieve attributes from parent.\n            if (!attrs) {\n                attrs = this.getStoredAttributes();\n            }\n        }\n        return attrs;\n    }\n    /**\n     * Fixes the selection after all its ranges got removed.\n     * @param deletionPosition Position where the deletion happened.\n     */\n    _fixGraveyardSelection(deletionPosition) {\n        // Find a range that is a correct selection range and is closest to the position where the deletion happened.\n        const selectionRange = this._model.schema.getNearestSelectionRange(deletionPosition);\n        // If nearest valid selection range has been found - add it in the place of old range.\n        if (selectionRange) {\n            // Check the range, convert it to live range, bind events, etc.\n            this._pushRange(selectionRange);\n        }\n        // If nearest valid selection range cannot be found don't add any range. Selection will be set to the default range.\n    }\n}\n/**\n * Helper function for {@link module:engine/model/liveselection~LiveSelection#_updateAttributes}.\n *\n * It checks if the passed model item is a text node (or text proxy) and, if so, returns it's attributes.\n * If not, it checks if item is an inline object and does the same. Otherwise it returns `null`.\n */\nfunction getTextAttributes(node, schema) {\n    if (!node) {\n        return null;\n    }\n    if (node instanceof ModelTextProxy || node instanceof ModelText) {\n        return node.getAttributes();\n    }\n    if (!schema.isInline(node)) {\n        return null;\n    }\n    // Stop on inline elements (such as `<softBreak>`) that are not objects (such as `<imageInline>` or `<mathml>`).\n    if (!schema.isObject(node)) {\n        return [];\n    }\n    const attributes = [];\n    // Collect all attributes that can be applied to the text node.\n    for (const [key, value] of node.getAttributes()) {\n        if (schema.checkAttribute('$text', key) &&\n            schema.getAttributeProperties(key).copyFromObject !== false) {\n            attributes.push([key, value]);\n        }\n    }\n    return attributes;\n}\n/**\n * Removes selection attributes from element which is not empty anymore.\n */\nfunction clearAttributesStoredInElement(model, batch) {\n    const differ = model.document.differ;\n    for (const entry of differ.getChanges()) {\n        if (entry.type != 'insert') {\n            continue;\n        }\n        const changeParent = entry.position.parent;\n        const isNoLongerEmpty = entry.length === changeParent.maxOffset;\n        if (isNoLongerEmpty) {\n            model.enqueueChange(batch, writer => {\n                const storedAttributes = Array.from(changeParent.getAttributeKeys())\n                    .filter(key => key.startsWith(storePrefix));\n                for (const key of storedAttributes) {\n                    writer.removeAttribute(key, changeParent);\n                }\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/nodelist\n */\nimport { ModelNode } from './node.js';\nimport { CKEditorError, spliceArray } from '@ckeditor/ckeditor5-utils';\n/**\n * Provides an interface to operate on a list of {@link module:engine/model/node~ModelNode nodes}. `NodeList` is used internally\n * in classes like {@link module:engine/model/element~ModelElement Element}\n * or {@link module:engine/model/documentfragment~ModelDocumentFragment ModelDocumentFragment}.\n */\nexport class ModelNodeList {\n    /**\n     * Nodes contained in this node list.\n     */\n    _nodes = [];\n    /**\n     * This array maps numbers (offsets) to node that is placed at that offset.\n     *\n     * This array is similar to `_nodes` with the difference that one node may occupy multiple consecutive items in the array.\n     *\n     * This array is needed to quickly retrieve a node that is placed at given offset.\n     */\n    _offsetToNode = [];\n    /**\n     * Creates a node list.\n     *\n     * @internal\n     * @param nodes Nodes contained in this node list.\n     */\n    constructor(nodes) {\n        if (nodes) {\n            this._insertNodes(0, nodes);\n        }\n    }\n    /**\n     * Iterable interface.\n     *\n     * Iterates over all nodes contained inside this node list.\n     */\n    [Symbol.iterator]() {\n        return this._nodes[Symbol.iterator]();\n    }\n    /**\n     * Number of nodes contained inside this node list.\n     */\n    get length() {\n        return this._nodes.length;\n    }\n    /**\n     * Sum of {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all nodes contained inside this node list.\n     */\n    get maxOffset() {\n        return this._offsetToNode.length;\n    }\n    /**\n     * Gets the node at the given index. Returns `null` if incorrect index was passed.\n     */\n    getNode(index) {\n        return this._nodes[index] || null;\n    }\n    /**\n     * Gets the node at the given offset. Returns `null` if incorrect offset was passed.\n     */\n    getNodeAtOffset(offset) {\n        return this._offsetToNode[offset] || null;\n    }\n    /**\n     * Returns an index of the given node or `null` if given node does not have a parent.\n     *\n     * This is an alias to {@link module:engine/model/node~ModelNode#index}.\n     */\n    getNodeIndex(node) {\n        return node.index;\n    }\n    /**\n     * Returns the offset at which given node is placed in its parent or `null` if given node does not have a parent.\n     *\n     * This is an alias to {@link module:engine/model/node~ModelNode#startOffset}.\n     */\n    getNodeStartOffset(node) {\n        return node.startOffset;\n    }\n    /**\n     * Converts index to offset in node list.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `model-nodelist-index-out-of-bounds` if given index is less\n     * than `0` or more than {@link #length}.\n     */\n    indexToOffset(index) {\n        if (index == this._nodes.length) {\n            return this.maxOffset;\n        }\n        const node = this._nodes[index];\n        if (!node) {\n            /**\n             * Given index cannot be found in the node list.\n             *\n             * @error model-nodelist-index-out-of-bounds\n             */\n            throw new CKEditorError('model-nodelist-index-out-of-bounds', this);\n        }\n        return this.getNodeStartOffset(node);\n    }\n    /**\n     * Converts offset in node list to index.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `model-nodelist-offset-out-of-bounds` if given offset is less\n     * than `0` or more than {@link #maxOffset}.\n     */\n    offsetToIndex(offset) {\n        if (offset == this._offsetToNode.length) {\n            return this._nodes.length;\n        }\n        const node = this._offsetToNode[offset];\n        if (!node) {\n            /**\n             * Given offset cannot be found in the node list.\n             *\n             * @error model-nodelist-offset-out-of-bounds\n             * @param {number} offset The offset value.\n             * @param {module:engine/model/nodelist~ModelNodeList} nodeList Stringified node list.\n             */\n            throw new CKEditorError('model-nodelist-offset-out-of-bounds', this, {\n                offset,\n                nodeList: this\n            });\n        }\n        return this.getNodeIndex(node);\n    }\n    /**\n     * Inserts given nodes at given index.\n     *\n     * @internal\n     * @param index Index at which nodes should be inserted.\n     * @param nodes Nodes to be inserted.\n     */\n    _insertNodes(index, nodes) {\n        const nodesArray = [];\n        // Validation.\n        for (const node of nodes) {\n            if (!(node instanceof ModelNode)) {\n                /**\n                 * Trying to insert an object which is not a Node instance.\n                 *\n                 * @error model-nodelist-insertnodes-not-node\n                 */\n                throw new CKEditorError('model-nodelist-insertnodes-not-node', this);\n            }\n            nodesArray.push(node);\n        }\n        let offset = this.indexToOffset(index);\n        // Splice nodes array and offsets array into the nodelist.\n        spliceArray(this._nodes, nodesArray, index);\n        spliceArray(this._offsetToNode, makeOffsetsArray(nodesArray), offset);\n        // Refresh indexes and offsets for nodes inside this node list. We need to do this for all inserted nodes and all nodes after them.\n        for (let i = index; i < this._nodes.length; i++) {\n            this._nodes[i]._index = i;\n            this._nodes[i]._startOffset = offset;\n            offset += this._nodes[i].offsetSize;\n        }\n    }\n    /**\n     * Removes one or more nodes starting at the given index.\n     *\n     * @internal\n     * @param indexStart Index of the first node to remove.\n     * @param howMany Number of nodes to remove.\n     * @returns Array containing removed nodes.\n     */\n    _removeNodes(indexStart, howMany = 1) {\n        if (howMany == 0) {\n            return [];\n        }\n        // Remove nodes from this nodelist.\n        let offset = this.indexToOffset(indexStart);\n        const nodes = this._nodes.splice(indexStart, howMany);\n        const lastNode = nodes[nodes.length - 1];\n        const removedOffsetSum = lastNode.startOffset + lastNode.offsetSize - offset;\n        this._offsetToNode.splice(offset, removedOffsetSum);\n        // Reset index and start offset properties for the removed nodes -- they do not have a parent anymore.\n        for (const node of nodes) {\n            node._index = null;\n            node._startOffset = null;\n        }\n        for (let i = indexStart; i < this._nodes.length; i++) {\n            this._nodes[i]._index = i;\n            this._nodes[i]._startOffset = offset;\n            offset += this._nodes[i].offsetSize;\n        }\n        return nodes;\n    }\n    /**\n     * Removes children nodes provided as an array. These nodes do not need to be direct siblings.\n     *\n     * This method is faster than removing nodes one by one, as it recalculates offsets only once.\n     *\n     * @internal\n     * @param nodes Array of nodes.\n     */\n    _removeNodesArray(nodes) {\n        if (nodes.length == 0) {\n            return;\n        }\n        for (const node of nodes) {\n            node._index = null;\n            node._startOffset = null;\n        }\n        this._nodes = this._nodes.filter(node => node.index !== null);\n        this._offsetToNode = this._offsetToNode.filter(node => node.index !== null);\n        let offset = 0;\n        for (let i = 0; i < this._nodes.length; i++) {\n            this._nodes[i]._index = i;\n            this._nodes[i]._startOffset = offset;\n            offset += this._nodes[i].offsetSize;\n        }\n    }\n    /**\n     * Converts `NodeList` instance to an array containing nodes that were inserted in the node list. Nodes\n     * are also converted to their plain object representation.\n     *\n     * @returns `NodeList` instance converted to `Array`.\n     */\n    toJSON() {\n        return this._nodes.map(node => node.toJSON());\n    }\n}\n/**\n * Creates an array of nodes in the format as in {@link module:engine/model/nodelist~ModelNodeList#_offsetToNode}, i.e. one node will\n * occupy multiple items if its offset size is greater than one.\n */\nfunction makeOffsetsArray(nodes) {\n    const offsets = [];\n    let index = 0;\n    for (const node of nodes) {\n        for (let i = 0; i < node.offsetSize; i++) {\n            offsets[index++] = node;\n        }\n    }\n    return offsets;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/element\n */\nimport { ModelNode } from './node.js';\nimport { ModelNodeList } from './nodelist.js';\nimport { ModelText } from './text.js';\nimport { ModelTextProxy } from './textproxy.js';\nimport { isIterable } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const { stringifyMap, convertMapToStringifiedObject, convertMapToTags } = require( '../dev-utils/utils' );\n/**\n * Model element. Type of {@link module:engine/model/node~ModelNode node} that has a\n * {@link module:engine/model/element~ModelElement#name name} and {@link module:engine/model/element~ModelElement#getChildren child nodes}.\n *\n * **Important**: see {@link module:engine/model/node~ModelNode} to read about restrictions using `Element` and `Node` API.\n */\nexport class ModelElement extends ModelNode {\n    /**\n     * Element name.\n     */\n    name;\n    /**\n     * List of children nodes.\n     */\n    _children = new ModelNodeList();\n    /**\n     * Creates a model element.\n     *\n     * **Note:** Constructor of this class shouldn't be used directly in the code.\n     * Use the {@link module:engine/model/writer~ModelWriter#createElement} method instead.\n     *\n     * @internal\n     * @param name Element's name.\n     * @param attrs Element's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.\n     * @param children One or more nodes to be inserted as children of created element.\n     */\n    constructor(name, attrs, children) {\n        super(attrs);\n        this.name = name;\n        if (children) {\n            this._insertChild(0, children);\n        }\n    }\n    /**\n     * Number of this element's children.\n     */\n    get childCount() {\n        return this._children.length;\n    }\n    /**\n     * Sum of {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all of this element's children.\n     */\n    get maxOffset() {\n        return this._children.maxOffset;\n    }\n    /**\n     * Is `true` if there are no nodes inside this element, `false` otherwise.\n     */\n    get isEmpty() {\n        return this.childCount === 0;\n    }\n    /**\n     * Gets the child at the given index. Returns `null` if incorrect index was passed.\n     *\n     * @param index Index in this element.\n     * @returns Child node.\n     */\n    getChild(index) {\n        return this._children.getNode(index);\n    }\n    /**\n     * Gets the child at the given offset. Returns `null` if incorrect index was passed.\n     *\n     * @param offset Offset in this element.\n     * @returns Child node.\n     */\n    getChildAtOffset(offset) {\n        return this._children.getNodeAtOffset(offset);\n    }\n    /**\n     * Returns an iterator that iterates over all of this element's children.\n     */\n    getChildren() {\n        return this._children[Symbol.iterator]();\n    }\n    /**\n     * Returns an index of the given child node. Returns `null` if given node is not a child of this element.\n     *\n     * @param node Child node to look for.\n     * @returns Child node's index in this element.\n     */\n    getChildIndex(node) {\n        return this._children.getNodeIndex(node);\n    }\n    /**\n     * Returns the starting offset of given child. Starting offset is equal to the sum of\n     * {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all node's siblings that are before it. Returns `null` if\n     * given node is not a child of this element.\n     *\n     * @param node Child node to look for.\n     * @returns Child node's starting offset.\n     */\n    getChildStartOffset(node) {\n        return this._children.getNodeStartOffset(node);\n    }\n    /**\n     * Returns index of a node that occupies given offset. If given offset is too low, returns `0`. If given offset is\n     * too high, returns {@link module:engine/model/element~ModelElement#getChildIndex index after last child}.\n     *\n     * ```ts\n     * const textNode = new Text( 'foo' );\n     * const pElement = new Element( 'p' );\n     * const divElement = new Element( [ textNode, pElement ] );\n     * divElement.offsetToIndex( -1 ); // Returns 0, because offset is too low.\n     * divElement.offsetToIndex( 0 ); // Returns 0, because offset 0 is taken by `textNode` which is at index 0.\n     * divElement.offsetToIndex( 1 ); // Returns 0, because `textNode` has `offsetSize` equal to 3, so it occupies offset 1 too.\n     * divElement.offsetToIndex( 2 ); // Returns 0.\n     * divElement.offsetToIndex( 3 ); // Returns 1.\n     * divElement.offsetToIndex( 4 ); // Returns 2. There are no nodes at offset 4, so last available index is returned.\n     * ```\n     */\n    offsetToIndex(offset) {\n        return this._children.offsetToIndex(offset);\n    }\n    /**\n     * Returns a descendant node by its path relative to this element.\n     *\n     * ```ts\n     * // <this>a<b>c</b></this>\n     * this.getNodeByPath( [ 0 ] );     // -> \"a\"\n     * this.getNodeByPath( [ 1 ] );     // -> <b>\n     * this.getNodeByPath( [ 1, 0 ] );  // -> \"c\"\n     * ```\n     *\n     * @param relativePath Path of the node to find, relative to this element.\n     */\n    getNodeByPath(relativePath) {\n        // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n        let node = this;\n        for (const offset of relativePath) {\n            node = node.getChildAtOffset(offset);\n        }\n        return node;\n    }\n    /**\n     * Returns the parent element of the given name. Returns null if the element is not inside the desired parent.\n     *\n     * @param parentName The name of the parent element to find.\n     * @param options Options object.\n     * @param options.includeSelf When set to `true` this node will be also included while searching.\n     */\n    findAncestor(parentName, options = {}) {\n        let parent = options.includeSelf ? this : this.parent;\n        while (parent) {\n            if (parent.name === parentName) {\n                return parent;\n            }\n            parent = parent.parent;\n        }\n        return null;\n    }\n    /**\n     * Converts `Element` instance to plain object and returns it. Takes care of converting all of this element's children.\n     *\n     * @returns `Element` instance converted to plain object.\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.name = this.name;\n        if (this._children.length > 0) {\n            json.children = [];\n            for (const node of this._children) {\n                json.children.push(node.toJSON());\n            }\n        }\n        return json;\n    }\n    /**\n     * Creates a copy of this element and returns it. Created element has the same name and attributes as the original element.\n     * If clone is deep, the original element's children are also cloned. If not, then empty element is returned.\n     *\n     * @internal\n     * @param deep If set to `true` clones element and all its children recursively. When set to `false`,\n     * element will be cloned without any child.\n     */\n    _clone(deep = false) {\n        const children = deep ? cloneNodes(this._children) : undefined;\n        return new ModelElement(this.name, this.getAttributes(), children);\n    }\n    /**\n     * {@link module:engine/model/element~ModelElement#_insertChild Inserts} one or more nodes at the end of this element.\n     *\n     * @see module:engine/model/writer~ModelWriter#append\n     * @internal\n     * @param nodes Nodes to be inserted.\n     */\n    _appendChild(nodes) {\n        this._insertChild(this.childCount, nodes);\n    }\n    /**\n     * Inserts one or more nodes at the given index and sets {@link module:engine/model/node~ModelNode#parent parent} of these nodes\n     * to this element.\n     *\n     * @see module:engine/model/writer~ModelWriter#insert\n     * @internal\n     * @param index Index at which nodes should be inserted.\n     * @param items Items to be inserted.\n     */\n    _insertChild(index, items) {\n        const nodes = normalize(items);\n        for (const node of nodes) {\n            // If node that is being added to this element is already inside another element, first remove it from the old parent.\n            if (node.parent !== null) {\n                node._remove();\n            }\n            node.parent = this;\n        }\n        this._children._insertNodes(index, nodes);\n    }\n    /**\n     * Removes one or more nodes starting at the given index and sets\n     * {@link module:engine/model/node~ModelNode#parent parent} of these nodes to `null`.\n     *\n     * @see module:engine/model/writer~ModelWriter#remove\n     * @internal\n     * @param index Index of the first node to remove.\n     * @param howMany Number of nodes to remove.\n     * @returns Array containing removed nodes.\n     */\n    _removeChildren(index, howMany = 1) {\n        const nodes = this._children._removeNodes(index, howMany);\n        for (const node of nodes) {\n            node.parent = null;\n        }\n        return nodes;\n    }\n    /**\n     * Removes children nodes provided as an array and sets\n     * the {@link module:engine/model/node~ModelNode#parent parent} of these nodes to `null`.\n     *\n     * These nodes do not need to be direct siblings.\n     *\n     * This method is faster than removing nodes one by one, as it recalculates offsets only once.\n     *\n     * @internal\n     * @param nodes Array of nodes.\n     */\n    _removeChildrenArray(nodes) {\n        this._children._removeNodesArray(nodes);\n        for (const node of nodes) {\n            node.parent = null;\n        }\n    }\n    /**\n     * Creates an `Element` instance from given plain object (i.e. parsed JSON string).\n     * Converts `Element` children to proper nodes.\n     *\n     * @param json Plain object to be converted to `Element`.\n     * @returns `Element` instance created using given plain object.\n     */\n    static fromJSON(json) {\n        let children;\n        if (json.children) {\n            children = [];\n            for (const child of json.children) {\n                if (child.name) {\n                    // If child has name property, it is an Element.\n                    children.push(ModelElement.fromJSON(child));\n                }\n                else {\n                    // Otherwise, it is a Text node.\n                    children.push(ModelText.fromJSON(child));\n                }\n            }\n        }\n        return new ModelElement(json.name, json.attributes, children);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'element' || type === 'model:element' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'node' || type === 'model:node';\n    }\n    return name === this.name && (type === 'element' || type === 'model:element');\n};\n/**\n * Converts strings to Text and non-iterables to arrays.\n */\nfunction normalize(nodes) {\n    // Separate condition because string is iterable.\n    if (typeof nodes == 'string') {\n        return [new ModelText(nodes)];\n    }\n    if (!isIterable(nodes)) {\n        nodes = [nodes];\n    }\n    const normalizedNodes = [];\n    for (const node of nodes) {\n        if (typeof node == 'string') {\n            normalizedNodes.push(new ModelText(node));\n        }\n        else if (node instanceof ModelTextProxy) {\n            normalizedNodes.push(new ModelText(node.data, node.getAttributes()));\n        }\n        else {\n            normalizedNodes.push(node);\n        }\n    }\n    return normalizedNodes;\n}\nfunction cloneNodes(nodes) {\n    const clonedNodes = [];\n    for (const node of nodes) {\n        clonedNodes.push(node._clone(true));\n    }\n    return clonedNodes;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/conversionhelpers\n */\n/**\n * Base class for conversion helpers.\n */\nexport class ConversionHelpers {\n    _dispatchers;\n    /**\n     * Creates a conversion helpers instance.\n     */\n    constructor(dispatchers) {\n        this._dispatchers = dispatchers;\n    }\n    /**\n     * Registers a conversion helper.\n     *\n     * **Note**: See full usage example in the `{@link module:engine/conversion/conversion~Conversion#for conversion.for()}`\n     * method description.\n     *\n     * @param conversionHelper The function to be called on event.\n     */\n    add(conversionHelper) {\n        for (const dispatcher of this._dispatchers) {\n            conversionHelper(dispatcher);\n        }\n        return this;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Contains downcast (model-to-view) converters for {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}.\n *\n * @module engine/conversion/downcasthelpers\n */\nimport { ModelRange } from '../model/range.js';\nimport { ModelSelection } from '../model/selection.js';\nimport { ModelDocumentSelection } from '../model/documentselection.js';\nimport { ModelElement } from '../model/element.js';\nimport { ModelPosition } from '../model/position.js';\nimport { ViewAttributeElement } from '../view/attributeelement.js';\nimport { ConversionHelpers } from './conversionhelpers.js';\nimport { StylesMap } from '../view/stylesmap.js';\nimport { CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';\nimport { cloneDeep } from 'es-toolkit/compat';\n/**\n * Downcast conversion helper functions.\n *\n * Learn more about {@glink framework/deep-dive/conversion/downcast downcast helpers}.\n *\n * @extends module:engine/conversion/conversionhelpers~ConversionHelpers\n */\nexport class DowncastHelpers extends ConversionHelpers {\n    /**\n     * Model element to view element conversion helper.\n     *\n     * This conversion results in creating a view element. For example, model `<paragraph>Foo</paragraph>` becomes `<p>Foo</p>` in the view.\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).elementToElement( {\n     * \tmodel: 'paragraph',\n     * \tview: 'p'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).elementToElement( {\n     * \tmodel: 'paragraph',\n     * \tview: 'div',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).elementToElement( {\n     * \tmodel: 'fancyParagraph',\n     * \tview: {\n     * \t\tname: 'p',\n     * \t\tclasses: 'fancy'\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).elementToElement( {\n     * \tmodel: 'heading',\n     * \tview: ( modelElement, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\treturn writer.createContainerElement( 'h' + modelElement.getAttribute( 'level' ) );\n     * \t}\n     * } );\n     * ```\n     *\n     * The element-to-element conversion supports the reconversion mechanism. It can be enabled by using either the `attributes` or\n     * the `children` props on a model description. You will find a couple examples below.\n     *\n     * In order to reconvert an element if any of its direct children have been added or removed, use the `children` property on a `model`\n     * description. For example, this model:\n     *\n     * ```xml\n     * <box>\n     * \t<paragraph>Some text.</paragraph>\n     * </box>\n     * ```\n     *\n     * will be converted into this structure in the view:\n     *\n     * ```html\n     * <div class=\"box\" data-type=\"single\">\n     * \t<p>Some text.</p>\n     * </div>\n     * ```\n     *\n     * But if more items were inserted in the model:\n     *\n     * ```xml\n     * <box>\n     * \t<paragraph>Some text.</paragraph>\n     * \t<paragraph>Other item.</paragraph>\n     * </box>\n     * ```\n     *\n     * it will be converted into this structure in the view (note the element `data-type` change):\n     *\n     * ```html\n     * <div class=\"box\" data-type=\"multiple\">\n     * \t<p>Some text.</p>\n     * \t<p>Other item.</p>\n     * </div>\n     * ```\n     *\n     * Such a converter would look like this (note that the `paragraph` elements are converted separately):\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).elementToElement( {\n     * \tmodel: {\n     * \t\tname: 'box',\n     * \t\tchildren: true\n     * \t},\n     * \tview: ( modelElement, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\treturn writer.createContainerElement( 'div', {\n     * \t\t\tclass: 'box',\n     * \t\t\t'data-type': modelElement.childCount == 1 ? 'single' : 'multiple'\n     * \t\t} );\n     * \t}\n     * } );\n     * ```\n     *\n     * In order to reconvert element if any of its attributes have been updated, use the `attributes` property on a `model`\n     * description. For example, this model:\n     *\n     * ```xml\n     * <heading level=\"2\">Some text.</heading>\n     * ```\n     *\n     * will be converted into this structure in the view:\n     *\n     * ```html\n     * <h2>Some text.</h2>\n     * ```\n     *\n     * But if the `heading` element's `level` attribute has been updated to `3` for example, then\n     * it will be converted into this structure in the view:\n     *\n     * ```html\n     * <h3>Some text.</h3>\n     * ```\n     *\n     * Such a converter would look as follows:\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).elementToElement( {\n     * \tmodel: {\n     * \t\tname: 'heading',\n     * \t\tattributes: 'level'\n     * \t},\n     * \tview: ( modelElement, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\treturn writer.createContainerElement( 'h' + modelElement.getAttribute( 'level' ) );\n     * \t}\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * You can read more about the element-to-element conversion in the\n     * {@glink framework/deep-dive/conversion/downcast downcast conversion} guide.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The description or a name of the model element to convert.\n     * @param config.view A view element definition or a function that takes the model element and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API}\n     * as parameters and returns a view container element.\n     * @param config.converterPriority Converter priority.\n     */\n    elementToElement(config) {\n        return this.add(downcastElementToElement(config));\n    }\n    /**\n     * The model element to view structure (several elements) conversion helper.\n     *\n     * This conversion results in creating a view structure with one or more slots defined for the child nodes.\n     * For example, a model `<table>` may become this structure in the view:\n     *\n     * ```html\n     * <figure class=\"table\">\n     * \t<table>\n     * \t\t<tbody>${ slot for table rows }</tbody>\n     * \t</table>\n     * </figure>\n     * ```\n     *\n     * The children of the model's `<table>` element will be inserted into the `<tbody>` element.\n     * If the `elementToElement()` helper was used, the children would be inserted into the `<figure>`.\n     *\n     * Imagine a table feature where for this model structure:\n     *\n     * ```xml\n     * <table headingRows=\"1\">\n     * \t<tableRow> ... table cells 1 ... </tableRow>\n     * \t<tableRow> ... table cells 2 ... </tableRow>\n     * \t<tableRow> ... table cells 3 ... </tableRow>\n     * \t<caption>Caption text</caption>\n     * </table>\n     * ```\n     *\n     * we want to generate this view structure:\n     *\n     * ```html\n     * <figure class=\"table\">\n     * \t<table>\n     * \t\t<thead>\n     * \t\t\t<tr> ... table cells 1 ... </tr>\n     * \t\t</thead>\n     * \t\t<tbody>\n     * \t\t\t<tr> ... table cells 2 ... </tr>\n     * \t\t\t<tr> ... table cells 3 ... </tr>\n     * \t\t</tbody>\n     * \t</table>\n     * \t<figcaption>Caption text</figcaption>\n     * </figure>\n     * ```\n     *\n     * The converter has to take the `headingRows` attribute into consideration when allocating the `<tableRow>` elements\n     * into the `<tbody>` and `<thead>` elements. Hence, we need two slots and need to define proper filter callbacks for them.\n     *\n     * Additionally, all elements other than `<tableRow>` should be placed outside the `<table>` tag.\n     * In the example above, this will handle the table caption.\n     *\n     * Such a converter would look like this:\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).elementToStructure( {\n     * \tmodel: {\n     * \t\tname: 'table',\n     * \t\tattributes: [ 'headingRows' ]\n     * \t},\n     * \tview: ( modelElement, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\tconst figureElement = writer.createContainerElement( 'figure', { class: 'table' } );\n     * \t\tconst tableElement = writer.createContainerElement( 'table' );\n     *\n     * \t\twriter.insert( writer.createPositionAt( figureElement, 0 ), tableElement );\n     *\n     * \t\tconst headingRows = modelElement.getAttribute( 'headingRows' ) || 0;\n     *\n     * \t\tif ( headingRows > 0 ) {\n     * \t\t\tconst tableHead = writer.createContainerElement( 'thead' );\n     *\n     * \t\t\tconst headSlot = writer.createSlot( node => node.is( 'element', 'tableRow' ) && node.index < headingRows );\n     *\n     * \t\t\twriter.insert( writer.createPositionAt( tableElement, 'end' ), tableHead );\n     * \t\t\twriter.insert( writer.createPositionAt( tableHead, 0 ), headSlot );\n     * \t\t}\n     *\n     * \t\tif ( headingRows < tableUtils.getRows( table ) ) {\n     * \t\t\tconst tableBody = writer.createContainerElement( 'tbody' );\n     *\n     * \t\t\tconst bodySlot = writer.createSlot( node => node.is( 'element', 'tableRow' ) && node.index >= headingRows );\n     *\n     * \t\t\twriter.insert( writer.createPositionAt( tableElement, 'end' ), tableBody );\n     * \t\t\twriter.insert( writer.createPositionAt( tableBody, 0 ), bodySlot );\n     * \t\t}\n     *\n     * \t\tconst restSlot = writer.createSlot( node => !node.is( 'element', 'tableRow' ) );\n     *\n     * \t\twriter.insert( writer.createPositionAt( figureElement, 'end' ), restSlot );\n     *\n     * \t\treturn figureElement;\n     * \t}\n     * } );\n     * ```\n     *\n     * Note: The children of a model element that's being converted must be allocated in the same order in the view\n     * in which they are placed in the model.\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The description or a name of the model element to convert.\n     * @param config.view A function that takes the model element and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as parameters\n     * and returns a view container element with slots for model child nodes to be converted into.\n     * @param config.converterPriority Converter priority.\n     */\n    elementToStructure(config) {\n        return this.add(downcastElementToStructure(config));\n    }\n    /**\n     * Model attribute to view element conversion helper.\n     *\n     * This conversion results in wrapping view nodes with a view attribute element. For example, a model text node with\n     * `\"Foo\"` as data and the `bold` attribute becomes `<strong>Foo</strong>` in the view.\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).attributeToElement( {\n     * \tmodel: 'bold',\n     * \tview: 'strong'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToElement( {\n     * \tmodel: 'bold',\n     * \tview: 'b',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToElement( {\n     * \tmodel: 'invert',\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tclasses: [ 'font-light', 'bg-dark' ]\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToElement( {\n     * \tmodel: {\n     * \t\tkey: 'fontSize',\n     * \t\tvalues: [ 'big', 'small' ]\n     * \t},\n     * \tview: {\n     * \t\tbig: {\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'font-size': '1.2em'\n     * \t\t\t}\n     * \t\t},\n     * \t\tsmall: {\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'font-size': '0.8em'\n     * \t\t\t}\n     * \t\t}\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToElement( {\n     * \tmodel: 'bold',\n     * \tview: ( modelAttributeValue, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\treturn writer.createAttributeElement( 'span', {\n     * \t\t\tstyle: 'font-weight:' + modelAttributeValue\n     * \t\t} );\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToElement( {\n     * \tmodel: {\n     * \t\tkey: 'color',\n     * \t\tname: '$text'\n     * \t},\n     * \tview: ( modelAttributeValue, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\treturn writer.createAttributeElement( 'span', {\n     * \t\t\tstyle: 'color:' + modelAttributeValue\n     * \t\t} );\n     * \t}\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The key of the attribute to convert from or a `{ key, values }` object. `values` is an array\n     * of `String`s with possible values if the model attribute is an enumerable.\n     * @param config.view A view element definition or a function\n     * that takes the model attribute value and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as parameters and returns a view\n     * attribute element. If `config.model.values` is given, `config.view` should be an object assigning values from `config.model.values`\n     * to view element definitions or functions.\n     * @param config.converterPriority Converter priority.\n     */\n    attributeToElement(config) {\n        return this.add(downcastAttributeToElement(config));\n    }\n    /**\n     * Model attribute to view attribute conversion helper.\n     *\n     * This conversion results in adding an attribute to a view node, basing on an attribute from a model node. For example,\n     * `<imageInline src='foo.jpg'></imageInline>` is converted to `<img src='foo.jpg'></img>`.\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n     * \tmodel: 'source',\n     * \tview: 'src'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n     * \tmodel: 'source',\n     * \tview: 'href',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n     * \tmodel: {\n     * \t\tname: 'imageInline',\n     * \t\tkey: 'source'\n     * \t},\n     * \tview: 'src'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n     * \tmodel: {\n     * \t\tname: 'styled',\n     * \t\tvalues: [ 'dark', 'light' ]\n     * \t},\n     * \tview: {\n     * \t\tdark: {\n     * \t\t\tkey: 'class',\n     * \t\t\tvalue: [ 'styled', 'styled-dark' ]\n     * \t\t},\n     * \t\tlight: {\n     * \t\t\tkey: 'class',\n     * \t\t\tvalue: [ 'styled', 'styled-light' ]\n     * \t\t}\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n     * \tmodel: 'styled',\n     * \tview: modelAttributeValue => ( {\n     * \t\tkey: 'class',\n     * \t\tvalue: 'styled-' + modelAttributeValue\n     * \t} )\n     * } );\n     * ```\n     *\n     * **Note**: Downcasting to a style property requires providing `value` as an object:\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n     * \tmodel: 'lineHeight',\n     * \tview: modelAttributeValue => ( {\n     * \t\tkey: 'style',\n     * \t\tvalue: {\n     * \t\t\t'line-height': modelAttributeValue,\n     * \t\t\t'border-bottom': '1px dotted #ba2'\n     * \t\t}\n     * \t} )\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The key of the attribute to convert from or a `{ key, values, [ name ] }` object describing\n     * the attribute key, possible values and, optionally, an element name to convert from.\n     * @param config.view A view attribute key, or a `{ key, value }` object or a function that takes the model attribute value and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API}\n     * as parameters and returns a `{ key, value }` object. If the `key` is `'class'`, the `value` can be a `String` or an\n     * array of `String`s. If the `key` is `'style'`, the `value` is an object with key-value pairs. In other cases, `value` is a `String`.\n     * If `config.model.values` is set, `config.view` should be an object assigning values from `config.model.values` to\n     * `{ key, value }` objects or a functions.\n     * @param config.converterPriority Converter priority.\n     */\n    attributeToAttribute(config) {\n        return this.add(downcastAttributeToAttribute(config));\n    }\n    /**\n     * Model marker to view element conversion helper.\n     *\n     * **Note**: This method should be used mainly for editing the downcast and it is recommended\n     * to use the {@link #markerToData `#markerToData()`} helper instead.\n     *\n     * This helper may produce invalid HTML code (e.g. a span between table cells).\n     * It should only be used when you are sure that the produced HTML will be semantically correct.\n     *\n     * This conversion results in creating a view element on the boundaries of the converted marker. If the converted marker\n     * is collapsed, only one element is created. For example, a model marker set like this: `<paragraph>F[oo b]ar</paragraph>`\n     * becomes `<p>F<span data-marker=\"search\"></span>oo b<span data-marker=\"search\"></span>ar</p>` in the view.\n     *\n     * ```ts\n     * editor.conversion.for( 'editingDowncast' ).markerToElement( {\n     * \tmodel: 'search',\n     * \tview: 'marker-search'\n     * } );\n     *\n     * editor.conversion.for( 'editingDowncast' ).markerToElement( {\n     * \tmodel: 'search',\n     * \tview: 'search-result',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'editingDowncast' ).markerToElement( {\n     * \tmodel: 'search',\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tattributes: {\n     * \t\t\t'data-marker': 'search'\n     * \t\t}\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'editingDowncast' ).markerToElement( {\n     * \tmodel: 'search',\n     * \tview: ( markerData, conversionApi ) => {\n     * \t\tconst { writer } = conversionApi;\n     *\n     * \t\treturn writer.createUIElement( 'span', {\n     * \t\t\t'data-marker': 'search',\n     * \t\t\t'data-start': markerData.isOpening\n     * \t\t} );\n     * \t}\n     * } );\n     * ```\n     *\n     * If a function is passed as the `config.view` parameter, it will be used to generate both boundary elements. The function\n     * receives the `data` object and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API}\n     * as a parameters and should return an instance of the\n     * {@link module:engine/view/uielement~ViewUIElement view UI element}. The `data` object and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi `conversionApi`} are passed from\n     * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker}. Additionally,\n     * the `data.isOpening` parameter is passed, which is set to `true` for the marker start boundary element, and `false` for\n     * the marker end boundary element.\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The name of the model marker (or model marker group) to convert.\n     * @param config.view A view element definition or a function that takes the model marker data and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as a parameters\n     * and returns a view UI element.\n     * @param config.converterPriority Converter priority.\n     */\n    markerToElement(config) {\n        return this.add(downcastMarkerToElement(config));\n    }\n    /**\n     * Model marker to highlight conversion helper.\n     *\n     * This conversion results in creating a highlight on view nodes. For this kind of conversion,\n     * the {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor} should be provided.\n     *\n     * For text nodes, a `<span>` {@link module:engine/view/attributeelement~ViewAttributeElement} is created and it wraps all text nodes\n     * in the converted marker range. For example, a model marker set like this: `<paragraph>F[oo b]ar</paragraph>` becomes\n     * `<p>F<span class=\"comment\">oo b</span>ar</p>` in the view.\n     *\n     * {@link module:engine/view/containerelement~ViewContainerElement} may provide a custom way of handling highlight. Most often,\n     * the element itself is given classes and attributes described in the highlight descriptor (instead of being wrapped in `<span>`).\n     * For example, a model marker set like this:\n     * `[<imageInline src=\"foo.jpg\"></imageInline>]` becomes `<img src=\"foo.jpg\" class=\"comment\"></img>` in the view.\n     *\n     * For container elements, the conversion is two-step. While the converter processes the highlight descriptor and passes it\n     * to a container element, it is the container element instance itself that applies values from the highlight descriptor.\n     * So, in a sense, the converter takes care of stating what should be applied on what, while the element decides how to apply that.\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' ).markerToHighlight( { model: 'comment', view: { classes: 'comment' } } );\n     *\n     * editor.conversion.for( 'downcast' ).markerToHighlight( {\n     * \tmodel: 'comment',\n     * \tview: { classes: 'comment' },\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'downcast' ).markerToHighlight( {\n     * \tmodel: 'comment',\n     * \tview: ( data, conversionApi ) => {\n     * \t\t// Assuming that the marker name is in a form of comment:commentType:commentId.\n     * \t\tconst [ , commentType, commentId ] = data.markerName.split( ':' );\n     *\n     * \t\treturn {\n     * \t\t\tclasses: [ 'comment', 'comment-' + commentType ],\n     * \t\t\tattributes: { 'data-comment-id': commentId }\n     * \t\t};\n     * \t}\n     * } );\n     * ```\n     *\n     * If a function is passed as the `config.view` parameter, it will be used to generate the highlight descriptor. The function\n     * receives the `data` object and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API}\n     * as the parameters and should return a\n     * {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor highlight descriptor}.\n     * The `data` object properties are passed from {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker}.\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The name of the model marker (or model marker group) to convert.\n     * @param config.view A highlight descriptor that will be used for highlighting or a function that takes the model marker data and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as a parameters\n     * and returns a highlight descriptor.\n     * @param config.converterPriority Converter priority.\n     */\n    markerToHighlight(config) {\n        return this.add(downcastMarkerToHighlight(config));\n    }\n    /**\n     * Model marker converter for data downcast.\n     *\n     * This conversion creates a representation for model marker boundaries in the view:\n     *\n     * * If the marker boundary is before or after a model element, a view attribute is set on a corresponding view element.\n     * * In other cases, a view element with the specified tag name is inserted at the corresponding view position.\n     *\n     * Typically, the marker names use the `group:uniqueId:otherData` convention. For example: `comment:e34zfk9k2n459df53sjl34:zx32c`.\n     * The default configuration for this conversion is that the first part is the `group` part and the rest of\n     * the marker name becomes the `name` part.\n     *\n     * Tag and attribute names and values are generated from the marker name:\n     *\n     * * The templates for attributes are `data-[group]-start-before=\"[name]\"`, `data-[group]-start-after=\"[name]\"`,\n     * `data-[group]-end-before=\"[name]\"` and `data-[group]-end-after=\"[name]\"`.\n     * * The templates for view elements are `<[group]-start name=\"[name]\">` and `<[group]-end name=\"[name]\">`.\n     *\n     * Attributes mark whether the given marker's start or end boundary is before or after the given element.\n     * The `data-[group]-start-before` and `data-[group]-end-after` attributes are favored.\n     * The other two are used when the former two cannot be used.\n     *\n     * The conversion configuration can take a function that will generate different group and name parts.\n     * If such a function is set as the `config.view` parameter, it is passed a marker name and it is expected to return an object with two\n     * properties: `group` and `name`. If the function returns a falsy value, the conversion will not take place.\n     *\n     * Basic usage:\n     *\n     * ```ts\n     * // Using the default conversion.\n     * // In this case, all markers with names starting with 'comment:' will be converted.\n     * // The `group` parameter will be set to `comment`.\n     * // The `name` parameter will be the rest of the marker name (without the `:`).\n     * editor.conversion.for( 'dataDowncast' ).markerToData( {\n     * \tmodel: 'comment'\n     * } );\n     * ```\n     *\n     * An example of a view that may be generated by this conversion (assuming a marker with the name `comment:commentId:uid` marked\n     * by `[]`):\n     *\n     * ```\n     * // Model:\n     * <paragraph>Foo[bar</paragraph>\n     * <imageBlock src=\"abc.jpg\"></imageBlock>]\n     *\n     * // View:\n     * <p>Foo<comment-start name=\"commentId:uid\"></comment-start>bar</p>\n     * <figure data-comment-end-after=\"commentId:uid\" class=\"image\"><img src=\"abc.jpg\" /></figure>\n     * ```\n     *\n     * In the example above, the comment starts before \"bar\" and ends after the image.\n     *\n     * If the `name` part is empty, the following view may be generated:\n     *\n     * ```html\n     * <p>Foo <myMarker-start></myMarker-start>bar</p>\n     * <figure data-myMarker-end-after=\"\" class=\"image\"><img src=\"abc.jpg\" /></figure>\n     * ```\n     *\n     * **Note:** A situation where some markers have the `name` part and some do not, is incorrect and should be avoided.\n     *\n     * Examples where `data-group-start-after` and `data-group-end-before` are used:\n     *\n     * ```\n     * // Model:\n     * <blockQuote>[]<paragraph>Foo</paragraph></blockQuote>\n     *\n     * // View:\n     * <blockquote><p data-group-end-before=\"name\" data-group-start-before=\"name\">Foo</p></blockquote>\n     * ```\n     *\n     * Similarly, when a marker is collapsed after the last element:\n     *\n     * ```\n     * // Model:\n     * <blockQuote><paragraph>Foo</paragraph>[]</blockQuote>\n     *\n     * // View:\n     * <blockquote><p data-group-end-after=\"name\" data-group-start-after=\"name\">Foo</p></blockquote>\n     * ```\n     *\n     * When there are multiple markers from the same group stored in the same attribute of the same element, their\n     * name parts are put together in the attribute value, for example: `data-group-start-before=\"name1,name2,name3\"`.\n     *\n     * Other examples of usage:\n     *\n     * ```ts\n     * // Using a custom function which is the same as the default conversion:\n     * editor.conversion.for( 'dataDowncast' ).markerToData( {\n     * \tmodel: 'comment',\n     * \tview: markerName => ( {\n     * \t\tgroup: 'comment',\n     * \t\tname: markerName.substr( 8 ) // Removes 'comment:' part.\n     * \t} )\n     * } );\n     *\n     * // Using the converter priority:\n     * editor.conversion.for( 'dataDowncast' ).markerToData( {\n     * \tmodel: 'comment',\n     * \tview: markerName => ( {\n     * \t\tgroup: 'comment',\n     * \t\tname: markerName.substr( 8 ) // Removes 'comment:' part.\n     * \t} ),\n     * \tconverterPriority: 'high'\n     * } );\n     * ```\n     *\n     * This kind of conversion is useful for saving data into the database, so it should be used in the data conversion pipeline.\n     *\n     * See the {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} API guide to learn how to\n     * add a converter to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.model The name of the model marker (or the model marker group) to convert.\n     * @param config.view A function that takes the model marker name and\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as the parameters\n     * and returns an object with the `group` and `name` properties.\n     * @param config.converterPriority Converter priority.\n     */\n    markerToData(config) {\n        return this.add(downcastMarkerToData(config));\n    }\n}\n/**\n * Function factory that creates a default downcast converter for text insertion changes.\n *\n * The converter automatically consumes the corresponding value from the consumables list and stops the event (see\n * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}).\n *\n * ```ts\n * modelDispatcher.on( 'insert:$text', insertText() );\n * ```\n *\n * @returns Insert text event converter.\n * @internal\n */\nexport function insertText() {\n    return (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const viewWriter = conversionApi.writer;\n        const viewPosition = conversionApi.mapper.toViewPosition(data.range.start);\n        const viewText = viewWriter.createText(data.item.data);\n        viewWriter.insert(viewPosition, viewText);\n    };\n}\n/**\n * Function factory that creates a default downcast converter for triggering attributes and children conversion.\n *\n * @returns The converter.\n * @internal\n */\nexport function insertAttributesAndChildren() {\n    return (evt, data, conversionApi) => {\n        conversionApi.convertAttributes(data.item);\n        // Start converting children of the current item.\n        // In case of reconversion children were already re-inserted or converted separately.\n        if (!data.reconversion && data.item.is('element') && !data.item.isEmpty) {\n            conversionApi.convertChildren(data.item);\n        }\n    };\n}\n/**\n * Function factory that creates a default downcast converter for node remove changes.\n *\n * ```ts\n * modelDispatcher.on( 'remove', remove() );\n * ```\n *\n * @returns Remove event converter.\n * @internal\n */\nexport function remove() {\n    return (evt, data, conversionApi) => {\n        // Ignore reconversion related remove as it is handled in the `insert` of reconversion.\n        if (data.reconversion) {\n            return;\n        }\n        // Find the view range start position by mapping the model position at which the remove happened.\n        const viewStart = conversionApi.mapper.toViewPosition(data.position);\n        const modelEnd = data.position.getShiftedBy(data.length);\n        const viewEnd = conversionApi.mapper.toViewPosition(modelEnd, { isPhantom: true });\n        const viewRange = conversionApi.writer.createRange(viewStart, viewEnd);\n        // Trim the range to remove in case some UI elements are on the view range boundaries.\n        removeRangeAndUnbind(viewRange.getTrimmed(), conversionApi);\n    };\n}\n/**\n * Creates a `<span>` {@link module:engine/view/attributeelement~ViewAttributeElement view attribute element} from the information\n * provided by the {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor highlight descriptor} object. If the priority\n * is not provided in the descriptor, the default priority will be used.\n *\n * @internal\n */\nexport function createViewElementFromDowncastHighlightDescriptor(writer, descriptor) {\n    const viewElement = writer.createAttributeElement('span', descriptor.attributes);\n    if (descriptor.classes) {\n        viewElement._addClass(descriptor.classes);\n    }\n    if (typeof descriptor.priority === 'number') {\n        viewElement._priority = descriptor.priority;\n    }\n    viewElement._id = descriptor.id;\n    return viewElement;\n}\n/**\n * Function factory that creates a converter which converts a non-collapsed\n * {@link module:engine/model/selection~ModelSelection model selection}\n * to a {@link module:engine/view/documentselection~ViewDocumentSelection view selection}. The converter consumes appropriate\n * value from the `consumable` object and maps model positions from the selection to view positions.\n *\n * ```ts\n * modelDispatcher.on( 'selection', convertRangeSelection() );\n * ```\n *\n * @returns Selection converter.\n * @internal\n */\nexport function convertRangeSelection() {\n    return (evt, data, conversionApi) => {\n        const selection = data.selection;\n        if (selection.isCollapsed) {\n            return;\n        }\n        if (!conversionApi.consumable.consume(selection, 'selection')) {\n            return;\n        }\n        const viewRanges = [];\n        for (const range of selection.getRanges()) {\n            viewRanges.push(conversionApi.mapper.toViewRange(range));\n        }\n        conversionApi.writer.setSelection(viewRanges, { backward: selection.isBackward });\n    };\n}\n/**\n * Function factory that creates a converter which converts a collapsed\n * {@link module:engine/model/selection~ModelSelection model selection} to\n * a {@link module:engine/view/documentselection~ViewDocumentSelection view selection}. The converter consumes appropriate\n * value from the `consumable` object, maps the model selection position to the view position and breaks\n * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} at the selection position.\n *\n * ```ts\n * modelDispatcher.on( 'selection', convertCollapsedSelection() );\n * ```\n *\n * An example of the view state before and after converting the collapsed selection:\n *\n * ```\n *    <p><strong>f^oo<strong>bar</p>\n * -> <p><strong>f</strong>^<strong>oo</strong>bar</p>\n * ```\n *\n * By breaking attribute elements like `<strong>`, the selection is in a correct element. Then, when the selection attribute is\n * converted, broken attributes might be merged again, or the position where the selection is may be wrapped\n * with different, appropriate attribute elements.\n *\n * See also {@link module:engine/conversion/downcasthelpers~cleanSelection} which does a clean-up\n * by merging attributes.\n *\n * @returns Selection converter.\n * @internal\n */\nexport function convertCollapsedSelection() {\n    return (evt, data, conversionApi) => {\n        const selection = data.selection;\n        if (!selection.isCollapsed) {\n            return;\n        }\n        if (!conversionApi.consumable.consume(selection, 'selection')) {\n            return;\n        }\n        const viewWriter = conversionApi.writer;\n        const modelPosition = selection.getFirstPosition();\n        const viewPosition = conversionApi.mapper.toViewPosition(modelPosition);\n        const brokenPosition = viewWriter.breakAttributes(viewPosition);\n        viewWriter.setSelection(brokenPosition);\n    };\n}\n/**\n * Function factory that creates a converter which cleans artifacts after the previous\n * {@link module:engine/model/selection~ModelSelection model selection} conversion. It removes all empty\n * {@link module:engine/view/attributeelement~ViewAttributeElement view attribute elements} and merges\n * sibling attributes at all start and end positions of all ranges.\n *\n * ```\n *    <p><strong>^</strong></p>\n * -> <p>^</p>\n *\n *    <p><strong>foo</strong>^<strong>bar</strong>bar</p>\n * -> <p><strong>foo^bar<strong>bar</p>\n *\n *    <p><strong>foo</strong><em>^</em><strong>bar</strong>bar</p>\n * -> <p><strong>foo^bar<strong>bar</p>\n * ```\n *\n * This listener should be assigned before any converter for the new selection:\n *\n * ```ts\n * modelDispatcher.on( 'cleanSelection', cleanSelection() );\n * ```\n *\n * See {@link module:engine/conversion/downcasthelpers~convertCollapsedSelection}\n * which does the opposite by breaking attributes in the selection position.\n *\n * @returns Selection converter.\n * @internal\n */\nexport function cleanSelection() {\n    return (evt, data, conversionApi) => {\n        const viewWriter = conversionApi.writer;\n        const viewSelection = viewWriter.document.selection;\n        for (const range of viewSelection.getRanges()) {\n            // Not collapsed selection should not have artifacts.\n            if (range.isCollapsed) {\n                // Position might be in the node removed by the view writer.\n                if (range.end.parent.isAttached()) {\n                    conversionApi.writer.mergeAttributes(range.start);\n                }\n            }\n        }\n        viewWriter.setSelection(null);\n    };\n}\n/**\n * Function factory that creates a converter which converts the set/change/remove attribute changes from the model to the view.\n * It can also be used to convert selection attributes. In that case, an empty attribute element will be created and the\n * selection will be put inside it.\n *\n * Attributes from the model are converted to a view element that will be wrapping these view nodes that are bound to\n * model elements having the given attribute. This is useful for attributes like `bold` that may be set on text nodes in the model\n * but are represented as an element in the view:\n *\n * ```\n * [paragraph]              MODEL ====> VIEW        <p>\n * \t|- a {bold: true}                             |- <b>\n * \t|- b {bold: true}                             |   |- ab\n * \t|- c                                          |- c\n * \t```\n *\n * Passed `Function` will be provided with the attribute value and then all the parameters of the\n * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute `attribute` event}.\n * It is expected that the function returns an {@link module:engine/view/element~ViewElement}.\n * The result of the function will be the wrapping element.\n * When the provided `Function` does not return any element, no conversion will take place.\n *\n * The converter automatically consumes the corresponding value from the consumables list and stops the event (see\n * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}).\n *\n * ```ts\n * modelDispatcher.on( 'attribute:bold', wrap( ( modelAttributeValue, { writer } ) => {\n * \treturn writer.createAttributeElement( 'strong' );\n * } );\n * ```\n *\n * @internal\n * @param elementCreator Function returning a view element that will be used for wrapping.\n * @returns Set/change attribute converter.\n */\nexport function wrap(elementCreator) {\n    return (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.test(data.item, evt.name)) {\n            return;\n        }\n        // Recreate current wrapping node. It will be used to unwrap view range if the attribute value has changed\n        // or the attribute was removed.\n        const oldViewElement = elementCreator(data.attributeOldValue, conversionApi, data);\n        // Create node to wrap with.\n        const newViewElement = elementCreator(data.attributeNewValue, conversionApi, data);\n        if (!oldViewElement && !newViewElement) {\n            return;\n        }\n        conversionApi.consumable.consume(data.item, evt.name);\n        const viewWriter = conversionApi.writer;\n        const viewSelection = viewWriter.document.selection;\n        if (data.item instanceof ModelSelection || data.item instanceof ModelDocumentSelection) {\n            // Selection attribute conversion.\n            viewWriter.wrap(viewSelection.getFirstRange(), newViewElement);\n        }\n        else {\n            // Node attribute conversion.\n            let viewRange = conversionApi.mapper.toViewRange(data.range);\n            // First, unwrap the range from current wrapper.\n            if (data.attributeOldValue !== null && oldViewElement) {\n                viewRange = viewWriter.unwrap(viewRange, oldViewElement);\n            }\n            if (data.attributeNewValue !== null && newViewElement) {\n                viewWriter.wrap(viewRange, newViewElement);\n            }\n        }\n    };\n}\n/**\n * Function factory that creates a converter which converts node insertion changes from the model to the view.\n * The function passed will be provided with all the parameters of the dispatcher's\n * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert `insert` event}.\n * It is expected that the function returns an {@link module:engine/view/element~ViewElement}.\n * The result of the function will be inserted into the view.\n *\n * The converter automatically consumes the corresponding value from the consumables list and binds the model and view elements.\n *\n * ```ts\n * downcastDispatcher.on(\n * \t'insert:myElem',\n * \tinsertElement( ( modelItem, { writer } ) => {\n * \t\tconst text = writer.createText( 'myText' );\n * \t\tconst myElem = writer.createElement( 'myElem', { myAttr: 'my-' + modelItem.getAttribute( 'myAttr' ) }, text );\n *\n * \t\t// Do something fancy with `myElem` using `modelItem` or other parameters.\n *\n * \t\treturn myElem;\n * \t}\n * ) );\n * ```\n *\n * @internal\n * @param  elementCreator Function returning a view element, which will be inserted.\n * @param consumer Function defining element consumption process.\n * By default this function just consume passed item insertion.\n * @returns Insert element event converter.\n */\nexport function insertElement(elementCreator, consumer = defaultConsumer) {\n    return (evt, data, conversionApi) => {\n        if (!consumer(data.item, conversionApi.consumable, { preflight: true })) {\n            return;\n        }\n        const viewElement = elementCreator(data.item, conversionApi, data);\n        if (!viewElement) {\n            return;\n        }\n        // Consume an element insertion and all present attributes that are specified as a reconversion triggers.\n        consumer(data.item, conversionApi.consumable);\n        const viewPosition = data.reconversion && removeElementAndUnbind(data.item, conversionApi) ||\n            conversionApi.mapper.toViewPosition(data.range.start);\n        conversionApi.mapper.bindElements(data.item, viewElement);\n        conversionApi.writer.insert(viewPosition, viewElement);\n        // Convert attributes before converting children.\n        conversionApi.convertAttributes(data.item);\n        // Convert children or reinsert previous view elements.\n        reinsertOrConvertNodes(viewElement, data.item.getChildren(), conversionApi, { reconversion: data.reconversion });\n    };\n}\n/**\n * Function factory that creates a converter which converts a single model node insertion to a view structure.\n *\n * It is expected that the passed element creator function returns an {@link module:engine/view/element~ViewElement} with attached slots\n * created with `writer.createSlot()` to indicate where child nodes should be converted.\n *\n * @see module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure\n *\n * @internal\n * @param elementCreator Function returning a view structure, which will be inserted.\n * @param consumer A callback that is expected to consume all the consumables\n * that were used by the element creator.\n * @returns Insert element event converter.\n*/\nexport function insertStructure(elementCreator, consumer) {\n    return (evt, data, conversionApi) => {\n        if (!consumer(data.item, conversionApi.consumable, { preflight: true })) {\n            return;\n        }\n        const slotsMap = new Map();\n        conversionApi.writer._registerSlotFactory(createSlotFactory(data.item, slotsMap, conversionApi));\n        // View creation.\n        const viewElement = elementCreator(data.item, conversionApi, data);\n        conversionApi.writer._clearSlotFactory();\n        if (!viewElement) {\n            return;\n        }\n        // Check if all children are covered by slots and there is no child that landed in multiple slots.\n        validateSlotsChildren(data.item, slotsMap, conversionApi);\n        // Consume an element insertion and all present attributes that are specified as a reconversion triggers.\n        consumer(data.item, conversionApi.consumable);\n        const viewPosition = data.reconversion && removeElementAndUnbind(data.item, conversionApi) ||\n            conversionApi.mapper.toViewPosition(data.range.start);\n        conversionApi.mapper.bindElements(data.item, viewElement);\n        conversionApi.writer.insert(viewPosition, viewElement);\n        // Convert attributes before converting children.\n        conversionApi.convertAttributes(data.item);\n        // Fill view slots with previous view elements or create new ones.\n        fillSlots(viewElement, slotsMap, conversionApi, { reconversion: data.reconversion });\n    };\n}\n/**\n * Function factory that creates a converter which converts marker adding change to the\n * {@link module:engine/view/uielement~ViewUIElement view UI element}.\n *\n * The view UI element that will be added to the view depends on the passed parameter. See {@link ~insertElement}.\n * In case of a non-collapsed range, the UI element will not wrap nodes but separate elements will be placed at the beginning\n * and at the end of the range.\n *\n * This converter binds created UI elements with the marker name using {@link module:engine/conversion/mapper~Mapper#bindElementToMarker}.\n *\n * @internal\n * @param elementCreator A view UI element or a function returning the view element that will be inserted.\n * @returns Insert element event converter.\n */\nexport function insertUIElement(elementCreator) {\n    return (evt, data, conversionApi) => {\n        // Create two view elements. One will be inserted at the beginning of marker, one at the end.\n        // If marker is collapsed, only \"opening\" element will be inserted.\n        data.isOpening = true;\n        const viewStartElement = elementCreator(data, conversionApi);\n        data.isOpening = false;\n        const viewEndElement = elementCreator(data, conversionApi);\n        if (!viewStartElement || !viewEndElement) {\n            return;\n        }\n        const markerRange = data.markerRange;\n        // Marker that is collapsed has consumable build differently that non-collapsed one.\n        // For more information see `addMarker` event description.\n        // If marker's range is collapsed - check if it can be consumed.\n        if (markerRange.isCollapsed && !conversionApi.consumable.consume(markerRange, evt.name)) {\n            return;\n        }\n        // If marker's range is not collapsed - consume all items inside.\n        for (const value of markerRange) {\n            if (!conversionApi.consumable.consume(value.item, evt.name)) {\n                return;\n            }\n        }\n        const mapper = conversionApi.mapper;\n        const viewWriter = conversionApi.writer;\n        // Add \"opening\" element.\n        viewWriter.insert(mapper.toViewPosition(markerRange.start), viewStartElement);\n        conversionApi.mapper.bindElementToMarker(viewStartElement, data.markerName);\n        // Add \"closing\" element only if range is not collapsed.\n        if (!markerRange.isCollapsed) {\n            viewWriter.insert(mapper.toViewPosition(markerRange.end), viewEndElement);\n            conversionApi.mapper.bindElementToMarker(viewEndElement, data.markerName);\n        }\n        evt.stop();\n    };\n}\n/**\n * Removes given view range content and unbinds removed elements.\n */\nfunction removeRangeAndUnbind(viewRange, conversionApi) {\n    const removed = conversionApi.writer.remove(viewRange);\n    // After the range is removed, unbind all view elements from the model.\n    // Range inside view document fragment is used to unbind deeply.\n    for (const child of conversionApi.writer.createRangeIn(removed).getItems()) {\n        conversionApi.mapper.unbindViewElement(child, { defer: true });\n    }\n    return viewRange.start;\n}\n/**\n * Removes view element for given model element and unbinds removed view elements.\n */\nfunction removeElementAndUnbind(modelElement, conversionApi) {\n    const viewElement = conversionApi.mapper.toViewElement(modelElement);\n    return viewElement && removeRangeAndUnbind(conversionApi.writer.createRangeOn(viewElement), conversionApi);\n}\n/**\n * Function factory that returns a default downcast converter for removing a {@link module:engine/view/uielement~ViewUIElement UI element}\n * based on marker remove change.\n *\n * This converter unbinds elements from the marker name.\n *\n * @returns Removed UI element converter.\n */\nfunction removeUIElement() {\n    return (evt, data, conversionApi) => {\n        const elements = conversionApi.mapper.markerNameToElements(data.markerName);\n        if (!elements) {\n            return;\n        }\n        for (const element of elements) {\n            conversionApi.mapper.unbindElementFromMarkerName(element, data.markerName);\n            conversionApi.writer.clear(conversionApi.writer.createRangeOn(element), element);\n        }\n        conversionApi.writer.clearClonedElementsGroup(data.markerName);\n        evt.stop();\n    };\n}\n/**\n * Function factory that creates a default converter for model markers.\n *\n * See {@link DowncastHelpers#markerToData} for more information what type of view is generated.\n *\n * This converter binds created UI elements and affected view elements with the marker name\n * using {@link module:engine/conversion/mapper~Mapper#bindElementToMarker}.\n *\n * @returns Add marker converter.\n */\nfunction insertMarkerData(viewCreator) {\n    return (evt, data, conversionApi) => {\n        const viewMarkerData = viewCreator(data.markerName, conversionApi);\n        if (!viewMarkerData) {\n            return;\n        }\n        const markerRange = data.markerRange;\n        if (!conversionApi.consumable.consume(markerRange, evt.name)) {\n            return;\n        }\n        // Adding closing data first to keep the proper order in the view.\n        handleMarkerBoundary(markerRange, false, conversionApi, data, viewMarkerData);\n        handleMarkerBoundary(markerRange, true, conversionApi, data, viewMarkerData);\n        evt.stop();\n    };\n}\n/**\n * Helper function for `insertMarkerData()` that marks a marker boundary at the beginning or end of given `range`.\n */\nfunction handleMarkerBoundary(range, isStart, conversionApi, data, viewMarkerData) {\n    const modelPosition = isStart ? range.start : range.end;\n    const elementAfter = modelPosition.nodeAfter && modelPosition.nodeAfter.is('element') ? modelPosition.nodeAfter : null;\n    const elementBefore = modelPosition.nodeBefore && modelPosition.nodeBefore.is('element') ? modelPosition.nodeBefore : null;\n    if (elementAfter || elementBefore) {\n        let modelElement;\n        let isBefore;\n        // If possible, we want to add `data-group-start-before` and `data-group-end-after` attributes.\n        if (isStart && elementAfter || !isStart && !elementBefore) {\n            // [<elementAfter>...</elementAfter> -> <elementAfter data-group-start-before=\"...\">...</elementAfter>\n            // <parent>]<elementAfter> -> <parent><elementAfter data-group-end-before=\"...\">\n            modelElement = elementAfter;\n            isBefore = true;\n        }\n        else {\n            // <elementBefore>...</elementBefore>] -> <elementBefore data-group-end-after=\"...\">...</elementBefore>\n            // </elementBefore>[</parent> -> </elementBefore data-group-start-after=\"...\"></parent>\n            modelElement = elementBefore;\n            isBefore = false;\n        }\n        const viewElement = conversionApi.mapper.toViewElement(modelElement);\n        // In rare circumstances, the model element may be not mapped to any view element and that would cause an error.\n        // One of those situations is a soft break inside code block.\n        if (viewElement) {\n            insertMarkerAsAttribute(viewElement, isStart, isBefore, conversionApi, data, viewMarkerData);\n            return;\n        }\n    }\n    const viewPosition = conversionApi.mapper.toViewPosition(modelPosition);\n    insertMarkerAsElement(viewPosition, isStart, conversionApi, data, viewMarkerData);\n}\n/**\n * Helper function for `insertMarkerData()` that marks a marker boundary in the view as an attribute on a view element.\n */\nfunction insertMarkerAsAttribute(viewElement, isStart, isBefore, conversionApi, data, viewMarkerData) {\n    const attributeName = `data-${viewMarkerData.group}-${isStart ? 'start' : 'end'}-${isBefore ? 'before' : 'after'}`;\n    const markerNames = viewElement.hasAttribute(attributeName) ? viewElement.getAttribute(attributeName).split(',') : [];\n    // Adding marker name at the beginning to have the same order in the attribute as there is with marker elements.\n    markerNames.unshift(viewMarkerData.name);\n    conversionApi.writer.setAttribute(attributeName, markerNames.join(','), viewElement);\n    conversionApi.mapper.bindElementToMarker(viewElement, data.markerName);\n}\n/**\n * Helper function for `insertMarkerData()` that marks a marker boundary in the view as a separate view ui element.\n */\nfunction insertMarkerAsElement(position, isStart, conversionApi, data, viewMarkerData) {\n    const viewElementName = `${viewMarkerData.group}-${isStart ? 'start' : 'end'}`;\n    const attrs = viewMarkerData.name ? { 'name': viewMarkerData.name } : null;\n    const viewElement = conversionApi.writer.createUIElement(viewElementName, attrs);\n    conversionApi.writer.insert(position, viewElement);\n    conversionApi.mapper.bindElementToMarker(viewElement, data.markerName);\n}\n/**\n * Function factory that creates a converter for removing a model marker data added by the {@link #insertMarkerData} converter.\n *\n * @returns Remove marker converter.\n */\nfunction removeMarkerData(viewCreator) {\n    return (evt, data, conversionApi) => {\n        const viewData = viewCreator(data.markerName, conversionApi);\n        if (!viewData) {\n            return;\n        }\n        const elements = conversionApi.mapper.markerNameToElements(data.markerName);\n        if (!elements) {\n            return;\n        }\n        for (const element of elements) {\n            conversionApi.mapper.unbindElementFromMarkerName(element, data.markerName);\n            if (element.is('containerElement')) {\n                removeMarkerFromAttribute(`data-${viewData.group}-start-before`, element);\n                removeMarkerFromAttribute(`data-${viewData.group}-start-after`, element);\n                removeMarkerFromAttribute(`data-${viewData.group}-end-before`, element);\n                removeMarkerFromAttribute(`data-${viewData.group}-end-after`, element);\n            }\n            else {\n                conversionApi.writer.clear(conversionApi.writer.createRangeOn(element), element);\n            }\n        }\n        conversionApi.writer.clearClonedElementsGroup(data.markerName);\n        evt.stop();\n        function removeMarkerFromAttribute(attributeName, element) {\n            if (element.hasAttribute(attributeName)) {\n                const markerNames = new Set(element.getAttribute(attributeName).split(','));\n                markerNames.delete(viewData.name);\n                if (markerNames.size == 0) {\n                    conversionApi.writer.removeAttribute(attributeName, element);\n                }\n                else {\n                    conversionApi.writer.setAttribute(attributeName, Array.from(markerNames).join(','), element);\n                }\n            }\n        }\n    };\n}\n/**\n * Function factory that creates a converter which converts the set/change/remove attribute changes from the model to the view.\n *\n * Attributes from the model are converted to the view element attributes in the view. You may provide a custom function to generate\n * a key-value attribute pair to add/change/remove. If not provided, model attributes will be converted to view element\n * attributes on a one-to-one basis.\n *\n * *Note:** The provided attribute creator should always return the same `key` for a given attribute from the model.\n *\n * The converter automatically consumes the corresponding value from the consumables list and stops the event (see\n * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}).\n *\n * ```ts\n * modelDispatcher.on( 'attribute:customAttr:myElem', changeAttribute( ( value, data ) => {\n * \t// Change attribute key from `customAttr` to `class` in the view.\n * \tconst key = 'class';\n * \tlet value = data.attributeNewValue;\n *\n * \t// Force attribute value to 'empty' if the model element is empty.\n * \tif ( data.item.childCount === 0 ) {\n * \t\tvalue = 'empty';\n * \t}\n *\n * \t// Return the key-value pair.\n * \treturn { key, value };\n * } ) );\n * ```\n *\n * @param attributeCreator Function returning an object with two properties: `key` and `value`, which\n * represent the attribute key and attribute value to be set on a {@link module:engine/view/element~ViewElement view element}.\n * The function is passed the model attribute value as the first parameter and additional data about the change as the second parameter.\n * @returns Set/change attribute converter.\n */\nfunction changeAttribute(attributeCreator) {\n    return (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.test(data.item, evt.name)) {\n            return;\n        }\n        const oldAttribute = attributeCreator(data.attributeOldValue, conversionApi, data);\n        const newAttribute = attributeCreator(data.attributeNewValue, conversionApi, data);\n        if (!oldAttribute && !newAttribute) {\n            return;\n        }\n        conversionApi.consumable.consume(data.item, evt.name);\n        const viewElement = conversionApi.mapper.toViewElement(data.item);\n        const viewWriter = conversionApi.writer;\n        // If model item cannot be mapped to a view element, it means item is not an `Element` instance but a `ModelTextProxy` node.\n        // Only elements can have attributes in a view so do not proceed for anything else (#1587).\n        if (!viewElement) {\n            /**\n             * This error occurs when a {@link module:engine/model/textproxy~ModelTextProxy text node's} attribute is to be downcasted\n             * by an {@link module:engine/conversion/conversion~Conversion#attributeToAttribute `Attribute to Attribute converter`}.\n             * In most cases it is caused by converters misconfiguration when only \"generic\" converter is defined:\n             *\n             * ```ts\n             * editor.conversion.for( 'downcast' ).attributeToAttribute( {\n             * \tmodel: 'attribute-name',\n             * \tview: 'attribute-name'\n             * } ) );\n             * ```\n             *\n             * and given attribute is used on text node, for example:\n             *\n             * ```ts\n             * model.change( writer => {\n             * \twriter.insertText( 'Foo', { 'attribute-name': 'bar' }, parent, 0 );\n             * } );\n             * ```\n             *\n             * In such cases, to convert the same attribute for both {@link module:engine/model/element~ModelElement}\n             * and {@link module:engine/model/textproxy~ModelTextProxy `Text`} nodes, text specific\n             * {@link module:engine/conversion/conversion~Conversion#attributeToElement `Attribute to Element converter`}\n             * with higher {@link module:utils/priorities~PriorityString priority} must also be defined:\n             *\n             * ```ts\n             * editor.conversion.for( 'downcast' ).attributeToElement( {\n             * \tmodel: {\n             * \t\tkey: 'attribute-name',\n             * \t\tname: '$text'\n             * \t},\n             * \tview: ( value, { writer } ) => {\n             * \t\treturn writer.createAttributeElement( 'span', { 'attribute-name': value } );\n             * \t},\n             * \tconverterPriority: 'high'\n             * } ) );\n             * ```\n             *\n             * @error conversion-attribute-to-attribute-on-text\n             * @param {object} data The conversion data.\n             */\n            throw new CKEditorError('conversion-attribute-to-attribute-on-text', conversionApi.dispatcher, data);\n        }\n        // First remove the old attribute if there was one.\n        if (data.attributeOldValue !== null && oldAttribute) {\n            let value = oldAttribute.value;\n            if (oldAttribute.key == 'style') {\n                if (typeof oldAttribute.value == 'string') {\n                    value = new StylesMap(viewWriter.document.stylesProcessor)\n                        .setTo(oldAttribute.value)\n                        .getStylesEntries()\n                        .map(([key]) => key);\n                }\n                else {\n                    value = Object.keys(oldAttribute.value);\n                }\n            }\n            viewWriter.removeAttribute(oldAttribute.key, value, viewElement);\n        }\n        // Then set the new attribute.\n        if (data.attributeNewValue !== null && newAttribute) {\n            let value = newAttribute.value;\n            if (newAttribute.key == 'style' && typeof newAttribute.value == 'string') {\n                value = Object.fromEntries(new StylesMap(viewWriter.document.stylesProcessor)\n                    .setTo(newAttribute.value)\n                    .getStylesEntries());\n            }\n            viewWriter.setAttribute(newAttribute.key, value, false, viewElement);\n        }\n    };\n}\n/**\n * Function factory that creates a converter which converts the text inside marker's range. The converter wraps the text with\n * {@link module:engine/view/attributeelement~ViewAttributeElement} created from the provided descriptor.\n * See {link module:engine/conversion/downcasthelpers~createViewElementFromDowncastHighlightDescriptor}.\n *\n * It can also be used to convert the selection that is inside a marker. In that case, an empty attribute element will be\n * created and the selection will be put inside it.\n *\n * If the highlight descriptor does not provide the `priority` property, `10` will be used.\n *\n * If the highlight descriptor does not provide the `id` property, the name of the marker will be used.\n *\n * This converter binds the created {@link module:engine/view/attributeelement~ViewAttributeElement attribute elemens} with the marker name\n * using the {@link module:engine/conversion/mapper~Mapper#bindElementToMarker} method.\n */\nfunction highlightText(highlightDescriptor) {\n    return (evt, data, conversionApi) => {\n        if (!data.item) {\n            return;\n        }\n        if (!(data.item instanceof ModelSelection || data.item instanceof ModelDocumentSelection) && !data.item.is('$textProxy')) {\n            return;\n        }\n        const descriptor = prepareDescriptor(highlightDescriptor, data, conversionApi);\n        if (!descriptor) {\n            return;\n        }\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const viewWriter = conversionApi.writer;\n        const viewElement = createViewElementFromDowncastHighlightDescriptor(viewWriter, descriptor);\n        const viewSelection = viewWriter.document.selection;\n        if (data.item instanceof ModelSelection || data.item instanceof ModelDocumentSelection) {\n            viewWriter.wrap(viewSelection.getFirstRange(), viewElement);\n        }\n        else {\n            const viewRange = conversionApi.mapper.toViewRange(data.range);\n            const rangeAfterWrap = viewWriter.wrap(viewRange, viewElement);\n            for (const element of rangeAfterWrap.getItems()) {\n                if (element.is('attributeElement') && element.isSimilar(viewElement)) {\n                    conversionApi.mapper.bindElementToMarker(element, data.markerName);\n                    // One attribute element is enough, because all of them are bound together by the view writer.\n                    // Mapper uses this binding to get all the elements no matter how many of them are registered in the mapper.\n                    break;\n                }\n            }\n        }\n    };\n}\n/**\n * Converter function factory. It creates a function which applies the marker's highlight to an element inside the marker's range.\n *\n * The converter checks if an element has the `addHighlight` function stored as a\n * {@link module:engine/view/element~ViewElement#_setCustomProperty custom property} and, if so, uses it to apply the highlight.\n * In such case the converter will consume all element's children, assuming that they were handled by the element itself.\n *\n * When the `addHighlight` custom property is not present, the element is not converted in any special way.\n * This means that converters will proceed to convert the element's child nodes.\n *\n * If the highlight descriptor does not provide the `priority` property, `10` will be used.\n *\n * If the highlight descriptor does not provide the `id` property, the name of the marker will be used.\n *\n * This converter binds altered {@link module:engine/view/containerelement~ViewContainerElement container elements}\n * with the marker name using the {@link module:engine/conversion/mapper~Mapper#bindElementToMarker} method.\n */\nfunction highlightElement(highlightDescriptor) {\n    return (evt, data, conversionApi) => {\n        if (!data.item) {\n            return;\n        }\n        if (!(data.item instanceof ModelElement)) {\n            return;\n        }\n        const descriptor = prepareDescriptor(highlightDescriptor, data, conversionApi);\n        if (!descriptor) {\n            return;\n        }\n        if (!conversionApi.consumable.test(data.item, evt.name)) {\n            return;\n        }\n        const viewElement = conversionApi.mapper.toViewElement(data.item);\n        if (viewElement && viewElement.getCustomProperty('addHighlight')) {\n            // Consume element itself.\n            conversionApi.consumable.consume(data.item, evt.name);\n            // Consume all children nodes.\n            for (const value of ModelRange._createIn(data.item)) {\n                conversionApi.consumable.consume(value.item, evt.name);\n            }\n            const addHighlightCallback = viewElement.getCustomProperty('addHighlight');\n            addHighlightCallback(viewElement, descriptor, conversionApi.writer);\n            conversionApi.mapper.bindElementToMarker(viewElement, data.markerName);\n        }\n    };\n}\n/**\n * Function factory that creates a converter which converts the removing model marker to the view.\n *\n * Both text nodes and elements are handled by this converter but they are handled a bit differently.\n *\n * Text nodes are unwrapped using the {@link module:engine/view/attributeelement~ViewAttributeElement attribute element} created from the\n * provided highlight descriptor. See {link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor}.\n *\n * For elements, the converter checks if an element has the `removeHighlight` function stored as a\n * {@link module:engine/view/element~ViewElement#_setCustomProperty custom property}. If so, it uses it to remove the highlight.\n * In such case, the children of that element will not be converted.\n *\n * When `removeHighlight` is not present, the element is not converted in any special way.\n * The converter will proceed to convert the element's child nodes instead.\n *\n * If the highlight descriptor does not provide the `priority` property, `10` will be used.\n *\n * If the highlight descriptor does not provide the `id` property, the name of the marker will be used.\n *\n * This converter unbinds elements from the marker name.\n */\nfunction removeHighlight(highlightDescriptor) {\n    return (evt, data, conversionApi) => {\n        // This conversion makes sense only for non-collapsed range.\n        if (data.markerRange.isCollapsed) {\n            return;\n        }\n        const descriptor = prepareDescriptor(highlightDescriptor, data, conversionApi);\n        if (!descriptor) {\n            return;\n        }\n        // View element that will be used to unwrap `AttributeElement`s.\n        const viewHighlightElement = createViewElementFromDowncastHighlightDescriptor(conversionApi.writer, descriptor);\n        // Get all elements bound with given marker name.\n        const elements = conversionApi.mapper.markerNameToElements(data.markerName);\n        if (!elements) {\n            return;\n        }\n        for (const element of elements) {\n            conversionApi.mapper.unbindElementFromMarkerName(element, data.markerName);\n            if (element.is('attributeElement')) {\n                conversionApi.writer.unwrap(conversionApi.writer.createRangeOn(element), viewHighlightElement);\n            }\n            else {\n                // if element.is( 'containerElement' ).\n                const removeHighlightCallback = element.getCustomProperty('removeHighlight');\n                removeHighlightCallback(element, descriptor.id, conversionApi.writer);\n            }\n        }\n        conversionApi.writer.clearClonedElementsGroup(data.markerName);\n        evt.stop();\n    };\n}\n/**\n * Model element to view element conversion helper.\n *\n * See {@link ~DowncastHelpers#elementToElement `.elementToElement()` downcast helper} for examples and config params description.\n *\n * @param config Conversion configuration.\n * @param config.model The description or a name of the model element to convert.\n * @param config.model.attributes List of attributes triggering element reconversion.\n * @param config.model.children Should reconvert element if the list of model child nodes changed.\n * @returns Conversion helper.\n */\nfunction downcastElementToElement(config) {\n    const model = normalizeModelElementConfig(config.model);\n    const view = normalizeToElementConfig(config.view, 'container');\n    // Trigger reconversion on children list change if element is a subject to any reconversion.\n    // This is required to be able to trigger Differ#refreshItem() on a direct child of the reconverted element.\n    if (model.attributes.length) {\n        model.children = true;\n    }\n    return (dispatcher) => {\n        dispatcher.on(`insert:${model.name}`, insertElement(view, createConsumer(model)), { priority: config.converterPriority || 'normal' });\n        if (model.children || model.attributes.length) {\n            dispatcher.on('reduceChanges', createChangeReducer(model), { priority: 'low' });\n        }\n    };\n}\n/**\n * Model element to view structure conversion helper.\n *\n * See {@link ~DowncastHelpers#elementToStructure `.elementToStructure()` downcast helper} for examples and config params description.\n *\n * @param config Conversion configuration.\n * @returns Conversion helper.\n */\nfunction downcastElementToStructure(config) {\n    const model = normalizeModelElementConfig(config.model);\n    const view = normalizeToElementConfig(config.view, 'container');\n    // Trigger reconversion on children list change because it always needs to use slots to put children in proper places.\n    // This is required to be able to trigger Differ#refreshItem() on a direct child of the reconverted element.\n    model.children = true;\n    return (dispatcher) => {\n        if (dispatcher._conversionApi.schema.checkChild(model.name, '$text')) {\n            /**\n             * This error occurs when a {@link module:engine/model/element~ModelElement model element} is downcasted\n             * via {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToStructure} helper but the element was\n             * allowed to host `$text` by the {@link module:engine/model/schema~ModelSchema model schema}.\n             *\n             * For instance, this may be the result of `myElement` allowing the content of\n             * {@glink framework/deep-dive/schema#generic-items `$block`} in its schema definition:\n             *\n             * ```ts\n             * // Element definition in schema.\n             * schema.register( 'myElement', {\n             * \tallowContentOf: '$block',\n             *\n             * \t// ...\n             * } );\n             *\n             * // ...\n             *\n             * // Conversion of myElement with the use of elementToStructure().\n             * editor.conversion.for( 'downcast' ).elementToStructure( {\n             * \tmodel: 'myElement',\n             * \tview: ( modelElement, { writer } ) => {\n             * \t\t// ...\n             * \t}\n             * } );\n             * ```\n             *\n             * In such case, {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToElement `elementToElement()`} helper\n             * can be used instead to get around this problem:\n             *\n             * ```ts\n             * editor.conversion.for( 'downcast' ).elementToElement( {\n             * \tmodel: 'myElement',\n             * \tview: ( modelElement, { writer } ) => {\n             * \t\t// ...\n             * \t}\n             * } );\n             * ```\n             *\n             * @error conversion-element-to-structure-disallowed-text\n             * @param {string} elementName The name of the element the structure is to be created for.\n             */\n            throw new CKEditorError('conversion-element-to-structure-disallowed-text', dispatcher, { elementName: model.name });\n        }\n        dispatcher.on(`insert:${model.name}`, insertStructure(view, createConsumer(model)), { priority: config.converterPriority || 'normal' });\n        dispatcher.on('reduceChanges', createChangeReducer(model), { priority: 'low' });\n    };\n}\n/**\n * Model attribute to view element conversion helper.\n *\n * See {@link ~DowncastHelpers#attributeToElement `.attributeToElement()` downcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.model The key of the attribute to convert from or a `{ key, values }` object. `values` is an array\n * of `String`s with possible values if the model attribute is an enumerable.\n * @param config.view A view element definition or a function that takes the model attribute value and\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter view downcast writer} as parameters and returns a view attribute element.\n * If `config.model.values` is given, `config.view` should be an object assigning values from `config.model.values` to view element\n * definitions or functions.\n * @param config.converterPriority Converter priority.\n * @returns Conversion helper.\n */\nfunction downcastAttributeToElement(config) {\n    config = cloneDeep(config);\n    let model = config.model;\n    if (typeof model == 'string') {\n        model = { key: model };\n    }\n    let eventName = `attribute:${model.key}`;\n    if (model.name) {\n        eventName += ':' + model.name;\n    }\n    if (model.values) {\n        for (const modelValue of model.values) {\n            config.view[modelValue] = normalizeToElementConfig(config.view[modelValue], 'attribute');\n        }\n    }\n    else {\n        config.view = normalizeToElementConfig(config.view, 'attribute');\n    }\n    const elementCreator = getFromAttributeCreator(config);\n    return (dispatcher) => {\n        dispatcher.on(eventName, wrap(elementCreator), { priority: config.converterPriority || 'normal' });\n    };\n}\n/**\n * Model attribute to view attribute conversion helper.\n *\n * See {@link ~DowncastHelpers#attributeToAttribute `.attributeToAttribute()` downcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.model The key of the attribute to convert from or a `{ key, values, [ name ] }` object describing\n * the attribute key, possible values and, optionally, an element name to convert from.\n * @param config.view A view attribute key, or a `{ key, value }` object or a function that takes the model attribute value and returns\n * a `{ key, value }` object.\n * If `key` is `'class'`, `value` can be a `String` or an array of `String`s. If `key` is `'style'`, `value` is an object with\n * key-value pairs. In other cases, `value` is a `String`.\n * If `config.model.values` is set, `config.view` should be an object assigning values from `config.model.values` to\n * `{ key, value }` objects or a functions.\n * @param config.converterPriority Converter priority.\n * @returns Conversion helper.\n */\nfunction downcastAttributeToAttribute(config) {\n    config = cloneDeep(config);\n    let model = config.model;\n    if (typeof model == 'string') {\n        model = { key: model };\n    }\n    let eventName = `attribute:${model.key}`;\n    if (model.name) {\n        eventName += ':' + model.name;\n    }\n    if (model.values) {\n        for (const modelValue of model.values) {\n            config.view[modelValue] = normalizeToAttributeConfig(config.view[modelValue]);\n        }\n    }\n    else {\n        config.view = normalizeToAttributeConfig(config.view);\n    }\n    const elementCreator = getFromAttributeCreator(config);\n    return (dispatcher) => {\n        dispatcher.on(eventName, changeAttribute(elementCreator), { priority: config.converterPriority || 'normal' });\n    };\n}\n/**\n * Model marker to view element conversion helper.\n *\n * See {@link ~DowncastHelpers#markerToElement `.markerToElement()` downcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.model The name of the model marker (or model marker group) to convert.\n * @param config.view A view element definition or a function that takes the model marker data as a parameter and returns a view UI element.\n * @param config.converterPriority Converter priority.\n * @returns Conversion helper.\n */\nfunction downcastMarkerToElement(config) {\n    const view = normalizeToElementConfig(config.view, 'ui');\n    return (dispatcher) => {\n        dispatcher.on(`addMarker:${config.model}`, insertUIElement(view), { priority: config.converterPriority || 'normal' });\n        dispatcher.on(`removeMarker:${config.model}`, removeUIElement(), { priority: config.converterPriority || 'normal' });\n    };\n}\n/**\n * Model marker to view data conversion helper.\n *\n * See {@link ~DowncastHelpers#markerToData `markerToData()` downcast helper} to learn more.\n *\n * @returns Conversion helper.\n */\nfunction downcastMarkerToData(config) {\n    config = cloneDeep(config);\n    const group = config.model;\n    let view = config.view;\n    // Default conversion.\n    if (!view) {\n        view = markerName => ({\n            group,\n            name: markerName.substr(config.model.length + 1)\n        });\n    }\n    return (dispatcher) => {\n        dispatcher.on(`addMarker:${group}`, insertMarkerData(view), { priority: config.converterPriority || 'normal' });\n        dispatcher.on(`removeMarker:${group}`, removeMarkerData(view), { priority: config.converterPriority || 'normal' });\n    };\n}\n/**\n * Model marker to highlight conversion helper.\n *\n * See {@link ~DowncastHelpers#markerToElement `.markerToElement()` downcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.model The name of the model marker (or model marker group) to convert.\n * @param config.view A highlight descriptor that will be used for highlighting or a function that takes\n * the model marker data as a parameter and returns a highlight descriptor.\n * @param config.converterPriority Converter priority.\n * @returns Conversion helper.\n */\nfunction downcastMarkerToHighlight(config) {\n    return (dispatcher) => {\n        dispatcher.on(`addMarker:${config.model}`, highlightText(config.view), { priority: config.converterPriority || 'normal' });\n        dispatcher.on(`addMarker:${config.model}`, highlightElement(config.view), { priority: config.converterPriority || 'normal' });\n        dispatcher.on(`removeMarker:${config.model}`, removeHighlight(config.view), { priority: config.converterPriority || 'normal' });\n    };\n}\n/**\n * Takes `config.model`, and converts it to an object with normalized structure.\n *\n * @param model Model configuration or element name.\n */\nfunction normalizeModelElementConfig(model) {\n    if (typeof model == 'string') {\n        model = { name: model };\n    }\n    return {\n        name: model.name,\n        attributes: model.attributes ? toArray(model.attributes) : [],\n        children: !!model.children\n    };\n}\n/**\n * Takes `config.view`, and if it is an {@link module:engine/view/elementdefinition~ViewElementDefinition}, converts it\n * to a function (because lower level converters accept only element creator functions).\n *\n * @param view View configuration.\n * @param viewElementType View element type to create.\n * @returns Element creator function to use in lower level converters.\n */\nfunction normalizeToElementConfig(view, viewElementType) {\n    if (typeof view == 'function') {\n        // If `view` is already a function, don't do anything.\n        return view;\n    }\n    return ((modelData, conversionApi) => createViewElementFromDefinition(view, conversionApi, viewElementType));\n}\n/**\n * Creates a view element instance from the provided {@link module:engine/view/elementdefinition~ViewElementDefinition} and class.\n */\nfunction createViewElementFromDefinition(viewElementDefinition, conversionApi, viewElementType) {\n    if (typeof viewElementDefinition == 'string') {\n        // If `viewElementDefinition` is given as a `String`, normalize it to an object with `name` property.\n        viewElementDefinition = { name: viewElementDefinition };\n    }\n    let element;\n    const viewWriter = conversionApi.writer;\n    const attributes = Object.assign({}, viewElementDefinition.attributes);\n    if (viewElementType == 'container') {\n        element = viewWriter.createContainerElement(viewElementDefinition.name, attributes);\n    }\n    else if (viewElementType == 'attribute') {\n        const options = {\n            priority: viewElementDefinition.priority || ViewAttributeElement.DEFAULT_PRIORITY\n        };\n        element = viewWriter.createAttributeElement(viewElementDefinition.name, attributes, options);\n    }\n    else {\n        // 'ui'.\n        element = viewWriter.createUIElement(viewElementDefinition.name, attributes);\n    }\n    if (viewElementDefinition.styles) {\n        const keys = Object.keys(viewElementDefinition.styles);\n        for (const key of keys) {\n            viewWriter.setStyle(key, viewElementDefinition.styles[key], element);\n        }\n    }\n    if (viewElementDefinition.classes) {\n        const classes = viewElementDefinition.classes;\n        if (typeof classes == 'string') {\n            viewWriter.addClass(classes, element);\n        }\n        else {\n            for (const className of classes) {\n                viewWriter.addClass(className, element);\n            }\n        }\n    }\n    return element;\n}\nfunction getFromAttributeCreator(config) {\n    if (config.model.values) {\n        return ((modelAttributeValue, conversionApi, data) => {\n            const view = config.view[modelAttributeValue];\n            if (view) {\n                return view(modelAttributeValue, conversionApi, data);\n            }\n            return null;\n        });\n    }\n    else {\n        return config.view;\n    }\n}\n/**\n * Takes the configuration, adds default parameters if they do not exist and normalizes other parameters to be used in downcast converters\n * for generating a view attribute.\n *\n * @param view View configuration.\n */\nfunction normalizeToAttributeConfig(view) {\n    if (typeof view == 'string') {\n        return modelAttributeValue => ({ key: view, value: modelAttributeValue });\n    }\n    else if (typeof view == 'object') {\n        // { key, value, ... }\n        if (view.value) {\n            return () => view;\n        }\n        // { key, ... }\n        else {\n            return modelAttributeValue => ({ key: view.key, value: modelAttributeValue });\n        }\n    }\n    else {\n        // function.\n        return view;\n    }\n}\n/**\n * Helper function for `highlight`. Prepares the actual descriptor object using value passed to the converter.\n */\nfunction prepareDescriptor(highlightDescriptor, data, conversionApi) {\n    // If passed descriptor is a creator function, call it. If not, just use passed value.\n    const descriptor = typeof highlightDescriptor == 'function' ?\n        highlightDescriptor(data, conversionApi) :\n        { ...highlightDescriptor };\n    if (!descriptor) {\n        return null;\n    }\n    // Apply default descriptor priority.\n    if (!descriptor.priority) {\n        descriptor.priority = 10;\n    }\n    // Default descriptor id is marker name.\n    if (!descriptor.id) {\n        descriptor.id = data.markerName;\n    }\n    return descriptor;\n}\n/**\n * Creates a function that checks a single differ diff item whether it should trigger reconversion.\n *\n * @param model A normalized `config.model` converter configuration.\n * @param model.name The name of element.\n * @param model.attributes The list of attribute names that should trigger reconversion.\n * @param model.children Whether the child list change should trigger reconversion.\n */\nfunction createChangeReducerCallback(model) {\n    return (node, change) => {\n        if (!node.is('element', model.name)) {\n            return false;\n        }\n        if (change.type == 'attribute') {\n            if (model.attributes.includes(change.attributeKey)) {\n                return true;\n            }\n        }\n        else {\n            /* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */\n            if (model.children) {\n                return true;\n            }\n        }\n        return false;\n    };\n}\n/**\n * Creates a `reduceChanges` event handler for reconversion.\n *\n * @param model A normalized `config.model` converter configuration.\n * @param model.name The name of element.\n * @param model.attributes The list of attribute names that should trigger reconversion.\n * @param model.children Whether the child list change should trigger reconversion.\n */\nfunction createChangeReducer(model) {\n    const shouldReplace = createChangeReducerCallback(model);\n    return (evt, data) => {\n        const reducedChanges = [];\n        if (!data.reconvertedElements) {\n            data.reconvertedElements = new Set();\n        }\n        for (const change of data.changes) {\n            // For attribute use node affected by the change.\n            // For insert or remove use parent element because we need to check if it's added/removed child.\n            const node = change.type == 'attribute' ? change.range.start.nodeAfter : change.position.parent;\n            if (!node || !shouldReplace(node, change) || change.type == 'reinsert') {\n                reducedChanges.push(change);\n                continue;\n            }\n            // Force to not-reuse view elements renamed in model.\n            if (change.type == 'insert' && change.action == 'rename') {\n                data.refreshedItems.add(change.position.nodeAfter);\n            }\n            // If it's already marked for reconversion, so skip this change, otherwise add the diff items.\n            if (!data.reconvertedElements.has(node)) {\n                data.reconvertedElements.add(node);\n                const position = ModelPosition._createBefore(node);\n                let changeIndex = reducedChanges.length;\n                // We need to insert remove+reinsert before any other change on and inside the re-converted element.\n                // This is important because otherwise we would remove element that had already been modified by the previous change.\n                // Note that there could be some element removed before the re-converted element, so we must not break this behavior.\n                for (let i = reducedChanges.length - 1; i >= 0; i--) {\n                    const change = reducedChanges[i];\n                    const changePosition = change.type == 'attribute' ? change.range.start : change.position;\n                    const positionRelation = changePosition.compareWith(position);\n                    if (positionRelation == 'before' || change.type == 'remove' && positionRelation == 'same') {\n                        break;\n                    }\n                    changeIndex = i;\n                }\n                reducedChanges.splice(changeIndex, 0, {\n                    type: 'reinsert',\n                    name: node.name,\n                    position,\n                    length: 1\n                });\n            }\n        }\n        data.changes = reducedChanges;\n    };\n}\n/**\n * Creates a function that checks if an element and its watched attributes can be consumed and consumes them.\n *\n * @param model A normalized `config.model` converter configuration.\n * @param model.name The name of element.\n * @param model.attributes The list of attribute names that should trigger reconversion.\n * @param model.children Whether the child list change should trigger reconversion.\n */\nfunction createConsumer(model) {\n    return (node, consumable, options = {}) => {\n        const events = ['insert'];\n        // Collect all set attributes that are triggering conversion.\n        for (const attributeName of model.attributes) {\n            if (node.hasAttribute(attributeName)) {\n                events.push(`attribute:${attributeName}`);\n            }\n        }\n        if (!events.every(event => consumable.test(node, event))) {\n            return false;\n        }\n        if (!options.preflight) {\n            events.forEach(event => consumable.consume(node, event));\n        }\n        return true;\n    };\n}\n/**\n * Creates a function that creates view slots.\n *\n * @returns Function exposed by the writer as `createSlot()`.\n */\nfunction createSlotFactory(element, slotsMap, conversionApi) {\n    return (writer, modeOrFilter) => {\n        const slot = writer.createContainerElement('$slot');\n        let children = null;\n        if (modeOrFilter === 'children') {\n            children = Array.from(element.getChildren());\n        }\n        else if (typeof modeOrFilter == 'function') {\n            children = Array.from(element.getChildren()).filter(element => modeOrFilter(element));\n        }\n        else {\n            /**\n             * Unknown slot mode was provided to `writer.createSlot()` in the downcast converter.\n             *\n             * @error conversion-slot-mode-unknown\n             * @param {never} modeOrFilter The specified mode or filter.\n             */\n            throw new CKEditorError('conversion-slot-mode-unknown', conversionApi.dispatcher, { modeOrFilter });\n        }\n        slotsMap.set(slot, children);\n        return slot;\n    };\n}\n/**\n * Checks if all children are covered by slots and there is no child that landed in multiple slots.\n */\nfunction validateSlotsChildren(element, slotsMap, conversionApi) {\n    const childrenInSlots = Array.from(slotsMap.values()).flat();\n    const uniqueChildrenInSlots = new Set(childrenInSlots);\n    if (uniqueChildrenInSlots.size != childrenInSlots.length) {\n        /**\n         * Filters provided to `writer.createSlot()` overlap (at least two filters accept the same child element).\n         *\n         * @error conversion-slot-filter-overlap\n         * @param {module:engine/model/element~ModelElement} element The element of which children would not be properly\n         * allocated to multiple slots.\n         */\n        throw new CKEditorError('conversion-slot-filter-overlap', conversionApi.dispatcher, { element });\n    }\n    if (uniqueChildrenInSlots.size != element.childCount) {\n        /**\n         * Filters provided to `writer.createSlot()` are incomplete and exclude at least one children element (one of\n         * the children elements would not be assigned to any of the slots).\n         *\n         * @error conversion-slot-filter-incomplete\n         * @param {module:engine/model/element~ModelElement} element The element of which children would not be properly\n         * allocated to multiple slots.\n         */\n        throw new CKEditorError('conversion-slot-filter-incomplete', conversionApi.dispatcher, { element });\n    }\n}\n/**\n * Fill slots with appropriate view elements.\n */\nfunction fillSlots(viewElement, slotsMap, conversionApi, options) {\n    // Set temporary position mapping to redirect child view elements into a proper slots.\n    conversionApi.mapper.on('modelToViewPosition', toViewPositionMapping, { priority: 'highest' });\n    let currentSlot = null;\n    let currentSlotNodes = null;\n    // Fill slots with nested view nodes.\n    for ([currentSlot, currentSlotNodes] of slotsMap) {\n        reinsertOrConvertNodes(viewElement, currentSlotNodes, conversionApi, options);\n        conversionApi.writer.setCustomProperty('$structureSlotParent', true, currentSlot.parent);\n        conversionApi.writer.move(conversionApi.writer.createRangeIn(currentSlot), conversionApi.writer.createPositionBefore(currentSlot));\n        conversionApi.writer.remove(currentSlot);\n    }\n    conversionApi.mapper.off('modelToViewPosition', toViewPositionMapping);\n    function toViewPositionMapping(evt, data) {\n        const element = data.modelPosition.nodeAfter;\n        // Find the proper offset within the slot.\n        const index = currentSlotNodes.indexOf(element);\n        if (index < 0) {\n            return;\n        }\n        data.viewPosition = data.mapper.findPositionIn(currentSlot, index);\n    }\n}\n/**\n * Inserts view representation of `nodes` into the `viewElement` either by bringing back just removed view nodes\n * or by triggering conversion for them.\n */\nfunction reinsertOrConvertNodes(viewElement, modelNodes, conversionApi, options) {\n    // Fill with nested view nodes.\n    for (const modelChildNode of modelNodes) {\n        // Try reinserting the view node for the specified model node...\n        if (!reinsertNode(viewElement.root, modelChildNode, conversionApi, options)) {\n            // ...or else convert the model element to the view.\n            conversionApi.convertItem(modelChildNode);\n        }\n    }\n}\n/**\n * Checks if the view for the given model element could be reused and reinserts it to the view.\n *\n * @returns `false` if view element can't be reused.\n */\nfunction reinsertNode(viewRoot, modelNode, conversionApi, options) {\n    const { writer, mapper } = conversionApi;\n    // Don't reinsert if this is not a reconversion...\n    if (!options.reconversion) {\n        return false;\n    }\n    const viewChildNode = mapper.toViewElement(modelNode);\n    // ...or there is no view to reinsert or it was already inserted to the view structure...\n    if (!viewChildNode || viewChildNode.root == viewRoot) {\n        return false;\n    }\n    // ...or it was strictly marked as not to be reused.\n    if (!conversionApi.canReuseView(viewChildNode)) {\n        return false;\n    }\n    // Otherwise reinsert the view node.\n    writer.move(writer.createRangeOn(viewChildNode), mapper.toViewPosition(ModelPosition._createBefore(modelNode)));\n    return true;\n}\n/**\n * The default consumer for insert events.\n *\n * @param item Model item.\n * @param consumable The model consumable.\n * @param options.preflight Whether should consume or just check if can be consumed.\n */\nfunction defaultConsumer(item, consumable, { preflight } = {}) {\n    if (preflight) {\n        return consumable.test(item, 'insert');\n    }\n    else {\n        return consumable.consume(item, 'insert');\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/utils/autoparagraphing\n */\n/**\n * Fixes all empty roots.\n *\n * @internal\n * @param writer The model writer.\n * @returns `true` if any change has been applied, `false` otherwise.\n */\nexport function autoParagraphEmptyRoots(writer) {\n    const { schema, document } = writer.model;\n    for (const root of document.getRoots()) {\n        if (root.isEmpty && !schema.checkChild(root, '$text')) {\n            // If paragraph element is allowed in the root, create paragraph element.\n            if (schema.checkChild(root, 'paragraph')) {\n                writer.insertElement('paragraph', root);\n                // Other roots will get fixed in the next post-fixer round. Those will be triggered\n                // in the same batch no matter if this method was triggered by the post-fixing or not\n                // (the above insertElement call will trigger the post-fixers).\n                return true;\n            }\n        }\n    }\n    return false;\n}\n/**\n * Checks if the given node wrapped with a paragraph would be accepted by the schema in the given position.\n *\n * @internal\n * @param position The position at which to check.\n * @param nodeOrType The child node or child type to check.\n * @param schema A schema instance used for element validation.\n */\nexport function isParagraphable(position, nodeOrType, schema) {\n    const context = schema.createContext(position);\n    // When paragraph is allowed in this context...\n    if (!schema.checkChild(context, 'paragraph')) {\n        return false;\n    }\n    // And a node would be allowed in this paragraph...\n    if (!schema.checkChild(context.push('paragraph'), nodeOrType)) {\n        return false;\n    }\n    return true;\n}\n/**\n * Inserts a new paragraph at the given position and returns a position inside that paragraph.\n *\n * @internal\n * @param position The position where a paragraph should be inserted.\n * @param writer The model writer.\n * @returns  Position inside the created paragraph.\n */\nexport function wrapInParagraph(position, writer) {\n    const paragraph = writer.createElement('paragraph');\n    writer.insert(paragraph, position);\n    return writer.createPositionAt(paragraph, 0);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Matcher } from '../view/matcher.js';\nimport { ConversionHelpers } from './conversionhelpers.js';\nimport { isParagraphable, wrapInParagraph } from '../model/utils/autoparagraphing.js';\nimport { priorities } from '@ckeditor/ckeditor5-utils';\nimport { cloneDeep } from 'es-toolkit/compat';\n/**\n * Contains the {@link module:engine/view/view view} to {@link module:engine/model/model model} converters for\n * {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher}.\n *\n * @module engine/conversion/upcasthelpers\n */\n/**\n * Upcast conversion helper functions.\n *\n * Learn more about {@glink framework/deep-dive/conversion/upcast upcast helpers}.\n *\n * @extends module:engine/conversion/conversionhelpers~ConversionHelpers\n */\nexport class UpcastHelpers extends ConversionHelpers {\n    /**\n     * View element to model element conversion helper.\n     *\n     * This conversion results in creating a model element. For example,\n     * view `<p>Foo</p>` becomes `<paragraph>Foo</paragraph>` in the model.\n     *\n     * Keep in mind that the element will be inserted only if it is allowed\n     * by {@link module:engine/model/schema~ModelSchema schema} configuration.\n     *\n     * ```ts\n     * editor.conversion.for( 'upcast' ).elementToElement( {\n     * \tview: 'p',\n     * \tmodel: 'paragraph'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToElement( {\n     * \tview: 'p',\n     * \tmodel: 'paragraph',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToElement( {\n     * \tview: {\n     * \t\tname: 'p',\n     * \t\tclasses: 'fancy'\n     * \t},\n     * \tmodel: 'fancyParagraph'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToElement( {\n     * \tview: {\n     * \t\tname: 'p',\n     * \t\tclasses: 'heading'\n     * \t},\n     * \tmodel: ( viewElement, conversionApi ) => {\n     * \t\tconst modelWriter = conversionApi.writer;\n     *\n     * \t\treturn modelWriter.createElement( 'heading', { level: viewElement.getAttribute( 'data-level' ) } );\n     * \t}\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.view Pattern matching all view elements which should be converted. If not set, the converter\n     * will fire for every view element.\n     * @param config.model Name of the model element, a model element instance or a function that takes a view element\n     * and {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API}\n     * and returns a model element. The model element will be inserted in the model.\n     * @param config.converterPriority Converter priority.\n     */\n    elementToElement(config) {\n        return this.add(upcastElementToElement(config));\n    }\n    /**\n     * View element to model attribute conversion helper.\n     *\n     * This conversion results in setting an attribute on a model node. For example, view `<strong>Foo</strong>` becomes\n     * `Foo` {@link module:engine/model/text~ModelText model text node} with `bold` attribute set to `true`.\n     *\n     * This helper is meant to set a model attribute on all the elements that are inside the converted element:\n     *\n     * ```\n     * <strong>Foo</strong>   -->   <strong><p>Foo</p></strong>   -->   <paragraph><$text bold=\"true\">Foo</$text></paragraph>\n     * ```\n     *\n     * Above is a sample of HTML code, that goes through autoparagraphing (first step) and then is converted (second step).\n     * Even though `<strong>` is over `<p>` element, `bold=\"true\"` was added to the text. See\n     * {@link module:engine/conversion/upcasthelpers~UpcastHelpers#attributeToAttribute} for comparison.\n     *\n     * Keep in mind that the attribute will be set only if it is allowed by\n     * {@link module:engine/model/schema~ModelSchema schema} configuration.\n     *\n     * ```ts\n     * editor.conversion.for( 'upcast' ).elementToAttribute( {\n     * \tview: 'strong',\n     * \tmodel: 'bold'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToAttribute( {\n     * \tview: 'strong',\n     * \tmodel: 'bold',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToAttribute( {\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tclasses: 'bold'\n     * \t},\n     * \tmodel: 'bold'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToAttribute( {\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tclasses: [ 'styled', 'styled-dark' ]\n     * \t},\n     * \tmodel: {\n     * \t\tkey: 'styled',\n     * \t\tvalue: 'dark'\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToAttribute( {\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tstyles: {\n     * \t\t\t'font-size': /[\\s\\S]+/\n     * \t\t}\n     * \t},\n     * \tmodel: {\n     * \t\tkey: 'fontSize',\n     * \t\tvalue: ( viewElement, conversionApi ) => {\n     * \t\t\tconst fontSize = viewElement.getStyle( 'font-size' );\n     * \t\t\tconst value = fontSize.substr( 0, fontSize.length - 2 );\n     *\n     * \t\t\tif ( value <= 10 ) {\n     * \t\t\t\treturn 'small';\n     * \t\t\t} else if ( value > 12 ) {\n     * \t\t\t\treturn 'big';\n     * \t\t\t}\n     *\n     * \t\t\treturn null;\n     * \t\t}\n     * \t}\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.view Pattern matching all view elements which should be converted.\n     * @param config.model Model attribute key or an object with `key` and `value` properties, describing\n     * the model attribute. `value` property may be set as a function that takes a view element and\n     * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value.\n     * If `String` is given, the model attribute value will be set to `true`.\n     * @param config.converterPriority Converter priority. Defaults to `low`.\n     */\n    elementToAttribute(config) {\n        return this.add(upcastElementToAttribute(config));\n    }\n    /**\n     * View attribute to model attribute conversion helper.\n     *\n     * This conversion results in setting an attribute on a model node. For example, view `<img src=\"foo.jpg\"></img>` becomes\n     * `<imageBlock source=\"foo.jpg\"></imageBlock>` in the model.\n     *\n     * This helper is meant to convert view attributes from view elements which got converted to the model, so the view attribute\n     * is set only on the corresponding model node:\n     *\n     * ```\n     * <div class=\"dark\"><div>foo</div></div>    -->    <div dark=\"true\"><div>foo</div></div>\n     * ```\n     *\n     * Above, `class=\"dark\"` attribute is added only to the `<div>` elements that has it. This is in contrast to\n     * {@link module:engine/conversion/upcasthelpers~UpcastHelpers#elementToAttribute} which sets attributes for\n     * all the children in the model:\n     *\n     * ```\n     * <strong>Foo</strong>   -->   <strong><p>Foo</p></strong>   -->   <paragraph><$text bold=\"true\">Foo</$text></paragraph>\n     * ```\n     *\n     * Above is a sample of HTML code, that goes through autoparagraphing (first step) and then is converted (second step).\n     * Even though `<strong>` is over `<p>` element, `bold=\"true\"` was added to the text.\n     *\n     * Keep in mind that the attribute will be set only if it is allowed by\n     * {@link module:engine/model/schema~ModelSchema schema} configuration.\n     *\n     * ```ts\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: 'src',\n     * \tmodel: 'source'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: { key: 'src' },\n     * \tmodel: 'source'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: { key: 'src' },\n     * \tmodel: 'source',\n     * \tconverterPriority: 'normal'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: {\n     * \t\tkey: 'data-style',\n     * \t\tvalue: /[\\s\\S]+/\n     * \t},\n     * \tmodel: 'styled'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: {\n     * \t\tname: 'img',\n     * \t\tkey: 'class',\n     * \t\tvalue: 'styled-dark'\n     * \t},\n     * \tmodel: {\n     * \t\tkey: 'styled',\n     * \t\tvalue: 'dark'\n     * \t}\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: {\n     * \t\tkey: 'class',\n     * \t\tvalue: /styled-[\\S]+/\n     * \t},\n     * \tmodel: {\n     * \t\tkey: 'styled'\n     * \t\tvalue: ( viewElement, conversionApi ) => {\n     * \t\t\tconst regexp = /styled-([\\S]+)/;\n     * \t\t\tconst match = viewElement.getAttribute( 'class' ).match( regexp );\n     *\n     * \t\t\treturn match[ 1 ];\n     * \t\t}\n     * \t}\n     * } );\n     * ```\n     *\n     * Converting styles works a bit differently as it requires `view.styles` to be an object and by default\n     * a model attribute will be set to `true` by such a converter. You can set the model attribute to any value by providing the `value`\n     * callback that returns the desired value.\n     *\n     * ```ts\n     * // Default conversion of font-weight style will result in setting bold attribute to true.\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: {\n     * \t\tstyles: {\n     * \t\t\t'font-weight': 'bold'\n     * \t\t}\n     * \t},\n     * \tmodel: 'bold'\n     * } );\n     *\n     * // This converter will pass any style value to the `lineHeight` model attribute.\n     * editor.conversion.for( 'upcast' ).attributeToAttribute( {\n     * \tview: {\n     * \t\tstyles: {\n     * \t\t\t'line-height': /[\\s\\S]+/\n     * \t\t}\n     * \t},\n     * \tmodel: {\n     * \t\tkey: 'lineHeight',\n     * \t\tvalue: ( viewElement, conversionApi ) => viewElement.getStyle( 'line-height' )\n     * \t}\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.view Specifies which view attribute will be converted. If a `String` is passed,\n     * attributes with given key will be converted. If an `Object` is passed, it must have a required `key` property,\n     * specifying view attribute key, and may have an optional `value` property, specifying view attribute value and optional `name`\n     * property specifying a view element name from/on which the attribute should be converted. `value` can be given as a `String`,\n     * a `RegExp` or a function callback, that takes view attribute value as the only parameter and returns `Boolean`.\n     * @param config.model Model attribute key or an object with `key` and `value` properties, describing\n     * the model attribute. `value` property may be set as a function that takes a view element and\n     * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value.\n     * If `String` is given, the model attribute value will be same as view attribute value.\n     * @param config.converterPriority Converter priority. Defaults to `low`.\n     */\n    attributeToAttribute(config) {\n        return this.add(upcastAttributeToAttribute(config));\n    }\n    /**\n     * View element to model marker conversion helper.\n     *\n     * This conversion results in creating a model marker. For example, if the marker was stored in a view as an element:\n     * `<p>Fo<span data-marker=\"comment\" data-comment-id=\"7\"></span>o</p><p>B<span data-marker=\"comment\" data-comment-id=\"7\"></span>ar</p>`,\n     * after the conversion is done, the marker will be available in\n     * {@link module:engine/model/model~Model#markers model document markers}.\n     *\n     * **Note**: When this helper is used in the data upcast in combination with\n     * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`} in the data downcast,\n     * then invalid HTML code (e.g. a span between table cells) may be produced by the latter converter.\n     *\n     * In most of the cases, the {@link #dataToMarker} should be used instead.\n     *\n     * ```ts\n     * editor.conversion.for( 'upcast' ).elementToMarker( {\n     * \tview: 'marker-search',\n     * \tmodel: 'search'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToMarker( {\n     * \tview: 'marker-search',\n     * \tmodel: 'search',\n     * \tconverterPriority: 'high'\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToMarker( {\n     * \tview: 'marker-search',\n     * \tmodel: ( viewElement, conversionApi ) => 'comment:' + viewElement.getAttribute( 'data-comment-id' )\n     * } );\n     *\n     * editor.conversion.for( 'upcast' ).elementToMarker( {\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tattributes: {\n     * \t\t\t'data-marker': 'search'\n     * \t\t}\n     * \t},\n     * \tmodel: 'search'\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.view Pattern matching all view elements which should be converted.\n     * @param config.model Name of the model marker, or a function that takes a view element and returns\n     * a model marker name.\n     * @param config.converterPriority Converter priority.\n     */\n    elementToMarker(config) {\n        return this.add(upcastElementToMarker(config));\n    }\n    /**\n     * View-to-model marker conversion helper.\n     *\n     * Converts view data created by {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`}\n     * back to a model marker.\n     *\n     * This converter looks for specific view elements and view attributes that mark marker boundaries. See\n     * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`} to learn what view data\n     * is expected by this converter.\n     *\n     * The `config.view` property is equal to the marker group name to convert.\n     *\n     * By default, this converter creates markers with the `group:name` name convention (to match the default `markerToData` conversion).\n     *\n     * The conversion configuration can take a function that will generate a marker name.\n     * If such function is set as the `config.model` parameter, it is passed the `name` part from the view element or attribute and it is\n     * expected to return a string with the marker name.\n     *\n     * Basic usage:\n     *\n     * ```ts\n     * // Using the default conversion.\n     * // In this case, all markers from the `comment` group will be converted.\n     * // The conversion will look for `<comment-start>` and `<comment-end>` tags and\n     * // `data-comment-start-before`, `data-comment-start-after`,\n     * // `data-comment-end-before` and `data-comment-end-after` attributes.\n     * editor.conversion.for( 'upcast' ).dataToMarker( {\n     * \tview: 'comment'\n     * } );\n     * ```\n     *\n     * An example of a model that may be generated by this conversion:\n     *\n     * ```\n     * // View:\n     * <p>Foo<comment-start name=\"commentId:uid\"></comment-start>bar</p>\n     * <figure data-comment-end-after=\"commentId:uid\" class=\"image\"><img src=\"abc.jpg\" /></figure>\n     *\n     * // Model:\n     * <paragraph>Foo[bar</paragraph>\n     * <imageBlock src=\"abc.jpg\"></imageBlock>]\n     * ```\n     *\n     * Where `[]` are boundaries of a marker that will receive the `comment:commentId:uid` name.\n     *\n     * Other examples of usage:\n     *\n     * ```ts\n     * // Using a custom function which is the same as the default conversion:\n     * editor.conversion.for( 'upcast' ).dataToMarker( {\n     * \tview: 'comment',\n     * \tmodel: ( name, conversionApi ) => 'comment:' + name,\n     * } );\n     *\n     * // Using the converter priority:\n     * editor.conversion.for( 'upcast' ).dataToMarker( {\n     * \tview: 'comment',\n     * \tmodel: ( name, conversionApi ) => 'comment:' + name,\n     * \tconverterPriority: 'high'\n     * } );\n     * ```\n     *\n     * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter\n     * to the conversion process.\n     *\n     * @param config Conversion configuration.\n     * @param config.view The marker group name to convert.\n     * @param config.model A function that takes the `name` part from the view element or attribute and\n     * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the marker name.\n     * @param config.converterPriority Converter priority.\n     */\n    dataToMarker(config) {\n        return this.add(upcastDataToMarker(config));\n    }\n}\n/**\n * Function factory, creates a converter that converts\n * {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}\n * or all children of {@link module:engine/view/element~ViewElement} into\n * {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment}.\n * This is the \"entry-point\" converter for upcast (view to model conversion). This converter starts the conversion of all children\n * of passed view document fragment. Those children {@link module:engine/view/node~ViewNode view nodes} are then\n * handled by other converters.\n *\n * This also a \"default\", last resort converter for all view elements that has not been converted by other converters.\n * When a view element is being converted to the model but it does not have converter specified, that view element\n * will be converted to {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} and returned.\n *\n * @returns Universal converter for view {@link module:engine/view/documentfragment~ViewDocumentFragment fragments} and\n * {@link module:engine/view/element~ViewElement elements} that returns\n * {@link module:engine/model/documentfragment~ModelDocumentFragment model fragment} with children of converted view item.\n *\n * @internal\n */\nexport function convertToModelFragment() {\n    return (evt, data, conversionApi) => {\n        // Second argument in `consumable.consume` is discarded for ViewDocumentFragment but is needed for ViewElement.\n        if (!data.modelRange && conversionApi.consumable.consume(data.viewItem, { name: true })) {\n            const { modelRange, modelCursor } = conversionApi.convertChildren(data.viewItem, data.modelCursor);\n            data.modelRange = modelRange;\n            data.modelCursor = modelCursor;\n        }\n    };\n}\n/**\n * Function factory, creates a converter that converts\n * {@link module:engine/view/text~ViewText} to {@link module:engine/model/text~ModelText}.\n *\n * @returns {@link module:engine/view/text~ViewText View text} converter.\n * @internal\n */\nexport function convertText() {\n    return (evt, data, { schema, consumable, writer }) => {\n        let position = data.modelCursor;\n        // When node is already converted then do nothing.\n        if (!consumable.test(data.viewItem)) {\n            return;\n        }\n        if (!schema.checkChild(position, '$text')) {\n            if (!isParagraphable(position, '$text', schema)) {\n                return;\n            }\n            // Do not auto-paragraph whitespaces.\n            if (data.viewItem.data.trim().length == 0) {\n                return;\n            }\n            position = wrapInParagraph(position, writer);\n        }\n        consumable.consume(data.viewItem);\n        const text = writer.createText(data.viewItem.data);\n        writer.insert(text, position);\n        data.modelRange = writer.createRange(position, position.getShiftedBy(text.offsetSize));\n        data.modelCursor = data.modelRange.end;\n    };\n}\n/**\n * Function factory, creates a callback function which converts a {@link module:engine/view/selection~ViewSelection\n * view selection} taken from the {@link module:engine/view/document~ViewDocument#event:selectionChange} event\n * and sets in on the {@link module:engine/model/document~ModelDocument#selection model}.\n *\n * **Note**: because there is no view selection change dispatcher nor any other advanced view selection to model\n * conversion mechanism, the callback should be set directly on view document.\n *\n * ```ts\n * view.document.on( 'selectionChange', convertSelectionChange( modelDocument, mapper ) );\n * ```\n *\n * @param model Data model.\n * @param mapper Conversion mapper.\n * @returns {@link module:engine/view/document~ViewDocument#event:selectionChange} callback function.\n * @internal\n */\nexport function convertSelectionChange(model, mapper) {\n    return (evt, data) => {\n        const viewSelection = data.newSelection;\n        const ranges = [];\n        for (const viewRange of viewSelection.getRanges()) {\n            ranges.push(mapper.toModelRange(viewRange));\n        }\n        const modelSelection = model.createSelection(ranges, { backward: viewSelection.isBackward });\n        if (!modelSelection.isEqual(model.document.selection)) {\n            model.change(writer => {\n                writer.setSelection(modelSelection);\n            });\n        }\n    };\n}\n/**\n * View element to model element conversion helper.\n *\n * See {@link ~UpcastHelpers#elementToElement `.elementToElement()` upcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.view Pattern matching all view elements which should be converted. If not\n * set, the converter will fire for every view element.\n * @param config.model Name of the model element, a model element\n * instance or a function that takes a view element and returns a model element. The model element will be inserted in the model.\n * @param config.converterPriority Converter priority.\n * @returns Conversion helper.\n */\nfunction upcastElementToElement(config) {\n    config = cloneDeep(config);\n    const converter = prepareToElementConverter(config);\n    const elementName = getViewElementNameFromConfig(config.view);\n    const eventName = elementName ? `element:${elementName}` : 'element';\n    return (dispatcher) => {\n        dispatcher.on(eventName, converter, { priority: config.converterPriority || 'normal' });\n    };\n}\n/**\n * View element to model attribute conversion helper.\n *\n * See {@link ~UpcastHelpers#elementToAttribute `.elementToAttribute()` upcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.view Pattern matching all view elements which should be converted.\n * @param config.model Model attribute key or an object with `key` and `value` properties, describing\n * the model attribute. `value` property may be set as a function that takes a view element and returns the value.\n * If `String` is given, the model attribute value will be set to `true`.\n * @param config.converterPriority Converter priority. Defaults to `low`.\n * @returns Conversion helper.\n */\nfunction upcastElementToAttribute(config) {\n    config = cloneDeep(config);\n    normalizeModelAttributeConfig(config);\n    const converter = prepareToAttributeConverter(config, false);\n    const elementName = getViewElementNameFromConfig(config.view);\n    const eventName = elementName ? `element:${elementName}` : 'element';\n    return (dispatcher) => {\n        dispatcher.on(eventName, converter, { priority: config.converterPriority || 'low' });\n    };\n}\n/**\n * View attribute to model attribute conversion helper.\n *\n * See {@link ~UpcastHelpers#attributeToAttribute `.attributeToAttribute()` upcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.view Specifies which view attribute will be converted. If a `String` is passed,\n * attributes with given key will be converted. If an `Object` is passed, it must have a required `key` property,\n * specifying view attribute key, and may have an optional `value` property, specifying view attribute value and optional `name`\n * property specifying a view element name from/on which the attribute should be converted. `value` can be given as a `String`,\n * a `RegExp` or a function callback, that takes view attribute value as the only parameter and returns `Boolean`.\n * @param config.model Model attribute key or an object with `key` and `value` properties, describing\n * the model attribute. `value` property may be set as a function that takes a view element and returns the value.\n * If `String` is given, the model attribute value will be same as view attribute value.\n * @param config.converterPriority Converter priority. Defaults to `low`.\n * @returns Conversion helper.\n */\nfunction upcastAttributeToAttribute(config) {\n    config = cloneDeep(config);\n    let viewKey = null;\n    if (typeof config.view == 'string' || config.view.key) {\n        viewKey = normalizeViewAttributeKeyValueConfig(config);\n    }\n    normalizeModelAttributeConfig(config, viewKey);\n    const converter = prepareToAttributeConverter(config, true);\n    return (dispatcher) => {\n        dispatcher.on('element', converter, { priority: config.converterPriority || 'low' });\n    };\n}\n/**\n * View element to model marker conversion helper.\n *\n * See {@link ~UpcastHelpers#elementToMarker `.elementToMarker()` upcast helper} for examples.\n *\n * @param config Conversion configuration.\n * @param config.view Pattern matching all view elements which should be converted.\n * @param config.model Name of the model marker, or a function that takes a view element and returns\n * a model marker name.\n * @param config.converterPriority Converter priority.\n * @returns Conversion helper.\n */\nfunction upcastElementToMarker(config) {\n    const model = normalizeElementToMarkerModelConfig(config.model);\n    return upcastElementToElement({ ...config, model });\n}\n/**\n * View data to model marker conversion helper.\n *\n * See {@link ~UpcastHelpers#dataToMarker} to learn more.\n *\n * @returns Conversion helper.\n */\nfunction upcastDataToMarker(config) {\n    config = cloneDeep(config);\n    // Default conversion.\n    if (!config.model) {\n        config.model = name => {\n            return name ? config.view + ':' + name : config.view;\n        };\n    }\n    const normalizedConfig = {\n        view: config.view,\n        model: config.model\n    };\n    const converterStart = prepareToElementConverter(normalizeDataToMarkerConfig(normalizedConfig, 'start'));\n    const converterEnd = prepareToElementConverter(normalizeDataToMarkerConfig(normalizedConfig, 'end'));\n    return (dispatcher) => {\n        dispatcher.on(`element:${config.view}-start`, converterStart, { priority: config.converterPriority || 'normal' });\n        dispatcher.on(`element:${config.view}-end`, converterEnd, { priority: config.converterPriority || 'normal' });\n        // Below is a hack that is needed to properly handle `converterPriority` for both elements and attributes.\n        // Attribute conversion needs to be performed *after* element conversion.\n        // This converter handles both element conversion and attribute conversion, which means that if a single\n        // `config.converterPriority` is used, it will lead to problems. For example, if the `'high'` priority is used,\n        // the attribute conversion will be performed before a lot of element upcast converters.\n        // On the other hand, we want to support `config.converterPriority` and converter overwriting.\n        //\n        // To make it work, we need to do some extra processing for priority for attribute converter.\n        // Priority `'low'` value should be the base value and then we will change it depending on `config.converterPriority` value.\n        //\n        // This hack probably would not be needed if attributes are upcasted separately.\n        //\n        const basePriority = priorities.low;\n        const maxPriority = priorities.highest;\n        const priorityFactor = priorities.get(config.converterPriority) / maxPriority; // Number in range [ -1, 1 ].\n        dispatcher.on('element', upcastAttributeToMarker(normalizedConfig), { priority: basePriority + priorityFactor });\n    };\n}\n/**\n * Function factory, returns a callback function which converts view attributes to a model marker.\n *\n * The converter looks for elements with `data-group-start-before`, `data-group-start-after`, `data-group-end-before`\n * and `data-group-end-after` attributes and inserts `$marker` model elements before/after those elements.\n * `group` part is specified in `config.view`.\n *\n * @returns Marker converter.\n */\nfunction upcastAttributeToMarker(config) {\n    return (evt, data, conversionApi) => {\n        const attrName = `data-${config.view}`;\n        // Check if any attribute for the given view item can be consumed before changing the conversion data\n        // and consuming view items with these attributes.\n        if (!conversionApi.consumable.test(data.viewItem, { attributes: attrName + '-end-after' }) &&\n            !conversionApi.consumable.test(data.viewItem, { attributes: attrName + '-start-after' }) &&\n            !conversionApi.consumable.test(data.viewItem, { attributes: attrName + '-end-before' }) &&\n            !conversionApi.consumable.test(data.viewItem, { attributes: attrName + '-start-before' })) {\n            return;\n        }\n        // This converter wants to add a model element, marking a marker, before/after an element (or maybe even group of elements).\n        // To do that, we can use `data.modelRange` which is set on an element (or a group of elements) that has been upcasted.\n        // But, if the processed view element has not been upcasted yet (it does not have been converted), we need to\n        // fire conversion for its children first, then we will have `data.modelRange` available.\n        if (!data.modelRange) {\n            Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));\n        }\n        if (conversionApi.consumable.consume(data.viewItem, { attributes: attrName + '-end-after' })) {\n            addMarkerElements(data.modelRange.end, data.viewItem.getAttribute(attrName + '-end-after').split(','));\n        }\n        if (conversionApi.consumable.consume(data.viewItem, { attributes: attrName + '-start-after' })) {\n            addMarkerElements(data.modelRange.end, data.viewItem.getAttribute(attrName + '-start-after').split(','));\n        }\n        if (conversionApi.consumable.consume(data.viewItem, { attributes: attrName + '-end-before' })) {\n            addMarkerElements(data.modelRange.start, data.viewItem.getAttribute(attrName + '-end-before').split(','));\n        }\n        if (conversionApi.consumable.consume(data.viewItem, { attributes: attrName + '-start-before' })) {\n            addMarkerElements(data.modelRange.start, data.viewItem.getAttribute(attrName + '-start-before').split(','));\n        }\n        function addMarkerElements(position, markerViewNames) {\n            for (const markerViewName of markerViewNames) {\n                const markerName = config.model(markerViewName, conversionApi);\n                const element = conversionApi.writer.createElement('$marker', { 'data-name': markerName });\n                conversionApi.writer.insert(element, position);\n                if (data.modelCursor.isEqual(position)) {\n                    data.modelCursor = data.modelCursor.getShiftedBy(1);\n                }\n                else {\n                    data.modelCursor = data.modelCursor._getTransformedByInsertion(position, 1);\n                }\n                data.modelRange = data.modelRange._getTransformedByInsertion(position, 1)[0];\n            }\n        }\n    };\n}\n/**\n * Helper function for from-view-element conversion. Checks if `config.view` directly specifies converted view element's name\n * and if so, returns it.\n *\n * @param config Conversion view config.\n * @returns View element name or `null` if name is not directly set.\n */\nfunction getViewElementNameFromConfig(viewConfig) {\n    if (typeof viewConfig == 'string') {\n        return viewConfig;\n    }\n    if (typeof viewConfig == 'object' && typeof viewConfig.name == 'string') {\n        return viewConfig.name;\n    }\n    return null;\n}\n/**\n * Helper for to-model-element conversion. Takes a config object and returns a proper converter function.\n *\n * @param config Conversion configuration.\n * @returns View to model converter.\n */\nfunction prepareToElementConverter(config) {\n    const matcher = new Matcher(config.view);\n    return (evt, data, conversionApi) => {\n        const matcherResult = matcher.match(data.viewItem);\n        if (!matcherResult) {\n            return;\n        }\n        const match = matcherResult.match;\n        // Force consuming element's name.\n        match.name = true;\n        if (!conversionApi.consumable.test(data.viewItem, match)) {\n            return;\n        }\n        const modelElement = getModelElement(config.model, data.viewItem, conversionApi);\n        if (!modelElement) {\n            return;\n        }\n        if (!conversionApi.safeInsert(modelElement, data.modelCursor)) {\n            return;\n        }\n        conversionApi.consumable.consume(data.viewItem, match);\n        conversionApi.convertChildren(data.viewItem, modelElement);\n        conversionApi.updateConversionResult(modelElement, data);\n    };\n}\n/**\n * Helper function for upcasting-to-element converter. Takes the model configuration, the converted view element\n * and a writer instance and returns a model element instance to be inserted in the model.\n *\n * @param model Model conversion configuration.\n * @param input The converted view node.\n * @param conversionApi The upcast conversion API.\n */\nfunction getModelElement(model, input, conversionApi) {\n    if (model instanceof Function) {\n        return model(input, conversionApi);\n    }\n    else {\n        return conversionApi.writer.createElement(model);\n    }\n}\n/**\n * Helper function view-attribute-to-model-attribute helper. Normalizes `config.view` which was set as `String` or\n * as an `Object` with `key`, `value` and `name` properties. Normalized `config.view` has is compatible with\n * {@link module:engine/view/matcher~MatcherPattern}.\n *\n * @param config Conversion config.\n * @returns Key of the converted view attribute.\n */\nfunction normalizeViewAttributeKeyValueConfig(config) {\n    if (typeof config.view == 'string') {\n        config.view = { key: config.view };\n    }\n    const key = config.view.key;\n    const value = typeof config.view.value == 'undefined' ? /[\\s\\S]*/ : config.view.value;\n    let normalized;\n    if (key == 'class' || key == 'style') {\n        const keyName = key == 'class' ? 'classes' : 'styles';\n        normalized = {\n            [keyName]: value\n        };\n    }\n    else {\n        normalized = {\n            attributes: {\n                [key]: value\n            }\n        };\n    }\n    if (config.view.name) {\n        normalized.name = config.view.name;\n    }\n    config.view = normalized;\n    return key;\n}\n/**\n * Helper function that normalizes `config.model` in from-model-attribute conversion. `config.model` can be set\n * as a `String`, an `Object` with only `key` property or an `Object` with `key` and `value` properties. Normalized\n * `config.model` is an `Object` with `key` and `value` properties.\n *\n * @param config Conversion config.\n * @param viewAttributeKeyToCopy Key of the converted view attribute. If it is set, model attribute value\n * will be equal to view attribute value.\n */\nfunction normalizeModelAttributeConfig(config, viewAttributeKeyToCopy = null) {\n    const defaultModelValue = viewAttributeKeyToCopy === null ? true :\n        (viewElement) => viewElement.getAttribute(viewAttributeKeyToCopy);\n    const key = typeof config.model != 'object' ? config.model : config.model.key;\n    const value = typeof config.model != 'object' || typeof config.model.value == 'undefined' ? defaultModelValue : config.model.value;\n    config.model = { key, value };\n}\n/**\n * Helper for to-model-attribute conversion. Takes the model attribute name and conversion configuration and returns\n * a proper converter function.\n *\n * @param config Conversion configuration. It is possible to provide multiple configurations in an array.\n * @param shallow If set to `true` the attribute will be set only on top-level nodes. Otherwise, it will be set\n * on all elements in the range.\n */\nfunction prepareToAttributeConverter(config, shallow) {\n    const matcher = new Matcher(config.view);\n    return (evt, data, conversionApi) => {\n        // Converting an attribute of an element that has not been converted to anything does not make sense\n        // because there will be nowhere to set that attribute on. At this stage, the element should've already\n        // been converted (https://github.com/ckeditor/ckeditor5/issues/11000).\n        if (!data.modelRange && shallow) {\n            return;\n        }\n        const match = matcher.match(data.viewItem);\n        // If there is no match, this callback should not do anything.\n        if (!match) {\n            return;\n        }\n        if (onlyViewNameIsDefined(config.view, data.viewItem)) {\n            match.match.name = true;\n        }\n        else {\n            // Do not test `name` consumable because it could get consumed already while upcasting some other attribute\n            // on the same element (for example <span class=\"big\" style=\"color: red\">foo</span>).\n            delete match.match.name;\n        }\n        // Try to consume appropriate values from consumable values list.\n        if (!conversionApi.consumable.test(data.viewItem, match.match)) {\n            return;\n        }\n        const modelKey = config.model.key;\n        const modelValue = typeof config.model.value == 'function' ?\n            config.model.value(data.viewItem, conversionApi, data) : config.model.value;\n        // Do not convert if attribute building function returned falsy value.\n        if (modelValue === null || modelValue === undefined) {\n            return;\n        }\n        // Since we are converting to attribute we need a range on which we will set the attribute.\n        // If the range is not created yet, let's create it by converting children of the current node first.\n        if (!data.modelRange) {\n            // Convert children and set conversion result as a current data.\n            Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));\n        }\n        // Set attribute on current `output`. `Schema` is checked inside this helper function.\n        const attributeWasSet = setAttributeOn(data.modelRange, { key: modelKey, value: modelValue }, shallow, conversionApi);\n        // It may happen that a converter will try to set an attribute that is not allowed in the given context.\n        // In such a situation we cannot consume the attribute. See: https://github.com/ckeditor/ckeditor5/pull/9249#issuecomment-815658459.\n        if (attributeWasSet) {\n            // Verify if the element itself wasn't consumed yet. It could be consumed already while upcasting some other attribute\n            // on the same element (for example <span class=\"big\" style=\"color: red\">foo</span>).\n            // We need to consume it so other features (especially GHS) won't try to convert it.\n            // Note that it's not tested by the other element-to-attribute converters whether an element was consumed before\n            // (in case of converters that the element itself is just a context and not the primary information to convert).\n            if (conversionApi.consumable.test(data.viewItem, { name: true })) {\n                match.match.name = true;\n            }\n            conversionApi.consumable.consume(data.viewItem, match.match);\n        }\n    };\n}\n/**\n * Helper function that checks if element name should be consumed in attribute converters.\n *\n * @param viewConfig Conversion view config.\n */\nfunction onlyViewNameIsDefined(viewConfig, viewItem) {\n    // https://github.com/ckeditor/ckeditor5-engine/issues/1786\n    const configToTest = typeof viewConfig == 'function' ? viewConfig(viewItem) : viewConfig;\n    if (typeof configToTest == 'object' && !getViewElementNameFromConfig(configToTest)) {\n        return false;\n    }\n    return !configToTest.classes && !configToTest.attributes && !configToTest.styles;\n}\n/**\n * Helper function for to-model-attribute converter. Sets model attribute on given range.\n * Checks {@link module:engine/model/schema~ModelSchema} to ensure proper model structure.\n *\n * If any node on the given range has already defined an attribute with the same name, its value will not be updated.\n *\n * @param modelRange Model range on which attribute should be set.\n * @param modelAttribute Model attribute to set.\n * @param conversionApi Conversion API.\n * @param shallow If set to `true` the attribute will be set only on top-level nodes. Otherwise, it will be set\n * on all elements in the range.\n * @returns `true` if attribute was set on at least one node from given `modelRange`.\n */\nfunction setAttributeOn(modelRange, modelAttribute, shallow, conversionApi) {\n    let result = false;\n    // Set attribute on each item in range according to Schema.\n    for (const node of Array.from(modelRange.getItems({ shallow }))) {\n        // Skip if not allowed.\n        if (!conversionApi.schema.checkAttribute(node, modelAttribute.key)) {\n            continue;\n        }\n        // Mark the node as consumed even if the attribute will not be updated because it's in a valid context (schema)\n        // and would be converted if the attribute wouldn't be present. See #8921.\n        result = true;\n        // Do not override the attribute if it's already present.\n        if (node.hasAttribute(modelAttribute.key)) {\n            continue;\n        }\n        conversionApi.writer.setAttribute(modelAttribute.key, modelAttribute.value, node);\n    }\n    return result;\n}\n/**\n * Helper function for upcasting-to-marker conversion. Takes the config in a format requested by `upcastElementToMarker()`\n * function and converts it to a format that is supported by `upcastElementToElement()` function.\n */\nfunction normalizeElementToMarkerModelConfig(model) {\n    return (viewElement, conversionApi) => {\n        const markerName = typeof model == 'string' ? model : model(viewElement, conversionApi);\n        return conversionApi.writer.createElement('$marker', { 'data-name': markerName });\n    };\n}\n/**\n * Helper function for upcasting-to-marker conversion. Takes the config in a format requested by `upcastDataToMarker()`\n * function and converts it to a format that is supported by `upcastElementToElement()` function.\n */\nfunction normalizeDataToMarkerConfig(config, type) {\n    const elementCreatorFunction = (viewElement, conversionApi) => {\n        const viewName = viewElement.getAttribute('name');\n        const markerName = config.model(viewName, conversionApi);\n        return conversionApi.writer.createElement('$marker', { 'data-name': markerName });\n    };\n    return {\n        // Upcast <markerGroup-start> and <markerGroup-end> elements.\n        view: `${config.view}-${type}`,\n        model: elementCreatorFunction\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/controller/editingcontroller\n */\nimport { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';\nimport { ViewRootEditableElement } from '../view/rooteditableelement.js';\nimport { EditingView } from '../view/view.js';\nimport { Mapper } from '../conversion/mapper.js';\nimport { DowncastDispatcher } from '../conversion/downcastdispatcher.js';\nimport { cleanSelection, convertCollapsedSelection, convertRangeSelection, insertAttributesAndChildren, insertText, remove } from '../conversion/downcasthelpers.js';\nimport { convertSelectionChange } from '../conversion/upcasthelpers.js';\n// @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );\n/**\n * A controller for the editing pipeline. The editing pipeline controls the {@link ~EditingController#model model} rendering,\n * including selection handling. It also creates the {@link ~EditingController#view view} which builds a\n * browser-independent virtualization over the DOM elements. The editing controller also attaches default converters.\n */\nexport class EditingController extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Editor model.\n     */\n    model;\n    /**\n     * Editing view controller.\n     */\n    view;\n    /**\n     * A mapper that describes the model-view binding.\n     */\n    mapper;\n    /**\n     * Downcast dispatcher that converts changes from the model to the {@link #view editing view}.\n     */\n    downcastDispatcher;\n    /**\n     * Creates an editing controller instance.\n     *\n     * @param model Editing model.\n     * @param stylesProcessor The styles processor instance.\n     */\n    constructor(model, stylesProcessor) {\n        super();\n        this.model = model;\n        this.view = new EditingView(stylesProcessor);\n        this.mapper = new Mapper();\n        this.downcastDispatcher = new DowncastDispatcher({\n            mapper: this.mapper,\n            schema: model.schema\n        });\n        const doc = this.model.document;\n        const selection = doc.selection;\n        const markers = this.model.markers;\n        // When plugins listen on model changes (on selection change, post fixers, etc.) and change the view as a result of\n        // the model's change, they might trigger view rendering before the conversion is completed (e.g. before the selection\n        // is converted). We disable rendering for the length of the outermost model change() block to prevent that.\n        //\n        // See https://github.com/ckeditor/ckeditor5-engine/issues/1528\n        this.listenTo(this.model, '_beforeChanges', () => {\n            this.view._disableRendering(true);\n        }, { priority: 'highest' });\n        this.listenTo(this.model, '_afterChanges', () => {\n            this.view._disableRendering(false);\n        }, { priority: 'lowest' });\n        // Whenever model document is changed, convert those changes to the view (using model.Document#differ).\n        // Do it on 'low' priority, so changes are converted after other listeners did their job.\n        // Also convert model selection.\n        this.listenTo(doc, 'change', () => {\n            this.view.change(writer => {\n                this.downcastDispatcher.convertChanges(doc.differ, markers, writer);\n                this.downcastDispatcher.convertSelection(selection, markers, writer);\n            });\n        }, { priority: 'low' });\n        // Convert selection from the view to the model when it changes in the view.\n        this.listenTo(this.view.document, 'selectionChange', convertSelectionChange(this.model, this.mapper));\n        // Attach default model converters.\n        this.downcastDispatcher.on('insert:$text', insertText(), { priority: 'lowest' });\n        this.downcastDispatcher.on('insert', insertAttributesAndChildren(), { priority: 'lowest' });\n        this.downcastDispatcher.on('remove', remove(), { priority: 'low' });\n        // Attach default model selection converters.\n        this.downcastDispatcher.on('cleanSelection', cleanSelection());\n        this.downcastDispatcher.on('selection', convertRangeSelection(), { priority: 'low' });\n        this.downcastDispatcher.on('selection', convertCollapsedSelection(), { priority: 'low' });\n        // Binds {@link module:engine/view/document~ViewDocument#roots view roots collection} to\n        // {@link module:engine/model/document~ModelDocument#roots model roots collection} so creating\n        // model root automatically creates corresponding view root.\n        this.view.document.roots.bindTo(this.model.document.roots).using(root => {\n            // $graveyard is a special root that has no reflection in the view.\n            if (root.rootName == '$graveyard') {\n                return null;\n            }\n            const viewRoot = new ViewRootEditableElement(this.view.document, root.name);\n            viewRoot.rootName = root.rootName;\n            this.mapper.bindElements(root, viewRoot);\n            return viewRoot;\n        });\n        // @if CK_DEBUG_ENGINE // initDocumentDumping( this.model.document );\n        // @if CK_DEBUG_ENGINE // initDocumentDumping( this.view.document );\n        // @if CK_DEBUG_ENGINE // dumpTrees( this.model.document, this.model.document.version );\n        // @if CK_DEBUG_ENGINE // dumpTrees( this.view.document, this.model.document.version );\n        // @if CK_DEBUG_ENGINE // this.model.document.on( 'change', () => {\n        // @if CK_DEBUG_ENGINE //\tdumpTrees( this.view.document, this.model.document.version );\n        // @if CK_DEBUG_ENGINE // }, { priority: 'lowest' } );\n    }\n    /**\n     * Removes all event listeners attached to the `EditingController`. Destroys all objects created\n     * by `EditingController` that need to be destroyed.\n     */\n    destroy() {\n        this.view.destroy();\n        this.stopListening();\n    }\n    /**\n     * Calling this method will refresh the marker by triggering the downcast conversion for it.\n     *\n     * Reconverting the marker is useful when you want to change its {@link module:engine/view/element~ViewElement view element}\n     * without changing any marker data. For instance:\n     *\n     * ```ts\n     * let isCommentActive = false;\n     *\n     * model.conversion.markerToHighlight( {\n     * \tmodel: 'comment',\n     * \tview: data => {\n     * \t\tconst classes = [ 'comment-marker' ];\n     *\n     * \t\tif ( isCommentActive ) {\n     * \t\t\tclasses.push( 'comment-marker--active' );\n     * \t\t}\n     *\n     * \t\treturn { classes };\n     * \t}\n     * } );\n     *\n     * // ...\n     *\n     * // Change the property that indicates if marker is displayed as active or not.\n     * isCommentActive = true;\n     *\n     * // Reconverting will downcast and synchronize the marker with the new isCommentActive state value.\n     * editor.editing.reconvertMarker( 'comment' );\n     * ```\n     *\n     * **Note**: If you want to reconvert a model item, use {@link #reconvertItem} instead.\n     *\n     * @param markerOrName Name of a marker to update, or a marker instance.\n     */\n    reconvertMarker(markerOrName) {\n        const markerName = typeof markerOrName == 'string' ? markerOrName : markerOrName.name;\n        const currentMarker = this.model.markers.get(markerName);\n        if (!currentMarker) {\n            /**\n             * The marker with the provided name does not exist and cannot be reconverted.\n             *\n             * @error editingcontroller-reconvertmarker-marker-not-exist\n             * @param {string} markerName The name of the reconverted marker.\n             */\n            throw new CKEditorError('editingcontroller-reconvertmarker-marker-not-exist', this, { markerName });\n        }\n        this.model.change(() => {\n            this.model.markers._refresh(currentMarker);\n        });\n    }\n    /**\n     * Calling this method will downcast a model item on demand (by requesting a refresh in the {@link module:engine/model/differ~Differ}).\n     *\n     * You can use it if you want the view representation of a specific item updated as a response to external modifications. For instance,\n     * when the view structure depends not only on the associated model data but also on some external state.\n     *\n     * **Note**: If you want to reconvert a model marker, use {@link #reconvertMarker} instead.\n     *\n     * @param item Item to refresh.\n     */\n    reconvertItem(item) {\n        this.model.change(() => {\n            this.model.document.differ._refreshItem(item);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/schema\n */\nimport { ModelElement } from './element.js';\nimport { ModelPosition } from './position.js';\nimport { ModelRange } from './range.js';\nimport { ModelText } from './text.js';\nimport { ModelTreeWalker } from './treewalker.js';\nimport { CKEditorError, first, ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * The model's schema. It defines the allowed and disallowed structures of nodes as well as nodes' attributes.\n * The schema is usually defined by the features and based on them, the editing framework and features\n * make decisions on how to change and process the model.\n *\n * The instance of schema is available in {@link module:engine/model/model~Model#schema `editor.model.schema`}.\n *\n * Read more about the schema in:\n *\n * * The {@glink framework/architecture/editing-engine#schema schema section} of the\n * {@glink framework/architecture/editing-engine Introduction to the Editing engine architecture} guide.\n * * The {@glink framework/deep-dive/schema Schema deep-dive} guide.\n */\nexport class ModelSchema extends /* #__PURE__ */ ObservableMixin() {\n    _sourceDefinitions = {};\n    /**\n     * A dictionary containing attribute properties.\n     */\n    _attributeProperties = Object.create(null);\n    /**\n     * Stores additional callbacks registered for schema items, which are evaluated when {@link ~ModelSchema#checkChild} is called.\n     *\n     * Keys are schema item names for which the callbacks are registered. Values are arrays with the callbacks.\n     *\n     * Some checks are added under {@link ~ModelSchema#_genericCheckSymbol} key, these are\n     * evaluated for every {@link ~ModelSchema#checkChild} call.\n     */\n    _customChildChecks = new Map();\n    /**\n     * Stores additional callbacks registered for attribute names, which are evaluated when {@link ~ModelSchema#checkAttribute} is called.\n     *\n     * Keys are schema attribute names for which the callbacks are registered. Values are arrays with the callbacks.\n     *\n     * Some checks are added under {@link ~ModelSchema#_genericCheckSymbol} key, these are evaluated for every\n     * {@link ~ModelSchema#checkAttribute} call.\n     */\n    _customAttributeChecks = new Map();\n    _genericCheckSymbol = Symbol('$generic');\n    _compiledDefinitions;\n    /**\n     * Creates a schema instance.\n     */\n    constructor() {\n        super();\n        this.decorate('checkChild');\n        this.decorate('checkAttribute');\n        this.on('checkAttribute', (evt, args) => {\n            args[0] = new ModelSchemaContext(args[0]);\n        }, { priority: 'highest' });\n        this.on('checkChild', (evt, args) => {\n            args[0] = new ModelSchemaContext(args[0]);\n            args[1] = this.getDefinition(args[1]);\n        }, { priority: 'highest' });\n    }\n    /**\n     * Registers a schema item. Can only be called once for every item name.\n     *\n     * ```ts\n     * schema.register( 'paragraph', {\n     * \tinheritAllFrom: '$block'\n     * } );\n     * ```\n     */\n    register(itemName, definition) {\n        if (this._sourceDefinitions[itemName]) {\n            /**\n             * A single item cannot be registered twice in the schema.\n             *\n             * This situation may happen when:\n             *\n             * * Two or more plugins called {@link module:engine/model/schema~ModelSchema#register `register()`} with the same name.\n             * This will usually mean that there is a collision between plugins which try to use the same element in the model.\n             * Unfortunately, the only way to solve this is by modifying one of these plugins to use a unique model element name.\n             * * A single plugin was loaded twice. This happens when it is installed by npm/yarn in two versions\n             * and usually means one or more of the following issues:\n             *     * a version mismatch (two of your dependencies require two different versions of this plugin),\n             *     * incorrect imports (this plugin is somehow imported twice in a way which confuses webpack),\n             *     * mess in `node_modules/` (`rm -rf node_modules/` may help).\n             *\n             * **Note:** Check the logged `itemName` to better understand which plugin was duplicated/conflicting.\n             *\n             * @param itemName The name of the model element that is being registered twice.\n             * @error schema-cannot-register-item-twice\n             */\n            throw new CKEditorError('schema-cannot-register-item-twice', this, {\n                itemName\n            });\n        }\n        this._sourceDefinitions[itemName] = [\n            Object.assign({}, definition)\n        ];\n        this._clearCache();\n    }\n    /**\n     * Extends a {@link #register registered} item's definition.\n     *\n     * Extending properties such as `allowIn` will add more items to the existing properties,\n     * while redefining properties such as `isBlock` will override the previously defined ones.\n     *\n     * ```ts\n     * schema.register( 'foo', {\n     * \tallowIn: '$root',\n     * \tisBlock: true;\n     * } );\n     * schema.extend( 'foo', {\n     * \tallowIn: 'blockQuote',\n     * \tisBlock: false\n     * } );\n     *\n     * schema.getDefinition( 'foo' );\n     * //\t{\n     * //\t\tallowIn: [ '$root', 'blockQuote' ],\n     * // \t\tisBlock: false\n     * //\t}\n     * ```\n     */\n    extend(itemName, definition) {\n        if (!this._sourceDefinitions[itemName]) {\n            /**\n             * Cannot extend an item which was not registered yet.\n             *\n             * This error happens when a plugin tries to extend the schema definition of an item which was not\n             * {@link module:engine/model/schema~ModelSchema#register registered} yet.\n             *\n             * @param itemName The name of the model element which is being extended.\n             * @error schema-cannot-extend-missing-item\n             */\n            throw new CKEditorError('schema-cannot-extend-missing-item', this, {\n                itemName\n            });\n        }\n        this._sourceDefinitions[itemName].push(Object.assign({}, definition));\n        this._clearCache();\n    }\n    /**\n     * Returns data of all registered items.\n     *\n     * This method should normally be used for reflection purposes (e.g. defining a clone of a certain element,\n     * checking a list of all block elements, etc).\n     * Use specific methods (such as {@link #checkChild `checkChild()`} or {@link #isLimit `isLimit()`})\n     * in other cases.\n     */\n    getDefinitions() {\n        if (!this._compiledDefinitions) {\n            this._compile();\n        }\n        return this._compiledDefinitions;\n    }\n    /**\n     * Returns a definition of the given item or `undefined` if an item is not registered.\n     *\n     * This method should normally be used for reflection purposes (e.g. defining a clone of a certain element,\n     * checking a list of all block elements, etc).\n     * Use specific methods (such as {@link #checkChild `checkChild()`} or {@link #isLimit `isLimit()`})\n     * in other cases.\n     */\n    getDefinition(item) {\n        let itemName;\n        if (typeof item == 'string') {\n            itemName = item;\n        }\n        else if ('is' in item && (item.is('$text') || item.is('$textProxy'))) {\n            itemName = '$text';\n        }\n        // Element or module:engine/model/schema~ModelSchemaContextItem.\n        else {\n            itemName = item.name;\n        }\n        return this.getDefinitions()[itemName];\n    }\n    /**\n     * Returns `true` if the given item is registered in the schema.\n     *\n     * ```ts\n     * schema.isRegistered( 'paragraph' ); // -> true\n     * schema.isRegistered( editor.model.document.getRoot() ); // -> true\n     * schema.isRegistered( 'foo' ); // -> false\n     * ```\n     */\n    isRegistered(item) {\n        return !!this.getDefinition(item);\n    }\n    /**\n     * Returns `true` if the given item is defined to be\n     * a block by the {@link module:engine/model/schema~ModelSchemaItemDefinition}'s `isBlock` property.\n     *\n     * ```ts\n     * schema.isBlock( 'paragraph' ); // -> true\n     * schema.isBlock( '$root' ); // -> false\n     *\n     * const paragraphElement = writer.createElement( 'paragraph' );\n     * schema.isBlock( paragraphElement ); // -> true\n     * ```\n     *\n     * See the {@glink framework/deep-dive/schema#block-elements Block elements} section of\n     * the {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.\n     */\n    isBlock(item) {\n        const def = this.getDefinition(item);\n        return !!(def && def.isBlock);\n    }\n    /**\n     * Returns `true` if the given item should be treated as a limit element.\n     *\n     * It considers an item to be a limit element if its\n     * {@link module:engine/model/schema~ModelSchemaItemDefinition}'s\n     * {@link module:engine/model/schema~ModelSchemaItemDefinition#isLimit `isLimit`} or\n     * {@link module:engine/model/schema~ModelSchemaItemDefinition#isObject `isObject`} property\n     * was set to `true`.\n     *\n     * ```ts\n     * schema.isLimit( 'paragraph' ); // -> false\n     * schema.isLimit( '$root' ); // -> true\n     * schema.isLimit( editor.model.document.getRoot() ); // -> true\n     * schema.isLimit( 'imageBlock' ); // -> true\n     * ```\n     *\n     * See the {@glink framework/deep-dive/schema#limit-elements Limit elements} section of\n     * the {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.\n     */\n    isLimit(item) {\n        const def = this.getDefinition(item);\n        if (!def) {\n            return false;\n        }\n        return !!(def.isLimit || def.isObject);\n    }\n    /**\n     * Returns `true` if the given item should be treated as an object element.\n     *\n     * It considers an item to be an object element if its\n     * {@link module:engine/model/schema~ModelSchemaItemDefinition}'s\n     * {@link module:engine/model/schema~ModelSchemaItemDefinition#isObject `isObject`} property\n     * was set to `true`.\n     *\n     * ```ts\n     * schema.isObject( 'paragraph' ); // -> false\n     * schema.isObject( 'imageBlock' ); // -> true\n     *\n     * const imageElement = writer.createElement( 'imageBlock' );\n     * schema.isObject( imageElement ); // -> true\n     * ```\n     *\n     * See the {@glink framework/deep-dive/schema#object-elements Object elements} section of\n     * the {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.\n     */\n    isObject(item) {\n        const def = this.getDefinition(item);\n        if (!def) {\n            return false;\n        }\n        // Note: Check out the implementation of #isLimit(), #isSelectable(), and #isContent()\n        // to understand why these three constitute an object.\n        return !!(def.isObject || (def.isLimit && def.isSelectable && def.isContent));\n    }\n    /**\n     * Returns `true` if the given item is defined to be\n     * an inline element by the {@link module:engine/model/schema~ModelSchemaItemDefinition}'s `isInline` property.\n     *\n     * ```ts\n     * schema.isInline( 'paragraph' ); // -> false\n     * schema.isInline( 'softBreak' ); // -> true\n     *\n     * const text = writer.createText( 'foo' );\n     * schema.isInline( text ); // -> true\n     * ```\n     *\n     * See the {@glink framework/deep-dive/schema#inline-elements Inline elements} section of\n     * the {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.\n     */\n    isInline(item) {\n        const def = this.getDefinition(item);\n        return !!(def && def.isInline);\n    }\n    /**\n     * Returns `true` if the given item is defined to be\n     * a selectable element by the {@link module:engine/model/schema~ModelSchemaItemDefinition}'s `isSelectable` property.\n     *\n     * ```ts\n     * schema.isSelectable( 'paragraph' ); // -> false\n     * schema.isSelectable( 'heading1' ); // -> false\n     * schema.isSelectable( 'imageBlock' ); // -> true\n     * schema.isSelectable( 'tableCell' ); // -> true\n     *\n     * const text = writer.createText( 'foo' );\n     * schema.isSelectable( text ); // -> false\n     * ```\n     *\n     * See the {@glink framework/deep-dive/schema#selectable-elements Selectable elements section} of\n     * the {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.\n     */\n    isSelectable(item) {\n        const def = this.getDefinition(item);\n        if (!def) {\n            return false;\n        }\n        return !!(def.isSelectable || def.isObject);\n    }\n    /**\n     * Returns `true` if the given item is defined to be\n     * a content by the {@link module:engine/model/schema~ModelSchemaItemDefinition}'s `isContent` property.\n     *\n     * ```ts\n     * schema.isContent( 'paragraph' ); // -> false\n     * schema.isContent( 'heading1' ); // -> false\n     * schema.isContent( 'imageBlock' ); // -> true\n     * schema.isContent( 'horizontalLine' ); // -> true\n     *\n     * const text = writer.createText( 'foo' );\n     * schema.isContent( text ); // -> true\n     * ```\n     *\n     * See the {@glink framework/deep-dive/schema#content-elements Content elements section} of\n     * the {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.\n     */\n    isContent(item) {\n        const def = this.getDefinition(item);\n        if (!def) {\n            return false;\n        }\n        return !!(def.isContent || def.isObject);\n    }\n    /**\n     * Checks whether the given node can be a child of the given context.\n     *\n     * ```ts\n     * schema.checkChild( model.document.getRoot(), paragraph ); // -> false\n     *\n     * schema.register( 'paragraph', {\n     * \tallowIn: '$root'\n     * } );\n     *\n     * schema.checkChild( model.document.getRoot(), paragraph ); // -> true\n     * ```\n     *\n     * Both {@link module:engine/model/schema~ModelSchema#addChildCheck callback checks} and declarative rules (added when\n     * {@link module:engine/model/schema~ModelSchema#register registering} and\n     * {@link module:engine/model/schema~ModelSchema#extend extending} items)\n     * are evaluated when this method is called.\n     *\n     * Note that callback checks have bigger priority than declarative rules checks and may overwrite them.\n     *\n     * Note that when verifying whether the given node can be a child of the given context, the schema also verifies the entire\n     * context &ndash; from its root to its last element. Therefore, it is possible for `checkChild()` to return `false` even though\n     * the `context` last element can contain the checked child. It happens if one of the `context` elements does not allow its child.\n     * When `context` is verified, {@link module:engine/model/schema~ModelSchema#addChildCheck custom checks} are considered as well.\n     *\n     * @fires checkChild\n     * @param context The context in which the child will be checked.\n     * @param def The child to check.\n     */\n    checkChild(context, def) {\n        // Note: `context` and `def` are already normalized here to `ModelSchemaContext` and `ModelSchemaCompiledItemDefinition`.\n        if (!def) {\n            return false;\n        }\n        return this._checkContextMatch(context, def);\n    }\n    /**\n     * Checks whether the given attribute can be applied in the given context (on the last item of the context).\n     *\n     * ```ts\n     * schema.checkAttribute( textNode, 'bold' ); // -> false\n     *\n     * schema.extend( '$text', {\n     * \tallowAttributes: 'bold'\n     * } );\n     *\n     * schema.checkAttribute( textNode, 'bold' ); // -> true\n     * ```\n     *\n     * Both {@link module:engine/model/schema~ModelSchema#addAttributeCheck callback checks} and declarative rules (added when\n     * {@link module:engine/model/schema~ModelSchema#register registering} and\n     * {@link module:engine/model/schema~ModelSchema#extend extending} items)\n     * are evaluated when this method is called.\n     *\n     * Note that callback checks have bigger priority than declarative rules checks and may overwrite them.\n     *\n     * @fires checkAttribute\n     * @param context The context in which the attribute will be checked.\n     * @param attributeName Name of attribute to check in the given context.\n     */\n    checkAttribute(context, attributeName) {\n        // Note: `context` is already normalized here to `ModelSchemaContext`.\n        const def = this.getDefinition(context.last);\n        if (!def) {\n            return false;\n        }\n        // First, check all attribute checks declared as callbacks.\n        // Note that `_evaluateAttributeChecks()` will return `undefined` if neither child check was applicable (no decision was made).\n        const isAllowed = this._evaluateAttributeChecks(context, attributeName);\n        // If the decision was not made inside attribute check callbacks, then use declarative rules.\n        return isAllowed !== undefined ? isAllowed : def.allowAttributes.includes(attributeName);\n    }\n    /**\n     * Checks whether the given element (`elementToMerge`) can be merged with the specified base element (`positionOrBaseElement`).\n     *\n     * In other words &ndash; both elements are not a limit elements and whether `elementToMerge`'s children\n     * {@link #checkChild are allowed} in the `positionOrBaseElement`.\n     *\n     * This check ensures that elements merged with {@link module:engine/model/writer~ModelWriter#merge `Writer#merge()`}\n     * will be valid.\n     *\n     * Instead of elements, you can pass the instance of the {@link module:engine/model/position~ModelPosition} class as the\n     * `positionOrBaseElement`. It means that the elements before and after the position will be checked whether they can be merged.\n     *\n     * @param positionOrBaseElement The position or base element to which the `elementToMerge` will be merged.\n     * @param elementToMerge The element to merge. Required if `positionOrBaseElement` is an element.\n     */\n    checkMerge(positionOrBaseElement, elementToMerge) {\n        if (positionOrBaseElement instanceof ModelPosition) {\n            const nodeBefore = positionOrBaseElement.nodeBefore;\n            const nodeAfter = positionOrBaseElement.nodeAfter;\n            if (!(nodeBefore instanceof ModelElement)) {\n                /**\n                 * The node before the merge position must be an element.\n                 *\n                 * @error schema-check-merge-no-element-before\n                 */\n                throw new CKEditorError('schema-check-merge-no-element-before', this);\n            }\n            if (!(nodeAfter instanceof ModelElement)) {\n                /**\n                 * The node after the merge position must be an element.\n                 *\n                 * @error schema-check-merge-no-element-after\n                 */\n                throw new CKEditorError('schema-check-merge-no-element-after', this);\n            }\n            return this.checkMerge(nodeBefore, nodeAfter);\n        }\n        if (this.isLimit(positionOrBaseElement) || this.isLimit(elementToMerge)) {\n            return false;\n        }\n        for (const child of elementToMerge.getChildren()) {\n            if (!this.checkChild(positionOrBaseElement, child)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Allows registering a callback to the {@link #checkChild} method calls.\n     *\n     * Callbacks allow you to implement rules which are not otherwise possible to achieve\n     * by using the declarative API of {@link module:engine/model/schema~ModelSchemaItemDefinition}.\n     *\n     * Note that callback checks have bigger priority than declarative rules checks and may overwrite them.\n     *\n     * For example, by using this method you can disallow elements in specific contexts:\n     *\n     * ```ts\n     * // Disallow `heading1` inside a `blockQuote` that is inside a table.\n     * schema.addChildCheck( ( context, childDefinition ) => {\n     * \tif ( context.endsWith( 'tableCell blockQuote' ) ) {\n     * \t\treturn false;\n     * \t}\n     * }, 'heading1' );\n     * ```\n     *\n     * You can skip the optional `itemName` parameter to evaluate the callback for every `checkChild()` call.\n     *\n     * ```ts\n     * // Inside specific custom element, allow only children, which allows for a specific attribute.\n     * schema.addChildCheck( ( context, childDefinition ) => {\n     * \tif ( context.endsWith( 'myElement' ) ) {\n     * \t\treturn childDefinition.allowAttributes.includes( 'myAttribute' );\n     * \t}\n     * } );\n     * ```\n     *\n     * Please note that the generic callbacks may affect the editor performance and should be avoided if possible.\n     *\n     * When one of the callbacks makes a decision (returns `true` or `false`) the processing is finished and other callbacks are not fired.\n     * Callbacks are fired in the order they were added, however generic callbacks are fired before callbacks added for a specified item.\n     *\n     * You can also use `checkChild` event, if you need even better control. The result from the example above could also be\n     * achieved with following event callback:\n     *\n     * ```ts\n     * schema.on( 'checkChild', ( evt, args ) => {\n     * \tconst context = args[ 0 ];\n     * \tconst childDefinition = args[ 1 ];\n     *\n     * \tif ( context.endsWith( 'myElement' ) ) {\n     * \t\t// Prevent next listeners from being called.\n     * \t\tevt.stop();\n     * \t\t// Set the `checkChild()` return value.\n     * \t\tevt.return = childDefinition.allowAttributes.includes( 'myAttribute' );\n     * \t}\n     * }, { priority: 'high' } );\n     * ```\n     *\n     * Note that the callback checks and declarative rules checks are processed on `normal` priority.\n     *\n     * Adding callbacks this way can also negatively impact editor performance.\n     *\n     * @param callback The callback to be called. It is called with two parameters:\n     * {@link module:engine/model/schema~ModelSchemaContext} (context) instance and\n     * {@link module:engine/model/schema~ModelSchemaCompiledItemDefinition} (definition). The callback may return `true/false` to\n     * override `checkChild()`'s return value. If it does not return a boolean value, the default algorithm (or other callbacks) will define\n     * `checkChild()`'s return value.\n     * @param itemName Name of the schema item for which the callback is registered. If specified, the callback will be run only for\n     * `checkChild()` calls which `def` parameter matches the `itemName`. Otherwise, the callback will run for every `checkChild` call.\n     */\n    addChildCheck(callback, itemName) {\n        const key = itemName !== undefined ? itemName : this._genericCheckSymbol;\n        const checks = this._customChildChecks.get(key) || [];\n        checks.push(callback);\n        this._customChildChecks.set(key, checks);\n    }\n    /**\n     * Allows registering a callback to the {@link #checkAttribute} method calls.\n     *\n     * Callbacks allow you to implement rules which are not otherwise possible to achieve\n     * by using the declarative API of {@link module:engine/model/schema~ModelSchemaItemDefinition}.\n     *\n     * Note that callback checks have bigger priority than declarative rules checks and may overwrite them.\n     *\n     * For example, by using this method you can disallow setting attributes on nodes in specific contexts:\n     *\n     * ```ts\n     * // Disallow setting `bold` on text inside `heading1` element:\n     * schema.addAttributeCheck( context => {\n     * \tif ( context.endsWith( 'heading1 $text' ) ) {\n     * \t\treturn false;\n     * \t}\n     * }, 'bold' );\n     * ```\n     *\n     * You can skip the optional `attributeName` parameter to evaluate the callback for every `checkAttribute()` call.\n     *\n     * ```ts\n     * // Disallow formatting attributes on text inside custom `myTitle` element:\n     * schema.addAttributeCheck( ( context, attributeName ) => {\n     * \tif ( context.endsWith( 'myTitle $text' ) && schema.getAttributeProperties( attributeName ).isFormatting ) {\n     * \t\treturn false;\n     * \t}\n     * } );\n     * ```\n     *\n     * Please note that the generic callbacks may affect the editor performance and should be avoided if possible.\n     *\n     * When one of the callbacks makes a decision (returns `true` or `false`) the processing is finished and other callbacks are not fired.\n     * Callbacks are fired in the order they were added, however generic callbacks are fired before callbacks added for a specified item.\n     *\n     * You can also use {@link #event:checkAttribute} event, if you need even better control. The result from the example above could also\n     * be achieved with following event callback:\n     *\n     * ```ts\n     * schema.on( 'checkAttribute', ( evt, args ) => {\n     * \tconst context = args[ 0 ];\n     * \tconst attributeName = args[ 1 ];\n     *\n     * \tif ( context.endsWith( 'myTitle $text' ) && schema.getAttributeProperties( attributeName ).isFormatting ) {\n     * \t\t// Prevent next listeners from being called.\n     * \t\tevt.stop();\n     * \t\t// Set the `checkAttribute()` return value.\n     * \t\tevt.return = false;\n     * \t}\n     * }, { priority: 'high' } );\n     * ```\n     *\n     * Note that the callback checks and declarative rules checks are processed on `normal` priority.\n     *\n     * Adding callbacks this way can also negatively impact editor performance.\n     *\n     * @param callback The callback to be called. It is called with two parameters:\n     * {@link module:engine/model/schema~ModelSchemaContext `context`} and attribute name. The callback may return `true` or `false`, to\n     * override `checkAttribute()`'s return value. If it does not return a boolean value, the default algorithm (or other callbacks)\n     * will define `checkAttribute()`'s return value.\n     * @param attributeName Name of the attribute for which the callback is registered. If specified, the callback will be run only for\n     * `checkAttribute()` calls with matching `attributeName`. Otherwise, the callback will run for every `checkAttribute()` call.\n     */\n    addAttributeCheck(callback, attributeName) {\n        const key = attributeName !== undefined ? attributeName : this._genericCheckSymbol;\n        const checks = this._customAttributeChecks.get(key) || [];\n        checks.push(callback);\n        this._customAttributeChecks.set(key, checks);\n    }\n    /**\n     * This method allows assigning additional metadata to the model attributes. For example,\n     * {@link module:engine/model/schema~ModelAttributeProperties `AttributeProperties#isFormatting` property} is\n     * used to mark formatting attributes (like `bold` or `italic`).\n     *\n     * ```ts\n     * // Mark bold as a formatting attribute.\n     * schema.setAttributeProperties( 'bold', {\n     * \tisFormatting: true\n     * } );\n     *\n     * // Override code not to be considered a formatting markup.\n     * schema.setAttributeProperties( 'code', {\n     * \tisFormatting: false\n     * } );\n     * ```\n     *\n     * Properties are not limited to members defined in the\n     * {@link module:engine/model/schema~ModelAttributeProperties `AttributeProperties` type} and you can also use custom properties:\n     *\n     * ```ts\n     * schema.setAttributeProperties( 'blockQuote', {\n     * \tcustomProperty: 'value'\n     * } );\n     * ```\n     *\n     * Subsequent calls with the same attribute will extend its custom properties:\n     *\n     * ```ts\n     * schema.setAttributeProperties( 'blockQuote', {\n     * \tone: 1\n     * } );\n     *\n     * schema.setAttributeProperties( 'blockQuote', {\n     * \ttwo: 2\n     * } );\n     *\n     * console.log( schema.getAttributeProperties( 'blockQuote' ) );\n     * // Logs: { one: 1, two: 2 }\n     * ```\n     *\n     * @param attributeName A name of the attribute to receive the properties.\n     * @param properties A dictionary of properties.\n     */\n    setAttributeProperties(attributeName, properties) {\n        this._attributeProperties[attributeName] = Object.assign(this.getAttributeProperties(attributeName), properties);\n    }\n    /**\n     * Returns properties associated with a given model attribute. See {@link #setAttributeProperties `setAttributeProperties()`}.\n     *\n     * @param attributeName A name of the attribute.\n     */\n    getAttributeProperties(attributeName) {\n        return this._attributeProperties[attributeName] || Object.create(null);\n    }\n    /**\n     * Returns the lowest {@link module:engine/model/schema~ModelSchema#isLimit limit element} containing the entire\n     * selection/range/position or the root otherwise.\n     *\n     * @param selectionOrRangeOrPosition The selection/range/position to check.\n     * @returns The lowest limit element containing the entire `selectionOrRangeOrPosition`.\n     */\n    getLimitElement(selectionOrRangeOrPosition) {\n        let element;\n        if (selectionOrRangeOrPosition instanceof ModelPosition) {\n            element = selectionOrRangeOrPosition.parent;\n        }\n        else {\n            const ranges = selectionOrRangeOrPosition instanceof ModelRange ?\n                [selectionOrRangeOrPosition] :\n                Array.from(selectionOrRangeOrPosition.getRanges());\n            // Find the common ancestor for all selection's ranges.\n            element = ranges\n                .reduce((element, range) => {\n                const rangeCommonAncestor = range.getCommonAncestor();\n                if (!element) {\n                    return rangeCommonAncestor;\n                }\n                return element.getCommonAncestor(rangeCommonAncestor, { includeSelf: true });\n            }, null);\n        }\n        while (!this.isLimit(element)) {\n            if (element.parent) {\n                element = element.parent;\n            }\n            else {\n                break;\n            }\n        }\n        return element;\n    }\n    /**\n     * Checks whether the attribute is allowed in selection:\n     *\n     * * if the selection is not collapsed, then checks if the attribute is allowed on any of nodes in that range,\n     * * if the selection is collapsed, then checks if on the selection position there's a text with the\n     * specified attribute allowed.\n     *\n     * @param selection Selection which will be checked.\n     * @param attribute The name of the attribute to check.\n     */\n    checkAttributeInSelection(selection, attribute) {\n        if (selection.isCollapsed) {\n            const firstPosition = selection.getFirstPosition();\n            const context = [\n                ...firstPosition.getAncestors(),\n                new ModelText('', selection.getAttributes())\n            ];\n            // Check whether schema allows for a text with the attribute in the selection.\n            return this.checkAttribute(context, attribute);\n        }\n        else {\n            const ranges = selection.getRanges();\n            // For all ranges, check nodes in them until you find a node that is allowed to have the attribute.\n            for (const range of ranges) {\n                for (const value of range) {\n                    if (this.checkAttribute(value.item, attribute)) {\n                        // If we found a node that is allowed to have the attribute, return true.\n                        return true;\n                    }\n                }\n            }\n        }\n        // If we haven't found such node, return false.\n        return false;\n    }\n    /**\n     * Transforms the given set of ranges into a set of ranges where the given attribute is allowed (and can be applied).\n     *\n     * @param ranges Ranges to be validated.\n     * @param attribute The name of the attribute to check.\n     * @returns Ranges in which the attribute is allowed.\n     */\n    *getValidRanges(ranges, attribute) {\n        ranges = convertToMinimalFlatRanges(ranges);\n        for (const range of ranges) {\n            yield* this._getValidRangesForRange(range, attribute);\n        }\n    }\n    /**\n     * Basing on given `position`, finds and returns a {@link module:engine/model/range~ModelRange range} which is\n     * nearest to that `position` and is a correct range for selection.\n     *\n     * The correct selection range might be collapsed when it is located in a position where the text node can be placed.\n     * Non-collapsed range is returned when selection can be placed around element marked as an \"object\" in\n     * the {@link module:engine/model/schema~ModelSchema schema}.\n     *\n     * Direction of searching for the nearest correct selection range can be specified as:\n     *\n     * * `both` - searching will be performed in both ways,\n     * * `forward` - searching will be performed only forward,\n     * * `backward` - searching will be performed only backward.\n     *\n     * When valid selection range cannot be found, `null` is returned.\n     *\n     * @param position Reference position where new selection range should be looked for.\n     * @param direction Search direction.\n     * @returns Nearest selection range or `null` if one cannot be found.\n     */\n    getNearestSelectionRange(position, direction = 'both') {\n        if (position.root.rootName == '$graveyard') {\n            // No valid selection range in the graveyard.\n            // This is important when getting the document selection default range.\n            return null;\n        }\n        // Return collapsed range if provided position is valid.\n        if (this.checkChild(position, '$text')) {\n            return new ModelRange(position);\n        }\n        let backwardWalker, forwardWalker;\n        // Never leave a limit element.\n        const limitElement = position.getAncestors().reverse().find(item => this.isLimit(item)) ||\n            position.root;\n        if (direction == 'both' || direction == 'backward') {\n            backwardWalker = new ModelTreeWalker({\n                boundaries: ModelRange._createIn(limitElement),\n                startPosition: position,\n                direction: 'backward'\n            });\n        }\n        if (direction == 'both' || direction == 'forward') {\n            forwardWalker = new ModelTreeWalker({\n                boundaries: ModelRange._createIn(limitElement),\n                startPosition: position\n            });\n        }\n        for (const data of combineWalkers(backwardWalker, forwardWalker)) {\n            const type = (data.walker == backwardWalker ? 'elementEnd' : 'elementStart');\n            const value = data.value;\n            if (value.type == type && this.isObject(value.item)) {\n                return ModelRange._createOn(value.item);\n            }\n            if (this.checkChild(value.nextPosition, '$text')) {\n                return new ModelRange(value.nextPosition);\n            }\n        }\n        return null;\n    }\n    /**\n     * Tries to find position ancestors that allow to insert a given node.\n     * It starts searching from the given position and goes node by node to the top of the model tree\n     * as long as a {@link module:engine/model/schema~ModelSchema#isLimit limit element}, an\n     * {@link module:engine/model/schema~ModelSchema#isObject object element} or a topmost ancestor is not reached.\n     *\n     * @param position The position that the search will start from.\n     * @param node The node for which an allowed parent should be found or its name.\n     * @returns Allowed parent or null if nothing was found.\n     */\n    findAllowedParent(position, node) {\n        let parent = position.parent;\n        while (parent) {\n            if (this.checkChild(parent, node)) {\n                return parent;\n            }\n            // Do not split limit elements.\n            if (this.isLimit(parent)) {\n                return null;\n            }\n            parent = parent.parent;\n        }\n        return null;\n    }\n    /**\n     * Sets attributes allowed by the schema on a given node.\n     *\n     * @param node A node to set attributes on.\n     * @param attributes Attributes keys and values.\n     * @param writer An instance of the model writer.\n     */\n    setAllowedAttributes(node, attributes, writer) {\n        const model = writer.model;\n        for (const [attributeName, attributeValue] of Object.entries(attributes)) {\n            if (model.schema.checkAttribute(node, attributeName)) {\n                writer.setAttribute(attributeName, attributeValue, node);\n            }\n        }\n    }\n    /**\n     * Removes attributes disallowed by the schema.\n     *\n     * @param nodes Nodes that will be filtered.\n     */\n    removeDisallowedAttributes(nodes, writer) {\n        for (const node of nodes) {\n            // When node is a `Text` it has no children, so just filter it out.\n            if (node.is('$text')) {\n                removeDisallowedAttributeFromNode(this, node, writer);\n            }\n            // In a case of `Element` iterates through positions between nodes inside this element\n            // and filter out node before the current position, or position parent when position\n            // is at start of an element. Using positions prevent from omitting merged nodes\n            // see https://github.com/ckeditor/ckeditor5-engine/issues/1789.\n            else {\n                const rangeInNode = ModelRange._createIn(node);\n                const positionsInRange = rangeInNode.getPositions();\n                for (const position of positionsInRange) {\n                    const item = position.nodeBefore || position.parent;\n                    removeDisallowedAttributeFromNode(this, item, writer);\n                }\n            }\n        }\n    }\n    /**\n     * Gets attributes of a node that have a given property.\n     *\n     * @param node Node to get attributes from.\n     * @param propertyName Name of the property that attribute must have to return it.\n     * @param propertyValue Desired value of the property that we want to check.\n     * When `undefined` attributes will be returned if they have set a given property no matter what the value is. If specified it will\n     * return attributes which given property's value is equal to this parameter.\n     * @returns Object with attributes' names as key and attributes' values as value.\n     */\n    getAttributesWithProperty(node, propertyName, propertyValue) {\n        const attributes = {};\n        for (const [attributeName, attributeValue] of node.getAttributes()) {\n            const attributeProperties = this.getAttributeProperties(attributeName);\n            if (attributeProperties[propertyName] === undefined) {\n                continue;\n            }\n            if (propertyValue === undefined || propertyValue === attributeProperties[propertyName]) {\n                attributes[attributeName] = attributeValue;\n            }\n        }\n        return attributes;\n    }\n    /**\n     * Creates an instance of the schema context.\n     */\n    createContext(context) {\n        return new ModelSchemaContext(context);\n    }\n    _clearCache() {\n        this._compiledDefinitions = null;\n    }\n    _compile() {\n        const definitions = {};\n        const sourceRules = this._sourceDefinitions;\n        const itemNames = Object.keys(sourceRules);\n        for (const itemName of itemNames) {\n            definitions[itemName] = compileBaseItemRule(sourceRules[itemName], itemName);\n        }\n        const items = Object.values(definitions);\n        // Sometimes features add rules (allows, disallows) for items that has not been registered yet. We allow that, to make it easier\n        // to put the schema together. However, sometimes these items are never registered. To prevent operating\n        // removeUnregisteredEntries( definitions, items );\n        // 1. Propagate `childItem.allowIn` to `parentItem.allowChildren` and vice versa, so that these properties are completely mirrored\n        // for all children and parents. Do the same for `disallowIn` and `disallowChildren`.\n        for (const item of items) {\n            propagateAllowIn(definitions, item);\n            propagateAllowChildren(definitions, item);\n            propagateDisallowIn(definitions, item);\n            propagateDisallowChildren(definitions, item);\n        }\n        // 2. Remove from `allowIn` and `allowChildren` these items which where disallowed by `disallowIn` and `disallowChildren`.\n        // Do the same for attributes. Now we have a clear situation where which item/attribute is allowed. Inheritance is in next steps.\n        for (const item of items) {\n            resolveDisallows(definitions, item);\n        }\n        // 3. Compile `item.allowContentOf` property. For each entry in `allowContentOf`, we want to take `allowChildren` and rewrite\n        // them into `item.allowChildren`. `item.disallowChildren` is used to filter out some entries. This way \"own rules\" have higher\n        // priority than \"inherited rules\". Mirroring from step 1. is maintained.\n        for (const item of items) {\n            compileAllowContentOf(definitions, item);\n        }\n        // 4. Compile `item.allowWhere` property. For each entry in `allowWhere`, we want to take `allowIn` and rewrite them into\n        // `item.allowIn`. `item.disallowIn` is used to filter out some entries. This way \"own rules\" have higher priority than\n        // \"inherited rules\". Mirroring from step 1. is maintained.\n        for (const item of items) {\n            compileAllowWhere(definitions, item);\n        }\n        // 5. Compile `item.allowAttributesOf`. For each entry in `allowAttributesOf`, we want to take `allowAttributes` and rewrite them\n        // into `item.allowAttributes`. `item.disallowAttributes` is used to filter out some entries. This way \"own rules\" have higher\n        // priority than \"inherited rules\".\n        for (const item of items) {\n            compileAllowAttributesOf(definitions, item);\n        }\n        // 6. Compile `item.inheritTypesFrom` property. For each entry in `inheritTypesFrom`, we want to take `is*` properties and\n        // set them on `item` (if they are not set yet).\n        for (const item of items) {\n            compileInheritPropertiesFrom(definitions, item);\n        }\n        // Compile final definitions. Unnecessary properties are removed and some additional cleaning is applied.\n        this._compiledDefinitions = compileDefinitions(definitions);\n    }\n    _checkContextMatch(context, def) {\n        const parentItem = context.last;\n        // First, check all child checks declared as callbacks.\n        // Note that `_evaluateChildChecks()` will return `undefined` if neither child check was applicable (no decision was made).\n        let isAllowed = this._evaluateChildChecks(context, def);\n        // If the decision was not made inside child check callbacks, then use declarative rules.\n        isAllowed = isAllowed !== undefined ? isAllowed : def.allowIn.includes(parentItem.name);\n        // If the item is not allowed in the `context`, return `false`.\n        if (!isAllowed) {\n            return false;\n        }\n        // If the item is allowed, recursively verify the rest of the `context`.\n        const parentItemDefinition = this.getDefinition(parentItem);\n        const parentContext = context.trimLast();\n        // One of the items in the original `context` did not have a definition specified. In this case, the whole context is disallowed.\n        if (!parentItemDefinition) {\n            return false;\n        }\n        // Whole `context` was verified and passed checks.\n        if (parentContext.length == 0) {\n            return true;\n        }\n        // Verify \"truncated\" parent context. The last item of the original context is now the definition to check.\n        return this._checkContextMatch(parentContext, parentItemDefinition);\n    }\n    /**\n     * Calls child check callbacks to decide whether `def` is allowed in `context`. It uses both generic and specific (defined for `def`\n     * item) callbacks. If neither callback makes a decision, `undefined` is returned.\n     *\n     * Note that the first callback that makes a decision \"wins\", i.e., if any callback returns `true` or `false`, then the processing\n     * is over and that result is returned.\n     */\n    _evaluateChildChecks(context, def) {\n        const genericChecks = this._customChildChecks.get(this._genericCheckSymbol) || [];\n        const childChecks = this._customChildChecks.get(def.name) || [];\n        for (const check of [...genericChecks, ...childChecks]) {\n            const result = check(context, def);\n            if (result !== undefined) {\n                return result;\n            }\n        }\n    }\n    /**\n     * Calls attribute check callbacks to decide whether `attributeName` can be set on the last element of `context`. It uses both\n     * generic and specific (defined for `attributeName`) callbacks. If neither callback makes a decision, `undefined` is returned.\n     *\n     * Note that the first callback that makes a decision \"wins\", i.e., if any callback returns `true` or `false`, then the processing\n     * is over and that result is returned.\n     */\n    _evaluateAttributeChecks(context, attributeName) {\n        const genericChecks = this._customAttributeChecks.get(this._genericCheckSymbol) || [];\n        const childChecks = this._customAttributeChecks.get(attributeName) || [];\n        for (const check of [...genericChecks, ...childChecks]) {\n            const result = check(context, attributeName);\n            if (result !== undefined) {\n                return result;\n            }\n        }\n    }\n    /**\n     * Takes a flat range and an attribute name. Traverses the range recursively and deeply to find and return all ranges\n     * inside the given range on which the attribute can be applied.\n     *\n     * This is a helper function for {@link ~ModelSchema#getValidRanges}.\n     *\n     * @param range The range to process.\n     * @param attribute The name of the attribute to check.\n     * @returns Ranges in which the attribute is allowed.\n     */\n    *_getValidRangesForRange(range, attribute) {\n        let start = range.start;\n        let end = range.start;\n        for (const item of range.getItems({ shallow: true })) {\n            if (item.is('element')) {\n                yield* this._getValidRangesForRange(ModelRange._createIn(item), attribute);\n            }\n            if (!this.checkAttribute(item, attribute)) {\n                if (!start.isEqual(end)) {\n                    yield new ModelRange(start, end);\n                }\n                start = ModelPosition._createAfter(item);\n            }\n            end = ModelPosition._createAfter(item);\n        }\n        if (!start.isEqual(end)) {\n            yield new ModelRange(start, end);\n        }\n    }\n    /**\n     * Returns a model range which is optimal (in terms of UX) for inserting a widget block.\n     *\n     * For instance, if a selection is in the middle of a paragraph, the collapsed range before this paragraph\n     * will be returned so that it is not split. If the selection is at the end of a paragraph,\n     * the collapsed range after this paragraph will be returned.\n     *\n     * Note: If the selection is placed in an empty block, the range in that block will be returned. If that range\n     * is then passed to {@link module:engine/model/model~Model#insertContent}, the block will be fully replaced\n     * by the inserted widget block.\n     *\n     * @internal\n     * @param selection The selection based on which the insertion position should be calculated.\n     * @param place The place where to look for optimal insertion range.\n     * The `auto` value will determine itself the best position for insertion.\n     * The `before` value will try to find a position before selection.\n     * The `after` value will try to find a position after selection.\n     * @returns The optimal range.\n     */\n    findOptimalInsertionRange(selection, place) {\n        const selectedElement = selection.getSelectedElement();\n        if (selectedElement && this.isObject(selectedElement) && !this.isInline(selectedElement)) {\n            if (place == 'before' || place == 'after') {\n                return new ModelRange(ModelPosition._createAt(selectedElement, place));\n            }\n            return ModelRange._createOn(selectedElement);\n        }\n        const firstBlock = first(selection.getSelectedBlocks());\n        // There are no block elements within ancestors (in the current limit element).\n        if (!firstBlock) {\n            return new ModelRange(selection.focus);\n        }\n        // If inserting into an empty block – return position in that block. It will get\n        // replaced with the image by insertContent(). #42.\n        if (firstBlock.isEmpty) {\n            return new ModelRange(ModelPosition._createAt(firstBlock, 0));\n        }\n        const positionAfter = ModelPosition._createAfter(firstBlock);\n        // If selection is at the end of the block - return position after the block.\n        if (selection.focus.isTouching(positionAfter)) {\n            return new ModelRange(positionAfter);\n        }\n        // Otherwise, return position before the block.\n        return new ModelRange(ModelPosition._createBefore(firstBlock));\n    }\n}\n/**\n * A schema context &ndash; a list of ancestors of a given position in the document.\n *\n * Considering such position:\n *\n * ```xml\n * <$root>\n * \t<blockQuote>\n * \t\t<paragraph>\n * \t\t\t^\n * \t\t</paragraph>\n * \t</blockQuote>\n * </$root>\n * ```\n *\n * The context of this position is its {@link module:engine/model/position~ModelPosition#getAncestors lists of ancestors}:\n *\n *\t\t[ rootElement, blockQuoteElement, paragraphElement ]\n *\n * Contexts are used in the {@link module:engine/model/schema~ModelSchema#event:checkChild `Schema#checkChild`} and\n * {@link module:engine/model/schema~ModelSchema#event:checkAttribute `Schema#checkAttribute`} events as a definition\n * of a place in the document where the check occurs. The context instances are created based on the first arguments\n * of the {@link module:engine/model/schema~ModelSchema#checkChild `Schema#checkChild()`} and\n * {@link module:engine/model/schema~ModelSchema#checkAttribute `Schema#checkAttribute()`} methods so when\n * using these methods you need to use {@link module:engine/model/schema~ModelSchemaContextDefinition}s.\n */\nexport class ModelSchemaContext {\n    _items;\n    /**\n     * Creates an instance of the context.\n     */\n    constructor(context) {\n        if (context instanceof ModelSchemaContext) {\n            return context;\n        }\n        let items;\n        if (typeof context == 'string') {\n            items = [context];\n        }\n        else if (!Array.isArray(context)) {\n            // `context` is item or position.\n            // Position#getAncestors() doesn't accept any parameters but it works just fine here.\n            items = context.getAncestors({ includeSelf: true });\n        }\n        else {\n            items = context;\n        }\n        this._items = items.map(mapContextItem);\n    }\n    /**\n     * The number of items.\n     */\n    get length() {\n        return this._items.length;\n    }\n    /**\n     * The last item (the lowest node).\n     */\n    get last() {\n        return this._items[this._items.length - 1];\n    }\n    /**\n     * Iterable interface.\n     *\n     * Iterates over all context items.\n     */\n    [Symbol.iterator]() {\n        return this._items[Symbol.iterator]();\n    }\n    /**\n     * Returns a new schema context instance with an additional item.\n     *\n     * Item can be added as:\n     *\n     * ```ts\n     * const context = new ModelSchemaContext( [ '$root' ] );\n     *\n     * // An element.\n     * const fooElement = writer.createElement( 'fooElement' );\n     * const newContext = context.push( fooElement ); // [ '$root', 'fooElement' ]\n     *\n     * // A text node.\n     * const text = writer.createText( 'foobar' );\n     * const newContext = context.push( text ); // [ '$root', '$text' ]\n     *\n     * // A string (element name).\n     * const newContext = context.push( 'barElement' ); // [ '$root', 'barElement' ]\n     * ```\n     *\n     * **Note** {@link module:engine/model/node~ModelNode} that is already in the model tree will be added as the only item\n     * (without ancestors).\n     *\n     * @param item An item that will be added to the current context.\n     * @returns A new schema context instance with an additional item.\n     */\n    push(item) {\n        const ctx = new ModelSchemaContext([item]);\n        ctx._items = [...this._items, ...ctx._items];\n        return ctx;\n    }\n    /**\n     * Returns a new schema context that is based on this context but has the last item removed.\n     *\n     * ```ts\n     * const ctxParagraph = new ModelSchemaContext( [ '$root', 'blockQuote', 'paragraph' ] );\n     * const ctxBlockQuote = ctxParagraph.trimLast(); // Items in `ctxBlockQuote` are: `$root` an `blockQuote`.\n     * const ctxRoot = ctxBlockQuote.trimLast(); // Items in `ctxRoot` are: `$root`.\n     * ```\n     *\n     * @returns A new reduced schema context instance.\n     */\n    trimLast() {\n        const ctx = new ModelSchemaContext([]);\n        ctx._items = this._items.slice(0, -1);\n        return ctx;\n    }\n    /**\n     * Gets an item on the given index.\n     */\n    getItem(index) {\n        return this._items[index];\n    }\n    /**\n     * Returns the names of items.\n     */\n    *getNames() {\n        yield* this._items.map(item => item.name);\n    }\n    /**\n     * Checks whether the context ends with the given nodes.\n     *\n     * ```ts\n     * const ctx = new ModelSchemaContext( [ rootElement, paragraphElement, textNode ] );\n     *\n     * ctx.endsWith( '$text' ); // -> true\n     * ctx.endsWith( 'paragraph $text' ); // -> true\n     * ctx.endsWith( '$root' ); // -> false\n     * ctx.endsWith( 'paragraph' ); // -> false\n     * ```\n     */\n    endsWith(query) {\n        return Array.from(this.getNames()).join(' ').endsWith(query);\n    }\n    /**\n     * Checks whether the context starts with the given nodes.\n     *\n     * ```ts\n     * const ctx = new ModelSchemaContext( [ rootElement, paragraphElement, textNode ] );\n     *\n     * ctx.endsWith( '$root' ); // -> true\n     * ctx.endsWith( '$root paragraph' ); // -> true\n     * ctx.endsWith( '$text' ); // -> false\n     * ctx.endsWith( 'paragraph' ); // -> false\n     * ```\n     */\n    startsWith(query) {\n        return Array.from(this.getNames()).join(' ').startsWith(query);\n    }\n}\nfunction compileBaseItemRule(sourceItemRules, itemName) {\n    const itemRule = {\n        name: itemName,\n        allowIn: new Set(),\n        allowChildren: new Set(),\n        disallowIn: new Set(),\n        disallowChildren: new Set(),\n        allowContentOf: new Set(),\n        allowWhere: new Set(),\n        allowAttributes: new Set(),\n        disallowAttributes: new Set(),\n        allowAttributesOf: new Set(),\n        inheritTypesFrom: new Set()\n    };\n    copyTypes(sourceItemRules, itemRule);\n    copyProperty(sourceItemRules, itemRule, 'allowIn');\n    copyProperty(sourceItemRules, itemRule, 'allowChildren');\n    copyProperty(sourceItemRules, itemRule, 'disallowIn');\n    copyProperty(sourceItemRules, itemRule, 'disallowChildren');\n    copyProperty(sourceItemRules, itemRule, 'allowContentOf');\n    copyProperty(sourceItemRules, itemRule, 'allowWhere');\n    copyProperty(sourceItemRules, itemRule, 'allowAttributes');\n    copyProperty(sourceItemRules, itemRule, 'disallowAttributes');\n    copyProperty(sourceItemRules, itemRule, 'allowAttributesOf');\n    copyProperty(sourceItemRules, itemRule, 'inheritTypesFrom');\n    resolveInheritAll(sourceItemRules, itemRule);\n    return itemRule;\n}\nfunction propagateAllowIn(definitions, item) {\n    for (const parentName of item.allowIn) {\n        const parentItem = definitions[parentName];\n        if (parentItem) {\n            parentItem.allowChildren.add(item.name);\n        }\n        else {\n            item.allowIn.delete(parentName);\n        }\n    }\n}\nfunction propagateAllowChildren(definitions, item) {\n    for (const childName of item.allowChildren) {\n        const childItem = definitions[childName];\n        if (childItem) {\n            childItem.allowIn.add(item.name);\n        }\n        else {\n            item.allowChildren.delete(childName);\n        }\n    }\n}\nfunction propagateDisallowIn(definitions, item) {\n    for (const parentName of item.disallowIn) {\n        const parentItem = definitions[parentName];\n        if (parentItem) {\n            parentItem.disallowChildren.add(item.name);\n        }\n        else {\n            item.disallowIn.delete(parentName);\n        }\n    }\n}\nfunction propagateDisallowChildren(definitions, item) {\n    for (const childName of item.disallowChildren) {\n        const childItem = definitions[childName];\n        if (childItem) {\n            childItem.disallowIn.add(item.name);\n        }\n        else {\n            item.disallowChildren.delete(childName);\n        }\n    }\n}\nfunction resolveDisallows(definitions, item) {\n    for (const childName of item.disallowChildren) {\n        item.allowChildren.delete(childName);\n    }\n    for (const parentName of item.disallowIn) {\n        item.allowIn.delete(parentName);\n    }\n    for (const attributeName of item.disallowAttributes) {\n        item.allowAttributes.delete(attributeName);\n    }\n}\nfunction compileAllowContentOf(definitions, item) {\n    for (const allowContentOfItemName of item.allowContentOf) {\n        const baseItem = definitions[allowContentOfItemName];\n        if (!baseItem) {\n            continue;\n        }\n        // Copy `disallowChildren` to propagate this \"knowledge\" down the inheritance chain. The inheritance may involve multiple items and\n        // if this is not propagated, then items down the chain may start to allow for items that were disallowed by previous base items.\n        //\n        // The scenarios were it is important involves multiple inherits both on parent items side and on the child items side.\n        baseItem.disallowChildren.forEach(childName => {\n            // Own item's rules takes precedence before inherited.\n            // If the item directly allows for given child, ignore that base item disallowed that child.\n            if (item.allowChildren.has(childName)) {\n                return;\n            }\n            item.disallowChildren.add(childName);\n            definitions[childName].disallowIn.add(item.name);\n        });\n        // Copy `allowChildren` from the base item to allow for the same items.\n        baseItem.allowChildren.forEach(childName => {\n            // Own item's rules takes precedence before inherited.\n            // Also, `item.disallowChildren` might get some new items during inheritance process.\n            if (item.disallowChildren.has(childName)) {\n                return;\n            }\n            item.allowChildren.add(childName);\n            definitions[childName].allowIn.add(item.name);\n        });\n    }\n}\nfunction compileAllowWhere(definitions, item) {\n    for (const allowWhereItemName of item.allowWhere) {\n        const baseItem = definitions[allowWhereItemName];\n        if (!baseItem) {\n            continue;\n        }\n        // Copy `disallowIn` to propagate this \"knowledge\" down the inheritance chain. The inheritance may involve multiple items and\n        // if this is not propagated, then items down the chain may start to be allowed in items in which they were disallowed previously.\n        //\n        // The scenarios were it is important involves multiple inherits both on parent items side and on the child items side.\n        baseItem.disallowIn.forEach(parentName => {\n            // Own item's rules takes precedence before inherited.\n            // If the item is directly allowed in given parent, ignore that base item was disallowed in it.\n            if (item.allowIn.has(parentName)) {\n                return;\n            }\n            item.disallowIn.add(parentName);\n            definitions[parentName].disallowChildren.add(item.name);\n        });\n        // Copy `allowIn` from the base item to allow item in same parents.\n        baseItem.allowIn.forEach(parentName => {\n            // Own item's rules takes precedence before inherited.\n            // Also, `item.disallowIn` might get some new items during inheritance process.\n            if (item.disallowIn.has(parentName)) {\n                return;\n            }\n            item.allowIn.add(parentName);\n            definitions[parentName].allowChildren.add(item.name);\n        });\n    }\n}\nfunction compileDefinitions(definitions) {\n    const finalDefinitions = {};\n    for (const item of Object.values(definitions)) {\n        finalDefinitions[item.name] = {\n            name: item.name,\n            // `is*` properties may not be set - convert `undefined` to `false`.\n            isBlock: !!item.isBlock,\n            isContent: !!item.isContent,\n            isInline: !!item.isInline,\n            isLimit: !!item.isLimit,\n            isObject: !!item.isObject,\n            isSelectable: !!item.isSelectable,\n            // Filter out non-existing items.\n            allowIn: Array.from(item.allowIn).filter(name => !!definitions[name]),\n            allowChildren: Array.from(item.allowChildren).filter(name => !!definitions[name]),\n            allowAttributes: Array.from(item.allowAttributes)\n        };\n    }\n    return finalDefinitions;\n}\nfunction compileAllowAttributesOf(definitions, item) {\n    for (const allowAttributeOfItemName of item.allowAttributesOf) {\n        const baseItem = definitions[allowAttributeOfItemName];\n        if (!baseItem) {\n            return;\n        }\n        baseItem.allowAttributes.forEach(attributeName => {\n            if (item.disallowAttributes.has(attributeName)) {\n                return;\n            }\n            item.allowAttributes.add(attributeName);\n        });\n    }\n}\nfunction compileInheritPropertiesFrom(definitions, item) {\n    for (const inheritPropertiesOfItemName of item.inheritTypesFrom) {\n        const inheritFrom = definitions[inheritPropertiesOfItemName];\n        if (inheritFrom) {\n            const typeNames = Object.keys(inheritFrom).filter(name => name.startsWith('is'));\n            for (const name of typeNames) {\n                if (!(name in item)) {\n                    item[name] = inheritFrom[name];\n                }\n            }\n        }\n    }\n}\nfunction copyTypes(sourceItemRules, itemRule) {\n    for (const sourceItemRule of sourceItemRules) {\n        const typeNames = Object.keys(sourceItemRule).filter(name => name.startsWith('is'));\n        for (const name of typeNames) {\n            itemRule[name] = !!sourceItemRule[name];\n        }\n    }\n}\nfunction copyProperty(sourceItemRules, itemRule, propertyName) {\n    for (const sourceItemRule of sourceItemRules) {\n        let value = sourceItemRule[propertyName];\n        // `value` can be a string, an array or undefined.\n        // Convert a string to an array with one item, then handle an array. Skip undefined this way.\n        if (typeof value == 'string') {\n            value = [value];\n        }\n        if (Array.isArray(value)) {\n            value.forEach(singleValue => itemRule[propertyName].add(singleValue));\n        }\n    }\n}\nfunction resolveInheritAll(sourceItemRules, itemRule) {\n    for (const sourceItemRule of sourceItemRules) {\n        const inheritFrom = sourceItemRule.inheritAllFrom;\n        if (inheritFrom) {\n            itemRule.allowContentOf.add(inheritFrom);\n            itemRule.allowWhere.add(inheritFrom);\n            itemRule.allowAttributesOf.add(inheritFrom);\n            itemRule.inheritTypesFrom.add(inheritFrom);\n        }\n    }\n}\nfunction mapContextItem(ctxItem) {\n    if (typeof ctxItem == 'string' || ctxItem.is('documentFragment')) {\n        return {\n            name: typeof ctxItem == 'string' ? ctxItem : '$documentFragment',\n            *getAttributeKeys() { },\n            getAttribute() { }\n        };\n    }\n    else {\n        return {\n            // '$text' means text nodes and text proxies.\n            name: ctxItem.is('element') ? ctxItem.name : '$text',\n            *getAttributeKeys() {\n                yield* ctxItem.getAttributeKeys();\n            },\n            getAttribute(key) {\n                return ctxItem.getAttribute(key);\n            }\n        };\n    }\n}\n/**\n * Generator function returning values from provided walkers, switching between them at each iteration. If only one walker\n * is provided it will return data only from that walker.\n *\n * @param backward Walker iterating in backward direction.\n * @param forward Walker iterating in forward direction.\n * @returns Object returned at each iteration contains `value` and `walker` (informing which walker returned\n * given value) fields.\n */\nfunction* combineWalkers(backward, forward) {\n    let done = false;\n    while (!done) {\n        done = true;\n        if (backward) {\n            const step = backward.next();\n            if (!step.done) {\n                done = false;\n                yield {\n                    walker: backward,\n                    value: step.value\n                };\n            }\n        }\n        if (forward) {\n            const step = forward.next();\n            if (!step.done) {\n                done = false;\n                yield {\n                    walker: forward,\n                    value: step.value\n                };\n            }\n        }\n    }\n}\n/**\n * Takes an array of non-intersecting ranges. For each of them gets minimal flat ranges covering that range and returns\n * all those minimal flat ranges.\n *\n * @param ranges Ranges to process.\n * @returns Minimal flat ranges of given `ranges`.\n */\nfunction* convertToMinimalFlatRanges(ranges) {\n    for (const range of ranges) {\n        yield* range.getMinimalFlatRanges();\n    }\n}\nfunction removeDisallowedAttributeFromNode(schema, node, writer) {\n    for (const attribute of node.getAttributeKeys()) {\n        if (!schema.checkAttribute(node, attribute)) {\n            writer.removeAttribute(attribute, node);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/upcastdispatcher\n */\nimport { ViewConsumable } from './viewconsumable.js';\nimport { ModelRange } from '../model/range.js';\nimport { ModelPosition } from '../model/position.js';\nimport { ModelSchemaContext } from '../model/schema.js'; // eslint-disable-line no-duplicate-imports\nimport { isParagraphable, wrapInParagraph } from '../model/utils/autoparagraphing.js';\nimport { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Upcast dispatcher is a central point of the view-to-model conversion, which is a process of\n * converting a given {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment} or\n * {@link module:engine/view/element~ViewElement view element} into a correct model structure.\n *\n * During the conversion process, the dispatcher fires events for all {@link module:engine/view/node~ViewNode view nodes}\n * from the converted view document fragment.\n * Special callbacks called \"converters\" should listen to these events in order to convert the view nodes.\n *\n * The second parameter of the callback is the `data` object with the following properties:\n *\n * * `data.viewItem` contains a {@link module:engine/view/node~ViewNode view node} or a\n * {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}\n * that is converted at the moment and might be handled by the callback.\n * * `data.modelRange` is used to point to the result\n * of the current conversion (e.g. the element that is being inserted)\n * and is always a {@link module:engine/model/range~ModelRange} when the conversion succeeds.\n * * `data.modelCursor` is a {@link module:engine/model/position~ModelPosition position} on which the converter should insert\n * the newly created items.\n *\n * The third parameter of the callback is an instance of {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi}\n * which provides additional tools for converters.\n *\n * You can read more about conversion in the {@glink framework/deep-dive/conversion/upcast Upcast conversion} guide.\n *\n * Examples of event-based converters:\n *\n * ```ts\n * // A converter for links (<a>).\n * editor.data.upcastDispatcher.on( 'element:a', ( evt, data, conversionApi ) => {\n * \tif ( conversionApi.consumable.consume( data.viewItem, { name: true, attributes: [ 'href' ] } ) ) {\n * \t\t// The <a> element is inline and is represented by an attribute in the model.\n * \t\t// This is why you need to convert only children.\n * \t\tconst { modelRange } = conversionApi.convertChildren( data.viewItem, data.modelCursor );\n *\n * \t\tfor ( let item of modelRange.getItems() ) {\n * \t\t\tif ( conversionApi.schema.checkAttribute( item, 'linkHref' ) ) {\n * \t\t\t\tconversionApi.writer.setAttribute( 'linkHref', data.viewItem.getAttribute( 'href' ), item );\n * \t\t\t}\n * \t\t}\n * \t}\n * } );\n *\n * // Convert <p> element's font-size style.\n * // Note: You should use a low-priority observer in order to ensure that\n * // it is executed after the element-to-element converter.\n * editor.data.upcastDispatcher.on( 'element:p', ( evt, data, conversionApi ) => {\n * \tconst { consumable, schema, writer } = conversionApi;\n *\n * \tif ( !consumable.consume( data.viewItem, { style: 'font-size' } ) ) {\n * \t\treturn;\n * \t}\n *\n * \tconst fontSize = data.viewItem.getStyle( 'font-size' );\n *\n * \t// Do not go for the model element after data.modelCursor because it might happen\n * \t// that a single view element was converted to multiple model elements. Get all of them.\n * \tfor ( const item of data.modelRange.getItems( { shallow: true } ) ) {\n * \t\tif ( schema.checkAttribute( item, 'fontSize' ) ) {\n * \t\t\twriter.setAttribute( 'fontSize', fontSize, item );\n * \t\t}\n * \t}\n * }, { priority: 'low' } );\n *\n * // Convert all elements which have no custom converter into a paragraph (autoparagraphing).\n * editor.data.upcastDispatcher.on( 'element', ( evt, data, conversionApi ) => {\n * \t// Check if an element can be converted.\n * \tif ( !conversionApi.consumable.test( data.viewItem, { name: data.viewItem.name } ) ) {\n * \t\t// When an element is already consumed by higher priority converters, do nothing.\n * \t\treturn;\n * \t}\n *\n * \tconst paragraph = conversionApi.writer.createElement( 'paragraph' );\n *\n * \t// Try to safely insert a paragraph at the model cursor - it will find an allowed parent for the current element.\n * \tif ( !conversionApi.safeInsert( paragraph, data.modelCursor ) ) {\n * \t\t// When an element was not inserted, it means that you cannot insert a paragraph at this position.\n * \t\treturn;\n * \t}\n *\n * \t// Consume the inserted element.\n * \tconversionApi.consumable.consume( data.viewItem, { name: data.viewItem.name } ) );\n *\n * \t// Convert the children to a paragraph.\n * \tconst { modelRange } = conversionApi.convertChildren( data.viewItem,  paragraph ) );\n *\n * \t// Update `modelRange` and `modelCursor` in the `data` as a conversion result.\n * \tconversionApi.updateConversionResult( paragraph, data );\n * }, { priority: 'low' } );\n * ```\n *\n * @fires viewCleanup\n * @fires element\n * @fires text\n * @fires documentFragment\n */\nexport class UpcastDispatcher extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * An interface passed by the dispatcher to the event callbacks.\n     */\n    conversionApi;\n    /**\n     * The list of elements that were created during splitting.\n     *\n     * After the conversion process, the list is cleared.\n     */\n    _splitParts = new Map();\n    /**\n     * The list of cursor parent elements that were created during splitting.\n     *\n     * After the conversion process the list is cleared.\n     */\n    _cursorParents = new Map();\n    /**\n     * The position in the temporary structure where the converted content is inserted. The structure reflects the context of\n     * the target position where the content will be inserted. This property is built based on the context parameter of the\n     * convert method.\n     */\n    _modelCursor = null;\n    /**\n     * The list of elements that were created during the splitting but should not get removed on conversion end even if they are empty.\n     *\n     * The list is cleared after the conversion process.\n     */\n    _emptyElementsToKeep = new Set();\n    /**\n     * Creates an upcast dispatcher that operates using the passed API.\n     *\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi\n     * @param conversionApi Additional properties for an interface that will be passed to events fired\n     * by the upcast dispatcher.\n     */\n    constructor(conversionApi) {\n        super();\n        this.conversionApi = {\n            ...conversionApi,\n            consumable: null,\n            writer: null,\n            store: null,\n            convertItem: (viewItem, modelCursor) => this._convertItem(viewItem, modelCursor),\n            convertChildren: (viewElement, positionOrElement) => this._convertChildren(viewElement, positionOrElement),\n            safeInsert: (modelNode, position) => this._safeInsert(modelNode, position),\n            updateConversionResult: (modelElement, data) => this._updateConversionResult(modelElement, data),\n            // Advanced API - use only if custom position handling is needed.\n            splitToAllowedParent: (modelNode, modelCursor) => this._splitToAllowedParent(modelNode, modelCursor),\n            getSplitParts: modelElement => this._getSplitParts(modelElement),\n            keepEmptyElement: modelElement => this._keepEmptyElement(modelElement)\n        };\n    }\n    /**\n     * Starts the conversion process. The entry point for the conversion.\n     *\n     * @fires element\n     * @fires text\n     * @fires documentFragment\n     * @param viewElement The part of the view to be converted.\n     * @param writer An instance of the model writer.\n     * @param context Elements will be converted according to this context.\n     * @returns Model data that is the result of the conversion process\n     * wrapped in `DocumentFragment`. Converted marker elements will be set as the document fragment's\n     * {@link module:engine/model/documentfragment~ModelDocumentFragment#markers static markers map}.\n     */\n    convert(viewElement, writer, context = ['$root']) {\n        this.fire('viewCleanup', viewElement);\n        // Create context tree and set position in the top element.\n        // Items will be converted according to this position.\n        this._modelCursor = createContextTree(context, writer);\n        // Store writer in conversion as a conversion API\n        // to be sure that conversion process will use the same batch.\n        this.conversionApi.writer = writer;\n        // Create consumable values list for conversion process.\n        this.conversionApi.consumable = ViewConsumable.createFrom(viewElement);\n        // Custom data stored by converter for conversion process.\n        this.conversionApi.store = {};\n        // Do the conversion.\n        const { modelRange } = this._convertItem(viewElement, this._modelCursor);\n        // Conversion result is always a document fragment so let's create it.\n        const documentFragment = writer.createDocumentFragment();\n        // When there is a conversion result.\n        if (modelRange) {\n            // Remove all empty elements that were created while splitting.\n            this._removeEmptyElements();\n            // Move all items that were converted in context tree to the document fragment.\n            const parent = this._modelCursor.parent;\n            const children = parent._removeChildren(0, parent.childCount);\n            documentFragment._insertChild(0, children);\n            // Extract temporary markers elements from model and set as static markers collection.\n            documentFragment.markers = extractMarkersFromModelFragment(documentFragment, writer);\n        }\n        // Clear context position.\n        this._modelCursor = null;\n        // Clear split elements & parents lists.\n        this._splitParts.clear();\n        this._cursorParents.clear();\n        this._emptyElementsToKeep.clear();\n        // Clear conversion API.\n        this.conversionApi.writer = null;\n        this.conversionApi.store = null;\n        // Return fragment as conversion result.\n        return documentFragment;\n    }\n    /**\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#convertItem\n     */\n    _convertItem(viewItem, modelCursor) {\n        const data = { viewItem, modelCursor, modelRange: null };\n        if (viewItem.is('element')) {\n            this.fire(`element:${viewItem.name}`, data, this.conversionApi);\n        }\n        else if (viewItem.is('$text')) {\n            this.fire('text', data, this.conversionApi);\n        }\n        else {\n            this.fire('documentFragment', data, this.conversionApi);\n        }\n        // Handle incorrect conversion result.\n        if (data.modelRange && !(data.modelRange instanceof ModelRange)) {\n            /**\n             * Incorrect conversion result was dropped.\n             *\n             * {@link module:engine/model/range~ModelRange Model range} should be a conversion result.\n             *\n             * @error view-conversion-dispatcher-incorrect-result\n             */\n            throw new CKEditorError('view-conversion-dispatcher-incorrect-result', this);\n        }\n        return { modelRange: data.modelRange, modelCursor: data.modelCursor };\n    }\n    /**\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#convertChildren\n     */\n    _convertChildren(viewItem, elementOrModelCursor) {\n        let nextModelCursor = elementOrModelCursor.is('position') ?\n            elementOrModelCursor : ModelPosition._createAt(elementOrModelCursor, 0);\n        const modelRange = new ModelRange(nextModelCursor);\n        for (const viewChild of Array.from(viewItem.getChildren())) {\n            const result = this._convertItem(viewChild, nextModelCursor);\n            if (result.modelRange instanceof ModelRange) {\n                modelRange.end = result.modelRange.end;\n                nextModelCursor = result.modelCursor;\n            }\n        }\n        return { modelRange, modelCursor: nextModelCursor };\n    }\n    /**\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#safeInsert\n     */\n    _safeInsert(modelNode, position) {\n        // Find allowed parent for element that we are going to insert.\n        // If current parent does not allow to insert element but one of the ancestors does\n        // then split nodes to allowed parent.\n        const splitResult = this._splitToAllowedParent(modelNode, position);\n        // When there is no split result it means that we can't insert element to model tree, so let's skip it.\n        if (!splitResult) {\n            return false;\n        }\n        // Insert element on allowed position.\n        this.conversionApi.writer.insert(modelNode, splitResult.position);\n        return true;\n    }\n    /**\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#updateConversionResult\n     */\n    _updateConversionResult(modelElement, data) {\n        const parts = this._getSplitParts(modelElement);\n        const writer = this.conversionApi.writer;\n        // Set conversion result range - only if not set already.\n        if (!data.modelRange) {\n            data.modelRange = writer.createRange(writer.createPositionBefore(modelElement), writer.createPositionAfter(parts[parts.length - 1]));\n        }\n        const savedCursorParent = this._cursorParents.get(modelElement);\n        // Now we need to check where the `modelCursor` should be.\n        if (savedCursorParent) {\n            // If we split parent to insert our element then we want to continue conversion in the new part of the split parent.\n            //\n            // before: <allowed><notAllowed>foo[]</notAllowed></allowed>\n            // after:  <allowed><notAllowed>foo</notAllowed> <converted></converted> <notAllowed>[]</notAllowed></allowed>\n            data.modelCursor = writer.createPositionAt(savedCursorParent, 0);\n        }\n        else {\n            // Otherwise just continue after inserted element.\n            data.modelCursor = data.modelRange.end;\n        }\n    }\n    /**\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#splitToAllowedParent\n     */\n    _splitToAllowedParent(node, modelCursor) {\n        const { schema, writer } = this.conversionApi;\n        // Try to find allowed parent.\n        let allowedParent = schema.findAllowedParent(modelCursor, node);\n        if (allowedParent) {\n            // When current position parent allows to insert node then return this position.\n            if (allowedParent === modelCursor.parent) {\n                return { position: modelCursor };\n            }\n            // When allowed parent is in context tree (it's outside the converted tree).\n            if (this._modelCursor.parent.getAncestors().includes(allowedParent)) {\n                allowedParent = null;\n            }\n        }\n        if (!allowedParent) {\n            // Check if the node wrapped with a paragraph would be accepted by the schema.\n            if (!isParagraphable(modelCursor, node, schema)) {\n                return null;\n            }\n            return {\n                position: wrapInParagraph(modelCursor, writer)\n            };\n        }\n        // Split element to allowed parent.\n        const splitResult = this.conversionApi.writer.split(modelCursor, allowedParent);\n        // Using the range returned by `model.Writer#split`, we will pair original elements with their split parts.\n        //\n        // The range returned from the writer spans \"over the split\" or, precisely saying, from the end of the original element (the one\n        // that got split) to the beginning of the other part of that element:\n        //\n        // <limit><a><b><c>X[]Y</c></b><a></limit> ->\n        // <limit><a><b><c>X[</c></b></a><a><b><c>]Y</c></b></a>\n        //\n        // After the split there cannot be any full node between the positions in `splitRange`. The positions are touching.\n        // Also, because of how splitting works, it is easy to notice, that \"closing tags\" are in the reverse order than \"opening tags\".\n        // Also, since we split all those elements, each of them has to have the other part.\n        //\n        // With those observations in mind, we will pair the original elements with their split parts by saving \"closing tags\" and matching\n        // them with \"opening tags\" in the reverse order. For that we can use a stack.\n        const stack = [];\n        for (const treeWalkerValue of splitResult.range.getWalker()) {\n            if (treeWalkerValue.type == 'elementEnd') {\n                stack.push(treeWalkerValue.item);\n            }\n            else {\n                // There should not be any text nodes after the element is split, so the only other value is `elementStart`.\n                const originalPart = stack.pop();\n                const splitPart = treeWalkerValue.item;\n                this._registerSplitPair(originalPart, splitPart);\n            }\n        }\n        const cursorParent = splitResult.range.end.parent;\n        this._cursorParents.set(node, cursorParent);\n        return {\n            position: splitResult.position,\n            cursorParent\n        };\n    }\n    /**\n     * Registers that a `splitPart` element is a split part of the `originalPart` element.\n     *\n     * The data set by this method is used by {@link #_getSplitParts} and {@link #_removeEmptyElements}.\n     */\n    _registerSplitPair(originalPart, splitPart) {\n        if (!this._splitParts.has(originalPart)) {\n            this._splitParts.set(originalPart, [originalPart]);\n        }\n        const list = this._splitParts.get(originalPart);\n        this._splitParts.set(splitPart, list);\n        list.push(splitPart);\n    }\n    /**\n     * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#getSplitParts\n     */\n    _getSplitParts(element) {\n        let parts;\n        if (!this._splitParts.has(element)) {\n            parts = [element];\n        }\n        else {\n            parts = this._splitParts.get(element);\n        }\n        return parts;\n    }\n    /**\n     * Mark an element that were created during the splitting to not get removed on conversion end even if it is empty.\n     */\n    _keepEmptyElement(element) {\n        this._emptyElementsToKeep.add(element);\n    }\n    /**\n     * Checks if there are any empty elements created while splitting and removes them.\n     *\n     * This method works recursively to re-check empty elements again after at least one element was removed in the initial call,\n     * as some elements might have become empty after other empty elements were removed from them.\n     */\n    _removeEmptyElements() {\n        // For every parent, prepare an array of children (empty elements) to remove from it.\n        // Then, in next step, we will remove all children together, which is faster than removing them one by one.\n        const toRemove = new Map();\n        for (const element of this._splitParts.keys()) {\n            if (element.isEmpty && !this._emptyElementsToKeep.has(element)) {\n                const children = toRemove.get(element.parent) || [];\n                children.push(element);\n                this._splitParts.delete(element);\n                toRemove.set(element.parent, children);\n            }\n        }\n        for (const [parent, children] of toRemove) {\n            parent._removeChildrenArray(children);\n        }\n        if (toRemove.size) {\n            this._removeEmptyElements();\n        }\n    }\n}\n/**\n * Traverses given model item and searches elements which marks marker range. Found element is removed from\n * ModelDocumentFragment but path of this element is stored in a Map which is then returned.\n *\n * @param modelItem Fragment of model.\n * @returns List of static markers.\n */\nfunction extractMarkersFromModelFragment(modelItem, writer) {\n    const markerElements = new Set();\n    const markers = new Map();\n    // Create ModelTreeWalker.\n    const range = ModelRange._createIn(modelItem).getItems();\n    // Walk through ModelDocumentFragment and collect marker elements.\n    for (const item of range) {\n        // Check if current element is a marker.\n        if (item.is('element', '$marker')) {\n            markerElements.add(item);\n        }\n    }\n    // Walk through collected marker elements store its path and remove its from the ModelDocumentFragment.\n    for (const markerElement of markerElements) {\n        const markerName = markerElement.getAttribute('data-name');\n        const currentPosition = writer.createPositionBefore(markerElement);\n        // When marker of given name is not stored it means that we have found the beginning of the range.\n        if (!markers.has(markerName)) {\n            markers.set(markerName, new ModelRange(currentPosition.clone()));\n            // Otherwise is means that we have found end of the marker range.\n        }\n        else {\n            markers.get(markerName).end = currentPosition.clone();\n        }\n        // Remove marker element from ModelDocumentFragment.\n        writer.remove(markerElement);\n    }\n    return markers;\n}\n/**\n * Creates model fragment according to given context and returns position in the bottom (the deepest) element.\n */\nfunction createContextTree(contextDefinition, writer) {\n    let position;\n    for (const item of new ModelSchemaContext(contextDefinition)) {\n        const attributes = {};\n        for (const key of item.getAttributeKeys()) {\n            attributes[key] = item.getAttribute(key);\n        }\n        const current = writer.createElement(item.name, attributes);\n        if (position) {\n            writer.insert(current, position);\n        }\n        position = ModelPosition._createAt(current, 0);\n    }\n    return position;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { global } from '@ckeditor/ckeditor5-utils';\n/**\n * Basic HTML writer. It uses the native `innerHTML` property for basic conversion\n * from a document fragment to an HTML string.\n *\n * @internal\n */\nexport class BasicHtmlWriter {\n    /**\n     * Returns an HTML string created from the document fragment.\n     */\n    getHtml(fragment) {\n        const doc = global.document.implementation.createHTMLDocument('');\n        const container = doc.createElement('div');\n        container.appendChild(fragment);\n        return container.innerHTML;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/dataprocessor/htmldataprocessor\n */\nimport { BasicHtmlWriter } from './basichtmlwriter.js';\nimport { ViewDomConverter } from '../view/domconverter.js';\n/**\n * The HTML data processor class.\n * This data processor implementation uses HTML as input and output data.\n */\nexport class HtmlDataProcessor {\n    /**\n     * A DOM parser instance used to parse an HTML string to an HTML document.\n     */\n    domParser;\n    /**\n     * A DOM converter used to convert DOM elements to view elements.\n     */\n    domConverter;\n    /**\n     * A basic HTML writer instance used to convert DOM elements to an HTML string.\n     */\n    htmlWriter;\n    skipComments = true;\n    /**\n     * Creates a new instance of the HTML data processor class.\n     *\n     * @param document The view document instance.\n     */\n    constructor(document) {\n        this.domParser = new DOMParser();\n        this.domConverter = new ViewDomConverter(document, { renderingMode: 'data' });\n        this.htmlWriter = new BasicHtmlWriter();\n    }\n    /**\n     * Converts a provided {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}\n     * to data format &ndash; in this case to an HTML string.\n     *\n     * @returns HTML string.\n     */\n    toData(viewFragment) {\n        // Convert view DocumentFragment to DOM DocumentFragment.\n        const domFragment = this.domConverter.viewToDom(viewFragment);\n        // Convert DOM DocumentFragment to HTML output.\n        return this.htmlWriter.getHtml(domFragment);\n    }\n    /**\n     * Converts the provided HTML string to a view tree.\n     *\n     * @param data An HTML string.\n     * @returns A converted view element.\n     */\n    toView(data) {\n        // Convert input HTML data to DOM DocumentFragment.\n        const domFragment = this._toDom(data);\n        // Convert DOM DocumentFragment to view DocumentFragment.\n        return this.domConverter.domToView(domFragment, { skipComments: this.skipComments });\n    }\n    /**\n     * Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data\n     * and not processed during the conversion from the DOM to the view elements.\n     *\n     * The raw data can be later accessed by a\n     * {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `\"$rawContent\"`.\n     *\n     * @param pattern Pattern matching all view elements whose content should be treated as raw data.\n     */\n    registerRawContentMatcher(pattern) {\n        this.domConverter.registerRawContentMatcher(pattern);\n    }\n    /**\n     * If the processor is set to use marked fillers, it will insert `&nbsp;` fillers wrapped in `<span>` elements\n     * (`<span data-cke-filler=\"true\">&nbsp;</span>`) instead of regular `&nbsp;` characters.\n     *\n     * This mode allows for a more precise handling of the block fillers (so they do not leak into the editor content) but\n     * bloats the editor data with additional markup.\n     *\n     * This mode may be required by some features and will be turned on by them automatically.\n     *\n     * @param type Whether to use the default or the marked `&nbsp;` block fillers.\n     */\n    useFillerType(type) {\n        this.domConverter.blockFillerMode = type == 'marked' ? 'markedNbsp' : 'nbsp';\n    }\n    /**\n     * Converts an HTML string to its DOM representation. Returns a document fragment containing nodes parsed from\n     * the provided data.\n     */\n    _toDom(data) {\n        // Wrap data with a <body> tag so leading non-layout nodes (like <script>, <style>, HTML comment)\n        // will be preserved in the body collection.\n        // Do it only for data that is not a full HTML document.\n        if (!/<(?:html|body|head|meta)(?:\\s[^>]*)?>/i.test(data.trim().slice(0, 10000))) {\n            data = `<body>${data}</body>`;\n        }\n        const document = this.domParser.parseFromString(data, 'text/html');\n        const fragment = document.createDocumentFragment();\n        const bodyChildNodes = document.body.childNodes;\n        while (bodyChildNodes.length > 0) {\n            fragment.appendChild(bodyChildNodes[0]);\n        }\n        return fragment;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/controller/datacontroller\n */\nimport { CKEditorError, EmitterMixin, ObservableMixin, logWarning } from '@ckeditor/ckeditor5-utils';\nimport { Mapper } from '../conversion/mapper.js';\nimport { DowncastDispatcher } from '../conversion/downcastdispatcher.js';\nimport { insertAttributesAndChildren, insertText } from '../conversion/downcasthelpers.js';\nimport { UpcastDispatcher } from '../conversion/upcastdispatcher.js';\nimport { convertText, convertToModelFragment } from '../conversion/upcasthelpers.js';\nimport { ViewDocumentFragment } from '../view/documentfragment.js';\nimport { ViewDocument } from '../view/document.js';\nimport { ViewDowncastWriter } from '../view/downcastwriter.js';\nimport { ModelRange } from '../model/range.js';\nimport { autoParagraphEmptyRoots } from '../model/utils/autoparagraphing.js';\nimport { HtmlDataProcessor } from '../dataprocessor/htmldataprocessor.js';\n/**\n * Controller for the data pipeline. The data pipeline controls how data is retrieved from the document\n * and set inside it. Hence, the controller features two methods which allow to {@link ~DataController#get get}\n * and {@link ~DataController#set set} data of the {@link ~DataController#model model}\n * using the given:\n *\n * * {@link module:engine/dataprocessor/dataprocessor~DataProcessor data processor},\n * * downcast converters,\n * * upcast converters.\n *\n * An instance of the data controller is always available in the {@link module:core/editor/editor~Editor#data `editor.data`}\n * property:\n *\n * ```ts\n * editor.data.get( { rootName: 'customRoot' } ); // -> '<p>Hello!</p>'\n * ```\n */\nexport class DataController extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * Data model.\n     */\n    model;\n    /**\n     * Mapper used for the conversion. It has no permanent bindings, because these are created while getting data and\n     * are cleared directly after the data are converted. However, the mapper is defined as a class property, because\n     * it needs to be passed to the `DowncastDispatcher` as a conversion API.\n     */\n    mapper;\n    /**\n     * Downcast dispatcher used by the {@link #get get method}. Downcast converters should be attached to it.\n     */\n    downcastDispatcher;\n    /**\n     * Upcast dispatcher used by the {@link #set set method}. Upcast converters should be attached to it.\n     */\n    upcastDispatcher;\n    /**\n     * The view document used by the data controller.\n     */\n    viewDocument;\n    /**\n     * Styles processor used during the conversion.\n     */\n    stylesProcessor;\n    /**\n     * Data processor used specifically for HTML conversion.\n     */\n    htmlProcessor;\n    /**\n     * Data processor used during the conversion.\n     * Same instance as {@link #htmlProcessor} by default. Can be replaced at run time to handle different format, e.g. XML or Markdown.\n     */\n    processor;\n    /**\n     * The view downcast writer just for data conversion purposes, i.e. to modify\n     * the {@link #viewDocument}.\n     */\n    _viewWriter;\n    /**\n     * Creates a data controller instance.\n     *\n     * @param model Data model.\n     * @param stylesProcessor The styles processor instance.\n     */\n    constructor(model, stylesProcessor) {\n        super();\n        this.model = model;\n        this.mapper = new Mapper();\n        this.downcastDispatcher = new DowncastDispatcher({\n            mapper: this.mapper,\n            schema: model.schema\n        });\n        this.downcastDispatcher.on('insert:$text', insertText(), { priority: 'lowest' });\n        this.downcastDispatcher.on('insert', insertAttributesAndChildren(), { priority: 'lowest' });\n        this.upcastDispatcher = new UpcastDispatcher({\n            schema: model.schema\n        });\n        this.viewDocument = new ViewDocument(stylesProcessor);\n        this.stylesProcessor = stylesProcessor;\n        this.htmlProcessor = new HtmlDataProcessor(this.viewDocument);\n        this.processor = this.htmlProcessor;\n        this._viewWriter = new ViewDowncastWriter(this.viewDocument);\n        // Define default converters for text and elements.\n        //\n        // Note that if there is no default converter for the element it will be skipped, for instance `<b>foo</b>` will be\n        // converted to nothing. We therefore add `convertToModelFragment` as a last converter so it converts children of that\n        // element to the document fragment so `<b>foo</b>` will still be converted to `foo` even if there is no converter for `<b>`.\n        this.upcastDispatcher.on('text', convertText(), { priority: 'lowest' });\n        this.upcastDispatcher.on('element', convertToModelFragment(), { priority: 'lowest' });\n        this.upcastDispatcher.on('documentFragment', convertToModelFragment(), { priority: 'lowest' });\n        ObservableMixin().prototype.decorate.call(this, 'init');\n        ObservableMixin().prototype.decorate.call(this, 'set');\n        ObservableMixin().prototype.decorate.call(this, 'get');\n        ObservableMixin().prototype.decorate.call(this, 'toView');\n        ObservableMixin().prototype.decorate.call(this, 'toModel');\n        // Fire the `ready` event when the initialization has completed. Such low-level listener offers the possibility\n        // to plug into the initialization pipeline without interrupting the initialization flow.\n        this.on('init', () => {\n            this.fire('ready');\n        }, { priority: 'lowest' });\n        // Fix empty roots after DataController is 'ready' (note that the init method could be decorated and stopped).\n        // We need to handle this event because initial data could be empty and the post-fixer would not get triggered.\n        this.on('ready', () => {\n            this.model.enqueueChange({ isUndoable: false }, autoParagraphEmptyRoots);\n        }, { priority: 'lowest' });\n    }\n    /**\n     * Returns the model's data converted by downcast dispatchers attached to {@link #downcastDispatcher} and\n     * formatted by the {@link #processor data processor}.\n     *\n     * A warning is logged when you try to retrieve data for a detached root, as most probably this is a mistake. A detached root should\n     * be treated like it is removed, and you should not save its data. Note, that the detached root data is always an empty string.\n     *\n     * @fires get\n     * @param options Additional configuration for the retrieved data. `DataController` provides two optional\n     * properties: `rootName` and `trim`. Other properties of this object are specified by various editor features.\n     * @param options.rootName Root name. Default 'main'.\n     * @param options.trim Whether returned data should be trimmed. This option is set to `empty` by default,\n     * which means whenever editor content is considered empty, an empty string will be returned. To turn off trimming completely\n     * use `'none'`. In such cases the exact content will be returned (for example a `<p>&nbsp;</p>` for an empty editor).\n     * @returns Output data.\n     */\n    get(options = {}) {\n        const { rootName = 'main', trim = 'empty' } = options;\n        if (!this._checkIfRootsExists([rootName])) {\n            /**\n             * Cannot get data from a non-existing root. This error is thrown when\n             * {@link module:engine/controller/datacontroller~DataController#get `DataController#get()` method}\n             * is called with a non-existent root name. For example, if there is an editor instance with only `main` root,\n             * calling {@link module:engine/controller/datacontroller~DataController#get} like:\n             *\n             * ```ts\n             * data.get( { rootName: 'root2' } );\n             * ```\n             *\n             * will throw this error.\n             *\n             * @error datacontroller-get-non-existent-root\n             */\n            throw new CKEditorError('datacontroller-get-non-existent-root', this);\n        }\n        const root = this.model.document.getRoot(rootName);\n        if (!root.isAttached()) {\n            /**\n             * Retrieving document data for a detached root.\n             *\n             * This usually indicates an error as a detached root should be considered \"removed\" and should not be included in the\n             * document data.\n             *\n             * @error datacontroller-get-detached-root\n             */\n            logWarning('datacontroller-get-detached-root', this);\n        }\n        if (trim === 'empty' && !this.model.hasContent(root, { ignoreWhitespaces: true })) {\n            return '';\n        }\n        return this.stringify(root, options);\n    }\n    /**\n     * Returns the content of the given {@link module:engine/model/element~ModelElement model's element} or\n     * {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} converted by the downcast converters\n     * attached to the {@link #downcastDispatcher} and formatted by the {@link #processor data processor}.\n     *\n     * @param modelElementOrFragment The element whose content will be stringified.\n     * @param options Additional configuration passed to the conversion process.\n     * @returns Output data.\n     */\n    stringify(modelElementOrFragment, options = {}) {\n        // Model -> view.\n        const viewDocumentFragment = this.toView(modelElementOrFragment, options);\n        // View -> data.\n        return this.processor.toData(viewDocumentFragment);\n    }\n    /**\n     * Returns the content of the given {@link module:engine/model/element~ModelElement model element} or\n     * {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} converted by the downcast\n     * converters attached to {@link #downcastDispatcher} into a\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}.\n     *\n     * @fires toView\n     * @param modelElementOrFragment Element or document fragment whose content will be converted.\n     * @param options Additional configuration that will be available through the\n     * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi#options} during the conversion process.\n     * @returns Output view ModelDocumentFragment.\n     */\n    toView(modelElementOrFragment, options = {}) {\n        const viewDocument = this.viewDocument;\n        const viewWriter = this._viewWriter;\n        // Clear bindings so the call to this method returns correct results.\n        this.mapper.clearBindings();\n        // First, convert elements.\n        const modelRange = ModelRange._createIn(modelElementOrFragment);\n        const viewDocumentFragment = new ViewDocumentFragment(viewDocument);\n        this.mapper.bindElements(modelElementOrFragment, viewDocumentFragment);\n        // Prepare list of markers.\n        // For document fragment, simply take the markers assigned to this document fragment.\n        // For model root, all markers in that root will be taken.\n        // For model element, we need to check which markers are intersecting with this element and relatively modify the markers' ranges.\n        // Collapsed markers at element boundary, although considered as not intersecting with the element, will also be returned.\n        const markers = modelElementOrFragment.is('documentFragment') ?\n            modelElementOrFragment.markers :\n            _getMarkersRelativeToElement(modelElementOrFragment);\n        this.downcastDispatcher.convert(modelRange, markers, viewWriter, options);\n        return viewDocumentFragment;\n    }\n    /**\n     * Sets the initial input data parsed by the {@link #processor data processor} and\n     * converted by the {@link #upcastDispatcher view-to-model converters}.\n     * Initial data can be only set to a document whose {@link module:engine/model/document~ModelDocument#version} is equal 0.\n     *\n     * **Note** This method is {@link module:utils/observablemixin~Observable#decorate decorated} which is\n     * used by e.g. collaborative editing plugin that syncs remote data on init.\n     *\n     * When data is passed as a string, it is initialized on the default `main` root:\n     *\n     * ```ts\n     * dataController.init( '<p>Foo</p>' ); // Initializes data on the `main` root only, as no other is specified.\n     * ```\n     *\n     * To initialize data on a different root or multiple roots at once, an object containing `rootName` - `data` pairs should be passed:\n     *\n     * ```ts\n     * dataController.init( { main: '<p>Foo</p>', title: '<h1>Bar</h1>' } ); // Initializes data on both the `main` and `title` roots.\n     * ```\n     *\n     * @fires init\n     * @param data Input data as a string or an object containing the `rootName` - `data`\n     * pairs to initialize data on multiple roots at once.\n     * @returns Promise that is resolved after the data is set on the editor.\n     */\n    init(data) {\n        if (this.model.document.version) {\n            /**\n             * Cannot set initial data to a non-empty {@link module:engine/model/document~ModelDocument}.\n             * Initial data should be set once, during the {@link module:core/editor/editor~Editor} initialization,\n             * when the {@link module:engine/model/document~ModelDocument#version} is equal 0.\n             *\n             * @error datacontroller-init-document-not-empty\n             */\n            throw new CKEditorError('datacontroller-init-document-not-empty', this);\n        }\n        let initialData = {};\n        if (typeof data === 'string') {\n            initialData.main = data; // Default root is 'main'. To initiate data on a different root, object should be passed.\n        }\n        else {\n            initialData = data;\n        }\n        if (!this._checkIfRootsExists(Object.keys(initialData))) {\n            /**\n             * Cannot init data on a non-existent root. This error is thrown when\n             * {@link module:engine/controller/datacontroller~DataController#init DataController#init() method}\n             * is called with non-existent root name. For example, if there is an editor instance with only `main` root,\n             * calling {@link module:engine/controller/datacontroller~DataController#init} like:\n             *\n             * ```ts\n             * data.init( { main: '<p>Foo</p>', root2: '<p>Bar</p>' } );\n             * ```\n             *\n             * will throw this error.\n             *\n             * @error datacontroller-init-non-existent-root\n             */\n            throw new CKEditorError('datacontroller-init-non-existent-root', this);\n        }\n        this.model.enqueueChange({ isUndoable: false }, writer => {\n            for (const rootName of Object.keys(initialData)) {\n                const modelRoot = this.model.document.getRoot(rootName);\n                writer.insert(this.parse(initialData[rootName], modelRoot), modelRoot, 0);\n            }\n        });\n        return Promise.resolve();\n    }\n    /**\n     * Sets the input data parsed by the {@link #processor data processor} and\n     * converted by the {@link #upcastDispatcher view-to-model converters}.\n     * This method can be used any time to replace existing editor data with the new one without clearing the\n     * {@link module:engine/model/document~ModelDocument#history document history}.\n     *\n     * This method also creates a batch with all the changes applied. If all you need is to parse data, use\n     * the {@link #parse} method.\n     *\n     * When data is passed as a string it is set on the default `main` root:\n     *\n     * ```ts\n     * dataController.set( '<p>Foo</p>' ); // Sets data on the `main` root, as no other is specified.\n     * ```\n     *\n     * To set data on a different root or multiple roots at once, an object containing `rootName` - `data` pairs should be passed:\n     *\n     * ```ts\n     * dataController.set( { main: '<p>Foo</p>', title: '<h1>Bar</h1>' } ); // Sets data on the `main` and `title` roots as specified.\n     * ```\n     *\n     * To set the data with a preserved undo stack and add the change to the undo stack, set `{ isUndoable: true }` as a `batchType` option.\n     *\n     * ```ts\n     * dataController.set( '<p>Foo</p>', { batchType: { isUndoable: true } } );\n     * ```\n     *\n     * @fires set\n     * @param data Input data as a string or an object containing the `rootName` - `data`\n     * pairs to set data on multiple roots at once.\n     * @param options Options for setting data.\n     * @param options.batchType The batch type that will be used to create a batch for the changes applied by this method.\n     * By default, the batch will be set as {@link module:engine/model/batch~Batch#isUndoable not undoable} and the undo stack will be\n     * cleared after the new data is applied (all undo steps will be removed). If the batch type `isUndoable` flag is be set to `true`,\n     * the undo stack will be preserved instead and not cleared when new data is applied.\n     */\n    set(data, options = {}) {\n        let newData = {};\n        if (typeof data === 'string') {\n            newData.main = data; // The default root is 'main'. To set data on a different root, an object should be passed.\n        }\n        else {\n            newData = data;\n        }\n        if (!this._checkIfRootsExists(Object.keys(newData))) {\n            /**\n             * Cannot set data on a non-existent root. This error is thrown when the\n             * {@link module:engine/controller/datacontroller~DataController#set DataController#set() method}\n             * is called with non-existent root name. For example, if there is an editor instance with only the default `main` root,\n             * calling {@link module:engine/controller/datacontroller~DataController#set} like:\n             *\n             * ```ts\n             * data.set( { main: '<p>Foo</p>', root2: '<p>Bar</p>' } );\n             * ```\n             *\n             * will throw this error.\n             *\n             * @error datacontroller-set-non-existent-root\n             */\n            throw new CKEditorError('datacontroller-set-non-existent-root', this);\n        }\n        this.model.enqueueChange(options.batchType || {}, writer => {\n            writer.setSelection(null);\n            writer.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());\n            for (const rootName of Object.keys(newData)) {\n                // Save to model.\n                const modelRoot = this.model.document.getRoot(rootName);\n                writer.remove(writer.createRangeIn(modelRoot));\n                writer.insert(this.parse(newData[rootName], modelRoot), modelRoot, 0);\n            }\n        });\n    }\n    /**\n     * Returns the data parsed by the {@link #processor data processor} and then converted by upcast converters\n     * attached to the {@link #upcastDispatcher}.\n     *\n     * @see #set\n     * @param data Data to parse.\n     * @param context Base context in which the view will be converted to the model.\n     * See: {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#convert}.\n     * @returns Parsed data.\n     */\n    parse(data, context = '$root') {\n        // data -> view\n        const viewDocumentFragment = this.processor.toView(data);\n        // view -> model\n        return this.toModel(viewDocumentFragment, context);\n    }\n    /**\n     * Returns the result of the given {@link module:engine/view/element~ViewElement view element} or\n     * {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment} converted by the\n     * {@link #upcastDispatcher view-to-model converters}, wrapped by {@link module:engine/model/documentfragment~ModelDocumentFragment}.\n     *\n     * When marker elements were converted during the conversion process, it will be set as a document fragment's\n     * {@link module:engine/model/documentfragment~ModelDocumentFragment#markers static markers map}.\n     *\n     * @fires toModel\n     * @param viewElementOrFragment The element or document fragment whose content will be converted.\n     * @param context Base context in which the view will be converted to the model.\n     * See: {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#convert}.\n     * @returns Output document fragment.\n     */\n    toModel(viewElementOrFragment, context = '$root') {\n        return this.model.change(writer => {\n            return this.upcastDispatcher.convert(viewElementOrFragment, writer, context);\n        });\n    }\n    /**\n     * Adds the style processor normalization rules.\n     *\n     * You can implement your own rules as well as use one of the available processor rules:\n     *\n     * * background: {@link module:engine/view/styles/background~addBackgroundStylesRules}\n     * * border: {@link module:engine/view/styles/border~addBorderStylesRules}\n     * * margin: {@link module:engine/view/styles/margin~addMarginStylesRules}\n     * * padding: {@link module:engine/view/styles/padding~addPaddingStylesRules}\n     */\n    addStyleProcessorRules(callback) {\n        callback(this.stylesProcessor);\n    }\n    /**\n     * Registers a {@link module:engine/view/matcher~MatcherPattern} on an {@link #htmlProcessor htmlProcessor}\n     * and a {@link #processor processor} for view elements whose content should be treated as raw data\n     * and not processed during the conversion from DOM to view elements.\n     *\n     * The raw data can be later accessed by the\n     * {@link module:engine/view/element~ViewElement#getCustomProperty view element custom property}\n     * `\"$rawContent\"`.\n     *\n     * @param pattern Pattern matching all view elements whose content should be treated as a raw data.\n     */\n    registerRawContentMatcher(pattern) {\n        // No need to register the pattern if both the `htmlProcessor` and `processor` are the same instances.\n        if (this.processor && this.processor !== this.htmlProcessor) {\n            this.processor.registerRawContentMatcher(pattern);\n        }\n        this.htmlProcessor.registerRawContentMatcher(pattern);\n    }\n    /**\n     * Removes all event listeners set by the DataController.\n     */\n    destroy() {\n        this.stopListening();\n    }\n    /**\n     * Checks whether all provided root names are actually existing editor roots.\n     *\n     * @param rootNames Root names to check.\n     * @returns Whether all provided root names are existing editor roots.\n     */\n    _checkIfRootsExists(rootNames) {\n        for (const rootName of rootNames) {\n            if (!this.model.document.getRoot(rootName)) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n/**\n * Helper function for downcast conversion.\n *\n * Takes a document element (element that is added to a model document) and checks which markers are inside it. If the marker is collapsed\n * at element boundary, it is considered as contained inside the element and marker range is returned. Otherwise, if the marker is\n * intersecting with the element, the intersection is returned.\n */\nfunction _getMarkersRelativeToElement(element) {\n    const result = [];\n    const doc = element.root.document;\n    if (!doc) {\n        return new Map();\n    }\n    const elementRange = ModelRange._createIn(element);\n    for (const marker of doc.model.markers) {\n        const markerRange = marker.getRange();\n        const isMarkerCollapsed = markerRange.isCollapsed;\n        const isMarkerAtElementBoundary = markerRange.start.isEqual(elementRange.start) || markerRange.end.isEqual(elementRange.end);\n        if (isMarkerCollapsed && isMarkerAtElementBoundary) {\n            result.push([marker.name, markerRange]);\n        }\n        else {\n            const updatedMarkerRange = elementRange.getIntersection(markerRange);\n            if (updatedMarkerRange) {\n                result.push([marker.name, updatedMarkerRange]);\n            }\n        }\n    }\n    // Sort the markers in a stable fashion to ensure that the order in which they are\n    // added to the model's marker collection does not affect how they are\n    // downcast. One particular use case that we are targeting here, is one where\n    // two markers are adjacent but not overlapping, such as an insertion/deletion\n    // suggestion pair representing the replacement of a range of text. In this\n    // case, putting the markers in DOM order causes the first marker's end to be\n    // serialized right after the second marker's start, while putting the markers\n    // in reverse DOM order causes it to be right before the second marker's\n    // start. So, we sort these in a way that ensures non-intersecting ranges are in\n    // reverse DOM order, and intersecting ranges are in something approximating\n    // reverse DOM order (since reverse DOM order doesn't have a precise meaning\n    // when working with intersecting ranges).\n    result.sort(([n1, r1], [n2, r2]) => {\n        if (r1.end.compareWith(r2.start) !== 'after') {\n            // m1.end <= m2.start -- m1 is entirely <= m2\n            return 1;\n        }\n        else if (r1.start.compareWith(r2.end) !== 'before') {\n            // m1.start >= m2.end -- m1 is entirely >= m2\n            return -1;\n        }\n        else {\n            // they overlap, so use their start positions as the primary sort key and\n            // end positions as the secondary sort key\n            switch (r1.start.compareWith(r2.start)) {\n                case 'before':\n                    return 1;\n                case 'after':\n                    return -1;\n                default:\n                    switch (r1.end.compareWith(r2.end)) {\n                        case 'before':\n                            return 1;\n                        case 'after':\n                            return -1;\n                        default:\n                            return n2.localeCompare(n1);\n                    }\n            }\n        }\n    });\n    return new Map(result);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/conversion/conversion\n */\nimport { CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';\nimport { UpcastHelpers } from './upcasthelpers.js';\nimport { DowncastHelpers } from './downcasthelpers.js';\n/**\n * A utility class that helps add converters to upcast and downcast dispatchers.\n *\n * We recommend reading the {@glink framework/deep-dive/conversion/intro editor conversion} guide first to\n * understand the core concepts of the conversion mechanisms.\n *\n * An instance of the conversion manager is available in the\n * {@link module:core/editor/editor~Editor#conversion `editor.conversion`} property\n * and by default has the following groups of dispatchers (i.e. directions of conversion):\n *\n * * `downcast` (editing and data downcasts)\n * * `editingDowncast`\n * * `dataDowncast`\n * * `upcast`\n *\n * # One-way converters\n *\n * To add a converter to a specific group, use the {@link module:engine/conversion/conversion~Conversion#for `for()`}\n * method:\n *\n * ```ts\n * // Add a converter to editing downcast and data downcast.\n * editor.conversion.for( 'downcast' ).elementToElement( config ) );\n *\n * // Add a converter to the data pipepline only:\n * editor.conversion.for( 'dataDowncast' ).elementToElement( dataConversionConfig ) );\n *\n * // And a slightly different one for the editing pipeline:\n * editor.conversion.for( 'editingDowncast' ).elementToElement( editingConversionConfig ) );\n * ```\n *\n * See {@link module:engine/conversion/conversion~Conversion#for `for()`} method documentation to learn more about\n * available conversion helpers and how to use your custom ones.\n *\n * # Two-way converters\n *\n * Besides using one-way converters via the `for()` method, you can also use other methods available in this\n * class to add two-way converters (upcast and downcast):\n *\n * * {@link module:engine/conversion/conversion~Conversion#elementToElement `elementToElement()`} &ndash;\n * Model element to view element and vice versa.\n * * {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement()`} &ndash;\n * Model attribute to view element and vice versa.\n * * {@link module:engine/conversion/conversion~Conversion#attributeToAttribute `attributeToAttribute()`} &ndash;\n * Model attribute to view attribute and vice versa.\n */\nexport class Conversion {\n    /**\n     * Maps dispatchers group name to ConversionHelpers instances.\n     */\n    _helpers = new Map();\n    _downcast;\n    _upcast;\n    /**\n     * Creates a new conversion instance.\n     */\n    constructor(downcastDispatchers, upcastDispatchers) {\n        // Define default 'downcast' & 'upcast' dispatchers groups. Those groups are always available as two-way converters needs them.\n        this._downcast = toArray(downcastDispatchers);\n        this._createConversionHelpers({ name: 'downcast', dispatchers: this._downcast, isDowncast: true });\n        this._upcast = toArray(upcastDispatchers);\n        this._createConversionHelpers({ name: 'upcast', dispatchers: this._upcast, isDowncast: false });\n    }\n    /**\n     * Define an alias for registered dispatcher.\n     *\n     * ```ts\n     * const conversion = new Conversion(\n     * \t[ dataDowncastDispatcher, editingDowncastDispatcher ],\n     * \tupcastDispatcher\n     * );\n     *\n     * conversion.addAlias( 'dataDowncast', dataDowncastDispatcher );\n     * ```\n     *\n     * @param alias An alias of a dispatcher.\n     * @param dispatcher Dispatcher which should have an alias.\n     */\n    addAlias(alias, dispatcher) {\n        const isDowncast = this._downcast.includes(dispatcher);\n        const isUpcast = this._upcast.includes(dispatcher);\n        if (!isUpcast && !isDowncast) {\n            /**\n             * Trying to register an alias for a dispatcher that nas not been registered.\n             *\n             * @error conversion-add-alias-dispatcher-not-registered\n             */\n            throw new CKEditorError('conversion-add-alias-dispatcher-not-registered', this);\n        }\n        this._createConversionHelpers({ name: alias, dispatchers: [dispatcher], isDowncast });\n    }\n    /**\n     * Provides a chainable API to assign converters to a conversion dispatchers group.\n     *\n     * If the given group name has not been registered, the\n     * {@link module:utils/ckeditorerror~CKEditorError `conversion-for-unknown-group` error} is thrown.\n     *\n     * You can use conversion helpers available directly in the `for()` chain or your custom ones via\n     * the {@link module:engine/conversion/conversionhelpers~ConversionHelpers#add `add()`} method.\n     *\n     * # Using built-in conversion helpers\n     *\n     * The `for()` chain comes with a set of conversion helpers which you can use like this:\n     *\n     * ```ts\n     * editor.conversion.for( 'downcast' )\n     * \t.elementToElement( config1 )        // Adds an element-to-element downcast converter.\n     * \t.attributeToElement( config2 );     // Adds an attribute-to-element downcast converter.\n     *\n     * editor.conversion.for( 'upcast' )\n     * \t.elementToAttribute( config3 );     // Adds an element-to-attribute upcast converter.\n     * ```\n     *\n     * Refer to the documentation of built-in conversion helpers to learn about their configuration options.\n     *\n     * * downcast (model-to-view) conversion helpers:\n     *\n     *\t* {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToElement `elementToElement()`},\n     *\t* {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement `attributeToElement()`},\n     *\t* {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToAttribute `attributeToAttribute()`}.\n     *\t* {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToElement `markerToElement()`}.\n     *\t* {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToHighlight `markerToHighlight()`}.\n     *\n     * * upcast (view-to-model) conversion helpers:\n     *\n     *\t* {@link module:engine/conversion/upcasthelpers~UpcastHelpers#elementToElement `elementToElement()`},\n     *\t* {@link module:engine/conversion/upcasthelpers~UpcastHelpers#elementToAttribute `elementToAttribute()`},\n     *\t* {@link module:engine/conversion/upcasthelpers~UpcastHelpers#attributeToAttribute `attributeToAttribute()`}.\n     *\t* {@link module:engine/conversion/upcasthelpers~UpcastHelpers#elementToMarker `elementToMarker()`}.\n     *\n     * # Using custom conversion helpers\n     *\n     * If you need to implement an atypical converter, you can do so by calling:\n     *\n     * ```ts\n     * editor.conversion.for( direction ).add( customHelper );\n     * ```\n     *\n     * The `.add()` method takes exactly one parameter, which is a function. This function should accept one parameter that\n     * is a dispatcher instance. The function should add an actual converter to the passed dispatcher instance.\n     *\n     * Example:\n     *\n     * ```ts\n     * editor.conversion.for( 'upcast' ).add( dispatcher => {\n     * \tdispatcher.on( 'element:a',  ( evt, data, conversionApi ) => {\n     * \t\t// Do something with a view <a> element.\n     * \t} );\n     * } );\n     * ```\n     *\n     * Refer to the documentation of {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher}\n     * and {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} to learn how to write\n     * custom converters.\n     *\n     * @param groupName The name of dispatchers group to add the converters to.\n     */\n    for(groupName) {\n        if (!this._helpers.has(groupName)) {\n            /**\n             * Trying to add a converter to an unknown dispatchers group.\n             *\n             * @error conversion-for-unknown-group\n             */\n            throw new CKEditorError('conversion-for-unknown-group', this);\n        }\n        return this._helpers.get(groupName);\n    }\n    /**\n     * Sets up converters between the model and the view that convert a model element to a view element (and vice versa).\n     * For example, the model `<paragraph>Foo</paragraph>` is turned into `<p>Foo</p>` in the view.\n     *\n     * ```ts\n     * // A simple conversion from the `paragraph` model element to the `<p>` view element (and vice versa).\n     * editor.conversion.elementToElement( { model: 'paragraph', view: 'p' } );\n     *\n     * // Override other converters by specifying a converter definition with a higher priority.\n     * editor.conversion.elementToElement( { model: 'paragraph', view: 'div', converterPriority: 'high' } );\n     *\n     * // View specified as an object instead of a string.\n     * editor.conversion.elementToElement( {\n     * \tmodel: 'fancyParagraph',\n     * \tview: {\n     * \t\tname: 'p',\n     * \t\tclasses: 'fancy'\n     * \t}\n     * } );\n     *\n     * // Use `upcastAlso` to define other view elements that should also be converted to a `paragraph` element.\n     * editor.conversion.elementToElement( {\n     * \tmodel: 'paragraph',\n     * \tview: 'p',\n     * \tupcastAlso: [\n     * \t\t'div',\n     * \t\t{\n     * \t\t\t// Any element with the `display: block` style.\n     * \t\t\tstyles: {\n     * \t\t\t\tdisplay: 'block'\n     * \t\t\t}\n     * \t\t}\n     * \t]\n     * } );\n     *\n     * // `upcastAlso` set as callback enables a conversion of a wide range of different view elements.\n     * editor.conversion.elementToElement( {\n     * \tmodel: 'heading',\n     * \tview: 'h2',\n     * \t// Convert \"heading-like\" paragraphs to headings.\n     * \tupcastAlso: viewElement => {\n     * \t\tconst fontSize = viewElement.getStyle( 'font-size' );\n     *\n     * \t\tif ( !fontSize ) {\n     * \t\t\treturn null;\n     * \t\t}\n     *\n     * \t\tconst match = fontSize.match( /(\\d+)\\s*px/ );\n     *\n     * \t\tif ( !match ) {\n     * \t\t\treturn null;\n     * \t\t}\n     *\n     * \t\tconst size = Number( match[ 1 ] );\n     *\n     * \t\tif ( size > 26 ) {\n     * \t\t\t// Returned value can be an object with the matched properties.\n     * \t\t\t// These properties will be \"consumed\" during the conversion.\n     * \t\t\t// See `engine.view.Matcher~MatcherPattern` and `engine.view.Matcher#match` for more details.\n     *\n     * \t\t\treturn { name: true, styles: [ 'font-size' ] };\n     * \t\t}\n     *\n     * \t\treturn null;\n     * \t}\n     * } );\n     * ```\n     *\n     * `definition.model` is a `String` with a model element name to convert from or to.\n     *\n     * @param definition The converter definition.\n     */\n    elementToElement(definition) {\n        // Set up downcast converter.\n        this.for('downcast').elementToElement(definition);\n        // Set up upcast converter.\n        for (const { model, view } of _getAllUpcastDefinitions(definition)) {\n            this.for('upcast')\n                .elementToElement({\n                model,\n                view,\n                converterPriority: definition.converterPriority\n            });\n        }\n    }\n    /**\n     * Sets up converters between the model and the view that convert a model attribute to a view element (and vice versa).\n     * For example, a model text node with `\"Foo\"` as data and the `bold` attribute will be turned to `<strong>Foo</strong>` in the view.\n     *\n     * ```ts\n     * // A simple conversion from the `bold=true` attribute to the `<strong>` view element (and vice versa).\n     * editor.conversion.attributeToElement( { model: 'bold', view: 'strong' } );\n     *\n     * // Override other converters by specifying a converter definition with a higher priority.\n     * editor.conversion.attributeToElement( { model: 'bold', view: 'b', converterPriority: 'high' } );\n     *\n     * // View specified as an object instead of a string.\n     * editor.conversion.attributeToElement( {\n     * \tmodel: 'bold',\n     * \tview: {\n     * \t\tname: 'span',\n     * \t\tclasses: 'bold'\n     * \t}\n     * } );\n     *\n     * // Use `config.model.name` to define the conversion only from a given node type, `$text` in this case.\n     * // The same attribute on different elements may then be handled by a different converter.\n     * editor.conversion.attributeToElement( {\n     * \tmodel: {\n     * \t\tkey: 'textDecoration',\n     * \t\tvalues: [ 'underline', 'lineThrough' ],\n     * \t\tname: '$text'\n     * \t},\n     * \tview: {\n     * \t\tunderline: {\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'text-decoration': 'underline'\n     * \t\t\t}\n     * \t\t},\n     * \t\tlineThrough: {\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'text-decoration': 'line-through'\n     * \t\t\t}\n     * \t\t}\n     * \t}\n     * } );\n     *\n     * // Use `upcastAlso` to define other view elements that should also be converted to the `bold` attribute.\n     * editor.conversion.attributeToElement( {\n     * \tmodel: 'bold',\n     * \tview: 'strong',\n     * \tupcastAlso: [\n     * \t\t'b',\n     * \t\t{\n     * \t\t\tname: 'span',\n     * \t\t\tclasses: 'bold'\n     * \t\t},\n     * \t\t{\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'font-weight': 'bold'\n     * \t\t\t}\n     * \t\t},\n     * \t\tviewElement => {\n     * \t\t\tconst fontWeight = viewElement.getStyle( 'font-weight' );\n     *\n     * \t\t\tif ( viewElement.is( 'element', 'span' ) && fontWeight && /\\d+/.test() && Number( fontWeight ) > 500 ) {\n     * \t\t\t\t// Returned value can be an object with the matched properties.\n     * \t\t\t\t// These properties will be \"consumed\" during the conversion.\n     * \t\t\t\t// See `engine.view.Matcher~MatcherPattern` and `engine.view.Matcher#match` for more details.\n     *\n     * \t\t\t\treturn {\n     * \t\t\t\t\tname: true,\n     * \t\t\t\t\tstyles: [ 'font-weight' ]\n     * \t\t\t\t};\n     * \t\t\t}\n     * \t\t}\n     * \t]\n     * } );\n     *\n     * // Conversion from and to a model attribute key whose value is an enum (`fontSize=big|small`).\n     * // `upcastAlso` set as callback enables a conversion of a wide range of different view elements.\n     * editor.conversion.attributeToElement( {\n     * \tmodel: {\n     * \t\tkey: 'fontSize',\n     * \t\tvalues: [ 'big', 'small' ]\n     * \t},\n     * \tview: {\n     * \t\tbig: {\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'font-size': '1.2em'\n     * \t\t\t}\n     * \t\t},\n     * \t\tsmall: {\n     * \t\t\tname: 'span',\n     * \t\t\tstyles: {\n     * \t\t\t\t'font-size': '0.8em'\n     * \t\t\t}\n     * \t\t}\n     * \t},\n     * \tupcastAlso: {\n     * \t\tbig: viewElement => {\n     * \t\t\tconst fontSize = viewElement.getStyle( 'font-size' );\n     *\n     * \t\t\tif ( !fontSize ) {\n     * \t\t\t\treturn null;\n     * \t\t\t}\n     *\n     * \t\t\tconst match = fontSize.match( /(\\d+)\\s*px/ );\n     *\n     * \t\t\tif ( !match ) {\n     * \t\t\t\treturn null;\n     * \t\t\t}\n     *\n     * \t\t\tconst size = Number( match[ 1 ] );\n     *\n     * \t\t\tif ( viewElement.is( 'element', 'span' ) && size > 10 ) {\n     * \t\t\t\t// Returned value can be an object with the matched properties.\n     * \t\t\t\t// These properties will be \"consumed\" during the conversion.\n     * \t\t\t\t// See `engine.view.Matcher~MatcherPattern` and `engine.view.Matcher#match` for more details.\n     *\n     * \t\t\t\treturn { name: true, styles: [ 'font-size' ] };\n     * \t\t\t}\n     *\n     * \t\t\treturn null;\n     * \t\t},\n     * \t\tsmall: viewElement => {\n     * \t\t\tconst fontSize = viewElement.getStyle( 'font-size' );\n     *\n     * \t\t\tif ( !fontSize ) {\n     * \t\t\t\treturn null;\n     * \t\t\t}\n     *\n     * \t\t\tconst match = fontSize.match( /(\\d+)\\s*px/ );\n     *\n     * \t\t\tif ( !match ) {\n     * \t\t\t\treturn null;\n     * \t\t\t}\n     *\n     * \t\t\tconst size = Number( match[ 1 ] );\n     *\n     * \t\t\tif ( viewElement.is( 'element', 'span' ) && size < 10 ) {\n     * \t\t\t\t// Returned value can be an object with the matched properties.\n     * \t\t\t\t// These properties will be \"consumed\" during the conversion.\n     * \t\t\t\t// See `engine.view.Matcher~MatcherPattern` and `engine.view.Matcher#match` for more details.\n     *\n     * \t\t\t\treturn { name: true, styles: [ 'font-size' ] };\n     * \t\t\t}\n     *\n     * \t\t\treturn null;\n     * \t\t}\n     * \t}\n     * } );\n     * ```\n     *\n     * The `definition.model` parameter specifies which model attribute should be converted from or to. It can be a `{ key, value }` object\n     * describing the attribute key and value to convert or a `String` specifying just the attribute key (in such a case\n     * `value` is set to `true`).\n     *\n     * @param definition The converter definition.\n     */\n    attributeToElement(definition) {\n        // Set up downcast converter.\n        this.for('downcast').attributeToElement(definition);\n        // Set up upcast converter.\n        for (const { model, view } of _getAllUpcastDefinitions(definition)) {\n            this.for('upcast')\n                .elementToAttribute({\n                view,\n                model,\n                converterPriority: definition.converterPriority\n            });\n        }\n    }\n    /**\n     * Sets up converters between the model and the view that convert a model attribute to a view attribute (and vice versa). For example,\n     * `<imageBlock src='foo.jpg'></imageBlock>` is converted to `<img src='foo.jpg'></img>` (the same attribute key and value).\n     * This type of converters is intended to be used with {@link module:engine/model/element~ModelElement model element} nodes.\n     * To convert the text attributes,\n     * the {@link module:engine/conversion/conversion~Conversion#attributeToElement `attributeToElement converter`}should be set up.\n     *\n     * ```ts\n     * // A simple conversion from the `source` model attribute to the `src` view attribute (and vice versa).\n     * editor.conversion.attributeToAttribute( { model: 'source', view: 'src' } );\n     *\n     * // Attribute values are strictly specified.\n     * editor.conversion.attributeToAttribute( {\n     * \tmodel: {\n     * \t\tname: 'imageInline',\n     * \t\tkey: 'aside',\n     * \t\tvalues: [ 'aside' ]\n     * \t},\n     * \tview: {\n     * \t\taside: {\n     * \t\t\tname: 'img',\n     * \t\t\tkey: 'class',\n     * \t\t\tvalue: [ 'aside', 'half-size' ]\n     * \t\t}\n     * \t}\n     * } );\n     *\n     * // Set the style attribute.\n     * editor.conversion.attributeToAttribute( {\n     * \tmodel: {\n     * \t\tname: 'imageInline',\n     * \t\tkey: 'aside',\n     * \t\tvalues: [ 'aside' ]\n     * \t},\n     * \tview: {\n     * \t\taside: {\n     * \t\t\tname: 'img',\n     * \t\t\tkey: 'style',\n     * \t\t\tvalue: {\n     * \t\t\t\tfloat: 'right',\n     * \t\t\t\twidth: '50%',\n     * \t\t\t\tmargin: '5px'\n     * \t\t\t}\n     * \t\t}\n     * \t}\n     * } );\n     *\n     * // Conversion from and to a model attribute key whose value is an enum (`align=right|center`).\n     * // Use `upcastAlso` to define other view elements that should also be converted to the `align=right` attribute.\n     * editor.conversion.attributeToAttribute( {\n     * \tmodel: {\n     * \t\tkey: 'align',\n     * \t\tvalues: [ 'right', 'center' ]\n     * \t},\n     * \tview: {\n     * \t\tright: {\n     * \t\t\tkey: 'class',\n     * \t\t\tvalue: 'align-right'\n     * \t\t},\n     * \t\tcenter: {\n     * \t\t\tkey: 'class',\n     * \t\t\tvalue: 'align-center'\n     * \t\t}\n     * \t},\n     * \tupcastAlso: {\n     * \t\tright: {\n     * \t\t\tstyles: {\n     * \t\t\t\t'text-align': 'right'\n     * \t\t\t}\n     * \t\t},\n     * \t\tcenter: {\n     * \t\t\tstyles: {\n     * \t\t\t\t'text-align': 'center'\n     * \t\t\t}\n     * \t\t}\n     * \t}\n     * } );\n     * ```\n     *\n     * The `definition.model` parameter specifies which model attribute should be converted from and to.\n     * It can be a `{ key, [ values ], [ name ] }` object or a `String`, which will be treated like `{ key: definition.model }`.\n     * The `key` property is the model attribute key to convert from and to.\n     * The `values` are the possible model attribute values. If the `values` parameter is not set, the model attribute value\n     * will be the same as the view attribute value.\n     * If `name` is set, the conversion will be set up only for model elements with the given name.\n     *\n     * The `definition.view` parameter specifies which view attribute should be converted from and to.\n     * It can be a `{ key, value, [ name ] }` object or a `String`, which will be treated like `{ key: definition.view }`.\n     * The `key` property is the view attribute key to convert from and to.\n     * The `value` is the view attribute value to convert from and to. If `definition.value` is not set, the view attribute value will be\n     * the same as the model attribute value.\n     * If `key` is `'class'`, `value` can be a `String` or an array of `String`s.\n     * If `key` is `'style'`, `value` is an object with key-value pairs.\n     * In other cases, `value` is a `String`.\n     * If `name` is set, the conversion will be set up only for model elements with the given name.\n     * If `definition.model.values` is set, `definition.view` is an object that assigns values from `definition.model.values`\n     * to `{ key, value, [ name ] }` objects.\n     *\n     * `definition.upcastAlso` specifies which other matching view elements should also be upcast to the given model configuration.\n     * If `definition.model.values` is set, `definition.upcastAlso` should be an object assigning values from `definition.model.values`\n     * to {@link module:engine/view/matcher~MatcherPattern}s or arrays of {@link module:engine/view/matcher~MatcherPattern}s.\n     *\n     * **Note:** `definition.model` and `definition.view` form should be mirrored, so the same types of parameters should\n     * be given in both parameters.\n     *\n     * @param definition The converter definition.\n     * @param definition.model The model attribute to convert from and to.\n     * @param definition.view The view attribute to convert from and to.\n     * @param definition.upcastAlso Any view element matching `definition.upcastAlso` will also be converted to the given model attribute.\n     * `definition.upcastAlso` is used only if `config.model.values` is specified.\n     */\n    attributeToAttribute(definition) {\n        // Set up downcast converter.\n        this.for('downcast').attributeToAttribute(definition);\n        // Set up upcast converter.\n        for (const { model, view } of _getAllUpcastDefinitions(definition)) {\n            this.for('upcast')\n                .attributeToAttribute({\n                view,\n                model\n            });\n        }\n    }\n    /**\n     * Creates and caches conversion helpers for given dispatchers group.\n     *\n     * @param options Group name.\n     * @param options.name Group name.\n     * @param options.dispatchers Dispatchers to register.\n     * @param options.isDowncast Whether downcast group.\n     */\n    _createConversionHelpers({ name, dispatchers, isDowncast }) {\n        if (this._helpers.has(name)) {\n            /**\n             * Trying to register a group name that has already been registered.\n             *\n             * @error conversion-group-exists\n             */\n            throw new CKEditorError('conversion-group-exists', this);\n        }\n        const helpers = isDowncast ?\n            new DowncastHelpers(dispatchers) :\n            new UpcastHelpers(dispatchers);\n        this._helpers.set(name, helpers);\n    }\n}\n/**\n * Helper function that creates a joint array out of an item passed in `definition.view` and items passed in\n * `definition.upcastAlso`.\n */\nfunction* _getAllUpcastDefinitions(definition) {\n    if (definition.model.values) {\n        for (const value of definition.model.values) {\n            const model = { key: definition.model.key, value };\n            const view = definition.view[value];\n            const upcastAlso = definition.upcastAlso ? definition.upcastAlso[value] : undefined;\n            yield* _getUpcastDefinition(model, view, upcastAlso);\n        }\n    }\n    else {\n        yield* _getUpcastDefinition(definition.model, definition.view, definition.upcastAlso);\n    }\n}\nfunction* _getUpcastDefinition(model, view, upcastAlso) {\n    yield { model, view };\n    if (upcastAlso) {\n        for (const upcastAlsoItem of toArray(upcastAlso)) {\n            yield { model, view: upcastAlsoItem };\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Abstract base operation class.\n */\nexport class Operation {\n    /**\n     * {@link module:engine/model/document~ModelDocument#version} on which operation can be applied. If you try to\n     * {@link module:engine/model/model~Model#applyOperation apply} operation with different base version than the\n     * {@link module:engine/model/document~ModelDocument#version document version} the\n     * {@link module:utils/ckeditorerror~CKEditorError model-document-applyOperation-wrong-version} error is thrown.\n     */\n    baseVersion;\n    /**\n     * Defines whether operation is executed on attached or detached {@link module:engine/model/item~ModelItem items}.\n     */\n    isDocumentOperation;\n    /**\n     * {@link module:engine/model/batch~Batch Batch} to which the operation is added or `null` if the operation is not\n     * added to any batch yet.\n     *\n     * Note, that a {@link #isDocumentOperation non-document operation} has this property always set to `null`, and is never added\n     * to any batch.\n     */\n    batch;\n    /**\n     * Base operation constructor.\n     *\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(baseVersion) {\n        this.baseVersion = baseVersion;\n        this.isDocumentOperation = this.baseVersion !== null;\n        this.batch = null;\n    }\n    /**\n     * Checks whether the operation's parameters are correct and the operation can be correctly executed. Throws\n     * an error if operation is not valid.\n     *\n     * @internal\n     */\n    _validate() {\n    }\n    /**\n     * Custom toJSON method to solve child-parent circular dependencies.\n     *\n     * @returns Clone of this object with the operation property replaced with string.\n     */\n    toJSON() {\n        // This method creates only a shallow copy, all nested objects should be defined separately.\n        // See https://github.com/ckeditor/ckeditor5-engine/issues/1477.\n        const json = Object.assign({}, this);\n        json.__className = this.constructor.className;\n        // Remove reference to the parent `Batch` to avoid circular dependencies.\n        delete json.batch;\n        // This can be derived from `baseVersion` so we can remove it.\n        delete json.isDocumentOperation;\n        return json;\n    }\n    /**\n     * Name of the operation class used for serialization.\n     */\n    static get className() {\n        return 'Operation';\n    }\n    /**\n     * Creates `Operation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        return new this(json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/utils\n */\nimport { ModelNode } from '../node.js';\nimport { ModelRange } from '../range.js';\nimport { ModelText } from '../text.js';\nimport { ModelTextProxy } from '../textproxy.js';\nimport { CKEditorError, isIterable } from '@ckeditor/ckeditor5-utils';\n/**\n * Inserts given nodes at given position.\n *\n * @internal\n * @param position Position at which nodes should be inserted.\n * @param nodes Nodes to insert.\n * @returns Range spanning over inserted elements.\n */\nexport function _insert(position, nodes) {\n    const normalizedNodes = _normalizeNodes(nodes);\n    // We have to count offset before inserting nodes because they can get merged and we would get wrong offsets.\n    const offset = normalizedNodes.reduce((sum, node) => sum + node.offsetSize, 0);\n    const parent = position.parent;\n    // Insertion might be in a text node, we should split it if that's the case.\n    _splitNodeAtPosition(position);\n    const index = position.index;\n    // Insert nodes at given index. After splitting we have a proper index and insertion is between nodes,\n    // using basic `Element` API.\n    parent._insertChild(index, normalizedNodes);\n    // Merge text nodes, if possible. Merging is needed only at points where inserted nodes \"touch\" \"old\" nodes.\n    _mergeNodesAtIndex(parent, index + normalizedNodes.length);\n    _mergeNodesAtIndex(parent, index);\n    return new ModelRange(position, position.getShiftedBy(offset));\n}\n/**\n * Removed nodes in given range. Only {@link module:engine/model/range~ModelRange#isFlat flat} ranges are accepted.\n *\n * @internal\n * @param range Range containing nodes to remove.\n */\nexport function _remove(range) {\n    if (!range.isFlat) {\n        /**\n         * Trying to remove a range which starts and ends in different element.\n         *\n         * @error operation-utils-remove-range-not-flat\n         */\n        throw new CKEditorError('operation-utils-remove-range-not-flat', this);\n    }\n    const parent = range.start.parent;\n    // Range may be inside text nodes, we have to split them if that's the case.\n    _splitNodeAtPosition(range.start);\n    _splitNodeAtPosition(range.end);\n    // Remove the text nodes using basic `Element` API.\n    const removed = parent._removeChildren(range.start.index, range.end.index - range.start.index);\n    // Merge text nodes, if possible. After some nodes were removed, node before and after removed range will be\n    // touching at the position equal to the removed range beginning. We check merging possibility there.\n    _mergeNodesAtIndex(parent, range.start.index);\n    return removed;\n}\n/**\n * Moves nodes in given range to given target position. Only {@link module:engine/model/range~ModelRange#isFlat flat} ranges are accepted.\n *\n * @internal\n * @param sourceRange Range containing nodes to move.\n * @param targetPosition Position to which nodes should be moved.\n * @returns Range containing moved nodes.\n */\nexport function _move(sourceRange, targetPosition) {\n    if (!sourceRange.isFlat) {\n        /**\n         * Trying to move a range which starts and ends in different element.\n         *\n         * @error operation-utils-move-range-not-flat\n         */\n        throw new CKEditorError('operation-utils-move-range-not-flat', this);\n    }\n    const nodes = _remove(sourceRange);\n    // We have to fix `targetPosition` because model changed after nodes from `sourceRange` got removed and\n    // that change might have an impact on `targetPosition`.\n    targetPosition = targetPosition._getTransformedByDeletion(sourceRange.start, sourceRange.end.offset - sourceRange.start.offset);\n    return _insert(targetPosition, nodes);\n}\n/**\n * Sets given attribute on nodes in given range. The attributes are only set on top-level nodes of the range, not on its children.\n *\n * @internal\n * @param range Range containing nodes that should have the attribute set. Must be a flat range.\n * @param key Key of attribute to set.\n * @param value Attribute value.\n */\nexport function _setAttribute(range, key, value) {\n    // Range might start or end in text nodes, so we have to split them.\n    _splitNodeAtPosition(range.start);\n    _splitNodeAtPosition(range.end);\n    // Iterate over all items in the range.\n    for (const item of range.getItems({ shallow: true })) {\n        // Iterator will return `ModelTextProxy` instances but we know that those text proxies will\n        // always represent full text nodes (this is guaranteed thanks to splitting we did before).\n        // So, we can operate on those text proxies' text nodes.\n        const node = item.is('$textProxy') ? item.textNode : item;\n        if (value !== null) {\n            node._setAttribute(key, value);\n        }\n        else {\n            node._removeAttribute(key);\n        }\n        // After attributes changing it may happen that some text nodes can be merged. Try to merge with previous node.\n        _mergeNodesAtIndex(node.parent, node.index);\n    }\n    // Try to merge last changed node with it's previous sibling (not covered by the loop above).\n    _mergeNodesAtIndex(range.end.parent, range.end.index);\n}\n/**\n * Normalizes given object or an array of objects to an array of {@link module:engine/model/node~ModelNode nodes}. See\n * {@link ~ModelNodeSet NodeSet} for details on how normalization is performed.\n *\n * @internal\n * @param nodes Objects to normalize.\n * @returns Normalized nodes.\n */\nexport function _normalizeNodes(nodes) {\n    const normalized = [];\n    function convert(nodes) {\n        if (typeof nodes == 'string') {\n            normalized.push(new ModelText(nodes));\n        }\n        else if (nodes instanceof ModelTextProxy) {\n            normalized.push(new ModelText(nodes.data, nodes.getAttributes()));\n        }\n        else if (nodes instanceof ModelNode) {\n            normalized.push(nodes);\n        }\n        else if (isIterable(nodes)) {\n            for (const node of nodes) {\n                convert(node);\n            }\n        }\n        else {\n            // Skip unrecognized type.\n            // eslint-disable-next-line @typescript-eslint/no-unused-vars\n            const unreachable = nodes;\n        }\n    }\n    convert(nodes);\n    // Merge text nodes.\n    for (let i = 1; i < normalized.length; i++) {\n        const node = normalized[i];\n        const prev = normalized[i - 1];\n        if (node instanceof ModelText && prev instanceof ModelText && _haveSameAttributes(node, prev)) {\n            // Doing this instead changing `prev.data` because `data` is readonly.\n            normalized.splice(i - 1, 2, new ModelText(prev.data + node.data, prev.getAttributes()));\n            i--;\n        }\n    }\n    return normalized;\n}\n/**\n * Checks if nodes before and after given index in given element are {@link module:engine/model/text~ModelText text nodes} and\n * merges them into one node if they have same attributes.\n *\n * Merging is done by removing two text nodes and inserting a new text node containing data from both merged text nodes.\n *\n * @param element Parent element of nodes to merge.\n * @param index Index between nodes to merge.\n */\nfunction _mergeNodesAtIndex(element, index) {\n    const nodeBefore = element.getChild(index - 1);\n    const nodeAfter = element.getChild(index);\n    // Check if both of those nodes are text objects with same attributes.\n    if (nodeBefore && nodeAfter && nodeBefore.is('$text') && nodeAfter.is('$text') && _haveSameAttributes(nodeBefore, nodeAfter)) {\n        // Append text of text node after index to the before one.\n        const mergedNode = new ModelText(nodeBefore.data + nodeAfter.data, nodeBefore.getAttributes());\n        // Remove separate text nodes.\n        element._removeChildren(index - 1, 2);\n        // Insert merged text node.\n        element._insertChild(index - 1, mergedNode);\n    }\n}\n/**\n * Checks if given position is in a text node, and if so, splits the text node in two text nodes, each of them\n * containing a part of original text node.\n *\n * @param position Position at which node should be split.\n */\nfunction _splitNodeAtPosition(position) {\n    const textNode = position.textNode;\n    const element = position.parent;\n    if (textNode) {\n        const offsetDiff = position.offset - textNode.startOffset;\n        const index = textNode.index;\n        element._removeChildren(index, 1);\n        const firstPart = new ModelText(textNode.data.substr(0, offsetDiff), textNode.getAttributes());\n        const secondPart = new ModelText(textNode.data.substr(offsetDiff), textNode.getAttributes());\n        element._insertChild(index, [firstPart, secondPart]);\n    }\n}\n/**\n * Checks whether two given nodes have same attributes.\n *\n * @param nodeA Node to check.\n * @param nodeB Node to check.\n * @returns `true` if nodes have same attributes, `false` otherwise.\n */\nfunction _haveSameAttributes(nodeA, nodeB) {\n    const iteratorA = nodeA.getAttributes();\n    const iteratorB = nodeB.getAttributes();\n    for (const attr of iteratorA) {\n        if (attr[1] !== nodeB.getAttribute(attr[0])) {\n            return false;\n        }\n        iteratorB.next();\n    }\n    return iteratorB.next().done;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/moveoperation\n */\nimport { Operation } from './operation.js';\nimport { ModelPosition } from '../position.js';\nimport { ModelRange } from '../range.js';\nimport { _move } from './utils.js';\nimport { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const ModelRange = require( '../range' ).default;\n/**\n * Operation to move a range of {@link module:engine/model/item~ModelItem model items}\n * to given {@link module:engine/model/position~ModelPosition target position}.\n */\nexport class MoveOperation extends Operation {\n    /**\n     * Position before the first {@link module:engine/model/item~ModelItem model item} to move.\n     */\n    sourcePosition;\n    /**\n     * Offset size of moved range.\n     */\n    howMany;\n    /**\n     * Position at which moved nodes will be inserted.\n     */\n    targetPosition;\n    /**\n     * Creates a move operation.\n     *\n     * @param sourcePosition Position before the first {@link module:engine/model/item~ModelItem model item} to move.\n     * @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at\n     * `sourcePosition` with offset shifted by `howMany`.\n     * @param targetPosition Position at which moved nodes will be inserted.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(sourcePosition, howMany, targetPosition, baseVersion) {\n        super(baseVersion);\n        this.sourcePosition = sourcePosition.clone();\n        // `'toNext'` because `sourcePosition` is a bit like a start of the moved range.\n        this.sourcePosition.stickiness = 'toNext';\n        this.howMany = howMany;\n        this.targetPosition = targetPosition.clone();\n        this.targetPosition.stickiness = 'toNone';\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        if (this.targetPosition.root.rootName == this.sourcePosition.root.rootName) {\n            return 'move';\n        }\n        else if (this.targetPosition.root.rootName == '$graveyard') {\n            return 'remove';\n        }\n        else if (this.sourcePosition.root.rootName == '$graveyard') {\n            return 'reinsert';\n        }\n        return 'move';\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return [\n            ModelRange._createFromPositionAndShift(this.sourcePosition, this.howMany),\n            ModelRange._createFromPositionAndShift(this.targetPosition, 0)\n        ];\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     */\n    clone() {\n        return new MoveOperation(this.sourcePosition, this.howMany, this.targetPosition, this.baseVersion);\n    }\n    /**\n     * Returns the start position of the moved range after it got moved. This may be different than\n     * {@link module:engine/model/operation/moveoperation~MoveOperation#targetPosition} in some cases, i.e. when a range is moved\n     * inside the same parent but {@link module:engine/model/operation/moveoperation~MoveOperation#targetPosition targetPosition}\n     * is after {@link module:engine/model/operation/moveoperation~MoveOperation#sourcePosition sourcePosition}.\n     *\n     * ```\n     *  vv              vv\n     * abcdefg ===> adefbcg\n     *      ^          ^\n     *      targetPos  movedRangeStart\n     *      offset 6   offset 4\n     *```\n     */\n    getMovedRangeStart() {\n        return this.targetPosition._getTransformedByDeletion(this.sourcePosition, this.howMany);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        const newTargetPosition = this.sourcePosition._getTransformedByInsertion(this.targetPosition, this.howMany);\n        return new MoveOperation(this.getMovedRangeStart(), this.howMany, newTargetPosition, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        const sourceElement = this.sourcePosition.parent;\n        const targetElement = this.targetPosition.parent;\n        const sourceOffset = this.sourcePosition.offset;\n        const targetOffset = this.targetPosition.offset;\n        // Validate whether move operation has correct parameters.\n        // Validation is pretty complex but move operation is one of the core ways to manipulate the document state.\n        // We expect that many errors might be connected with one of scenarios described below.\n        if (sourceOffset + this.howMany > sourceElement.maxOffset) {\n            /**\n             * The nodes which should be moved do not exist.\n             *\n             * @error move-operation-nodes-do-not-exist\n             */\n            throw new CKEditorError('move-operation-nodes-do-not-exist', this);\n        }\n        else if (sourceElement === targetElement && sourceOffset < targetOffset && targetOffset < sourceOffset + this.howMany) {\n            /**\n             * Trying to move a range of nodes into the middle of that range.\n             *\n             * @error move-operation-range-into-itself\n             */\n            throw new CKEditorError('move-operation-range-into-itself', this);\n        }\n        else if (this.sourcePosition.root == this.targetPosition.root) {\n            if (compareArrays(this.sourcePosition.getParentPath(), this.targetPosition.getParentPath()) == 'prefix') {\n                const i = this.sourcePosition.path.length - 1;\n                if (this.targetPosition.path[i] >= sourceOffset && this.targetPosition.path[i] < sourceOffset + this.howMany) {\n                    /**\n                     * Trying to move a range of nodes into one of nodes from that range.\n                     *\n                     * @error move-operation-node-into-itself\n                     */\n                    throw new CKEditorError('move-operation-node-into-itself', this);\n                }\n            }\n        }\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        _move(ModelRange._createFromPositionAndShift(this.sourcePosition, this.howMany), this.targetPosition);\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.sourcePosition = this.sourcePosition.toJSON();\n        json.targetPosition = this.targetPosition.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'MoveOperation';\n    }\n    /**\n     * Creates `MoveOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        const sourcePosition = ModelPosition.fromJSON(json.sourcePosition, document);\n        const targetPosition = ModelPosition.fromJSON(json.targetPosition, document);\n        return new this(sourcePosition, json.howMany, targetPosition, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/insertoperation\n */\nimport { Operation } from './operation.js';\nimport { ModelPosition } from '../position.js';\nimport { ModelNodeList } from '../nodelist.js';\nimport { MoveOperation } from './moveoperation.js';\nimport { _insert, _normalizeNodes } from './utils.js';\nimport { ModelText } from '../text.js';\nimport { ModelElement } from '../element.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Operation to insert one or more nodes at given position in the model.\n */\nexport class InsertOperation extends Operation {\n    /**\n     * Position of insertion.\n     *\n     * @readonly\n     */\n    position;\n    /**\n     * List of nodes to insert.\n     *\n     * @readonly\n     */\n    nodes;\n    /**\n     * Flag deciding how the operation should be transformed. If set to `true`, nodes might get additional attributes\n     * during operational transformation. This happens when the operation insertion position is inside of a range\n     * where attributes have changed.\n     */\n    shouldReceiveAttributes;\n    /**\n     * Creates an insert operation.\n     *\n     * @param position Position of insertion.\n     * @param nodes The list of nodes to be inserted.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(position, nodes, baseVersion) {\n        super(baseVersion);\n        this.position = position.clone();\n        this.position.stickiness = 'toNone';\n        this.nodes = new ModelNodeList(_normalizeNodes(nodes));\n        this.shouldReceiveAttributes = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return 'insert';\n    }\n    /**\n     * Total offset size of inserted nodes.\n     */\n    get howMany() {\n        return this.nodes.maxOffset;\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return this.position.clone();\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     */\n    clone() {\n        const nodes = new ModelNodeList([...this.nodes].map(node => node._clone(true)));\n        const insert = new InsertOperation(this.position, nodes, this.baseVersion);\n        insert.shouldReceiveAttributes = this.shouldReceiveAttributes;\n        return insert;\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        const graveyard = this.position.root.document.graveyard;\n        const gyPosition = new ModelPosition(graveyard, [0]);\n        return new MoveOperation(this.position, this.nodes.maxOffset, gyPosition, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        const targetElement = this.position.parent;\n        if (!targetElement || targetElement.maxOffset < this.position.offset) {\n            /**\n             * Insertion position is invalid.\n             *\n             * @error insert-operation-position-invalid\n             */\n            throw new CKEditorError('insert-operation-position-invalid', this);\n        }\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        // What happens here is that we want original nodes be passed to writer because we want original nodes\n        // to be inserted to the model. But in InsertOperation, we want to keep those nodes as they were added\n        // to the operation, not modified. For example, text nodes can get merged or cropped while Elements can\n        // get children. It is important that InsertOperation has the copy of original nodes in intact state.\n        const originalNodes = this.nodes;\n        this.nodes = new ModelNodeList([...originalNodes].map(node => node._clone(true)));\n        _insert(this.position, originalNodes);\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.position = this.position.toJSON();\n        json.nodes = this.nodes.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'InsertOperation';\n    }\n    /**\n     * Creates `InsertOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        const children = [];\n        for (const child of json.nodes) {\n            if (child.name) {\n                // If child has name property, it is an Element.\n                children.push(ModelElement.fromJSON(child));\n            }\n            else {\n                // Otherwise, it is a Text node.\n                children.push(ModelText.fromJSON(child));\n            }\n        }\n        const insert = new InsertOperation(ModelPosition.fromJSON(json.position, document), children, json.baseVersion);\n        insert.shouldReceiveAttributes = json.shouldReceiveAttributes;\n        return insert;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/splitoperation\n */\nimport { Operation } from './operation.js';\nimport { MergeOperation } from './mergeoperation.js';\nimport { ModelPosition } from '../position.js';\nimport { ModelRange } from '../range.js';\nimport { _insert, _move } from './utils.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Operation to split {@link module:engine/model/element~ModelElement an element} at given\n * {@link module:engine/model/operation/splitoperation~SplitOperation#splitPosition split position} into two elements,\n * both containing a part of the element's original content.\n */\nexport class SplitOperation extends Operation {\n    /**\n     * Position at which an element should be split.\n     */\n    splitPosition;\n    /**\n     * Total offset size of elements that are in the split element after `position`.\n     */\n    howMany;\n    /**\n     * Position at which the clone of split element (or element from graveyard) will be inserted.\n     */\n    insertionPosition;\n    /**\n     * Position in the graveyard root before the element which should be used as a parent of the nodes after `position`.\n     * If it is not set, a copy of the the `position` parent will be used.\n     *\n     * The default behavior is to clone the split element. Element from graveyard is used during undo.\n     */\n    graveyardPosition;\n    /**\n     * Creates a split operation.\n     *\n     * @param splitPosition Position at which an element should be split.\n     * @param howMany Total offset size of elements that are in the split element after `position`.\n     * @param insertionPosition Position at which the clone of split element (or element from graveyard) will be inserted.\n     * @param graveyardPosition Position in the graveyard root before the element which\n     * should be used as a parent of the nodes after `position`. If it is not set, a copy of the the `position` parent will be used.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(splitPosition, howMany, insertionPosition, graveyardPosition, baseVersion) {\n        super(baseVersion);\n        this.splitPosition = splitPosition.clone();\n        // Keep position sticking to the next node. This way any new content added at the place where the element is split\n        // will be left in the original element.\n        this.splitPosition.stickiness = 'toNext';\n        this.howMany = howMany;\n        this.insertionPosition = insertionPosition;\n        this.graveyardPosition = graveyardPosition ? graveyardPosition.clone() : null;\n        if (this.graveyardPosition) {\n            this.graveyardPosition.stickiness = 'toNext';\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return 'split';\n    }\n    /**\n     * Position inside the new clone of a split element.\n     *\n     * This is a position where nodes that are after the split position will be moved to.\n     */\n    get moveTargetPosition() {\n        const path = this.insertionPosition.path.slice();\n        path.push(0);\n        return new ModelPosition(this.insertionPosition.root, path);\n    }\n    /**\n     * Artificial range that contains all the nodes from the split element that will be moved to the new element.\n     * The range starts at {@link #splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.\n     */\n    get movedRange() {\n        const end = this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);\n        return new ModelRange(this.splitPosition, end);\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        // These could be positions but `Selectable` type only supports `Iterable<Range>`.\n        const ranges = [\n            ModelRange._createFromPositionAndShift(this.splitPosition, 0),\n            ModelRange._createFromPositionAndShift(this.insertionPosition, 0)\n        ];\n        if (this.graveyardPosition) {\n            ranges.push(ModelRange._createFromPositionAndShift(this.graveyardPosition, 0));\n        }\n        return ranges;\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     *\n     * @returns Clone of this operation.\n     */\n    clone() {\n        return new SplitOperation(this.splitPosition, this.howMany, this.insertionPosition, this.graveyardPosition, this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        const graveyard = this.splitPosition.root.document.graveyard;\n        const graveyardPosition = new ModelPosition(graveyard, [0]);\n        return new MergeOperation(this.moveTargetPosition, this.howMany, this.splitPosition, graveyardPosition, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        const element = this.splitPosition.parent;\n        const offset = this.splitPosition.offset;\n        // Validate whether split operation has correct parameters.\n        if (!element || element.maxOffset < offset) {\n            /**\n             * Split position is invalid.\n             *\n             * @error split-operation-position-invalid\n             */\n            throw new CKEditorError('split-operation-position-invalid', this);\n        }\n        else if (!element.parent) {\n            /**\n             * Cannot split root element.\n             *\n             * @error split-operation-split-in-root\n             */\n            throw new CKEditorError('split-operation-split-in-root', this);\n        }\n        else if (this.howMany !== Number.NEGATIVE_INFINITY && this.howMany != element.maxOffset - this.splitPosition.offset) {\n            /**\n             * Split operation specifies wrong number of nodes to move.\n             *\n             * @error split-operation-how-many-invalid\n             */\n            throw new CKEditorError('split-operation-how-many-invalid', this);\n        }\n        else if (this.graveyardPosition && !this.graveyardPosition.nodeAfter) {\n            /**\n             * Graveyard position invalid.\n             *\n             * @error split-operation-graveyard-position-invalid\n             */\n            throw new CKEditorError('split-operation-graveyard-position-invalid', this);\n        }\n        this.howMany = this.splitPosition.parent.maxOffset - this.splitPosition.offset;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        const splitElement = this.splitPosition.parent;\n        if (this.graveyardPosition) {\n            _move(ModelRange._createFromPositionAndShift(this.graveyardPosition, 1), this.insertionPosition);\n        }\n        else {\n            const newElement = splitElement._clone();\n            _insert(this.insertionPosition, newElement);\n        }\n        const sourceRange = new ModelRange(ModelPosition._createAt(splitElement, this.splitPosition.offset), ModelPosition._createAt(splitElement, splitElement.maxOffset));\n        _move(sourceRange, this.moveTargetPosition);\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.splitPosition = this.splitPosition.toJSON();\n        json.insertionPosition = this.insertionPosition.toJSON();\n        if (this.graveyardPosition) {\n            json.graveyardPosition = this.graveyardPosition.toJSON();\n        }\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'SplitOperation';\n    }\n    /**\n     * Helper function that returns a default insertion position basing on given `splitPosition`. The default insertion\n     * position is after the split element.\n     */\n    static getInsertionPosition(splitPosition) {\n        const path = splitPosition.path.slice(0, -1);\n        path[path.length - 1]++;\n        return new ModelPosition(splitPosition.root, path, 'toPrevious');\n    }\n    /**\n     * Creates `SplitOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        const splitPosition = ModelPosition.fromJSON(json.splitPosition, document);\n        const insertionPosition = ModelPosition.fromJSON(json.insertionPosition, document);\n        const graveyardPosition = json.graveyardPosition ? ModelPosition.fromJSON(json.graveyardPosition, document) : null;\n        return new this(splitPosition, json.howMany, insertionPosition, graveyardPosition, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/mergeoperation\n */\nimport { Operation } from './operation.js';\nimport { SplitOperation } from './splitoperation.js';\nimport { ModelPosition } from '../position.js';\nimport { ModelRange } from '../range.js';\nimport { _move } from './utils.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Operation to merge two {@link module:engine/model/element~ModelElement elements}.\n *\n * The merged element is the parent of {@link ~MergeOperation#sourcePosition} and it is merged into the parent of\n * {@link ~MergeOperation#targetPosition}. All nodes from the merged element are moved to {@link ~MergeOperation#targetPosition}.\n *\n * The merged element is moved to the graveyard at {@link ~MergeOperation#graveyardPosition}.\n */\nexport class MergeOperation extends Operation {\n    /**\n     * Position inside the merged element. All nodes from that element after that position will be moved to {@link #targetPosition}.\n     */\n    sourcePosition;\n    /**\n     * Summary offset size of nodes which will be moved from the merged element to the new parent.\n     */\n    howMany;\n    /**\n     * Position which the nodes from the merged elements will be moved to.\n     */\n    targetPosition;\n    /**\n     * Position in graveyard to which the merged element will be moved.\n     */\n    graveyardPosition;\n    /**\n     * Creates a merge operation.\n     *\n     * @param sourcePosition Position inside the merged element. All nodes from that\n     * element after that position will be moved to {@link #targetPosition}.\n     * @param howMany Summary offset size of nodes which will be moved from the merged element to the new parent.\n     * @param targetPosition Position which the nodes from the merged elements will be moved to.\n     * @param graveyardPosition Position in graveyard to which the merged element will be moved.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(sourcePosition, howMany, targetPosition, graveyardPosition, baseVersion) {\n        super(baseVersion);\n        this.sourcePosition = sourcePosition.clone();\n        // This is, and should always remain, the first position in its parent.\n        this.sourcePosition.stickiness = 'toPrevious';\n        this.howMany = howMany;\n        this.targetPosition = targetPosition.clone();\n        // Except of a rare scenario in `MergeOperation` x `MergeOperation` transformation,\n        // this is, and should always remain, the last position in its parent.\n        this.targetPosition.stickiness = 'toNext';\n        this.graveyardPosition = graveyardPosition.clone();\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return 'merge';\n    }\n    /**\n     * Position before the merged element (which will be deleted).\n     */\n    get deletionPosition() {\n        return new ModelPosition(this.sourcePosition.root, this.sourcePosition.path.slice(0, -1));\n    }\n    /**\n     * Artificial range that contains all the nodes from the merged element that will be moved to {@link ~MergeOperation#sourcePosition}.\n     * The range starts at {@link ~MergeOperation#sourcePosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.\n     */\n    get movedRange() {\n        const end = this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);\n        return new ModelRange(this.sourcePosition, end);\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        const mergedElement = this.sourcePosition.parent;\n        return [\n            ModelRange._createOn(mergedElement),\n            // These could be positions but `Selectable` type only supports `Iterable<Range>`.\n            ModelRange._createFromPositionAndShift(this.targetPosition, 0),\n            ModelRange._createFromPositionAndShift(this.graveyardPosition, 0)\n        ];\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     */\n    clone() {\n        return new MergeOperation(this.sourcePosition, this.howMany, this.targetPosition, this.graveyardPosition, this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        // Positions in this method are transformed by this merge operation because the split operation bases on\n        // the context after this merge operation happened (because split operation reverses it).\n        // So we need to acknowledge that the merge operation happened and those positions changed a little.\n        const targetPosition = this.targetPosition._getTransformedByMergeOperation(this);\n        const path = this.sourcePosition.path.slice(0, -1);\n        const insertionPosition = new ModelPosition(this.sourcePosition.root, path)._getTransformedByMergeOperation(this);\n        return new SplitOperation(targetPosition, this.howMany, insertionPosition, this.graveyardPosition, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        const sourceElement = this.sourcePosition.parent;\n        const targetElement = this.targetPosition.parent;\n        // Validate whether merge operation has correct parameters.\n        if (!sourceElement.parent) {\n            /**\n             * Merge source position is invalid. The element to be merged must have a parent node.\n             *\n             * @error merge-operation-source-position-invalid\n             */\n            throw new CKEditorError('merge-operation-source-position-invalid', this);\n        }\n        else if (!targetElement.parent) {\n            /**\n             * Merge target position is invalid. The element to be merged must have a parent node.\n             *\n             * @error merge-operation-target-position-invalid\n             */\n            throw new CKEditorError('merge-operation-target-position-invalid', this);\n        }\n        else if (this.howMany !== Number.NEGATIVE_INFINITY && this.howMany != sourceElement.maxOffset) {\n            /**\n             * Merge operation specifies wrong number of nodes to move.\n             *\n             * @error merge-operation-how-many-invalid\n             */\n            throw new CKEditorError('merge-operation-how-many-invalid', this);\n        }\n        this.howMany = this.sourcePosition.parent.maxOffset;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        const mergedElement = this.sourcePosition.parent;\n        const sourceRange = ModelRange._createIn(mergedElement);\n        _move(sourceRange, this.targetPosition);\n        _move(ModelRange._createOn(mergedElement), this.graveyardPosition);\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.sourcePosition = json.sourcePosition.toJSON();\n        json.targetPosition = json.targetPosition.toJSON();\n        json.graveyardPosition = json.graveyardPosition.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'MergeOperation';\n    }\n    /**\n     * Creates `MergeOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        const sourcePosition = ModelPosition.fromJSON(json.sourcePosition, document);\n        const targetPosition = ModelPosition.fromJSON(json.targetPosition, document);\n        const graveyardPosition = ModelPosition.fromJSON(json.graveyardPosition, document);\n        return new this(sourcePosition, json.howMany, targetPosition, graveyardPosition, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/markeroperation\n */\nimport { Operation } from './operation.js';\nimport { ModelRange } from '../range.js';\nexport class MarkerOperation extends Operation {\n    /**\n     * Marker name.\n     *\n     * @readonly\n     */\n    name;\n    /**\n     * Marker range before the change.\n     *\n     * @readonly\n     */\n    oldRange;\n    /**\n     * Marker range after the change.\n     *\n     * @readonly\n     */\n    newRange;\n    /**\n     * Specifies whether the marker operation affects the data produced by the data pipeline\n     * (is persisted in the editor's data).\n     *\n     * @readonly\n     */\n    affectsData;\n    /**\n     * Marker collection on which change should be executed.\n     */\n    _markers;\n    /**\n     * @param name Marker name.\n     * @param oldRange Marker range before the change.\n     * @param newRange Marker range after the change.\n     * @param markers Marker collection on which change should be executed.\n     * @param affectsData Specifies whether the marker operation affects the data produced by the data pipeline\n     * (is persisted in the editor's data).\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(name, oldRange, newRange, markers, affectsData, baseVersion) {\n        super(baseVersion);\n        this.name = name;\n        this.oldRange = oldRange ? oldRange.clone() : null;\n        this.newRange = newRange ? newRange.clone() : null;\n        this.affectsData = affectsData;\n        this._markers = markers;\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return 'marker';\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        const ranges = [];\n        if (this.oldRange) {\n            ranges.push(this.oldRange.clone());\n        }\n        if (this.newRange) {\n            if (this.oldRange) {\n                ranges.push(...this.newRange.getDifference(this.oldRange));\n            }\n            else {\n                ranges.push(this.newRange.clone());\n            }\n        }\n        return ranges;\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     */\n    clone() {\n        return new MarkerOperation(this.name, this.oldRange, this.newRange, this._markers, this.affectsData, this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        return new MarkerOperation(this.name, this.newRange, this.oldRange, this._markers, this.affectsData, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        if (this.newRange) {\n            this._markers._set(this.name, this.newRange, true, this.affectsData);\n        }\n        else {\n            this._markers._remove(this.name);\n        }\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    toJSON() {\n        const json = super.toJSON();\n        if (this.oldRange) {\n            json.oldRange = this.oldRange.toJSON();\n        }\n        if (this.newRange) {\n            json.newRange = this.newRange.toJSON();\n        }\n        delete json._markers;\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'MarkerOperation';\n    }\n    /**\n     * Creates `MarkerOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        return new MarkerOperation(json.name, json.oldRange ? ModelRange.fromJSON(json.oldRange, document) : null, json.newRange ? ModelRange.fromJSON(json.newRange, document) : null, document.model.markers, json.affectsData, json.baseVersion);\n    }\n}\n","import { isEqualWith } from './isEqualWith.mjs';\nimport { noop } from '../function/noop.mjs';\n\nfunction isEqual(a, b) {\n    return isEqualWith(a, b, noop);\n}\n\nexport { isEqual };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/attributeoperation\n */\nimport { Operation } from './operation.js';\nimport { _setAttribute } from './utils.js';\nimport { ModelRange } from '../range.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\nimport { isEqual } from 'es-toolkit/compat';\n/**\n * Operation to change nodes' attribute.\n *\n * Using this class you can add, remove or change value of the attribute.\n */\nexport class AttributeOperation extends Operation {\n    /**\n     * Range on which operation should be applied.\n     *\n     * @readonly\n     */\n    range;\n    /**\n     * Key of an attribute to change or remove.\n     *\n     * @readonly\n     */\n    key;\n    /**\n     * Old value of the attribute with given key or `null`, if attribute was not set before.\n     *\n     * @readonly\n     */\n    oldValue;\n    /**\n     * New value of the attribute with given key or `null`, if operation should remove attribute.\n     *\n     * @readonly\n     */\n    newValue;\n    /**\n     * Creates an operation that changes, removes or adds attributes.\n     *\n     * If only `newValue` is set, attribute will be added on a node. Note that all nodes in operation's range must not\n     * have an attribute with the same key as the added attribute.\n     *\n     * If only `oldValue` is set, then attribute with given key will be removed. Note that all nodes in operation's range\n     * must have an attribute with that key added.\n     *\n     * If both `newValue` and `oldValue` are set, then the operation will change the attribute value. Note that all nodes in\n     * operation's ranges must already have an attribute with given key and `oldValue` as value\n     *\n     * @param range Range on which the operation should be applied. Must be a flat range.\n     * @param key Key of an attribute to change or remove.\n     * @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.\n     * @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(range, key, oldValue, newValue, baseVersion) {\n        super(baseVersion);\n        this.range = range.clone();\n        this.key = key;\n        this.oldValue = oldValue === undefined ? null : oldValue;\n        this.newValue = newValue === undefined ? null : newValue;\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        if (this.oldValue === null) {\n            return 'addAttribute';\n        }\n        else if (this.newValue === null) {\n            return 'removeAttribute';\n        }\n        else {\n            return 'changeAttribute';\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return this.range.clone();\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     */\n    clone() {\n        return new AttributeOperation(this.range, this.key, this.oldValue, this.newValue, this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        return new AttributeOperation(this.range, this.key, this.newValue, this.oldValue, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.range = this.range.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        if (!this.range.isFlat) {\n            /**\n             * The range to change is not flat.\n             *\n             * @error attribute-operation-range-not-flat\n             */\n            throw new CKEditorError('attribute-operation-range-not-flat', this);\n        }\n        for (const item of this.range.getItems({ shallow: true })) {\n            if (this.oldValue !== null && !isEqual(item.getAttribute(this.key), this.oldValue)) {\n                /**\n                 * Changed node has different attribute value than operation's old attribute value.\n                 *\n                 * @error attribute-operation-wrong-old-value\n                 * @param {module:engine/model/item~ModelItem} root The item element.\n                 * @param {string} key The key of the attribute.\n                 * @param {never} value The value.\n                 */\n                throw new CKEditorError('attribute-operation-wrong-old-value', this, { item, key: this.key, value: this.oldValue });\n            }\n            if (this.oldValue === null && this.newValue !== null && item.hasAttribute(this.key)) {\n                /**\n                 * The attribute with given key already exists for the given node.\n                 *\n                 * @error attribute-operation-attribute-exists\n                 * @param {module:engine/model/item~ModelItem} root The item element.\n                 * @param {string} key The key of the attribute.\n                 */\n                throw new CKEditorError('attribute-operation-attribute-exists', this, { node: item, key: this.key });\n            }\n        }\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        // If value to set is same as old value, don't do anything.\n        if (!isEqual(this.oldValue, this.newValue)) {\n            // Execution.\n            _setAttribute(this.range, this.key, this.newValue);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'AttributeOperation';\n    }\n    /**\n     * Creates `AttributeOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        return new AttributeOperation(ModelRange.fromJSON(json.range, document), json.key, json.oldValue, json.newValue, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/nooperation\n */\nimport { Operation } from './operation.js';\n/**\n * Operation which is doing nothing (\"empty operation\", \"do-nothing operation\", \"noop\"). This is an operation,\n * which when executed does not change the tree model. It still has some parameters defined for transformation purposes.\n *\n * In most cases this operation is a result of transforming operations. When transformation returns\n * {@link module:engine/model/operation/nooperation~NoOperation} it means that changes done by the transformed operation\n * have already been applied.\n */\nexport class NoOperation extends Operation {\n    get type() {\n        return 'noop';\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return null;\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     */\n    clone() {\n        return new NoOperation(this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        return new NoOperation(this.baseVersion + 1);\n    }\n    /** @internal */\n    _execute() {\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'NoOperation';\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/renameoperation\n */\nimport { Operation } from './operation.js';\nimport { ModelElement } from '../element.js';\nimport { ModelPosition } from '../position.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Operation to change element's name.\n *\n * Using this class you can change element's name.\n */\nexport class RenameOperation extends Operation {\n    /**\n     * Position before an element to change.\n     */\n    position;\n    /**\n     * Current name of the element.\n     */\n    oldName;\n    /**\n     * New name for the element.\n     */\n    newName;\n    /**\n     * Creates an operation that changes element's name.\n     *\n     * @param position Position before an element to change.\n     * @param oldName Current name of the element.\n     * @param newName New name for the element.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(position, oldName, newName, baseVersion) {\n        super(baseVersion);\n        this.position = position;\n        // This position sticks to the next node because it is a position before the node that we want to change.\n        this.position.stickiness = 'toNext';\n        this.oldName = oldName;\n        this.newName = newName;\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return 'rename';\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return this.position.nodeAfter;\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     *\n     * @returns Clone of this operation.\n     */\n    clone() {\n        return new RenameOperation(this.position.clone(), this.oldName, this.newName, this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        return new RenameOperation(this.position.clone(), this.newName, this.oldName, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        const element = this.position.nodeAfter;\n        if (!(element instanceof ModelElement)) {\n            /**\n             * Given position is invalid or node after it is not instance of Element.\n             *\n             * @error rename-operation-wrong-position\n             */\n            throw new CKEditorError('rename-operation-wrong-position', this);\n        }\n        else if (this.oldName !== '' && element.name !== this.oldName) {\n            /**\n             * Element to change has different name than operation's old name.\n             *\n             * @error rename-operation-wrong-name\n             */\n            throw new CKEditorError('rename-operation-wrong-name', this);\n        }\n        this.oldName = element.name;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        const element = this.position.nodeAfter;\n        element.name = this.newName;\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.position = this.position.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'RenameOperation';\n    }\n    /**\n     * Creates `RenameOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        return new RenameOperation(ModelPosition.fromJSON(json.position, document), json.oldName, json.newName, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/rootattributeoperation\n */\nimport { Operation } from './operation.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Operation to change root element's attribute. Using this class you can add, remove or change value of the attribute.\n *\n * This operation is needed, because root elements can't be changed through\n * {@link module:engine/model/operation/attributeoperation~AttributeOperation}.\n * It is because {@link module:engine/model/operation/attributeoperation~AttributeOperation}\n * requires a range to change and root element can't\n * be a part of range because every {@link module:engine/model/position~ModelPosition} has to be inside a root.\n * {@link module:engine/model/position~ModelPosition} can't be created before a root element.\n */\nexport class RootAttributeOperation extends Operation {\n    /**\n     * Root element to change.\n     */\n    root;\n    /**\n     * Key of an attribute to change or remove.\n     */\n    key;\n    /**\n     * Old value of the attribute with given key or `null`, if attribute was not set before.\n     *\n     * @readonly\n     */\n    oldValue;\n    /**\n     * New value of the attribute with given key or `null`, if operation should remove attribute.\n     *\n     * @readonly\n     */\n    newValue;\n    /**\n     * Creates an operation that changes, removes or adds attributes on root element.\n     *\n     * @see module:engine/model/operation/attributeoperation~AttributeOperation\n     * @param root Root element to change.\n     * @param key Key of an attribute to change or remove.\n     * @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.\n     * @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation\n     * can be applied or `null` if the operation operates on detached (non-document) tree.\n     */\n    constructor(root, key, oldValue, newValue, baseVersion) {\n        super(baseVersion);\n        this.root = root;\n        this.key = key;\n        this.oldValue = oldValue === undefined ? null : oldValue;\n        this.newValue = newValue === undefined ? null : newValue;\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        if (this.oldValue === null) {\n            return 'addRootAttribute';\n        }\n        else if (this.newValue === null) {\n            return 'removeRootAttribute';\n        }\n        else {\n            return 'changeRootAttribute';\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return this.root;\n    }\n    /**\n     * Creates and returns an operation that has the same parameters as this operation.\n     *\n     * @returns Clone of this operation.\n     */\n    clone() {\n        return new RootAttributeOperation(this.root, this.key, this.oldValue, this.newValue, this.baseVersion);\n    }\n    /**\n     * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.\n     */\n    getReversed() {\n        return new RootAttributeOperation(this.root, this.key, this.newValue, this.oldValue, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        if (this.root != this.root.root || this.root.is('documentFragment')) {\n            /**\n             * The element to change is not a root element.\n             *\n             * @error rootattribute-operation-not-a-root\n             * @param {module:engine/model/rootelement~ModelRootElement} root The root element.\n             * @param {string} key The key of the attribute.\n             */\n            throw new CKEditorError('rootattribute-operation-not-a-root', this, { root: this.root, key: this.key });\n        }\n        if (this.oldValue !== null && this.root.getAttribute(this.key) !== this.oldValue) {\n            /**\n             * The attribute which should be removed does not exist for the given node.\n             *\n             * @error rootattribute-operation-wrong-old-value\n             * @param {module:engine/model/rootelement~ModelRootElement} root The root element.\n             * @param {string} key The key of the attribute.\n             */\n            throw new CKEditorError('rootattribute-operation-wrong-old-value', this, { root: this.root, key: this.key });\n        }\n        if (this.oldValue === null && this.newValue !== null && this.root.hasAttribute(this.key)) {\n            /**\n             * The attribute with given key already exists for the given node.\n             *\n             * @error rootattribute-operation-attribute-exists\n             * @param {module:engine/model/rootelement~ModelRootElement} root The root element.\n             * @param {string} key The key of the attribute.\n             */\n            throw new CKEditorError('rootattribute-operation-attribute-exists', this, { root: this.root, key: this.key });\n        }\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        if (this.newValue !== null) {\n            this.root._setAttribute(this.key, this.newValue);\n        }\n        else {\n            this.root._removeAttribute(this.key);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.root = this.root.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'RootAttributeOperation';\n    }\n    /**\n     * Creates `RootAttributeOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        if (!document.getRoot(json.root)) {\n            /**\n             * Cannot create RootAttributeOperation for document. Root with the specified name does not exist.\n             *\n             * @error rootattribute-operation-fromjson-no-root\n             * @param {string} rootName The root name.\n             */\n            throw new CKEditorError('rootattribute-operation-fromjson-no-root', this, { rootName: json.root });\n        }\n        return new RootAttributeOperation(document.getRoot(json.root), json.key, json.oldValue, json.newValue, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/rootoperation\n */\nimport { Operation } from './operation.js';\n/**\n * Operation that creates (or attaches) or detaches a root element.\n */\nexport class RootOperation extends Operation {\n    /**\n     * Root name to create or detach.\n     */\n    rootName;\n    /**\n     * Root element name.\n     */\n    elementName;\n    /**\n     * Specifies whether the operation adds (`true`) or detaches the root (`false`).\n     */\n    isAdd;\n    /**\n     * Document which owns the root.\n     */\n    _document;\n    /**\n     * Creates an operation that creates or removes a root element.\n     *\n     * @param rootName Root name to create or detach.\n     * @param elementName Root element name.\n     * @param isAdd Specifies whether the operation adds (`true`) or detaches the root (`false`).\n     * @param document Document which owns the root.\n     * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation can be applied.\n     */\n    constructor(rootName, elementName, isAdd, document, baseVersion) {\n        super(baseVersion);\n        this.rootName = rootName;\n        this.elementName = elementName;\n        this.isAdd = isAdd;\n        this._document = document;\n        // Make sure that the root exists ASAP, this is important for RTC.\n        // If the root was dynamically added, there will be more operations that operate on/in this root.\n        // These operations will require root element instance (in operation property or in position instance).\n        // If the root is not created ahead of time, instantiating such operations may fail.\n        if (!this._document.getRoot(this.rootName)) {\n            const root = this._document.createRoot(this.elementName, this.rootName);\n            root._isAttached = false;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return this.isAdd ? 'addRoot' : 'detachRoot';\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return this._document.getRoot(this.rootName);\n    }\n    /**\n     * @inheritDoc\n     */\n    clone() {\n        return new RootOperation(this.rootName, this.elementName, this.isAdd, this._document, this.baseVersion);\n    }\n    /**\n     * @inheritDoc\n     */\n    getReversed() {\n        return new RootOperation(this.rootName, this.elementName, !this.isAdd, this._document, this.baseVersion + 1);\n    }\n    /**\n     * @inheritDoc\n     */\n    _execute() {\n        this._document.getRoot(this.rootName)._isAttached = this.isAdd;\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        delete json._document;\n        return json;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'RootOperation';\n    }\n    /**\n     * Creates `RootOperation` object from deserialized object, i.e. from parsed JSON string.\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        return new RootOperation(json.rootName, json.elementName, json.isAdd, document, json.baseVersion);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/operationfactory\n */\nimport { AttributeOperation } from './attributeoperation.js';\nimport { InsertOperation } from './insertoperation.js';\nimport { MarkerOperation } from './markeroperation.js';\nimport { MoveOperation } from './moveoperation.js';\nimport { NoOperation } from './nooperation.js';\nimport { Operation } from './operation.js';\nimport { RenameOperation } from './renameoperation.js';\nimport { RootAttributeOperation } from './rootattributeoperation.js';\nimport { RootOperation } from './rootoperation.js';\nimport { SplitOperation } from './splitoperation.js';\nimport { MergeOperation } from './mergeoperation.js';\nconst operations = {};\noperations[AttributeOperation.className] = AttributeOperation;\noperations[InsertOperation.className] = InsertOperation;\noperations[MarkerOperation.className] = MarkerOperation;\noperations[MoveOperation.className] = MoveOperation;\noperations[NoOperation.className] = NoOperation;\noperations[Operation.className] = Operation;\noperations[RenameOperation.className] = RenameOperation;\noperations[RootAttributeOperation.className] = RootAttributeOperation;\noperations[RootOperation.className] = RootOperation;\noperations[SplitOperation.className] = SplitOperation;\noperations[MergeOperation.className] = MergeOperation;\n/**\n * A factory class for creating operations.\n */\nexport class OperationFactory {\n    /**\n     * Creates an operation instance from a JSON object (parsed JSON string).\n     *\n     * @param json Deserialized JSON object.\n     * @param document Document on which this operation will be applied.\n     */\n    static fromJSON(json, document) {\n        return operations[json.__className].fromJSON(json, document);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/transform\n */\nimport { InsertOperation } from './insertoperation.js';\nimport { AttributeOperation } from './attributeoperation.js';\nimport { RenameOperation } from './renameoperation.js';\nimport { MarkerOperation } from './markeroperation.js';\nimport { MoveOperation } from './moveoperation.js';\nimport { RootAttributeOperation } from './rootattributeoperation.js';\nimport { RootOperation } from './rootoperation.js';\nimport { MergeOperation } from './mergeoperation.js';\nimport { SplitOperation } from './splitoperation.js';\nimport { NoOperation } from './nooperation.js';\nimport { ModelRange } from '../range.js';\nimport { ModelPosition } from '../position.js';\nimport { compareArrays } from '@ckeditor/ckeditor5-utils';\nconst transformations = new Map();\n/**\n * Sets a transformation function to be be used to transform instances of class `OperationA` by instances of class `OperationB`.\n *\n * The `transformationFunction` is passed three parameters:\n *\n * * `a` - operation to be transformed, an instance of `OperationA`,\n * * `b` - operation to be transformed by, an instance of `OperationB`,\n * * {@link module:engine/model/operation/transform~TransformationContext `context`} - object with additional information about\n * transformation context.\n *\n * The `transformationFunction` should return transformation result, which is an array with one or multiple\n * {@link module:engine/model/operation/operation~Operation operation} instances.\n *\n * @param transformationFunction Function to use for transforming.\n */\nfunction setTransformation(OperationA, OperationB, transformationFunction) {\n    let aGroup = transformations.get(OperationA);\n    if (!aGroup) {\n        aGroup = new Map();\n        transformations.set(OperationA, aGroup);\n    }\n    aGroup.set(OperationB, transformationFunction);\n}\n/**\n * Returns a previously set transformation function for transforming an instance of `OperationA` by an instance of `OperationB`.\n *\n * If no transformation was set for given pair of operations, {@link module:engine/model/operation/transform~noUpdateTransformation}\n * is returned. This means that if no transformation was set, the `OperationA` instance will not change when transformed\n * by the `OperationB` instance.\n *\n * @returns Function set to transform an instance of `OperationA` by an instance of `OperationB`.\n */\nfunction getTransformation(OperationA, OperationB) {\n    const aGroup = transformations.get(OperationA);\n    if (aGroup && aGroup.has(OperationB)) {\n        return aGroup.get(OperationB);\n    }\n    return noUpdateTransformation;\n}\n/**\n * A transformation function that only clones operation to transform, without changing it.\n */\nfunction noUpdateTransformation(a) {\n    return [a];\n}\n/**\n * Transforms operation `a` by operation `b`.\n *\n * @param a Operation to be transformed.\n * @param b Operation to transform by.\n * @param context Transformation context for this transformation.\n * @returns Transformation result.\n * @internal\n */\nexport function transform(a, b, context = {}) {\n    const transformationFunction = getTransformation(a.constructor, b.constructor);\n    /* eslint-disable no-useless-catch */\n    try {\n        a = a.clone();\n        return transformationFunction(a, b, context);\n    }\n    catch (e) {\n        // @if CK_DEBUG // console.warn( 'Error during operation transformation!', e.message );\n        // @if CK_DEBUG // console.warn( 'Transformed operation', a );\n        // @if CK_DEBUG // console.warn( 'Operation transformed by', b );\n        // @if CK_DEBUG // console.warn( 'context.aIsStrong', context.aIsStrong );\n        // @if CK_DEBUG // console.warn( 'context.aWasUndone', context.aWasUndone );\n        // @if CK_DEBUG // console.warn( 'context.bWasUndone', context.bWasUndone );\n        // @if CK_DEBUG // console.warn( 'context.abRelation', context.abRelation );\n        // @if CK_DEBUG // console.warn( 'context.baRelation', context.baRelation );\n        throw e;\n    }\n    /* eslint-enable no-useless-catch */\n}\n/**\n * Performs a transformation of two sets of operations - `operationsA` and `operationsB`. The transformation is two-way -\n * both transformed `operationsA` and transformed `operationsB` are returned.\n *\n * Note, that the first operation in each set should base on the same document state (\n * {@link module:engine/model/document~ModelDocument#version document version}).\n *\n * It is assumed that `operationsA` are \"more important\" during conflict resolution between two operations.\n *\n * New copies of both passed arrays and operations inside them are returned. Passed arguments are not altered.\n *\n * Base versions of the transformed operations sets are updated accordingly. For example, assume that base versions are `4`\n * and there are `3` operations in `operationsA` and `5` operations in `operationsB`. Then:\n *\n * * transformed `operationsA` will start from base version `9` (`4` base version + `5` operations B),\n * * transformed `operationsB` will start from base version `7` (`4` base version + `3` operations A).\n *\n * If no operation was broken into two during transformation, then both sets will end up with an operation that bases on version `11`:\n *\n * * transformed `operationsA` start from `9` and there are `3` of them, so the last will have `baseVersion` equal to `11`,\n * * transformed `operationsB` start from `7` and there are `5` of them, so the last will have `baseVersion` equal to `11`.\n *\n * @param operationsA\n * @param operationsB\n * @param options Additional transformation options.\n * @param options.document Document which the operations change.\n * @param options.useRelations Whether during transformation relations should be used (used during undo for better conflict resolution).\n * @param options.padWithNoOps Whether additional {@link module:engine/model/operation/nooperation~NoOperation}s\n * should be added to the transformation results to force the same last base version for both transformed sets (in case\n * if some operations got broken into multiple operations during transformation).\n * @param options.forceWeakRemove If set to `false`, remove operation will be always stronger than move operation,\n * so the removed nodes won't end up back in the document root. When set to `true`, context data will be used.\n * @returns Transformation result.\n */\nexport function transformOperationSets(operationsA, operationsB, options) {\n    // Create new arrays so the originally passed arguments are not changed.\n    // No need to clone operations, they are cloned as they are transformed.\n    operationsA = operationsA.slice();\n    operationsB = operationsB.slice();\n    const contextFactory = new ContextFactory(options.document, options.useRelations, options.forceWeakRemove);\n    contextFactory.setOriginalOperations(operationsA);\n    contextFactory.setOriginalOperations(operationsB);\n    const originalOperations = contextFactory.originalOperations;\n    // If one of sets is empty there is simply nothing to transform, so return sets as they are.\n    if (operationsA.length == 0 || operationsB.length == 0) {\n        return { operationsA, operationsB, originalOperations };\n    }\n    //\n    // Following is a description of transformation process:\n    //\n    // There are `operationsA` and `operationsB` to be transformed, both by both.\n    //\n    // So, suppose we have sets of two operations each: `operationsA` = `[ a1, a2 ]`, `operationsB` = `[ b1, b2 ]`.\n    //\n    // Remember, that we can only transform operations that base on the same context. We assert that `a1` and `b1` base on\n    // the same context and we transform them. Then, we get `a1'` and `b1'`. `a2` bases on a context with `a1` -- `a2`\n    // is an operation that followed `a1`. Similarly, `b2` bases on a context with `b1`.\n    //\n    // However, since `a1'` is a result of transformation by `b1`, `a1'` now also has a context with `b1`. This means that\n    // we can safely transform `a1'` by `b2`. As we finish transforming `a1`, we also transformed all `operationsB`.\n    // All `operationsB` also have context including `a1`. Now, we can properly transform `a2` by those operations.\n    //\n    // The transformation process can be visualized on a transformation diagram (\"diamond diagram\"):\n    //\n    //          [the initial state]\n    //         [common for a1 and b1]\n    //\n    //                   *\n    //                  / \\\n    //                 /   \\\n    //               b1     a1\n    //               /       \\\n    //              /         \\\n    //             *           *\n    //            / \\         / \\\n    //           /   \\       /   \\\n    //         b2    a1'   b1'    a2\n    //         /       \\   /       \\\n    //        /         \\ /         \\\n    //       *           *           *\n    //        \\         / \\         /\n    //         \\       /   \\       /\n    //        a1''   b2'   a2'   b1''\n    //           \\   /       \\   /\n    //            \\ /         \\ /\n    //             *           *\n    //              \\         /\n    //               \\       /\n    //              a2''   b2''\n    //                 \\   /\n    //                  \\ /\n    //                   *\n    //\n    //           [the final state]\n    //\n    // The final state can be reached from the initial state by applying `a1`, `a2`, `b1''` and `b2''`, as well as by\n    // applying `b1`, `b2`, `a1''`, `a2''`. Note how the operations get to a proper common state before each pair is\n    // transformed.\n    //\n    // Another thing to consider is that an operation during transformation can be broken into multiple operations.\n    // Suppose that `a1` * `b1` = `[ a11', a12' ]` (instead of `a1'` that we considered previously).\n    //\n    // In that case, we leave `a12'` for later and we continue transforming `a11'` until it is transformed by all `operationsB`\n    // (in our case it is just `b2`). At this point, `b1` is transformed by \"whole\" `a1`, while `b2` is only transformed\n    // by `a11'`. Similarly, `a12'` is only transformed by `b1`. This leads to a conclusion that we need to start transforming `a12'`\n    // from the moment just after it was broken. So, `a12'` is transformed by `b2`. Now, \"the whole\" `a1` is transformed\n    // by `operationsB`, while all `operationsB` are transformed by \"the whole\" `a1`. This means that we can continue with\n    // following `operationsA` (in our case it is just `a2`).\n    //\n    // Of course, also `operationsB` can be broken. However, since we focus on transforming operation `a` to the end,\n    // the only thing to do is to store both pieces of operation `b`, so that the next transformed operation `a` will\n    // be transformed by both of them.\n    //\n    //                       *\n    //                      / \\\n    //                     /   \\\n    //                    /     \\\n    //                  b1       a1\n    //                  /         \\\n    //                 /           \\\n    //                /             \\\n    //               *               *\n    //              / \\             / \\\n    //             /  a11'         /   \\\n    //            /     \\         /     \\\n    //          b2       *      b1'      a2\n    //          /       / \\     /         \\\n    //         /       /  a12' /           \\\n    //        /       /     \\ /             \\\n    //       *       b2'     *               *\n    //        \\     /       / \\             /\n    //       a11'' /     b21'' \\           /\n    //          \\ /       /     \\         /\n    //           *       *      a2'     b1''\n    //            \\     / \\       \\     /\n    //          a12'' b22''\\       \\   /\n    //              \\ /     \\       \\ /\n    //               *      a2''     *\n    //                \\       \\     /\n    //                 \\       \\  b21'''\n    //                  \\       \\ /\n    //                a2'''      *\n    //                    \\     /\n    //                     \\  b22'''\n    //                      \\ /\n    //                       *\n    //\n    // Note, how `a1` is broken and transformed into `a11'` and `a12'`, while `b2'` got broken and transformed into `b21''` and `b22''`.\n    //\n    // Having all that on mind, here is an outline for the transformation process algorithm:\n    //\n    // 1. We have `operationsA` and `operationsB` array, which we dynamically update as the transformation process goes.\n    //\n    // 2. We take next (or first) operation from `operationsA` and check from which operation `b` we need to start transforming it.\n    // All original `operationsA` are set to be transformed starting from the first operation `b`.\n    //\n    // 3. We take operations from `operationsB`, one by one, starting from the correct one, and transform operation `a`\n    // by operation `b` (and vice versa). We update `operationsA` and `operationsB` by replacing the original operations\n    // with the transformation results.\n    //\n    // 4. If operation is broken into multiple operations, we save all the new operations in the place of the\n    // original operation.\n    //\n    // 5. Additionally, if operation `a` was broken, for the \"new\" operation, we remember from which operation `b` it should\n    // be transformed by.\n    //\n    // 6. We continue transforming \"current\" operation `a` until it is transformed by all `operationsB`. Then, go to 2.\n    // unless the last operation `a` was transformed.\n    //\n    // The actual implementation of the above algorithm is slightly different, as only one loop (while) is used.\n    // The difference is that we have \"current\" `a` operation to transform and we store the index of the next `b` operation\n    // to transform by. Each loop operates on two indexes then: index pointing to currently processed `a` operation and\n    // index pointing to next `b` operation. Each loop is just one `a * b` + `b * a` transformation. After each loop\n    // operation `b` index is updated. If all `b` operations were visited for the current `a` operation, we change\n    // current `a` operation index to the next one.\n    //\n    // For each operation `a`, keeps information what is the index in `operationsB` from which the transformation should start.\n    const nextTransformIndex = new WeakMap();\n    // For all the original `operationsA`, set that they should be transformed starting from the first of `operationsB`.\n    for (const op of operationsA) {\n        nextTransformIndex.set(op, 0);\n    }\n    // Additional data that is used for some postprocessing after the main transformation process is done.\n    const data = {\n        nextBaseVersionA: operationsA[operationsA.length - 1].baseVersion + 1,\n        nextBaseVersionB: operationsB[operationsB.length - 1].baseVersion + 1,\n        originalOperationsACount: operationsA.length,\n        originalOperationsBCount: operationsB.length\n    };\n    // Index of currently transformed operation `a`.\n    let i = 0;\n    // While not all `operationsA` are transformed...\n    while (i < operationsA.length) {\n        // Get \"current\" operation `a`.\n        const opA = operationsA[i];\n        // For the \"current\" operation `a`, get the index of the next operation `b` to transform by.\n        const indexB = nextTransformIndex.get(opA);\n        // If operation `a` was already transformed by every operation `b`, change \"current\" operation `a` to the next one.\n        if (indexB == operationsB.length) {\n            i++;\n            continue;\n        }\n        const opB = operationsB[indexB];\n        // Transform `a` by `b` and `b` by `a`.\n        const newOpsA = transform(opA, opB, contextFactory.getContext(opA, opB, true));\n        const newOpsB = transform(opB, opA, contextFactory.getContext(opB, opA, false));\n        // As a result we get one or more `newOpsA` and one or more `newOpsB` operations.\n        // Update contextual information about operations.\n        contextFactory.updateRelation(opA, opB);\n        contextFactory.setOriginalOperations(newOpsA, opA);\n        contextFactory.setOriginalOperations(newOpsB, opB);\n        // For new `a` operations, update their index of the next operation `b` to transform them by.\n        //\n        // This is needed even if there was only one result (`a` was not broken) because that information is used\n        // at the beginning of this loop every time.\n        for (const newOpA of newOpsA) {\n            // Acknowledge, that operation `b` also might be broken into multiple operations.\n            //\n            // This is why we raise `indexB` not just by 1. If `newOpsB` are multiple operations, they will be\n            // spliced in the place of `opB`. So we need to change `transformBy` accordingly, so that an operation won't\n            // be transformed by the same operation (part of it) again.\n            nextTransformIndex.set(newOpA, indexB + newOpsB.length);\n        }\n        // Update `operationsA` and `operationsB` with the transformed versions.\n        operationsA.splice(i, 1, ...newOpsA);\n        operationsB.splice(indexB, 1, ...newOpsB);\n    }\n    handlePartialMarkerOperations(operationsA);\n    handlePartialMarkerOperations(operationsB);\n    if (options.padWithNoOps) {\n        // If no-operations padding is enabled, count how many extra `a` and `b` operations were generated.\n        const brokenOperationsACount = operationsA.length - data.originalOperationsACount;\n        const brokenOperationsBCount = operationsB.length - data.originalOperationsBCount;\n        // Then, if that number is not the same, pad `operationsA` or `operationsB` with correct number of no-ops so\n        // that the base versions are equalled.\n        //\n        // Note that only one array will be updated, as only one of those subtractions can be greater than zero.\n        padWithNoOps(operationsA, brokenOperationsBCount - brokenOperationsACount);\n        padWithNoOps(operationsB, brokenOperationsACount - brokenOperationsBCount);\n    }\n    // Finally, update base versions of transformed operations.\n    updateBaseVersions(operationsA, data.nextBaseVersionB);\n    updateBaseVersions(operationsB, data.nextBaseVersionA);\n    return { operationsA, operationsB, originalOperations };\n}\n/**\n * Gathers additional data about operations processed during transformation. Can be used to obtain contextual information\n * about two operations that are about to be transformed. This contextual information can be used for better conflict resolution.\n */\nclass ContextFactory {\n    originalOperations;\n    _history;\n    _useRelations;\n    _forceWeakRemove;\n    _relations;\n    /**\n     * Creates `ContextFactory` instance.\n     *\n     * @param document Document which the operations change.\n     * @param useRelations Whether during transformation relations should be used (used during undo for\n     * better conflict resolution).\n     * @param forceWeakRemove If set to `false`, remove operation will be always stronger than move operation,\n     * so the removed nodes won't end up back in the document root. When set to `true`, context data will be used.\n     */\n    constructor(document, useRelations, forceWeakRemove = false) {\n        // For each operation that is created during transformation process, we keep a reference to the original operation\n        // which it comes from. The original operation works as a kind of \"identifier\". Every contextual information\n        // gathered during transformation that we want to save for given operation, is actually saved for the original operation.\n        // This way no matter if operation `a` is cloned, then transformed, even breaks, we still have access to the previously\n        // gathered data through original operation reference.\n        this.originalOperations = new Map();\n        // `model.History` instance which information about undone operations will be taken from.\n        this._history = document.history;\n        // Whether additional context should be used.\n        this._useRelations = useRelations;\n        this._forceWeakRemove = !!forceWeakRemove;\n        // Relations is a double-map structure (maps in map) where for two operations we store how those operations were related\n        // to each other. Those relations are evaluated during transformation process. For every transformated pair of operations\n        // we keep relations between them.\n        this._relations = new Map();\n    }\n    /**\n     * Sets \"original operation\" for given operations.\n     *\n     * During transformation process, operations are cloned, then changed, then processed again, sometimes broken into two\n     * or multiple operations. When gathering additional data it is important that all operations can be somehow linked\n     * so a cloned and transformed \"version\" still kept track of the data assigned earlier to it.\n     *\n     * The original operation object will be used as such an universal linking id. Throughout the transformation process\n     * all cloned operations will refer to \"the original operation\" when storing and reading additional data.\n     *\n     * If `takeFrom` is not set, each operation from `operations` array will be assigned itself as \"the original operation\".\n     * This should be used as an initialization step.\n     *\n     * If `takeFrom` is set, each operation from `operations` will be assigned the same original operation as assigned\n     * for `takeFrom` operation. This should be used to update original operations. It should be used in a way that\n     * `operations` are the result of `takeFrom` transformation to ensure proper \"original operation propagation\".\n     */\n    setOriginalOperations(operations, takeFrom = null) {\n        const originalOperation = takeFrom ? this.originalOperations.get(takeFrom) : null;\n        for (const operation of operations) {\n            this.originalOperations.set(operation, originalOperation || operation);\n        }\n    }\n    /**\n     * Saves a relation between operations `opA` and `opB`.\n     *\n     * Relations are then later used to help solve conflicts when operations are transformed.\n     */\n    updateRelation(opA, opB) {\n        // The use of relations is described in a bigger detail in transformation functions.\n        //\n        // In brief, this function, for specified pairs of operation types, checks how positions defined in those operations relate.\n        // Then those relations are saved. For example, for two move operations, it is saved if one of those operations target\n        // position is before the other operation source position. This kind of information gives contextual information when\n        // transformation is used during undo. Similar checks are done for other pairs of operations.\n        //\n        if (opA instanceof MoveOperation) {\n            if (opB instanceof MergeOperation) {\n                if (opA.targetPosition.isEqual(opB.sourcePosition) || opB.movedRange.containsPosition(opA.targetPosition)) {\n                    this._setRelation(opA, opB, 'insertAtSource');\n                }\n                else if (opA.targetPosition.isEqual(opB.deletionPosition)) {\n                    this._setRelation(opA, opB, 'insertBetween');\n                }\n                else if (opA.targetPosition.isAfter(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'moveTargetAfter');\n                }\n                else if (opA.howMany > 1 && opA.sourcePosition.isEqual(opB.deletionPosition)) {\n                    this._setRelation(opA, opB, 'firstToMoveMerged');\n                }\n                else if (opA.howMany > 1 && opA.sourcePosition.getShiftedBy(opA.howMany - 1).isEqual(opB.deletionPosition)) {\n                    this._setRelation(opA, opB, 'lastToMoveMerged');\n                }\n            }\n            else if (opB instanceof MoveOperation) {\n                if (opA.targetPosition.isEqual(opB.sourcePosition) || opA.targetPosition.isBefore(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'insertBefore');\n                }\n                else {\n                    this._setRelation(opA, opB, 'insertAfter');\n                }\n            }\n        }\n        else if (opA instanceof SplitOperation) {\n            if (opB instanceof MergeOperation) {\n                if (opA.splitPosition.isBefore(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'splitBefore');\n                }\n            }\n            else if (opB instanceof MoveOperation) {\n                if (opA.splitPosition.isEqual(opB.sourcePosition) || opA.splitPosition.isBefore(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'splitBefore');\n                }\n                else {\n                    const range = ModelRange._createFromPositionAndShift(opB.sourcePosition, opB.howMany);\n                    if (opA.splitPosition.hasSameParentAs(opB.sourcePosition) && range.containsPosition(opA.splitPosition)) {\n                        // TODO: Potential bug -- we are saving offset value directly and it is not later updated during OT.\n                        // TODO: This may cause a bug it here was an non-undone operation that may have impacted this offset.\n                        // TODO: Similar error was with MarkerOperation relations, where full path was saved and never updated.\n                        const howMany = range.end.offset - opA.splitPosition.offset;\n                        const offset = opA.splitPosition.offset - range.start.offset;\n                        this._setRelation(opA, opB, { howMany, offset });\n                    }\n                }\n            }\n        }\n        else if (opA instanceof MergeOperation) {\n            if (opB instanceof MergeOperation) {\n                if (!opA.targetPosition.isEqual(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'mergeTargetNotMoved');\n                }\n                if (opA.sourcePosition.isEqual(opB.targetPosition)) {\n                    this._setRelation(opA, opB, 'mergeSourceNotMoved');\n                }\n                if (opA.sourcePosition.isEqual(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'mergeSameElement');\n                }\n            }\n            else if (opB instanceof SplitOperation) {\n                if (opA.sourcePosition.isEqual(opB.splitPosition)) {\n                    this._setRelation(opA, opB, 'splitAtSource');\n                }\n            }\n            else if (opB instanceof MoveOperation && opB.howMany > 0) {\n                if (opA.sourcePosition.isEqual(opB.sourcePosition.getShiftedBy(opB.howMany))) {\n                    this._setRelation(opA, opB, 'mergeSourceAffected');\n                }\n                if (opA.targetPosition.isEqual(opB.sourcePosition)) {\n                    this._setRelation(opA, opB, 'mergeTargetWasBefore');\n                }\n            }\n        }\n        else if (opA instanceof MarkerOperation) {\n            const markerRange = opA.newRange;\n            if (!markerRange) {\n                return;\n            }\n            if (opB instanceof MergeOperation) {\n                const wasInLeftElement = markerRange.start.isEqual(opB.targetPosition);\n                const wasStartBeforeMergedElement = markerRange.start.isEqual(opB.deletionPosition);\n                const wasEndBeforeMergedElement = markerRange.end.isEqual(opB.deletionPosition);\n                const wasInRightElement = markerRange.end.isEqual(opB.sourcePosition);\n                if (wasInLeftElement || wasStartBeforeMergedElement || wasEndBeforeMergedElement || wasInRightElement) {\n                    this._setRelation(opA, opB, {\n                        wasInLeftElement,\n                        wasStartBeforeMergedElement,\n                        wasEndBeforeMergedElement,\n                        wasInRightElement\n                    });\n                }\n            }\n        }\n    }\n    /**\n     * Evaluates and returns contextual information about two given operations `opA` and `opB` which are about to be transformed.\n     */\n    getContext(opA, opB, aIsStrong) {\n        return {\n            aIsStrong,\n            aWasUndone: this._wasUndone(opA),\n            bWasUndone: this._wasUndone(opB),\n            abRelation: this._useRelations ? this._getRelation(opA, opB) : null,\n            baRelation: this._useRelations ? this._getRelation(opB, opA) : null,\n            forceWeakRemove: this._forceWeakRemove\n        };\n    }\n    /**\n     * Returns whether given operation `op` has already been undone.\n     *\n     * Information whether an operation was undone gives more context when making a decision when two operations are in conflict.\n     */\n    _wasUndone(op) {\n        // For `op`, get its original operation. After all, if `op` is a clone (or even transformed clone) of another\n        // operation, literally `op` couldn't be undone. It was just generated. If anything, it was the operation it origins\n        // from which was undone. So get that original operation.\n        const originalOp = this.originalOperations.get(op);\n        // And check with the document if the original operation was undone.\n        return originalOp.wasUndone || this._history.isUndoneOperation(originalOp);\n    }\n    /**\n     * Returns a relation between `opA` and an operation which is undone by `opB`. This can be `String` value if a relation\n     * was set earlier or `null` if there was no relation between those operations.\n     *\n     * This is a little tricky to understand, so let's compare it to `ContextFactory#_wasUndone`.\n     *\n     * When `wasUndone( opB )` is used, we check if the `opB` has already been undone. It is obvious, that the\n     * undoing operation must happen after the undone operation. So, essentially, we have `opB`, we take document history,\n     * we look forward in the future and ask if in that future `opB` was undone.\n     *\n     * Relations is a backward process to `wasUndone()`.\n     *\n     * Long story short - using relations is asking what happened in the past. Looking back. This time we have an undoing\n     * operation `opB` which has undone some other operation. When there is a transformation `opA` x `opB` and there is\n     * a conflict to solve and `opB` is an undoing operation, we can look back in the history and see what was a relation\n     * between `opA` and the operation which `opB` undone. Basing on that relation from the past, we can now make\n     * a better decision when resolving a conflict between two operations, because we know more about the context of\n     * those two operations.\n     *\n     * This is why this function does not return a relation directly between `opA` and `opB` because we need to look\n     * back to search for a meaningful contextual information.\n     */\n    _getRelation(opA, opB) {\n        // Get the original operation. Similarly as in `wasUndone()` it is used as an universal identifier for stored data.\n        const origB = this.originalOperations.get(opB);\n        const undoneB = this._history.getUndoneOperation(origB);\n        // If `opB` is not undoing any operation, there is no relation.\n        if (!undoneB) {\n            return null;\n        }\n        const origA = this.originalOperations.get(opA);\n        const relationsA = this._relations.get(origA);\n        // Get all relations for `opA`, and check if there is a relation with `opB`-undone-counterpart. If so, return it.\n        if (relationsA) {\n            return relationsA.get(undoneB) || null;\n        }\n        return null;\n    }\n    /**\n     * Helper function for `ContextFactory#updateRelations`.\n     */\n    _setRelation(opA, opB, relation) {\n        // As always, setting is for original operations, not the clones/transformed operations.\n        const origA = this.originalOperations.get(opA);\n        const origB = this.originalOperations.get(opB);\n        let relationsA = this._relations.get(origA);\n        if (!relationsA) {\n            relationsA = new Map();\n            this._relations.set(origA, relationsA);\n        }\n        relationsA.set(origB, relation);\n    }\n}\n/**\n * An utility function that updates {@link module:engine/model/operation/operation~Operation#baseVersion base versions}\n * of passed operations.\n *\n * The function simply sets `baseVersion` as a base version of the first passed operation and then increments it for\n * each following operation in `operations`.\n *\n * @param operations Operations to update.\n * @param baseVersion Base version to set for the first operation in `operations`.\n */\nfunction updateBaseVersions(operations, baseVersion) {\n    for (const operation of operations) {\n        operation.baseVersion = baseVersion++;\n    }\n}\n/**\n * Adds `howMany` instances of {@link module:engine/model/operation/nooperation~NoOperation} to `operations` set.\n */\nfunction padWithNoOps(operations, howMany) {\n    for (let i = 0; i < howMany; i++) {\n        operations.push(new NoOperation(0));\n    }\n}\n/**\n * Transformed operations set may include marker operations which were broken into multiple marker operations during transformation.\n * It represents marker range being broken into multiple pieces as the transformation was processed. Each partial marker operation is\n * a piece of the original marker range.\n *\n * These partial marker operations (\"marker range pieces\") should be \"glued\" together if, after transformations, the ranges ended up\n * next to each other.\n *\n * If the ranges did not end up next to each other, then partial marker operations should be discarded, as the marker range cannot\n * be broken into two pieces.\n *\n * There is always one \"reference\" marker operation (the original operation) and there may be some partial marker operations. Partial\n * marker operations have base version set to `-1`. If the `operations` set includes partial marker operations, then they are always\n * after the original marker operation.\n *\n * See also `MarkerOperation` x `MoveOperation` transformation.\n * See also https://github.com/ckeditor/ckeditor5/pull/17071.\n */\nfunction handlePartialMarkerOperations(operations) {\n    const markerOps = new Map();\n    for (let i = 0; i < operations.length; i++) {\n        const op = operations[i];\n        if (!(op instanceof MarkerOperation)) {\n            continue;\n        }\n        if (op.baseVersion !== -1) {\n            markerOps.set(op.name, {\n                op,\n                ranges: op.newRange ? [op.newRange] : []\n            });\n        }\n        else {\n            if (op.newRange) {\n                // `markerOps.get( op.name )` must exist because original marker operation is always before partial marker operations.\n                // If the original marker operation was changed to `NoOperation`, then the partial marker operations would be changed\n                // to `NoOperation` as well, so this is not a case.\n                markerOps.get(op.name).ranges.push(op.newRange);\n            }\n            operations.splice(i, 1);\n            i--;\n        }\n    }\n    for (const { op, ranges } of markerOps.values()) {\n        if (ranges.length) {\n            op.newRange = ModelRange._createFromRanges(ranges);\n        }\n        else {\n            op.newRange = null;\n        }\n    }\n}\n// -----------------------\nsetTransformation(AttributeOperation, AttributeOperation, (a, b, context) => {\n    // If operations in conflict, check if their ranges intersect and manage them properly.\n    //\n    // Operations can be in conflict only if:\n    //\n    // * their key is the same (they change the same attribute), and\n    // * they are in the same parent (operations for ranges [ 1 ] - [ 3 ] and [ 2, 0 ] - [ 2, 5 ] change different\n    // elements and can't be in conflict).\n    if (a.key === b.key && a.range.start.hasSameParentAs(b.range.start)) {\n        // First, we want to apply change to the part of a range that has not been changed by the other operation.\n        const operations = a.range.getDifference(b.range).map(range => {\n            return new AttributeOperation(range, a.key, a.oldValue, a.newValue, 0);\n        });\n        // Then we take care of the common part of ranges.\n        const common = a.range.getIntersection(b.range);\n        if (common) {\n            // If this operation is more important, we also want to apply change to the part of the\n            // original range that has already been changed by the other operation. Since that range\n            // got changed we also have to update `oldValue`.\n            if (context.aIsStrong) {\n                operations.push(new AttributeOperation(common, b.key, b.newValue, a.newValue, 0));\n            }\n        }\n        if (operations.length == 0) {\n            return [new NoOperation(0)];\n        }\n        return operations;\n    }\n    else {\n        // If operations don't conflict, simply return an array containing just a clone of this operation.\n        return [a];\n    }\n});\nsetTransformation(AttributeOperation, InsertOperation, (a, b) => {\n    // Case 1:\n    //\n    // The attribute operation range includes the position where nodes were inserted.\n    // There are two possible scenarios: the inserted nodes were text and they should receive attributes or\n    // the inserted nodes were elements and they should not receive attributes.\n    //\n    if (a.range.start.hasSameParentAs(b.position) && a.range.containsPosition(b.position)) {\n        // If new nodes should not receive attributes, two separated ranges will be returned.\n        // Otherwise, one expanded range will be returned.\n        const range = a.range._getTransformedByInsertion(b.position, b.howMany, !b.shouldReceiveAttributes);\n        const result = range.map(r => {\n            return new AttributeOperation(r, a.key, a.oldValue, a.newValue, a.baseVersion);\n        });\n        if (b.shouldReceiveAttributes) {\n            // `AttributeOperation#range` includes some newly inserted text.\n            // The operation should also change the attribute of that text. An example:\n            //\n            // Bold should be applied on the following range:\n            // <p>Fo[zb]ar</p>\n            //\n            // In meantime, new text is typed:\n            // <p>Fozxxbar</p>\n            //\n            // Bold should be applied also on the new text:\n            // <p>Fo[zxxb]ar</p>\n            // <p>Fo<$text bold=\"true\">zxxb</$text>ar</p>\n            //\n            // There is a special case to consider here to consider.\n            //\n            // Consider setting an attribute with multiple possible values, for example `highlight`. The inserted text might\n            // have already an attribute value applied and the `oldValue` property of the attribute operation might be wrong:\n            //\n            // Attribute `highlight=\"yellow\"` should be applied on the following range:\n            // <p>Fo[zb]ar<p>\n            //\n            // In meantime, character `x` with `highlight=\"red\"` is typed:\n            // <p>Fo[z<$text highlight=\"red\">x</$text>b]ar</p>\n            //\n            // In this case we cannot simply apply operation changing the attribute value from `null` to `\"yellow\"` for the whole range\n            // because that would lead to an exception (`oldValue` is incorrect for `x`).\n            //\n            // We also cannot break the original range as this would mess up a scenario when there are multiple following\n            // insert operations, because then only the first inserted character is included in those ranges:\n            // <p>Fo[z][x][b]ar</p>   -->   <p>Fo[z][x]x[b]ar</p>   -->   <p>Fo[z][x]xx[b]ar</p>\n            //\n            // So, the attribute range needs be expanded, no matter what attributes are set on the inserted nodes:\n            //\n            // <p>Fo[z<$text highlight=\"red\">x</$text>b]ar</p>      <--- Change from `null` to `yellow`, throwing an exception.\n            //\n            // But before that operation would be applied, we will add an additional attribute operation that will change\n            // attributes on the inserted nodes in a way which would make the original operation correct:\n            //\n            // <p>Fo[z{<$text highlight=\"red\">}x</$text>b]ar</p>    <--- Change range `{}` from `red` to `null`.\n            // <p>Fo[zxb]ar</p>                                     <--- Now change from `null` to `yellow` is completely fine.\n            //\n            // Generate complementary attribute operation. Be sure to add it before the original operation.\n            const op = _getComplementaryAttributeOperations(b, a.key, a.oldValue);\n            if (op) {\n                result.unshift(op);\n            }\n        }\n        // If nodes should not receive new attribute, we are done here.\n        return result;\n    }\n    // If insert operation is not expanding the attribute operation range, simply transform the range.\n    a.range = a.range._getTransformedByInsertion(b.position, b.howMany, false)[0];\n    return [a];\n});\n/**\n * Helper function for `AttributeOperation` x `InsertOperation` (and reverse) transformation.\n *\n * For given `insertOperation` it checks the inserted node if it has an attribute `key` set to a value different\n * than `newValue`. If so, it generates an `AttributeOperation` which changes the value of `key` attribute to `newValue`.\n */\nfunction _getComplementaryAttributeOperations(insertOperation, key, newValue) {\n    const nodes = insertOperation.nodes;\n    // At the beginning we store the attribute value from the first node.\n    const insertValue = nodes.getNode(0).getAttribute(key);\n    if (insertValue == newValue) {\n        return null;\n    }\n    const range = new ModelRange(insertOperation.position, insertOperation.position.getShiftedBy(insertOperation.howMany));\n    return new AttributeOperation(range, key, insertValue, newValue, 0);\n}\nsetTransformation(AttributeOperation, MergeOperation, (a, b) => {\n    const ranges = [];\n    // Case 1:\n    //\n    // Attribute change on the merged element. In this case, the merged element was moved to the graveyard.\n    // An additional attribute operation that will change the (re)moved element needs to be generated.\n    //\n    if (a.range.start.hasSameParentAs(b.deletionPosition)) {\n        if (a.range.containsPosition(b.deletionPosition) || a.range.start.isEqual(b.deletionPosition)) {\n            ranges.push(ModelRange._createFromPositionAndShift(b.graveyardPosition, 1));\n        }\n    }\n    const range = a.range._getTransformedByMergeOperation(b);\n    // Do not add empty (collapsed) ranges to the result. `range` may be collapsed if it contained only the merged element.\n    if (!range.isCollapsed) {\n        ranges.push(range);\n    }\n    // Create `AttributeOperation`s out of the ranges.\n    return ranges.map(range => {\n        return new AttributeOperation(range, a.key, a.oldValue, a.newValue, a.baseVersion);\n    });\n});\nsetTransformation(AttributeOperation, MoveOperation, (a, b) => {\n    const ranges = _breakRangeByMoveOperation(a.range, b);\n    // Create `AttributeOperation`s out of the ranges.\n    return ranges.map(range => new AttributeOperation(range, a.key, a.oldValue, a.newValue, a.baseVersion));\n});\n/**\n * Helper function for `AttributeOperation` x `MoveOperation` transformation.\n *\n * Takes the passed `range` and transforms it by move operation `moveOp` in a specific way. Only top-level nodes of `range`\n * are considered to be in the range. If move operation moves nodes deep from inside of the range, those nodes won't\n * be included in the result. In other words, top-level nodes of the ranges from the result are exactly the same as\n * top-level nodes of the original `range`.\n *\n * This is important for `AttributeOperation` because, for its range, it changes only the top-level nodes. So we need to\n * track only how those nodes have been affected by `MoveOperation`.\n */\nfunction _breakRangeByMoveOperation(range, moveOp) {\n    const moveRange = ModelRange._createFromPositionAndShift(moveOp.sourcePosition, moveOp.howMany);\n    // We are transforming `range` (original range) by `moveRange` (range moved by move operation). As usual when it comes to\n    // transforming a ranges, we may have a common part of the ranges and we may have a difference part (zero to two ranges).\n    let common = null;\n    let difference = [];\n    // Let's compare the ranges.\n    if (moveRange.containsRange(range, true)) {\n        // If the whole original range is moved, treat it whole as a common part. There's also no difference part.\n        common = range;\n    }\n    else if (range.start.hasSameParentAs(moveRange.start)) {\n        // If the ranges are \"on the same level\" (in the same parent) then move operation may move exactly those nodes\n        // that are changed by the attribute operation. In this case we get common part and difference part in the usual way.\n        difference = range.getDifference(moveRange);\n        common = range.getIntersection(moveRange);\n    }\n    else {\n        // In any other situation we assume that original range is different than move range, that is that move operation\n        // moves other nodes that attribute operation change. Even if the moved range is deep inside in the original range.\n        //\n        // Note that this is different than in `.getIntersection` (we would get a common part in that case) and different\n        // than `.getDifference` (we would get two ranges).\n        difference = [range];\n    }\n    const result = [];\n    // The default behaviour of `_getTransformedByMove` might get wrong results for difference part, though, so\n    // we do it by hand.\n    for (let diff of difference) {\n        // First, transform the range by removing moved nodes. Since this is a difference, this is safe, `null` won't be returned\n        // as the range is different than the moved range.\n        diff = diff._getTransformedByDeletion(moveOp.sourcePosition, moveOp.howMany);\n        // Transform also `targetPosition`.\n        const targetPosition = moveOp.getMovedRangeStart();\n        // Spread the range only if moved nodes are inserted only between the top-level nodes of the `diff` range.\n        const spread = diff.start.hasSameParentAs(targetPosition);\n        // Transform by insertion of moved nodes.\n        const diffs = diff._getTransformedByInsertion(targetPosition, moveOp.howMany, spread);\n        result.push(...diffs);\n    }\n    // Common part can be simply transformed by the move operation. This is because move operation will not target to\n    // that common part (the operation would have to target inside its own moved range).\n    if (common) {\n        result.push(common._getTransformedByMove(moveOp.sourcePosition, moveOp.targetPosition, moveOp.howMany, false)[0]);\n    }\n    return result;\n}\nsetTransformation(AttributeOperation, SplitOperation, (a, b) => {\n    // Case 1:\n    //\n    // Split node is the last node in `AttributeOperation#range`.\n    // `AttributeOperation#range` needs to be expanded to include the new (split) node.\n    //\n    // Attribute `type` to be changed to `numbered` but the `listItem` is split.\n    // <listItem type=\"bulleted\">foobar</listItem>\n    //\n    // After split:\n    // <listItem type=\"bulleted\">foo</listItem><listItem type=\"bulleted\">bar</listItem>\n    //\n    // After attribute change:\n    // <listItem type=\"numbered\">foo</listItem><listItem type=\"numbered\">foo</listItem>\n    //\n    if (a.range.end.isEqual(b.insertionPosition)) {\n        if (!b.graveyardPosition) {\n            a.range.end.offset++;\n        }\n        return [a];\n    }\n    // Case 2:\n    //\n    // Split position is inside `AttributeOperation#range`, at the same level, so the nodes to change are\n    // not going to make a flat range.\n    //\n    // Content with range-to-change and split position:\n    // <p>Fo[zb^a]r</p>\n    //\n    // After split:\n    // <p>Fozb</p><p>ar</p>\n    //\n    // Make two separate ranges containing all nodes to change:\n    // <p>Fo[zb]</p><p>[a]r</p>\n    //\n    if (a.range.start.hasSameParentAs(b.splitPosition) && a.range.containsPosition(b.splitPosition)) {\n        const secondPart = a.clone();\n        secondPart.range = new ModelRange(b.moveTargetPosition.clone(), a.range.end._getCombined(b.splitPosition, b.moveTargetPosition));\n        a.range.end = b.splitPosition.clone();\n        a.range.end.stickiness = 'toPrevious';\n        return [a, secondPart];\n    }\n    // The default case.\n    //\n    a.range = a.range._getTransformedBySplitOperation(b);\n    return [a];\n});\nsetTransformation(InsertOperation, AttributeOperation, (a, b) => {\n    const result = [a];\n    // Case 1:\n    //\n    // The attribute operation range includes the position where nodes were inserted.\n    // There are two possible scenarios: the inserted nodes were text and they should receive attributes or\n    // the inserted nodes were elements and they should not receive attributes.\n    //\n    // This is a mirror scenario to the one described in `AttributeOperation` x `InsertOperation` transformation,\n    // although this case is a little less complicated. In this case we simply need to change attributes of the\n    // inserted nodes and that's it.\n    //\n    if (a.shouldReceiveAttributes && a.position.hasSameParentAs(b.range.start) && b.range.containsPosition(a.position)) {\n        const op = _getComplementaryAttributeOperations(a, b.key, b.newValue);\n        if (op) {\n            result.push(op);\n        }\n    }\n    // The default case is: do nothing.\n    // `AttributeOperation` does not change the model tree structure so `InsertOperation` does not need to be changed.\n    //\n    return result;\n});\nsetTransformation(InsertOperation, InsertOperation, (a, b, context) => {\n    // Case 1:\n    //\n    // Two insert operations insert nodes at the same position. Since they are the same, it needs to be decided\n    // what will be the order of inserted nodes. However, there is no additional information to help in that\n    // decision. Also, when `b` will be transformed by `a`, the same order must be maintained.\n    //\n    // To achieve that, we will check if the operation is strong.\n    // If it is, it won't get transformed. If it is not, it will be moved.\n    //\n    if (a.position.isEqual(b.position) && context.aIsStrong) {\n        return [a];\n    }\n    // The default case.\n    //\n    a.position = a.position._getTransformedByInsertOperation(b);\n    return [a];\n});\nsetTransformation(InsertOperation, MoveOperation, (a, b) => {\n    // The default case.\n    //\n    a.position = a.position._getTransformedByMoveOperation(b);\n    return [a];\n});\nsetTransformation(InsertOperation, SplitOperation, (a, b) => {\n    // The default case.\n    //\n    a.position = a.position._getTransformedBySplitOperation(b);\n    return [a];\n});\nsetTransformation(InsertOperation, MergeOperation, (a, b) => {\n    a.position = a.position._getTransformedByMergeOperation(b);\n    return [a];\n});\n// -----------------------\nsetTransformation(MarkerOperation, InsertOperation, (a, b) => {\n    if (a.oldRange) {\n        a.oldRange = a.oldRange._getTransformedByInsertOperation(b)[0];\n    }\n    if (a.newRange) {\n        a.newRange = a.newRange._getTransformedByInsertOperation(b)[0];\n    }\n    return [a];\n});\nsetTransformation(MarkerOperation, MarkerOperation, (a, b, context) => {\n    if (a.name == b.name) {\n        if (context.aIsStrong) {\n            a.oldRange = b.newRange ? b.newRange.clone() : null;\n        }\n        else {\n            return [new NoOperation(0)];\n        }\n    }\n    return [a];\n});\nsetTransformation(MarkerOperation, MergeOperation, (a, b) => {\n    if (a.oldRange) {\n        a.oldRange = a.oldRange._getTransformedByMergeOperation(b);\n    }\n    if (a.newRange) {\n        a.newRange = a.newRange._getTransformedByMergeOperation(b);\n    }\n    return [a];\n});\nsetTransformation(MarkerOperation, MoveOperation, (a, b) => {\n    const result = [a];\n    if (a.oldRange) {\n        a.oldRange = ModelRange._createFromRanges(a.oldRange._getTransformedByMoveOperation(b));\n    }\n    if (a.newRange) {\n        // In many simple cases the marker range will be kept integral after the transformation. For example, if some nodes\n        // were inserted before the range, or into the range, then the marker range is not broken into two.\n        //\n        // However, if some nodes are taken out of the range and moved somewhere else, or are moved into the range, then the marker\n        // range is \"broken\" into two or three pieces, and these pieces must be transformed and updated separately.\n        //\n        // When the marker range is transformed by move operation, as a result we get an array with one (simple case) or multiple\n        // (\"broken range\" case) ranges.\n        const ranges = a.newRange._getTransformedByMoveOperation(b);\n        a.newRange = ranges[0];\n        // If there are multiple ranges, we will create separate marker operations for each piece of the original marker range.\n        // Since they will be marker operations, they will be processed through the transformation process.\n        //\n        // However, we cannot create multiple ranges for the same marker (for the same marker name). A marker has only one range.\n        // So, we cannot really have multiple marker operations for the same marker. We will keep the track of the separate marker\n        // operations to see, if after all transformations, the marker pieces are next to each other or not. If so, we will glue\n        // them together to the original marker operation (`a`). If not, we will discard them. These extra operations will never\n        // be executed, as they will only exist temporarily during the transformation process.\n        //\n        // We will call these additional marker operations \"partial marker operations\" and we will mark them with negative base version.\n        //\n        // See also `handlePartialMarkerOperations()`.\n        // See also https://github.com/ckeditor/ckeditor5/pull/17071.\n        //\n        for (let i = 1; i < ranges.length; i++) {\n            const op = a.clone();\n            op.oldRange = null;\n            op.newRange = ranges[i];\n            op.baseVersion = -1;\n            result.push(op);\n        }\n    }\n    return result;\n});\nsetTransformation(MarkerOperation, SplitOperation, (a, b, context) => {\n    if (a.oldRange) {\n        a.oldRange = a.oldRange._getTransformedBySplitOperation(b);\n    }\n    if (a.newRange) {\n        if (context.abRelation) {\n            // If we have context, it means that there was previously a merge operation which transformed this marker operation, and that\n            // merge operation was then undone, and this split operation should reverse the marker to state before the merge operation.\n            const aNewRange = a.newRange._getTransformedBySplitOperation(b);\n            if (a.newRange.start.isEqual(b.splitPosition)) {\n                // If marker range start is same as split position, we need to decide where marker start should be placed, as there\n                // are three possible options.\n                //\n                if (context.abRelation.wasStartBeforeMergedElement) {\n                    // If the marker start was initially before the merged element, move it back to that place.\n                    //\n                    // <p>Foo</p>[<p>Bar]</p>  -- merge ->  <p>Foo[Bar]</p>  -- default split ->  <p>Foo</p><p>[Bar]</p>\n                    // <p>Foo</p>[<p>Bar]</p>  -- merge ->  <p>Foo[Bar]</p>  --- fixed split -->  <p>Foo</p>[<p>Bar]</p>\n                    //\n                    a.newRange.start = ModelPosition._createAt(b.insertionPosition);\n                }\n                else if (context.abRelation.wasInLeftElement) {\n                    // If the marker start was initially in the \"left\" element, keep the start position there.\n                    //\n                    // <p>Foo[</p><p>Bar]</p>  -- merge ->  <p>Foo[Bar]</p>  -- default split ->  <p>Foo</p><p>[Bar]</p>\n                    // <p>Foo[</p><p>Bar]</p>  -- merge ->  <p>Foo[Bar]</p>  --- fixed split -->  <p>Foo[</p><p>Bar]</p>\n                    //\n                    a.newRange.start = ModelPosition._createAt(a.newRange.start);\n                }\n                else {\n                    // Finally, the start position must have been at the beginning of the \"right\" (merged) element.\n                    // In this case, move it back to the \"right\" element.\n                    //\n                    // Note, that this what the default transformation (`_getTransformedBySplitOperation()`) does, BUT ONLY for\n                    // a non-collapsed marker. For a collapsed marker, by default, the whole marker is kept at the split position,\n                    // which would be incorrect. This is why this case is needed, and why we don't use `aNewRange.start` here.\n                    //\n                    // <p>Foo</p><p>[]Bar</p>  -- merge ->  <p>Foo[]Bar</p>  -- default split ->  <p>Foo[]</p><p>Bar</p>\n                    // <p>Foo</p><p>[]Bar</p>  -- merge ->  <p>Foo[]Bar</p>  --- fixed split -->  <p>Foo</p><p>[]Bar</p>\n                    //\n                    a.newRange.start = ModelPosition._createAt(b.moveTargetPosition);\n                }\n            }\n            else {\n                // If marker range start is not the same as split position, simply use the default transformation, as there is no\n                // ambiguity in this case.\n                a.newRange.start = aNewRange.start;\n            }\n            if (a.newRange.end.isEqual(b.splitPosition)) {\n                // If marker range end is same as split position, we need to decide where marker end should be placed, as there\n                // are three possible options.\n                //\n                if (a.newRange.end.isEqual(b.splitPosition) && context.abRelation.wasEndBeforeMergedElement) {\n                    // If the marker end was initially before the merged element, move it back to that place.\n                    //\n                    // <p>[Foo</p>]<p>Bar</p>  -- merge ->  <p>[Foo]Bar</p>  -- default split ->  <p>[Foo]</p><p>Bar</p>\n                    // <p>[Foo</p>]<p>Bar</p>  -- merge ->  <p>[Foo]Bar</p>  --- fixed split -->  <p>[Foo</p>]<p>Bar</p>\n                    //\n                    a.newRange.end = ModelPosition._createAt(b.insertionPosition);\n                }\n                else if (context.abRelation.wasInRightElement) {\n                    // If the marker was initially in the \"right\" element, keep the end position there.\n                    //\n                    // <p>[Foo</p><p>]Bar</p>  -- merge ->  <p>[Foo]Bar</p>  -- default split ->  <p>[Foo]</p><p>Bar</p>\n                    // <p>[Foo</p><p>]Bar</p>  -- merge ->  <p>[Foo]Bar</p>  --- fixed split -->  <p>[Foo</p><p>]Bar</p>\n                    //\n                    a.newRange.end = ModelPosition._createAt(b.moveTargetPosition);\n                }\n                else {\n                    // Finally, the end position must have been at the end of the \"left\" (merged) element.\n                    // In this case, keep it where it is.\n                    //\n                    // Note, that this is what the default transformation does, so we could use `aNewRange.end`, but this is more clear.\n                    //\n                    a.newRange.end = ModelPosition._createAt(a.newRange.end);\n                }\n            }\n            else {\n                // If marker range end is not the same as split position, simply use the default transformation, as there is no\n                // ambiguity in this case.\n                a.newRange.end = aNewRange.end;\n            }\n            return [a];\n        }\n        a.newRange = a.newRange._getTransformedBySplitOperation(b);\n    }\n    return [a];\n});\n// -----------------------\nsetTransformation(MergeOperation, InsertOperation, (a, b) => {\n    if (a.sourcePosition.hasSameParentAs(b.position)) {\n        a.howMany += b.howMany;\n    }\n    a.sourcePosition = a.sourcePosition._getTransformedByInsertOperation(b);\n    a.targetPosition = a.targetPosition._getTransformedByInsertOperation(b);\n    return [a];\n});\nsetTransformation(MergeOperation, MergeOperation, (a, b, context) => {\n    // Case 1:\n    //\n    // Same merge operations.\n    //\n    // Both operations have same source and target positions. So the element already got merged and there is\n    // theoretically nothing to do.\n    //\n    if (a.sourcePosition.isEqual(b.sourcePosition) && a.targetPosition.isEqual(b.targetPosition)) {\n        // There are two ways that we can provide a do-nothing operation.\n        //\n        // First is simply a NoOperation instance. We will use it if `b` operation was not undone.\n        //\n        // Second is a merge operation that has the source operation in the merged element - in the graveyard -\n        // same target position and `howMany` equal to `0`. So it is basically merging an empty element from graveyard\n        // which is almost the same as NoOperation.\n        //\n        // This way the merge operation can be later transformed by split operation\n        // to provide correct undo. This will be used if `b` operation was undone (only then it is correct).\n        //\n        if (!context.bWasUndone) {\n            return [new NoOperation(0)];\n        }\n        else {\n            const path = b.graveyardPosition.path.slice();\n            path.push(0);\n            a.sourcePosition = new ModelPosition(b.graveyardPosition.root, path);\n            a.howMany = 0;\n            return [a];\n        }\n    }\n    // Case 2:\n    //\n    // Same merge source position but different target position.\n    //\n    // This can happen during collaboration. For example, if one client merged a paragraph to the previous paragraph\n    // and the other person removed that paragraph and merged the same paragraph to something before:\n    //\n    // Client A:\n    // <p>Foo</p><p>Bar</p><p>[]Xyz</p>\n    // <p>Foo</p><p>BarXyz</p>\n    //\n    // Client B:\n    // <p>Foo</p>[<p>Bar</p>]<p>Xyz</p>\n    // <p>Foo</p><p>[]Xyz</p>\n    // <p>FooXyz</p>\n    //\n    // In this case we need to decide where finally \"Xyz\" will land:\n    //\n    // <p>FooXyz</p>               graveyard: <p>Bar</p>\n    // <p>Foo</p>                  graveyard: <p>BarXyz</p>\n    //\n    // Let's move it in a way so that a merge operation that does not target to graveyard is more important so that\n    // nodes does not end up in the graveyard. It makes sense. Both for Client A and for Client B \"Xyz\" finally did not\n    // end up in the graveyard (see above).\n    //\n    // If neither or both operations point to graveyard, then let `aIsStrong` decide.\n    //\n    if (a.sourcePosition.isEqual(b.sourcePosition) && !a.targetPosition.isEqual(b.targetPosition) &&\n        !context.bWasUndone && context.abRelation != 'splitAtSource') {\n        const aToGraveyard = a.targetPosition.root.rootName == '$graveyard';\n        const bToGraveyard = b.targetPosition.root.rootName == '$graveyard';\n        // If `aIsWeak` it means that `a` points to graveyard while `b` doesn't. Don't move nodes then.\n        const aIsWeak = aToGraveyard && !bToGraveyard;\n        // If `bIsWeak` it means that `b` points to graveyard while `a` doesn't. Force moving nodes then.\n        const bIsWeak = bToGraveyard && !aToGraveyard;\n        // Force move if `b` is weak or neither operation is weak but `a` is stronger through `context.aIsStrong`.\n        const forceMove = bIsWeak || (!aIsWeak && context.aIsStrong);\n        if (forceMove) {\n            const sourcePosition = b.targetPosition._getTransformedByMergeOperation(b);\n            const targetPosition = a.targetPosition._getTransformedByMergeOperation(b);\n            return [new MoveOperation(sourcePosition, a.howMany, targetPosition, 0)];\n        }\n        else {\n            return [new NoOperation(0)];\n        }\n    }\n    // The default case.\n    // TODO: Possibly, there's a missing case for same `targetPosition` but different `sourcePosition`.\n    //\n    if (a.sourcePosition.hasSameParentAs(b.targetPosition)) {\n        a.howMany += b.howMany;\n    }\n    a.sourcePosition = a.sourcePosition._getTransformedByMergeOperation(b);\n    a.targetPosition = a.targetPosition._getTransformedByMergeOperation(b);\n    // Handle positions in graveyard.\n    // If graveyard positions are same and `a` operation is strong - do not transform.\n    if (!a.graveyardPosition.isEqual(b.graveyardPosition) || !context.aIsStrong) {\n        a.graveyardPosition = a.graveyardPosition._getTransformedByMergeOperation(b);\n    }\n    return [a];\n});\nsetTransformation(MergeOperation, MoveOperation, (a, b, context) => {\n    // Case 1:\n    //\n    // The element to merge got removed.\n    //\n    // Merge operation does support merging elements which are not siblings. So it would not be a problem\n    // from technical point of view. However, if the element was removed, the intention of the user deleting it\n    // was to have it all deleted, together with its children. From user experience point of view, moving back the\n    // removed nodes might be unexpected. This means that in this scenario we will block the merging.\n    //\n    // The exception to this rule would be if the remove operation was later undone.\n    //\n    const removedRange = ModelRange._createFromPositionAndShift(b.sourcePosition, b.howMany);\n    if (b.type == 'remove' && !context.bWasUndone) {\n        if (a.deletionPosition.hasSameParentAs(b.sourcePosition) && removedRange.containsPosition(a.sourcePosition)) {\n            return [new NoOperation(0)];\n        }\n    }\n    // In most cases we want `sourcePosition` to stick to previous and `targetPosition` to stick to next.\n    // Usually, `sourcePosition` is at the beginning of the merged element and `targetPosition` is at the end of the merge-target element.\n    //\n    // However, `sourcePosition` and `targetPosition` may end up in the middle of an element due to some OT magic that happens during undo.\n    // It is expected and used in `MergeOperation` x `SplitOperation` transformation.\n    //\n    // But when these positions are in the middle, it messes up the regular `MergeOperation` x `MoveOperation` transformation because\n    // these positions may \"follow\" some moved elements. And we want them stick in the original elements.\n    //\n    // This is why we add two extra cases: (1) and (2).\n    //\n    // But after this `MergeOperation` is transformed by \"this\" move (which is undone), we also need to define extra cases for\n    // the operation undoing previous move. These are (3) and (4).\n    //\n    // (1). Note that this case is also added to `updateRelations()` and sets `mergeSourceAffected` relation.\n    //\n    // [] is move operation, } is merge source position (sticks to previous by default):\n    // <p>A[b]}c</p>  ->  <p>A}c</p>\n    //\n    if (b.sourcePosition.getShiftedBy(b.howMany).isEqual(a.sourcePosition)) {\n        a.sourcePosition.stickiness = 'toNone';\n    }\n    // (3). This is the transformation for undoing operation of the above case.\n    //\n    // [] is move operation, } is merge source position (sticks to previous by default):\n    // <p>A}c</p>  ->  <p>A[b]}c</p>  (instead of <p>A}[b]c</p>)\n    //\n    else if (b.targetPosition.isEqual(a.sourcePosition) && context.abRelation == 'mergeSourceAffected') {\n        a.sourcePosition.stickiness = 'toNext';\n    }\n    // (2). Note that this case is also added to `updateRelations()` and sets `mergeTargetWasBefore` relation.\n    //\n    // [] is move operation, { is merge target position (sticks to next by default):\n    // <p>A{[b]c</p>  ->  <p>A{c</p>\n    //\n    else if (b.sourcePosition.isEqual(a.targetPosition)) {\n        a.targetPosition.stickiness = 'toNone';\n        a.howMany -= b.howMany;\n    }\n    // (4). This is the transformation for undoing operation of the above case.\n    //\n    // [] is move operation, { is merge target position (sticks to next by default):\n    // <p>A{c</p>  ->  <p>A{[b]c</p>  (instead of <p>A[b]{c</p>)\n    //\n    else if (b.targetPosition.isEqual(a.targetPosition) && context.abRelation == 'mergeTargetWasBefore') {\n        a.targetPosition.stickiness = 'toPrevious';\n        a.howMany += b.howMany;\n    }\n    // The default case.\n    else {\n        if (a.sourcePosition.hasSameParentAs(b.targetPosition)) {\n            a.howMany += b.howMany;\n        }\n        if (a.sourcePosition.hasSameParentAs(b.sourcePosition)) {\n            a.howMany -= b.howMany;\n        }\n    }\n    a.sourcePosition = a.sourcePosition._getTransformedByMoveOperation(b);\n    a.targetPosition = a.targetPosition._getTransformedByMoveOperation(b);\n    // After transformations are done, make sure to revert stickiness in case if (1) - (4) scenario happened.\n    a.sourcePosition.stickiness = 'toPrevious';\n    a.targetPosition.stickiness = 'toNext';\n    // `MergeOperation` graveyard position is like `MoveOperation` target position. It is a position where element(s) will\n    // be moved. Like in other similar cases, we need to consider the scenario when those positions are same.\n    // Here, we will treat `MergeOperation` like it is always strong (see `InsertOperation` x `InsertOperation` for comparison).\n    // This means that we won't transform graveyard position if it is equal to move operation target position.\n    if (!a.graveyardPosition.isEqual(b.targetPosition)) {\n        a.graveyardPosition = a.graveyardPosition._getTransformedByMoveOperation(b);\n    }\n    return [a];\n});\nsetTransformation(MergeOperation, SplitOperation, (a, b, context) => {\n    if (b.graveyardPosition) {\n        // If `b` operation defines graveyard position, a node from graveyard will be moved. This means that we need to\n        // transform `a.graveyardPosition` accordingly.\n        a.graveyardPosition = a.graveyardPosition._getTransformedByDeletion(b.graveyardPosition, 1);\n        // This is a scenario foreseen in `MergeOperation` x `MergeOperation`, with two identical merge operations.\n        //\n        // So, there was `MergeOperation` x `MergeOperation` transformation earlier. Now, `a` is a merge operation which\n        // source position is in graveyard. Interestingly, split operation wants to use the node to be merged by `a`. This\n        // means that `b` is undoing that merge operation from earlier, which caused `a` to be in graveyard.\n        //\n        // If that's the case, at this point, we will only \"fix\" `a.howMany`. It was earlier set to `0` in\n        // `MergeOperation` x `MergeOperation` transformation. Later transformations in this function will change other\n        // properties.\n        //\n        if (a.deletionPosition.isEqual(b.graveyardPosition)) {\n            a.howMany = b.howMany;\n        }\n    }\n    // Case 1:\n    //\n    // Merge operation moves nodes to the place where split happens.\n    //\n    // This is a classic situation when there are two paragraphs, and there is a split (enter) at the end of the first\n    // paragraph and there is a merge (delete) at the beginning of the second paragraph:\n    //\n    // <p>Foo{}</p><p>[]Bar</p>.\n    //\n    // User A presses enter after `Foo`, while User B presses backspace before `Bar`. It is intuitive that after both operations, the\n    // editor state should stay the same.\n    //\n    // State after split:\n    // <p>Foo</p><p></p><p>[]Bar</p>\n    //\n    // When this happens, `Bar` should be merged to the newly created paragraph, to maintain the editor state:\n    // <p>Foo</p><p>Bar</p>\n    //\n    // Another option is to merge into the original paragraph `Foo`, according to the `targetPosition`. This results in an incorrect state:\n    // <p>FooBar</p><p></p>\n    //\n    // Also, consider an example where User A also writes something in the new paragraph:\n    // <p>Foo</p><p>Xyz</p><p>[]Bar</p>\n    //\n    // In this case it is clear that merge should happen into `[ 1, 3 ]` not into `[ 0, 3 ]`. It first has to be transformed to `[ 1, 0 ]`,\n    // and then transformed be insertion into `[ 1, 3 ]`.\n    //\n    // So, usually we want to move `targetPosition` to the new paragraph when it is same as split position. This is how it is handled\n    // in the default transformation (`_getTransformedBySplitOperation()`). We don't need a special case for this.\n    //\n    // However, there are two exceptions, when we **do not** want to transform `targetPosition`, and we need a special case then.\n    //\n    // These exceptions happen only if undo is involved. During OT, above presented case (`<p>Foo{}</p><p>[]Bar</p>`) is the only way\n    // how `SplitOperation#splitPosition` and `MergeOperation#targetPosition` can be the same.\n    //\n    // First exception is when the element to merge is in the graveyard and split operation uses it. In that case\n    // if target position would be transformed, the merge operation would target at the source position:\n    //\n    // root: <p>Foo[]</p>\t\t\t\tgraveyard: <p></p>\n    //\n    // SplitOperation: root [ 0, 3 ] using graveyard [ 0 ] (howMany = 0)\n    // MergeOperation: graveyard [ 0, 0 ] -> root [ 0, 3 ] (howMany = 0)\n    //\n    // Since split operation moves the graveyard element back to the root (to path `[ 1 ]`), the merge operation `sourcePosition` changes.\n    // After split we have: `<p>Foo</p><p></p>`, so `sourcePosition` is `[ 1, 0 ]`. But if `targetPosition` is transformed, then it\n    // also becomes `[ 1, 0 ]`. In this case, we want to keep the `targetPosition` as it was.\n    //\n    // Second exception is connected strictly with undo relations. If this `MergeOperation` was earlier transformed by\n    // `MergeOperation` and we stored an information that earlier the target position was not affected, then here, when transforming by\n    // `SplitOperation` we are not going to change it as well.\n    //\n    // For these two cases we will only transform `sourcePosition` and return early.\n    //\n    // Note, that earlier there was also third special case here. `targetPosition` was not transformed, if it pointed into the middle of\n    // target element, not into its end (as usual). This can also happen only with undo involved. However, it wasn't always a correct\n    // solution, as in some cases we actually wanted to transform `targetPosition`. Also, this case usually happens together with the second\n    // case described above. There is only one scenario that we have in our unit tests, where this third case happened without second case.\n    // However, this scenario went fine no matter if we transformed `targetPosition` or not. That's because this happened in the middle\n    // of transformation process and the operation was correctly transformed later on.\n    //\n    if (a.targetPosition.isEqual(b.splitPosition)) {\n        const mergeSplittingElement = b.graveyardPosition && a.deletionPosition.isEqual(b.graveyardPosition);\n        if (mergeSplittingElement || context.abRelation == 'mergeTargetNotMoved') {\n            a.sourcePosition = a.sourcePosition._getTransformedBySplitOperation(b);\n            return [a];\n        }\n    }\n    // Case 2:\n    //\n    // Merge source is at the same position as split position. This sometimes happen, mostly during undo.\n    // The decision here is mostly to choose whether merge source position should stay where it is (so it will be at the end of the\n    // split element) or should be move to the beginning of the new element.\n    //\n    if (a.sourcePosition.isEqual(b.splitPosition)) {\n        // Use context to check if `SplitOperation` is not undoing a merge operation, that didn't change the `a` operation.\n        // This scenario happens the undone merge operation moved nodes at the source position of `a` operation.\n        // In that case `a` operation source position should stay where it is.\n        if (context.abRelation == 'mergeSourceNotMoved') {\n            a.howMany = 0;\n            a.targetPosition = a.targetPosition._getTransformedBySplitOperation(b);\n            return [a];\n        }\n        // This merge operation might have been earlier transformed by a merge operation which both merged the same element.\n        // See that case in `MergeOperation` x `MergeOperation` transformation. In that scenario, if the merge operation has been undone,\n        // the special case is not applied.\n        //\n        // Now, the merge operation is transformed by the split which has undone that previous merge operation.\n        // So now we are fixing situation which was skipped in `MergeOperation` x `MergeOperation` case.\n        //\n        if (context.abRelation == 'mergeSameElement' || a.sourcePosition.offset > 0) {\n            a.sourcePosition = b.moveTargetPosition.clone();\n            a.targetPosition = a.targetPosition._getTransformedBySplitOperation(b);\n            return [a];\n        }\n    }\n    // The default case.\n    //\n    if (a.sourcePosition.hasSameParentAs(b.splitPosition)) {\n        a.howMany = b.splitPosition.offset;\n    }\n    a.sourcePosition = a.sourcePosition._getTransformedBySplitOperation(b);\n    a.targetPosition = a.targetPosition._getTransformedBySplitOperation(b);\n    return [a];\n});\n// -----------------------\nsetTransformation(MoveOperation, InsertOperation, (a, b) => {\n    const moveRange = ModelRange._createFromPositionAndShift(a.sourcePosition, a.howMany);\n    const transformed = moveRange._getTransformedByInsertOperation(b, false)[0];\n    a.sourcePosition = transformed.start;\n    a.howMany = transformed.end.offset - transformed.start.offset;\n    // See `InsertOperation` x `MoveOperation` transformation for details on this case.\n    //\n    // In summary, both operations point to the same place, so the order of nodes needs to be decided.\n    // `MoveOperation` is considered weaker, so it is always transformed, unless there was a certain relation\n    // between operations.\n    //\n    if (!a.targetPosition.isEqual(b.position)) {\n        a.targetPosition = a.targetPosition._getTransformedByInsertOperation(b);\n    }\n    return [a];\n});\nsetTransformation(MoveOperation, MoveOperation, (a, b, context) => {\n    //\n    // Setting and evaluating some variables that will be used in special cases and default algorithm.\n    //\n    // Create ranges from `MoveOperations` properties.\n    const rangeA = ModelRange._createFromPositionAndShift(a.sourcePosition, a.howMany);\n    const rangeB = ModelRange._createFromPositionAndShift(b.sourcePosition, b.howMany);\n    // Assign `context.aIsStrong` to a different variable, because the value may change during execution of\n    // this algorithm and we do not want to override original `context.aIsStrong` that will be used in later transformations.\n    let aIsStrong = context.aIsStrong;\n    // This will be used to decide the order of nodes if both operations target at the same position.\n    // By default, use strong/weak operation mechanism.\n    let insertBefore = !context.aIsStrong;\n    // If the relation is set, then use it to decide nodes order.\n    if (context.abRelation == 'insertBefore' || context.baRelation == 'insertAfter') {\n        insertBefore = true;\n    }\n    else if (context.abRelation == 'insertAfter' || context.baRelation == 'insertBefore') {\n        insertBefore = false;\n    }\n    // `a.targetPosition` could be affected by the `b` operation. We will transform it.\n    let newTargetPosition;\n    if (a.targetPosition.isEqual(b.targetPosition) && insertBefore) {\n        newTargetPosition = a.targetPosition._getTransformedByDeletion(b.sourcePosition, b.howMany);\n    }\n    else {\n        newTargetPosition = a.targetPosition._getTransformedByMove(b.sourcePosition, b.targetPosition, b.howMany);\n    }\n    //\n    // Special case #1 + mirror.\n    //\n    // Special case when both move operations' target positions are inside nodes that are\n    // being moved by the other move operation. So in other words, we move ranges into inside of each other.\n    // This case can't be solved reasonably (on the other hand, it should not happen often).\n    if (_moveTargetIntoMovedRange(a, b) && _moveTargetIntoMovedRange(b, a)) {\n        // Instead of transforming operation, we return a reverse of the operation that we transform by.\n        // So when the results of this \"transformation\" will be applied, `b` MoveOperation will get reversed.\n        return [b.getReversed()];\n    }\n    //\n    // End of special case #1.\n    //\n    //\n    // Special case #2.\n    //\n    // Check if `b` operation targets inside `rangeA`.\n    const bTargetsToA = rangeA.containsPosition(b.targetPosition);\n    // If `b` targets to `rangeA` and `rangeA` contains `rangeB`, `b` operation has no influence on `a` operation.\n    // You might say that operation `b` is captured inside operation `a`.\n    if (bTargetsToA && rangeA.containsRange(rangeB, true)) {\n        // There is a mini-special case here, where `rangeB` is on other level than `rangeA`. That's why\n        // we need to transform `a` operation anyway.\n        rangeA.start = rangeA.start._getTransformedByMove(b.sourcePosition, b.targetPosition, b.howMany);\n        rangeA.end = rangeA.end._getTransformedByMove(b.sourcePosition, b.targetPosition, b.howMany);\n        return _makeMoveOperationsFromRanges([rangeA], newTargetPosition);\n    }\n    //\n    // Special case #2 mirror.\n    //\n    const aTargetsToB = rangeB.containsPosition(a.targetPosition);\n    if (aTargetsToB && rangeB.containsRange(rangeA, true)) {\n        // `a` operation is \"moved together\" with `b` operation.\n        // Here, just move `rangeA` \"inside\" `rangeB`.\n        rangeA.start = rangeA.start._getCombined(b.sourcePosition, b.getMovedRangeStart());\n        rangeA.end = rangeA.end._getCombined(b.sourcePosition, b.getMovedRangeStart());\n        return _makeMoveOperationsFromRanges([rangeA], newTargetPosition);\n    }\n    //\n    // End of special case #2.\n    //\n    //\n    // Special case #3 + mirror.\n    //\n    // `rangeA` has a node which is an ancestor of `rangeB`. In other words, `rangeB` is inside `rangeA`\n    // but not on the same tree level. In such case ranges have common part but we have to treat it\n    // differently, because in such case those ranges are not really conflicting and should be treated like\n    // two separate ranges. Also we have to discard two difference parts.\n    const aCompB = compareArrays(a.sourcePosition.getParentPath(), b.sourcePosition.getParentPath());\n    if (aCompB == 'prefix' || aCompB == 'extension') {\n        // Transform `rangeA` by `b` operation and make operation out of it, and that's all.\n        // Note that this is a simplified version of default case, but here we treat the common part (whole `rangeA`)\n        // like a one difference part.\n        rangeA.start = rangeA.start._getTransformedByMove(b.sourcePosition, b.targetPosition, b.howMany);\n        rangeA.end = rangeA.end._getTransformedByMove(b.sourcePosition, b.targetPosition, b.howMany);\n        return _makeMoveOperationsFromRanges([rangeA], newTargetPosition);\n    }\n    //\n    // End of special case #3.\n    //\n    //\n    // Default case - ranges are on the same level or are not connected with each other.\n    //\n    // Modifier for default case.\n    // Modifies `aIsStrong` flag in certain conditions.\n    //\n    // If only one of operations is a remove operation, we force remove operation to be the \"stronger\" one\n    // to provide more expected results.\n    if (a.type == 'remove' && b.type != 'remove' && !context.aWasUndone && !context.forceWeakRemove) {\n        aIsStrong = true;\n    }\n    else if (a.type != 'remove' && b.type == 'remove' && !context.bWasUndone && !context.forceWeakRemove) {\n        aIsStrong = false;\n    }\n    // Handle operation's source ranges - check how `rangeA` is affected by `b` operation.\n    // This will aggregate transformed ranges.\n    const ranges = [];\n    // Get the \"difference part\" of `a` operation source range.\n    // This is an array with one or two ranges. Two ranges if `rangeB` is inside `rangeA`.\n    const difference = rangeA.getDifference(rangeB);\n    for (const range of difference) {\n        // Transform those ranges by `b` operation. For example if `b` moved range from before those ranges, fix those ranges.\n        range.start = range.start._getTransformedByDeletion(b.sourcePosition, b.howMany);\n        range.end = range.end._getTransformedByDeletion(b.sourcePosition, b.howMany);\n        // If `b` operation targets into `rangeA` on the same level, spread `rangeA` into two ranges.\n        const shouldSpread = compareArrays(range.start.getParentPath(), b.getMovedRangeStart().getParentPath()) == 'same';\n        const newRanges = range._getTransformedByInsertion(b.getMovedRangeStart(), b.howMany, shouldSpread);\n        ranges.push(...newRanges);\n    }\n    // Then, we have to manage the \"common part\" of both move ranges.\n    const common = rangeA.getIntersection(rangeB);\n    if (common !== null && aIsStrong) {\n        // Calculate the new position of that part of original range.\n        common.start = common.start._getCombined(b.sourcePosition, b.getMovedRangeStart());\n        common.end = common.end._getCombined(b.sourcePosition, b.getMovedRangeStart());\n        // Take care of proper range order.\n        //\n        // Put `common` at appropriate place. Keep in mind that we are interested in original order.\n        // Basically there are only three cases: there is zero, one or two difference ranges.\n        //\n        // If there is zero difference ranges, just push `common` in the array.\n        if (ranges.length === 0) {\n            ranges.push(common);\n        }\n        // If there is one difference range, we need to check whether common part was before it or after it.\n        else if (ranges.length == 1) {\n            if (rangeB.start.isBefore(rangeA.start) || rangeB.start.isEqual(rangeA.start)) {\n                ranges.unshift(common);\n            }\n            else {\n                ranges.push(common);\n            }\n        }\n        // If there are more ranges (which means two), put common part between them. This is the only scenario\n        // where there could be two difference ranges so we don't have to make any comparisons.\n        else {\n            ranges.splice(1, 0, common);\n        }\n    }\n    if (ranges.length === 0) {\n        // If there are no \"source ranges\", nothing should be changed.\n        // Note that this can happen only if `aIsStrong == false` and `rangeA.isEqual( rangeB )`.\n        return [new NoOperation(a.baseVersion)];\n    }\n    return _makeMoveOperationsFromRanges(ranges, newTargetPosition);\n});\nsetTransformation(MoveOperation, SplitOperation, (a, b, context) => {\n    let newTargetPosition = a.targetPosition.clone();\n    // Do not transform if target position is same as split insertion position and this split comes from undo.\n    // This should be done on relations but it is too much work for now as it would require relations working in collaboration.\n    // We need to make a decision how we will resolve such conflict and this is less harmful way.\n    if (!a.targetPosition.isEqual(b.insertionPosition) || !b.graveyardPosition || context.abRelation == 'moveTargetAfter') {\n        newTargetPosition = a.targetPosition._getTransformedBySplitOperation(b);\n    }\n    // Case 1:\n    //\n    // Split operation brings back an element that was earlier a part of the move operation (first element of the original move operation).\n    //\n    if (a.sourcePosition.isEqual(b.insertionPosition) && context.abRelation == 'firstToMoveMerged') {\n        a.howMany++;\n        a.targetPosition = newTargetPosition;\n        return [a];\n    }\n    // Case 2:\n    //\n    // Last element in the moved range got split.\n    //\n    // In this case the default range transformation will not work correctly as the element created by\n    // split operation would be outside the range. The range to move needs to be fixed manually.\n    //\n    const moveRange = ModelRange._createFromPositionAndShift(a.sourcePosition, a.howMany);\n    if (moveRange.end.isEqual(b.insertionPosition)) {\n        // Do it only if this is a \"natural\" split, not a one that comes from undo.\n        // If this is undo split, only `targetPosition` needs to be changed (if the move is a remove).\n        if (!b.graveyardPosition || context.abRelation == 'lastToMoveMerged') {\n            a.howMany++;\n        }\n        a.targetPosition = newTargetPosition;\n        return [a];\n    }\n    // Case 3:\n    //\n    // Split happened between the moved nodes. In this case two ranges to move need to be generated.\n    //\n    // Characters `ozba` are moved to the end of paragraph `Xyz` but split happened.\n    // <p>F[oz|ba]r</p><p>Xyz</p>\n    //\n    // After split:\n    // <p>F[oz</p><p>ba]r</p><p>Xyz</p>\n    //\n    // Correct ranges:\n    // <p>F[oz]</p><p>[ba]r</p><p>Xyz</p>\n    //\n    // After move:\n    // <p>F</p><p>r</p><p>Xyzozba</p>\n    //\n    if (moveRange.start.hasSameParentAs(b.splitPosition) && moveRange.containsPosition(b.splitPosition)) {\n        let rightRange = new ModelRange(b.splitPosition, moveRange.end);\n        rightRange = rightRange._getTransformedBySplitOperation(b);\n        const ranges = [\n            new ModelRange(moveRange.start, b.splitPosition),\n            rightRange\n        ];\n        return _makeMoveOperationsFromRanges(ranges, newTargetPosition);\n    }\n    // Case 4:\n    //\n    // Move operation targets at the split position. We need to decide if the nodes should be inserted\n    // at the end of the split element or at the beginning of the new element.\n    //\n    if (a.targetPosition.isEqual(b.splitPosition) && context.abRelation == 'insertAtSource') {\n        newTargetPosition = b.moveTargetPosition;\n    }\n    // Case 5:\n    //\n    // Move operation targets just after the split element. We need to decide if the nodes should be inserted\n    // between two parts of split element, or after the new element.\n    //\n    // Split at `|`, while move operation moves `<p>Xyz</p>` and targets at `^`:\n    // <p>Foo|bar</p>^<p>baz</p>\n    // <p>Foo</p>^<p>bar</p><p>baz</p> or <p>Foo</p><p>bar</p>^<p>baz</p>?\n    //\n    // If there is no contextual information between operations (for example, they come from collaborative\n    // editing), we don't want to put some unrelated content (move) between parts of related content (split parts).\n    // However, if the split is from undo, in the past, the moved content might be targeting between the\n    // split parts, meaning that was exactly user's intention:\n    //\n    // <p>Foo</p>^<p>bar</p>\t\t<--- original situation, in \"past\".\n    // <p>Foobar</p>^\t\t\t\t<--- after merge target position is transformed.\n    // <p>Foo|bar</p>^\t\t\t\t<--- then the merge is undone, and split happens, which leads us to current situation.\n    //\n    // In this case it is pretty clear that the intention was to put new paragraph between those nodes,\n    // so we need to transform accordingly. We can detect this scenario thanks to relations.\n    //\n    if (a.targetPosition.isEqual(b.insertionPosition) && context.abRelation == 'insertBetween') {\n        newTargetPosition = a.targetPosition;\n    }\n    // The default case.\n    //\n    const transformed = moveRange._getTransformedBySplitOperation(b);\n    const ranges = [transformed];\n    // Case 6:\n    //\n    // Moved range contains graveyard element used by split operation. Add extra move operation to the result.\n    //\n    if (b.graveyardPosition) {\n        const movesGraveyardElement = moveRange.start.isEqual(b.graveyardPosition) || moveRange.containsPosition(b.graveyardPosition);\n        if (a.howMany > 1 && movesGraveyardElement && !context.aWasUndone) {\n            ranges.push(ModelRange._createFromPositionAndShift(b.insertionPosition, 1));\n        }\n    }\n    return _makeMoveOperationsFromRanges(ranges, newTargetPosition);\n});\nsetTransformation(MoveOperation, MergeOperation, (a, b, context) => {\n    const movedRange = ModelRange._createFromPositionAndShift(a.sourcePosition, a.howMany);\n    if (b.deletionPosition.hasSameParentAs(a.sourcePosition) && movedRange.containsPosition(b.sourcePosition)) {\n        if (a.type == 'remove' && !context.forceWeakRemove) {\n            // Case 1:\n            //\n            // The element to remove got merged.\n            //\n            // Merge operation does support merging elements which are not siblings. So it would not be a problem\n            // from technical point of view. However, if the element was removed, the intention of the user\n            // deleting it was to have it all deleted. From user experience point of view, moving back the\n            // removed nodes might be unexpected. This means that in this scenario we will reverse merging and remove the element.\n            //\n            if (!context.aWasUndone) {\n                const results = [];\n                let gyMoveSource = b.graveyardPosition.clone();\n                let splitNodesMoveSource = b.targetPosition._getTransformedByMergeOperation(b);\n                // `a.targetPosition` points to graveyard, so it was probably affected by `b` (which moved merged element to the graveyard).\n                const aTarget = a.targetPosition.getTransformedByOperation(b);\n                if (a.howMany > 1) {\n                    results.push(new MoveOperation(a.sourcePosition, a.howMany - 1, aTarget, 0));\n                    gyMoveSource = gyMoveSource._getTransformedByMove(a.sourcePosition, aTarget, a.howMany - 1);\n                    splitNodesMoveSource = splitNodesMoveSource._getTransformedByMove(a.sourcePosition, aTarget, a.howMany - 1);\n                }\n                const gyMoveTarget = b.deletionPosition._getCombined(a.sourcePosition, aTarget);\n                const gyMove = new MoveOperation(gyMoveSource, 1, gyMoveTarget, 0);\n                const splitNodesMoveTargetPath = gyMove.getMovedRangeStart().path.slice();\n                splitNodesMoveTargetPath.push(0);\n                const splitNodesMoveTarget = new ModelPosition(gyMove.targetPosition.root, splitNodesMoveTargetPath);\n                splitNodesMoveSource = splitNodesMoveSource._getTransformedByMove(gyMoveSource, gyMoveTarget, 1);\n                const splitNodesMove = new MoveOperation(splitNodesMoveSource, b.howMany, splitNodesMoveTarget, 0);\n                results.push(gyMove);\n                results.push(splitNodesMove);\n                return results;\n            }\n        }\n        else {\n            // Case 2:\n            //\n            // The element to move got merged and it was the only element to move.\n            // In this case just don't do anything, leave the node in the graveyard. Without special case\n            // it would be a move operation that moves 0 nodes, so maybe it is better just to return no-op.\n            //\n            if (a.howMany == 1) {\n                if (!context.bWasUndone) {\n                    return [new NoOperation(0)];\n                }\n                else {\n                    a.sourcePosition = b.graveyardPosition.clone();\n                    a.targetPosition = a.targetPosition._getTransformedByMergeOperation(b);\n                    return [a];\n                }\n            }\n        }\n    }\n    // The default case.\n    //\n    const moveRange = ModelRange._createFromPositionAndShift(a.sourcePosition, a.howMany);\n    const transformed = moveRange._getTransformedByMergeOperation(b);\n    a.sourcePosition = transformed.start;\n    a.howMany = transformed.end.offset - transformed.start.offset;\n    a.targetPosition = a.targetPosition._getTransformedByMergeOperation(b);\n    return [a];\n});\n// -----------------------\nsetTransformation(RenameOperation, InsertOperation, (a, b) => {\n    a.position = a.position._getTransformedByInsertOperation(b);\n    return [a];\n});\nsetTransformation(RenameOperation, MergeOperation, (a, b) => {\n    // Case 1:\n    //\n    // Element to rename got merged, so it was moved to `b.graveyardPosition`.\n    //\n    if (a.position.isEqual(b.deletionPosition)) {\n        a.position = b.graveyardPosition.clone();\n        a.position.stickiness = 'toNext';\n        return [a];\n    }\n    a.position = a.position._getTransformedByMergeOperation(b);\n    return [a];\n});\nsetTransformation(RenameOperation, MoveOperation, (a, b) => {\n    a.position = a.position._getTransformedByMoveOperation(b);\n    return [a];\n});\nsetTransformation(RenameOperation, RenameOperation, (a, b, context) => {\n    if (a.position.isEqual(b.position)) {\n        if (context.aIsStrong) {\n            a.oldName = b.newName;\n        }\n        else {\n            return [new NoOperation(0)];\n        }\n    }\n    return [a];\n});\nsetTransformation(RenameOperation, SplitOperation, (a, b) => {\n    // Case 1:\n    //\n    // The element to rename has been split. In this case, the new element should be also renamed.\n    //\n    // User decides to change the paragraph to a list item:\n    // <paragraph>Foobar</paragraph>\n    //\n    // However, in meantime, split happens:\n    // <paragraph>Foo</paragraph><paragraph>bar</paragraph>\n    //\n    // As a result, rename both elements:\n    // <listItem>Foo</listItem><listItem>bar</listItem>\n    //\n    const renamePath = a.position.path;\n    const splitPath = b.splitPosition.getParentPath();\n    if (compareArrays(renamePath, splitPath) == 'same' && !b.graveyardPosition) {\n        const extraRename = new RenameOperation(a.position.getShiftedBy(1), a.oldName, a.newName, 0);\n        return [a, extraRename];\n    }\n    // The default case.\n    //\n    a.position = a.position._getTransformedBySplitOperation(b);\n    return [a];\n});\n// -----------------------\nsetTransformation(RootAttributeOperation, RootAttributeOperation, (a, b, context) => {\n    if (a.root === b.root && a.key === b.key) {\n        if (!context.aIsStrong || a.newValue === b.newValue) {\n            return [new NoOperation(0)];\n        }\n        else {\n            a.oldValue = b.newValue;\n        }\n    }\n    return [a];\n});\n// -----------------------\nsetTransformation(RootOperation, RootOperation, (a, b) => {\n    if (a.rootName === b.rootName && a.isAdd === b.isAdd) {\n        return [new NoOperation(0)];\n    }\n    return [a];\n});\n// -----------------------\nsetTransformation(SplitOperation, InsertOperation, (a, b) => {\n    // The default case.\n    //\n    if (a.splitPosition.hasSameParentAs(b.position) && a.splitPosition.offset < b.position.offset) {\n        a.howMany += b.howMany;\n    }\n    a.splitPosition = a.splitPosition._getTransformedByInsertOperation(b);\n    a.insertionPosition = a.insertionPosition._getTransformedByInsertOperation(b);\n    return [a];\n});\nsetTransformation(SplitOperation, MergeOperation, (a, b, context) => {\n    // Case 1:\n    //\n    // Split element got merged. If two different elements were merged, clients will have different content.\n    //\n    // Example. Merge at `{}`, split at `[]`:\n    // <heading>Foo</heading>{}<paragraph>B[]ar</paragraph>\n    //\n    // On merge side it will look like this:\n    // <heading>FooB[]ar</heading>\n    // <heading>FooB</heading><heading>ar</heading>\n    //\n    // On split side it will look like this:\n    // <heading>Foo</heading>{}<paragraph>B</paragraph><paragraph>ar</paragraph>\n    // <heading>FooB</heading><paragraph>ar</paragraph>\n    //\n    // Clearly, the second element is different for both clients.\n    //\n    // We could use the removed merge element from graveyard as a split element but then clients would have a different\n    // model state (in graveyard), because the split side client would still have an element in graveyard (removed by merge).\n    //\n    // To overcome this, in `SplitOperation` x `MergeOperation` transformation we will add additional `SplitOperation`\n    // in the graveyard, which will actually clone the merged-and-deleted element. Then, that cloned element will be\n    // used for splitting. Example below.\n    //\n    // Original state:\n    // <heading>Foo</heading>{}<paragraph>B[]ar</paragraph>\n    //\n    // Merge side client:\n    //\n    // After merge:\n    // <heading>FooB[]ar</heading>                                 graveyard: <paragraph></paragraph>\n    //\n    // Extra split:\n    // <heading>FooB[]ar</heading>                                 graveyard: <paragraph></paragraph><paragraph></paragraph>\n    //\n    // Use the \"cloned\" element from graveyard:\n    // <heading>FooB</heading><paragraph>ar</paragraph>            graveyard: <paragraph></paragraph>\n    //\n    // Split side client:\n    //\n    // After split:\n    // <heading>Foo</heading>{}<paragraph>B</paragraph><paragraph>ar</paragraph>\n    //\n    // After merge:\n    // <heading>FooB</heading><paragraph>ar</paragraph>            graveyard: <paragraph></paragraph>\n    //\n    // This special case scenario only applies if the original split operation clones the split element.\n    // If the original split operation has `graveyardPosition` set, it all doesn't have sense because split operation\n    // knows exactly which element it should use. So there would be no original problem with different contents.\n    //\n    // Additionally, the special case applies only if the merge wasn't already undone.\n    //\n    if (!a.graveyardPosition && !context.bWasUndone && a.splitPosition.hasSameParentAs(b.sourcePosition)) {\n        const splitPath = b.graveyardPosition.path.slice();\n        splitPath.push(0);\n        const splitPosition = new ModelPosition(b.graveyardPosition.root, splitPath);\n        const insertionPosition = SplitOperation.getInsertionPosition(new ModelPosition(b.graveyardPosition.root, splitPath));\n        const additionalSplit = new SplitOperation(splitPosition, 0, insertionPosition, null, 0);\n        a.splitPosition = a.splitPosition._getTransformedByMergeOperation(b);\n        a.insertionPosition = SplitOperation.getInsertionPosition(a.splitPosition);\n        a.graveyardPosition = additionalSplit.insertionPosition.clone();\n        a.graveyardPosition.stickiness = 'toNext';\n        return [additionalSplit, a];\n    }\n    // The default case.\n    //\n    if (a.splitPosition.hasSameParentAs(b.deletionPosition) && !a.splitPosition.isAfter(b.deletionPosition)) {\n        a.howMany--;\n    }\n    if (a.splitPosition.hasSameParentAs(b.targetPosition)) {\n        a.howMany += b.howMany;\n    }\n    a.splitPosition = a.splitPosition._getTransformedByMergeOperation(b);\n    a.insertionPosition = SplitOperation.getInsertionPosition(a.splitPosition);\n    if (a.graveyardPosition) {\n        a.graveyardPosition = a.graveyardPosition._getTransformedByMergeOperation(b);\n    }\n    return [a];\n});\nsetTransformation(SplitOperation, MoveOperation, (a, b, context) => {\n    const rangeToMove = ModelRange._createFromPositionAndShift(b.sourcePosition, b.howMany);\n    if (a.graveyardPosition) {\n        // Case 1:\n        //\n        // Split operation graveyard node was moved. In this case move operation is stronger. Since graveyard element\n        // is already moved to the correct position, we need to only move the nodes after the split position.\n        // This will be done by `MoveOperation` instead of `SplitOperation`.\n        //\n        const gyElementMoved = rangeToMove.start.isEqual(a.graveyardPosition) || rangeToMove.containsPosition(a.graveyardPosition);\n        if (!context.bWasUndone && gyElementMoved) {\n            const sourcePosition = a.splitPosition._getTransformedByMoveOperation(b);\n            const newParentPosition = a.graveyardPosition._getTransformedByMoveOperation(b);\n            const newTargetPath = newParentPosition.path.slice();\n            newTargetPath.push(0);\n            const newTargetPosition = new ModelPosition(newParentPosition.root, newTargetPath);\n            const moveOp = new MoveOperation(sourcePosition, a.howMany, newTargetPosition, 0);\n            return [moveOp];\n        }\n        a.graveyardPosition = a.graveyardPosition._getTransformedByMoveOperation(b);\n    }\n    // Case 2:\n    //\n    // Split is at a position where nodes were moved.\n    //\n    // This is a scenario described in `MoveOperation` x `SplitOperation` transformation but from the\n    // \"split operation point of view\".\n    //\n    const splitAtTarget = a.splitPosition.isEqual(b.targetPosition);\n    if (splitAtTarget && (context.baRelation == 'insertAtSource' || context.abRelation == 'splitBefore')) {\n        a.howMany += b.howMany;\n        a.splitPosition = a.splitPosition._getTransformedByDeletion(b.sourcePosition, b.howMany);\n        a.insertionPosition = SplitOperation.getInsertionPosition(a.splitPosition);\n        return [a];\n    }\n    if (splitAtTarget && context.abRelation && context.abRelation.howMany) {\n        const { howMany, offset } = context.abRelation;\n        a.howMany += howMany;\n        a.splitPosition = a.splitPosition.getShiftedBy(offset);\n        // TODO: `insertionPosition` change missing?\n        return [a];\n    }\n    // Case 3:\n    //\n    // If the split position is inside the moved range, we need to shift the split position to a proper place.\n    // The position cannot be moved together with moved range because that would result in splitting of an incorrect element.\n    //\n    // Characters `bc` should be moved to the second paragraph while split position is between them:\n    // <paragraph>A[b|c]d</paragraph><paragraph>Xyz</paragraph>\n    //\n    // After move, new split position is incorrect:\n    // <paragraph>Ad</paragraph><paragraph>Xb|cyz</paragraph>\n    //\n    // Correct split position:\n    // <paragraph>A|d</paragraph><paragraph>Xbcyz</paragraph>\n    //\n    // After split:\n    // <paragraph>A</paragraph><paragraph>d</paragraph><paragraph>Xbcyz</paragraph>\n    //\n    if (a.splitPosition.hasSameParentAs(b.sourcePosition) && rangeToMove.containsPosition(a.splitPosition)) {\n        const howManyRemoved = b.howMany - (a.splitPosition.offset - b.sourcePosition.offset);\n        a.howMany -= howManyRemoved;\n        if (a.splitPosition.hasSameParentAs(b.targetPosition) && a.splitPosition.offset < b.targetPosition.offset) {\n            a.howMany += b.howMany;\n        }\n        a.splitPosition = b.sourcePosition.clone();\n        a.insertionPosition = SplitOperation.getInsertionPosition(a.splitPosition);\n        return [a];\n    }\n    // The default case.\n    // Don't change `howMany` if move operation does not really move anything.\n    //\n    if (!b.sourcePosition.isEqual(b.targetPosition)) {\n        if (a.splitPosition.hasSameParentAs(b.sourcePosition) && a.splitPosition.offset <= b.sourcePosition.offset) {\n            a.howMany -= b.howMany;\n        }\n        if (a.splitPosition.hasSameParentAs(b.targetPosition) && a.splitPosition.offset < b.targetPosition.offset) {\n            a.howMany += b.howMany;\n        }\n    }\n    // Change position stickiness to force a correct transformation.\n    a.splitPosition.stickiness = 'toNone';\n    a.splitPosition = a.splitPosition._getTransformedByMoveOperation(b);\n    a.splitPosition.stickiness = 'toNext';\n    if (a.graveyardPosition) {\n        a.insertionPosition = a.insertionPosition._getTransformedByMoveOperation(b);\n    }\n    else {\n        a.insertionPosition = SplitOperation.getInsertionPosition(a.splitPosition);\n    }\n    return [a];\n});\nsetTransformation(SplitOperation, SplitOperation, (a, b, context) => {\n    // Case 1:\n    //\n    // Split at the same position.\n    //\n    // If there already was a split at the same position as in `a` operation, it means that the intention\n    // conveyed by `a` operation has already been fulfilled and `a` should not do anything (to avoid double split).\n    //\n    // However, there is a difference if these are new splits or splits created by undo. These have different\n    // intentions. Also splits moving back different elements from graveyard have different intentions. They\n    // are just different operations.\n    //\n    // So we cancel split operation only if it was really identical.\n    //\n    // Also, there is additional case, where split operations aren't identical and should not be cancelled, however the\n    // default transformation is incorrect too.\n    //\n    if (a.splitPosition.isEqual(b.splitPosition)) {\n        if (!a.graveyardPosition && !b.graveyardPosition) {\n            return [new NoOperation(0)];\n        }\n        if (a.graveyardPosition && b.graveyardPosition && a.graveyardPosition.isEqual(b.graveyardPosition)) {\n            return [new NoOperation(0)];\n        }\n        // Use context to know that the `a.splitPosition` should stay where it is.\n        // This happens during undo when first a merge operation moved nodes to `a.splitPosition` and now `b` operation undoes that merge.\n        if (context.abRelation == 'splitBefore') {\n            // Since split is at the same position, there are no nodes left to split.\n            a.howMany = 0;\n            // Note: there was `if ( a.graveyardPosition )` here but it was uncovered in tests and I couldn't find any scenarios for now.\n            // That would have to be a `SplitOperation` that didn't come from undo but is transformed by operations that were undone.\n            // It could happen if `context` is enabled in collaboration.\n            a.graveyardPosition = a.graveyardPosition._getTransformedBySplitOperation(b);\n            return [a];\n        }\n    }\n    // Case 2:\n    //\n    // Same node is using to split different elements. This happens in undo when previously same element was merged to\n    // two different elements. This is described in `MergeOperation` x `MergeOperation` transformation.\n    //\n    // In this case we will follow the same logic. We will assume that `insertionPosition` is same for both\n    // split operations. This might not always be true but in the real cases that were experienced it was. After all,\n    // if these splits are reverses of merge operations that were merging the same element, then the `insertionPosition`\n    // should be same for both of those splits.\n    //\n    // Again, we will decide which operation is stronger by checking if split happens in graveyard or in non-graveyard root.\n    //\n    if (a.graveyardPosition && b.graveyardPosition && a.graveyardPosition.isEqual(b.graveyardPosition)) {\n        const aInGraveyard = a.splitPosition.root.rootName == '$graveyard';\n        const bInGraveyard = b.splitPosition.root.rootName == '$graveyard';\n        // If `aIsWeak` it means that `a` points to graveyard while `b` doesn't. Don't move nodes then.\n        const aIsWeak = aInGraveyard && !bInGraveyard;\n        // If `bIsWeak` it means that `b` points to graveyard while `a` doesn't. Force moving nodes then.\n        const bIsWeak = bInGraveyard && !aInGraveyard;\n        // Force move if `b` is weak or neither operation is weak but `a` is stronger through `context.aIsStrong`.\n        const forceMove = bIsWeak || (!aIsWeak && context.aIsStrong);\n        if (forceMove) {\n            const result = [];\n            // First we need to move any nodes split by `b` back to where they were.\n            // Do it only if `b` actually moved something.\n            if (b.howMany) {\n                result.push(new MoveOperation(b.moveTargetPosition, b.howMany, b.splitPosition, 0));\n            }\n            // Then we need to move nodes from `a` split position to their new element.\n            // Do it only if `a` actually should move something.\n            if (a.howMany) {\n                result.push(new MoveOperation(a.splitPosition, a.howMany, a.moveTargetPosition, 0));\n            }\n            return result;\n        }\n        else {\n            return [new NoOperation(0)];\n        }\n    }\n    if (a.graveyardPosition) {\n        a.graveyardPosition = a.graveyardPosition._getTransformedBySplitOperation(b);\n    }\n    // Case 3:\n    //\n    // Position where operation `b` inserted a new node after split is the same as the operation `a` split position.\n    // As in similar cases, there is ambiguity if the split should be before the new node (created by `b`) or after.\n    //\n    if (a.splitPosition.isEqual(b.insertionPosition) && context.abRelation == 'splitBefore') {\n        a.howMany++;\n        return [a];\n    }\n    // Case 4:\n    //\n    // This is a mirror to the case 2. above.\n    //\n    if (b.splitPosition.isEqual(a.insertionPosition) && context.baRelation == 'splitBefore') {\n        const newPositionPath = b.insertionPosition.path.slice();\n        newPositionPath.push(0);\n        const newPosition = new ModelPosition(b.insertionPosition.root, newPositionPath);\n        const moveOp = new MoveOperation(a.insertionPosition, 1, newPosition, 0);\n        return [a, moveOp];\n    }\n    // The default case.\n    //\n    if (a.splitPosition.hasSameParentAs(b.splitPosition) && a.splitPosition.offset < b.splitPosition.offset) {\n        a.howMany -= b.howMany;\n    }\n    a.splitPosition = a.splitPosition._getTransformedBySplitOperation(b);\n    a.insertionPosition = SplitOperation.getInsertionPosition(a.splitPosition);\n    return [a];\n});\n/**\n * Checks whether `MoveOperation` `targetPosition` is inside a node from the moved range of the other `MoveOperation`.\n */\nfunction _moveTargetIntoMovedRange(a, b) {\n    return a.targetPosition._getTransformedByDeletion(b.sourcePosition, b.howMany) === null;\n}\n/**\n * Helper function for `MoveOperation` x `MoveOperation` transformation. Converts given ranges and target position to\n * move operations and returns them.\n *\n * Ranges and target position will be transformed on-the-fly when generating operations.\n *\n * Given `ranges` should be in the order of how they were in the original transformed operation.\n *\n * Given `targetPosition` is the target position of the first range from `ranges`.\n */\nfunction _makeMoveOperationsFromRanges(ranges, targetPosition) {\n    // At this moment we have some ranges and a target position, to which those ranges should be moved.\n    // Order in `ranges` array is the go-to order of after transformation.\n    //\n    // We are almost done. We have `ranges` and `targetPosition` to make operations from.\n    // Unfortunately, those operations may affect each other. Precisely, first operation after move\n    // may affect source range and target position of second and third operation. Same with second\n    // operation affecting third.\n    //\n    // We need to fix those source ranges and target positions once again, before converting `ranges` to operations.\n    const operations = [];\n    // Keep in mind that nothing will be transformed if there is just one range in `ranges`.\n    for (let i = 0; i < ranges.length; i++) {\n        // Create new operation out of a range and target position.\n        const range = ranges[i];\n        const op = new MoveOperation(range.start, range.end.offset - range.start.offset, targetPosition, 0);\n        operations.push(op);\n        // Transform other ranges by the generated operation.\n        for (let j = i + 1; j < ranges.length; j++) {\n            // All ranges in `ranges` array should be:\n            //\n            // * non-intersecting (these are part of original operation source range), and\n            // * `targetPosition` does not target into them (opposite would mean that transformed operation targets \"inside itself\").\n            //\n            // This means that the transformation will be \"clean\" and always return one result.\n            ranges[j] = ranges[j]._getTransformedByMove(op.sourcePosition, op.targetPosition, op.howMany)[0];\n        }\n        targetPosition = targetPosition._getTransformedByMove(op.sourcePosition, op.targetPosition, op.howMany);\n    }\n    return operations;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/liveposition\n */\nimport { ModelPosition } from './position.js';\nimport { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * `ModelLivePosition` is a type of {@link module:engine/model/position~ModelPosition Position}\n * that updates itself as {@link module:engine/model/document~ModelDocument document}\n * is changed through operations. It may be used as a bookmark.\n *\n * **Note:** Contrary to {@link module:engine/model/position~ModelPosition}, `ModelLivePosition` works only in roots that are\n * {@link module:engine/model/rootelement~ModelRootElement}.\n * If {@link module:engine/model/documentfragment~ModelDocumentFragment} is passed, error will be thrown.\n *\n * **Note:** Be very careful when dealing with `ModelLivePosition`. Each `ModelLivePosition` instance bind events that might\n * have to be unbound.\n * Use {@link module:engine/model/liveposition~ModelLivePosition#detach} whenever you don't need `ModelLivePosition` anymore.\n */\nexport class ModelLivePosition extends /* #__PURE__ */ EmitterMixin(ModelPosition) {\n    /**\n     * Creates a live position.\n     *\n     * @see module:engine/model/position~ModelPosition\n     */\n    constructor(root, path, stickiness = 'toNone') {\n        super(root, path, stickiness);\n        if (!this.root.is('rootElement')) {\n            /**\n             * LivePosition's root has to be an instance of ModelRootElement.\n             *\n             * @error model-liveposition-root-not-rootelement\n             */\n            throw new CKEditorError('model-liveposition-root-not-rootelement', root);\n        }\n        bindWithDocument.call(this);\n    }\n    /**\n     * Unbinds all events previously bound by `ModelLivePosition`. Use it whenever you don't need `ModelLivePosition` instance\n     * anymore (i.e. when leaving scope in which it was declared or before re-assigning variable that was\n     * referring to it).\n     */\n    detach() {\n        this.stopListening();\n    }\n    /**\n     * Creates a {@link module:engine/model/position~ModelPosition position instance}, which is equal to this live position.\n     */\n    toPosition() {\n        return new ModelPosition(this.root, this.path.slice(), this.stickiness);\n    }\n    /**\n     * Creates a `ModelLivePosition` instance that is equal to position.\n     */\n    static fromPosition(position, stickiness) {\n        return new this(position.root, position.path.slice(), stickiness ? stickiness : position.stickiness);\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelLivePosition.prototype.is = function (type) {\n    return type === 'livePosition' || type === 'model:livePosition' ||\n        // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n        type == 'position' || type === 'model:position';\n};\n/**\n * Binds this `ModelLivePosition` to the {@link module:engine/model/document~ModelDocument document} that owns\n * this position's {@link module:engine/model/position~ModelPosition#root root}.\n */\nfunction bindWithDocument() {\n    this.listenTo(this.root.document.model, 'applyOperation', (event, args) => {\n        const operation = args[0];\n        if (!operation.isDocumentOperation) {\n            return;\n        }\n        transform.call(this, operation);\n    }, { priority: 'low' });\n}\n/**\n * Updates this position accordingly to the updates applied to the model. Bases on change events.\n */\nfunction transform(operation) {\n    const result = this.getTransformedByOperation(operation);\n    if (!this.isEqual(result)) {\n        const oldPosition = this.toPosition();\n        this.path = result.path;\n        this.root = result.root;\n        this.fire('change', oldPosition);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/batch\n */\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\n/**\n * A batch instance groups model changes ({@link module:engine/model/operation/operation~Operation operations}). All operations\n * grouped in a single batch can be reverted together, so you can also think about a batch as of a single undo step. If you want\n * to extend a given undo step, you can add more changes to the batch using {@link module:engine/model/model~Model#enqueueChange}:\n *\n * ```ts\n * model.enqueueChange( batch, writer => {\n * \twriter.insertText( 'foo', paragraph, 'end' );\n * } );\n * ```\n *\n * @see module:engine/model/model~Model#enqueueChange\n * @see module:engine/model/model~Model#change\n */\nexport class Batch {\n    /**\n     * An array of operations that compose this batch.\n     */\n    operations;\n    /**\n     * Whether the batch can be undone through the undo feature.\n     */\n    isUndoable;\n    /**\n     * Whether the batch includes operations created locally (`true`) or operations created on other, remote editors (`false`).\n     */\n    isLocal;\n    /**\n     * Whether the batch was created by the undo feature and undoes other operations.\n     */\n    isUndo;\n    /**\n     * Whether the batch includes operations connected with typing.\n     */\n    isTyping;\n    /**\n     * Creates a batch instance.\n     *\n     * @see module:engine/model/model~Model#enqueueChange\n     * @see module:engine/model/model~Model#change\n     * @param type A set of flags that specify the type of the batch. Batch type can alter how some of the features work\n     * when encountering a given `Batch` instance (for example, when a feature listens to applied operations).\n     */\n    constructor(type = {}) {\n        if (typeof type === 'string') {\n            type = type === 'transparent' ? { isUndoable: false } : {};\n            /**\n             * The string value for a `type` property of the `Batch` constructor has been deprecated and will be removed in the near future.\n             * Please refer to the {@link module:engine/model/batch~Batch#constructor `Batch` constructor API documentation} for more\n             * information.\n             *\n             * @error batch-constructor-deprecated-string-type\n             */\n            logWarning('batch-constructor-deprecated-string-type');\n        }\n        const { isUndoable = true, isLocal = true, isUndo = false, isTyping = false } = type;\n        this.operations = [];\n        this.isUndoable = isUndoable;\n        this.isLocal = isLocal;\n        this.isUndo = isUndo;\n        this.isTyping = isTyping;\n    }\n    /**\n     * Returns the base version of this batch, which is equal to the base version of the first operation in the batch.\n     * If there are no operations in the batch or neither operation has the base version set, it returns `null`.\n     */\n    get baseVersion() {\n        for (const op of this.operations) {\n            if (op.baseVersion !== null) {\n                return op.baseVersion;\n            }\n        }\n        return null;\n    }\n    /**\n     * Adds an operation to the batch instance.\n     *\n     * @param operation An operation to add.\n     * @returns The added operation.\n     */\n    addOperation(operation) {\n        if (operation.isDocumentOperation) {\n            // Store only document operations in the batch.\n            // Non-document operations are temporary and should be discarded after they are applied.\n            operation.batch = this;\n            this.operations.push(operation);\n        }\n        return operation;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/differ\n */\nimport { ModelPosition } from './position.js';\nimport { ModelRange } from './range.js';\n/**\n * Calculates the difference between two model states.\n *\n * Receives operations that are to be applied on the model document. Marks parts of the model document tree which\n * are changed and saves the state of these elements before the change. Then, it compares saved elements with the\n * changed elements, after all changes are applied on the model document. Calculates the diff between saved\n * elements and new ones and returns a change set.\n */\nexport class Differ {\n    /**\n     * Priority of the {@link ~Differ#_elementState element states}. States on higher indexes of the array can overwrite states on the lower\n     * indexes.\n     */\n    static _statesPriority = [undefined, 'refresh', 'rename', 'move'];\n    /**\n     * Reference to the model's marker collection.\n     */\n    _markerCollection;\n    /**\n     * A map that stores changes that happened in a given element.\n     *\n     * The keys of the map are references to the model elements.\n     * The values of the map are arrays with changes that were done on this element.\n     */\n    _changesInElement = new Map();\n    /**\n     * Stores a snapshot for these model nodes that might have changed.\n     *\n     * This complements {@link ~Differ#_elementChildrenSnapshots `_elementChildrenSnapshots`}.\n     *\n     * See also {@link ~DifferSnapshot}.\n     */\n    _elementsSnapshots = new Map();\n    /**\n     * For each element or document fragment inside which there was a change, it stores a snapshot of the child nodes list (an array\n     * of children snapshots that represent the state in the element / fragment before any change has happened).\n     *\n     * This complements {@link ~Differ#_elementsSnapshots `_elementsSnapshots`}.\n     *\n     * See also {@link ~DifferSnapshot}.\n     */\n    _elementChildrenSnapshots = new Map();\n    /**\n     * Keeps the state for a given element, describing how the element was changed so far. It is used to evaluate the `action` property\n     * of diff items returned by {@link ~Differ#getChanges}.\n     *\n     * Possible values, in the order from the lowest priority to the highest priority:\n     *\n     * * `'refresh'` - element was refreshed,\n     * * `'rename'` - element was renamed,\n     * * `'move'` - element was moved (or, usually, removed, that is moved to the graveyard).\n     *\n     * Element that was refreshed, may change its state to `'rename'` if it was later renamed, or to `'move'` if it was removed.\n     * But the element cannot change its state from `'move'` to `'rename'`, or from `'rename'` to `'refresh'`.\n     *\n     * Only already existing elements are registered in `_elementState`. If a new element was inserted as a result of a buffered operation,\n     * it is not be registered in `_elementState`.\n     */\n    _elementState = new Map();\n    /**\n     * A map that stores all changed markers.\n     *\n     * The keys of the map are marker names.\n     *\n     * The values of the map are objects with the following properties:\n     *\n     * * `oldMarkerData`,\n     * * `newMarkerData`.\n     */\n    _changedMarkers = new Map();\n    /**\n     * A map that stores all roots that have been changed.\n     *\n     * The keys are the names of the roots while value represents the changes.\n     */\n    _changedRoots = new Map();\n    /**\n     * Stores the number of changes that were processed. Used to order the changes chronologically. It is important\n     * when changes are sorted.\n     */\n    _changeCount = 0;\n    /**\n     * For efficiency purposes, `Differ` stores the change set returned by the differ after {@link #getChanges} call.\n     * Cache is reset each time a new operation is buffered. If the cache has not been reset, {@link #getChanges} will\n     * return the cached value instead of calculating it again.\n     *\n     * This property stores those changes that did not take place in graveyard root.\n     */\n    _cachedChanges = null;\n    /**\n     * For efficiency purposes, `Differ` stores the change set returned by the differ after the {@link #getChanges} call.\n     * The cache is reset each time a new operation is buffered. If the cache has not been reset, {@link #getChanges} will\n     * return the cached value instead of calculating it again.\n     *\n     * This property stores all changes evaluated by `Differ`, including those that took place in the graveyard.\n     */\n    _cachedChangesWithGraveyard = null;\n    /**\n     * Set of model items that were marked to get refreshed in {@link #_refreshItem}.\n     */\n    _refreshedItems = new Set();\n    /**\n     * Creates a `Differ` instance.\n     *\n     * @param markerCollection Model's marker collection.\n     */\n    constructor(markerCollection) {\n        this._markerCollection = markerCollection;\n    }\n    /**\n     * Informs whether there are any changes buffered in `Differ`.\n     */\n    get isEmpty() {\n        return this._changesInElement.size == 0 && this._changedMarkers.size == 0 && this._changedRoots.size == 0;\n    }\n    /**\n     * Buffers the given operation. **An operation has to be buffered before it is executed.**\n     *\n     * @param operationToBuffer An operation to buffer.\n     */\n    bufferOperation(operationToBuffer) {\n        // Below we take an operation, check its type, then use its parameters in marking (private) methods.\n        // The general rule is to not mark elements inside inserted element. All inserted elements are re-rendered.\n        // Marking changes in them would cause a \"double\" changing then.\n        //\n        const operation = operationToBuffer;\n        // Note: an operation that happens inside a non-loaded root will be ignored. If the operation happens partially inside\n        // a non-loaded root, that part will be ignored (this may happen for move or marker operations).\n        //\n        switch (operation.type) {\n            case 'insert': {\n                if (this._isInInsertedElement(operation.position.parent)) {\n                    return;\n                }\n                this._markInsert(operation.position.parent, operation.position.offset, operation.nodes.maxOffset);\n                break;\n            }\n            case 'addAttribute':\n            case 'removeAttribute':\n            case 'changeAttribute': {\n                for (const item of operation.range.getItems({ shallow: true })) {\n                    if (this._isInInsertedElement(item.parent)) {\n                        continue;\n                    }\n                    this._markAttribute(item);\n                }\n                break;\n            }\n            case 'remove':\n            case 'move':\n            case 'reinsert': {\n                // When range is moved to the same position then not mark it as a change.\n                // See: https://github.com/ckeditor/ckeditor5-engine/issues/1664.\n                if (operation.sourcePosition.isEqual(operation.targetPosition) ||\n                    operation.sourcePosition.getShiftedBy(operation.howMany).isEqual(operation.targetPosition)) {\n                    return;\n                }\n                const sourceParentInserted = this._isInInsertedElement(operation.sourcePosition.parent);\n                const targetParentInserted = this._isInInsertedElement(operation.targetPosition.parent);\n                if (!sourceParentInserted) {\n                    this._markRemove(operation.sourcePosition.parent, operation.sourcePosition.offset, operation.howMany);\n                }\n                if (!targetParentInserted) {\n                    this._markInsert(operation.targetPosition.parent, operation.getMovedRangeStart().offset, operation.howMany);\n                }\n                // Remember -- operation is buffered before it is executed. So, it was not executed yet.\n                const range = ModelRange._createFromPositionAndShift(operation.sourcePosition, operation.howMany);\n                for (const node of range.getItems({ shallow: true })) {\n                    this._setElementState(node, 'move');\n                }\n                break;\n            }\n            case 'rename': {\n                if (this._isInInsertedElement(operation.position.parent)) {\n                    return;\n                }\n                this._markRemove(operation.position.parent, operation.position.offset, 1);\n                this._markInsert(operation.position.parent, operation.position.offset, 1);\n                const range = ModelRange._createFromPositionAndShift(operation.position, 1);\n                for (const marker of this._markerCollection.getMarkersIntersectingRange(range)) {\n                    const markerData = marker.getData();\n                    this.bufferMarkerChange(marker.name, markerData, markerData);\n                }\n                this._setElementState(operation.position.nodeAfter, 'rename');\n                break;\n            }\n            case 'split': {\n                const splitElement = operation.splitPosition.parent;\n                // Mark that children of the split element were removed.\n                if (!this._isInInsertedElement(splitElement)) {\n                    this._markRemove(splitElement, operation.splitPosition.offset, operation.howMany);\n                    // Remember -- operation is buffered before it is executed. So, it was not executed yet.\n                    const range = ModelRange._createFromPositionAndShift(operation.splitPosition, operation.howMany);\n                    for (const node of range.getItems({ shallow: true })) {\n                        this._setElementState(node, 'move');\n                    }\n                }\n                // Mark that the new element (split copy) was inserted.\n                if (!this._isInInsertedElement(operation.insertionPosition.parent)) {\n                    this._markInsert(operation.insertionPosition.parent, operation.insertionPosition.offset, 1);\n                }\n                // If the split took the element from the graveyard, mark that the element from the graveyard was removed.\n                if (operation.graveyardPosition) {\n                    this._markRemove(operation.graveyardPosition.parent, operation.graveyardPosition.offset, 1);\n                    this._setElementState(operation.graveyardPosition.nodeAfter, 'move');\n                }\n                break;\n            }\n            case 'merge': {\n                // Mark that the merged element was removed.\n                const mergedElement = operation.sourcePosition.parent;\n                if (!this._isInInsertedElement(mergedElement.parent)) {\n                    this._markRemove(mergedElement.parent, mergedElement.startOffset, 1);\n                }\n                // Mark that the merged element was inserted into graveyard.\n                const graveyardParent = operation.graveyardPosition.parent;\n                this._markInsert(graveyardParent, operation.graveyardPosition.offset, 1);\n                this._setElementState(mergedElement, 'move');\n                // Mark that children of merged element were inserted at new parent.\n                const mergedIntoElement = operation.targetPosition.parent;\n                if (!this._isInInsertedElement(mergedIntoElement)) {\n                    this._markInsert(mergedIntoElement, operation.targetPosition.offset, mergedElement.maxOffset);\n                    // Remember -- operation is buffered before it is executed. So, it was not executed yet.\n                    const range = ModelRange._createFromPositionAndShift(operation.sourcePosition, operation.howMany);\n                    for (const node of range.getItems({ shallow: true })) {\n                        this._setElementState(node, 'move');\n                    }\n                }\n                break;\n            }\n            case 'detachRoot':\n            case 'addRoot': {\n                const root = operation.affectedSelectable;\n                if (!root._isLoaded) {\n                    return;\n                }\n                // Don't buffer if the root state does not change.\n                if (root.isAttached() == operation.isAdd) {\n                    return;\n                }\n                this._bufferRootStateChange(operation.rootName, operation.isAdd);\n                break;\n            }\n            case 'addRootAttribute':\n            case 'removeRootAttribute':\n            case 'changeRootAttribute': {\n                if (!operation.root._isLoaded) {\n                    return;\n                }\n                const rootName = operation.root.rootName;\n                this._bufferRootAttributeChange(rootName, operation.key, operation.oldValue, operation.newValue);\n                break;\n            }\n        }\n        // Clear cache after each buffered operation as it is no longer valid.\n        this._cachedChanges = null;\n    }\n    /**\n     * Buffers a marker change.\n     *\n     * @param markerName The name of the marker that changed.\n     * @param oldMarkerData Marker data before the change.\n     * @param newMarkerData Marker data after the change.\n     */\n    bufferMarkerChange(markerName, oldMarkerData, newMarkerData) {\n        if (oldMarkerData.range && oldMarkerData.range.root.is('rootElement') && !oldMarkerData.range.root._isLoaded) {\n            oldMarkerData.range = null;\n        }\n        if (newMarkerData.range && newMarkerData.range.root.is('rootElement') && !newMarkerData.range.root._isLoaded) {\n            newMarkerData.range = null;\n        }\n        let buffered = this._changedMarkers.get(markerName);\n        if (!buffered) {\n            buffered = { newMarkerData, oldMarkerData };\n            this._changedMarkers.set(markerName, buffered);\n        }\n        else {\n            buffered.newMarkerData = newMarkerData;\n        }\n        if (buffered.oldMarkerData.range == null && newMarkerData.range == null) {\n            // The marker is going to be removed (`newMarkerData.range == null`) but it did not exist before the first buffered change\n            // (`buffered.oldMarkerData.range == null`). In this case, do not keep the marker in buffer at all.\n            this._changedMarkers.delete(markerName);\n        }\n    }\n    /**\n     * Returns all markers that should be removed as a result of buffered changes.\n     *\n     * @returns Markers to remove. Each array item is an object containing the `name` and `range` properties.\n     */\n    getMarkersToRemove() {\n        const result = [];\n        for (const [name, change] of this._changedMarkers) {\n            if (change.oldMarkerData.range != null) {\n                result.push({ name, range: change.oldMarkerData.range });\n            }\n        }\n        return result;\n    }\n    /**\n     * Returns all markers which should be added as a result of buffered changes.\n     *\n     * @returns Markers to add. Each array item is an object containing the `name` and `range` properties.\n     */\n    getMarkersToAdd() {\n        const result = [];\n        for (const [name, change] of this._changedMarkers) {\n            if (change.newMarkerData.range != null) {\n                result.push({ name, range: change.newMarkerData.range });\n            }\n        }\n        return result;\n    }\n    /**\n     * Returns all markers which changed.\n     */\n    getChangedMarkers() {\n        return Array.from(this._changedMarkers).map(([name, change]) => ({\n            name,\n            data: {\n                oldRange: change.oldMarkerData.range,\n                newRange: change.newMarkerData.range\n            }\n        }));\n    }\n    /**\n     * Checks whether some of the buffered changes affect the editor data.\n     *\n     * Types of changes which affect the editor data:\n     *\n     * * model structure changes,\n     * * attribute changes,\n     * * a root is added or detached,\n     * * changes of markers which were defined as `affectsData`,\n     * * changes of markers' `affectsData` property.\n     */\n    hasDataChanges() {\n        if (this.getChanges().length) {\n            return true;\n        }\n        if (this._changedRoots.size > 0) {\n            return true;\n        }\n        for (const { newMarkerData, oldMarkerData } of this._changedMarkers.values()) {\n            if (newMarkerData.affectsData !== oldMarkerData.affectsData) {\n                return true;\n            }\n            if (newMarkerData.affectsData) {\n                const markerAdded = newMarkerData.range && !oldMarkerData.range;\n                const markerRemoved = !newMarkerData.range && oldMarkerData.range;\n                const markerChanged = newMarkerData.range && oldMarkerData.range && !newMarkerData.range.isEqual(oldMarkerData.range);\n                if (markerAdded || markerRemoved || markerChanged) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    /**\n     * Calculates the diff between the old model tree state (the state before the first buffered operations since the last {@link #reset}\n     * call) and the new model tree state (actual one). It should be called after all buffered operations are executed.\n     *\n     * The diff set is returned as an array of {@link module:engine/model/differ~DifferItem diff items}, each describing a change done\n     * on the model. The items are sorted by the position on which the change happened. If a position\n     * {@link module:engine/model/position~ModelPosition#isBefore is before} another one, it will be on an earlier index in the diff set.\n     *\n     * **Note**: Elements inside inserted element will not have a separate diff item, only the top most element change will be reported.\n     *\n     * Because calculating the diff is a costly operation, the result is cached. If no new operation was buffered since the\n     * previous {@link #getChanges} call, the next call will return the cached value.\n     *\n     * @param options Additional options.\n     * @param options.includeChangesInGraveyard If set to `true`, also changes that happened\n     * in the graveyard root will be returned. By default, changes in the graveyard root are not returned.\n     * @returns Diff between the old and the new model tree state.\n     */\n    getChanges(options = {}) {\n        // If there are cached changes, just return them instead of calculating changes again.\n        if (this._cachedChanges) {\n            if (options.includeChangesInGraveyard) {\n                return this._cachedChangesWithGraveyard.slice();\n            }\n            else {\n                return this._cachedChanges.slice();\n            }\n        }\n        // Will contain returned results.\n        let diffSet = [];\n        // Check all changed elements/roots.\n        for (const element of this._changesInElement.keys()) {\n            // Get changes inside this element/root and sort them.\n            const changes = this._changesInElement.get(element).sort((a, b) => {\n                if (a.offset === b.offset) {\n                    if (a.type != b.type) {\n                        // If there are multiple changes at the same position, \"remove\" change should be first.\n                        // If the order is different, for example, we would first add some nodes and then removed them\n                        // (instead of the nodes that we should remove).\n                        return a.type == 'remove' ? -1 : 1;\n                    }\n                    return 0;\n                }\n                return a.offset < b.offset ? -1 : 1;\n            });\n            // Get children of this element before any change was applied on it.\n            const childrenBefore = this._elementChildrenSnapshots.get(element);\n            // Get snapshot of current element's children.\n            const childrenAfter = _getChildrenSnapshots(element.getChildren());\n            // Generate diff instructions based on changes done in the element/root.\n            const diffInstructions = _generateDiffInstructionsFromChanges(childrenBefore.length, changes);\n            let i = 0; // Iterator in `childrenAfter` array -- iterates through current children of element.\n            let j = 0; // Iterator in `childrenBefore` array -- iterates through old children of element.\n            // Process every action.\n            for (const instruction of diffInstructions) {\n                if (instruction === 'i') {\n                    const action = this._getDiffActionForNode(childrenAfter[i].node, 'insert');\n                    const childSnapshotBefore = this._elementsSnapshots.get(childrenAfter[i].node);\n                    const diffItem = this._getInsertDiff(element, i, action, childrenAfter[i], childSnapshotBefore);\n                    diffSet.push(diffItem);\n                    i++;\n                }\n                else if (instruction === 'r') {\n                    const action = this._getDiffActionForNode(childrenBefore[j].node, 'remove');\n                    const diffItem = this._getRemoveDiff(element, i, action, childrenBefore[j]);\n                    diffSet.push(diffItem);\n                    j++;\n                }\n                else if (instruction === 'a') {\n                    // Take attributes from saved and current children.\n                    const beforeAttributes = childrenBefore[j].attributes;\n                    const afterAttributes = childrenAfter[i].attributes;\n                    let range;\n                    if (childrenAfter[i].name == '$text') {\n                        range = new ModelRange(ModelPosition._createAt(element, i), ModelPosition._createAt(element, i + 1));\n                    }\n                    else {\n                        const index = element.offsetToIndex(i);\n                        range = new ModelRange(ModelPosition._createAt(element, i), ModelPosition._createAt(element.getChild(index), 0));\n                    }\n                    // Generate diff items for this change (there might be multiple attributes changed and\n                    // there is a single diff for each of them) and insert them into the diff set.\n                    const diffItems = this._getAttributesDiff(range, beforeAttributes, afterAttributes);\n                    diffSet.push(...diffItems);\n                    i++;\n                    j++;\n                }\n                else {\n                    // `action` is 'equal'. Child not changed.\n                    i++;\n                    j++;\n                }\n            }\n        }\n        // Then, sort the changes by the position (change at position before other changes is first).\n        diffSet.sort((a, b) => {\n            // If the change is in different root, we don't care much, but we'd like to have all changes in given\n            // root \"together\" in the array. So let's just sort them by the root name. It does not matter which root\n            // will be processed first.\n            if (a.position.root != b.position.root) {\n                return a.position.root.rootName < b.position.root.rootName ? -1 : 1;\n            }\n            // If change happens at the same position...\n            if (a.position.isEqual(b.position)) {\n                // Keep chronological order of operations.\n                return a.changeCount - b.changeCount;\n            }\n            // If positions differ, position \"on the left\" should be earlier in the result.\n            return a.position.isBefore(b.position) ? -1 : 1;\n        });\n        // Glue together multiple changes (mostly on text nodes).\n        for (let i = 1, prevIndex = 0; i < diffSet.length; i++) {\n            const prevDiff = diffSet[prevIndex];\n            const thisDiff = diffSet[i];\n            // Glue remove changes if they happen on text on same position.\n            const isConsecutiveTextRemove = prevDiff.type == 'remove' && thisDiff.type == 'remove' &&\n                prevDiff.name == '$text' && thisDiff.name == '$text' &&\n                prevDiff.position.isEqual(thisDiff.position);\n            // Glue insert changes if they happen on text on consecutive fragments.\n            const isConsecutiveTextAdd = prevDiff.type == 'insert' && thisDiff.type == 'insert' &&\n                prevDiff.name == '$text' && thisDiff.name == '$text' &&\n                prevDiff.position.parent == thisDiff.position.parent &&\n                prevDiff.position.offset + prevDiff.length == thisDiff.position.offset;\n            // Glue attribute changes if they happen on consecutive fragments and have same key, old value and new value.\n            const isConsecutiveAttributeChange = prevDiff.type == 'attribute' && thisDiff.type == 'attribute' &&\n                prevDiff.position.parent == thisDiff.position.parent &&\n                prevDiff.range.isFlat && thisDiff.range.isFlat &&\n                (prevDiff.position.offset + prevDiff.length) == thisDiff.position.offset &&\n                prevDiff.attributeKey == thisDiff.attributeKey &&\n                prevDiff.attributeOldValue == thisDiff.attributeOldValue &&\n                prevDiff.attributeNewValue == thisDiff.attributeNewValue;\n            if (isConsecutiveTextRemove || isConsecutiveTextAdd || isConsecutiveAttributeChange) {\n                prevDiff.length++;\n                if (isConsecutiveAttributeChange) {\n                    prevDiff.range.end = prevDiff.range.end.getShiftedBy(1);\n                }\n                diffSet[i] = null;\n            }\n            else {\n                prevIndex = i;\n            }\n        }\n        diffSet = diffSet.filter(v => v);\n        // Remove `changeCount` property from diff items. It is used only for sorting and is internal thing.\n        for (const item of diffSet) {\n            delete item.changeCount;\n            if (item.type == 'attribute') {\n                delete item.position;\n                delete item.length;\n            }\n        }\n        this._changeCount = 0;\n        // Cache changes.\n        this._cachedChangesWithGraveyard = diffSet;\n        this._cachedChanges = diffSet.filter(_changesInGraveyardFilter);\n        if (options.includeChangesInGraveyard) {\n            return this._cachedChangesWithGraveyard.slice();\n        }\n        else {\n            return this._cachedChanges.slice();\n        }\n    }\n    /**\n     * Returns all roots that have changed (either were attached, or detached, or their attributes changed).\n     *\n     * @returns Diff between the old and the new roots state.\n     */\n    getChangedRoots() {\n        return Array.from(this._changedRoots.values()).map(diffItem => {\n            const entry = { ...diffItem };\n            if (entry.state !== undefined) {\n                // The root was attached or detached -- do not return its attributes changes.\n                // If the root was attached, it should be handled as a whole, together with its attributes, the same way as model nodes.\n                // If the root was detached, its attributes should be discarded anyway.\n                //\n                // Keep in mind that filtering must happen on this stage (when retrieving changes). If filtering happens on-the-fly as\n                // the attributes change, it may lead to incorrect situation, e.g.: detach root, change attribute, re-attach root.\n                // In this case, attribute change cannot be filtered. After the root is re-attached, the attribute change must be kept.\n                delete entry.attributes;\n            }\n            return entry;\n        });\n    }\n    /**\n     * Returns a set of model items that were marked to get refreshed.\n     */\n    getRefreshedItems() {\n        return new Set(this._refreshedItems);\n    }\n    /**\n     * Resets `Differ`. Removes all buffered changes.\n     */\n    reset() {\n        this._changesInElement.clear();\n        this._elementChildrenSnapshots.clear();\n        this._elementsSnapshots.clear();\n        this._elementState.clear();\n        this._changedMarkers.clear();\n        this._changedRoots.clear();\n        this._refreshedItems.clear();\n        this._cachedChanges = null;\n    }\n    /**\n     * Marks the given `item` in differ to be \"refreshed\". It means that the item will be marked as removed and inserted\n     * in the differ changes set, so it will be effectively re-converted when the differ changes are handled by a dispatcher.\n     *\n     * @internal\n     * @param item Item to refresh.\n     */\n    _refreshItem(item) {\n        if (this._isInInsertedElement(item.parent)) {\n            return;\n        }\n        this._markRemove(item.parent, item.startOffset, item.offsetSize);\n        this._markInsert(item.parent, item.startOffset, item.offsetSize);\n        this._refreshedItems.add(item);\n        this._setElementState(item, 'refresh');\n        const range = ModelRange._createOn(item);\n        for (const marker of this._markerCollection.getMarkersIntersectingRange(range)) {\n            const markerData = marker.getData();\n            this.bufferMarkerChange(marker.name, markerData, markerData);\n        }\n        // Clear cache after each buffered operation as it is no longer valid.\n        this._cachedChanges = null;\n    }\n    /**\n     * Buffers all the data related to given root like it was all just added to the editor.\n     *\n     * Following changes are buffered:\n     *\n     * * root is attached,\n     * * all root content is inserted,\n     * * all root attributes are added,\n     * * all markers inside the root are added.\n     *\n     * @internal\n     */\n    _bufferRootLoad(root) {\n        if (!root.isAttached()) {\n            return;\n        }\n        this._bufferRootStateChange(root.rootName, true);\n        this._markInsert(root, 0, root.maxOffset);\n        // Buffering root attribute changes makes sense and is actually needed, even though we buffer root state change above.\n        // Because the root state change is buffered, the root attributes changes are not returned by the differ.\n        // But, if the root attribute is removed in the same change block, or the root is detached, then the differ results would be wrong.\n        //\n        for (const key of root.getAttributeKeys()) {\n            this._bufferRootAttributeChange(root.rootName, key, null, root.getAttribute(key));\n        }\n        for (const marker of this._markerCollection) {\n            if (marker.getRange().root == root) {\n                const markerData = marker.getData();\n                this.bufferMarkerChange(marker.name, { ...markerData, range: null }, markerData);\n            }\n        }\n    }\n    /**\n     * Buffers the root state change after the root was attached or detached\n     */\n    _bufferRootStateChange(rootName, isAttached) {\n        if (!this._changedRoots.has(rootName)) {\n            this._changedRoots.set(rootName, { name: rootName, state: isAttached ? 'attached' : 'detached' });\n            return;\n        }\n        const diffItem = this._changedRoots.get(rootName);\n        if (diffItem.state !== undefined) {\n            // Root `state` can only toggle between one of the values and no value. It cannot be any other way,\n            // because if the root was originally attached it can only become detached. Then, if it is re-attached in the same batch of\n            // changes, it gets back to \"no change\" (which means no value). Same if the root was originally detached.\n            delete diffItem.state;\n            if (diffItem.attributes === undefined) {\n                // If there is no `state` change and no `attributes` change, remove the entry.\n                this._changedRoots.delete(rootName);\n            }\n        }\n        else {\n            diffItem.state = isAttached ? 'attached' : 'detached';\n        }\n    }\n    /**\n     * Buffers a root attribute change.\n     */\n    _bufferRootAttributeChange(rootName, key, oldValue, newValue) {\n        const diffItem = this._changedRoots.get(rootName) || { name: rootName };\n        const attrs = diffItem.attributes || {};\n        if (attrs[key]) {\n            // If this attribute or metadata was already changed earlier and is changed again, check to what value it is changed.\n            const attrEntry = attrs[key];\n            if (newValue === attrEntry.oldValue) {\n                // If it was changed back to the old value, remove the entry.\n                delete attrs[key];\n            }\n            else {\n                // If it was changed to a different value, update the entry.\n                attrEntry.newValue = newValue;\n            }\n        }\n        else {\n            // If this attribute or metadata was not set earlier, add an entry.\n            attrs[key] = { oldValue, newValue };\n        }\n        if (Object.entries(attrs).length === 0) {\n            // If attributes or metadata changes set became empty, remove it from the diff item.\n            delete diffItem.attributes;\n            if (diffItem.state === undefined) {\n                // If there is no `state` change and no `attributes` change, remove the entry.\n                this._changedRoots.delete(rootName);\n            }\n        }\n        else {\n            // Make sure that, if a new object in the structure was created, it gets set.\n            diffItem.attributes = attrs;\n            this._changedRoots.set(rootName, diffItem);\n        }\n    }\n    /**\n     * Saves and handles an insert change.\n     */\n    _markInsert(parent, offset, howMany) {\n        if (parent.root.is('rootElement') && !parent.root._isLoaded) {\n            return;\n        }\n        const changeItem = { type: 'insert', offset, howMany, count: this._changeCount++ };\n        this._markChange(parent, changeItem);\n    }\n    /**\n     * Saves and handles a remove change.\n     */\n    _markRemove(parent, offset, howMany) {\n        if (parent.root.is('rootElement') && !parent.root._isLoaded) {\n            return;\n        }\n        const changeItem = { type: 'remove', offset, howMany, count: this._changeCount++ };\n        this._markChange(parent, changeItem);\n        this._removeAllNestedChanges(parent, offset, howMany);\n    }\n    /**\n     * Saves and handles an attribute change.\n     */\n    _markAttribute(item) {\n        if (item.root.is('rootElement') && !item.root._isLoaded) {\n            return;\n        }\n        const changeItem = { type: 'attribute', offset: item.startOffset, howMany: item.offsetSize, count: this._changeCount++ };\n        this._markChange(item.parent, changeItem);\n    }\n    /**\n     * Saves and handles a model change.\n     */\n    _markChange(parent, changeItem) {\n        // First, make a snapshot of the parent and its children (it will be made only if it was not made before).\n        this._makeSnapshots(parent);\n        // Then, get all changes that already were done on the element (empty array if this is the first change).\n        const changes = this._getChangesForElement(parent);\n        // Then, look through all the changes, and transform them or the new change.\n        this._handleChange(changeItem, changes);\n        // Add the new change.\n        changes.push(changeItem);\n        // Remove incorrect changes. During transformation some change might be, for example, included in another.\n        // In that case, the change will have `howMany` property set to `0` or less. We need to remove those changes.\n        for (let i = 0; i < changes.length; i++) {\n            if (changes[i].howMany < 1) {\n                changes.splice(i, 1);\n                i--;\n            }\n        }\n    }\n    /**\n     * Tries to set given state for given item.\n     *\n     * This method does simple validation (it sets the state only for model elements, not for text proxy nodes). It also follows state\n     * setting rules, that is, `'refresh'` cannot overwrite `'rename'`, and `'rename'` cannot overwrite `'move'`.\n     */\n    _setElementState(node, state) {\n        if (!node.is('element')) {\n            return;\n        }\n        const currentStatePriority = Differ._statesPriority.indexOf(this._elementState.get(node));\n        const newStatePriority = Differ._statesPriority.indexOf(state);\n        if (newStatePriority > currentStatePriority) {\n            this._elementState.set(node, state);\n        }\n    }\n    /**\n     * Returns a value for {@link ~DifferItemAction `action`} property for diff items returned by {@link ~Differ#getChanges}.\n     * This method aims to return `'rename'` or `'refresh'` when it should, and `diffItemType` (\"default action\") in all other cases.\n     *\n     * It bases on a few factors:\n     *\n     * * for text nodes, the method always returns `diffItemType`,\n     * * for newly inserted element, the method returns `diffItemType`,\n     * * if {@link ~Differ#_elementState element state} was not recorded, the method returns `diffItemType`,\n     * * if state was recorded, and it was `'move'` (default action), the method returns `diffItemType`,\n     * * finally, if state was `'refresh'` or `'rename'`, the method returns the state value.\n     */\n    _getDiffActionForNode(node, diffItemType) {\n        if (!node.is('element')) {\n            // Text node.\n            return diffItemType;\n        }\n        if (!this._elementsSnapshots.has(node)) {\n            // Newly inserted element.\n            return diffItemType;\n        }\n        const state = this._elementState.get(node);\n        if (!state || state == 'move') {\n            return diffItemType;\n        }\n        return state;\n    }\n    /**\n     * Gets an array of changes that have already been saved for a given element.\n     */\n    _getChangesForElement(element) {\n        let changes;\n        if (this._changesInElement.has(element)) {\n            changes = this._changesInElement.get(element);\n        }\n        else {\n            changes = [];\n            this._changesInElement.set(element, changes);\n        }\n        return changes;\n    }\n    /**\n     * Creates and saves a snapshot for all children of the given element.\n     */\n    _makeSnapshots(element) {\n        if (this._elementChildrenSnapshots.has(element)) {\n            return;\n        }\n        const childrenSnapshots = _getChildrenSnapshots(element.getChildren());\n        this._elementChildrenSnapshots.set(element, childrenSnapshots);\n        for (const snapshot of childrenSnapshots) {\n            this._elementsSnapshots.set(snapshot.node, snapshot);\n        }\n    }\n    /**\n     * For a given newly saved change, compares it with a change already done on the element and modifies the incoming\n     * change and/or the old change.\n     *\n     * @param inc Incoming (new) change.\n     * @param changes An array containing all the changes done on that element.\n     */\n    _handleChange(inc, changes) {\n        // We need a helper variable that will store how many nodes are to be still handled for this change item.\n        // `nodesToHandle` (how many nodes still need to be handled) and `howMany` (how many nodes were affected)\n        // needs to be differentiated.\n        //\n        // This comes up when there are multiple changes that are affected by `inc` change item.\n        //\n        // For example: assume two insert changes: `{ offset: 2, howMany: 1 }` and `{ offset: 5, howMany: 1 }`.\n        // Assume that `inc` change is remove `{ offset: 2, howMany: 2, nodesToHandle: 2 }`.\n        //\n        // Then, we:\n        // - \"forget\" about first insert change (it is \"eaten\" by remove),\n        // - because of that, at the end we will want to remove only one node (`nodesToHandle = 1`),\n        // - but still we have to change offset of the second insert change from `5` to `3`!\n        //\n        // So, `howMany` does not change throughout items transformation and keeps information about how many nodes were affected,\n        // while `nodesToHandle` means how many nodes need to be handled after the change item is transformed by other changes.\n        inc.nodesToHandle = inc.howMany;\n        for (const old of changes) {\n            const incEnd = inc.offset + inc.howMany;\n            const oldEnd = old.offset + old.howMany;\n            if (inc.type == 'insert') {\n                if (old.type == 'insert') {\n                    if (inc.offset <= old.offset) {\n                        old.offset += inc.howMany;\n                    }\n                    else if (inc.offset < oldEnd) {\n                        old.howMany += inc.nodesToHandle;\n                        inc.nodesToHandle = 0;\n                    }\n                }\n                if (old.type == 'remove') {\n                    if (inc.offset < old.offset) {\n                        old.offset += inc.howMany;\n                    }\n                }\n                if (old.type == 'attribute') {\n                    if (inc.offset <= old.offset) {\n                        old.offset += inc.howMany;\n                    }\n                    else if (inc.offset < oldEnd) {\n                        // This case is more complicated, because attribute change has to be split into two.\n                        // Example (assume that uppercase and lowercase letters mean different attributes):\n                        //\n                        // initial state:\t\tabcxyz\n                        // attribute change:\taBCXYz\n                        // incoming insert:\t\taBCfooXYz\n                        //\n                        // Change ranges cannot intersect because each item has to be described exactly (it was either\n                        // not changed, inserted, removed, or its attribute was changed). That's why old attribute\n                        // change has to be split and both parts has to be handled separately from now on.\n                        const howMany = old.howMany;\n                        old.howMany = inc.offset - old.offset;\n                        // Add the second part of attribute change to the beginning of processed array so it won't\n                        // be processed again in this loop.\n                        changes.unshift({\n                            type: 'attribute',\n                            offset: incEnd,\n                            howMany: howMany - old.howMany,\n                            count: this._changeCount++\n                        });\n                    }\n                }\n            }\n            if (inc.type == 'remove') {\n                if (old.type == 'insert') {\n                    if (incEnd <= old.offset) {\n                        old.offset -= inc.howMany;\n                    }\n                    else if (incEnd <= oldEnd) {\n                        if (inc.offset < old.offset) {\n                            const intersectionLength = incEnd - old.offset;\n                            old.offset = inc.offset;\n                            old.howMany -= intersectionLength;\n                            inc.nodesToHandle -= intersectionLength;\n                        }\n                        else {\n                            old.howMany -= inc.nodesToHandle;\n                            inc.nodesToHandle = 0;\n                        }\n                    }\n                    else {\n                        if (inc.offset <= old.offset) {\n                            inc.nodesToHandle -= old.howMany;\n                            old.howMany = 0;\n                        }\n                        else if (inc.offset < oldEnd) {\n                            const intersectionLength = oldEnd - inc.offset;\n                            old.howMany -= intersectionLength;\n                            inc.nodesToHandle -= intersectionLength;\n                        }\n                    }\n                }\n                if (old.type == 'remove') {\n                    if (incEnd <= old.offset) {\n                        old.offset -= inc.howMany;\n                    }\n                    else if (inc.offset < old.offset) {\n                        inc.nodesToHandle += old.howMany;\n                        old.howMany = 0;\n                    }\n                }\n                if (old.type == 'attribute') {\n                    if (incEnd <= old.offset) {\n                        old.offset -= inc.howMany;\n                    }\n                    else if (inc.offset < old.offset) {\n                        const intersectionLength = incEnd - old.offset;\n                        old.offset = inc.offset;\n                        old.howMany -= intersectionLength;\n                    }\n                    else if (inc.offset < oldEnd) {\n                        if (incEnd <= oldEnd) {\n                            // On first sight in this case we don't need to split attribute operation into two.\n                            // However the changes set is later converted to actions (see `_generateActionsFromChanges`).\n                            // For that reason, no two changes may intersect.\n                            // So we cannot have an attribute change that \"contains\" remove change.\n                            // Attribute change needs to be split.\n                            const howMany = old.howMany;\n                            old.howMany = inc.offset - old.offset;\n                            const howManyAfter = howMany - old.howMany - inc.nodesToHandle;\n                            // Add the second part of attribute change to the beginning of processed array so it won't\n                            // be processed again in this loop.\n                            changes.unshift({\n                                type: 'attribute',\n                                offset: inc.offset,\n                                howMany: howManyAfter,\n                                count: this._changeCount++\n                            });\n                        }\n                        else {\n                            old.howMany -= oldEnd - inc.offset;\n                        }\n                    }\n                }\n            }\n            if (inc.type == 'attribute') {\n                // In case of attribute change, `howMany` should be kept same as `nodesToHandle`. It's not an error.\n                if (old.type == 'insert') {\n                    if (inc.offset < old.offset && incEnd > old.offset) {\n                        if (incEnd > oldEnd) {\n                            // This case is similar to a case described when incoming change was insert and old change was attribute.\n                            // See comment above.\n                            //\n                            // This time incoming change is attribute. We need to split incoming change in this case too.\n                            // However this time, the second part of the attribute change needs to be processed further\n                            // because there might be other changes that it collides with.\n                            const attributePart = {\n                                type: 'attribute',\n                                offset: oldEnd,\n                                howMany: incEnd - oldEnd,\n                                count: this._changeCount++\n                            };\n                            this._handleChange(attributePart, changes);\n                            changes.push(attributePart);\n                        }\n                        inc.nodesToHandle = old.offset - inc.offset;\n                        inc.howMany = inc.nodesToHandle;\n                    }\n                    else if (inc.offset >= old.offset && inc.offset < oldEnd) {\n                        if (incEnd > oldEnd) {\n                            inc.nodesToHandle = incEnd - oldEnd;\n                            inc.offset = oldEnd;\n                        }\n                        else {\n                            inc.nodesToHandle = 0;\n                        }\n                    }\n                }\n                if (old.type == 'remove') {\n                    // This is a case when attribute change \"contains\" remove change.\n                    // The attribute change needs to be split into two because changes cannot intersect.\n                    if (inc.offset < old.offset && incEnd > old.offset) {\n                        const attributePart = {\n                            type: 'attribute',\n                            offset: old.offset,\n                            howMany: incEnd - old.offset,\n                            count: this._changeCount++\n                        };\n                        this._handleChange(attributePart, changes);\n                        changes.push(attributePart);\n                        inc.nodesToHandle = old.offset - inc.offset;\n                        inc.howMany = inc.nodesToHandle;\n                    }\n                }\n                if (old.type == 'attribute') {\n                    // There are only two conflicting scenarios possible here:\n                    if (inc.offset >= old.offset && incEnd <= oldEnd) {\n                        // `old` change includes `inc` change, or they are the same.\n                        inc.nodesToHandle = 0;\n                        inc.howMany = 0;\n                        inc.offset = 0;\n                    }\n                    else if (inc.offset <= old.offset && incEnd >= oldEnd) {\n                        // `inc` change includes `old` change.\n                        old.howMany = 0;\n                    }\n                }\n            }\n        }\n        inc.howMany = inc.nodesToHandle;\n        delete inc.nodesToHandle;\n    }\n    /**\n     * Returns an object with a single insert change description.\n     *\n     * @param parent The element in which the change happened.\n     * @param offset The offset at which change happened.\n     * @param action Further specifies what kind of action led to generating this change.\n     * @param elementSnapshot Snapshot of the inserted node after changes.\n     * @param elementSnapshotBefore Snapshot of the inserted node before changes.\n     * @returns The diff item.\n     */\n    _getInsertDiff(parent, offset, action, elementSnapshot, elementSnapshotBefore) {\n        const diffItem = {\n            type: 'insert',\n            position: ModelPosition._createAt(parent, offset),\n            name: elementSnapshot.name,\n            attributes: new Map(elementSnapshot.attributes),\n            length: 1,\n            changeCount: this._changeCount++,\n            action\n        };\n        if (action != 'insert' && elementSnapshotBefore) {\n            diffItem.before = {\n                name: elementSnapshotBefore.name,\n                attributes: new Map(elementSnapshotBefore.attributes)\n            };\n        }\n        return diffItem;\n    }\n    /**\n     * Returns an object with a single remove change description.\n     *\n     * @param parent The element in which change happened.\n     * @param offset The offset at which change happened.\n     * @param action Further specifies what kind of action led to generating this change.\n     * @param elementSnapshot The snapshot of the removed node before changes.\n     * @returns The diff item.\n     */\n    _getRemoveDiff(parent, offset, action, elementSnapshot) {\n        return {\n            type: 'remove',\n            action,\n            position: ModelPosition._createAt(parent, offset),\n            name: elementSnapshot.name,\n            attributes: new Map(elementSnapshot.attributes),\n            length: 1,\n            changeCount: this._changeCount++\n        };\n    }\n    /**\n     * Returns an array of objects where each one is a single attribute change description.\n     *\n     * @param range The range where the change happened.\n     * @param oldAttributes A map, map iterator or compatible object that contains attributes before the change.\n     * @param newAttributes A map, map iterator or compatible object that contains attributes after the change.\n     * @returns An array containing one or more diff items.\n     */\n    _getAttributesDiff(range, oldAttributes, newAttributes) {\n        // Results holder.\n        const diffs = [];\n        // Clone new attributes as we will be performing changes on this object.\n        newAttributes = new Map(newAttributes);\n        // Look through old attributes.\n        for (const [key, oldValue] of oldAttributes) {\n            // Check what is the new value of the attribute (or if it was removed).\n            const newValue = newAttributes.has(key) ? newAttributes.get(key) : null;\n            // If values are different (or attribute was removed)...\n            if (newValue !== oldValue) {\n                // Add diff item.\n                diffs.push({\n                    type: 'attribute',\n                    position: range.start,\n                    range: range.clone(),\n                    length: 1,\n                    attributeKey: key,\n                    attributeOldValue: oldValue,\n                    attributeNewValue: newValue,\n                    changeCount: this._changeCount++\n                });\n            }\n            // Prevent returning two diff items for the same change.\n            newAttributes.delete(key);\n        }\n        // Look through new attributes that weren't handled above.\n        for (const [key, newValue] of newAttributes) {\n            // Each of them is a new attribute. Add diff item.\n            diffs.push({\n                type: 'attribute',\n                position: range.start,\n                range: range.clone(),\n                length: 1,\n                attributeKey: key,\n                attributeOldValue: null,\n                attributeNewValue: newValue,\n                changeCount: this._changeCount++\n            });\n        }\n        return diffs;\n    }\n    /**\n     * Checks whether given element or any of its parents is an element that is buffered as an inserted element.\n     */\n    _isInInsertedElement(element) {\n        const parent = element.parent;\n        if (!parent) {\n            return false;\n        }\n        const changes = this._changesInElement.get(parent);\n        const offset = element.startOffset;\n        if (changes) {\n            for (const change of changes) {\n                if (change.type == 'insert' && offset >= change.offset && offset < change.offset + change.howMany) {\n                    return true;\n                }\n            }\n        }\n        return this._isInInsertedElement(parent);\n    }\n    /**\n     * Removes deeply all buffered changes that are registered in elements from range specified by `parent`, `offset`\n     * and `howMany`.\n     */\n    _removeAllNestedChanges(parent, offset, howMany) {\n        const range = new ModelRange(ModelPosition._createAt(parent, offset), ModelPosition._createAt(parent, offset + howMany));\n        for (const item of range.getItems({ shallow: true })) {\n            if (item.is('element')) {\n                this._changesInElement.delete(item);\n                this._removeAllNestedChanges(item, 0, item.maxOffset);\n            }\n        }\n    }\n}\n/**\n * Returns a snapshot for the specified child node. Text node snapshots have the `name` property set to `$text`.\n */\nfunction _getSingleNodeSnapshot(node) {\n    return {\n        node,\n        name: node.is('$text') ? '$text' : node.name,\n        attributes: new Map(node.getAttributes())\n    };\n}\n/**\n * Returns an array that is a copy of passed child list with the exception that text nodes are split to one or more\n * objects, each representing one character and attributes set on that character.\n */\nfunction _getChildrenSnapshots(children) {\n    const snapshots = [];\n    for (const child of children) {\n        if (child.is('$text')) {\n            for (let i = 0; i < child.data.length; ++i) {\n                snapshots.push(_getSingleNodeSnapshot(child));\n            }\n        }\n        else {\n            snapshots.push(_getSingleNodeSnapshot(child));\n        }\n    }\n    return snapshots;\n}\n/**\n * Generates array of diff instructions for given changes set.\n *\n * Generated actions are:\n *\n * - 'e' for 'equal' - when item at that position did not change,\n * - 'i' for 'insert' - when item at that position was inserted,\n * - 'r' for 'remove' - when item at that position was removed,\n * - 'a' for 'attribute' - when item at that position has it attributes changed.\n *\n * Example (assume that uppercase letters have bold attribute, compare with function code):\n *\n * children before:\tfooBAR\n * children after:\tfoxybAR\n *\n * changes: type: remove, offset: 1, howMany: 1\n *\t\t\ttype: insert, offset: 2, howMany: 2\n *\t\t\ttype: attribute, offset: 4, howMany: 1\n *\n * Expected actions: equal (f), remove (o), equal (o), insert (x), insert (y), attribute (b), equal (A), equal (R)\n *\n * Steps taken by the script:\n *\n * 1. change = \"type: remove, offset: 1, howMany: 1\"; offset = 0; oldChildrenHandled = 0\n *    1.1 between this change and the beginning is one not-changed node, fill with one equal action, one old child has been handled\n *    1.2 this change removes one node, add one remove action\n *    1.3 change last visited `offset` to 1\n *    1.4 since an old child has been removed, one more old child has been handled\n *    1.5 actions at this point are: equal, remove\n *\n * 2. change = \"type: insert, offset: 2, howMany: 2\"; offset = 1; oldChildrenHandled = 2\n *    2.1 between this change and previous change is one not-changed node, add equal action, another one old children has been handled\n *    2.2 this change inserts two nodes, add two insert actions\n *    2.3 change last visited offset to the end of the inserted range, that is 4\n *    2.4 actions at this point are: equal, remove, equal, insert, insert\n *\n * 3. change = \"type: attribute, offset: 4, howMany: 1\"; offset = 4, oldChildrenHandled = 3\n *    3.1 between this change and previous change are no not-changed nodes\n *    3.2 this change changes one node, add one attribute action\n *    3.3 change last visited `offset` to the end of change range, that is 5\n *    3.4 since an old child has been changed, one more old child has been handled\n *    3.5 actions at this point are: equal, remove, equal, insert, insert, attribute\n *\n * 4. after loop oldChildrenHandled = 4, oldChildrenLength = 6 (fooBAR is 6 characters)\n *    4.1 fill up with two equal actions\n *\n * The result actions are: equal, remove, equal, insert, insert, attribute, equal, equal.\n */\nfunction _generateDiffInstructionsFromChanges(oldChildrenLength, changes) {\n    const diff = [];\n    let offset = 0;\n    let oldChildrenHandled = 0;\n    // Go through all buffered changes.\n    for (const change of changes) {\n        // First, fill \"holes\" between changes with \"equal\" actions.\n        if (change.offset > offset) {\n            for (let i = 0; i < change.offset - offset; i++) {\n                diff.push('e');\n            }\n            oldChildrenHandled += change.offset - offset;\n        }\n        // Then, fill up actions accordingly to change type.\n        if (change.type == 'insert') {\n            for (let i = 0; i < change.howMany; i++) {\n                diff.push('i');\n            }\n            // The last handled offset is after inserted range.\n            offset = change.offset + change.howMany;\n        }\n        else if (change.type == 'remove') {\n            for (let i = 0; i < change.howMany; i++) {\n                diff.push('r');\n            }\n            // The last handled offset is at the position where the nodes were removed.\n            offset = change.offset;\n            // We removed `howMany` old nodes, update `oldChildrenHandled`.\n            oldChildrenHandled += change.howMany;\n        }\n        else {\n            // Total maximum amount of arguments that can be passed to `Array.prototype.push` may be limited so we need to\n            // add them manually one by one to avoid this limit. However loop might be a bit slower than `push` method on\n            // smaller changesets so we need to decide which method to use based on the size of the change.\n            // See: https://github.com/ckeditor/ckeditor5/issues/16819\n            if (change.howMany > 1500) {\n                for (let i = 0; i < change.howMany; i++) {\n                    diff.push('a');\n                }\n            }\n            else {\n                diff.push(...'a'.repeat(change.howMany).split(''));\n            }\n            // The last handled offset is at the position after the changed range.\n            offset = change.offset + change.howMany;\n            // We changed `howMany` old nodes, update `oldChildrenHandled`.\n            oldChildrenHandled += change.howMany;\n        }\n    }\n    // Fill \"equal\" actions at the end of actions set. Use `oldChildrenHandled` to see how many children\n    // has not been changed / removed at the end of their parent.\n    if (oldChildrenHandled < oldChildrenLength) {\n        for (let i = 0; i < oldChildrenLength - oldChildrenHandled - offset; i++) {\n            diff.push('e');\n        }\n    }\n    return diff;\n}\n/**\n * Filter callback for `Array.filter` that filters out change entries that are in graveyard.\n */\nfunction _changesInGraveyardFilter(entry) {\n    const posInGy = 'position' in entry && entry.position.root.rootName == '$graveyard';\n    const rangeInGy = 'range' in entry && entry.range.root.rootName == '$graveyard';\n    return !posInGy && !rangeInGy;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * @module engine/model/history\n */\n/**\n * `History` keeps the track of all the operations applied to the {@link module:engine/model/document~ModelDocument document}.\n */\nexport class History {\n    /**\n     * Operations added to the history.\n     */\n    _operations = [];\n    /**\n     * Holds an information which {@link module:engine/model/operation/operation~Operation operation} undoes which\n     * {@link module:engine/model/operation/operation~Operation operation}.\n     *\n     * Keys of the map are \"undoing operations\", that is operations that undone some other operations. For each key, the\n     * value is an operation that has been undone by the \"undoing operation\".\n     */\n    _undoPairs = new Map();\n    /**\n     * Holds all undone operations.\n     */\n    _undoneOperations = new Set();\n    /**\n     * A map that allows retrieving the operations fast based on the given base version.\n     */\n    _baseVersionToOperationIndex = new Map();\n    /**\n     * The history version.\n     */\n    _version = 0;\n    /**\n     * The gap pairs kept in the <from,to> format.\n     *\n     * Anytime the `history.version` is set to a version larger than `history.version + 1`,\n     * a new <lastHistoryVersion, newHistoryVersion> entry is added to the map.\n     */\n    _gaps = new Map();\n    /**\n     * The version of the last operation in the history.\n     *\n     * The history version is incremented automatically when a new operation is added to the history.\n     * Setting the version manually should be done only in rare circumstances when a gap is planned\n     * between history versions. When doing so, a gap will be created and the history will accept adding\n     * an operation with base version equal to the new history version.\n     */\n    get version() {\n        return this._version;\n    }\n    set version(version) {\n        // Store a gap if there are some operations already in the history and the\n        // new version does not increment the latest one.\n        if (this._operations.length && version > this._version + 1) {\n            this._gaps.set(this._version, version);\n        }\n        this._version = version;\n    }\n    /**\n     * The last history operation.\n     */\n    get lastOperation() {\n        return this._operations[this._operations.length - 1];\n    }\n    /**\n     * Adds an operation to the history and increments the history version.\n     *\n     * The operation's base version should be equal to the history version. Otherwise an error is thrown.\n     */\n    addOperation(operation) {\n        if (operation.baseVersion !== this.version) {\n            /**\n             * Only operations with matching versions can be added to the history.\n             *\n             * @error model-document-history-addoperation-incorrect-version\n             * @param {module:engine/model/operation/operation~Operation} operation The current operation.\n             * @param {number} historyVersion The current document history version.\n             */\n            throw new CKEditorError('model-document-history-addoperation-incorrect-version', this, {\n                operation,\n                historyVersion: this.version\n            });\n        }\n        this._operations.push(operation);\n        this._version++;\n        this._baseVersionToOperationIndex.set(operation.baseVersion, this._operations.length - 1);\n    }\n    /**\n     * Returns operations from the given range of operation base versions that were added to the history.\n     *\n     * Note that there may be gaps in operations base versions.\n     *\n     * @param fromBaseVersion Base version from which operations should be returned (inclusive).\n     * @param toBaseVersion Base version up to which operations should be returned (exclusive).\n     * @returns History operations for the given range, in chronological order.\n     */\n    getOperations(fromBaseVersion, toBaseVersion = this.version) {\n        // When there is no operation in the history, return an empty array.\n        // After that we can be sure that `firstOperation`, `lastOperation` are not nullish.\n        if (!this._operations.length) {\n            return [];\n        }\n        const firstOperation = this._operations[0];\n        if (fromBaseVersion === undefined) {\n            fromBaseVersion = firstOperation.baseVersion;\n        }\n        // Change exclusive `toBaseVersion` to inclusive, so it will refer to the actual index.\n        // Thanks to that mapping from base versions to operation indexes are possible.\n        let inclusiveTo = toBaseVersion - 1;\n        // Check if \"from\" or \"to\" point to a gap between versions.\n        // If yes, then change the incorrect position to the proper side of the gap.\n        // Thanks to it, it will be possible to get index of the operation.\n        for (const [gapFrom, gapTo] of this._gaps) {\n            if (fromBaseVersion > gapFrom && fromBaseVersion < gapTo) {\n                fromBaseVersion = gapTo;\n            }\n            if (inclusiveTo > gapFrom && inclusiveTo < gapTo) {\n                inclusiveTo = gapFrom - 1;\n            }\n        }\n        // If the whole range is outside of the operation versions, then return an empty array.\n        if (inclusiveTo < firstOperation.baseVersion || fromBaseVersion > this.lastOperation.baseVersion) {\n            return [];\n        }\n        let fromIndex = this._baseVersionToOperationIndex.get(fromBaseVersion);\n        // If the range starts before the first operation, then use the first operation as the range's start.\n        if (fromIndex === undefined) {\n            fromIndex = 0;\n        }\n        let toIndex = this._baseVersionToOperationIndex.get(inclusiveTo);\n        // If the range ends after the last operation, then use the last operation as the range's end.\n        if (toIndex === undefined) {\n            toIndex = this._operations.length - 1;\n        }\n        // Return the part of the history operations based on the calculated start index and end index.\n        return this._operations.slice(fromIndex, \n        // The `toIndex` should be included in the returned operations, so add `1`.\n        toIndex + 1);\n    }\n    /**\n     * Returns operation from the history that bases on given `baseVersion`.\n     *\n     * @param baseVersion Base version of the operation to get.\n     * @returns Operation with given base version or `undefined` if there is no such operation in history.\n     */\n    getOperation(baseVersion) {\n        const operationIndex = this._baseVersionToOperationIndex.get(baseVersion);\n        if (operationIndex === undefined) {\n            return;\n        }\n        return this._operations[operationIndex];\n    }\n    /**\n     * Marks in history that one operation is an operation that is undoing the other operation. By marking operation this way,\n     * history is keeping more context information about operations, which helps in operational transformation.\n     *\n     * @param undoneOperation Operation which is undone by `undoingOperation`.\n     * @param undoingOperation Operation which undoes `undoneOperation`.\n     */\n    setOperationAsUndone(undoneOperation, undoingOperation) {\n        this._undoPairs.set(undoingOperation, undoneOperation);\n        this._undoneOperations.add(undoneOperation);\n    }\n    /**\n     * Checks whether given `operation` is undoing any other operation.\n     *\n     * @param operation Operation to check.\n     * @returns `true` if given `operation` is undoing any other operation, `false` otherwise.\n     */\n    isUndoingOperation(operation) {\n        return this._undoPairs.has(operation);\n    }\n    /**\n     * Checks whether given `operation` has been undone by any other operation.\n     *\n     * @param operation Operation to check.\n     * @returns `true` if given `operation` has been undone any other operation, `false` otherwise.\n     */\n    isUndoneOperation(operation) {\n        return this._undoneOperations.has(operation);\n    }\n    /**\n     * For given `undoingOperation`, returns the operation which has been undone by it.\n     *\n     * @returns Operation that has been undone by given `undoingOperation` or `undefined`\n     * if given `undoingOperation` is not undoing any other operation.\n     */\n    getUndoneOperation(undoingOperation) {\n        return this._undoPairs.get(undoingOperation);\n    }\n    /**\n     * Resets the history of operations.\n     */\n    reset() {\n        this._version = 0;\n        this._undoPairs = new Map();\n        this._operations = [];\n        this._undoneOperations = new Set();\n        this._gaps = new Map();\n        this._baseVersionToOperationIndex = new Map();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/rootelement\n */\nimport { ModelElement } from './element.js';\n/**\n * Type of {@link module:engine/model/element~ModelElement} that is a root of a model tree.\n */\nexport class ModelRootElement extends ModelElement {\n    /**\n     * Unique root name used to identify this root element by {@link module:engine/model/document~ModelDocument}.\n     */\n    rootName;\n    /**\n     * Document that is an owner of this root.\n     */\n    _document;\n    /**\n     * @internal\n     */\n    _isAttached = true;\n    /**\n     * Informs if the root element is loaded (default).\n     *\n     * @internal\n     */\n    _isLoaded = true;\n    /**\n     * Creates root element.\n     *\n     * @param document Document that is an owner of this root.\n     * @param name Node name.\n     * @param rootName Unique root name used to identify this root element by {@link module:engine/model/document~ModelDocument}.\n     */\n    constructor(document, name, rootName = 'main') {\n        super(name);\n        this._document = document;\n        this.rootName = rootName;\n    }\n    /**\n     * {@link module:engine/model/document~ModelDocument Document} that owns this root element.\n     */\n    get document() {\n        return this._document;\n    }\n    /**\n     * Informs if the root element is currently attached to the document, or not.\n     *\n     * A detached root is equivalent to being removed and cannot contain any children or markers.\n     *\n     * By default, a newly added root is attached. It can be detached using\n     * {@link module:engine/model/writer~ModelWriter#detachRoot `Writer#detachRoot`}. A detached root can be re-attached again using\n     * {@link module:engine/model/writer~ModelWriter#addRoot `Writer#addRoot`}.\n     */\n    isAttached() {\n        return this._isAttached;\n    }\n    /**\n     * Converts `RootElement` instance to `string` containing its name.\n     *\n     * @returns `RootElement` instance converted to `string`.\n     */\n    toJSON() {\n        return this.rootName;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelRootElement.prototype.is = function (type, name) {\n    if (!name) {\n        return type === 'rootElement' || type === 'model:rootElement' ||\n            // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n            type === 'element' || type === 'model:element' ||\n            type === 'node' || type === 'model:node';\n    }\n    return name === this.name && (type === 'rootElement' || type === 'model:rootElement' ||\n        // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.\n        type === 'element' || type === 'model:element');\n};\n","import { isPrimitive } from '../../predicate/isPrimitive.mjs';\nimport { getTag } from '../_internal/getTag.mjs';\nimport { arrayBufferTag, dataViewTag, booleanTag, numberTag, stringTag, dateTag, regexpTag, symbolTag, mapTag, setTag, argumentsTag, uint32ArrayTag, uint16ArrayTag, uint8ClampedArrayTag, uint8ArrayTag, objectTag, int32ArrayTag, int16ArrayTag, int8ArrayTag, float64ArrayTag, float32ArrayTag, arrayTag } from '../_internal/tags.mjs';\nimport { isArray } from '../predicate/isArray.mjs';\nimport { isTypedArray } from '../predicate/isTypedArray.mjs';\n\nfunction clone(obj) {\n    if (isPrimitive(obj)) {\n        return obj;\n    }\n    const tag = getTag(obj);\n    if (!isCloneableObject(obj)) {\n        return {};\n    }\n    if (isArray(obj)) {\n        const result = Array.from(obj);\n        if (obj.length > 0 && typeof obj[0] === 'string' && Object.hasOwn(obj, 'index')) {\n            result.index = obj.index;\n            result.input = obj.input;\n        }\n        return result;\n    }\n    if (isTypedArray(obj)) {\n        const typedArray = obj;\n        const Ctor = typedArray.constructor;\n        return new Ctor(typedArray.buffer, typedArray.byteOffset, typedArray.length);\n    }\n    if (tag === arrayBufferTag) {\n        return new ArrayBuffer(obj.byteLength);\n    }\n    if (tag === dataViewTag) {\n        const dataView = obj;\n        const buffer = dataView.buffer;\n        const byteOffset = dataView.byteOffset;\n        const byteLength = dataView.byteLength;\n        const clonedBuffer = new ArrayBuffer(byteLength);\n        const srcView = new Uint8Array(buffer, byteOffset, byteLength);\n        const destView = new Uint8Array(clonedBuffer);\n        destView.set(srcView);\n        return new DataView(clonedBuffer);\n    }\n    if (tag === booleanTag || tag === numberTag || tag === stringTag) {\n        const Ctor = obj.constructor;\n        const clone = new Ctor(obj.valueOf());\n        if (tag === stringTag) {\n            cloneStringObjectProperties(clone, obj);\n        }\n        else {\n            copyOwnProperties(clone, obj);\n        }\n        return clone;\n    }\n    if (tag === dateTag) {\n        return new Date(Number(obj));\n    }\n    if (tag === regexpTag) {\n        const regExp = obj;\n        const clone = new RegExp(regExp.source, regExp.flags);\n        clone.lastIndex = regExp.lastIndex;\n        return clone;\n    }\n    if (tag === symbolTag) {\n        return Object(Symbol.prototype.valueOf.call(obj));\n    }\n    if (tag === mapTag) {\n        const map = obj;\n        const result = new Map();\n        map.forEach((obj, key) => {\n            result.set(key, obj);\n        });\n        return result;\n    }\n    if (tag === setTag) {\n        const set = obj;\n        const result = new Set();\n        set.forEach(obj => {\n            result.add(obj);\n        });\n        return result;\n    }\n    if (tag === argumentsTag) {\n        const args = obj;\n        const result = {};\n        copyOwnProperties(result, args);\n        result.length = args.length;\n        result[Symbol.iterator] = args[Symbol.iterator];\n        return result;\n    }\n    const result = {};\n    copyPrototype(result, obj);\n    copyOwnProperties(result, obj);\n    copySymbolProperties(result, obj);\n    return result;\n}\nfunction isCloneableObject(object) {\n    switch (getTag(object)) {\n        case argumentsTag:\n        case arrayTag:\n        case arrayBufferTag:\n        case dataViewTag:\n        case booleanTag:\n        case dateTag:\n        case float32ArrayTag:\n        case float64ArrayTag:\n        case int8ArrayTag:\n        case int16ArrayTag:\n        case int32ArrayTag:\n        case mapTag:\n        case numberTag:\n        case objectTag:\n        case regexpTag:\n        case setTag:\n        case stringTag:\n        case symbolTag:\n        case uint8ArrayTag:\n        case uint8ClampedArrayTag:\n        case uint16ArrayTag:\n        case uint32ArrayTag: {\n            return true;\n        }\n        default: {\n            return false;\n        }\n    }\n}\nfunction copyOwnProperties(target, source) {\n    for (const key in source) {\n        if (Object.hasOwn(source, key)) {\n            target[key] = source[key];\n        }\n    }\n}\nfunction copySymbolProperties(target, source) {\n    const symbols = Object.getOwnPropertySymbols(source);\n    for (let i = 0; i < symbols.length; i++) {\n        const symbol = symbols[i];\n        if (Object.prototype.propertyIsEnumerable.call(source, symbol)) {\n            target[symbol] = source[symbol];\n        }\n    }\n}\nfunction cloneStringObjectProperties(target, source) {\n    const stringLength = source.valueOf().length;\n    for (const key in source) {\n        if (Object.hasOwn(source, key) && (Number.isNaN(Number(key)) || Number(key) >= stringLength)) {\n            target[key] = source[key];\n        }\n    }\n}\nfunction copyPrototype(target, source) {\n    const proto = Object.getPrototypeOf(source);\n    if (proto !== null) {\n        const Ctor = source.constructor;\n        if (typeof Ctor === 'function') {\n            Object.setPrototypeOf(target, proto);\n        }\n    }\n}\n\nexport { clone };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/document\n */\nimport { Differ } from './differ.js';\nimport { ModelDocumentSelection } from './documentselection.js';\nimport { History } from './history.js';\nimport { ModelRootElement } from './rootelement.js';\nimport { CKEditorError, Collection, EmitterMixin, isInsideSurrogatePair, isInsideCombinedSymbol } from '@ckeditor/ckeditor5-utils';\nimport { clone } from 'es-toolkit/compat';\n// @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' );\nconst graveyardName = '$graveyard';\n/**\n * Data model's document. It contains the model's structure, its selection and the history of changes.\n *\n * Read more about working with the model in\n * {@glink framework/architecture/editing-engine#model introduction to the the editing engine's architecture}.\n *\n * Usually, the document contains just one {@link module:engine/model/document~ModelDocument#roots root element}, so\n * you can retrieve it by just calling {@link module:engine/model/document~ModelDocument#getRoot} without specifying its name:\n *\n * ```ts\n * model.document.getRoot(); // -> returns the main root\n * ```\n *\n * However, the document may contain multiple roots – e.g. when the editor has multiple editable areas\n * (e.g. a title and a body of a message).\n */\nexport class ModelDocument extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * The {@link module:engine/model/model~Model model} that the document is a part of.\n     */\n    model;\n    /**\n     * The document's history.\n     */\n    history;\n    /**\n     * The selection in this document.\n     */\n    selection;\n    /**\n     * A list of roots that are owned and managed by this document. Use {@link #createRoot}, {@link #getRoot} and\n     * {@link #getRootNames} to manipulate it.\n     */\n    roots;\n    /**\n     * The model differ object. Its role is to buffer changes done on the model document and then calculate a diff of those changes.\n     */\n    differ;\n    /**\n     * Defines whether the document is in a read-only mode.\n     *\n     * The user should not be able to change the data of a document that is read-only.\n     *\n     * @readonly\n     */\n    isReadOnly;\n    /**\n     * Post-fixer callbacks registered to the model document.\n     */\n    _postFixers;\n    /**\n     * A flag that indicates whether the selection has changed since last change block.\n     */\n    _hasSelectionChangedFromTheLastChangeBlock;\n    /**\n     * Creates an empty document instance with no {@link #roots} (other than\n     * the {@link #graveyard graveyard root}).\n     */\n    constructor(model) {\n        super();\n        this.model = model;\n        this.history = new History();\n        this.selection = new ModelDocumentSelection(this);\n        this.roots = new Collection({ idProperty: 'rootName' });\n        this.differ = new Differ(model.markers);\n        this.isReadOnly = false;\n        this._postFixers = new Set();\n        this._hasSelectionChangedFromTheLastChangeBlock = false;\n        // Graveyard tree root. Document always have a graveyard root, which stores removed nodes.\n        this.createRoot('$root', graveyardName);\n        // Then, still before an operation is applied on model, buffer the change in differ.\n        this.listenTo(model, 'applyOperation', (evt, args) => {\n            const operation = args[0];\n            if (operation.isDocumentOperation) {\n                this.differ.bufferOperation(operation);\n            }\n        }, { priority: 'high' });\n        // After the operation is applied, bump document's version and add the operation to the history.\n        this.listenTo(model, 'applyOperation', (evt, args) => {\n            const operation = args[0];\n            if (operation.isDocumentOperation) {\n                this.history.addOperation(operation);\n            }\n        }, { priority: 'low' });\n        // Listen to selection changes. If selection changed, mark it.\n        this.listenTo(this.selection, 'change', () => {\n            this._hasSelectionChangedFromTheLastChangeBlock = true;\n        });\n        // Buffer marker changes.\n        // This is not covered in buffering operations because markers may change outside of them (when they\n        // are modified using `model.markers` collection, not through `MarkerOperation`).\n        this.listenTo(model.markers, 'update', (evt, marker, oldRange, newRange, oldMarkerData) => {\n            // Copy the `newRange` to the new marker data as during the marker removal the range is not updated.\n            const newMarkerData = { ...marker.getData(), range: newRange };\n            // Whenever marker is updated, buffer that change.\n            this.differ.bufferMarkerChange(marker.name, oldMarkerData, newMarkerData);\n            if (oldRange === null) {\n                // If this is a new marker, add a listener that will buffer change whenever marker changes.\n                marker.on('change', (evt, oldRange) => {\n                    const markerData = marker.getData();\n                    this.differ.bufferMarkerChange(marker.name, { ...markerData, range: oldRange }, markerData);\n                });\n            }\n        });\n        // This is a solution for a problem that may occur during real-time editing. If one client detached a root and another added\n        // something there at the same moment, the OT does not solve this problem currently. In such situation, the added elements would\n        // stay in the detached root.\n        //\n        // This is incorrect, a detached root should be empty and all elements from it should be removed. To solve this, the post-fixer will\n        // remove any element that is left in a detached root.\n        //\n        // Similarly, markers that are created at the beginning or at the end of the detached root will not be removed as well.\n        //\n        // The drawback of this solution over the OT solution is that the elements removed by the post-fixer will never be brought back.\n        // If the root detachment gets undone (and the root is brought back), the removed elements will not be there.\n        this.registerPostFixer(writer => {\n            let result = false;\n            for (const root of this.roots) {\n                if (!root.isAttached() && !root.isEmpty) {\n                    writer.remove(writer.createRangeIn(root));\n                    result = true;\n                }\n            }\n            for (const marker of this.model.markers) {\n                if (!marker.getRange().root.isAttached()) {\n                    writer.removeMarker(marker);\n                    result = true;\n                }\n            }\n            return result;\n        });\n    }\n    /**\n     * The document version. Every applied operation increases the version number. It is used to\n     * ensure that operations are applied on a proper document version.\n     *\n     * This property is equal to {@link module:engine/model/history~History#version `model.Document#history#version`}.\n     *\n     * If the {@link module:engine/model/operation/operation~Operation#baseVersion base version} does not match the document version,\n     * a {@link module:utils/ckeditorerror~CKEditorError model-document-applyoperation-wrong-version} error is thrown.\n     */\n    get version() {\n        return this.history.version;\n    }\n    set version(version) {\n        this.history.version = version;\n    }\n    /**\n     * The graveyard tree root. A document always has a graveyard root that stores removed nodes.\n     */\n    get graveyard() {\n        return this.getRoot(graveyardName);\n    }\n    /**\n     * Creates a new root.\n     *\n     * **Note:** do not use this method after the editor has been initialized! If you want to dynamically add a root, use\n     * {@link module:engine/model/writer~ModelWriter#addRoot `model.Writer#addRoot`} instead.\n     *\n     * @param elementName The element name. Defaults to `'$root'` which also has some basic schema defined\n     * (e.g. `$block` elements are allowed inside the `$root`). Make sure to define a proper schema if you use a different name.\n     * @param rootName A unique root name.\n     * @returns The created root.\n     */\n    createRoot(elementName = '$root', rootName = 'main') {\n        if (this.roots.get(rootName)) {\n            /**\n             * A root with the specified name already exists.\n             *\n             * @error model-document-createroot-name-exists\n             */\n            throw new CKEditorError('model-document-createroot-name-exists', this, { name: rootName });\n        }\n        const root = new ModelRootElement(this, elementName, rootName);\n        this.roots.add(root);\n        return root;\n    }\n    /**\n     * Removes all event listeners set by the document instance.\n     */\n    destroy() {\n        this.selection.destroy();\n        this.stopListening();\n    }\n    /**\n     * Returns a root by its name.\n     *\n     * Detached roots are returned by this method. This is to be able to operate on the detached root (for example, to be able to create\n     * a position inside such a root for undo feature purposes).\n     *\n     * @param name The root name of the root to return.\n     * @returns The root registered under a given name or `null` when there is no root with the given name.\n     */\n    getRoot(name = 'main') {\n        return this.roots.get(name);\n    }\n    /**\n     * Returns an array with names of all roots added to the document (except the {@link #graveyard graveyard root}).\n     *\n     * Detached roots **are not** returned by this method by default. This is to make sure that all features or algorithms that operate\n     * on the document data know which roots are still a part of the document and should be processed.\n     *\n     * @param includeDetached Specified whether detached roots should be returned as well.\n     */\n    getRootNames(includeDetached = false) {\n        return this.getRoots(includeDetached).map(root => root.rootName);\n    }\n    /**\n     * Returns an array with all roots added to the document (except the {@link #graveyard graveyard root}).\n     *\n     * Detached roots **are not** returned by this method by default. This is to make sure that all features or algorithms that operate\n     * on the document data know which roots are still a part of the document and should be processed.\n     *\n     * @param includeDetached Specified whether detached roots should be returned as well.\n     */\n    getRoots(includeDetached = false) {\n        return this.roots.filter(root => root != this.graveyard && (includeDetached || root.isAttached()) && root._isLoaded);\n    }\n    /**\n     * Used to register a post-fixer callback. A post-fixer mechanism guarantees that the features\n     * will operate on a correct model state.\n     *\n     * An execution of a feature may lead to an incorrect document tree state. The callbacks are used to fix the document tree after\n     * it has changed. Post-fixers are fired just after all changes from the outermost change block were applied but\n     * before the {@link module:engine/model/document~ModelDocument#event:change change event} is fired. If a post-fixer callback made\n     * a change, it should return `true`. When this happens, all post-fixers are fired again to check if something else should\n     * not be fixed in the new document tree state.\n     *\n     * As a parameter, a post-fixer callback receives a {@link module:engine/model/writer~ModelWriter writer} instance connected with the\n     * executed changes block. Thanks to that, all changes done by the callback will be added to the same\n     * {@link module:engine/model/batch~Batch batch} (and undo step) as the original changes. This makes post-fixer changes transparent\n     * for the user.\n     *\n     * An example of a post-fixer is a callback that checks if all the data were removed from the editor. If so, the\n     * callback should add an empty paragraph so that the editor is never empty:\n     *\n     * ```ts\n     * document.registerPostFixer( writer => {\n     * \tconst changes = document.differ.getChanges();\n     *\n     * \t// Check if the changes lead to an empty root in the editor.\n     * \tfor ( const entry of changes ) {\n     * \t\tif ( entry.type == 'remove' && entry.position.root.isEmpty ) {\n     * \t\t\twriter.insertElement( 'paragraph', entry.position.root, 0 );\n     *\n     * \t\t\t// It is fine to return early, even if multiple roots would need to be fixed.\n     * \t\t\t// All post-fixers will be fired again, so if there are more empty roots, those will be fixed, too.\n     * \t\t\treturn true;\n     * \t\t}\n     * \t}\n     *\n     * \treturn false;\n     * } );\n     * ```\n     */\n    registerPostFixer(postFixer) {\n        this._postFixers.add(postFixer);\n    }\n    /**\n     * A custom `toJSON()` method to solve child-parent circular dependencies.\n     *\n     * @returns A clone of this object with the document property changed to a string.\n     */\n    toJSON() {\n        const json = clone(this);\n        // Due to circular references we need to remove parent reference.\n        json.selection = '[engine.model.DocumentSelection]';\n        json.model = '[engine.model.Model]';\n        return json;\n    }\n    /**\n     * Check if there were any changes done on document, and if so, call post-fixers,\n     * fire `change` event for features and conversion and then reset the differ.\n     * Fire `change:data` event when at least one operation or buffered marker changes the data.\n     *\n     * @internal\n     * @fires change\n     * @fires change:data\n     * @param writer The writer on which post-fixers will be called.\n     */\n    _handleChangeBlock(writer) {\n        if (this._hasDocumentChangedFromTheLastChangeBlock()) {\n            this._callPostFixers(writer);\n            // Refresh selection attributes according to the final position in the model after the change.\n            this.selection.refresh();\n            if (this.differ.hasDataChanges()) {\n                this.fire('change:data', writer.batch);\n            }\n            else {\n                this.fire('change', writer.batch);\n            }\n            // Theoretically, it is not necessary to refresh selection after change event because\n            // post-fixers are the last who should change the model, but just in case...\n            this.selection.refresh();\n            this.differ.reset();\n        }\n        this._hasSelectionChangedFromTheLastChangeBlock = false;\n    }\n    /**\n     * Returns whether there is a buffered change or if the selection has changed from the last\n     * {@link module:engine/model/model~Model#enqueueChange `enqueueChange()` block}\n     * or {@link module:engine/model/model~Model#change `change()` block}.\n     *\n     * @returns Returns `true` if document has changed from the last `change()` or `enqueueChange()` block.\n     */\n    _hasDocumentChangedFromTheLastChangeBlock() {\n        return !this.differ.isEmpty || this._hasSelectionChangedFromTheLastChangeBlock;\n    }\n    /**\n     * Returns the default root for this document which is either the first root that was added to the document using\n     * {@link #createRoot} or the {@link #graveyard graveyard root} if no other roots were created.\n     *\n     * @returns The default root for this document.\n     */\n    _getDefaultRoot() {\n        const roots = this.getRoots();\n        return roots.length ? roots[0] : this.graveyard;\n    }\n    /**\n     * Returns the default range for this selection. The default range is a collapsed range that starts and ends\n     * at the beginning of this selection's document {@link #_getDefaultRoot default root}.\n     *\n     * @internal\n     */\n    _getDefaultRange() {\n        const defaultRoot = this._getDefaultRoot();\n        const model = this.model;\n        const schema = model.schema;\n        // Find the first position where the selection can be put.\n        const position = model.createPositionFromPath(defaultRoot, [0]);\n        const nearestRange = schema.getNearestSelectionRange(position);\n        // If valid selection range is not found - return range collapsed at the beginning of the root.\n        return nearestRange || model.createRange(position);\n    }\n    /**\n     * Checks whether a given {@link module:engine/model/range~ModelRange range} is a valid range for\n     * the {@link #selection document's selection}.\n     *\n     * @internal\n     * @param range A range to check.\n     * @returns `true` if `range` is valid, `false` otherwise.\n     */\n    _validateSelectionRange(range) {\n        return range.start.isValid() && range.end.isValid() &&\n            validateTextNodePosition(range.start) && validateTextNodePosition(range.end);\n    }\n    /**\n     * Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.\n     *\n     * @param writer The writer on which post-fixer callbacks will be called.\n     */\n    _callPostFixers(writer) {\n        let wasFixed = false;\n        do {\n            for (const callback of this._postFixers) {\n                // Ensure selection attributes are up to date before each post-fixer.\n                // https://github.com/ckeditor/ckeditor5-engine/issues/1673.\n                //\n                // It might be good to refresh the selection after each operation but at the moment it leads\n                // to losing attributes for composition or and spell checking\n                // https://github.com/ckeditor/ckeditor5-typing/issues/188\n                this.selection.refresh();\n                wasFixed = callback(writer);\n                if (wasFixed) {\n                    break;\n                }\n            }\n        } while (wasFixed);\n    }\n}\n/**\n * Checks whether given range boundary position is valid for document selection, meaning that is not between\n * unicode surrogate pairs or base character and combining marks.\n */\nfunction validateTextNodePosition(rangeBoundary) {\n    const textNode = rangeBoundary.textNode;\n    if (textNode) {\n        const data = textNode.data;\n        const offset = rangeBoundary.offset - textNode.startOffset;\n        return !isInsideSurrogatePair(data, offset) && !isInsideCombinedSymbol(data, offset);\n    }\n    return true;\n}\n","function isArray(value) {\n    return Array.isArray(value);\n}\n\nexport { isArray };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/markercollection\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { ModelLiveRange } from './liverange.js';\nimport { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * The collection of all {@link module:engine/model/markercollection~Marker markers} attached to the document.\n * It lets you {@link module:engine/model/markercollection~MarkerCollection#get get} markers or track them using\n * {@link module:engine/model/markercollection~MarkerCollection#event:update} event.\n *\n * To create, change or remove makers use {@link module:engine/model/writer~ModelWriter model writers'} methods:\n * {@link module:engine/model/writer~ModelWriter#addMarker} or {@link module:engine/model/writer~ModelWriter#removeMarker}. Since\n * the writer is the only proper way to change the data model it is not possible to change markers directly using this\n * collection. All markers created by the writer will be automatically added to this collection.\n *\n * By default there is one marker collection available as {@link module:engine/model/model~Model#markers model property}.\n *\n * @see module:engine/model/markercollection~Marker\n */\nexport class MarkerCollection extends /* #__PURE__ */ EmitterMixin() {\n    /**\n     * Stores {@link ~Marker markers} added to the collection.\n     */\n    _markers = new Map();\n    /**\n     * Iterable interface.\n     *\n     * Iterates over all {@link ~Marker markers} added to the collection.\n     */\n    [Symbol.iterator]() {\n        return this._markers.values();\n    }\n    /**\n     * Checks if given {@link ~Marker marker} or marker name is in the collection.\n     *\n     * @param markerOrName Name of marker or marker instance to check.\n     * @returns `true` if marker is in the collection, `false` otherwise.\n     */\n    has(markerOrName) {\n        const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;\n        return this._markers.has(markerName);\n    }\n    /**\n     * Returns {@link ~Marker marker} with given `markerName`.\n     *\n     * @param markerName Name of marker to get.\n     * @returns Marker with given name or `null` if such marker was\n     * not added to the collection.\n     */\n    get(markerName) {\n        return this._markers.get(markerName) || null;\n    }\n    /**\n     * Creates and adds a {@link ~Marker marker} to the `MarkerCollection` with given name on given\n     * {@link module:engine/model/range~ModelRange range}.\n     *\n     * If `MarkerCollection` already had a marker with given name (or {@link ~Marker marker} was passed), the marker in\n     * collection is updated and {@link module:engine/model/markercollection~MarkerCollection#event:update} event is fired\n     * but only if there was a change (marker range or {@link module:engine/model/markercollection~Marker#managedUsingOperations}\n     * flag has changed.\n     *\n     * @internal\n     * @fires update\n     * @param markerOrName Name of marker to set or marker instance to update.\n     * @param range Marker range.\n     * @param managedUsingOperations Specifies whether the marker is managed using operations.\n     * @param affectsData Specifies whether the marker affects the data produced by the data pipeline\n     * (is persisted in the editor's data).\n     * @returns `Marker` instance which was added or updated.\n     */\n    _set(markerOrName, range, managedUsingOperations = false, affectsData = false) {\n        const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;\n        if (markerName.includes(',')) {\n            /**\n             * Marker name cannot contain the \",\" character.\n             *\n             * @error markercollection-incorrect-marker-name\n             */\n            throw new CKEditorError('markercollection-incorrect-marker-name', this);\n        }\n        const oldMarker = this._markers.get(markerName);\n        if (oldMarker) {\n            const oldMarkerData = oldMarker.getData();\n            const oldRange = oldMarker.getRange();\n            let hasChanged = false;\n            if (!oldRange.isEqual(range)) {\n                oldMarker._attachLiveRange(ModelLiveRange.fromRange(range));\n                hasChanged = true;\n            }\n            if (managedUsingOperations != oldMarker.managedUsingOperations) {\n                oldMarker._managedUsingOperations = managedUsingOperations;\n                hasChanged = true;\n            }\n            if (typeof affectsData === 'boolean' && affectsData != oldMarker.affectsData) {\n                oldMarker._affectsData = affectsData;\n                hasChanged = true;\n            }\n            if (hasChanged) {\n                this.fire(`update:${markerName}`, oldMarker, oldRange, range, oldMarkerData);\n            }\n            return oldMarker;\n        }\n        const liveRange = ModelLiveRange.fromRange(range);\n        const marker = new Marker(markerName, liveRange, managedUsingOperations, affectsData);\n        this._markers.set(markerName, marker);\n        this.fire(`update:${markerName}`, marker, null, range, { ...marker.getData(), range: null });\n        return marker;\n    }\n    /**\n     * Removes given {@link ~Marker marker} or a marker with given name from the `MarkerCollection`.\n     *\n     * @internal\n     * @fires update\n     * @param markerOrName Marker or name of a marker to remove.\n     * @returns `true` if marker was found and removed, `false` otherwise.\n     */\n    _remove(markerOrName) {\n        const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;\n        const oldMarker = this._markers.get(markerName);\n        if (oldMarker) {\n            this._markers.delete(markerName);\n            this.fire(`update:${markerName}`, oldMarker, oldMarker.getRange(), null, oldMarker.getData());\n            this._destroyMarker(oldMarker);\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Fires an {@link module:engine/model/markercollection~MarkerCollection#event:update} event for the given {@link ~Marker marker}\n     * but does not change the marker. Useful to force {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast\n     * conversion} for the marker.\n     *\n     * @internal\n     * @fires update\n     * @param markerOrName Marker or name of a marker to refresh.\n     */\n    _refresh(markerOrName) {\n        const markerName = markerOrName instanceof Marker ? markerOrName.name : markerOrName;\n        const marker = this._markers.get(markerName);\n        if (!marker) {\n            /**\n             * Marker with provided name does not exists.\n             *\n             * @error markercollection-refresh-marker-not-exists\n             */\n            throw new CKEditorError('markercollection-refresh-marker-not-exists', this);\n        }\n        const range = marker.getRange();\n        this.fire(`update:${markerName}`, marker, range, range, marker.getData());\n    }\n    /**\n     * Returns iterator that iterates over all markers, which ranges\n     * contain given {@link module:engine/model/position~ModelPosition position}.\n     */\n    *getMarkersAtPosition(position) {\n        for (const marker of this) {\n            if (marker.getRange().containsPosition(position)) {\n                yield marker;\n            }\n        }\n    }\n    /**\n     * Returns iterator that iterates over all markers, which intersects with given {@link module:engine/model/range~ModelRange range}.\n     */\n    *getMarkersIntersectingRange(range) {\n        for (const marker of this) {\n            if (marker.getRange().getIntersection(range) !== null) {\n                yield marker;\n            }\n        }\n    }\n    /**\n     * Destroys marker collection and all markers inside it.\n     */\n    destroy() {\n        for (const marker of this._markers.values()) {\n            this._destroyMarker(marker);\n        }\n        this._markers = null;\n        this.stopListening();\n    }\n    /**\n     * Iterates over all markers that starts with given `prefix`.\n     *\n     * ```ts\n     * const markerFooA = markersCollection._set( 'foo:a', rangeFooA );\n     * const markerFooB = markersCollection._set( 'foo:b', rangeFooB );\n     * const markerBarA = markersCollection._set( 'bar:a', rangeBarA );\n     * const markerFooBarA = markersCollection._set( 'foobar:a', rangeFooBarA );\n     * Array.from( markersCollection.getMarkersGroup( 'foo' ) ); // [ markerFooA, markerFooB ]\n     * Array.from( markersCollection.getMarkersGroup( 'a' ) ); // []\n     * ```\n     */\n    *getMarkersGroup(prefix) {\n        for (const marker of this._markers.values()) {\n            if (marker.name.startsWith(prefix + ':')) {\n                yield marker;\n            }\n        }\n    }\n    /**\n     * Destroys the marker.\n     */\n    _destroyMarker(marker) {\n        marker.stopListening();\n        marker._detachLiveRange();\n    }\n}\n/**\n * `Marker` is a continuous part of the model (like a range), is named and represents some kind of information about the\n * marked part of the model document. In contrary to {@link module:engine/model/node~ModelNode nodes}, which are building blocks of\n * the model document tree, markers are not stored directly in the document tree but in the\n * {@link module:engine/model/model~Model#markers model markers' collection}. Still, they are document data, by giving\n * additional meaning to the part of a model document between marker start and marker end.\n *\n * In this sense, markers are similar to adding and converting attributes on nodes. The difference is that attribute is\n * connected with a given node (e.g. a character is bold no matter if it gets moved or content around it changes).\n * Markers on the other hand are continuous ranges and are characterized by their start and end position. This means that\n * any character in the marker is marked by the marker. For example, if a character is moved outside of marker it stops being\n * \"special\" and the marker is shrunk. Similarly, when a character is moved into the marker from other place in document\n * model, it starts being \"special\" and the marker is enlarged.\n *\n * Another upside of markers is that finding marked part of document is fast and easy. Using attributes to mark some nodes\n * and then trying to find that part of document would require traversing whole document tree. Marker gives instant access\n * to the range which it is marking at the moment.\n *\n * Markers are built from a name and a range.\n *\n * Range of the marker is updated automatically when document changes, using\n * {@link module:engine/model/liverange~ModelLiveRange live range} mechanism.\n *\n * Name is used to group and identify markers. Names have to be unique, but markers can be grouped by\n * using common prefixes, separated with `:`, for example: `user:john` or `search:3`. That's useful in term of creating\n * namespaces for custom elements (e.g. comments, highlights). You can use this prefixes in\n * {@link module:engine/model/markercollection~MarkerCollection#event:update} listeners to listen on changes in a group of markers.\n * For instance: `model.markers.on( 'update:user', callback );` will be called whenever any `user:*` markers changes.\n *\n * There are two types of markers.\n *\n * 1. Markers managed directly, without using operations. They are added directly by {@link module:engine/model/writer~ModelWriter}\n * to the {@link module:engine/model/markercollection~MarkerCollection} without any additional mechanism. They can be used\n * as bookmarks or visual markers. They are great for showing results of the find, or select link when the focus is in the input.\n *\n * 1. Markers managed using operations. These markers are also stored in {@link module:engine/model/markercollection~MarkerCollection}\n * but changes in these markers is managed the same way all other changes in the model structure - using operations.\n * Therefore, they are handled in the undo stack and synchronized between clients if the collaboration plugin is enabled.\n * This type of markers is useful for solutions like spell checking or comments.\n *\n * Both type of them should be added / updated by {@link module:engine/model/writer~ModelWriter#addMarker}\n * and removed by {@link module:engine/model/writer~ModelWriter#removeMarker} methods.\n *\n * ```ts\n * model.change( ( writer ) => {\n * \tconst marker = writer.addMarker( name, { range, usingOperation: true } );\n *\n * \t// ...\n *\n * \twriter.removeMarker( marker );\n * } );\n * ```\n *\n * See {@link module:engine/model/writer~ModelWriter} to find more examples.\n *\n * Since markers need to track change in the document, for efficiency reasons, it is best to create and keep as little\n * markers as possible and remove them as soon as they are not needed anymore.\n *\n * Markers can be downcasted and upcasted.\n *\n * Markers downcast happens on {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker} and\n * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:removeMarker} events.\n * Use {@link module:engine/conversion/downcasthelpers downcast converters} or attach a custom converter to mentioned events.\n * For {@link module:engine/controller/datacontroller~DataController data pipeline}, marker should be downcasted to an element.\n * Then, it can be upcasted back to a marker. Again, use {@link module:engine/conversion/upcasthelpers upcast converters} or\n * attach a custom converter to {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element}.\n *\n * `Marker` instances are created and destroyed only by {@link ~MarkerCollection MarkerCollection}.\n */\nclass Marker extends /* #__PURE__ */ EmitterMixin(ModelTypeCheckable) {\n    /**\n     * Marker's name.\n     */\n    name;\n    /**\n     * Flag indicates if the marker is managed using operations or not.\n     *\n     * @internal\n     */\n    _managedUsingOperations;\n    /**\n     * Specifies whether the marker affects the data produced by the data pipeline\n     * (is persisted in the editor's data).\n     *\n     * @internal\n     */\n    _affectsData;\n    /**\n     * Range marked by the marker.\n     */\n    _liveRange;\n    /**\n     * Creates a marker instance.\n     *\n     * @param name Marker name.\n     * @param liveRange Range marked by the marker.\n     * @param managedUsingOperations Specifies whether the marker is managed using operations.\n     * @param affectsData Specifies whether the marker affects the data produced by the data pipeline (is persisted in the editor's data).\n     */\n    constructor(name, liveRange, managedUsingOperations, affectsData) {\n        super();\n        this.name = name;\n        this._liveRange = this._attachLiveRange(liveRange);\n        this._managedUsingOperations = managedUsingOperations;\n        this._affectsData = affectsData;\n    }\n    /**\n     * A value indicating if the marker is managed using operations.\n     * See {@link ~Marker marker class description} to learn more about marker types.\n     * See {@link module:engine/model/writer~ModelWriter#addMarker}.\n     */\n    get managedUsingOperations() {\n        if (!this._liveRange) {\n            throw new CKEditorError('marker-destroyed', this);\n        }\n        return this._managedUsingOperations;\n    }\n    /**\n     * A value indicating if the marker changes the data.\n     */\n    get affectsData() {\n        if (!this._liveRange) {\n            throw new CKEditorError('marker-destroyed', this);\n        }\n        return this._affectsData;\n    }\n    /**\n     * Returns the marker data (properties defining the marker).\n     */\n    getData() {\n        return {\n            range: this.getRange(),\n            affectsData: this.affectsData,\n            managedUsingOperations: this.managedUsingOperations\n        };\n    }\n    /**\n     * Returns current marker start position.\n     */\n    getStart() {\n        if (!this._liveRange) {\n            throw new CKEditorError('marker-destroyed', this);\n        }\n        return this._liveRange.start.clone();\n    }\n    /**\n     * Returns current marker end position.\n     */\n    getEnd() {\n        if (!this._liveRange) {\n            throw new CKEditorError('marker-destroyed', this);\n        }\n        return this._liveRange.end.clone();\n    }\n    /**\n     * Returns a range that represents the current state of the marker.\n     *\n     * Keep in mind that returned value is a {@link module:engine/model/range~ModelRange Range}, not a\n     * {@link module:engine/model/liverange~ModelLiveRange ModelLiveRange}. This means that it is up-to-date and relevant only\n     * until next model document change. Do not store values returned by this method. Instead, store {@link ~Marker#name}\n     * and get `Marker` instance from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection} every\n     * time there is a need to read marker properties. This will guarantee that the marker has not been removed and\n     * that it's data is up-to-date.\n     */\n    getRange() {\n        if (!this._liveRange) {\n            throw new CKEditorError('marker-destroyed', this);\n        }\n        return this._liveRange.toRange();\n    }\n    /**\n     * Converts `Marker` to plain object and returns it.\n     *\n     * @returns `Marker` converted to plain object.\n     */\n    toJSON() {\n        return {\n            name: this.name,\n            range: this._liveRange?.toJSON(),\n            usingOperations: this._managedUsingOperations,\n            affectsData: this._affectsData\n        };\n    }\n    /**\n     * Binds new live range to the marker and detach the old one if is attached.\n     *\n     * @internal\n     * @param liveRange Live range to attach\n     * @returns Attached live range.\n     */\n    _attachLiveRange(liveRange) {\n        if (this._liveRange) {\n            this._detachLiveRange();\n        }\n        // Delegating does not work with namespaces. Alternatively, we could delegate all events (using `*`).\n        liveRange.delegate('change:range').to(this);\n        liveRange.delegate('change:content').to(this);\n        this._liveRange = liveRange;\n        return liveRange;\n    }\n    /**\n     * Unbinds and destroys currently attached live range.\n     *\n     * @internal\n     */\n    _detachLiveRange() {\n        this._liveRange.stopDelegating('change:range', this);\n        this._liveRange.stopDelegating('change:content', this);\n        this._liveRange.detach();\n        this._liveRange = null;\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nMarker.prototype.is = function (type) {\n    return type === 'marker' || type === 'model:marker';\n};\nexport { Marker };\n/**\n * Cannot use a {@link module:engine/model/markercollection~MarkerCollection#destroy destroyed marker} instance.\n *\n * @error marker-destroyed\n */\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/operation/detachoperation\n */\nimport { Operation } from './operation.js';\nimport { ModelRange } from '../range.js';\nimport { _remove } from './utils.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const ModelRange = require( '../range' ).default;\n/**\n * Operation to permanently remove node from detached root.\n * Note this operation is only a local operation and won't be send to the other clients.\n *\n * @internal\n */\nexport class DetachOperation extends Operation {\n    /**\n     * Position before the first {@link module:engine/model/item~ModelItem model item} to detach.\n     */\n    sourcePosition;\n    /**\n     * Offset size of moved range.\n     */\n    howMany;\n    /**\n     * Creates an insert operation.\n     *\n     * @param sourcePosition Position before the first {@link module:engine/model/item~ModelItem model item} to move.\n     * @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at\n     * `sourcePosition` with offset shifted by `howMany`.\n     */\n    constructor(sourcePosition, howMany) {\n        super(null);\n        this.sourcePosition = sourcePosition.clone();\n        this.howMany = howMany;\n    }\n    /**\n     * @inheritDoc\n     */\n    get type() {\n        return 'detach';\n    }\n    /**\n     * @inheritDoc\n     */\n    get affectedSelectable() {\n        return null;\n    }\n    /**\n     * @inheritDoc\n     */\n    toJSON() {\n        const json = super.toJSON();\n        json.sourcePosition = this.sourcePosition.toJSON();\n        return json;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _validate() {\n        if (this.sourcePosition.root.document) {\n            /**\n             * Cannot detach document node.\n             *\n             * @error detach-operation-on-document-node\n             */\n            throw new CKEditorError('detach-operation-on-document-node', this);\n        }\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    _execute() {\n        _remove(ModelRange._createFromPositionAndShift(this.sourcePosition, this.howMany));\n    }\n    /**\n     * @inheritDoc\n     */\n    static get className() {\n        return 'DetachOperation';\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/documentfragment\n */\nimport { ModelTypeCheckable } from './typecheckable.js';\nimport { ModelElement } from './element.js';\nimport { ModelNodeList } from './nodelist.js';\nimport { ModelText } from './text.js';\nimport { ModelTextProxy } from './textproxy.js';\nimport { isIterable } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const { stringifyMap } = require( '../dev-utils/utils' );\n/**\n * ModelDocumentFragment represents a part of model which does not have a common root but its top-level nodes\n * can be seen as siblings. In other words, it is a detached part of model tree, without a root.\n *\n * ModelDocumentFragment has own {@link module:engine/model/markercollection~MarkerCollection}. Markers from this collection\n * will be set to the {@link module:engine/model/model~Model#markers model markers} by a\n * {@link module:engine/model/writer~ModelWriter#insert} function.\n */\nexport class ModelDocumentFragment extends ModelTypeCheckable {\n    /**\n     * ModelDocumentFragment static markers map. This is a list of names and {@link module:engine/model/range~ModelRange ranges}\n     * which will be set as Markers to {@link module:engine/model/model~Model#markers model markers collection}\n     * when ModelDocumentFragment will be inserted to the document.\n     */\n    markers = new Map();\n    /**\n     * List of nodes contained inside the document fragment.\n     */\n    _children = new ModelNodeList();\n    /**\n     * Creates an empty `ModelDocumentFragment`.\n     *\n     * **Note:** Constructor of this class shouldn't be used directly in the code.\n     * Use the {@link module:engine/model/writer~ModelWriter#createDocumentFragment} method instead.\n     *\n     * @internal\n     * @param children Nodes to be contained inside the `ModelDocumentFragment`.\n     */\n    constructor(children) {\n        super();\n        if (children) {\n            this._insertChild(0, children);\n        }\n    }\n    /**\n     * Returns an iterator that iterates over all nodes contained inside this document fragment.\n     */\n    [Symbol.iterator]() {\n        return this.getChildren();\n    }\n    /**\n     * Number of this document fragment's children.\n     */\n    get childCount() {\n        return this._children.length;\n    }\n    /**\n     * Sum of {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all of this document fragment's children.\n     */\n    get maxOffset() {\n        return this._children.maxOffset;\n    }\n    /**\n     * Is `true` if there are no nodes inside this document fragment, `false` otherwise.\n     */\n    get isEmpty() {\n        return this.childCount === 0;\n    }\n    /**\n     * Artificial next sibling. Returns `null`. Added for compatibility reasons.\n     */\n    get nextSibling() {\n        return null;\n    }\n    /**\n     * Artificial previous sibling. Returns `null`. Added for compatibility reasons.\n     */\n    get previousSibling() {\n        return null;\n    }\n    /**\n     * Artificial root of `ModelDocumentFragment`. Returns itself. Added for compatibility reasons.\n     */\n    get root() {\n        return this;\n    }\n    /**\n     * Artificial parent of `ModelDocumentFragment`. Returns `null`. Added for compatibility reasons.\n     */\n    get parent() {\n        return null;\n    }\n    /**\n     * Artificial owner of `ModelDocumentFragment`. Returns `null`. Added for compatibility reasons.\n     */\n    get document() {\n        return null;\n    }\n    /**\n     * Returns `false` as `ModelDocumentFragment` by definition is not attached to a document. Added for compatibility reasons.\n     */\n    isAttached() {\n        return false;\n    }\n    /**\n     * Returns empty array. Added for compatibility reasons.\n     */\n    getAncestors() {\n        return [];\n    }\n    /**\n     * Gets the child at the given index. Returns `null` if incorrect index was passed.\n     *\n     * @param index Index in this document fragment.\n     * @returns Child node.\n     */\n    getChild(index) {\n        return this._children.getNode(index);\n    }\n    /**\n     * Gets the child at the given offset. Returns `null` if incorrect index was passed.\n     *\n     * @param offset Offset in this document fragment.\n     * @returns Child node.\n     */\n    getChildAtOffset(offset) {\n        return this._children.getNodeAtOffset(offset);\n    }\n    /**\n     * Returns an iterator that iterates over all of this document fragment's children.\n     */\n    getChildren() {\n        return this._children[Symbol.iterator]();\n    }\n    /**\n     * Returns an index of the given child node. Returns `null` if given node is not a child of this document fragment.\n     *\n     * @param node Child node to look for.\n     * @returns Child node's index.\n     */\n    getChildIndex(node) {\n        return this._children.getNodeIndex(node);\n    }\n    /**\n     * Returns the starting offset of given child. Starting offset is equal to the sum of\n     * {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all node's siblings that are before it. Returns `null` if\n     * given node is not a child of this document fragment.\n     *\n     * @param node Child node to look for.\n     * @returns Child node's starting offset.\n     */\n    getChildStartOffset(node) {\n        return this._children.getNodeStartOffset(node);\n    }\n    /**\n     * Returns path to a `ModelDocumentFragment`, which is an empty array. Added for compatibility reasons.\n     */\n    getPath() {\n        return [];\n    }\n    /**\n     * Returns a descendant node by its path relative to this element.\n     *\n     * ```ts\n     * // <this>a<b>c</b></this>\n     * this.getNodeByPath( [ 0 ] );     // -> \"a\"\n     * this.getNodeByPath( [ 1 ] );     // -> <b>\n     * this.getNodeByPath( [ 1, 0 ] );  // -> \"c\"\n     * ```\n     *\n     * @param relativePath Path of the node to find, relative to this element.\n     */\n    getNodeByPath(relativePath) {\n        // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n        let node = this;\n        for (const offset of relativePath) {\n            node = node.getChildAtOffset(offset);\n        }\n        return node;\n    }\n    /**\n     * Converts offset \"position\" to index \"position\".\n     *\n     * Returns index of a node that occupies given offset. If given offset is too low, returns `0`. If given offset is\n     * too high, returns index after last child.\n     *\n     * ```ts\n     * const textNode = new Text( 'foo' );\n     * const pElement = new Element( 'p' );\n     * const docFrag = new ModelDocumentFragment( [ textNode, pElement ] );\n     * docFrag.offsetToIndex( -1 ); // Returns 0, because offset is too low.\n     * docFrag.offsetToIndex( 0 ); // Returns 0, because offset 0 is taken by `textNode` which is at index 0.\n     * docFrag.offsetToIndex( 1 ); // Returns 0, because `textNode` has `offsetSize` equal to 3, so it occupies offset 1 too.\n     * docFrag.offsetToIndex( 2 ); // Returns 0.\n     * docFrag.offsetToIndex( 3 ); // Returns 1.\n     * docFrag.offsetToIndex( 4 ); // Returns 2. There are no nodes at offset 4, so last available index is returned.\n     * ```\n     *\n     * @param offset Offset to look for.\n     * @returns Index of a node that occupies given offset.\n     */\n    offsetToIndex(offset) {\n        return this._children.offsetToIndex(offset);\n    }\n    /**\n     * Converts `ModelDocumentFragment` instance to plain object and returns it.\n     * Takes care of converting all of this document fragment's children.\n     *\n     * @returns `ModelDocumentFragment` instance converted to plain object.\n     */\n    toJSON() {\n        const json = [];\n        for (const node of this._children) {\n            json.push(node.toJSON());\n        }\n        return json;\n    }\n    /**\n     * Creates a `ModelDocumentFragment` instance from given plain object (i.e. parsed JSON string).\n     * Converts `ModelDocumentFragment` children to proper nodes.\n     *\n     * @param json Plain object to be converted to `ModelDocumentFragment`.\n     * @returns `ModelDocumentFragment` instance created using given plain object.\n     */\n    static fromJSON(json) {\n        const children = [];\n        for (const child of json) {\n            if (child.name) {\n                // If child has name property, it is an Element.\n                children.push(ModelElement.fromJSON(child));\n            }\n            else {\n                // Otherwise, it is a Text node.\n                children.push(ModelText.fromJSON(child));\n            }\n        }\n        return new ModelDocumentFragment(children);\n    }\n    /**\n     * {@link #_insertChild Inserts} one or more nodes at the end of this document fragment.\n     *\n     * @internal\n     * @param items Items to be inserted.\n     */\n    _appendChild(items) {\n        this._insertChild(this.childCount, items);\n    }\n    /**\n     * Inserts one or more nodes at the given index and sets {@link module:engine/model/node~ModelNode#parent parent} of these nodes\n     * to this document fragment.\n     *\n     * @internal\n     * @param index Index at which nodes should be inserted.\n     * @param items Items to be inserted.\n     */\n    _insertChild(index, items) {\n        const nodes = normalize(items);\n        for (const node of nodes) {\n            // If node that is being added to this element is already inside another element, first remove it from the old parent.\n            if (node.parent !== null) {\n                node._remove();\n            }\n            node.parent = this;\n        }\n        this._children._insertNodes(index, nodes);\n    }\n    /**\n     * Removes one or more nodes starting at the given index\n     * and sets {@link module:engine/model/node~ModelNode#parent parent} of these nodes to `null`.\n     *\n     * @internal\n     * @param index Index of the first node to remove.\n     * @param howMany Number of nodes to remove.\n     * @returns Array containing removed nodes.\n     */\n    _removeChildren(index, howMany = 1) {\n        const nodes = this._children._removeNodes(index, howMany);\n        for (const node of nodes) {\n            node.parent = null;\n        }\n        return nodes;\n    }\n    /**\n     * Removes children nodes provided as an array and sets\n     * the {@link module:engine/model/node~ModelNode#parent parent} of these nodes to `null`.\n     *\n     * These nodes do not need to be direct siblings.\n     *\n     * This method is faster than removing nodes one by one, as it recalculates offsets only once.\n     *\n     * @internal\n     * @param nodes Array of nodes.\n     */\n    _removeChildrenArray(nodes) {\n        this._children._removeNodesArray(nodes);\n        for (const node of nodes) {\n            node.parent = null;\n        }\n    }\n}\n// The magic of type inference using `is` method is centralized in `TypeCheckable` class.\n// Proper overload would interfere with that.\nModelDocumentFragment.prototype.is = function (type) {\n    return type === 'documentFragment' || type === 'model:documentFragment';\n};\n/**\n * Converts strings to Text and non-iterables to arrays.\n */\nfunction normalize(nodes) {\n    // Separate condition because string is iterable.\n    if (typeof nodes == 'string') {\n        return [new ModelText(nodes)];\n    }\n    if (!isIterable(nodes)) {\n        nodes = [nodes];\n    }\n    // Array.from to enable .map() on non-arrays.\n    return Array.from(nodes)\n        .map(node => {\n        if (typeof node == 'string') {\n            return new ModelText(node);\n        }\n        if (node instanceof ModelTextProxy) {\n            return new ModelText(node.data, node.getAttributes());\n        }\n        return node;\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/writer\n */\nimport { AttributeOperation } from './operation/attributeoperation.js';\nimport { DetachOperation } from './operation/detachoperation.js';\nimport { InsertOperation } from './operation/insertoperation.js';\nimport { MarkerOperation } from './operation/markeroperation.js';\nimport { MergeOperation } from './operation/mergeoperation.js';\nimport { MoveOperation } from './operation/moveoperation.js';\nimport { RenameOperation } from './operation/renameoperation.js';\nimport { RootAttributeOperation } from './operation/rootattributeoperation.js';\nimport { RootOperation } from './operation/rootoperation.js';\nimport { SplitOperation } from './operation/splitoperation.js';\nimport { ModelDocumentFragment } from './documentfragment.js';\nimport { ModelDocumentSelection } from './documentselection.js';\nimport { ModelElement } from './element.js';\nimport { ModelPosition } from './position.js';\nimport { ModelRange } from './range.js';\nimport { ModelRootElement } from './rootelement.js';\nimport { ModelText } from './text.js';\nimport { CKEditorError, logWarning, toMap } from '@ckeditor/ckeditor5-utils';\n/**\n * The model can only be modified by using the writer. It should be used whenever you want to create a node, modify\n * child nodes, attributes or text, set the selection's position and its attributes.\n *\n * The instance of the writer is only available in the {@link module:engine/model/model~Model#change `change()`} or\n * {@link module:engine/model/model~Model#enqueueChange `enqueueChange()`}.\n *\n * ```ts\n * model.change( writer => {\n * \twriter.insertText( 'foo', paragraph, 'end' );\n * } );\n * ```\n *\n * Note that the writer should never be stored and used outside of the `change()` and\n * `enqueueChange()` blocks.\n *\n * Note that writer's methods do not check the {@link module:engine/model/schema~ModelSchema}. It is possible\n * to create incorrect model structures by using the writer. Read more about in\n * {@glink framework/deep-dive/schema#who-checks-the-schema \"Who checks the schema?\"}.\n *\n * @see module:engine/model/model~Model#change\n * @see module:engine/model/model~Model#enqueueChange\n */\nexport class ModelWriter {\n    /**\n     * Instance of the model on which this writer operates.\n     */\n    model;\n    /**\n     * The batch to which this writer will add changes.\n     */\n    batch;\n    /**\n     * Creates a writer instance.\n     *\n     * **Note:** It is not recommended to use it directly. Use {@link module:engine/model/model~Model#change `Model#change()`} or\n     * {@link module:engine/model/model~Model#enqueueChange `Model#enqueueChange()`} instead.\n     *\n     * @internal\n     */\n    constructor(model, batch) {\n        this.model = model;\n        this.batch = batch;\n    }\n    /**\n     * Creates a new {@link module:engine/model/text~ModelText text node}.\n     *\n     * ```ts\n     * writer.createText( 'foo' );\n     * writer.createText( 'foo', { bold: true } );\n     * ```\n     *\n     * @param data Text data.\n     * @param attributes Text attributes.\n     * @returns {module:engine/model/text~ModelText} Created text node.\n     */\n    createText(data, attributes) {\n        return new ModelText(data, attributes);\n    }\n    /**\n     * Creates a new {@link module:engine/model/element~ModelElement element}.\n     *\n     * ```ts\n     * writer.createElement( 'paragraph' );\n     * writer.createElement( 'paragraph', { alignment: 'center' } );\n     * ```\n     *\n     * @param name Name of the element.\n     * @param attributes Elements attributes.\n     * @returns Created element.\n     */\n    createElement(name, attributes) {\n        return new ModelElement(name, attributes);\n    }\n    /**\n     * Creates a new {@link module:engine/model/documentfragment~ModelDocumentFragment document fragment}.\n     *\n     * @returns Created document fragment.\n     */\n    createDocumentFragment() {\n        return new ModelDocumentFragment();\n    }\n    /**\n     * Creates a copy of the element and returns it. Created element has the same name and attributes as the original element.\n     * If clone is deep, the original element's children are also cloned. If not, then empty element is returned.\n     *\n     * @param element The element to clone.\n     * @param deep If set to `true` clones element and all its children recursively. When set to `false`,\n     * element will be cloned without any child.\n     */\n    cloneElement(element, deep = true) {\n        return element._clone(deep);\n    }\n    /**\n     * Inserts item on given position.\n     *\n     * ```ts\n     * const paragraph = writer.createElement( 'paragraph' );\n     * writer.insert( paragraph, position );\n     * ```\n     *\n     * Instead of using position you can use parent and offset:\n     *\n     * ```ts\n     * const text = writer.createText( 'foo' );\n     * writer.insert( text, paragraph, 5 );\n     * ```\n     *\n     * You can also use `end` instead of the offset to insert at the end:\n     *\n     * ```ts\n     * const text = writer.createText( 'foo' );\n     * writer.insert( text, paragraph, 'end' );\n     * ```\n     *\n     * Or insert before or after another element:\n     *\n     * ```ts\n     * const paragraph = writer.createElement( 'paragraph' );\n     * writer.insert( paragraph, anotherParagraph, 'after' );\n     * ```\n     *\n     * These parameters works the same way as {@link #createPositionAt `writer.createPositionAt()`}.\n     *\n     * Note that if the item already has parent it will be removed from the previous parent.\n     *\n     * Note that you cannot re-insert a node from a document to a different document or a document fragment. In this case,\n     * `model-writer-insert-forbidden-move` is thrown.\n     *\n     * If you want to move {@link module:engine/model/range~ModelRange range} instead of an\n     * {@link module:engine/model/item~ModelItem item} use {@link module:engine/model/writer~ModelWriter#move `Writer#move()`}.\n     *\n     * **Note:** For a paste-like content insertion mechanism see\n     * {@link module:engine/model/model~Model#insertContent `model.insertContent()`}.\n     *\n     * @param item Item or document fragment to insert.\n     * @param offset Offset or one of the flags. Used only when second parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    insert(item, itemOrPosition, offset = 0) {\n        this._assertWriterUsedCorrectly();\n        if (item instanceof ModelText && item.data == '') {\n            return;\n        }\n        const position = ModelPosition._createAt(itemOrPosition, offset);\n        // If item has a parent already.\n        if (item.parent) {\n            // We need to check if item is going to be inserted within the same document.\n            if (isSameTree(item.root, position.root)) {\n                // If it's we just need to move it.\n                this.move(ModelRange._createOn(item), position);\n                return;\n            }\n            // If it isn't the same root.\n            else {\n                if (item.root.document) {\n                    /**\n                     * Cannot move a node from a document to a different tree.\n                     * It is forbidden to move a node that was already in a document outside of it.\n                     *\n                     * @error model-writer-insert-forbidden-move\n                     */\n                    throw new CKEditorError('model-writer-insert-forbidden-move', this);\n                }\n                else {\n                    // Move between two different document fragments or from document fragment to a document is possible.\n                    // In that case, remove the item from it's original parent.\n                    this.remove(item);\n                }\n            }\n        }\n        const version = position.root.document ? position.root.document.version : null;\n        const children = item instanceof ModelDocumentFragment ?\n            item._removeChildren(0, item.childCount) :\n            item;\n        const insert = new InsertOperation(position, children, version);\n        if (item instanceof ModelText) {\n            insert.shouldReceiveAttributes = true;\n        }\n        this.batch.addOperation(insert);\n        this.model.applyOperation(insert);\n        // When element is a ModelDocumentFragment we need to move its markers to Document#markers.\n        if (item instanceof ModelDocumentFragment) {\n            for (const [markerName, markerRange] of item.markers) {\n                // We need to migrate marker range from ModelDocumentFragment to Document.\n                const rangeRootPosition = ModelPosition._createAt(markerRange.root, 0);\n                const range = new ModelRange(markerRange.start._getCombined(rangeRootPosition, position), markerRange.end._getCombined(rangeRootPosition, position));\n                const options = { range, usingOperation: true, affectsData: true };\n                if (this.model.markers.has(markerName)) {\n                    this.updateMarker(markerName, options);\n                }\n                else {\n                    this.addMarker(markerName, options);\n                }\n            }\n        }\n    }\n    insertText(text, attributes, // Too complicated when not using `any`.\n    itemOrPosition, // Too complicated when not using `any`.\n    offset // Too complicated when not using `any`.\n    ) {\n        if (attributes instanceof ModelDocumentFragment || attributes instanceof ModelElement || attributes instanceof ModelPosition) {\n            this.insert(this.createText(text), attributes, itemOrPosition);\n        }\n        else {\n            this.insert(this.createText(text, attributes), itemOrPosition, offset);\n        }\n    }\n    insertElement(name, attributes, // Too complicated when not using `any`.\n    itemOrPositionOrOffset, // Too complicated when not using `any`.\n    offset // Too complicated when not using `any`.\n    ) {\n        if (attributes instanceof ModelDocumentFragment || attributes instanceof ModelElement || attributes instanceof ModelPosition) {\n            this.insert(this.createElement(name), attributes, itemOrPositionOrOffset);\n        }\n        else {\n            this.insert(this.createElement(name, attributes), itemOrPositionOrOffset, offset);\n        }\n    }\n    /**\n     * Inserts item at the end of the given parent.\n     *\n     * ```ts\n     * const paragraph = writer.createElement( 'paragraph' );\n     * writer.append( paragraph, root );\n     * ```\n     *\n     * Note that if the item already has parent it will be removed from the previous parent.\n     *\n     * If you want to move {@link module:engine/model/range~ModelRange range} instead of an\n     * {@link module:engine/model/item~ModelItem item} use {@link module:engine/model/writer~ModelWriter#move `Writer#move()`}.\n     *\n     * @param item Item or document fragment to insert.\n     */\n    append(item, parent) {\n        this.insert(item, parent, 'end');\n    }\n    appendText(text, attributes, parent) {\n        if (attributes instanceof ModelDocumentFragment || attributes instanceof ModelElement) {\n            this.insert(this.createText(text), attributes, 'end');\n        }\n        else {\n            this.insert(this.createText(text, attributes), parent, 'end');\n        }\n    }\n    appendElement(name, attributes, parent) {\n        if (attributes instanceof ModelDocumentFragment || attributes instanceof ModelElement) {\n            this.insert(this.createElement(name), attributes, 'end');\n        }\n        else {\n            this.insert(this.createElement(name, attributes), parent, 'end');\n        }\n    }\n    /**\n     * Sets value of the attribute with given key on a {@link module:engine/model/item~ModelItem model item}\n     * or on a {@link module:engine/model/range~ModelRange range}.\n     *\n     * @param key Attribute key.\n     * @param value Attribute new value.\n     * @param itemOrRange Model item or range on which the attribute will be set.\n     */\n    setAttribute(key, value, itemOrRange) {\n        this._assertWriterUsedCorrectly();\n        if (itemOrRange instanceof ModelRange) {\n            const ranges = itemOrRange.getMinimalFlatRanges();\n            for (const range of ranges) {\n                setAttributeOnRange(this, key, value, range);\n            }\n        }\n        else {\n            setAttributeOnItem(this, key, value, itemOrRange);\n        }\n    }\n    /**\n     * Sets values of attributes on a {@link module:engine/model/item~ModelItem model item}\n     * or on a {@link module:engine/model/range~ModelRange range}.\n     *\n     * ```ts\n     * writer.setAttributes( {\n     * \tbold: true,\n     * \titalic: true\n     * }, range );\n     * ```\n     *\n     * @param attributes Attributes keys and values.\n     * @param itemOrRange Model item or range on which the attributes will be set.\n     */\n    setAttributes(attributes, itemOrRange) {\n        for (const [key, val] of toMap(attributes)) {\n            this.setAttribute(key, val, itemOrRange);\n        }\n    }\n    /**\n     * Removes an attribute with given key from a {@link module:engine/model/item~ModelItem model item}\n     * or from a {@link module:engine/model/range~ModelRange range}.\n     *\n     * @param key Attribute key.\n     * @param itemOrRange Model item or range from which the attribute will be removed.\n     */\n    removeAttribute(key, itemOrRange) {\n        this._assertWriterUsedCorrectly();\n        if (itemOrRange instanceof ModelRange) {\n            const ranges = itemOrRange.getMinimalFlatRanges();\n            for (const range of ranges) {\n                setAttributeOnRange(this, key, null, range);\n            }\n        }\n        else {\n            setAttributeOnItem(this, key, null, itemOrRange);\n        }\n    }\n    /**\n     * Removes all attributes from all elements in the range or from the given item.\n     *\n     * @param itemOrRange Model item or range from which all attributes will be removed.\n     */\n    clearAttributes(itemOrRange) {\n        this._assertWriterUsedCorrectly();\n        const removeAttributesFromItem = (item) => {\n            for (const attribute of item.getAttributeKeys()) {\n                this.removeAttribute(attribute, item);\n            }\n        };\n        if (!(itemOrRange instanceof ModelRange)) {\n            removeAttributesFromItem(itemOrRange);\n        }\n        else {\n            for (const item of itemOrRange.getItems()) {\n                removeAttributesFromItem(item);\n            }\n        }\n    }\n    /**\n     * Moves all items in the source range to the target position.\n     *\n     * ```ts\n     * writer.move( sourceRange, targetPosition );\n     * ```\n     *\n     * Instead of the target position you can use parent and offset or define that range should be moved to the end\n     * or before or after chosen item:\n     *\n     * ```ts\n     * // Moves all items in the range to the paragraph at offset 5:\n     * writer.move( sourceRange, paragraph, 5 );\n     * // Moves all items in the range to the end of a blockquote:\n     * writer.move( sourceRange, blockquote, 'end' );\n     * // Moves all items in the range to a position after an image:\n     * writer.move( sourceRange, image, 'after' );\n     * ```\n     *\n     * These parameters work the same way as {@link #createPositionAt `writer.createPositionAt()`}.\n     *\n     * Note that items can be moved only within the same tree. It means that you can move items within the same root\n     * (element or document fragment) or between {@link module:engine/model/document~ModelDocument#roots documents roots},\n     * but you cannot move items from document fragment to the document or from one detached element to another. Use\n     * {@link module:engine/model/writer~ModelWriter#insert} in such cases.\n     *\n     * @param range Source range.\n     * @param offset Offset or one of the flags. Used only when second parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    move(range, itemOrPosition, offset) {\n        this._assertWriterUsedCorrectly();\n        if (!(range instanceof ModelRange)) {\n            /**\n             * Invalid range to move.\n             *\n             * @error writer-move-invalid-range\n             */\n            throw new CKEditorError('writer-move-invalid-range', this);\n        }\n        if (!range.isFlat) {\n            /**\n             * Range to move is not flat.\n             *\n             * @error writer-move-range-not-flat\n             */\n            throw new CKEditorError('writer-move-range-not-flat', this);\n        }\n        const position = ModelPosition._createAt(itemOrPosition, offset);\n        // Do not move anything if the move target is same as moved range start.\n        if (position.isEqual(range.start)) {\n            return;\n        }\n        // If part of the marker is removed, create additional marker operation for undo purposes.\n        this._addOperationForAffectedMarkers('move', range);\n        if (!isSameTree(range.root, position.root)) {\n            /**\n             * Range is going to be moved within not the same document. Please use\n             * {@link module:engine/model/writer~ModelWriter#insert insert} instead.\n             *\n             * @error writer-move-different-document\n             */\n            throw new CKEditorError('writer-move-different-document', this);\n        }\n        const version = range.root.document ? range.root.document.version : null;\n        const operation = new MoveOperation(range.start, range.end.offset - range.start.offset, position, version);\n        this.batch.addOperation(operation);\n        this.model.applyOperation(operation);\n    }\n    /**\n     * Removes given model {@link module:engine/model/item~ModelItem item} or {@link module:engine/model/range~ModelRange range}.\n     *\n     * @param itemOrRange Model item or range to remove.\n     */\n    remove(itemOrRange) {\n        this._assertWriterUsedCorrectly();\n        const rangeToRemove = itemOrRange instanceof ModelRange ? itemOrRange : ModelRange._createOn(itemOrRange);\n        const ranges = rangeToRemove.getMinimalFlatRanges().reverse();\n        for (const flat of ranges) {\n            // If part of the marker is removed, create additional marker operation for undo purposes.\n            this._addOperationForAffectedMarkers('move', flat);\n            applyRemoveOperation(flat.start, flat.end.offset - flat.start.offset, this.batch, this.model);\n        }\n    }\n    /**\n     * Merges two siblings at the given position.\n     *\n     * Node before and after the position have to be an element. Otherwise `writer-merge-no-element-before` or\n     * `writer-merge-no-element-after` error will be thrown.\n     *\n     * @param position Position between merged elements.\n     */\n    merge(position) {\n        this._assertWriterUsedCorrectly();\n        const nodeBefore = position.nodeBefore;\n        const nodeAfter = position.nodeAfter;\n        // If part of the marker is removed, create additional marker operation for undo purposes.\n        this._addOperationForAffectedMarkers('merge', position);\n        if (!(nodeBefore instanceof ModelElement)) {\n            /**\n             * Node before merge position must be an element.\n             *\n             * @error writer-merge-no-element-before\n             */\n            throw new CKEditorError('writer-merge-no-element-before', this);\n        }\n        if (!(nodeAfter instanceof ModelElement)) {\n            /**\n             * Node after merge position must be an element.\n             *\n             * @error writer-merge-no-element-after\n             */\n            throw new CKEditorError('writer-merge-no-element-after', this);\n        }\n        if (!position.root.document) {\n            this._mergeDetached(position);\n        }\n        else {\n            this._merge(position);\n        }\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createPositionFromPath `Model#createPositionFromPath()`}.\n     *\n     * @param root Root of the position.\n     * @param path Position path. See {@link module:engine/model/position~ModelPosition#path}.\n     * @param stickiness Position stickiness. See {@link module:engine/model/position~ModelPositionStickiness}.\n     */\n    createPositionFromPath(root, path, stickiness) {\n        return this.model.createPositionFromPath(root, path, stickiness);\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createPositionAt `Model#createPositionAt()`}.\n     *\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    createPositionAt(itemOrPosition, offset) {\n        return this.model.createPositionAt(itemOrPosition, offset);\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createPositionAfter `Model#createPositionAfter()`}.\n     *\n     * @param item Item after which the position should be placed.\n     */\n    createPositionAfter(item) {\n        return this.model.createPositionAfter(item);\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createPositionBefore `Model#createPositionBefore()`}.\n     *\n     * @param item Item after which the position should be placed.\n     */\n    createPositionBefore(item) {\n        return this.model.createPositionBefore(item);\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createRange `Model#createRange()`}.\n     *\n     * @param start Start position.\n     * @param end End position. If not set, range will be collapsed at `start` position.\n     */\n    createRange(start, end) {\n        return this.model.createRange(start, end);\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createRangeIn `Model#createRangeIn()`}.\n     *\n     * @param element Element which is a parent for the range.\n     */\n    createRangeIn(element) {\n        return this.model.createRangeIn(element);\n    }\n    /**\n     * Shortcut for {@link module:engine/model/model~Model#createRangeOn `Model#createRangeOn()`}.\n     *\n     * @param element Element which is a parent for the range.\n     */\n    createRangeOn(element) {\n        return this.model.createRangeOn(element);\n    }\n    createSelection(...args) {\n        return this.model.createSelection(...args);\n    }\n    /**\n     * Performs merge action in a detached tree.\n     *\n     * @param position Position between merged elements.\n     */\n    _mergeDetached(position) {\n        const nodeBefore = position.nodeBefore;\n        const nodeAfter = position.nodeAfter;\n        this.move(ModelRange._createIn(nodeAfter), ModelPosition._createAt(nodeBefore, 'end'));\n        this.remove(nodeAfter);\n    }\n    /**\n     * Performs merge action in a non-detached tree.\n     *\n     * @param position Position between merged elements.\n     */\n    _merge(position) {\n        const targetPosition = ModelPosition._createAt(position.nodeBefore, 'end');\n        const sourcePosition = ModelPosition._createAt(position.nodeAfter, 0);\n        const graveyard = position.root.document.graveyard;\n        const graveyardPosition = new ModelPosition(graveyard, [0]);\n        const version = position.root.document.version;\n        const merge = new MergeOperation(sourcePosition, position.nodeAfter.maxOffset, targetPosition, graveyardPosition, version);\n        this.batch.addOperation(merge);\n        this.model.applyOperation(merge);\n    }\n    /**\n     * Renames the given element.\n     *\n     * @param element The element to rename.\n     * @param newName New element name.\n     */\n    rename(element, newName) {\n        this._assertWriterUsedCorrectly();\n        if (!(element instanceof ModelElement)) {\n            /**\n             * Trying to rename an object which is not an instance of Element.\n             *\n             * @error writer-rename-not-element-instance\n             */\n            throw new CKEditorError('writer-rename-not-element-instance', this);\n        }\n        const version = element.root.document ? element.root.document.version : null;\n        const renameOperation = new RenameOperation(ModelPosition._createBefore(element), element.name, newName, version);\n        this.batch.addOperation(renameOperation);\n        this.model.applyOperation(renameOperation);\n    }\n    /**\n     * Splits elements starting from the given position and going to the top of the model tree as long as given\n     * `limitElement` is reached. When `limitElement` is not defined then only the parent of the given position will be split.\n     *\n     * The element needs to have a parent. It cannot be a root element nor a document fragment.\n     * The `writer-split-element-no-parent` error will be thrown if you try to split an element with no parent.\n     *\n     * @param position Position of split.\n     * @param limitElement Stop splitting when this element will be reached.\n     * @returns Split result with properties:\n     * * `position` - Position between split elements.\n     * * `range` - Range that stars from the end of the first split element and ends at the beginning of the first copy element.\n     */\n    split(position, limitElement) {\n        this._assertWriterUsedCorrectly();\n        let splitElement = position.parent;\n        if (!splitElement.parent) {\n            /**\n             * Element with no parent cannot be split.\n             *\n             * @error writer-split-element-no-parent\n             */\n            throw new CKEditorError('writer-split-element-no-parent', this);\n        }\n        // When limit element is not defined lets set splitElement parent as limit.\n        if (!limitElement) {\n            limitElement = splitElement.parent;\n        }\n        if (!position.parent.getAncestors({ includeSelf: true }).includes(limitElement)) {\n            /**\n             * Limit element is not a position ancestor.\n             *\n             * @error writer-split-invalid-limit-element\n             */\n            throw new CKEditorError('writer-split-invalid-limit-element', this);\n        }\n        // We need to cache elements that will be created as a result of the first split because\n        // we need to create a range from the end of the first split element to the beginning of the\n        // first copy element. This should be handled by ModelLiveRange but it doesn't work on detached nodes.\n        let firstSplitElement;\n        let firstCopyElement;\n        do {\n            const version = splitElement.root.document ? splitElement.root.document.version : null;\n            const howMany = splitElement.maxOffset - position.offset;\n            const insertionPosition = SplitOperation.getInsertionPosition(position);\n            const split = new SplitOperation(position, howMany, insertionPosition, null, version);\n            this.batch.addOperation(split);\n            this.model.applyOperation(split);\n            // Cache result of the first split.\n            if (!firstSplitElement && !firstCopyElement) {\n                firstSplitElement = splitElement;\n                firstCopyElement = position.parent.nextSibling;\n            }\n            position = this.createPositionAfter(position.parent);\n            splitElement = position.parent;\n        } while (splitElement !== limitElement);\n        return {\n            position,\n            range: new ModelRange(ModelPosition._createAt(firstSplitElement, 'end'), ModelPosition._createAt(firstCopyElement, 0))\n        };\n    }\n    /**\n     * Wraps the given range with the given element or with a new element (if a string was passed).\n     *\n     * **Note:** range to wrap should be a \"flat range\" (see {@link module:engine/model/range~ModelRange#isFlat `Range#isFlat`}).\n     * If not, an error will be thrown.\n     *\n     * @param range Range to wrap.\n     * @param elementOrString Element or name of element to wrap the range with.\n     */\n    wrap(range, elementOrString) {\n        this._assertWriterUsedCorrectly();\n        if (!range.isFlat) {\n            /**\n             * Range to wrap is not flat.\n             *\n             * @error writer-wrap-range-not-flat\n             */\n            throw new CKEditorError('writer-wrap-range-not-flat', this);\n        }\n        const element = elementOrString instanceof ModelElement ? elementOrString : new ModelElement(elementOrString);\n        if (element.childCount > 0) {\n            /**\n             * Element to wrap with is not empty.\n             *\n             * @error writer-wrap-element-not-empty\n             */\n            throw new CKEditorError('writer-wrap-element-not-empty', this);\n        }\n        if (element.parent !== null) {\n            /**\n             * Element to wrap with is already attached to a tree model.\n             *\n             * @error writer-wrap-element-attached\n             */\n            throw new CKEditorError('writer-wrap-element-attached', this);\n        }\n        this.insert(element, range.start);\n        // Shift the range-to-wrap because we just inserted an element before that range.\n        const shiftedRange = new ModelRange(range.start.getShiftedBy(1), range.end.getShiftedBy(1));\n        this.move(shiftedRange, ModelPosition._createAt(element, 0));\n    }\n    /**\n     * Unwraps children of the given element – all its children are moved before it and then the element is removed.\n     * Throws error if you try to unwrap an element which does not have a parent.\n     *\n     * @param element Element to unwrap.\n     */\n    unwrap(element) {\n        this._assertWriterUsedCorrectly();\n        if (element.parent === null) {\n            /**\n             * Trying to unwrap an element which has no parent.\n             *\n             * @error writer-unwrap-element-no-parent\n             */\n            throw new CKEditorError('writer-unwrap-element-no-parent', this);\n        }\n        this.move(ModelRange._createIn(element), this.createPositionAfter(element));\n        this.remove(element);\n    }\n    /**\n     * Adds a {@link module:engine/model/markercollection~Marker marker}. Marker is a named range, which tracks\n     * changes in the document and updates its range automatically, when model tree changes.\n     *\n     * As the first parameter you can set marker name.\n     *\n     * The required `options.usingOperation` parameter lets you decide if the marker should be managed by operations or not. See\n     * {@link module:engine/model/markercollection~Marker marker class description} to learn about the difference between\n     * markers managed by operations and not-managed by operations.\n     *\n     * The `options.affectsData` parameter, which defaults to `false`, allows you to define if a marker affects the data. It should be\n     * `true` when the marker change changes the data returned by the\n     * {@link module:core/editor/editor~Editor#getData `editor.getData()`} method.\n     * When set to `true` it fires the {@link module:engine/model/document~ModelDocument#event:change:data `change:data`} event.\n     * When set to `false` it fires the {@link module:engine/model/document~ModelDocument#event:change `change`} event.\n     *\n     * Create marker directly base on marker's name:\n     *\n     * ```ts\n     * addMarker( markerName, { range, usingOperation: false } );\n     * ```\n     *\n     * Create marker using operation:\n     *\n     * ```ts\n     * addMarker( markerName, { range, usingOperation: true } );\n     * ```\n     *\n     * Create marker that affects the editor data:\n     *\n     * ```ts\n     * addMarker( markerName, { range, usingOperation: false, affectsData: true } );\n     * ```\n     *\n     * Note: For efficiency reasons, it's best to create and keep as little markers as possible.\n     *\n     * @see module:engine/model/markercollection~Marker\n     * @param name Name of a marker to create - must be unique.\n     * @param options.usingOperation Flag indicating that the marker should be added by MarkerOperation.\n     * See {@link module:engine/model/markercollection~Marker#managedUsingOperations}.\n     * @param options.range Marker range.\n     * @param options.affectsData Flag indicating that the marker changes the editor data.\n     * @returns Marker that was set.\n     */\n    addMarker(name, options) {\n        this._assertWriterUsedCorrectly();\n        if (!options || typeof options.usingOperation != 'boolean') {\n            /**\n             * The `options.usingOperation` parameter is required when adding a new marker.\n             *\n             * @error writer-addmarker-no-usingoperation\n             */\n            throw new CKEditorError('writer-addmarker-no-usingoperation', this);\n        }\n        const usingOperation = options.usingOperation;\n        const range = options.range;\n        const affectsData = options.affectsData === undefined ? false : options.affectsData;\n        if (this.model.markers.has(name)) {\n            /**\n             * Marker with provided name already exists.\n             *\n             * @error writer-addmarker-marker-exists\n             */\n            throw new CKEditorError('writer-addmarker-marker-exists', this);\n        }\n        if (!range) {\n            /**\n             * Range parameter is required when adding a new marker.\n             *\n             * @error writer-addmarker-no-range\n             */\n            throw new CKEditorError('writer-addmarker-no-range', this);\n        }\n        if (!usingOperation) {\n            return this.model.markers._set(name, range, usingOperation, affectsData);\n        }\n        applyMarkerOperation(this, name, null, range, affectsData);\n        return this.model.markers.get(name);\n    }\n    /**\n     * Adds, updates or refreshes a {@link module:engine/model/markercollection~Marker marker}. Marker is a named range, which tracks\n     * changes in the document and updates its range automatically, when model tree changes. Still, it is possible to change the\n     * marker's range directly using this method.\n     *\n     * As the first parameter you can set marker name or instance. If none of them is provided, new marker, with a unique\n     * name is created and returned.\n     *\n     * **Note**: If you want to change the {@link module:engine/view/element~ViewElement view element}\n     * of the marker while its data in the model\n     * remains the same, use the dedicated {@link module:engine/controller/editingcontroller~EditingController#reconvertMarker} method.\n     *\n     * The `options.usingOperation` parameter lets you change if the marker should be managed by operations or not. See\n     * {@link module:engine/model/markercollection~Marker marker class description} to learn about the difference between\n     * markers managed by operations and not-managed by operations. It is possible to change this option for an existing marker.\n     *\n     * The `options.affectsData` parameter, which defaults to `false`, allows you to define if a marker affects the data. It should be\n     * `true` when the marker change changes the data returned by\n     * the {@link module:core/editor/editor~Editor#getData `editor.getData()`} method.\n     * When set to `true` it fires the {@link module:engine/model/document~ModelDocument#event:change:data `change:data`} event.\n     * When set to `false` it fires the {@link module:engine/model/document~ModelDocument#event:change `change`} event.\n     *\n     * Update marker directly base on marker's name:\n     *\n     * ```ts\n     * updateMarker( markerName, { range } );\n     * ```\n     *\n     * Update marker using operation:\n     *\n     * ```ts\n     * updateMarker( marker, { range, usingOperation: true } );\n     * updateMarker( markerName, { range, usingOperation: true } );\n     * ```\n     *\n     * Change marker's option (start using operations to manage it):\n     *\n     * ```ts\n     * updateMarker( marker, { usingOperation: true } );\n     * ```\n     *\n     * Change marker's option (inform the engine, that the marker does not affect the data anymore):\n     *\n     * ```ts\n     * updateMarker( markerName, { affectsData: false } );\n     * ```\n     *\n     * @see module:engine/model/markercollection~Marker\n     * @param markerOrName Name of a marker to update, or a marker instance.\n     * @param options If options object is not defined then marker will be refreshed by triggering\n     * downcast conversion for this marker with the same data.\n     * @param options.range Marker range to update.\n     * @param options.usingOperation Flag indicated whether the marker should be added by MarkerOperation.\n     * See {@link module:engine/model/markercollection~Marker#managedUsingOperations}.\n     * @param options.affectsData Flag indicating that the marker changes the editor data.\n     */\n    updateMarker(markerOrName, options) {\n        this._assertWriterUsedCorrectly();\n        const markerName = typeof markerOrName == 'string' ? markerOrName : markerOrName.name;\n        const currentMarker = this.model.markers.get(markerName);\n        if (!currentMarker) {\n            /**\n             * Marker with provided name does not exist and will not be updated.\n             *\n             * @error writer-updatemarker-marker-not-exists\n             */\n            throw new CKEditorError('writer-updatemarker-marker-not-exists', this);\n        }\n        if (!options) {\n            /**\n             * The usage of `writer.updateMarker()` only to reconvert (refresh) a\n             * {@link module:engine/model/markercollection~Marker model marker} was deprecated and may not work in the future.\n             * Please update your code to use\n             * {@link module:engine/controller/editingcontroller~EditingController#reconvertMarker `editor.editing.reconvertMarker()`}\n             * instead.\n             *\n             * @error writer-updatemarker-reconvert-using-editingcontroller\n             * @param markerName The name of the updated marker.\n             */\n            logWarning('writer-updatemarker-reconvert-using-editingcontroller', { markerName });\n            this.model.markers._refresh(currentMarker);\n            return;\n        }\n        const hasUsingOperationDefined = typeof options.usingOperation == 'boolean';\n        const affectsDataDefined = typeof options.affectsData == 'boolean';\n        // Use previously defined marker's affectsData if the property is not provided.\n        const affectsData = affectsDataDefined ? options.affectsData : currentMarker.affectsData;\n        if (!hasUsingOperationDefined && !options.range && !affectsDataDefined) {\n            /**\n             * One of the options is required - provide range, usingOperations or affectsData.\n             *\n             * @error writer-updatemarker-wrong-options\n             */\n            throw new CKEditorError('writer-updatemarker-wrong-options', this);\n        }\n        const currentRange = currentMarker.getRange();\n        const updatedRange = options.range ? options.range : currentRange;\n        if (hasUsingOperationDefined && options.usingOperation !== currentMarker.managedUsingOperations) {\n            // The marker type is changed so it's necessary to create proper operations.\n            if (options.usingOperation) {\n                // If marker changes to a managed one treat this as synchronizing existing marker.\n                // Create `MarkerOperation` with `oldRange` set to `null`, so reverse operation will remove the marker.\n                applyMarkerOperation(this, markerName, null, updatedRange, affectsData);\n            }\n            else {\n                // If marker changes to a marker that do not use operations then we need to create additional operation\n                // that removes that marker first.\n                applyMarkerOperation(this, markerName, currentRange, null, affectsData);\n                // Although not managed the marker itself should stay in model and its range should be preserver or changed to passed range.\n                this.model.markers._set(markerName, updatedRange, undefined, affectsData);\n            }\n            return;\n        }\n        // Marker's type doesn't change so update it accordingly.\n        if (currentMarker.managedUsingOperations) {\n            applyMarkerOperation(this, markerName, currentRange, updatedRange, affectsData);\n        }\n        else {\n            this.model.markers._set(markerName, updatedRange, undefined, affectsData);\n        }\n    }\n    /**\n     * Removes given {@link module:engine/model/markercollection~Marker marker} or marker with given name.\n     * The marker is removed accordingly to how it has been created, so if the marker was created using operation,\n     * it will be destroyed using operation.\n     *\n     * @param markerOrName Marker or marker name to remove.\n     */\n    removeMarker(markerOrName) {\n        this._assertWriterUsedCorrectly();\n        const name = typeof markerOrName == 'string' ? markerOrName : markerOrName.name;\n        if (!this.model.markers.has(name)) {\n            /**\n             * Trying to remove marker which does not exist.\n             *\n             * @error writer-removemarker-no-marker\n             */\n            throw new CKEditorError('writer-removemarker-no-marker', this);\n        }\n        const marker = this.model.markers.get(name);\n        if (!marker.managedUsingOperations) {\n            this.model.markers._remove(name);\n            return;\n        }\n        const oldRange = marker.getRange();\n        applyMarkerOperation(this, name, oldRange, null, marker.affectsData);\n    }\n    /**\n     * Adds a new root to the document (or re-attaches a {@link #detachRoot detached root}).\n     *\n     * Throws an error, if trying to add a root that is already added and attached.\n     *\n     * @param rootName Name of the added root.\n     * @param elementName The element name. Defaults to `'$root'` which also has some basic schema defined\n     * (e.g. `$block` elements are allowed inside the `$root`). Make sure to define a proper schema if you use a different name.\n     * @returns The added root element.\n     */\n    addRoot(rootName, elementName = '$root') {\n        this._assertWriterUsedCorrectly();\n        const root = this.model.document.getRoot(rootName);\n        if (root && root.isAttached()) {\n            /**\n             * Root with provided name already exists and is attached.\n             *\n             * @error writer-addroot-root-exists\n             */\n            throw new CKEditorError('writer-addroot-root-exists', this);\n        }\n        const document = this.model.document;\n        const operation = new RootOperation(rootName, elementName, true, document, document.version);\n        this.batch.addOperation(operation);\n        this.model.applyOperation(operation);\n        return this.model.document.getRoot(rootName);\n    }\n    /**\n     * Detaches the root from the document.\n     *\n     * All content and markers are removed from the root upon detaching. New content and new markers cannot be added to the root, as long\n     * as it is detached.\n     *\n     * A root cannot be fully removed from the document, it can be only detached. A root is permanently removed only after you\n     * re-initialize the editor and do not specify the root in the initial data.\n     *\n     * A detached root can be re-attached using {@link #addRoot}.\n     *\n     * Throws an error if the root does not exist or the root is already detached.\n     *\n     * @param rootOrName Name of the detached root.\n     */\n    detachRoot(rootOrName) {\n        this._assertWriterUsedCorrectly();\n        const root = typeof rootOrName == 'string' ? this.model.document.getRoot(rootOrName) : rootOrName;\n        if (!root || !root.isAttached()) {\n            /**\n             * Root with provided name does not exist or is already detached.\n             *\n             * @error writer-detachroot-no-root\n             */\n            throw new CKEditorError('writer-detachroot-no-root', this);\n        }\n        // First, remove all markers from the root. It is better to do it before removing stuff for undo purposes.\n        // However, looking through all the markers may not be the best performance wise. But there's no better solution for now.\n        for (const marker of this.model.markers) {\n            if (marker.getRange().root === root) {\n                this.removeMarker(marker);\n            }\n        }\n        // Remove all attributes from the root.\n        for (const key of root.getAttributeKeys()) {\n            this.removeAttribute(key, root);\n        }\n        // Remove all contents of the root.\n        this.remove(this.createRangeIn(root));\n        // Finally, detach the root.\n        const document = this.model.document;\n        const operation = new RootOperation(root.rootName, root.name, false, document, document.version);\n        this.batch.addOperation(operation);\n        this.model.applyOperation(operation);\n    }\n    setSelection(...args) {\n        this._assertWriterUsedCorrectly();\n        this.model.document.selection._setTo(...args);\n    }\n    /**\n     * Moves {@link module:engine/model/documentselection~ModelDocumentSelection#focus} to the specified location.\n     *\n     * The location can be specified in the same form as\n     * {@link #createPositionAt `writer.createPositionAt()`} parameters.\n     *\n     * @param itemOrPosition\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    setSelectionFocus(itemOrPosition, offset) {\n        this._assertWriterUsedCorrectly();\n        this.model.document.selection._setFocus(itemOrPosition, offset);\n    }\n    setSelectionAttribute(keyOrObjectOrIterable, value) {\n        this._assertWriterUsedCorrectly();\n        if (typeof keyOrObjectOrIterable === 'string') {\n            this._setSelectionAttribute(keyOrObjectOrIterable, value);\n        }\n        else {\n            for (const [key, value] of toMap(keyOrObjectOrIterable)) {\n                this._setSelectionAttribute(key, value);\n            }\n        }\n    }\n    /**\n     * Removes attribute(s) with given key(s) from the selection.\n     *\n     * Remove one attribute:\n     *\n     * ```ts\n     * writer.removeSelectionAttribute( 'italic' );\n     * ```\n     *\n     * Remove multiple attributes:\n     *\n     * ```ts\n     * writer.removeSelectionAttribute( [ 'italic', 'bold' ] );\n     * ```\n     *\n     * @param keyOrIterableOfKeys Key of the attribute to remove or an iterable of attribute keys to remove.\n     */\n    removeSelectionAttribute(keyOrIterableOfKeys) {\n        this._assertWriterUsedCorrectly();\n        if (typeof keyOrIterableOfKeys === 'string') {\n            this._removeSelectionAttribute(keyOrIterableOfKeys);\n        }\n        else {\n            for (const key of keyOrIterableOfKeys) {\n                this._removeSelectionAttribute(key);\n            }\n        }\n    }\n    /**\n     * Temporarily changes the {@link module:engine/model/documentselection~ModelDocumentSelection#isGravityOverridden gravity}\n     * of the selection from left to right.\n     *\n     * The gravity defines from which direction the selection inherits its attributes. If it's the default left gravity,\n     * then the selection (after being moved by the user) inherits attributes from its left-hand side.\n     * This method allows to temporarily override this behavior by forcing the gravity to the right.\n     *\n     * For the following model fragment:\n     *\n     * ```xml\n     * <$text bold=\"true\" linkHref=\"url\">bar[]</$text><$text bold=\"true\">biz</$text>\n     * ```\n     *\n     * * Default gravity: selection will have the `bold` and `linkHref` attributes.\n     * * Overridden gravity: selection will have `bold` attribute.\n     *\n     * **Note**: It returns an unique identifier which is required to restore the gravity. It guarantees the symmetry\n     * of the process.\n     *\n     * @returns The unique id which allows restoring the gravity.\n     */\n    overrideSelectionGravity() {\n        return this.model.document.selection._overrideGravity();\n    }\n    /**\n     * Restores {@link ~ModelWriter#overrideSelectionGravity} gravity to default.\n     *\n     * Restoring the gravity is only possible using the unique identifier returned by\n     * {@link ~ModelWriter#overrideSelectionGravity}. Note that the gravity remains overridden as long as won't be restored\n     * the same number of times it was overridden.\n     *\n     * @param uid The unique id returned by {@link ~ModelWriter#overrideSelectionGravity}.\n     */\n    restoreSelectionGravity(uid) {\n        this.model.document.selection._restoreGravity(uid);\n    }\n    /**\n     * @param key Key of the attribute to remove.\n     * @param value Attribute value.\n     */\n    _setSelectionAttribute(key, value) {\n        const selection = this.model.document.selection;\n        // Store attribute in parent element if the selection is collapsed in an empty node.\n        if (selection.isCollapsed && selection.anchor.parent.isEmpty) {\n            const storeKey = ModelDocumentSelection._getStoreAttributeKey(key);\n            this.setAttribute(storeKey, value, selection.anchor.parent);\n        }\n        selection._setAttribute(key, value);\n    }\n    /**\n     * @param key Key of the attribute to remove.\n     */\n    _removeSelectionAttribute(key) {\n        const selection = this.model.document.selection;\n        // Remove stored attribute from parent element if the selection is collapsed in an empty node.\n        if (selection.isCollapsed && selection.anchor.parent.isEmpty) {\n            const storeKey = ModelDocumentSelection._getStoreAttributeKey(key);\n            this.removeAttribute(storeKey, selection.anchor.parent);\n        }\n        selection._removeAttribute(key);\n    }\n    /**\n     * Throws `writer-detached-writer-tries-to-modify-model` error when the writer is used outside of the `change()` block.\n     */\n    _assertWriterUsedCorrectly() {\n        /**\n         * Trying to use a writer outside a {@link module:engine/model/model~Model#change `change()`} or\n         * {@link module:engine/model/model~Model#enqueueChange `enqueueChange()`} blocks.\n         *\n         * The writer can only be used inside these blocks which ensures that the model\n         * can only be changed during such \"sessions\".\n         *\n         * @error writer-incorrect-use\n         */\n        if (this.model._currentWriter !== this) {\n            throw new CKEditorError('writer-incorrect-use', this);\n        }\n    }\n    /**\n     * For given action `type` and `positionOrRange` where the action happens, this function finds all affected markers\n     * and applies a marker operation with the new marker range equal to the current range. Thanks to this, the marker range\n     * can be later correctly processed during undo.\n     *\n     * @param type Writer action type.\n     * @param positionOrRange Position or range where the writer action happens.\n     */\n    _addOperationForAffectedMarkers(type, positionOrRange) {\n        for (const marker of this.model.markers) {\n            if (!marker.managedUsingOperations) {\n                continue;\n            }\n            const markerRange = marker.getRange();\n            let isAffected = false;\n            if (type === 'move') {\n                const range = positionOrRange;\n                isAffected =\n                    range.containsPosition(markerRange.start) ||\n                        range.start.isEqual(markerRange.start) ||\n                        range.containsPosition(markerRange.end) ||\n                        range.end.isEqual(markerRange.end);\n            }\n            else {\n                // if type === 'merge'.\n                const position = positionOrRange;\n                const elementBefore = position.nodeBefore;\n                const elementAfter = position.nodeAfter;\n                //               Start:  <p>Foo[</p><p>Bar]</p>\n                //         After merge:  <p>Foo[Bar]</p>\n                // After undoing split:  <p>Foo</p><p>[Bar]</p>     <-- incorrect, needs remembering for undo.\n                //\n                const affectedInLeftElement = markerRange.start.parent == elementBefore && markerRange.start.isAtEnd;\n                //               Start:  <p>[Foo</p><p>]Bar</p>\n                //         After merge:  <p>[Foo]Bar</p>\n                // After undoing split:  <p>[Foo]</p><p>Bar</p>     <-- incorrect, needs remembering for undo.\n                //\n                const affectedInRightElement = markerRange.end.parent == elementAfter && markerRange.end.offset == 0;\n                //               Start:  <p>[Foo</p>]<p>Bar</p>\n                //         After merge:  <p>[Foo]Bar</p>\n                // After undoing split:  <p>[Foo]</p><p>Bar</p>     <-- incorrect, needs remembering for undo.\n                //\n                const affectedAfterLeftElement = markerRange.end.nodeAfter == elementAfter;\n                //               Start:  <p>Foo</p>[<p>Bar]</p>\n                //         After merge:  <p>Foo[Bar]</p>\n                // After undoing split:  <p>Foo</p><p>[Bar]</p>     <-- incorrect, needs remembering for undo.\n                //\n                const affectedBeforeRightElement = markerRange.start.nodeAfter == elementAfter;\n                isAffected = affectedInLeftElement || affectedInRightElement || affectedAfterLeftElement || affectedBeforeRightElement;\n            }\n            if (isAffected) {\n                this.updateMarker(marker.name, { range: markerRange });\n            }\n        }\n    }\n}\n/**\n * Sets given attribute to each node in given range. When attribute value is null then attribute will be removed.\n *\n * Because attribute operation needs to have the same attribute value on the whole range, this function splits\n * the range into smaller parts.\n *\n * Given `range` must be flat.\n */\nfunction setAttributeOnRange(writer, key, value, range) {\n    const model = writer.model;\n    const doc = model.document;\n    // Position of the last split, the beginning of the new range.\n    let lastSplitPosition = range.start;\n    // Currently position in the scanning range. Because we need value after the position, it is not a current\n    // position of the iterator but the previous one (we need to iterate one more time to get the value after).\n    let position;\n    // Value before the currently position.\n    let valueBefore;\n    // Value after the currently position.\n    let valueAfter;\n    for (const val of range.getWalker({ shallow: true })) {\n        valueAfter = val.item.getAttribute(key);\n        // At the first run of the iterator the position in undefined. We also do not have a valueBefore, but\n        // because valueAfter may be null, valueBefore may be equal valueAfter ( undefined == null ).\n        if (position && valueBefore != valueAfter) {\n            // if valueBefore == value there is nothing to change, so we add operation only if these values are different.\n            if (valueBefore != value) {\n                addOperation();\n            }\n            lastSplitPosition = position;\n        }\n        position = val.nextPosition;\n        valueBefore = valueAfter;\n    }\n    // Because position in the loop is not the iterator position (see let position comment), the last position in\n    // the while loop will be last but one position in the range. We need to check the last position manually.\n    if (position instanceof ModelPosition && position != lastSplitPosition && valueBefore != value) {\n        addOperation();\n    }\n    function addOperation() {\n        const range = new ModelRange(lastSplitPosition, position);\n        const version = range.root.document ? doc.version : null;\n        const operation = new AttributeOperation(range, key, valueBefore, value, version);\n        writer.batch.addOperation(operation);\n        model.applyOperation(operation);\n    }\n}\n/**\n * Sets given attribute to the given node. When attribute value is null then attribute will be removed.\n */\nfunction setAttributeOnItem(writer, key, value, item) {\n    const model = writer.model;\n    const doc = model.document;\n    const previousValue = item.getAttribute(key);\n    let range, operation;\n    if (previousValue != value) {\n        const isRootChanged = item.root === item;\n        if (isRootChanged) {\n            // If we change attributes of root element, we have to use `RootAttributeOperation`.\n            const version = item.document ? doc.version : null;\n            operation = new RootAttributeOperation(item, key, previousValue, value, version);\n        }\n        else {\n            range = new ModelRange(ModelPosition._createBefore(item), writer.createPositionAfter(item));\n            const version = range.root.document ? doc.version : null;\n            operation = new AttributeOperation(range, key, previousValue, value, version);\n        }\n        writer.batch.addOperation(operation);\n        model.applyOperation(operation);\n    }\n}\n/**\n * Creates and applies marker operation to {@link module:engine/model/operation/operation~Operation operation}.\n */\nfunction applyMarkerOperation(writer, name, oldRange, newRange, affectsData) {\n    const model = writer.model;\n    const doc = model.document;\n    const operation = new MarkerOperation(name, oldRange, newRange, model.markers, !!affectsData, doc.version);\n    writer.batch.addOperation(operation);\n    model.applyOperation(operation);\n}\n/**\n * Creates `MoveOperation` or `DetachOperation` that removes `howMany` nodes starting from `position`.\n * The operation will be applied on given model instance and added to given operation instance.\n *\n * @param position Position from which nodes are removed.\n * @param howMany Number of nodes to remove.\n * @param batch Batch to which the operation will be added.\n * @param model Model instance on which operation will be applied.\n */\nfunction applyRemoveOperation(position, howMany, batch, model) {\n    let operation;\n    if (position.root.document) {\n        const doc = model.document;\n        const graveyardPosition = new ModelPosition(doc.graveyard, [0]);\n        operation = new MoveOperation(position, howMany, graveyardPosition, doc.version);\n    }\n    else {\n        operation = new DetachOperation(position, howMany);\n    }\n    batch.addOperation(operation);\n    model.applyOperation(operation);\n}\n/**\n * Returns `true` if both root elements are the same element or both are documents root elements.\n *\n * Elements in the same tree can be moved (for instance you can move element form one documents root to another, or\n * within the same document fragment), but when element supposed to be moved from document fragment to the document, or\n * to another document it should be removed and inserted to avoid problems with OT. This is because features like undo or\n * collaboration may track changes on the document but ignore changes on detached fragments and should not get\n * unexpected `move` operation.\n */\nfunction isSameTree(rootA, rootB) {\n    // If it is the same root this is the same tree.\n    if (rootA === rootB) {\n        return true;\n    }\n    // If both roots are documents root it is operation within the document what we still treat as the same tree.\n    if (rootA instanceof ModelRootElement && rootB instanceof ModelRootElement) {\n        return true;\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/utils/selection-post-fixer\n */\nimport { ModelPosition } from '../position.js';\nimport { ModelRange } from '../range.js';\n/**\n * Injects selection post-fixer to the model.\n *\n * The role of the selection post-fixer is to ensure that the selection is in a correct place\n * after a {@link module:engine/model/model~Model#change `change()`} block was executed.\n *\n * The correct position means that:\n *\n * * All collapsed selection ranges are in a place where the {@link module:engine/model/schema~ModelSchema}\n * allows a `$text`.\n * * None of the selection's non-collapsed ranges crosses a {@link module:engine/model/schema~ModelSchema#isLimit limit element}\n * boundary (a range must be rooted within one limit element).\n * * Only {@link module:engine/model/schema~ModelSchema#isSelectable selectable elements} can be selected from the outside\n * (e.g. `[<paragraph>foo</paragraph>]` is invalid). This rule applies independently to both selection ends, so this\n * selection is correct: `<paragraph>f[oo</paragraph><imageBlock></imageBlock>]`.\n *\n * If the position is not correct, the post-fixer will automatically correct it.\n *\n * ## Fixing a non-collapsed selection\n *\n * See as an example a selection that starts in a P1 element and ends inside the text of a TD element\n * (`[` and `]` are range boundaries and `(l)` denotes an element defined as `isLimit=true`):\n *\n * ```\n * root\n *  |- element P1\n *  |   |- \"foo\"                                      root\n *  |- element TABLE (l)                   P1         TABLE             P2\n *  |   |- element TR (l)                 f o[o     TR      TR         b a r\n *  |   |   |- element TD (l)                       TD      TD\n *  |   |       |- \"aaa\"                          a]a a    b b b\n *  |   |- element TR (l)\n *  |   |   |- element TD (l)                           ||\n *  |   |       |- \"bbb\"                                ||\n *  |- element P2                                       VV\n *  |   |- \"bar\"\n *                                                    root\n *                                         P1         TABLE]            P2\n *                                        f o[o     TR      TR         b a r\n *                                                  TD      TD\n *                                                a a a    b b b\n * ```\n *\n * In the example above, the TABLE, TR and TD are defined as `isLimit=true` in the schema. The range which is not contained within\n * a single limit element must be expanded to select the outermost limit element. The range end is inside the text node of the TD element.\n * As the TD element is a child of the TR and TABLE elements, where both are defined as `isLimit=true` in the schema, the range must be\n * expanded to select the whole TABLE element.\n *\n * **Note** If the selection contains multiple ranges, the method returns a minimal set of ranges that are not intersecting after expanding\n * them to select `isLimit=true` elements.\n *\n * @internal\n */\nexport function injectSelectionPostFixer(model) {\n    model.document.registerPostFixer(writer => selectionPostFixer(writer, model));\n}\n/**\n * The selection post-fixer.\n */\nfunction selectionPostFixer(writer, model) {\n    const selection = model.document.selection;\n    const schema = model.schema;\n    const ranges = [];\n    let wasFixed = false;\n    for (const modelRange of selection.getRanges()) {\n        // Go through all ranges in selection and try fixing each of them.\n        // Those ranges might overlap but will be corrected later.\n        const correctedRange = tryFixingRange(modelRange, schema);\n        // \"Selection fixing\" algorithms sometimes get lost. In consequence, it may happen\n        // that a new range is returned but, in fact, it has the same positions as the original\n        // range anyway. If this range is not discarded, a new selection will be set and that,\n        // for instance, would destroy the selection attributes. Let's make sure that the post-fixer\n        // actually worked first before setting a new selection.\n        //\n        // https://github.com/ckeditor/ckeditor5/issues/6693\n        if (correctedRange && !correctedRange.isEqual(modelRange)) {\n            ranges.push(correctedRange);\n            wasFixed = true;\n        }\n        else {\n            ranges.push(modelRange);\n        }\n    }\n    // If any of ranges were corrected update the selection.\n    if (wasFixed) {\n        writer.setSelection(mergeIntersectingRanges(ranges), { backward: selection.isBackward });\n    }\n    return false;\n}\n/**\n * Tries fixing a range if it's incorrect.\n *\n * **Note:** This helper is used by the selection post-fixer and to fix the `beforeinput` target ranges.\n *\n * @returns Returns fixed range or null if range is valid.\n * @internal\n */\nexport function tryFixingRange(range, schema) {\n    if (range.isCollapsed) {\n        return tryFixingCollapsedRange(range, schema);\n    }\n    return tryFixingNonCollapsedRage(range, schema);\n}\n/**\n * Tries to fix collapsed ranges.\n *\n * * Fixes situation when a range is in a place where $text is not allowed\n *\n * @param range Collapsed range to fix.\n * @returns Returns fixed range or null if range is valid.\n */\nfunction tryFixingCollapsedRange(range, schema) {\n    const originalPosition = range.start;\n    const nearestSelectionRange = schema.getNearestSelectionRange(originalPosition);\n    // This might be null, i.e. when the editor data is empty or the selection is inside a limit element\n    // that doesn't allow text inside.\n    // In the first case, there is no need to fix the selection range.\n    // In the second, let's go up to the outer selectable element\n    if (!nearestSelectionRange) {\n        const ancestorObject = originalPosition.getAncestors().reverse().find((item) => schema.isObject(item));\n        if (ancestorObject) {\n            return ModelRange._createOn(ancestorObject);\n        }\n        return null;\n    }\n    if (!nearestSelectionRange.isCollapsed) {\n        return nearestSelectionRange;\n    }\n    const fixedPosition = nearestSelectionRange.start;\n    // Fixed position is the same as original - no need to return corrected range.\n    if (originalPosition.isEqual(fixedPosition)) {\n        return null;\n    }\n    return new ModelRange(fixedPosition);\n}\n/**\n * Tries to fix an expanded range.\n *\n * @param range Expanded range to fix.\n * @returns Returns fixed range or null if range is valid.\n */\nfunction tryFixingNonCollapsedRage(range, schema) {\n    const { start, end } = range;\n    const isTextAllowedOnStart = schema.checkChild(start, '$text');\n    const isTextAllowedOnEnd = schema.checkChild(end, '$text');\n    const startLimitElement = schema.getLimitElement(start);\n    const endLimitElement = schema.getLimitElement(end);\n    // Ranges which both end are inside the same limit element (or root) might needs only minor fix.\n    if (startLimitElement === endLimitElement) {\n        // Range is valid when both position allows to place a text:\n        // - <block>f[oobarba]z</block>\n        // This would be \"fixed\" by a next check but as it will be the same it's better to return null so the selection stays the same.\n        if (isTextAllowedOnStart && isTextAllowedOnEnd) {\n            return null;\n        }\n        // Range that is on non-limit element (or is partially) must be fixed so it is placed inside the block around $text:\n        // - [<block>foo</block>]    ->    <block>[foo]</block>\n        // - [<block>foo]</block>    ->    <block>[foo]</block>\n        // - <block>f[oo</block>]    ->    <block>f[oo]</block>\n        // - [<block>foo</block><selectable></selectable>]    ->    <block>[foo</block><selectable></selectable>]\n        if (checkSelectionOnNonLimitElements(start, end, schema)) {\n            const isStartBeforeSelectable = start.nodeAfter && schema.isSelectable(start.nodeAfter);\n            const fixedStart = isStartBeforeSelectable ? null : schema.getNearestSelectionRange(start, 'forward');\n            const isEndAfterSelectable = end.nodeBefore && schema.isSelectable(end.nodeBefore);\n            const fixedEnd = isEndAfterSelectable ? null : schema.getNearestSelectionRange(end, 'backward');\n            // The schema.getNearestSelectionRange might return null - if that happens use original position.\n            const rangeStart = fixedStart ? fixedStart.start : start;\n            const rangeEnd = fixedEnd ? fixedEnd.end : end;\n            return new ModelRange(rangeStart, rangeEnd);\n        }\n    }\n    const isStartInLimit = startLimitElement && !startLimitElement.is('rootElement');\n    const isEndInLimit = endLimitElement && !endLimitElement.is('rootElement');\n    // At this point we eliminated valid positions on text nodes so if one of range positions is placed inside a limit element\n    // then the range crossed limit element boundaries and needs to be fixed.\n    if (isStartInLimit || isEndInLimit) {\n        const bothInSameParent = (start.nodeAfter && end.nodeBefore) && start.nodeAfter.parent === end.nodeBefore.parent;\n        const expandStart = isStartInLimit && (!bothInSameParent || !isSelectable(start.nodeAfter, schema));\n        const expandEnd = isEndInLimit && (!bothInSameParent || !isSelectable(end.nodeBefore, schema));\n        // Although we've already found limit element on start/end positions we must find the outer-most limit element.\n        // as limit elements might be nested directly inside (ie table > tableRow > tableCell).\n        let fixedStart = start;\n        let fixedEnd = end;\n        if (expandStart) {\n            fixedStart = ModelPosition._createBefore(findOutermostLimitAncestor(startLimitElement, schema));\n        }\n        if (expandEnd) {\n            fixedEnd = ModelPosition._createAfter(findOutermostLimitAncestor(endLimitElement, schema));\n        }\n        return new ModelRange(fixedStart, fixedEnd);\n    }\n    // Range was not fixed at this point so it is valid - ie it was placed around limit element already.\n    return null;\n}\n/**\n * Finds the outer-most ancestor.\n */\nfunction findOutermostLimitAncestor(startingNode, schema) {\n    let isLimitNode = startingNode;\n    let parent = isLimitNode;\n    // Find outer most isLimit block as such blocks might be nested (ie. in tables).\n    while (schema.isLimit(parent) && parent.parent) {\n        isLimitNode = parent;\n        parent = parent.parent;\n    }\n    return isLimitNode;\n}\n/**\n * Checks whether any of range boundaries is placed around non-limit elements.\n */\nfunction checkSelectionOnNonLimitElements(start, end, schema) {\n    const startIsOnBlock = (start.nodeAfter && !schema.isLimit(start.nodeAfter)) || schema.checkChild(start, '$text');\n    const endIsOnBlock = (end.nodeBefore && !schema.isLimit(end.nodeBefore)) || schema.checkChild(end, '$text');\n    // We should fix such selection when one of those nodes needs fixing.\n    return startIsOnBlock || endIsOnBlock;\n}\n/**\n * Returns a minimal non-intersecting array of ranges without duplicates.\n *\n * @param ranges Ranges to merge.\n * @returns Array of unique and non-intersecting ranges.\n * @internal\n */\nexport function mergeIntersectingRanges(ranges) {\n    const rangesToMerge = [...ranges];\n    const rangeIndexesToRemove = new Set();\n    let currentRangeIndex = 1;\n    while (currentRangeIndex < rangesToMerge.length) {\n        const currentRange = rangesToMerge[currentRangeIndex];\n        const previousRanges = rangesToMerge.slice(0, currentRangeIndex);\n        for (const [previousRangeIndex, previousRange] of previousRanges.entries()) {\n            if (rangeIndexesToRemove.has(previousRangeIndex)) {\n                continue;\n            }\n            if (currentRange.isEqual(previousRange)) {\n                rangeIndexesToRemove.add(previousRangeIndex);\n            }\n            else if (currentRange.isIntersecting(previousRange)) {\n                rangeIndexesToRemove.add(previousRangeIndex);\n                rangeIndexesToRemove.add(currentRangeIndex);\n                const mergedRange = currentRange.getJoined(previousRange);\n                rangesToMerge.push(mergedRange);\n            }\n        }\n        currentRangeIndex++;\n    }\n    const nonIntersectingRanges = rangesToMerge.filter((_, index) => !rangeIndexesToRemove.has(index));\n    return nonIntersectingRanges;\n}\n/**\n * Checks if node exists and if it's a selectable.\n */\nfunction isSelectable(node, schema) {\n    return node && schema.isSelectable(node);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/utils/deletecontent\n */\nimport { ModelDocumentSelection } from '../documentselection.js';\nimport { ModelLivePosition } from '../liveposition.js';\nimport { ModelRange } from '../range.js';\n/**\n * Deletes content of the selection and merge siblings. The resulting selection is always collapsed.\n *\n * **Note:** Use {@link module:engine/model/model~Model#deleteContent} instead of this function.\n * This function is only exposed to be reusable in algorithms\n * which change the {@link module:engine/model/model~Model#deleteContent}\n * method's behavior.\n *\n * @param model The model in context of which the insertion should be performed.\n * @param selection Selection of which the content should be deleted.\n * @param options.leaveUnmerged Whether to merge elements after removing the content of the selection.\n *\n * For example `<heading>x[x</heading><paragraph>y]y</paragraph>` will become:\n *\n * * `<heading>x^y</heading>` with the option disabled (`leaveUnmerged == false`)\n * * `<heading>x^</heading><paragraph>y</paragraph>` with enabled (`leaveUnmerged == true`).\n *\n * Note: {@link module:engine/model/schema~ModelSchema#isObject object} and {@link module:engine/model/schema~ModelSchema#isLimit limit}\n * elements will not be merged.\n *\n * @param options.doNotResetEntireContent Whether to skip replacing the entire content with a\n * paragraph when the entire content was selected.\n *\n * For example `<heading>[x</heading><paragraph>y]</paragraph>` will become:\n *\n * * `<paragraph>^</paragraph>` with the option disabled (`doNotResetEntireContent == false`)\n * * `<heading>^</heading>` with enabled (`doNotResetEntireContent == true`).\n *\n * @param options.doNotAutoparagraph Whether to create a paragraph if after content deletion selection is moved\n * to a place where text cannot be inserted.\n *\n * For example `<paragraph>x</paragraph>[<imageBlock src=\"foo.jpg\"></imageBlock>]` will become:\n *\n * * `<paragraph>x</paragraph><paragraph>[]</paragraph>` with the option disabled (`doNotAutoparagraph == false`)\n * * `<paragraph>x</paragraph>[]` with the option enabled (`doNotAutoparagraph == true`).\n *\n * If you use this option you need to make sure to handle invalid selections yourself or leave\n * them to the selection post-fixer (may not always work).\n *\n * **Note:** If there is no valid position for the selection, the paragraph will always be created:\n *\n * `[<imageBlock src=\"foo.jpg\"></imageBlock>]` -> `<paragraph>[]</paragraph>`.\n *\n * @param options.doNotFixSelection Whether given selection-to-remove should be fixed if it ends at the beginning of an element.\n *\n * By default, `deleteContent()` will fix selection before performing a deletion, so that the selection does not end at the beginning of\n * an element. For example, selection `<heading>[Heading</heading><paragraph>]Some text.</paragraph>` will be treated as it was\n * `<heading>[Heading]</heading><paragraph>Some text.</paragraph>`. As a result, the elements will not get merged.\n *\n * If selection is as in example, visually, the next element (paragraph) is not selected and it may be confusing for the user that\n * the elements got merged. Selection is set up like this by browsers when a user triple-clicks on some text.\n *\n * However, in some cases, it is expected to remove content exactly as selected in the selection, without any fixing. In these cases,\n * this flag can be set to `true`, which will prevent fixing the selection.\n *\n * @internal\n */\nexport function deleteContent(model, selection, options = {}) {\n    if (selection.isCollapsed) {\n        return;\n    }\n    const selRange = selection.getFirstRange();\n    // If the selection is already removed, don't do anything.\n    if (selRange.root.rootName == '$graveyard') {\n        return;\n    }\n    const schema = model.schema;\n    model.change(writer => {\n        // 1. Replace the entire content with paragraph.\n        // See: https://github.com/ckeditor/ckeditor5-engine/issues/1012#issuecomment-315017594.\n        if (!options.doNotResetEntireContent && shouldEntireContentBeReplacedWithParagraph(schema, selection)) {\n            replaceEntireContentWithParagraph(writer, selection);\n            return;\n        }\n        // Collect attributes to copy in case of autoparagraphing.\n        const attributesForAutoparagraph = {};\n        if (!options.doNotAutoparagraph) {\n            const selectedElement = selection.getSelectedElement();\n            if (selectedElement) {\n                Object.assign(attributesForAutoparagraph, schema.getAttributesWithProperty(selectedElement, 'copyOnReplace', true));\n            }\n        }\n        // Get the live positions for the range adjusted to span only blocks selected from the user perspective.\n        let startPosition, endPosition;\n        if (!options.doNotFixSelection) {\n            [startPosition, endPosition] = getLivePositionsForSelectedBlocks(selRange);\n        }\n        else {\n            startPosition = ModelLivePosition.fromPosition(selRange.start, 'toPrevious');\n            endPosition = ModelLivePosition.fromPosition(selRange.end, 'toNext');\n        }\n        // 2. Remove the content if there is any.\n        if (!startPosition.isTouching(endPosition)) {\n            writer.remove(writer.createRange(startPosition, endPosition));\n        }\n        // 3. Merge elements in the right branch to the elements in the left branch.\n        // The only reasonable (in terms of data and selection correctness) case in which we need to do that is:\n        //\n        // <heading type=1>Fo[</heading><paragraph>]ar</paragraph> => <heading type=1>Fo^ar</heading>\n        //\n        // However, the algorithm supports also merging deeper structures (up to the depth of the shallower branch),\n        // as it's hard to imagine what should actually be the default behavior. Usually, specific features will\n        // want to override that behavior anyway.\n        if (!options.leaveUnmerged) {\n            mergeBranches(writer, startPosition, endPosition);\n            // TMP this will be replaced with a postfixer.\n            // We need to check and strip disallowed attributes in all nested nodes because after merge\n            // some attributes could end up in a path where are disallowed.\n            //\n            // e.g. bold is disallowed for <H1>\n            // <h1>Fo{o</h1><p>b}a<b>r</b><p> -> <h1>Fo{}a<b>r</b><h1> -> <h1>Fo{}ar<h1>.\n            schema.removeDisallowedAttributes(startPosition.parent.getChildren(), writer);\n        }\n        collapseSelectionAt(writer, selection, startPosition);\n        // 4. Add a paragraph to set selection in it.\n        // Check if a text is allowed in the new container. If not, try to create a new paragraph (if it's allowed here).\n        // If autoparagraphing is off, we assume that you know what you do so we leave the selection wherever it was.\n        if (!options.doNotAutoparagraph && shouldAutoparagraph(schema, startPosition)) {\n            insertParagraph(writer, startPosition, selection, attributesForAutoparagraph);\n        }\n        startPosition.detach();\n        endPosition.detach();\n    });\n}\n/**\n * Returns the live positions for the range adjusted to span only blocks selected from the user perspective. Example:\n *\n * ```\n * <heading1>[foo</heading1>\n * <paragraph>bar</paragraph>\n * <heading1>]abc</heading1>  <-- this block is not considered as selected\n * ```\n *\n * This is the same behavior as in Selection#getSelectedBlocks() \"special case\".\n */\nfunction getLivePositionsForSelectedBlocks(range) {\n    const model = range.root.document.model;\n    const startPosition = range.start;\n    let endPosition = range.end;\n    // If the end of selection is at the start position of last block in the selection, then\n    // shrink it to not include that trailing block. Note that this should happen only for not empty selection.\n    if (model.hasContent(range, { ignoreMarkers: true })) {\n        const endBlock = getParentBlock(endPosition);\n        if (endBlock && endPosition.isTouching(model.createPositionAt(endBlock, 0))) {\n            // Create forward selection as a probe to find a valid position after excluding last block from the range.\n            const selection = model.createSelection(range);\n            // Modify the forward selection in backward direction to shrink it and remove first position of following block from it.\n            // This is how modifySelection works and here we are making use of it.\n            model.modifySelection(selection, { direction: 'backward' });\n            const newEndPosition = selection.getLastPosition();\n            // For such a model and selection:\n            //     <paragraph>A[</paragraph><imageBlock></imageBlock><paragraph>]B</paragraph>\n            //\n            // After modifySelection(), we would end up with this:\n            //     <paragraph>A[</paragraph>]<imageBlock></imageBlock><paragraph>B</paragraph>\n            //\n            // So we need to check if there is no content in the skipped range (because we want to include the <imageBlock>).\n            const skippedRange = model.createRange(newEndPosition, endPosition);\n            if (!model.hasContent(skippedRange, { ignoreMarkers: true })) {\n                endPosition = newEndPosition;\n            }\n        }\n    }\n    return [\n        ModelLivePosition.fromPosition(startPosition, 'toPrevious'),\n        ModelLivePosition.fromPosition(endPosition, 'toNext')\n    ];\n}\n/**\n * Finds the lowest element in position's ancestors which is a block.\n * Returns null if a limit element is encountered before reaching a block element.\n */\nfunction getParentBlock(position) {\n    const element = position.parent;\n    const schema = element.root.document.model.schema;\n    const ancestors = element.getAncestors({ parentFirst: true, includeSelf: true });\n    for (const element of ancestors) {\n        if (schema.isLimit(element)) {\n            return null;\n        }\n        if (schema.isBlock(element)) {\n            return element;\n        }\n    }\n}\n/**\n * This function is a result of reaching the Ballmer's peak for just the right amount of time.\n * Even I had troubles documenting it after a while and after reading it again I couldn't believe that it really works.\n */\nfunction mergeBranches(writer, startPosition, endPosition) {\n    const model = writer.model;\n    // Verify if there is a need and possibility to merge.\n    if (!checkShouldMerge(writer.model.schema, startPosition, endPosition)) {\n        return;\n    }\n    // If the start element on the common ancestor level is empty, and the end element on the same level is not empty\n    // then merge those to the right element so that it's properties are preserved (name, attributes).\n    // Because of OT merging is used instead of removing elements.\n    //\n    // Merge left:\n    //     <heading1>foo[</heading1>    ->  <heading1>foo[]bar</heading1>\n    //     <paragraph>]bar</paragraph>  ->               --^\n    //\n    // Merge right:\n    //     <heading1>[</heading1>       ->\n    //     <paragraph>]bar</paragraph>  ->  <paragraph>[]bar</paragraph>\n    //\n    // Merge left:\n    //     <blockQuote>                     ->  <blockQuote>\n    //         <heading1>foo[</heading1>    ->      <heading1>foo[]bar</heading1>\n    //         <paragraph>]bar</paragraph>  ->                   --^\n    //     </blockQuote>                    ->  </blockQuote>\n    //\n    // Merge right:\n    //     <blockQuote>                     ->  <blockQuote>\n    //         <heading1>[</heading1>       ->\n    //         <paragraph>]bar</paragraph>  ->      <paragraph>[]bar</paragraph>\n    //     </blockQuote>                    ->  </blockQuote>\n    // Merging should not go deeper than common ancestor.\n    const [startAncestor, endAncestor] = getAncestorsJustBelowCommonAncestor(startPosition, endPosition);\n    // Branches can't be merged if one of the positions is directly inside a common ancestor.\n    //\n    // Example:\n    //     <blockQuote>\n    //         <paragraph>[foo</paragraph>]\n    //         <table> ... </table>\n    //     <blockQuote>\n    //\n    if (!startAncestor || !endAncestor) {\n        return;\n    }\n    if (!model.hasContent(startAncestor, { ignoreMarkers: true }) && model.hasContent(endAncestor, { ignoreMarkers: true })) {\n        mergeBranchesRight(writer, startPosition, endPosition, startAncestor.parent);\n    }\n    else {\n        mergeBranchesLeft(writer, startPosition, endPosition, startAncestor.parent);\n    }\n}\n/**\n * Merging blocks to the left (properties of the left block are preserved).\n * Simple example:\n *\n * ```\n * <heading1>foo[</heading1>    ->  <heading1>foo[bar</heading1>]\n * <paragraph>]bar</paragraph>  ->              --^\n * ```\n *\n * Nested example:\n *\n * ```\n * <blockQuote>                     ->  <blockQuote>\n *     <heading1>foo[</heading1>    ->      <heading1>foo[bar</heading1>\n * </blockQuote>                    ->  </blockQuote>]    ^\n * <blockBlock>                     ->                    |\n *     <paragraph>]bar</paragraph>  ->                 ---\n * </blockBlock>                    ->\n * ```\n */\nfunction mergeBranchesLeft(writer, startPosition, endPosition, commonAncestor) {\n    const startElement = startPosition.parent;\n    const endElement = endPosition.parent;\n    // Merging reached the common ancestor element, stop here.\n    if (startElement == commonAncestor || endElement == commonAncestor) {\n        return;\n    }\n    // Remember next positions to merge in next recursive step (also used as modification points pointers).\n    startPosition = writer.createPositionAfter(startElement);\n    endPosition = writer.createPositionBefore(endElement);\n    // Move endElement just after startElement if they aren't siblings.\n    if (!endPosition.isEqual(startPosition)) {\n        //\n        //     <blockQuote>                     ->  <blockQuote>\n        //         <heading1>foo[</heading1>    ->      <heading1>foo</heading1>[<paragraph>bar</paragraph>\n        //     </blockQuote>                    ->  </blockQuote>                ^\n        //     <blockBlock>                     ->  <blockBlock>                 |\n        //         <paragraph>]bar</paragraph>  ->      ]                     ---\n        //     </blockBlock>                    ->  </blockBlock>\n        //\n        writer.insert(endElement, startPosition);\n    }\n    // Merge two siblings (nodes on sides of startPosition):\n    //\n    //     <blockQuote>                                             ->  <blockQuote>\n    //         <heading1>foo</heading1>[<paragraph>bar</paragraph>  ->      <heading1>foo[bar</heading1>\n    //     </blockQuote>                                            ->  </blockQuote>\n    //     <blockBlock>                                             ->  <blockBlock>\n    //         ]                                                    ->      ]\n    //     </blockBlock>                                            ->  </blockBlock>\n    //\n    // Or in simple case (without moving elements in above if):\n    //     <heading1>foo</heading1>[<paragraph>bar</paragraph>]  ->  <heading1>foo[bar</heading1>]\n    //\n    writer.merge(startPosition);\n    // Remove empty end ancestors:\n    //\n    //     <blockQuote>                      ->  <blockQuote>\n    //         <heading1>foo[bar</heading1>  ->      <heading1>foo[bar</heading1>\n    //     </blockQuote>                     ->  </blockQuote>\n    //     <blockBlock>                      ->\n    //         ]                             ->  ]\n    //     </blockBlock>                     ->\n    //\n    while (endPosition.parent.isEmpty) {\n        const parentToRemove = endPosition.parent;\n        endPosition = writer.createPositionBefore(parentToRemove);\n        writer.remove(parentToRemove);\n    }\n    // Verify if there is a need and possibility to merge next level.\n    if (!checkShouldMerge(writer.model.schema, startPosition, endPosition)) {\n        return;\n    }\n    // Continue merging next level (blockQuote with blockBlock in the examples above if it would not be empty and got removed).\n    mergeBranchesLeft(writer, startPosition, endPosition, commonAncestor);\n}\n/**\n * Merging blocks to the right (properties of the right block are preserved).\n * Simple example:\n *\n * ```\n * <heading1>foo[</heading1>    ->            --v\n * <paragraph>]bar</paragraph>  ->  [<paragraph>foo]bar</paragraph>\n * ```\n *\n * Nested example:\n *\n * ```\n * <blockQuote>                     ->\n *     <heading1>foo[</heading1>    ->              ---\n * </blockQuote>                    ->                 |\n * <blockBlock>                     ->  [<blockBlock>  v\n *     <paragraph>]bar</paragraph>  ->      <paragraph>foo]bar</paragraph>\n * </blockBlock>                    ->  </blockBlock>\n * ```\n */\nfunction mergeBranchesRight(writer, startPosition, endPosition, commonAncestor) {\n    const startElement = startPosition.parent;\n    const endElement = endPosition.parent;\n    // Merging reached the common ancestor element, stop here.\n    if (startElement == commonAncestor || endElement == commonAncestor) {\n        return;\n    }\n    // Remember next positions to merge in next recursive step (also used as modification points pointers).\n    startPosition = writer.createPositionAfter(startElement);\n    endPosition = writer.createPositionBefore(endElement);\n    // Move startElement just before endElement if they aren't siblings.\n    if (!endPosition.isEqual(startPosition)) {\n        //\n        //     <blockQuote>                     ->  <blockQuote>\n        //         <heading1>foo[</heading1>    ->      [                   ---\n        //     </blockQuote>                    ->  </blockQuote>              |\n        //     <blockBlock>                     ->  <blockBlock>               v\n        //         <paragraph>]bar</paragraph>  ->      <heading1>foo</heading1>]<paragraph>bar</paragraph>\n        //     </blockBlock>                    ->  </blockBlock>\n        //\n        writer.insert(startElement, endPosition);\n    }\n    // Remove empty end ancestors:\n    //\n    //     <blockQuote>                                             ->\n    //         [                                                    ->  [\n    //     </blockQuote>                                            ->\n    //     <blockBlock>                                             ->  <blockBlock>\n    //         <heading1>foo</heading1>]<paragraph>bar</paragraph>  ->      <heading1>foo</heading1>]<paragraph>bar</paragraph>\n    //     </blockBlock>                                            ->  </blockBlock>\n    //\n    while (startPosition.parent.isEmpty) {\n        const parentToRemove = startPosition.parent;\n        startPosition = writer.createPositionBefore(parentToRemove);\n        writer.remove(parentToRemove);\n    }\n    // Update endPosition after inserting and removing elements.\n    endPosition = writer.createPositionBefore(endElement);\n    // Merge right two siblings (nodes on sides of endPosition):\n    //                                                              ->\n    //     [                                                        ->  [\n    //                                                              ->\n    //     <blockBlock>                                             ->  <blockBlock>\n    //         <heading1>foo</heading1>]<paragraph>bar</paragraph>  ->      <paragraph>foo]bar</paragraph>\n    //     </blockBlock>                                            ->  </blockBlock>\n    //\n    // Or in simple case (without moving elements in above if):\n    //     [<heading1>foo</heading1>]<paragraph>bar</paragraph>  ->  [<heading1>foo]bar</heading1>\n    //\n    mergeRight(writer, endPosition);\n    // Verify if there is a need and possibility to merge next level.\n    if (!checkShouldMerge(writer.model.schema, startPosition, endPosition)) {\n        return;\n    }\n    // Continue merging next level (blockQuote with blockBlock in the examples above if it would not be empty and got removed).\n    mergeBranchesRight(writer, startPosition, endPosition, commonAncestor);\n}\n/**\n * There is no right merge operation so we need to simulate it.\n */\nfunction mergeRight(writer, position) {\n    const startElement = position.nodeBefore;\n    const endElement = position.nodeAfter;\n    if (startElement.name != endElement.name) {\n        writer.rename(startElement, endElement.name);\n    }\n    writer.clearAttributes(startElement);\n    writer.setAttributes(Object.fromEntries(endElement.getAttributes()), startElement);\n    writer.merge(position);\n}\n/**\n * Verifies if merging is needed and possible. It's not needed if both positions are in the same element\n * and it's not possible if some element is a limit or the range crosses a limit element.\n */\nfunction checkShouldMerge(schema, startPosition, endPosition) {\n    const startElement = startPosition.parent;\n    const endElement = endPosition.parent;\n    // If both positions ended up in the same parent, then there's nothing more to merge:\n    // <$root><p>x[</p><p>]y</p></$root> => <$root><p>xy</p>[]</$root>\n    if (startElement == endElement) {\n        return false;\n    }\n    // If one of the positions is a limit element, then there's nothing to merge because we don't want to cross the limit boundaries.\n    if (schema.isLimit(startElement) || schema.isLimit(endElement)) {\n        return false;\n    }\n    // Check if operations we'll need to do won't need to cross object or limit boundaries.\n    // E.g., we can't merge endElement into startElement in this case:\n    // <limit><startElement>x[</startElement></limit><endElement>]</endElement>\n    return isCrossingLimitElement(startPosition, endPosition, schema);\n}\n/**\n * Returns the elements that are the ancestors of the provided positions that are direct children of the common ancestor.\n */\nfunction getAncestorsJustBelowCommonAncestor(positionA, positionB) {\n    const ancestorsA = positionA.getAncestors();\n    const ancestorsB = positionB.getAncestors();\n    let i = 0;\n    while (ancestorsA[i] && ancestorsA[i] == ancestorsB[i]) {\n        i++;\n    }\n    return [ancestorsA[i], ancestorsB[i]];\n}\nfunction shouldAutoparagraph(schema, position) {\n    const isTextAllowed = schema.checkChild(position, '$text');\n    const isParagraphAllowed = schema.checkChild(position, 'paragraph');\n    return !isTextAllowed && isParagraphAllowed;\n}\n/**\n * Check if parents of two positions can be merged by checking if there are no limit/object\n * boundaries between those two positions.\n *\n * E.g. in <bQ><p>x[]</p></bQ><widget><caption>{}</caption></widget>\n * we'll check <p>, <bQ>, <widget> and <caption>.\n * Usually, widget and caption are marked as objects/limits in the schema, so in this case merging will be blocked.\n */\nfunction isCrossingLimitElement(leftPos, rightPos, schema) {\n    const rangeToCheck = new ModelRange(leftPos, rightPos);\n    for (const value of rangeToCheck.getWalker()) {\n        if (schema.isLimit(value.item)) {\n            return false;\n        }\n    }\n    return true;\n}\nfunction insertParagraph(writer, position, selection, attributes = {}) {\n    const paragraph = writer.createElement('paragraph');\n    writer.model.schema.setAllowedAttributes(paragraph, attributes, writer);\n    writer.insert(paragraph, position);\n    collapseSelectionAt(writer, selection, writer.createPositionAt(paragraph, 0));\n}\nfunction replaceEntireContentWithParagraph(writer, selection) {\n    const limitElement = writer.model.schema.getLimitElement(selection);\n    writer.remove(writer.createRangeIn(limitElement));\n    insertParagraph(writer, writer.createPositionAt(limitElement, 0), selection);\n}\n/**\n * We want to replace the entire content with a paragraph when:\n * * the entire content is selected,\n * * selection contains at least two elements,\n * * whether the paragraph is allowed in schema in the common ancestor.\n */\nfunction shouldEntireContentBeReplacedWithParagraph(schema, selection) {\n    const limitElement = schema.getLimitElement(selection);\n    if (!selection.containsEntireContent(limitElement)) {\n        return false;\n    }\n    const range = selection.getFirstRange();\n    if (range.start.parent == range.end.parent) {\n        return false;\n    }\n    return schema.checkChild(limitElement, 'paragraph');\n}\n/**\n * Helper function that sets the selection. Depending whether given `selection` is a document selection or not,\n * uses a different method to set it.\n */\nfunction collapseSelectionAt(writer, selection, positionOrRange) {\n    if (selection instanceof ModelDocumentSelection) {\n        writer.setSelection(positionOrRange);\n    }\n    else {\n        selection.setTo(positionOrRange);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/utils/getselectedcontent\n */\n/**\n * Gets a clone of the selected content.\n *\n * For example, for the following selection:\n *\n * ```html\n * <p>x</p><quote><p>y</p><h>fir[st</h></quote><p>se]cond</p><p>z</p>\n * ```\n *\n * It will return a document fragment with such a content:\n *\n * ```html\n * <quote><h>st</h></quote><p>se</p>\n * ```\n *\n * @param model The model in context of which the selection modification should be performed.\n * @param selection The selection of which content will be returned.\n * @internal\n */\nexport function getSelectedContent(model, selection) {\n    return model.change(writer => {\n        const frag = writer.createDocumentFragment();\n        const range = selection.getFirstRange();\n        if (!range || range.isCollapsed) {\n            return frag;\n        }\n        const root = range.start.root;\n        const commonPath = range.start.getCommonPath(range.end);\n        const commonParent = root.getNodeByPath(commonPath);\n        // ## 1st step\n        //\n        // First, we'll clone a fragment represented by a minimal flat range\n        // containing the original range to be cloned.\n        // E.g. let's consider such a range:\n        //\n        // <p>x</p><quote><p>y</p><h>fir[st</h></quote><p>se]cond</p><p>z</p>\n        //\n        // A minimal flat range containing this one is:\n        //\n        // <p>x</p>[<quote><p>y</p><h>first</h></quote><p>second</p>]<p>z</p>\n        //\n        // We can easily clone this structure, preserving e.g. the <quote> element.\n        let flatSubtreeRange;\n        if (range.start.parent == range.end.parent) {\n            // The original range is flat, so take it.\n            flatSubtreeRange = range;\n        }\n        else {\n            flatSubtreeRange = writer.createRange(writer.createPositionAt(commonParent, range.start.path[commonPath.length]), writer.createPositionAt(commonParent, range.end.path[commonPath.length] + 1));\n        }\n        const howMany = flatSubtreeRange.end.offset - flatSubtreeRange.start.offset;\n        // Clone the whole contents.\n        for (const item of flatSubtreeRange.getItems({ shallow: true })) {\n            if (item.is('$textProxy')) {\n                writer.appendText(item.data, item.getAttributes(), frag);\n            }\n            else {\n                writer.append(writer.cloneElement(item, true), frag);\n            }\n        }\n        // ## 2nd step\n        //\n        // If the original range wasn't flat, then we need to remove the excess nodes from the both ends of the cloned fragment.\n        //\n        // For example, for the range shown in the 1st step comment, we need to remove these pieces:\n        //\n        // <quote>[<p>y</p>]<h>[fir]st</h></quote><p>se[cond]</p>\n        //\n        // So this will be the final copied content:\n        //\n        // <quote><h>st</h></quote><p>se</p>\n        //\n        // In order to do that, we remove content from these two ranges:\n        //\n        // [<quote><p>y</p><h>fir]st</h></quote><p>se[cond</p>]\n        if (flatSubtreeRange != range) {\n            // Find the position of the original range in the cloned fragment.\n            const newRange = range._getTransformedByMove(flatSubtreeRange.start, writer.createPositionAt(frag, 0), howMany)[0];\n            const leftExcessRange = writer.createRange(writer.createPositionAt(frag, 0), newRange.start);\n            const rightExcessRange = writer.createRange(newRange.end, writer.createPositionAt(frag, 'end'));\n            removeRangeContent(rightExcessRange, writer);\n            removeRangeContent(leftExcessRange, writer);\n        }\n        return frag;\n    });\n}\n// After https://github.com/ckeditor/ckeditor5-engine/issues/690 is fixed,\n// this function will, most likely, be able to rewritten using getMinimalFlatRanges().\nfunction removeRangeContent(range, writer) {\n    const parentsToCheck = [];\n    Array.from(range.getItems({ direction: 'backward' }))\n        // We should better store ranges because text proxies will lose integrity\n        // with the text nodes when we'll start removing content.\n        .map(item => writer.createRangeOn(item))\n        // Filter only these items which are fully contained in the passed range.\n        //\n        // E.g. for the following range: [<quote><p>y</p><h>fir]st</h>\n        // the walker will return the entire <h> element, when only the \"fir\" item inside it is fully contained.\n        .filter(itemRange => {\n        // We should be able to use Range.containsRange, but https://github.com/ckeditor/ckeditor5-engine/issues/691.\n        const contained = (itemRange.start.isAfter(range.start) || itemRange.start.isEqual(range.start)) &&\n            (itemRange.end.isBefore(range.end) || itemRange.end.isEqual(range.end));\n        return contained;\n    })\n        .forEach(itemRange => {\n        parentsToCheck.push(itemRange.start.parent);\n        writer.remove(itemRange);\n    });\n    // Remove ancestors of the removed items if they turned to be empty now\n    // (their whole content was contained in the range).\n    parentsToCheck.forEach(parentToCheck => {\n        let parent = parentToCheck;\n        while (parent.parent && parent.isEmpty) {\n            const removeRange = writer.createRangeOn(parent);\n            parent = parent.parent;\n            writer.remove(removeRange);\n        }\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/utils/insertcontent\n */\nimport { ModelDocumentSelection } from '../documentselection.js';\nimport { ModelElement } from '../element.js';\nimport { ModelLivePosition } from '../liveposition.js';\nimport { ModelLiveRange } from '../liverange.js';\nimport { ModelPosition } from '../position.js';\nimport { ModelRange } from '../range.js';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Inserts content into the editor (specified selection) as one would expect the paste functionality to work.\n *\n * It takes care of removing the selected content, splitting elements (if needed), inserting elements and merging elements appropriately.\n *\n * Some examples:\n *\n * ```html\n * <p>x^</p> + <p>y</p> => <p>x</p><p>y</p> => <p>xy[]</p>\n * <p>x^y</p> + <p>z</p> => <p>x</p>^<p>y</p> + <p>z</p> => <p>x</p><p>z</p><p>y</p> => <p>xz[]y</p>\n * <p>x^y</p> + <img /> => <p>x</p>^<p>y</p> + <img /> => <p>x</p><img /><p>y</p>\n * <p>x</p><p>^</p><p>z</p> + <p>y</p> => <p>x</p><p>y[]</p><p>z</p> (no merging)\n * <p>x</p>[<img />]<p>z</p> + <p>y</p> => <p>x</p>^<p>z</p> + <p>y</p> => <p>x</p><p>y[]</p><p>z</p>\n * ```\n *\n * If an instance of {@link module:engine/model/selection~ModelSelection} is passed as `selectable` it will be modified\n * to the insertion selection (equal to a range to be selected after insertion).\n *\n * If `selectable` is not passed, the content will be inserted using the current selection of the model document.\n *\n * **Note:** Use {@link module:engine/model/model~Model#insertContent} instead of this function.\n * This function is only exposed to be reusable in algorithms which change the {@link module:engine/model/model~Model#insertContent}\n * method's behavior.\n *\n * @param model The model in context of which the insertion should be performed.\n * @param content The content to insert.\n * @param selectable Selection into which the content should be inserted.\n * @returns Range which contains all the performed changes. This is a range that, if removed,\n * would return the model to the state before the insertion. If no changes were preformed by `insertContent`, returns a range collapsed\n * at the insertion position.\n * @internal\n */\nexport function insertContent(model, content, selectable) {\n    return model.change(writer => {\n        const selection = selectable ? selectable : model.document.selection;\n        if (!selection.isCollapsed) {\n            model.deleteContent(selection, { doNotAutoparagraph: true });\n        }\n        const insertion = new Insertion(model, writer, selection.anchor);\n        const fakeMarkerElements = [];\n        let nodesToInsert;\n        if (content.is('documentFragment')) {\n            // If document fragment has any markers, these markers should be inserted into the model as well.\n            if (content.markers.size) {\n                const markersPosition = [];\n                for (const [name, range] of content.markers) {\n                    const { start, end } = range;\n                    const isCollapsed = start.isEqual(end);\n                    markersPosition.push({ position: start, name, isCollapsed }, { position: end, name, isCollapsed });\n                }\n                // Markers position is sorted backwards to ensure that the insertion of fake markers will not change\n                // the position of the next markers.\n                markersPosition.sort(({ position: posA }, { position: posB }) => posA.isBefore(posB) ? 1 : -1);\n                for (const { position, name, isCollapsed } of markersPosition) {\n                    let fakeElement = null;\n                    let collapsed = null;\n                    const isAtBeginning = position.parent === content && position.isAtStart;\n                    const isAtEnd = position.parent === content && position.isAtEnd;\n                    // We have two ways of handling markers. In general, we want to add temporary <$marker> model elements to\n                    // represent marker boundaries. These elements will be inserted into content together with the rest\n                    // of the document fragment. After insertion is done, positions for these elements will be read\n                    // and proper, actual markers will be created in the model and fake elements will be removed.\n                    //\n                    // However, if the <$marker> element is at the beginning or at the end of the document fragment,\n                    // it may affect how the inserted content is merged with current model, impacting the insertion\n                    // result. To avoid that, we don't add <$marker> elements at these positions. Instead, we will use\n                    // `Insertion#getAffectedRange()` to figure out new positions for these marker boundaries.\n                    if (!isAtBeginning && !isAtEnd) {\n                        fakeElement = writer.createElement('$marker');\n                        writer.insert(fakeElement, position);\n                    }\n                    else if (isCollapsed) {\n                        // Save whether the collapsed marker was at the beginning or at the end of document fragment\n                        // to know where to create it after the insertion is done.\n                        collapsed = isAtBeginning ? 'start' : 'end';\n                    }\n                    fakeMarkerElements.push({\n                        name,\n                        element: fakeElement,\n                        collapsed\n                    });\n                }\n            }\n            nodesToInsert = content.getChildren();\n        }\n        else {\n            nodesToInsert = [content];\n        }\n        insertion.handleNodes(nodesToInsert);\n        let newRange = insertion.getSelectionRange();\n        if (content.is('documentFragment') && fakeMarkerElements.length) {\n            // After insertion was done, the selection was set but the model contains fake <$marker> elements.\n            // These <$marker> elements will be now removed. Because of that, we will need to fix the selection.\n            // We will create a live range that will automatically be update as <$marker> elements are removed.\n            const selectionLiveRange = newRange ? ModelLiveRange.fromRange(newRange) : null;\n            // Marker name -> [ start position, end position ].\n            const markersData = {};\n            // Note: `fakeMarkerElements` are sorted backwards. However, now, we want to handle the markers\n            // from the beginning, so that existing <$marker> elements do not affect markers positions.\n            // This is why we iterate from the end to the start.\n            for (let i = fakeMarkerElements.length - 1; i >= 0; i--) {\n                const { name, element, collapsed } = fakeMarkerElements[i];\n                const isStartBoundary = !markersData[name];\n                if (isStartBoundary) {\n                    markersData[name] = [];\n                }\n                if (element) {\n                    // Read fake marker element position to learn where the marker should be created.\n                    const elementPosition = writer.createPositionAt(element, 'before');\n                    markersData[name].push(elementPosition);\n                    writer.remove(element);\n                }\n                else {\n                    // If the fake marker element does not exist, it means that the marker boundary was at the beginning or at the end.\n                    const rangeOnInsertion = insertion.getAffectedRange();\n                    if (!rangeOnInsertion) {\n                        // If affected range is `null` it means that nothing was in the document fragment or all content was filtered out.\n                        // Some markers that were in the filtered content may be removed (partially or totally).\n                        // Let's handle only those markers that were at the beginning or at the end of the document fragment.\n                        if (collapsed) {\n                            markersData[name].push(insertion.position);\n                        }\n                        continue;\n                    }\n                    if (collapsed) {\n                        // If the marker was collapsed at the beginning or at the end of the document fragment,\n                        // put both boundaries at the beginning or at the end of inserted range (to keep the marker collapsed).\n                        markersData[name].push(rangeOnInsertion[collapsed]);\n                    }\n                    else {\n                        markersData[name].push(isStartBoundary ? rangeOnInsertion.start : rangeOnInsertion.end);\n                    }\n                }\n            }\n            for (const [name, [start, end]] of Object.entries(markersData)) {\n                // For now, we ignore markers if they are included in the filtered-out content.\n                // In the future implementation we will improve that case to create markers that are not filtered out completely.\n                if (start && end && start.root === end.root && start.root.document && !writer.model.markers.has(name)) {\n                    writer.addMarker(name, {\n                        usingOperation: true,\n                        affectsData: true,\n                        range: new ModelRange(start, end)\n                    });\n                }\n            }\n            if (selectionLiveRange) {\n                newRange = selectionLiveRange.toRange();\n                selectionLiveRange.detach();\n            }\n        }\n        /* istanbul ignore else -- @preserve */\n        if (newRange) {\n            if (selection instanceof ModelDocumentSelection) {\n                writer.setSelection(newRange);\n            }\n            else {\n                selection.setTo(newRange);\n            }\n        }\n        else {\n            // We are not testing else because it's a safe check for unpredictable edge cases:\n            // an insertion without proper range to select.\n            //\n            // @if CK_DEBUG // console.warn( 'Cannot determine a proper selection range after insertion.' );\n        }\n        const affectedRange = insertion.getAffectedRange() || model.createRange(selection.anchor);\n        insertion.destroy();\n        return affectedRange;\n    });\n}\n/**\n * Utility class for performing content insertion.\n */\nclass Insertion {\n    /**\n     * The model in context of which the insertion should be performed.\n     */\n    model;\n    /**\n     * Batch to which operations will be added.\n     */\n    writer;\n    /**\n     * The position at which (or near which) the next node will be inserted.\n     */\n    position;\n    /**\n     * Elements with which the inserted elements can be merged.\n     *\n     * ```html\n     * <p>x^</p><p>y</p> + <p>z</p> (can merge to <p>x</p>)\n     * <p>x</p><p>^y</p> + <p>z</p> (can merge to <p>y</p>)\n     * <p>x^y</p> + <p>z</p> (can merge to <p>xy</p> which will be split during the action,\n     * \t\t\t\t\t\tso both its pieces will be added to this set)\n     * ```\n     */\n    canMergeWith;\n    /**\n     * Schema of the model.\n     */\n    schema;\n    /**\n     * The temporary ModelDocumentFragment used for grouping multiple nodes for single insert operation.\n     */\n    _documentFragment;\n    /**\n     * The current position in the temporary ModelDocumentFragment.\n     */\n    _documentFragmentPosition;\n    /**\n     * The reference to the first inserted node.\n     */\n    _firstNode = null;\n    /**\n     * The reference to the last inserted node.\n     */\n    _lastNode = null;\n    /**\n     * The reference to the last auto paragraph node.\n     */\n    _lastAutoParagraph = null;\n    /**\n     * The array of nodes that should be cleaned of not allowed attributes and sub-nodes.\n     */\n    _filterAttributesAndChildrenOf = [];\n    /**\n     * Beginning of the affected range. See {@link module:engine/model/utils/insertcontent~Insertion#getAffectedRange}.\n     */\n    _affectedStart = null;\n    /**\n     * End of the affected range. See {@link module:engine/model/utils/insertcontent~Insertion#getAffectedRange}.\n     */\n    _affectedEnd = null;\n    _nodeToSelect = null;\n    constructor(model, writer, position) {\n        this.model = model;\n        this.writer = writer;\n        this.position = position;\n        this.canMergeWith = new Set([this.position.parent]);\n        this.schema = model.schema;\n        this._documentFragment = writer.createDocumentFragment();\n        this._documentFragmentPosition = writer.createPositionAt(this._documentFragment, 0);\n    }\n    /**\n     * Handles insertion of a set of nodes.\n     *\n     * @param nodes Nodes to insert.\n     */\n    handleNodes(nodes) {\n        for (const node of Array.from(nodes)) {\n            // Ignore empty nodes, especially empty text nodes.\n            if (node.offsetSize > 0) {\n                this._handleNode(node);\n            }\n        }\n        // Insert nodes collected in temporary ModelDocumentFragment.\n        this._insertPartialFragment();\n        // If there was an auto paragraph then we might need to adjust the end of insertion.\n        if (this._lastAutoParagraph) {\n            this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph);\n        }\n        // After the content was inserted we may try to merge it with its next sibling if the selection was in it initially.\n        // Merging with the previous sibling was performed just after inserting the first node to the document.\n        this._mergeOnRight();\n        // TMP this will become a post-fixer.\n        this.schema.removeDisallowedAttributes(this._filterAttributesAndChildrenOf, this.writer);\n        if (this.model._config?.get('experimentalFlags.modelInsertContentDeepSchemaVerification')) {\n            this._removeDisallowedChildren(this._filterAttributesAndChildrenOf);\n        }\n        this._filterAttributesAndChildrenOf = [];\n    }\n    /**\n     * Removes disallowed children from nodes that were inserted or modified during insertion.\n     */\n    _removeDisallowedChildren(nodes) {\n        // Make sure we do not modify the original iterable.\n        const nodesArray = Array.from(nodes);\n        // Check all sub-nodes of top level inserted nodes.\n        // We do it at this point so node is already in the model tree and schema checks will be correct.\n        for (const node of nodesArray) {\n            if (!node.is('element')) {\n                continue;\n            }\n            const remove = [];\n            const unwrap = [];\n            const walker = this.writer.createRangeIn(node).getWalker({ ignoreElementEnd: true });\n            for (const { item } of walker) {\n                const itemParent = item.parent;\n                if (!this.schema.checkChild(itemParent, item)) {\n                    if (item.is('element') && !this.schema.isObject(item)) {\n                        // Unwrap non-object element.\n                        unwrap.push(item);\n                        // Store the parent for re-checking children after unwrap.\n                        nodesArray.push(itemParent);\n                    }\n                    else {\n                        // Remove object with children, or text.\n                        remove.push(item);\n                    }\n                    // Skip the whole subtree as it will be removed or processed later.\n                    walker.jumpTo(this.writer.createPositionAfter(item));\n                }\n            }\n            for (const item of unwrap) {\n                this.writer.unwrap(item);\n            }\n            for (const item of remove) {\n                this.writer.remove(item);\n            }\n        }\n    }\n    /**\n     * Updates the last node after the auto paragraphing.\n     *\n     * @param node The last auto paragraphing node.\n     */\n    _updateLastNodeFromAutoParagraph(node) {\n        const positionAfterLastNode = this.writer.createPositionAfter(this._lastNode);\n        const positionAfterNode = this.writer.createPositionAfter(node);\n        // If the real end was after the last auto paragraph then update relevant properties.\n        if (positionAfterNode.isAfter(positionAfterLastNode)) {\n            this._lastNode = node;\n            /* istanbul ignore if -- @preserve */\n            if (this.position.parent != node || !this.position.isAtEnd) {\n                // Algorithm's correctness check. We should never end up here but it's good to know that we did.\n                // At this point the insertion position should be at the end of the last auto paragraph.\n                // Note: This error is documented in other place in this file.\n                throw new CKEditorError('insertcontent-invalid-insertion-position', this);\n            }\n            this.position = positionAfterNode;\n            this._setAffectedBoundaries(this.position);\n        }\n    }\n    /**\n     * Returns range to be selected after insertion.\n     * Returns `null` if there is no valid range to select after insertion.\n     */\n    getSelectionRange() {\n        if (this._nodeToSelect) {\n            return ModelRange._createOn(this._nodeToSelect);\n        }\n        return this.model.schema.getNearestSelectionRange(this.position);\n    }\n    /**\n     * Returns a range which contains all the performed changes. This is a range that, if removed, would return the model to the state\n     * before the insertion. Returns `null` if no changes were done.\n     */\n    getAffectedRange() {\n        if (!this._affectedStart) {\n            return null;\n        }\n        return new ModelRange(this._affectedStart, this._affectedEnd);\n    }\n    /**\n     * Destroys `Insertion` instance.\n     */\n    destroy() {\n        if (this._affectedStart) {\n            this._affectedStart.detach();\n        }\n        if (this._affectedEnd) {\n            this._affectedEnd.detach();\n        }\n    }\n    /**\n     * Handles insertion of a single node.\n     */\n    _handleNode(node) {\n        // Split the position.parent's branch up to a point where the node can be inserted.\n        // If it isn't allowed in the whole branch, then of course don't split anything.\n        if (!this._checkAndSplitToAllowedPosition(node)) {\n            // Handle element children if it's not an object (strip container).\n            if (!this.schema.isObject(node)) {\n                this._handleDisallowedNode(node);\n            }\n            return;\n        }\n        // Add node to the current temporary ModelDocumentFragment.\n        node = this._appendToFragment(node);\n        // Store the first and last nodes for easy access for merging with sibling nodes.\n        if (!this._firstNode) {\n            this._firstNode = node;\n        }\n        this._lastNode = node;\n    }\n    /**\n     * Inserts the temporary ModelDocumentFragment into the model.\n     */\n    _insertPartialFragment() {\n        if (this._documentFragment.isEmpty) {\n            return;\n        }\n        const livePosition = ModelLivePosition.fromPosition(this.position, 'toNext');\n        this._setAffectedBoundaries(this.position);\n        // If the very first node of the whole insertion process is inserted, insert it separately for OT reasons (undo).\n        // Note: there can be multiple calls to `_insertPartialFragment()` during one insertion process.\n        // Note: only the very first node can be merged so we have to do separate operation only for it.\n        if (this._documentFragment.getChild(0) == this._firstNode) {\n            this.writer.insert(this._firstNode, this.position);\n            // We must merge the first node just after inserting it to avoid problems with OT.\n            // (See: https://github.com/ckeditor/ckeditor5/pull/8773#issuecomment-760945652).\n            this._mergeOnLeft();\n            this.position = livePosition.toPosition();\n        }\n        // Insert the remaining nodes from document fragment.\n        if (!this._documentFragment.isEmpty) {\n            this.writer.insert(this._documentFragment, this.position);\n        }\n        this._documentFragmentPosition = this.writer.createPositionAt(this._documentFragment, 0);\n        this.position = livePosition.toPosition();\n        livePosition.detach();\n    }\n    /**\n     * @param node The disallowed node which needs to be handled.\n     */\n    _handleDisallowedNode(node) {\n        // If the node is an element, try inserting its children (strip the parent).\n        if (node.is('element')) {\n            this.handleNodes(node.getChildren());\n        }\n    }\n    /**\n     * Append a node to the temporary ModelDocumentFragment.\n     *\n     * @param node The node to insert.\n     */\n    _appendToFragment(node) {\n        /* istanbul ignore if -- @preserve */\n        if (!this.schema.checkChild(this.position, node)) {\n            // Algorithm's correctness check. We should never end up here but it's good to know that we did.\n            // Note that it would often be a silent issue if we insert node in a place where it's not allowed.\n            /**\n             * Given node cannot be inserted on the given position.\n             *\n             * @error insertcontent-wrong-position\n             * @param {module:engine/model/node~ModelNode} node Node to insert.\n             * @param {module:engine/model/position~ModelPosition} position Position to insert the node at.\n             */\n            throw new CKEditorError('insertcontent-wrong-position', this, { node, position: this.position });\n        }\n        this.writer.insert(node, this._documentFragmentPosition);\n        this._documentFragmentPosition = this._documentFragmentPosition.getShiftedBy(node.offsetSize);\n        // In case text node was merged with already inserted text node, we need to get the actual node that is in the document.\n        // This happens when there is a non-allowed object between text nodes.\n        if (!node.parent) {\n            node = this._documentFragmentPosition.nodeBefore;\n        }\n        // The last inserted object should be selected because we can't put a collapsed selection after it.\n        if (this.schema.isObject(node) && !this.schema.checkChild(this.position, '$text')) {\n            this._nodeToSelect = node;\n        }\n        else {\n            this._nodeToSelect = null;\n        }\n        this._filterAttributesAndChildrenOf.push(node);\n        return node;\n    }\n    /**\n     * Sets `_affectedStart` and `_affectedEnd` to the given `position`. Should be used before a change is done during insertion process to\n     * mark the affected range.\n     *\n     * This method is used before inserting a node or splitting a parent node. `_affectedStart` and `_affectedEnd` are also changed\n     * during merging, but the logic there is more complicated so it is left out of this function.\n     */\n    _setAffectedBoundaries(position) {\n        // Set affected boundaries stickiness so that those position will \"expand\" when something is inserted in between them:\n        // <paragraph>Foo][bar</paragraph> -> <paragraph>Foo]xx[bar</paragraph>\n        // This is why it cannot be a range but two separate positions.\n        if (!this._affectedStart) {\n            this._affectedStart = ModelLivePosition.fromPosition(position, 'toPrevious');\n        }\n        // If `_affectedEnd` is before the new boundary position, expand `_affectedEnd`. This can happen if first inserted node was\n        // inserted into the parent but the next node is moved-out of that parent:\n        // (1) <paragraph>Foo][</paragraph> -> <paragraph>Foo]xx[</paragraph>\n        // (2) <paragraph>Foo]xx[</paragraph> -> <paragraph>Foo]xx</paragraph><widget></widget>[\n        if (!this._affectedEnd || this._affectedEnd.isBefore(position)) {\n            if (this._affectedEnd) {\n                this._affectedEnd.detach();\n            }\n            this._affectedEnd = ModelLivePosition.fromPosition(position, 'toNext');\n        }\n    }\n    /**\n     * Merges the previous sibling of the first node if it should be merged.\n     *\n     * After the content was inserted we may try to merge it with its siblings.\n     * This should happen only if the selection was in those elements initially.\n     */\n    _mergeOnLeft() {\n        const node = this._firstNode;\n        if (!(node instanceof ModelElement)) {\n            return;\n        }\n        if (!this._canMergeLeft(node)) {\n            return;\n        }\n        const mergePosLeft = ModelLivePosition._createBefore(node);\n        mergePosLeft.stickiness = 'toNext';\n        const livePosition = ModelLivePosition.fromPosition(this.position, 'toNext');\n        // If `_affectedStart` is sames as merge position, it means that the element \"marked\" by `_affectedStart` is going to be\n        // removed and its contents will be moved. This won't transform `ModelLivePosition` so `_affectedStart` needs to be moved\n        // by hand to properly reflect affected range. (Due to `_affectedStart` and `_affectedEnd` stickiness, the \"range\" is\n        // shown as `][`).\n        //\n        // Example - insert `<paragraph>Abc</paragraph><paragraph>Xyz</paragraph>` at the end of `<paragraph>Foo^</paragraph>`:\n        //\n        // <paragraph>Foo</paragraph><paragraph>Bar</paragraph>   -->\n        // <paragraph>Foo</paragraph>]<paragraph>Abc</paragraph><paragraph>Xyz</paragraph>[<paragraph>Bar</paragraph>   -->\n        // <paragraph>Foo]Abc</paragraph><paragraph>Xyz</paragraph>[<paragraph>Bar</paragraph>\n        //\n        // Note, that if we are here then something must have been inserted, so `_affectedStart` and `_affectedEnd` have to be set.\n        if (this._affectedStart.isEqual(mergePosLeft)) {\n            this._affectedStart.detach();\n            this._affectedStart = ModelLivePosition._createAt(mergePosLeft.nodeBefore, 'end', 'toPrevious');\n        }\n        // We need to update the references to the first and last nodes if they will be merged into the previous sibling node\n        // because the reference would point to the removed node.\n        //\n        // <p>A^A</p> + <p>X</p>\n        //\n        // <p>A</p>^<p>A</p>\n        // <p>A</p><p>X</p><p>A</p>\n        // <p>AX</p><p>A</p>\n        // <p>AXA</p>\n        if (this._firstNode === this._lastNode) {\n            this._firstNode = mergePosLeft.nodeBefore;\n            this._lastNode = mergePosLeft.nodeBefore;\n        }\n        this.writer.merge(mergePosLeft);\n        // If only one element (the merged one) is in the \"affected range\", also move the affected range end appropriately.\n        //\n        // Example - insert `<paragraph>Abc</paragraph>` at the of `<paragraph>Foo^</paragraph>`:\n        //\n        // <paragraph>Foo</paragraph><paragraph>Bar</paragraph>   -->\n        // <paragraph>Foo</paragraph>]<paragraph>Abc</paragraph>[<paragraph>Bar</paragraph>   -->\n        // <paragraph>Foo]Abc</paragraph>[<paragraph>Bar</paragraph>   -->\n        // <paragraph>Foo]Abc[</paragraph><paragraph>Bar</paragraph>\n        if (mergePosLeft.isEqual(this._affectedEnd) && this._firstNode === this._lastNode) {\n            this._affectedEnd.detach();\n            this._affectedEnd = ModelLivePosition._createAt(mergePosLeft.nodeBefore, 'end', 'toNext');\n        }\n        this.position = livePosition.toPosition();\n        livePosition.detach();\n        // After merge elements that were marked by _insert() to be filtered might be gone so\n        // we need to mark the new container.\n        this._filterAttributesAndChildrenOf.push(this.position.parent);\n        mergePosLeft.detach();\n    }\n    /**\n     * Merges the next sibling of the last node if it should be merged.\n     *\n     * After the content was inserted we may try to merge it with its siblings.\n     * This should happen only if the selection was in those elements initially.\n     */\n    _mergeOnRight() {\n        const node = this._lastNode;\n        if (!(node instanceof ModelElement)) {\n            return;\n        }\n        if (!this._canMergeRight(node)) {\n            return;\n        }\n        const mergePosRight = ModelLivePosition._createAfter(node);\n        mergePosRight.stickiness = 'toNext';\n        /* istanbul ignore if -- @preserve */\n        if (!this.position.isEqual(mergePosRight)) {\n            // Algorithm's correctness check. We should never end up here but it's good to know that we did.\n            // At this point the insertion position should be after the node we'll merge. If it isn't,\n            // it should need to be secured as in the left merge case.\n            /**\n             * An internal error occurred when merging inserted content with its siblings.\n             * The insertion position should equal the merge position.\n             *\n             * If you encountered this error, report it back to the CKEditor 5 team\n             * with as many details as possible regarding the content being inserted and the insertion position.\n             *\n             * @error insertcontent-invalid-insertion-position\n             */\n            throw new CKEditorError('insertcontent-invalid-insertion-position', this);\n        }\n        // Move the position to the previous node, so it isn't moved to the graveyard on merge.\n        // <p>x</p>[]<p>y</p> => <p>x[]</p><p>y</p>\n        this.position = ModelPosition._createAt(mergePosRight.nodeBefore, 'end');\n        // Explanation of setting position stickiness to `'toPrevious'`:\n        // OK:  <p>xx[]</p> + <p>yy</p> => <p>xx[]yy</p> (when sticks to previous)\n        // NOK: <p>xx[]</p> + <p>yy</p> => <p>xxyy[]</p> (when sticks to next)\n        const livePosition = ModelLivePosition.fromPosition(this.position, 'toPrevious');\n        // See comment in `_mergeOnLeft()` on moving `_affectedStart`.\n        if (this._affectedEnd.isEqual(mergePosRight)) {\n            this._affectedEnd.detach();\n            this._affectedEnd = ModelLivePosition._createAt(mergePosRight.nodeBefore, 'end', 'toNext');\n        }\n        // We need to update the references to the first and last nodes if they will be merged into the previous sibling node\n        // because the reference would point to the removed node.\n        //\n        // <p>A^A</p> + <p>X</p>\n        //\n        // <p>A</p>^<p>A</p>\n        // <p>A</p><p>X</p><p>A</p>\n        // <p>AX</p><p>A</p>\n        // <p>AXA</p>\n        if (this._firstNode === this._lastNode) {\n            this._firstNode = mergePosRight.nodeBefore;\n            this._lastNode = mergePosRight.nodeBefore;\n        }\n        this.writer.merge(mergePosRight);\n        // See comment in `_mergeOnLeft()` on moving `_affectedStart`.\n        if (mergePosRight.getShiftedBy(-1).isEqual(this._affectedStart) && this._firstNode === this._lastNode) {\n            this._affectedStart.detach();\n            this._affectedStart = ModelLivePosition._createAt(mergePosRight.nodeBefore, 0, 'toPrevious');\n        }\n        this.position = livePosition.toPosition();\n        livePosition.detach();\n        // After merge elements that were marked by _insert() to be filtered might be gone so\n        // we need to mark the new container.\n        this._filterAttributesAndChildrenOf.push(this.position.parent);\n        mergePosRight.detach();\n    }\n    /**\n     * Checks whether specified node can be merged with previous sibling element.\n     *\n     * @param node The node which could potentially be merged.\n     */\n    _canMergeLeft(node) {\n        const previousSibling = node.previousSibling;\n        return (previousSibling instanceof ModelElement) &&\n            this.canMergeWith.has(previousSibling) &&\n            this.model.schema.checkMerge(previousSibling, node);\n    }\n    /**\n     * Checks whether specified node can be merged with next sibling element.\n     *\n     * @param node The node which could potentially be merged.\n     */\n    _canMergeRight(node) {\n        const nextSibling = node.nextSibling;\n        return (nextSibling instanceof ModelElement) &&\n            this.canMergeWith.has(nextSibling) &&\n            this.model.schema.checkMerge(node, nextSibling);\n    }\n    /**\n     * Inserts a paragraph and moves the insertion position into it.\n     */\n    _insertAutoParagraph() {\n        // Insert nodes collected in temporary ModelDocumentFragment if the position parent needs change to process further nodes.\n        this._insertPartialFragment();\n        // Insert a paragraph and move insertion position to it.\n        const paragraph = this.writer.createElement('paragraph');\n        this.writer.insert(paragraph, this.position);\n        this._setAffectedBoundaries(this.position);\n        this._lastAutoParagraph = paragraph;\n        this.position = this.writer.createPositionAt(paragraph, 0);\n    }\n    /**\n     * @returns Whether an allowed position was found.\n     * `false` is returned if the node isn't allowed at any position up in the tree, `true` if was.\n     */\n    _checkAndSplitToAllowedPosition(node) {\n        const allowedIn = this._getAllowedIn(this.position.parent, node);\n        if (!allowedIn) {\n            return false;\n        }\n        // Insert nodes collected in temporary ModelDocumentFragment if the position parent needs change to process further nodes.\n        if (allowedIn != this.position.parent) {\n            this._insertPartialFragment();\n        }\n        while (allowedIn != this.position.parent) {\n            if (this.position.isAtStart) {\n                // If insertion position is at the beginning of the parent, move it out instead of splitting.\n                // <p>^Foo</p> -> ^<p>Foo</p>\n                const parent = this.position.parent;\n                this.position = this.writer.createPositionBefore(parent);\n                // Special case – parent is empty (<p>^</p>).\n                //\n                // 1. parent.isEmpty\n                // We can remove the element after moving insertion position out of it.\n                //\n                // 2. parent.parent === allowedIn\n                // However parent should remain in place when allowed element is above limit element in document tree.\n                // For example there shouldn't be allowed to remove empty paragraph from tableCell, when is pasted\n                // content allowed in $root.\n                if (parent.isEmpty && parent.parent === allowedIn) {\n                    this.writer.remove(parent);\n                }\n            }\n            else if (this.position.isAtEnd) {\n                // If insertion position is at the end of the parent, move it out instead of splitting.\n                // <p>Foo^</p> -> <p>Foo</p>^\n                this.position = this.writer.createPositionAfter(this.position.parent);\n            }\n            else {\n                const tempPos = this.writer.createPositionAfter(this.position.parent);\n                this._setAffectedBoundaries(this.position);\n                this.writer.split(this.position);\n                this.position = tempPos;\n                this.canMergeWith.add(this.position.nodeAfter);\n            }\n        }\n        // At this point, we split elements up to the parent in which `node` is allowed.\n        // Note that `_getAllowedIn()` checks if the `node` is allowed either directly, or when auto-paragraphed.\n        // So, let's check if the `node` is allowed directly. If not, we need to auto-paragraph it.\n        if (!this.schema.checkChild(this.position.parent, node)) {\n            this._insertAutoParagraph();\n        }\n        return true;\n    }\n    /**\n     * Gets the element in which the given node is allowed. It checks the passed element and all its ancestors.\n     *\n     * It also verifies if auto-paragraphing could help.\n     *\n     * @param contextElement The element in which context the node should be checked.\n     * @param childNode The node to check.\n     */\n    _getAllowedIn(contextElement, childNode) {\n        const context = this.schema.createContext(contextElement);\n        // Check if a node can be inserted in the given context...\n        if (this.schema.checkChild(context, childNode)) {\n            return contextElement;\n        }\n        // ...or it would be accepted if a paragraph would be inserted.\n        if (this.schema.checkChild(context, 'paragraph') &&\n            this.schema.checkChild(context.push('paragraph'), childNode)) {\n            return contextElement;\n        }\n        // If the child wasn't allowed in the context element and the element is a limit there's no point in\n        // checking any further towards the root. This is it: the limit is unsplittable and there's nothing\n        // we can do about it. Without this check, the algorithm will analyze parent of the limit and may create\n        // an illusion of the child being allowed. There's no way to insert it down there, though. It results in\n        // infinite loops.\n        if (this.schema.isLimit(contextElement)) {\n            return null;\n        }\n        return this._getAllowedIn(contextElement.parent, childNode);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/utils/modifyselection\n */\nimport { ModelDocumentSelection } from '../documentselection.js';\nimport { ModelPosition } from '../position.js';\nimport { ModelRange } from '../range.js';\nimport { ModelTreeWalker } from '../treewalker.js';\nimport { isInsideSurrogatePair, isInsideCombinedSymbol, isInsideEmojiSequence } from '@ckeditor/ckeditor5-utils';\nconst wordBoundaryCharacters = ' ,.?!:;\"-()';\n/**\n * Modifies the selection. Currently, the supported modifications are:\n *\n * * Extending. The selection focus is moved in the specified `options.direction` with a step specified in `options.unit`.\n * Possible values for `unit` are:\n *  * `'character'` (default) - moves selection by one user-perceived character. In most cases this means moving by one\n *  character in `String` sense. However, unicode also defines \"combing marks\". These are special symbols, that combines\n *  with a symbol before it (\"base character\") to create one user-perceived character. For example, `q̣̇` is a normal\n *  letter `q` with two \"combining marks\": upper dot (`Ux0307`) and lower dot (`Ux0323`). For most actions, i.e. extending\n *  selection by one position, it is correct to include both \"base character\" and all of it's \"combining marks\". That is\n *  why `'character'` value is most natural and common method of modifying selection.\n *  * `'codePoint'` - moves selection by one unicode code point. In contrary to, `'character'` unit, this will insert\n *  selection between \"base character\" and \"combining mark\", because \"combining marks\" have their own unicode code points.\n *  However, for technical reasons, unicode code points with values above `UxFFFF` are represented in native `String` by\n *  two characters, called \"surrogate pairs\". Halves of \"surrogate pairs\" have a meaning only when placed next to each other.\n *  For example `𨭎` is represented in `String` by `\\uD862\\uDF4E`. Both `\\uD862` and `\\uDF4E` do not have any meaning\n *  outside the pair (are rendered as ? when alone). Position between them would be incorrect. In this case, selection\n *  extension will include whole \"surrogate pair\".\n *  * `'word'` - moves selection by a whole word.\n *\n * **Note:** if you extend a forward selection in a backward direction you will in fact shrink it.\n *\n * **Note:** Use {@link module:engine/model/model~Model#modifySelection} instead of this function.\n * This function is only exposed to be reusable in algorithms\n * which change the {@link module:engine/model/model~Model#modifySelection}\n * method's behavior.\n *\n * @param model The model in context of which the selection modification should be performed.\n * @param selection The selection to modify.\n * @param options.direction The direction in which the selection should be modified. Default 'forward'.\n * @param options.unit The unit by which selection should be modified. Default 'character'.\n * @param options.treatEmojiAsSingleUnit Whether multi-characer emoji sequences should be handled as single unit.\n * @internal\n */\nexport function modifySelection(model, selection, options = {}) {\n    const schema = model.schema;\n    const isForward = options.direction != 'backward';\n    const unit = options.unit ? options.unit : 'character';\n    const treatEmojiAsSingleUnit = !!options.treatEmojiAsSingleUnit;\n    const focus = selection.focus;\n    const walker = new ModelTreeWalker({\n        boundaries: getSearchRange(focus, isForward),\n        singleCharacters: true,\n        direction: isForward ? 'forward' : 'backward'\n    });\n    const data = { walker, schema, isForward, unit, treatEmojiAsSingleUnit };\n    let next;\n    while ((next = walker.next())) {\n        if (next.done) {\n            return;\n        }\n        const position = tryExtendingTo(data, next.value);\n        if (position) {\n            if (selection instanceof ModelDocumentSelection) {\n                model.change(writer => {\n                    writer.setSelectionFocus(position);\n                });\n            }\n            else {\n                selection.setFocus(position);\n            }\n            return;\n        }\n    }\n}\n/**\n * Checks whether the selection can be extended to the the walker's next value (next position).\n */\nfunction tryExtendingTo(data, value) {\n    const { isForward, walker, unit, schema, treatEmojiAsSingleUnit } = data;\n    const { type, item, nextPosition } = value;\n    // If found text, we can certainly put the focus in it. Let's just find a correct position\n    // based on the unit.\n    if (type == 'text') {\n        if (data.unit === 'word') {\n            return getCorrectWordBreakPosition(walker, isForward);\n        }\n        return getCorrectPosition(walker, unit, treatEmojiAsSingleUnit);\n    }\n    // Entering an element.\n    if (type == (isForward ? 'elementStart' : 'elementEnd')) {\n        // If it's a selectable, we can select it now.\n        if (schema.isSelectable(item)) {\n            return ModelPosition._createAt(item, isForward ? 'after' : 'before');\n        }\n        // If text allowed on this position, extend to this place.\n        if (schema.checkChild(nextPosition, '$text')) {\n            return nextPosition;\n        }\n    }\n    // Leaving an element.\n    else {\n        // If leaving a limit element, stop.\n        if (schema.isLimit(item)) {\n            // NOTE: Fast-forward the walker until the end.\n            walker.skip(() => true);\n            return;\n        }\n        // If text allowed on this position, extend to this place.\n        if (schema.checkChild(nextPosition, '$text')) {\n            return nextPosition;\n        }\n    }\n}\n/**\n * Finds a correct position by walking in a text node and checking whether selection can be extended to given position\n * or should be extended further.\n */\nfunction getCorrectPosition(walker, unit, treatEmojiAsSingleUnit) {\n    const textNode = walker.position.textNode;\n    if (textNode) {\n        const data = textNode.data;\n        let offset = walker.position.offset - textNode.startOffset;\n        while (isInsideSurrogatePair(data, offset) ||\n            (unit == 'character' && isInsideCombinedSymbol(data, offset)) ||\n            (treatEmojiAsSingleUnit && isInsideEmojiSequence(data, offset))) {\n            walker.next();\n            offset = walker.position.offset - textNode.startOffset;\n        }\n    }\n    return walker.position;\n}\n/**\n * Finds a correct position of a word break by walking in a text node and checking whether selection can be extended to given position\n * or should be extended further.\n */\nfunction getCorrectWordBreakPosition(walker, isForward) {\n    let textNode = walker.position.textNode;\n    if (!textNode) {\n        textNode = isForward ? walker.position.nodeAfter : walker.position.nodeBefore;\n    }\n    while (textNode && textNode.is('$text')) {\n        const offset = walker.position.offset - textNode.startOffset;\n        // Check of adjacent text nodes with different attributes (like BOLD).\n        // Example          : 'foofoo []bar<$text bold=\"true\">bar</$text> bazbaz'\n        // should expand to : 'foofoo [bar<$text bold=\"true\">bar</$text>] bazbaz'.\n        if (isAtNodeBoundary(textNode, offset, isForward)) {\n            textNode = isForward ? walker.position.nodeAfter : walker.position.nodeBefore;\n        }\n        // Check if this is a word boundary.\n        else if (isAtWordBoundary(textNode.data, offset, isForward)) {\n            break;\n        }\n        // Maybe one more character.\n        else {\n            walker.next();\n        }\n    }\n    return walker.position;\n}\nfunction getSearchRange(start, isForward) {\n    const root = start.root;\n    const searchEnd = ModelPosition._createAt(root, isForward ? 'end' : 0);\n    if (isForward) {\n        return new ModelRange(start, searchEnd);\n    }\n    else {\n        return new ModelRange(searchEnd, start);\n    }\n}\n/**\n * Checks if selection is on word boundary.\n */\nfunction isAtWordBoundary(data, offset, isForward) {\n    // The offset to check depends on direction.\n    const offsetToCheck = offset + (isForward ? 0 : -1);\n    return wordBoundaryCharacters.includes(data.charAt(offsetToCheck));\n}\n/**\n * Checks if selection is on node boundary.\n */\nfunction isAtNodeBoundary(textNode, offset, isForward) {\n    return offset === (isForward ? textNode.offsetSize : 0);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/model/model\n */\nimport { Batch } from './batch.js';\nimport { ModelDocument } from './document.js';\nimport { MarkerCollection } from './markercollection.js';\nimport { ModelPosition } from './position.js';\nimport { ModelRange } from './range.js';\nimport { ModelSelection } from './selection.js';\nimport { OperationFactory } from './operation/operationfactory.js';\nimport { ModelDocumentSelection } from './documentselection.js';\nimport { ModelSchema } from './schema.js';\nimport { ModelWriter } from './writer.js';\nimport { ModelNode } from './node.js';\nimport { autoParagraphEmptyRoots } from './utils/autoparagraphing.js';\nimport { injectSelectionPostFixer } from './utils/selection-post-fixer.js';\nimport { deleteContent } from './utils/deletecontent.js';\nimport { getSelectedContent } from './utils/getselectedcontent.js';\nimport { insertContent } from './utils/insertcontent.js';\nimport { insertObject } from './utils/insertobject.js';\nimport { modifySelection } from './utils/modifyselection.js';\nimport { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );\n// @if CK_DEBUG_ENGINE // const { OperationReplayer } = require( '../dev-utils/operationreplayer' ).default;\n/**\n * Editor's data model. Read about the model in the\n * {@glink framework/architecture/editing-engine engine architecture} guide.\n */\nexport class Model extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Model's marker collection.\n     */\n    markers;\n    /**\n     * Model's document.\n     */\n    document;\n    /**\n     * Model's schema.\n     */\n    schema;\n    /**\n     * Stores all configurations specific to editor instance.\n     *\n     * @internal\n     */\n    _config;\n    /**\n     * All callbacks added by {@link module:engine/model/model~Model#change} or\n     * {@link module:engine/model/model~Model#enqueueChange} methods waiting to be executed.\n     */\n    _pendingChanges;\n    /**\n     * The last created and currently used writer instance.\n     */\n    _currentWriter;\n    // @if CK_DEBUG_ENGINE // private _operationLogs: Array<string>;\n    // @if CK_DEBUG_ENGINE // private _appliedOperations: Array<Operation>;\n    constructor(config) {\n        super();\n        this.markers = new MarkerCollection();\n        this.document = new ModelDocument(this);\n        this.schema = new ModelSchema();\n        this._config = config;\n        this._pendingChanges = [];\n        this._currentWriter = null;\n        ['deleteContent', 'modifySelection', 'getSelectedContent', 'applyOperation']\n            .forEach(methodName => this.decorate(methodName));\n        // Adding operation validation with `highest` priority, so it is called before any other feature would like\n        // to do anything with the operation. If the operation has incorrect parameters it should throw on the earliest occasion.\n        this.on('applyOperation', (evt, args) => {\n            const operation = args[0];\n            operation._validate();\n        }, { priority: 'highest' });\n        // Register some default abstract entities.\n        this.schema.register('$root', {\n            isLimit: true\n        });\n        this.schema.register('$container', {\n            allowIn: ['$root', '$container']\n        });\n        this.schema.register('$block', {\n            allowIn: ['$root', '$container'],\n            isBlock: true\n        });\n        this.schema.register('$blockObject', {\n            allowWhere: '$block',\n            isBlock: true,\n            isObject: true\n        });\n        this.schema.register('$inlineObject', {\n            allowWhere: '$text',\n            allowAttributesOf: '$text',\n            isInline: true,\n            isObject: true\n        });\n        this.schema.register('$text', {\n            allowIn: '$block',\n            isInline: true,\n            isContent: true\n        });\n        this.schema.register('$clipboardHolder', {\n            allowContentOf: '$root',\n            allowChildren: '$text',\n            isLimit: true\n        });\n        this.schema.register('$documentFragment', {\n            allowContentOf: '$root',\n            allowChildren: '$text',\n            isLimit: true\n        });\n        // An element needed by the `upcastElementToMarker` converter.\n        // This element temporarily represents a marker boundary during the conversion process and is removed\n        // at the end of the conversion. `UpcastDispatcher` or at least `Conversion` class looks like a\n        // better place for this registration but both know nothing about `Schema`.\n        this.schema.register('$marker');\n        this.schema.addChildCheck(() => true, '$marker'); // Allow everywhere.\n        injectSelectionPostFixer(this);\n        // Post-fixer which takes care of adding empty paragraph elements to the empty roots.\n        this.document.registerPostFixer(autoParagraphEmptyRoots);\n        // The base implementation for \"decorated\" method with remapped arguments.\n        this.on('insertContent', (evt, [content, selectable]) => {\n            evt.return = insertContent(this, content, selectable);\n        });\n        // The base implementation for \"decorated\" method with remapped arguments.\n        this.on('insertObject', (evt, [element, selection, options]) => {\n            evt.return = insertObject(this, element, selection, options);\n        });\n        // The base implementation for \"decorated\" method with remapped arguments.\n        this.on('canEditAt', evt => {\n            const canEditAt = !this.document.isReadOnly;\n            evt.return = canEditAt;\n            if (!canEditAt) {\n                // Prevent further processing if the selection is at non-editable place.\n                evt.stop();\n            }\n        });\n        // @if CK_DEBUG_ENGINE // initDocumentDumping( this.document );\n        // @if CK_DEBUG_ENGINE // this.on( 'applyOperation', () => {\n        // @if CK_DEBUG_ENGINE // \tdumpTrees( this.document, this.document.version );\n        // @if CK_DEBUG_ENGINE // }, { priority: 'lowest' } );\n        // @if CK_DEBUG_ENGINE // this._operationLogs = [];\n        // @if CK_DEBUG_ENGINE // this._appliedOperations = [];\n    }\n    /**\n     * The `change()` method is the primary way of changing the model. You should use it to modify all document nodes\n     * (including detached nodes – i.e. nodes not added to the {@link module:engine/model/model~Model#document model document}),\n     * the {@link module:engine/model/document~ModelDocument#selection document's selection}, and\n     * {@link module:engine/model/model~Model#markers model markers}.\n     *\n     * ```ts\n     * model.change( writer => {\n     * \twriter.insertText( 'foo', paragraph, 'end' );\n     * } );\n     * ```\n     *\n     * All changes inside the change block use the same {@link module:engine/model/batch~Batch} so they are combined\n     * into a single undo step.\n     *\n     * ```ts\n     * model.change( writer => {\n     * \twriter.insertText( 'foo', paragraph, 'end' ); // foo.\n     *\n     * \tmodel.change( writer => {\n     * \t\twriter.insertText( 'bar', paragraph, 'end' ); // foobar.\n     * \t} );\n     *\n     * \twriter.insertText( 'bom', paragraph, 'end' ); // foobarbom.\n     * } );\n     * ```\n     *\n     * The callback of the `change()` block is executed synchronously.\n     *\n     * You can also return a value from the change block.\n     *\n     * ```ts\n     * const img = model.change( writer => {\n     * \treturn writer.createElement( 'img' );\n     * } );\n     * ```\n     *\n     * @see #enqueueChange\n     * @typeParam TReturn The return type of the provided callback.\n     * @param callback Callback function which may modify the model.\n     */\n    change(callback) {\n        try {\n            if (this._pendingChanges.length === 0) {\n                // If this is the outermost block, create a new batch and start `_runPendingChanges` execution flow.\n                this._pendingChanges.push({ batch: new Batch(), callback });\n                return this._runPendingChanges()[0];\n            }\n            else {\n                // If this is not the outermost block, just execute the callback.\n                return callback(this._currentWriter);\n            }\n        }\n        catch (err) {\n            // @if CK_DEBUG // throw err;\n            /* istanbul ignore next -- @preserve */\n            CKEditorError.rethrowUnexpectedError(err, this);\n        }\n    }\n    enqueueChange(batchOrType, callback) {\n        try {\n            if (!batchOrType) {\n                batchOrType = new Batch();\n            }\n            else if (typeof batchOrType === 'function') {\n                callback = batchOrType;\n                batchOrType = new Batch();\n            }\n            else if (!(batchOrType instanceof Batch)) {\n                batchOrType = new Batch(batchOrType);\n            }\n            this._pendingChanges.push({ batch: batchOrType, callback });\n            if (this._pendingChanges.length == 1) {\n                this._runPendingChanges();\n            }\n        }\n        catch (err) {\n            // @if CK_DEBUG // throw err;\n            /* istanbul ignore next -- @preserve */\n            CKEditorError.rethrowUnexpectedError(err, this);\n        }\n    }\n    /**\n     * {@link module:utils/observablemixin~Observable#decorate Decorated} function for applying\n     * {@link module:engine/model/operation/operation~Operation operations} to the model.\n     *\n     * This is a low-level way of changing the model. It is exposed for very specific use cases (like the undo feature).\n     * Normally, to modify the model, you will want to use {@link module:engine/model/writer~ModelWriter `Writer`}.\n     * See also {@glink framework/architecture/editing-engine#changing-the-model Changing the model} section\n     * of the {@glink framework/architecture/editing-engine Editing architecture} guide.\n     *\n     * @param operation The operation to apply.\n     */\n    applyOperation(operation) {\n        // @if CK_DEBUG_ENGINE // console.log( 'Applying ' + operation );\n        // @if CK_DEBUG_ENGINE // this._operationLogs.push( JSON.stringify( operation ) );\n        // @if CK_DEBUG_ENGINE // this._appliedOperations.push( operation );\n        operation._execute();\n    }\n    // @if CK_DEBUG_ENGINE // public getAppliedOperation(): string {\n    // @if CK_DEBUG_ENGINE // \tif ( !this._appliedOperations ) {\n    // @if CK_DEBUG_ENGINE // \t\treturn '';\n    // @if CK_DEBUG_ENGINE // \t}\n    // @if CK_DEBUG_ENGINE // \treturn this._appliedOperations.map( operation => JSON.stringify( operation ) ).join( '-------' );\n    // @if CK_DEBUG_ENGINE // }\n    // @if CK_DEBUG_ENGINE // public createReplayer( stringifiedOperations: string ): typeof OperationReplayer {\n    // @if CK_DEBUG_ENGINE // \treturn new OperationReplayer( this, '-------', stringifiedOperations );\n    // @if CK_DEBUG_ENGINE // }\n    /**\n     * Inserts content at the position in the editor specified by the selection, as one would expect the paste\n     * functionality to work.\n     *\n     * **Note**: If you want to insert an {@glink framework/deep-dive/schema#object-elements object element}\n     * (e.g. a {@link module:widget/utils~toWidget widget}), see {@link #insertObject} instead.\n     *\n     * This is a high-level method. It takes the {@link #schema schema} into consideration when inserting\n     * the content, clears the given selection's content before inserting nodes and moves the selection\n     * to its target position at the end of the process.\n     * It can split elements, merge them, wrap bare text nodes with paragraphs, etc. &ndash; just like the\n     * pasting feature should do.\n     *\n     * For lower-level methods see {@link module:engine/model/writer~ModelWriter `Writer`}.\n     *\n     * This method, unlike {@link module:engine/model/writer~ModelWriter `Writer`}'s methods, does not have to be used\n     * inside a {@link #change `change()` block}.\n     *\n     * # Conversion and schema\n     *\n     * Inserting elements and text nodes into the model is not enough to make CKEditor 5 render that content\n     * to the user. CKEditor 5 implements a model-view-controller architecture and what `model.insertContent()` does\n     * is only adding nodes to the model. Additionally, you need to define\n     * {@glink framework/architecture/editing-engine#conversion converters} between the model and view\n     * and define those nodes in the {@glink framework/architecture/editing-engine#schema schema}.\n     *\n     * So, while this method may seem similar to CKEditor 4 `editor.insertHtml()` (in fact, both methods\n     * are used for paste-like content insertion), the CKEditor 5 method cannot be use to insert arbitrary HTML\n     * unless converters are defined for all elements and attributes in that HTML.\n     *\n     * # Examples\n     *\n     * Using `insertContent()` with a manually created model structure:\n     *\n     * ```ts\n     * // Let's create a document fragment containing such content as:\n     * //\n     * // <paragraph>foo</paragraph>\n     * // <blockQuote>\n     * //    <paragraph>bar</paragraph>\n     * // </blockQuote>\n     * const docFrag = editor.model.change( writer => {\n     * \tconst p1 = writer.createElement( 'paragraph' );\n     * \tconst p2 = writer.createElement( 'paragraph' );\n     * \tconst blockQuote = writer.createElement( 'blockQuote' );\n     * \tconst docFrag = writer.createDocumentFragment();\n     *\n     * \twriter.append( p1, docFrag );\n     * \twriter.append( blockQuote, docFrag );\n     * \twriter.append( p2, blockQuote );\n     * \twriter.insertText( 'foo', p1 );\n     * \twriter.insertText( 'bar', p2 );\n     *\n     * \treturn docFrag;\n     * } );\n     *\n     * // insertContent() does not have to be used in a change() block. It can, though,\n     * // so this code could be moved to the callback defined above.\n     * editor.model.insertContent( docFrag );\n     * ```\n     *\n     * Using `insertContent()` with an HTML string converted to a model document fragment (similar to the pasting mechanism):\n     *\n     * ```ts\n     * // You can create your own HtmlDataProcessor instance or use editor.data.processor\n     * // if you have not overridden the default one (which is the HtmlDataProcessor instance).\n     * const htmlDP = new HtmlDataProcessor( viewDocument );\n     *\n     * // Convert an HTML string to a view document fragment:\n     * const viewFragment = htmlDP.toView( htmlString );\n     *\n     * // Convert the view document fragment to a model document fragment\n     * // in the context of $root. This conversion takes the schema into\n     * // account so if, for example, the view document fragment contained a bare text node,\n     * // this text node cannot be a child of $root, so it will be automatically\n     * // wrapped with a <paragraph>. You can define the context yourself (in the second parameter),\n     * // and e.g. convert the content like it would happen in a <paragraph>.\n     * // Note: The clipboard feature uses a custom context called $clipboardHolder\n     * // which has a loosened schema.\n     * const modelFragment = editor.data.toModel( viewFragment );\n     *\n     * editor.model.insertContent( modelFragment );\n     * ```\n     *\n     * By default this method will use the document selection but it can also be used with a position, range or selection instance.\n     *\n     * ```ts\n     * // Insert text at the current document selection position.\n     * editor.model.change( writer => {\n     * \teditor.model.insertContent( writer.createText( 'x' ) );\n     * } );\n     *\n     * // Insert text at a given position - the document selection will not be modified.\n     * editor.model.change( writer => {\n     * \teditor.model.insertContent( writer.createText( 'x' ), doc.getRoot(), 2 );\n     *\n     * \t// Which is a shorthand for:\n     * \teditor.model.insertContent( writer.createText( 'x' ), writer.createPositionAt( doc.getRoot(), 2 ) );\n     * } );\n     * ```\n     *\n     * If you want the document selection to be moved to the inserted content, use the\n     * {@link module:engine/model/writer~ModelWriter#setSelection `setSelection()`} method of the writer after inserting\n     * the content:\n     *\n     * ```ts\n     * editor.model.change( writer => {\n     * \tconst paragraph = writer.createElement( 'paragraph' );\n     *\n     * \t// Insert an empty paragraph at the beginning of the root.\n     * \teditor.model.insertContent( paragraph, writer.createPositionAt( editor.model.document.getRoot(), 0 ) );\n     *\n     * \t// Move the document selection to the inserted paragraph.\n     * \twriter.setSelection( paragraph, 'in' );\n     * } );\n     * ```\n     *\n     * If an instance of the {@link module:engine/model/selection~ModelSelection model selection} is passed as `selectable`,\n     * the new content will be inserted at the passed selection (instead of document selection):\n     *\n     * ```ts\n     * editor.model.change( writer => {\n     * \t// Create a selection in a paragraph that will be used as a place of insertion.\n     * \tconst selection = writer.createSelection( paragraph, 'in' );\n     *\n     * \t// Insert the new text at the created selection.\n     * \teditor.model.insertContent( writer.createText( 'x' ), selection );\n     *\n     * \t// insertContent() modifies the passed selection instance so it can be used to set the document selection.\n     * \t// Note: This is not necessary when you passed the document selection to insertContent().\n     * \twriter.setSelection( selection );\n     * } );\n     * ```\n     *\n     * @fires insertContent\n     * @param content The content to insert.\n     * @param selectable The selection into which the content should be inserted.\n     * If not provided the current model document selection will be used.\n     * @param placeOrOffset To be used when a model item was passed as `selectable`.\n     * This param defines a position in relation to that item.\n     * at the insertion position.\n     */\n    insertContent(content, selectable, placeOrOffset, ...rest) {\n        const selection = normalizeSelectable(selectable, placeOrOffset);\n        // Passing all call arguments so it acts like decorated method.\n        return this.fire('insertContent', [content, selection, placeOrOffset, ...rest]);\n    }\n    /**\n     * Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.\n     *\n     * This is a high-level API:\n     * * It takes the {@link #schema schema} into consideration,\n     * * It clears the content of passed `selectable` before inserting,\n     * * It can move the selection at the end of the process,\n     * * It will copy the selected block's attributes to preserve them upon insertion,\n     * * It can split elements or wrap inline objects with paragraphs if they are not allowed in target position,\n     * * etc.\n     *\n     * # Notes\n     *\n     * * If you want to insert a non-object content, see {@link #insertContent} instead.\n     * * For lower-level API, see {@link module:engine/model/writer~ModelWriter `Writer`}.\n     * * Unlike {@link module:engine/model/writer~ModelWriter `Writer`}, this method does not have to be used inside\n     * a {@link #change `change()` block}.\n     * * Inserting object into the model is not enough to make CKEditor 5 render that content to the user.\n     * CKEditor 5 implements a model-view-controller architecture and what `model.insertObject()` does\n     * is only adding nodes to the model. Additionally, you need to define\n     * {@glink framework/architecture/editing-engine#conversion converters} between the model and view\n     * and define those nodes in the {@glink framework/architecture/editing-engine#schema schema}.\n     *\n     * # Examples\n     *\n     * Use the following code to insert an object at the current selection and keep the selection on the inserted element:\n     *\n     * ```ts\n     * const rawHtmlEmbedElement = writer.createElement( 'rawHtml' );\n     *\n     * model.insertObject( rawHtmlEmbedElement, null, null, {\n     * \tsetSelection: 'on'\n     * } );\n     * ```\n     *\n     * Use the following code to insert an object at the current selection and nudge the selection after the inserted object:\n     *\n     * ```ts\n     * const pageBreakElement = writer.createElement( 'pageBreak' );\n     *\n     * model.insertObject( pageBreakElement, null, null, {\n     * \tsetSelection: 'after'\n     * } );\n     * ```\n     *\n     * Use the following code to insert an object at the current selection and avoid splitting the content (non-destructive insertion):\n     *\n     * ```ts\n     * const tableElement = writer.createElement( 'table' );\n     *\n     * model.insertObject( tableElement, null, null, {\n     * \tfindOptimalPosition: 'auto'\n     * } );\n     * ```\n     *\n     * Use the following code to insert an object at the specific range (also: replace the content of the range):\n     *\n     * ```ts\n     * const tableElement = writer.createElement( 'table' );\n     * const range = model.createRangeOn( model.document.getRoot().getChild( 1 ) );\n     *\n     * model.insertObject( tableElement, range );\n     * ```\n     *\n     * @param element An object to be inserted into the model document.\n     * @param selectable A selectable where the content should be inserted. If not specified, the current\n     * {@link module:engine/model/document~ModelDocument#selection document selection} will be used instead.\n     * @param placeOrOffset Specifies the exact place or offset for the insertion to take place, relative to `selectable`.\n     * @param options Additional options.\n     * @param options.findOptimalPosition An option that, when set, adjusts the insertion position (relative to\n     * `selectable` and `placeOrOffset`) so that the content of `selectable` is not split upon insertion (a.k.a. non-destructive insertion).\n     * * When `'auto'`, the algorithm will decide whether to insert the object before or after `selectable` to avoid content splitting.\n     * * When `'before'`, the closest position before `selectable` will be used that will not result in content splitting.\n     * * When `'after'`, the closest position after `selectable` will be used that will not result in content splitting.\n     *\n     * Note that this option only works for block objects. Inline objects are inserted into text and do not split blocks.\n     * @param options.setSelection An option that, when set, moves the\n     * {@link module:engine/model/document~ModelDocument#selection document selection} after inserting the object.\n     * * When `'on'`, the document selection will be set on the inserted object.\n     * * When `'after'`, the document selection will move to the closest text node after the inserted object. If there is no\n     * such text node, a paragraph will be created and the document selection will be moved inside it.\n     * at the insertion position.\n     */\n    insertObject(element, selectable, placeOrOffset, options, ...rest) {\n        const selection = normalizeSelectable(selectable, placeOrOffset);\n        // Note that options are fired as 2 arguments for backward compatibility with the decorated method.\n        // Passing all call arguments so it acts like decorated method.\n        return this.fire('insertObject', [element, selection, options, options, ...rest]);\n    }\n    /**\n     * Deletes content of the selection and merge siblings. The resulting selection is always collapsed.\n     *\n     * **Note:** For the sake of predictability, the resulting selection should always be collapsed.\n     * In cases where a feature wants to modify deleting behavior so selection isn't collapsed\n     * (e.g. a table feature may want to keep row selection after pressing <kbd>Backspace</kbd>),\n     * then that behavior should be implemented in the view's listener. At the same time, the table feature\n     * will need to modify this method's behavior too, e.g. to \"delete contents and then collapse\n     * the selection inside the last selected cell\" or \"delete the row and collapse selection somewhere near\".\n     * That needs to be done in order to ensure that other features which use `deleteContent()` will work well with tables.\n     *\n     * @fires deleteContent\n     * @param selection Selection of which the content should be deleted.\n     * @param options.leaveUnmerged Whether to merge elements after removing the content of the selection.\n     *\n     * For example `<heading1>x[x</heading1><paragraph>y]y</paragraph>` will become:\n     *\n     * * `<heading1>x^y</heading1>` with the option disabled (`leaveUnmerged == false`)\n     * * `<heading1>x^</heading1><paragraph>y</paragraph>` with enabled (`leaveUnmerged == true`).\n     *\n     * Note: {@link module:engine/model/schema~ModelSchema#isObject object} and {@link module:engine/model/schema~ModelSchema#isLimit limit}\n     * elements will not be merged.\n     *\n     * @param options.doNotResetEntireContent Whether to skip replacing the entire content with a\n     * paragraph when the entire content was selected.\n     *\n     * For example `<heading1>[x</heading1><paragraph>y]</paragraph>` will become:\n     *\n     * * `<paragraph>^</paragraph>` with the option disabled (`doNotResetEntireContent == false`)\n     * * `<heading1>^</heading1>` with enabled (`doNotResetEntireContent == true`)\n     *\n     * @param options.doNotAutoparagraph Whether to create a paragraph if after content deletion selection is moved\n     * to a place where text cannot be inserted.\n     *\n     * For example `<paragraph>x</paragraph>[<imageBlock src=\"foo.jpg\"></imageBlock>]` will become:\n     *\n     * * `<paragraph>x</paragraph><paragraph>[]</paragraph>` with the option disabled (`doNotAutoparagraph == false`)\n     * * `<paragraph>x[]</paragraph>` with the option enabled (`doNotAutoparagraph == true`).\n     *\n     * **Note:** if there is no valid position for the selection, the paragraph will always be created:\n     *\n     * `[<imageBlock src=\"foo.jpg\"></imageBlock>]` -> `<paragraph>[]</paragraph>`.\n     *\n     * @param options.direction The direction in which the content is being consumed.\n     * Deleting backward corresponds to using the <kbd>Backspace</kbd> key, while deleting content forward corresponds to\n     * the <kbd>Shift</kbd>+<kbd>Backspace</kbd> keystroke.\n     */\n    deleteContent(selection, options) {\n        deleteContent(this, selection, options);\n    }\n    /**\n     * Modifies the selection. Currently, the supported modifications are:\n     *\n     * * Extending. The selection focus is moved in the specified `options.direction` with a step specified in `options.unit`.\n     * Possible values for `unit` are:\n     *  * `'character'` (default) - moves selection by one user-perceived character. In most cases this means moving by one\n     *  character in `String` sense. However, unicode also defines \"combing marks\". These are special symbols, that combines\n     *  with a symbol before it (\"base character\") to create one user-perceived character. For example, `q̣̇` is a normal\n     *  letter `q` with two \"combining marks\": upper dot (`Ux0307`) and lower dot (`Ux0323`). For most actions, i.e. extending\n     *  selection by one position, it is correct to include both \"base character\" and all of it's \"combining marks\". That is\n     *  why `'character'` value is most natural and common method of modifying selection.\n     *  * `'codePoint'` - moves selection by one unicode code point. In contrary to, `'character'` unit, this will insert\n     *  selection between \"base character\" and \"combining mark\", because \"combining marks\" have their own unicode code points.\n     *  However, for technical reasons, unicode code points with values above `UxFFFF` are represented in native `String` by\n     *  two characters, called \"surrogate pairs\". Halves of \"surrogate pairs\" have a meaning only when placed next to each other.\n     *  For example `𨭎` is represented in `String` by `\\uD862\\uDF4E`. Both `\\uD862` and `\\uDF4E` do not have any meaning\n     *  outside the pair (are rendered as ? when alone). Position between them would be incorrect. In this case, selection\n     *  extension will include whole \"surrogate pair\".\n     *  * `'word'` - moves selection by a whole word.\n     *\n     * **Note:** if you extend a forward selection in a backward direction you will in fact shrink it.\n     *\n     * @fires modifySelection\n     * @param selection The selection to modify.\n     * @param options.direction The direction in which the selection should be modified.\n     * @param options.unit The unit by which selection should be modified.\n     * @param options.treatEmojiAsSingleUnit Whether multi-characer emoji sequences should be handled as single unit.\n     */\n    modifySelection(selection, options) {\n        modifySelection(this, selection, options);\n    }\n    /**\n     * Gets a clone of the selected content.\n     *\n     * For example, for the following selection:\n     *\n     * ```html\n     * <paragraph>x</paragraph>\n     * <blockQuote>\n     * \t<paragraph>y</paragraph>\n     * \t<heading1>fir[st</heading1>\n     * </blockQuote>\n     * <paragraph>se]cond</paragraph>\n     * <paragraph>z</paragraph>\n     * ```\n     *\n     * It will return a document fragment with such a content:\n     *\n     * ```html\n     * <blockQuote>\n     * \t<heading1>st</heading1>\n     * </blockQuote>\n     * <paragraph>se</paragraph>\n     * ```\n     *\n     * @fires getSelectedContent\n     * @param selection The selection of which content will be returned.\n     */\n    getSelectedContent(selection) {\n        return getSelectedContent(this, selection);\n    }\n    /**\n     * Checks whether the given {@link module:engine/model/range~ModelRange range} or\n     * {@link module:engine/model/element~ModelElement element} has any meaningful content.\n     *\n     * Meaningful content is:\n     *\n     * * any text node (`options.ignoreWhitespaces` allows controlling whether this text node must also contain\n     * any non-whitespace characters),\n     * * or any {@link module:engine/model/schema~ModelSchema#isContent content element},\n     * * or any {@link module:engine/model/markercollection~Marker marker} which\n     * {@link module:engine/model/markercollection~Marker#_affectsData affects data}.\n     *\n     * This means that a range containing an empty `<paragraph></paragraph>` is not considered to have a meaningful content.\n     * However, a range containing an `<imageBlock></imageBlock>` (which would normally be marked in the schema as an object element)\n     * is considered non-empty.\n     *\n     * @param rangeOrElement Range or element to check.\n     * @param options.ignoreWhitespaces Whether text node with whitespaces only should be considered empty.\n     * @param options.ignoreMarkers Whether markers should be ignored.\n     */\n    hasContent(rangeOrElement, options = {}) {\n        const range = rangeOrElement instanceof ModelRange ? rangeOrElement : ModelRange._createIn(rangeOrElement);\n        if (range.isCollapsed) {\n            return false;\n        }\n        const { ignoreWhitespaces = false, ignoreMarkers = false } = options;\n        // Check if there are any markers which affects data in this given range.\n        if (!ignoreMarkers) {\n            for (const intersectingMarker of this.markers.getMarkersIntersectingRange(range)) {\n                if (intersectingMarker.affectsData) {\n                    return true;\n                }\n            }\n        }\n        for (const item of range.getItems()) {\n            if (this.schema.isContent(item)) {\n                if (item.is('$textProxy')) {\n                    if (!ignoreWhitespaces) {\n                        return true;\n                    }\n                    else if (item.data.search(/\\S/) !== -1) {\n                        return true;\n                    }\n                }\n                else {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    /**\n     * Check whether given selectable is at a place in the model where it can be edited (returns `true`) or not (returns `false`).\n     *\n     * Should be used instead of {@link module:core/editor/editor~Editor#isReadOnly} to check whether a user action can happen at\n     * given selectable. It may be decorated and used differently in different environment (e.g. multi-root editor can disable\n     * a particular root).\n     *\n     * This method is decorated. Although this method accepts any parameter of `Selectable` type, the\n     * {@link ~Model#event:canEditAt `canEditAt` event} is fired with `selectable` normalized to an instance of\n     * {@link module:engine/model/selection~ModelSelection} or {@link module:engine/model/documentselection~ModelDocumentSelection}\n     *\n     * @fires canEditAt\n     */\n    canEditAt(selectable) {\n        const selection = normalizeSelectable(selectable);\n        return this.fire('canEditAt', [selection]);\n    }\n    /**\n     * Creates a position from the given root and path in that root.\n     *\n     * Note: This method is also available as\n     * {@link module:engine/model/writer~ModelWriter#createPositionFromPath `Writer#createPositionFromPath()`}.\n     *\n     * @param root Root of the position.\n     * @param path Position path. See {@link module:engine/model/position~ModelPosition#path}.\n     * @param stickiness Position stickiness. See {@link module:engine/model/position~ModelPositionStickiness}.\n     */\n    createPositionFromPath(root, path, stickiness) {\n        return new ModelPosition(root, path, stickiness);\n    }\n    /**\n     * Creates position at the given location. The location can be specified as:\n     *\n     * * a {@link module:engine/model/position~ModelPosition position},\n     * * a parent element and offset in that element,\n     * * a parent element and `'end'` (the position will be set at the end of that element),\n     * * a {@link module:engine/model/item~ModelItem model item} and `'before'` or `'after'`\n     * (the position will be set before or after the given model item).\n     *\n     * This method is a shortcut to other factory methods such as:\n     *\n     * * {@link module:engine/model/model~Model#createPositionBefore `createPositionBefore()`},\n     * * {@link module:engine/model/model~Model#createPositionAfter `createPositionAfter()`}.\n     *\n     * Note: This method is also available as\n     * {@link module:engine/model/writer~ModelWriter#createPositionAt `Writer#createPositionAt()`},\n     *\n     * @param itemOrPosition\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~ModelItem model item}.\n     */\n    createPositionAt(itemOrPosition, offset) {\n        return ModelPosition._createAt(itemOrPosition, offset);\n    }\n    /**\n     * Creates a new position after the given {@link module:engine/model/item~ModelItem model item}.\n     *\n     * Note: This method is also available as\n     * {@link module:engine/model/writer~ModelWriter#createPositionAfter `Writer#createPositionAfter()`}.\n     *\n     * @param item Item after which the position should be placed.\n     */\n    createPositionAfter(item) {\n        return ModelPosition._createAfter(item);\n    }\n    /**\n     * Creates a new position before the given {@link module:engine/model/item~ModelItem model item}.\n     *\n     * Note: This method is also available as\n     * {@link module:engine/model/writer~ModelWriter#createPositionBefore `Writer#createPositionBefore()`}.\n     *\n     * @param item Item before which the position should be placed.\n     */\n    createPositionBefore(item) {\n        return ModelPosition._createBefore(item);\n    }\n    /**\n     * Creates a range spanning from the `start` position to the `end` position.\n     *\n     * Note: This method is also available as\n     * {@link module:engine/model/writer~ModelWriter#createRange `Writer#createRange()`}:\n     *\n     * ```ts\n     * model.change( writer => {\n     * \tconst range = writer.createRange( start, end );\n     * } );\n     * ```\n     *\n     * @param start Start position.\n     * @param end End position. If not set, the range will be collapsed to the `start` position.\n     */\n    createRange(start, end) {\n        return new ModelRange(start, end);\n    }\n    /**\n     * Creates a range inside the given element which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * Note: This method is also available as\n     * {@link module:engine/model/writer~ModelWriter#createRangeIn `Writer#createRangeIn()`}:\n     *\n     * ```ts\n     * model.change( writer => {\n     * \tconst range = writer.createRangeIn( paragraph );\n     * } );\n     * ```\n     *\n     * @param element Element which is a parent for the range.\n     */\n    createRangeIn(element) {\n        return ModelRange._createIn(element);\n    }\n    /**\n     * Creates a range that starts before the given {@link module:engine/model/item~ModelItem model item} and ends after it.\n     *\n     * Note: This method is also available on `writer` instance as\n     * {@link module:engine/model/writer~ModelWriter#createRangeOn `Writer.createRangeOn()`}:\n     *\n     * ```ts\n     * model.change( writer => {\n     * \tconst range = writer.createRangeOn( paragraph );\n     * } );\n     * ```\n     *\n     * @param item\n     */\n    createRangeOn(item) {\n        return ModelRange._createOn(item);\n    }\n    createSelection(...args) {\n        return new ModelSelection(...args);\n    }\n    /**\n     * Creates a {@link module:engine/model/batch~Batch} instance.\n     *\n     * **Note:** In most cases creating a batch instance is not necessary as they are created when using:\n     *\n     * * {@link #change `change()`},\n     * * {@link #enqueueChange `enqueueChange()`}.\n     *\n     * @param type {@link module:engine/model/batch~Batch#constructor The type} of the batch.\n     */\n    createBatch(type) {\n        return new Batch(type);\n    }\n    /**\n     * Creates an operation instance from a JSON object (parsed JSON string).\n     *\n     * This is an alias for {@link module:engine/model/operation/operationfactory~OperationFactory.fromJSON `OperationFactory.fromJSON()`}.\n     *\n     * @param json Deserialized JSON object.\n     */\n    createOperationFromJSON(json) {\n        return OperationFactory.fromJSON(json, this.document);\n    }\n    /**\n     * Removes all events listeners set by model instance and destroys {@link module:engine/model/document~ModelDocument}.\n     */\n    destroy() {\n        this.document.destroy();\n        this.stopListening();\n    }\n    /**\n     * Common part of {@link module:engine/model/model~Model#change} and {@link module:engine/model/model~Model#enqueueChange}\n     * which calls callbacks and returns array of values returned by these callbacks.\n     */\n    _runPendingChanges() {\n        const ret = [];\n        this.fire('_beforeChanges');\n        try {\n            while (this._pendingChanges.length) {\n                // Create a new writer using batch instance created for this chain of changes.\n                const currentBatch = this._pendingChanges[0].batch;\n                this._currentWriter = new ModelWriter(this, currentBatch);\n                // Execute changes callback and gather the returned value.\n                const callbackReturnValue = this._pendingChanges[0].callback(this._currentWriter);\n                ret.push(callbackReturnValue);\n                this.document._handleChangeBlock(this._currentWriter);\n                this._pendingChanges.shift();\n                this._currentWriter = null;\n            }\n        }\n        finally {\n            this._pendingChanges.length = 0;\n            this._currentWriter = null;\n            this.fire('_afterChanges');\n        }\n        return ret;\n    }\n}\n/**\n * Normalizes a selectable to a Selection or ModelDocumentSelection.\n */\nfunction normalizeSelectable(selectable, placeOrOffset) {\n    if (!selectable) {\n        return;\n    }\n    if (selectable instanceof ModelSelection || selectable instanceof ModelDocumentSelection) {\n        return selectable;\n    }\n    if (selectable instanceof ModelNode) {\n        if (placeOrOffset || placeOrOffset === 0) {\n            return new ModelSelection(selectable, placeOrOffset);\n        }\n        else if (selectable.is('rootElement')) {\n            return new ModelSelection(selectable, 'in');\n        }\n        else {\n            return new ModelSelection(selectable, 'on');\n        }\n    }\n    return new ModelSelection(selectable);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { CKEditorError, first } from '@ckeditor/ckeditor5-utils';\n/**\n * Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.\n *\n * **Note:** Use {@link module:engine/model/model~Model#insertObject} instead of this function.\n * This function is only exposed to be reusable in algorithms which change the {@link module:engine/model/model~Model#insertObject}\n * method's behavior.\n *\n * **Note**: For more documentation and examples, see {@link module:engine/model/model~Model#insertObject}.\n *\n * @param model The model in context of which the insertion should be performed.\n * @param object An object to be inserted into the model document.\n * @param selectable A selectable where the content should be inserted. If not specified, the current\n * {@link module:engine/model/document~ModelDocument#selection document selection} will be used instead.\n * @param options Additional options.\n * @param options.findOptimalPosition An option that, when set, adjusts the insertion position (relative to\n * `selectable` and `placeOrOffset`) so that the content of `selectable` is not split upon insertion (a.k.a. non-destructive insertion).\n * * When `'auto'`, the algorithm will decide whether to insert the object before or after `selectable` to avoid content splitting.\n * * When `'before'`, the closest position before `selectable` will be used that will not result in content splitting.\n * * When `'after'`, the closest position after `selectable` will be used that will not result in content splitting.\n *\n * Note that this option works only for block objects. Inline objects are inserted into text and do not split blocks.\n * @param options.setSelection An option that, when set, moves the\n * {@link module:engine/model/document~ModelDocument#selection document selection} after inserting the object.\n * * When `'on'`, the document selection will be set on the inserted object.\n * * When `'after'`, the document selection will move to the closest text node after the inserted object. If there is no\n * such text node, a paragraph will be created and the document selection will be moved inside it.\n * @returns A range which contains all the performed changes. This is a range that, if removed,\n * would return the model to the state before the insertion. If no changes were preformed by `insertObject()`, returns a range collapsed\n * at the insertion position.\n */\nexport function insertObject(model, object, selectable, options = {}) {\n    if (!model.schema.isObject(object)) {\n        /**\n         * Tried to insert an element with {@link module:engine/model/utils/insertobject insertObject()} function\n         * that is not defined as an object in schema.\n         * See {@link module:engine/model/schema~ModelSchemaItemDefinition#isObject `SchemaItemDefinition`}.\n         * If you want to insert content that is not an object you might want to use\n         * {@link module:engine/model/utils/insertcontent insertContent()} function.\n         * @error insertobject-element-not-an-object\n         */\n        throw new CKEditorError('insertobject-element-not-an-object', model, { object });\n    }\n    // Normalize selectable to a selection instance.\n    const originalSelection = selectable ? selectable : model.document.selection;\n    // Adjust the insertion selection.\n    let insertionSelection = originalSelection;\n    if (options.findOptimalPosition && model.schema.isBlock(object)) {\n        insertionSelection = model.createSelection(model.schema.findOptimalInsertionRange(originalSelection, options.findOptimalPosition));\n    }\n    // Collect attributes to be copied on the inserted object.\n    const firstSelectedBlock = first(originalSelection.getSelectedBlocks());\n    const attributesToCopy = {};\n    if (firstSelectedBlock) {\n        Object.assign(attributesToCopy, model.schema.getAttributesWithProperty(firstSelectedBlock, 'copyOnReplace', true));\n    }\n    return model.change(writer => {\n        // Remove the selected content to find out what the parent of the inserted object would be.\n        // It would be removed inside model.insertContent() anyway.\n        if (!insertionSelection.isCollapsed) {\n            model.deleteContent(insertionSelection, { doNotAutoparagraph: true });\n        }\n        let elementToInsert = object;\n        const insertionPositionParent = insertionSelection.anchor.parent;\n        const context = model.schema.createContext(insertionPositionParent);\n        // Auto-paragraphing of an inline objects.\n        if (!model.schema.checkChild(context, object) &&\n            model.schema.checkChild(context, 'paragraph') &&\n            model.schema.checkChild(context.push('paragraph'), object)) {\n            elementToInsert = writer.createElement('paragraph');\n            writer.insert(object, elementToInsert);\n        }\n        // Apply attributes that are allowed on the inserted object (or paragraph if autoparagraphed).\n        model.schema.setAllowedAttributes(elementToInsert, attributesToCopy, writer);\n        // Insert the prepared content at the optionally adjusted selection.\n        const affectedRange = model.insertContent(elementToInsert, insertionSelection);\n        // Nothing got inserted.\n        if (affectedRange.isCollapsed) {\n            return affectedRange;\n        }\n        if (options.setSelection) {\n            updateSelection(writer, object, options.setSelection, attributesToCopy);\n        }\n        return affectedRange;\n    });\n}\n/**\n * Updates document selection based on given `place` parameter in relation to `contextElement` element.\n *\n * @param writer An instance of the model writer.\n * @param contextElement An element to set the attributes on.\n * @param place The place where selection should be set in relation to the `contextElement` element.\n * Value `on` will set selection on the passed `contextElement`. Value `after` will set selection after `contextElement`.\n * @param attributes Attributes keys and values to set on a paragraph that this function can create when\n * `place` parameter is equal to `after` but there is no element with `$text` node to set selection in.\n */\nfunction updateSelection(writer, contextElement, place, paragraphAttributes) {\n    const model = writer.model;\n    if (place == 'on') {\n        writer.setSelection(contextElement, 'on');\n        return;\n    }\n    if (place != 'after') {\n        /**\n         * The unsupported `options.setSelection` parameter was passed\n         * to the {@link module:engine/model/utils/insertobject insertObject()} function.\n         * Check the {@link module:engine/model/utils/insertobject insertObject()} API documentation for allowed\n         * `options.setSelection` parameter values.\n         *\n         * @error insertobject-invalid-place-parameter-value\n         */\n        throw new CKEditorError('insertobject-invalid-place-parameter-value', model);\n    }\n    let nextElement = contextElement.nextSibling;\n    if (model.schema.isInline(contextElement)) {\n        writer.setSelection(contextElement, 'after');\n        return;\n    }\n    // Check whether an element next to the inserted element is defined and can contain a text.\n    const canSetSelection = nextElement && model.schema.checkChild(nextElement, '$text');\n    // If the element is missing, but a paragraph could be inserted next to the element, let's add it.\n    if (!canSetSelection && model.schema.checkChild(contextElement.parent, 'paragraph')) {\n        nextElement = writer.createElement('paragraph');\n        model.schema.setAllowedAttributes(nextElement, paragraphAttributes, writer);\n        model.insertContent(nextElement, writer.createPositionAfter(contextElement));\n    }\n    // Put the selection inside the element, at the beginning.\n    if (nextElement) {\n        writer.setSelection(nextElement, 0);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/clickobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\n/**\n * {@link module:engine/view/document~ViewDocument#event:click Click} event observer.\n *\n * Note that this observer is not available by default. To make it available it needs to be added to\n * {@link module:engine/view/view~EditingView view controller} by a {@link module:engine/view/view~EditingView#addObserver} method.\n */\nexport class ClickObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = 'click';\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        this.fire(domEvent.type, domEvent);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/mouseobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\n/**\n * Mouse events observer.\n *\n * Note that this observer is not available by default. To make it available it needs to be added to\n * {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.\n */\nexport class MouseObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['mousedown', 'mouseup', 'mouseover', 'mouseout'];\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        this.fire(domEvent.type, domEvent);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/touchobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\n/**\n * Touch events observer.\n *\n * Note that this observer is not available by default. To make it available it needs to be added to\n * {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.\n */\nexport class TouchObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['touchstart', 'touchend', 'touchmove'];\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        this.fire(domEvent.type, domEvent);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/observer/pointerobserver\n */\nimport { DomEventObserver } from './domeventobserver.js';\n/**\n * Pointer events observer.\n *\n * Note that this observer is not available by default. To make it available it needs to be added to\n * {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.\n */\nexport class PointerObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['pointerdown', 'pointerup', 'pointermove'];\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        this.fire(domEvent.type, domEvent);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module engine/view/upcastwriter\n */\nimport { ViewDocumentFragment } from './documentfragment.js';\nimport { ViewElement } from './element.js';\nimport { ViewText } from './text.js';\nimport { isPlainObject } from 'es-toolkit/compat';\nimport { ViewPosition } from './position.js';\nimport { ViewRange } from './range.js';\nimport { ViewSelection } from './selection.js';\n/**\n * View upcast writer. It provides a set of methods used to manipulate non-semantic view trees.\n *\n * It should be used only while working on a non-semantic view\n * (e.g. a view created from HTML string on paste).\n * To manipulate a view which was or is being downcasted from the the model use the\n * {@link module:engine/view/downcastwriter~ViewDowncastWriter downcast writer}.\n *\n * Read more about changing the view in the {@glink framework/architecture/editing-engine#changing-the-view Changing the view}\n * section of the {@glink framework/architecture/editing-engine Editing engine architecture} guide.\n *\n * Unlike `ViewDowncastWriter`, which is available in the {@link module:engine/view/view~EditingView#change `View#change()`} block,\n * `ViewUpcastWriter` can be created wherever you need it:\n *\n * ```ts\n * const writer = new ViewUpcastWriter( viewDocument );\n * const text = writer.createText( 'foo!' );\n *\n * writer.appendChild( text, someViewElement );\n * ```\n */\nexport class ViewUpcastWriter {\n    /**\n     * The view document instance in which this upcast writer operates.\n     */\n    document;\n    /**\n     * @param document The view document instance in which this upcast writer operates.\n     */\n    constructor(document) {\n        this.document = document;\n    }\n    /**\n     * Creates a new {@link module:engine/view/documentfragment~ViewDocumentFragment} instance.\n     *\n     * @param children A list of nodes to be inserted into the created document fragment.\n     * @returns The created document fragment.\n     */\n    createDocumentFragment(children) {\n        return new ViewDocumentFragment(this.document, children);\n    }\n    /**\n     * Creates a new {@link module:engine/view/element~ViewElement} instance.\n     *\n     * Attributes can be passed in various formats:\n     *\n     * ```ts\n     * upcastWriter.createElement( 'div', { class: 'editor', contentEditable: 'true' } ); // object\n     * upcastWriter.createElement( 'div', [ [ 'class', 'editor' ], [ 'contentEditable', 'true' ] ] ); // map-like iterator\n     * upcastWriter.createElement( 'div', mapOfAttributes ); // map\n     * ```\n     *\n     * @param name Node name.\n     * @param attrs Collection of attributes.\n     * @param children A list of nodes to be inserted into created element.\n     * @returns Created element.\n     */\n    createElement(name, attrs, children) {\n        return new ViewElement(this.document, name, attrs, children);\n    }\n    /**\n     * Creates a new {@link module:engine/view/text~ViewText} instance.\n     *\n     * @param data The text's data.\n     * @returns The created text node.\n     */\n    createText(data) {\n        return new ViewText(this.document, data);\n    }\n    /**\n     * Clones the provided element.\n     *\n     * @see module:engine/view/element~ViewElement#_clone\n     * @param element Element to be cloned.\n     * @param deep If set to `true` clones element and all its children recursively. When set to `false`,\n     * element will be cloned without any children.\n     * @returns Clone of this element.\n     */\n    clone(element, deep = false) {\n        return element._clone(deep);\n    }\n    /**\n     * Appends a child node or a list of child nodes at the end of this node\n     * and sets the parent of these nodes to this element.\n     *\n     * @see module:engine/view/element~ViewElement#_appendChild\n     * @param items Items to be inserted.\n     * @param element Element to which items will be appended.\n     * @returns Number of appended nodes.\n     */\n    appendChild(items, element) {\n        return element._appendChild(items);\n    }\n    /**\n     * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to\n     * this element.\n     *\n     * @see module:engine/view/element~ViewElement#_insertChild\n     * @param index Offset at which nodes should be inserted.\n     * @param items Items to be inserted.\n     * @param element Element to which items will be inserted.\n     * @returns Number of inserted nodes.\n     */\n    insertChild(index, items, element) {\n        return element._insertChild(index, items);\n    }\n    /**\n     * Removes the given number of child nodes starting at the given index and set the parent of these nodes to `null`.\n     *\n     * @see module:engine/view/element~ViewElement#_removeChildren\n     * @param index Offset from which nodes will be removed.\n     * @param howMany Number of nodes to remove.\n     * @param element Element which children will be removed.\n     * @returns The array containing removed nodes.\n     */\n    removeChildren(index, howMany, element) {\n        return element._removeChildren(index, howMany);\n    }\n    /**\n     * Removes given element from the view structure. Will not have effect on detached elements.\n     *\n     * @param element Element which will be removed.\n     * @returns The array containing removed nodes.\n     */\n    remove(element) {\n        const parent = element.parent;\n        if (parent) {\n            return this.removeChildren(parent.getChildIndex(element), 1, parent);\n        }\n        return [];\n    }\n    /**\n     * Replaces given element with the new one in the view structure. Will not have effect on detached elements.\n     *\n     * @param oldElement Element which will be replaced.\n     * @param newElement Element which will be inserted in the place of the old element.\n     * @returns Whether old element was successfully replaced.\n     */\n    replace(oldElement, newElement) {\n        const parent = oldElement.parent;\n        if (parent) {\n            const index = parent.getChildIndex(oldElement);\n            this.removeChildren(index, 1, parent);\n            this.insertChild(index, newElement, parent);\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Removes given element from view structure and places its children in its position.\n     * It does nothing if element has no parent.\n     *\n     * @param element Element to unwrap.\n     */\n    unwrapElement(element) {\n        const parent = element.parent;\n        if (parent) {\n            const index = parent.getChildIndex(element);\n            this.remove(element);\n            this.insertChild(index, element.getChildren(), parent);\n        }\n    }\n    /**\n     * Renames element by creating a copy of a given element but with its name changed and then moving contents of the\n     * old element to the new one.\n     *\n     * Since this function creates a new element and removes the given one, the new element is returned to keep reference.\n     *\n     * @param newName New element name.\n     * @param  element Element to be renamed.\n     * @returns New element or null if the old element was not replaced (happens for detached elements).\n     */\n    rename(newName, element) {\n        const newElement = new ViewElement(this.document, newName, element.getAttributes(), element.getChildren());\n        return this.replace(element, newElement) ? newElement : null;\n    }\n    /**\n     * Adds or overwrites element's attribute with a specified key and value.\n     *\n     * ```ts\n     * writer.setAttribute( 'href', 'http://ckeditor.com', linkElement );\n     * ```\n     *\n     * @see module:engine/view/element~ViewElement#_setAttribute\n     * @param key Attribute key.\n     * @param value Attribute value.\n     * @param element Element for which attribute will be set.\n     */\n    setAttribute(key, value, element) {\n        element._setAttribute(key, value);\n    }\n    /**\n     * Removes attribute from the element.\n     *\n     * ```ts\n     * writer.removeAttribute( 'href', linkElement );\n     * ```\n     *\n     * @see module:engine/view/element~ViewElement#_removeAttribute\n     * @param key Attribute key.\n     * @param element Element from which attribute will be removed.\n     */\n    removeAttribute(key, element) {\n        element._removeAttribute(key);\n    }\n    /**\n     * Adds specified class to the element.\n     *\n     * ```ts\n     * writer.addClass( 'foo', linkElement );\n     * writer.addClass( [ 'foo', 'bar' ], linkElement );\n     * ```\n     *\n     * @see module:engine/view/element~ViewElement#_addClass\n     * @param className Single class name or array of class names which will be added.\n     * @param element Element for which class will be added.\n     */\n    addClass(className, element) {\n        element._addClass(className);\n    }\n    /**\n     * Removes specified class from the element.\n     *\n     * ```ts\n     * writer.removeClass( 'foo', linkElement );\n     * writer.removeClass( [ 'foo', 'bar' ], linkElement );\n     * ```\n     *\n     * @see module:engine/view/element~ViewElement#_removeClass\n     * @param className Single class name or array of class names which will be removed.\n     * @param element Element from which class will be removed.\n     */\n    removeClass(className, element) {\n        element._removeClass(className);\n    }\n    setStyle(property, valueOrElement, element) {\n        if (isPlainObject(property) && element === undefined) {\n            valueOrElement._setStyle(property);\n        }\n        else {\n            element._setStyle(property, valueOrElement);\n        }\n    }\n    /**\n     * Removes specified style from the element.\n     *\n     * ```ts\n     * writer.removeStyle( 'color', element );  // Removes 'color' style.\n     * writer.removeStyle( [ 'color', 'border-top' ], element ); // Removes both 'color' and 'border-top' styles.\n     * ```\n     *\n     * **Note**: This method can work with normalized style names if\n     * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.\n     * See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.\n     *\n     * @see module:engine/view/element~ViewElement#_removeStyle\n     * @param property Style property name or names to be removed.\n     * @param element Element from which style will be removed.\n     */\n    removeStyle(property, element) {\n        element._removeStyle(property);\n    }\n    /**\n     * Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,\n     * so they can be used to add special data to elements.\n     *\n     * @see module:engine/view/element~ViewElement#_setCustomProperty\n     * @param key Custom property name/key.\n     * @param value Custom property value to be stored.\n     * @param element Element for which custom property will be set.\n     */\n    setCustomProperty(key, value, element) {\n        element._setCustomProperty(key, value);\n    }\n    /**\n     * Removes a custom property stored under the given key.\n     *\n     * @see module:engine/view/element~ViewElement#_removeCustomProperty\n     * @param key Name/key of the custom property to be removed.\n     * @param element Element from which the custom property will be removed.\n     * @returns Returns true if property was removed.\n     */\n    removeCustomProperty(key, element) {\n        return element._removeCustomProperty(key);\n    }\n    /**\n     * Creates position at the given location. The location can be specified as:\n     *\n     * * a {@link module:engine/view/position~ViewPosition position},\n     * * parent element and offset (offset defaults to `0`),\n     * * parent element and `'end'` (sets position at the end of that element),\n     * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).\n     *\n     * This method is a shortcut to other constructors such as:\n     *\n     * * {@link #createPositionBefore},\n     * * {@link #createPositionAfter},\n     *\n     * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.\n     */\n    createPositionAt(itemOrPosition, offset) {\n        return ViewPosition._createAt(itemOrPosition, offset);\n    }\n    /**\n     * Creates a new position after given view item.\n     *\n     * @param item View item after which the position should be located.\n     */\n    createPositionAfter(item) {\n        return ViewPosition._createAfter(item);\n    }\n    /**\n     * Creates a new position before given view item.\n     *\n     * @param item View item before which the position should be located.\n     */\n    createPositionBefore(item) {\n        return ViewPosition._createBefore(item);\n    }\n    /**\n     * Creates a range spanning from `start` position to `end` position.\n     *\n     * **Note:** This factory method creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.\n     *\n     * @param start Start position.\n     * @param end End position. If not set, range will be collapsed at `start` position.\n     */\n    createRange(start, end) {\n        return new ViewRange(start, end);\n    }\n    /**\n     * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.\n     */\n    createRangeOn(item) {\n        return ViewRange._createOn(item);\n    }\n    /**\n     * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of\n     * that element and ends after the last child of that element.\n     *\n     * @param element Element which is a parent for the range.\n     */\n    createRangeIn(element) {\n        return ViewRange._createIn(element);\n    }\n    createSelection(...args) {\n        return new ViewSelection(...args);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nconst HEX_COLOR_REGEXP = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;\nconst RGB_COLOR_REGEXP = /^rgb\\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\\)$/i;\nconst RGBA_COLOR_REGEXP = /^rgba\\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\\.?[0-9]+)\\)$/i;\nconst HSL_COLOR_REGEXP = /^hsl\\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\\.?[0-9]+)?\\)$/i;\nconst HSLA_COLOR_REGEXP = /^hsla\\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\\.?[0-9]+)\\)$/i;\n// Note: This regexp hardcodes a single level of nested () for values such as `calc( var( ...) + ...)`.\n// If this gets more complex, a proper parser should be used instead.\nconst CSS_SHORTHAND_VALUE_REGEXP = /\\w+\\((?:[^()]|\\([^()]*\\))*\\)|\\S+/gi;\nconst COLOR_NAMES = new Set([\n    // CSS Level 1\n    'black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia',\n    'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua',\n    // CSS Level 2 (Revision 1)\n    'orange',\n    // CSS Color Module Level 3\n    'aliceblue', 'antiquewhite', 'aquamarine', 'azure', 'beige', 'bisque', 'blanchedalmond', 'blueviolet', 'brown',\n    'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan',\n    'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta',\n    'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue',\n    'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey',\n    'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod',\n    'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush',\n    'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray',\n    'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray',\n    'lightslategrey', 'lightsteelblue', 'lightyellow', 'limegreen', 'linen', 'magenta', 'mediumaquamarine',\n    'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen',\n    'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite',\n    'oldlace', 'olivedrab', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred',\n    'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon',\n    'sandybrown', 'seagreen', 'seashell', 'sienna', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow',\n    'springgreen', 'steelblue', 'tan', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'whitesmoke', 'yellowgreen',\n    // CSS Color Module Level 3 (System Colors)\n    'activeborder', 'activecaption', 'appworkspace', 'background', 'buttonface', 'buttonhighlight', 'buttonshadow',\n    'buttontext', 'captiontext', 'graytext', 'highlight', 'highlighttext', 'inactiveborder', 'inactivecaption',\n    'inactivecaptiontext', 'infobackground', 'infotext', 'menu', 'menutext', 'scrollbar', 'threeddarkshadow',\n    'threedface', 'threedhighlight', 'threedlightshadow', 'threedshadow', 'window', 'windowframe', 'windowtext',\n    // CSS Color Module Level 4\n    'rebeccapurple',\n    // Keywords\n    'currentcolor', 'transparent'\n]);\n/**\n * Checks if string contains [color](https://developer.mozilla.org/en-US/docs/Web/CSS/color) CSS value.\n *\n * ```ts\n * isColorStyleValue( '#f00' );\t\t\t\t\t\t// true\n * isColorStyleValue( '#AA00BB33' );\t\t\t\t// true\n * isColorStyleValue( 'rgb(0, 0, 250)' );\t\t\t// true\n * isColorStyleValue( 'hsla(240, 100%, 50%, .7)' );\t// true\n * isColorStyleValue( 'deepskyblue' );\t\t\t\t// true\n * ```\n *\n * **Note**: It does not support CSS Level 4 whitespace syntax, system colors and radius values for HSL colors.\n */\nexport function isColorStyleValue(string) {\n    // As far as I was able to test checking some pre-conditions is faster than joining each test with ||.\n    if (string.startsWith('#')) {\n        return HEX_COLOR_REGEXP.test(string);\n    }\n    if (string.startsWith('rgb')) {\n        return RGB_COLOR_REGEXP.test(string) || RGBA_COLOR_REGEXP.test(string);\n    }\n    if (string.startsWith('hsl')) {\n        return HSL_COLOR_REGEXP.test(string) || HSLA_COLOR_REGEXP.test(string);\n    }\n    // Array check > RegExp test.\n    return COLOR_NAMES.has(string.toLowerCase());\n}\nconst lineStyleValues = ['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'];\n/**\n * Checks if string contains [line style](https://developer.mozilla.org/en-US/docs/Web/CSS/border-style) CSS value.\n */\nexport function isLineStyleValue(string) {\n    return lineStyleValues.includes(string);\n}\nconst lengthRegExp = /^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;\n/**\n * Checks if string contains [length](https://developer.mozilla.org/en-US/docs/Web/CSS/length) CSS value.\n */\nexport function isLengthStyleValue(string) {\n    return lengthRegExp.test(string);\n}\nconst PERCENTAGE_VALUE_REGEXP = /^[+-]?[0-9]*([.][0-9]+)?%$/;\n/**\n * Checks if string contains [percentage](https://developer.mozilla.org/en-US/docs/Web/CSS/percentage) CSS value.\n */\nexport function isPercentageStyleValue(string) {\n    return PERCENTAGE_VALUE_REGEXP.test(string);\n}\nconst repeatValues = ['repeat-x', 'repeat-y', 'repeat', 'space', 'round', 'no-repeat'];\n/**\n * Checks if string contains [background repeat](https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat) CSS value.\n */\nexport function isRepeatStyleValue(string) {\n    return repeatValues.includes(string);\n}\nconst positionValues = ['center', 'top', 'bottom', 'left', 'right'];\n/**\n * Checks if string contains [background position](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position) CSS value.\n */\nexport function isPositionStyleValue(string) {\n    return positionValues.includes(string);\n}\nconst attachmentValues = ['fixed', 'scroll', 'local'];\n/**\n * Checks if string contains [background attachment](https://developer.mozilla.org/en-US/docs/Web/CSS/background-attachment) CSS value.\n */\nexport function isAttachmentStyleValue(string) {\n    return attachmentValues.includes(string);\n}\nconst urlRegExp = /^url\\(/;\n/**\n * Checks if string contains [URL](https://developer.mozilla.org/en-US/docs/Web/CSS/url) CSS value.\n */\nexport function isURLStyleValue(string) {\n    return urlRegExp.test(string);\n}\n/**\n * Parses box sides as individual values.\n */\nexport function getBoxSidesStyleValues(value = '') {\n    if (value === '') {\n        return { top: undefined, right: undefined, bottom: undefined, left: undefined };\n    }\n    const values = getShorthandStylesValues(value);\n    const top = values[0];\n    const bottom = values[2] || top;\n    const right = values[1] || top;\n    const left = values[3] || right;\n    return { top, bottom, right, left };\n}\n/**\n * Default reducer for CSS properties that concerns edges of a box\n * [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) notations:\n *\n * ```ts\n * stylesProcessor.setReducer( 'padding', getBoxSidesStyleValueReducer( 'padding' ) );\n * ```\n */\nexport function getBoxSidesStyleValueReducer(styleShorthand) {\n    return (value) => {\n        const { top, right, bottom, left } = value;\n        const reduced = [];\n        if (![top, right, left, bottom].every(value => !!value)) {\n            if (top) {\n                reduced.push([styleShorthand + '-top', top]);\n            }\n            if (right) {\n                reduced.push([styleShorthand + '-right', right]);\n            }\n            if (bottom) {\n                reduced.push([styleShorthand + '-bottom', bottom]);\n            }\n            if (left) {\n                reduced.push([styleShorthand + '-left', left]);\n            }\n        }\n        else {\n            reduced.push([styleShorthand, getBoxSidesStyleShorthandValue(value)]);\n        }\n        return reduced;\n    };\n}\n/**\n * Returns a [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) notation\n * of a CSS property value.\n *\n * ```ts\n * getBoxSidesStyleShorthandValue( { top: '1px', right: '1px', bottom: '2px', left: '1px' } );\n * // will return '1px 1px 2px'\n * ```\n */\nexport function getBoxSidesStyleShorthandValue({ top, right, bottom, left }) {\n    const out = [];\n    if (left !== right) {\n        out.push(top, right, bottom, left);\n    }\n    else if (bottom !== top) {\n        out.push(top, right, bottom);\n    }\n    else if (right !== top) {\n        out.push(top, right);\n    }\n    else {\n        out.push(top);\n    }\n    return out.join(' ');\n}\n/**\n * Creates a normalizer for a [shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) 1-to-4 value.\n *\n * ```ts\n * stylesProcessor.setNormalizer( 'margin', getPositionStyleShorthandNormalizer( 'margin' ) );\n * ```\n */\nexport function getPositionStyleShorthandNormalizer(shorthand) {\n    return (value) => {\n        return {\n            path: shorthand,\n            value: getBoxSidesStyleValues(value)\n        };\n    };\n}\n/**\n * Parses parts of a 1-to-4 value notation - handles some CSS values with spaces (like RGB()).\n *\n * ```ts\n * getShorthandStylesValues( 'red blue RGB(0, 0, 0)');\n * // will return [ 'red', 'blue', 'RGB(0, 0, 0)' ]\n * ```\n */\nexport function getShorthandStylesValues(string) {\n    const matches = string.trim().slice(0, 1500).matchAll(CSS_SHORTHAND_VALUE_REGEXP);\n    return Array.from(matches).map(i => i[0]);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getShorthandStylesValues, isAttachmentStyleValue, isColorStyleValue, isPositionStyleValue, isRepeatStyleValue, isURLStyleValue } from './utils.js';\n/**\n * Adds a background CSS styles processing rules.\n *\n * ```ts\n * editor.data.addStyleProcessorRules( addBackgroundStylesRules );\n * ```\n *\n * The normalized value is stored as:\n *\n * ```ts\n * const styles = {\n * \tbackground: {\n * \t\tcolor,\n * \t\trepeat,\n * \t\tposition,\n * \t\tattachment,\n * \t\timage\n * \t}\n * };\n * ````\n *\n * **Note**: Currently only `'background-color'` longhand value is parsed besides `'background'` shorthand. The reducer also supports only\n * `'background-color'` value.\n */\nexport function addBackgroundStylesRules(stylesProcessor) {\n    stylesProcessor.setNormalizer('background', getBackgroundNormalizer());\n    stylesProcessor.setNormalizer('background-color', getBackgroundColorNormalizer());\n    stylesProcessor.setReducer('background', getBackgroundReducer());\n    stylesProcessor.setStyleRelation('background', ['background-color']);\n}\nfunction getBackgroundNormalizer() {\n    return value => {\n        const background = {};\n        const parts = getShorthandStylesValues(value);\n        for (const part of parts) {\n            if (isRepeatStyleValue(part)) {\n                background.repeat = background.repeat || [];\n                background.repeat.push(part);\n            }\n            else if (isPositionStyleValue(part)) {\n                background.position = background.position || [];\n                background.position.push(part);\n            }\n            else if (isAttachmentStyleValue(part)) {\n                background.attachment = part;\n            }\n            else if (isColorStyleValue(part)) {\n                background.color = part;\n            }\n            else if (isURLStyleValue(part)) {\n                background.image = part;\n            }\n        }\n        return {\n            path: 'background',\n            value: background\n        };\n    };\n}\nfunction getBackgroundColorNormalizer() {\n    return value => ({ path: 'background.color', value });\n}\nfunction getBackgroundReducer() {\n    return value => {\n        const ret = [];\n        ret.push(['background-color', value.color]);\n        return ret;\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getShorthandStylesValues, getBoxSidesStyleValueReducer, getBoxSidesStyleValues, isLengthStyleValue, isLineStyleValue } from './utils.js';\n/**\n * Adds a border CSS styles processing rules.\n *\n * ```ts\n * editor.data.addStyleProcessorRules( addBorderStylesRules );\n * ```\n *\n * This rules merges all [border](https://developer.mozilla.org/en-US/docs/Web/CSS/border) styles notation shorthands:\n *\n * - border\n * - border-top\n * - border-right\n * - border-bottom\n * - border-left\n * - border-color\n * - border-style\n * - border-width\n *\n * and all corresponding longhand forms (like `border-top-color`, `border-top-style`, etc).\n *\n * It does not handle other shorthands (like `border-radius` or `border-image`).\n *\n * The normalized model stores border values as:\n *\n * ```ts\n * const styles = {\n * \tborder: {\n * \t\tcolor: { top, right, bottom, left },\n * \t\tstyle: { top, right, bottom, left },\n * \t\twidth: { top, right, bottom, left },\n * \t}\n * };\n * ```\n */\nexport function addBorderStylesRules(stylesProcessor) {\n    stylesProcessor.setNormalizer('border', getBorderNormalizer());\n    // Border-position shorthands.\n    stylesProcessor.setNormalizer('border-top', getBorderPositionNormalizer('top'));\n    stylesProcessor.setNormalizer('border-right', getBorderPositionNormalizer('right'));\n    stylesProcessor.setNormalizer('border-bottom', getBorderPositionNormalizer('bottom'));\n    stylesProcessor.setNormalizer('border-left', getBorderPositionNormalizer('left'));\n    // Border-property shorthands.\n    stylesProcessor.setNormalizer('border-color', getBorderPropertyNormalizer('color'));\n    stylesProcessor.setNormalizer('border-width', getBorderPropertyNormalizer('width'));\n    stylesProcessor.setNormalizer('border-style', getBorderPropertyNormalizer('style'));\n    // Border longhands.\n    stylesProcessor.setNormalizer('border-top-color', getBorderPropertyPositionNormalizer('color', 'top'));\n    stylesProcessor.setNormalizer('border-top-style', getBorderPropertyPositionNormalizer('style', 'top'));\n    stylesProcessor.setNormalizer('border-top-width', getBorderPropertyPositionNormalizer('width', 'top'));\n    stylesProcessor.setNormalizer('border-right-color', getBorderPropertyPositionNormalizer('color', 'right'));\n    stylesProcessor.setNormalizer('border-right-style', getBorderPropertyPositionNormalizer('style', 'right'));\n    stylesProcessor.setNormalizer('border-right-width', getBorderPropertyPositionNormalizer('width', 'right'));\n    stylesProcessor.setNormalizer('border-bottom-color', getBorderPropertyPositionNormalizer('color', 'bottom'));\n    stylesProcessor.setNormalizer('border-bottom-style', getBorderPropertyPositionNormalizer('style', 'bottom'));\n    stylesProcessor.setNormalizer('border-bottom-width', getBorderPropertyPositionNormalizer('width', 'bottom'));\n    stylesProcessor.setNormalizer('border-left-color', getBorderPropertyPositionNormalizer('color', 'left'));\n    stylesProcessor.setNormalizer('border-left-style', getBorderPropertyPositionNormalizer('style', 'left'));\n    stylesProcessor.setNormalizer('border-left-width', getBorderPropertyPositionNormalizer('width', 'left'));\n    stylesProcessor.setExtractor('border-top', getBorderPositionExtractor('top'));\n    stylesProcessor.setExtractor('border-right', getBorderPositionExtractor('right'));\n    stylesProcessor.setExtractor('border-bottom', getBorderPositionExtractor('bottom'));\n    stylesProcessor.setExtractor('border-left', getBorderPositionExtractor('left'));\n    stylesProcessor.setExtractor('border-top-color', 'border.color.top');\n    stylesProcessor.setExtractor('border-right-color', 'border.color.right');\n    stylesProcessor.setExtractor('border-bottom-color', 'border.color.bottom');\n    stylesProcessor.setExtractor('border-left-color', 'border.color.left');\n    stylesProcessor.setExtractor('border-top-width', 'border.width.top');\n    stylesProcessor.setExtractor('border-right-width', 'border.width.right');\n    stylesProcessor.setExtractor('border-bottom-width', 'border.width.bottom');\n    stylesProcessor.setExtractor('border-left-width', 'border.width.left');\n    stylesProcessor.setExtractor('border-top-style', 'border.style.top');\n    stylesProcessor.setExtractor('border-right-style', 'border.style.right');\n    stylesProcessor.setExtractor('border-bottom-style', 'border.style.bottom');\n    stylesProcessor.setExtractor('border-left-style', 'border.style.left');\n    stylesProcessor.setReducer('border-color', getBoxSidesStyleValueReducer('border-color'));\n    stylesProcessor.setReducer('border-style', getBoxSidesStyleValueReducer('border-style'));\n    stylesProcessor.setReducer('border-width', getBoxSidesStyleValueReducer('border-width'));\n    stylesProcessor.setReducer('border-top', getBorderPositionReducer('top'));\n    stylesProcessor.setReducer('border-right', getBorderPositionReducer('right'));\n    stylesProcessor.setReducer('border-bottom', getBorderPositionReducer('bottom'));\n    stylesProcessor.setReducer('border-left', getBorderPositionReducer('left'));\n    stylesProcessor.setReducer('border', getBorderReducer());\n    stylesProcessor.setStyleRelation('border', [\n        'border-color', 'border-style', 'border-width',\n        'border-top', 'border-right', 'border-bottom', 'border-left',\n        'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color',\n        'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style',\n        'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width'\n    ]);\n    stylesProcessor.setStyleRelation('border-color', [\n        'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color'\n    ]);\n    stylesProcessor.setStyleRelation('border-style', [\n        'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style'\n    ]);\n    stylesProcessor.setStyleRelation('border-width', [\n        'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width'\n    ]);\n    stylesProcessor.setStyleRelation('border-top', ['border-top-color', 'border-top-style', 'border-top-width']);\n    stylesProcessor.setStyleRelation('border-right', ['border-right-color', 'border-right-style', 'border-right-width']);\n    stylesProcessor.setStyleRelation('border-bottom', ['border-bottom-color', 'border-bottom-style', 'border-bottom-width']);\n    stylesProcessor.setStyleRelation('border-left', ['border-left-color', 'border-left-style', 'border-left-width']);\n}\nfunction getBorderNormalizer() {\n    return value => {\n        const { color, style, width } = normalizeBorderShorthand(value);\n        return {\n            path: 'border',\n            value: {\n                color: getBoxSidesStyleValues(color),\n                style: getBoxSidesStyleValues(style),\n                width: getBoxSidesStyleValues(width)\n            }\n        };\n    };\n}\nfunction getBorderPositionNormalizer(side) {\n    return value => {\n        const { color, style, width } = normalizeBorderShorthand(value);\n        const border = {};\n        if (color !== undefined) {\n            border.color = { [side]: color };\n        }\n        if (style !== undefined) {\n            border.style = { [side]: style };\n        }\n        if (width !== undefined) {\n            border.width = { [side]: width };\n        }\n        return {\n            path: 'border',\n            value: border\n        };\n    };\n}\nfunction getBorderPropertyNormalizer(propertyName) {\n    return value => {\n        return {\n            path: 'border',\n            value: toBorderPropertyShorthand(value, propertyName)\n        };\n    };\n}\nfunction toBorderPropertyShorthand(value, property) {\n    return {\n        [property]: getBoxSidesStyleValues(value)\n    };\n}\nfunction getBorderPropertyPositionNormalizer(property, side) {\n    return value => {\n        return {\n            path: 'border',\n            value: {\n                [property]: {\n                    [side]: value\n                }\n            }\n        };\n    };\n}\nfunction getBorderPositionExtractor(which) {\n    return (name, styles) => {\n        if (styles.border) {\n            return extractBorderPosition(styles.border, which);\n        }\n    };\n}\nfunction extractBorderPosition(border, which) {\n    const value = {};\n    if (border.width && border.width[which]) {\n        value.width = border.width[which];\n    }\n    if (border.style && border.style[which]) {\n        value.style = border.style[which];\n    }\n    if (border.color && border.color[which]) {\n        value.color = border.color[which];\n    }\n    return value;\n}\nfunction normalizeBorderShorthand(string) {\n    const result = {};\n    const parts = getShorthandStylesValues(string);\n    for (const part of parts) {\n        if (isLengthStyleValue(part) || /thin|medium|thick/.test(part)) {\n            result.width = part;\n        }\n        else if (isLineStyleValue(part)) {\n            result.style = part;\n        }\n        else {\n            result.color = part;\n        }\n    }\n    return result;\n}\n/**\n * The border reducer factory.\n *\n * It tries to produce the most optimal output for the specified styles.\n *\n * For a border style:\n *\n * ```css\n * style: {top: \"solid\", bottom: \"solid\", right: \"solid\", left: \"solid\"}\n * ```\n *\n * It will produce: `border-style: solid`.\n * For a border style and color:\n *\n * ```css\n * color: {top: \"#ff0\", bottom: \"#ff0\", right: \"#ff0\", left: \"#ff0\"}\n * style: {top: \"solid\", bottom: \"solid\", right: \"solid\", left: \"solid\"}\n * ```\n *\n * It will produce: `border-color: #ff0; border-style: solid`.\n * If all border parameters are specified:\n *\n * ```css\n * color: {top: \"#ff0\", bottom: \"#ff0\", right: \"#ff0\", left: \"#ff0\"}\n * style: {top: \"solid\", bottom: \"solid\", right: \"solid\", left: \"solid\"}\n * width: {top: \"2px\", bottom: \"2px\", right: \"2px\", left: \"2px\"}\n * ```\n *\n * It will combine everything into a single property: `border: 2px solid #ff0`.\n *\n * The definitions are merged only if all border selectors have the same values.\n */\nfunction getBorderReducer() {\n    return value => {\n        const topStyles = extractBorderPosition(value, 'top');\n        const rightStyles = extractBorderPosition(value, 'right');\n        const bottomStyles = extractBorderPosition(value, 'bottom');\n        const leftStyles = extractBorderPosition(value, 'left');\n        const borderStyles = [topStyles, rightStyles, bottomStyles, leftStyles];\n        const borderStylesByType = {\n            width: getReducedStyleValueForType(borderStyles, 'width'),\n            style: getReducedStyleValueForType(borderStyles, 'style'),\n            color: getReducedStyleValueForType(borderStyles, 'color')\n        };\n        // Try reducing to a single `border:` property.\n        const reducedBorderStyle = reduceBorderPosition(borderStylesByType, 'all');\n        if (reducedBorderStyle.length) {\n            return reducedBorderStyle;\n        }\n        // Try reducing to `border-style:`, `border-width:`, `border-color:` properties.\n        const reducedStyleTypes = Object.entries(borderStylesByType).reduce((reducedStyleTypes, [type, value]) => {\n            if (value) {\n                reducedStyleTypes.push([`border-${type}`, value]);\n                // Remove it from the full set to not include it in the most specific properties later.\n                borderStyles.forEach(style => delete style[type]);\n            }\n            return reducedStyleTypes;\n        }, []);\n        // The reduced properties (by type) and all that remains that could not be reduced.\n        return [\n            ...reducedStyleTypes,\n            ...reduceBorderPosition(topStyles, 'top'),\n            ...reduceBorderPosition(rightStyles, 'right'),\n            ...reduceBorderPosition(bottomStyles, 'bottom'),\n            ...reduceBorderPosition(leftStyles, 'left')\n        ];\n    };\n    /**\n     * @param styles The array of objects with `style`, `color`, `width` properties.\n     */\n    function getReducedStyleValueForType(styles, type) {\n        return styles\n            .map(style => style[type])\n            .reduce((result, style) => result == style ? result : null);\n    }\n}\nfunction getBorderPositionReducer(which) {\n    return value => reduceBorderPosition(value, which);\n}\n/**\n * Returns an array with reduced border styles depending on the specified values.\n *\n * If all border properties (width, style, color) are specified, the returned selector will be\n * merged into a group: `border-*: [width] [style] [color]`.\n *\n * Otherwise, the specific definitions will be returned: `border-(width|style|color)-*: [value]`.\n *\n * @param value Styles if defined.\n * @param which The border position.\n */\nfunction reduceBorderPosition(value, which) {\n    const borderTypes = [];\n    if (value && (value.width)) {\n        borderTypes.push('width');\n    }\n    if (value && (value.style)) {\n        borderTypes.push('style');\n    }\n    if (value && (value.color)) {\n        borderTypes.push('color');\n    }\n    if (borderTypes.length == 3) {\n        const borderValue = borderTypes.map(item => value[item]).join(' ');\n        return [\n            which == 'all' ? ['border', borderValue] : [`border-${which}`, borderValue]\n        ];\n    }\n    // We are unable to reduce to a single `border:` property.\n    if (which == 'all') {\n        return [];\n    }\n    return borderTypes.map(type => {\n        return [`border-${which}-${type}`, value[type]];\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getPositionStyleShorthandNormalizer, getBoxSidesStyleValueReducer } from './utils.js';\n/**\n * Adds a margin CSS styles processing rules.\n *\n * ```ts\n * editor.data.addStyleProcessorRules( addMarginStylesRules );\n * ```\n *\n * The normalized value is stored as:\n *\n * ```ts\n * const styles = {\n * \tmargin: {\n * \t\ttop,\n * \t\tright,\n * \t\tbottom,\n * \t\tleft\n * \t}\n * };\n * ```\n */\nexport function addMarginStylesRules(stylesProcessor) {\n    stylesProcessor.setNormalizer('margin', getPositionStyleShorthandNormalizer('margin'));\n    stylesProcessor.setNormalizer('margin-top', value => ({ path: 'margin.top', value }));\n    stylesProcessor.setNormalizer('margin-right', value => ({ path: 'margin.right', value }));\n    stylesProcessor.setNormalizer('margin-bottom', value => ({ path: 'margin.bottom', value }));\n    stylesProcessor.setNormalizer('margin-left', value => ({ path: 'margin.left', value }));\n    stylesProcessor.setReducer('margin', getBoxSidesStyleValueReducer('margin'));\n    stylesProcessor.setStyleRelation('margin', ['margin-top', 'margin-right', 'margin-bottom', 'margin-left']);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getPositionStyleShorthandNormalizer, getBoxSidesStyleValueReducer } from './utils.js';\n/**\n * Adds a padding CSS styles processing rules.\n *\n * ```ts\n * editor.data.addStyleProcessorRules( addPaddingStylesRules );\n * ```\n *\n * The normalized value is stored as:\n *\n * ```ts\n * const styles = {\n * \tpadding: {\n * \t\ttop,\n * \t\tright,\n * \t\tbottom,\n * \t\tleft\n * \t}\n * };\n * ```\n */\nexport function addPaddingStylesRules(stylesProcessor) {\n    stylesProcessor.setNormalizer('padding', getPositionStyleShorthandNormalizer('padding'));\n    stylesProcessor.setNormalizer('padding-top', value => ({ path: 'padding.top', value }));\n    stylesProcessor.setNormalizer('padding-right', value => ({ path: 'padding.right', value }));\n    stylesProcessor.setNormalizer('padding-bottom', value => ({ path: 'padding.bottom', value }));\n    stylesProcessor.setNormalizer('padding-left', value => ({ path: 'padding.left', value }));\n    stylesProcessor.setReducer('padding', getBoxSidesStyleValueReducer('padding'));\n    stylesProcessor.setStyleRelation('padding', ['padding-top', 'padding-right', 'padding-bottom', 'padding-left']);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Note: This package is used only internally for debugging purposes and should not be used\n * in other environments. It uses a few special methods not existing in the default\n * building process. That is also why there are no tests for this file.\n *\n * @module engine/dev-utils/utils\n */\n// @if CK_DEBUG_TYPING // const { debounce } = require( 'es-toolkit/compat' );\n/**\n * Helper function, converts a map to the 'key1=\"value1\" key2=\"value1\"' format.\n *\n * @param map Map to convert.\n * @returns Converted map.\n * @internal\n */\nexport function convertMapToTags(map) {\n    let string = '';\n    for (const entry of map) {\n        string += ` ${entry[0]}=${JSON.stringify(entry[1])}`;\n    }\n    return string;\n}\n/**\n * Helper function, converts a map to the `{\"key1\":\"value1\",\"key2\":\"value2\"}` format.\n *\n * @param map Map to convert.\n * @returns Converted map.\n * @internal\n */\nexport function convertMapToStringifiedObject(map) {\n    const obj = {};\n    for (const entry of map) {\n        obj[entry[0]] = entry[1];\n    }\n    return JSON.stringify(obj);\n}\nconst treeDump = Symbol('_treeDump');\nconst maxTreeDumpLength = 20;\n/**\n * Helper function that stores the `document` state for a given `version`.\n *\n * @internal\n */\nexport function dumpTrees(document, version) {\n    console.log(document, version);\n    let string = '';\n    for (const root of document.roots) {\n        string += root.printTree() + '\\n';\n    }\n    document[treeDump][version] = string.substr(0, string.length - 1); // Remove the last \"\\n\".\n    const overflow = document[treeDump].length - maxTreeDumpLength;\n    if (overflow > 0) {\n        document[treeDump][overflow - 1] = null;\n    }\n}\n/**\n * Helper function that initializes document dumping.\n *\n * @internal\n */\nexport function initDocumentDumping(document) {\n    document[treeDump] = [];\n}\n/**\n * Helper function that logs document for the given version.\n *\n * @internal\n */\nexport function logDocument(document, version) {\n    console.log('--------------------');\n    if (document[treeDump][version]) {\n        console.log(document[treeDump][version]);\n    }\n    else {\n        console.log('Tree log unavailable for given version: ' + version);\n    }\n}\n// @if CK_DEBUG_TYPING // export const _debouncedLine = debounce( () => {\n// @if CK_DEBUG_TYPING // \tconsole.log(\n// @if CK_DEBUG_TYPING // \t\t'%c───────────────────────────────────────────────────────────────────────────────────────────────────────',\n// @if CK_DEBUG_TYPING // \t\t'font-weight: bold; color: red'\n// @if CK_DEBUG_TYPING // \t);\n// @if CK_DEBUG_TYPING // }, 300 );\n// @if CK_DEBUG_TYPING // export function _buildLogMessage( context, className, message = '', ...rest ) {\n// @if CK_DEBUG_TYPING // \tconst editor = _findAllEditorInstances().find( editor => (\n// @if CK_DEBUG_TYPING // \t\t_getLogNodes( editor ).includes( context )\n// @if CK_DEBUG_TYPING // \t) );\n// @if CK_DEBUG_TYPING // \tconst editorName = editor && Object.getPrototypeOf( editor ).constructor.name;\n// @if CK_DEBUG_TYPING // \tconst editorPrefix = editor ? `${ editorName }-${ editor.id.slice( -4 ) } ` : 'UNKNOWN ';\n// @if CK_DEBUG_TYPING // \treturn [\n// @if CK_DEBUG_TYPING // \t\t`%c${ editorPrefix }%c[${ className }]%c ${ message }`,\n// @if CK_DEBUG_TYPING //\t\t'font-weight: normal;',\n// @if CK_DEBUG_TYPING //\t\t'font-weight: bold; color: green',\n// @if CK_DEBUG_TYPING //\t\t'',\n// @if CK_DEBUG_TYPING // \t\t...rest\n// @if CK_DEBUG_TYPING // \t];\n// @if CK_DEBUG_TYPING // }\n// @if CK_DEBUG_TYPING // function _findAllEditorInstances() {\n// @if CK_DEBUG_TYPING // \tconst editors = new Set();\n// @if CK_DEBUG_TYPING // \tfor ( const domEditable of document.querySelectorAll( '.ck.ck-content.ck-editor__editable' ) ) {\n// @if CK_DEBUG_TYPING // \t\tif ( domEditable.ckeditorInstance ) {\n// @if CK_DEBUG_TYPING // \t\t\teditors.add( domEditable.ckeditorInstance );\n// @if CK_DEBUG_TYPING // \t\t}\n// @if CK_DEBUG_TYPING // \t}\n// @if CK_DEBUG_TYPING // \treturn Array.from( editors );\n// @if CK_DEBUG_TYPING // }\n// @if CK_DEBUG_TYPING // function _getLogNodes( editor ) {\n// @if CK_DEBUG_TYPING // \treturn [\n// @if CK_DEBUG_TYPING // \t\teditor.editing.view._renderer,\n// @if CK_DEBUG_TYPING // \t\teditor.editing.view.domConverter,\n// @if CK_DEBUG_TYPING // \t\t...editor.editing.view._observers.values(),\n// @if CK_DEBUG_TYPING // \t\teditor.plugins.get( 'Input' ),\n// @if CK_DEBUG_TYPING // \t\teditor.plugins.get( 'Input' )._typingQueue,\n// @if CK_DEBUG_TYPING // \t\teditor.plugins.get( 'WidgetTypeAround' ),\n// @if CK_DEBUG_TYPING // \t\teditor.commands.get( 'delete' ),\n// @if CK_DEBUG_TYPING // \t\teditor.commands.get( 'deleteForward' )\n// @if CK_DEBUG_TYPING // \t];\n// @if CK_DEBUG_TYPING // }\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { EditorUI, DialogView, normalizeToolbarConfig } from 'ckeditor5/src/ui.js';\nimport { enableViewPlaceholder } from 'ckeditor5/src/engine.js';\nimport { ElementReplacer, Rect } from 'ckeditor5/src/utils.js';\n/**\n * The classic editor UI class.\n */\nexport class ClassicEditorUI extends EditorUI {\n    /**\n     * The main (top–most) view of the editor UI.\n     */\n    view;\n    /**\n     * A normalized `config.toolbar` object.\n     */\n    _toolbarConfig;\n    /**\n     * The element replacer instance used to hide the editor's source element.\n     */\n    _elementReplacer;\n    /**\n     * Creates an instance of the classic editor UI class.\n     *\n     * @param editor The editor instance.\n     * @param view The view of the UI.\n     */\n    constructor(editor, view) {\n        super(editor);\n        this.view = view;\n        this._toolbarConfig = normalizeToolbarConfig(editor.config.get('toolbar'));\n        this._elementReplacer = new ElementReplacer();\n        this.listenTo(editor.editing.view, 'scrollToTheSelection', this._handleScrollToTheSelectionWithStickyPanel.bind(this));\n    }\n    /**\n     * @inheritDoc\n     */\n    get element() {\n        return this.view.element;\n    }\n    /**\n     * Initializes the UI.\n     *\n     * @param replacementElement The DOM element that will be the source for the created editor.\n     */\n    init(replacementElement) {\n        const editor = this.editor;\n        const view = this.view;\n        const editingView = editor.editing.view;\n        const editable = view.editable;\n        const editingRoot = editingView.document.getRoot();\n        // The editable UI and editing root should share the same name. Then name is used\n        // to recognize the particular editable, for instance in ARIA attributes.\n        editable.name = editingRoot.rootName;\n        view.render();\n        // The editable UI element in DOM is available for sure only after the editor UI view has been rendered.\n        // But it can be available earlier if a DOM element has been passed to BalloonEditor.create().\n        const editableElement = editable.element;\n        // Register the editable UI view in the editor. A single editor instance can aggregate multiple\n        // editable areas (roots) but the classic editor has only one.\n        this.setEditableElement(editable.name, editableElement);\n        // Let the editable UI element respond to the changes in the global editor focus\n        // tracker. It has been added to the same tracker a few lines above but, in reality, there are\n        // many focusable areas in the editor, like balloons, toolbars or dropdowns and as long\n        // as they have focus, the editable should act like it is focused too (although technically\n        // it isn't), e.g. by setting the proper CSS class, visually announcing focus to the user.\n        // Doing otherwise will result in editable focus styles disappearing, once e.g. the\n        // toolbar gets focused.\n        view.editable.bind('isFocused').to(this.focusTracker);\n        // Bind the editable UI element to the editing view, making it an end– and entry–point\n        // of the editor's engine. This is where the engine meets the UI.\n        editingView.attachDomRoot(editableElement);\n        // If an element containing the initial data of the editor was provided, replace it with\n        // an editor instance's UI in DOM until the editor is destroyed. For instance, a <textarea>\n        // can be such element.\n        if (replacementElement) {\n            this._elementReplacer.replace(replacementElement, this.element);\n        }\n        this._initPlaceholder();\n        this._initToolbar();\n        if (view.menuBarView) {\n            this.initMenuBar(view.menuBarView);\n        }\n        this._initDialogPluginIntegration();\n        this._initContextualBalloonIntegration();\n        this.fire('ready');\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        const view = this.view;\n        const editingView = this.editor.editing.view;\n        this._elementReplacer.restore();\n        if (editingView.getDomRoot(view.editable.name)) {\n            editingView.detachDomRoot(view.editable.name);\n        }\n        view.destroy();\n    }\n    /**\n     * Initializes the editor toolbar.\n     */\n    _initToolbar() {\n        const view = this.view;\n        // Set–up the sticky panel with toolbar.\n        view.stickyPanel.bind('isActive').to(this.focusTracker, 'isFocused');\n        view.stickyPanel.limiterElement = view.element;\n        view.stickyPanel.bind('viewportTopOffset').to(this, 'viewportOffset', ({ visualTop }) => visualTop || 0);\n        view.toolbar.fillFromConfig(this._toolbarConfig, this.componentFactory);\n        // Register the toolbar so it becomes available for Alt+F10 and Esc navigation.\n        this.addToolbar(view.toolbar);\n    }\n    /**\n     * Enable the placeholder text on the editing root.\n     */\n    _initPlaceholder() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const editingRoot = editingView.document.getRoot();\n        const sourceElement = editor.sourceElement;\n        let placeholderText;\n        const placeholder = editor.config.get('placeholder');\n        if (placeholder) {\n            placeholderText = typeof placeholder === 'string' ? placeholder : placeholder[this.view.editable.name];\n        }\n        if (!placeholderText && sourceElement && sourceElement.tagName.toLowerCase() === 'textarea') {\n            placeholderText = sourceElement.getAttribute('placeholder');\n        }\n        if (placeholderText) {\n            editingRoot.placeholder = placeholderText;\n        }\n        enableViewPlaceholder({\n            view: editingView,\n            element: editingRoot,\n            isDirectHost: false,\n            keepOnFocus: true\n        });\n    }\n    /**\n     * Provides an integration between the sticky toolbar and {@link module:ui/panel/balloon/contextualballoon contextual balloon plugin}.\n     * It allows the contextual balloon to consider the height of the\n     * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel}. It prevents the balloon from overlapping\n     * the sticky toolbar by adjusting the balloon's position using viewport offset configuration.\n     */\n    _initContextualBalloonIntegration() {\n        if (!this.editor.plugins.has('ContextualBalloon')) {\n            return;\n        }\n        const { stickyPanel } = this.view;\n        const contextualBalloon = this.editor.plugins.get('ContextualBalloon');\n        contextualBalloon.on('getPositionOptions', evt => {\n            const position = evt.return;\n            if (!position || !stickyPanel.isSticky || !stickyPanel.element) {\n                return;\n            }\n            // Measure toolbar (and menu bar) height.\n            const stickyPanelHeight = new Rect(stickyPanel.element).height;\n            // Handle edge case when the target element is larger than the limiter.\n            // It's an issue because the contextual balloon can overlap top table cells when the table is larger than the viewport\n            // and it's placed at the top of the editor. It's better to overlap toolbar in that situation.\n            // Check this issue: https://github.com/ckeditor/ckeditor5/issues/15744\n            const target = typeof position.target === 'function' ? position.target() : position.target;\n            const limiter = typeof position.limiter === 'function' ? position.limiter() : position.limiter;\n            if (target && limiter && new Rect(target).height >= new Rect(limiter).height - stickyPanelHeight) {\n                return;\n            }\n            // Ensure that viewport offset is present, it can be undefined according to the typing.\n            const viewportOffsetConfig = { ...position.viewportOffsetConfig };\n            const newTopViewportOffset = (viewportOffsetConfig.top || 0) + stickyPanelHeight;\n            evt.return = {\n                ...position,\n                viewportOffsetConfig: {\n                    ...viewportOffsetConfig,\n                    top: newTopViewportOffset\n                }\n            };\n        }, { priority: 'low' });\n        // Update balloon position when the toolbar becomes sticky or when ui viewportOffset changes.\n        const updateBalloonPosition = () => {\n            if (contextualBalloon.visibleView) {\n                contextualBalloon.updatePosition();\n            }\n        };\n        this.listenTo(stickyPanel, 'change:isSticky', updateBalloonPosition);\n        this.listenTo(this.editor.ui, 'change:viewportOffset', updateBalloonPosition);\n    }\n    /**\n     * Provides an integration between the sticky toolbar and {@link module:utils/dom/scroll~scrollViewportToShowTarget}.\n     * It allows the UI-agnostic engine method to consider the geometry of the\n     * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel} that pins to the\n     * edge of the viewport and can obscure the user caret after scrolling the window.\n     *\n     * @param evt The `scrollToTheSelection` event info.\n     * @param data The payload carried by the `scrollToTheSelection` event.\n     * @param originalArgs The original arguments passed to `scrollViewportToShowTarget()` method (see implementation to learn more).\n     */\n    _handleScrollToTheSelectionWithStickyPanel(evt, data, originalArgs) {\n        const stickyPanel = this.view.stickyPanel;\n        if (stickyPanel.isSticky) {\n            const stickyPanelHeight = new Rect(stickyPanel.element).height;\n            data.viewportOffset.top += stickyPanelHeight;\n        }\n        else {\n            const scrollViewportOnPanelGettingSticky = () => {\n                this.editor.editing.view.scrollToTheSelection(originalArgs);\n            };\n            this.listenTo(stickyPanel, 'change:isSticky', scrollViewportOnPanelGettingSticky);\n            // This works as a post-scroll-fixer because it's impossible predict whether the panel will be sticky after scrolling or not.\n            // Listen for a short period of time only and if the toolbar does not become sticky very soon, cancel the listener.\n            setTimeout(() => {\n                this.stopListening(stickyPanel, 'change:isSticky', scrollViewportOnPanelGettingSticky);\n            }, 20);\n        }\n    }\n    /**\n     * Provides an integration between the sticky toolbar and {@link module:ui/dialog/dialog the Dialog plugin}.\n     *\n     * It moves the dialog down to ensure that the\n     * {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#stickyPanel sticky panel}\n     * used by the editor UI will not get obscured by the dialog when the dialog uses one of its automatic positions.\n     */\n    _initDialogPluginIntegration() {\n        if (!this.editor.plugins.has('Dialog')) {\n            return;\n        }\n        const stickyPanel = this.view.stickyPanel;\n        const dialogPlugin = this.editor.plugins.get('Dialog');\n        dialogPlugin.on('show', () => {\n            const dialogView = dialogPlugin.view;\n            dialogView.on('moveTo', (evt, data) => {\n                // Engage only when the panel is sticky, and the dialog is using one of default positions.\n                // Ignore modals because they are displayed on top of the page (and overlay) and they do not collide with anything\n                // See (https://github.com/ckeditor/ckeditor5/issues/17339).\n                if (!stickyPanel.isSticky || dialogView.wasMoved || dialogView.isModal) {\n                    return;\n                }\n                const stickyPanelContentRect = new Rect(stickyPanel.contentPanelElement);\n                if (data[1] < stickyPanelContentRect.bottom + DialogView.defaultOffset) {\n                    data[1] = stickyPanelContentRect.bottom + DialogView.defaultOffset;\n                }\n            }, { priority: 'high' });\n        }, { priority: 'low' });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/bodycollection\n */\nimport { Template } from '../template.js';\nimport { ViewCollection } from '../viewcollection.js';\nimport { createElement } from '@ckeditor/ckeditor5-utils';\n/**\n * This is a special {@link module:ui/viewcollection~ViewCollection} dedicated to elements that are detached from the DOM structure of\n * the editor, like floating panels, floating toolbars, dialogs, etc.\n *\n * The body collection is available under the {@link module:ui/editorui/editoruiview~EditorUIView#body `editor.ui.view.body`} property.\n * Any plugin can add a {@link module:ui/view~View view} to this collection.\n *\n * All views added to a body collection render in a dedicated DOM container (`<div class=\"ck ck-body ...\">...</div>`). All body collection\n * containers render in a common shared (`<div class=\"ck-body-wrapper\">...</div>`) in the DOM to limit the pollution of\n * the `<body>` element. The resulting DOM structure is as follows:\n *\n * ```html\n * <body>\n * \t<!-- Content of the webpage... -->\n *\n * \t<!-- The shared wrapper for all body collection containers. -->\n * \t<div class=\"ck-body-wrapper\">\n * \t\t<!-- The container of the first body collection instance. -->\n * \t\t<div class=\"ck ck-body ...\">\n * \t\t\t<!-- View elements belonging to the first body collection -->\n * \t\t</div>\n *\n * \t\t<!-- The container of the second body collection instance. -->\n * \t\t<div class=\"ck ck-body ...\">...</div>\n *\n * \t\t<!-- More body collection containers for the rest of instances... -->\n * \t</div>\n * </body>\n * ```\n *\n * By default, the {@link module:ui/editorui/editoruiview~EditorUIView `editor.ui.view`} manages the life cycle of the\n * {@link module:ui/editorui/editoruiview~EditorUIView#body `editor.ui.view.body`} collection, attaching and detaching it\n * when the editor gets created or {@link module:core/editor/editor~Editor#destroy destroyed}.\n *\n * # Custom body collection instances\n *\n * Even though most editor instances come with a built-in body collection\n * ({@link module:ui/editorui/editoruiview~EditorUIView#body `editor.ui.view.body`}), you can create your own instance of this\n * class if you need to control their life cycle.\n *\n * The life cycle of a custom body collection must be handled manually by the developer using the dedicated API:\n * * A body collection will render itself automatically in the DOM as soon as you call {@link ~BodyCollection#attachToDom}.\n * * Calling {@link ~BodyCollection#detachFromDom} will remove the collection from the DOM.\n *\n * **Note**: The shared collection wrapper (`<div class=\"ck-body-wrapper\">...</div>`) gets automatically removed from DOM when the\n * last body collection is {@link ~BodyCollection#detachFromDom detached} and does not require any special handling.\n */\nexport class BodyCollection extends ViewCollection {\n    /**\n     * The {@link module:core/editor/editor~Editor#locale editor's locale} instance.\n     * See the view {@link module:ui/view~View#locale locale} property.\n     */\n    locale;\n    /**\n     * The element holding elements of the body collection.\n     */\n    _bodyCollectionContainer;\n    /**\n     * The wrapper element that holds all of the {@link #_bodyCollectionContainer} elements.\n     */\n    static _bodyWrapper;\n    /**\n     * Creates a new instance of the {@link module:ui/editorui/bodycollection~BodyCollection}.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor editor's locale} instance.\n     * @param initialItems The initial items of the collection.\n     */\n    constructor(locale, initialItems = []) {\n        super(initialItems);\n        this.locale = locale;\n    }\n    /**\n     * The element holding elements of the body collection.\n     */\n    get bodyCollectionContainer() {\n        return this._bodyCollectionContainer;\n    }\n    /**\n     * Attaches the body collection to the DOM body element. You need to execute this method to render the content of\n     * the body collection.\n     */\n    attachToDom() {\n        this._bodyCollectionContainer = new Template({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-reset_all',\n                    'ck-body',\n                    'ck-rounded-corners'\n                ],\n                dir: this.locale.uiLanguageDirection,\n                role: 'application'\n            },\n            children: this\n        }).render();\n        // Create a shared wrapper if there were none or the previous one got disconnected from DOM.\n        if (!BodyCollection._bodyWrapper || !BodyCollection._bodyWrapper.isConnected) {\n            BodyCollection._bodyWrapper = createElement(document, 'div', { class: 'ck-body-wrapper' });\n            document.body.appendChild(BodyCollection._bodyWrapper);\n        }\n        BodyCollection._bodyWrapper.appendChild(this._bodyCollectionContainer);\n    }\n    /**\n     * Detaches the collection from the DOM structure. Use this method when you do not need to use the body collection\n     * anymore to clean-up the DOM structure.\n     */\n    detachFromDom() {\n        super.destroy();\n        if (this._bodyCollectionContainer) {\n            this._bodyCollectionContainer.remove();\n        }\n        if (BodyCollection._bodyWrapper && !BodyCollection._bodyWrapper.childElementCount) {\n            BodyCollection._bodyWrapper.remove();\n            delete BodyCollection._bodyWrapper;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/editoruiview\n */\nimport { View } from '../view.js';\nimport { BodyCollection } from './bodycollection.js';\nimport '../../theme/components/editorui/editorui.css';\n/**\n * The editor UI view class. Base class for the editor main views.\n */\nexport class EditorUIView extends View {\n    /**\n     * Collection of the child views, detached from the DOM\n     * structure of the editor, like panels, icons etc.\n     */\n    body;\n    /**\n     * Menu bar view instance. Initialized by default in:\n     *\n     * * balloon editor;\n     * * decoupled editor;\n     * * multiroot editor.\n     */\n    menuBarView;\n    /**\n     * Toolbar view instance. Initialized by default in:\n     *\n     * * classic editor;\n     * * decoupled editor;\n     * * inline editor;\n     * * multiroot editor.\n     */\n    toolbar;\n    /**\n     * Creates an instance of the editor UI view class.\n     *\n     * @param locale The locale instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.body = new BodyCollection(locale);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.body.attachToDom();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this.body.detachFromDom();\n        return super.destroy();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/label/labelview\n */\nimport { View } from '../view.js';\nimport { uid } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/label/label.css';\n/**\n * The label view class.\n */\nexport class LabelView extends View {\n    /**\n     * An unique id of the label. It can be used by other UI components to reference\n     * the label, for instance, using the `aria-describedby` DOM attribute.\n     */\n    id;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.set('text', undefined);\n        this.set('for', undefined);\n        this.id = `ck-editor__label_${uid()}`;\n        const bind = this.bindTemplate;\n        this.setTemplate({\n            tag: 'label',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-label'\n                ],\n                id: this.id,\n                for: bind.to('for')\n            },\n            children: [\n                {\n                    text: bind.to('text')\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/boxed/boxededitoruiview\n */\nimport { EditorUIView } from '../editoruiview.js';\nimport { LabelView } from '../../label/labelview.js';\n/**\n * The boxed editor UI view class. This class represents an editor interface\n * consisting of a toolbar and an editable area, enclosed within a box.\n */\nexport class BoxedEditorUIView extends EditorUIView {\n    /**\n     * Collection of the child views located in the top (`.ck-editor__top`)\n     * area of the UI.\n     */\n    top;\n    /**\n     * Collection of the child views located in the main (`.ck-editor__main`)\n     * area of the UI.\n     */\n    main;\n    /**\n     * Voice label of the UI.\n     */\n    _voiceLabelView;\n    /**\n     * Creates an instance of the boxed editor UI view class.\n     *\n     * @param locale The locale instance..\n     */\n    constructor(locale) {\n        super(locale);\n        this.top = this.createCollection();\n        this.main = this.createCollection();\n        this._voiceLabelView = this._createVoiceLabel();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-reset',\n                    'ck-editor',\n                    'ck-rounded-corners'\n                ],\n                role: 'application',\n                dir: locale.uiLanguageDirection,\n                lang: locale.uiLanguage,\n                'aria-labelledby': this._voiceLabelView.id\n            },\n            children: [\n                this._voiceLabelView,\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-editor__top',\n                            'ck-reset_all'\n                        ],\n                        role: 'presentation'\n                    },\n                    children: this.top\n                },\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-editor__main'\n                        ],\n                        role: 'presentation'\n                    },\n                    children: this.main\n                }\n            ]\n        });\n    }\n    /**\n     * Creates a voice label view instance.\n     */\n    _createVoiceLabel() {\n        const t = this.t;\n        const voiceLabel = new LabelView();\n        voiceLabel.text = t('Rich Text Editor');\n        voiceLabel.extendTemplate({\n            attributes: {\n                class: 'ck-voice-label'\n            }\n        });\n        return voiceLabel;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/panel/sticky/stickypanelview\n */\nimport { View } from '../../view.js';\nimport { Template } from '../../template.js';\nimport { Rect, toUnit, getVisualViewportOffset, global } from '@ckeditor/ckeditor5-utils';\n// @if CK_DEBUG_STICKYPANEL // const {\n// @if CK_DEBUG_STICKYPANEL // \tdefault: RectDrawer,\n// @if CK_DEBUG_STICKYPANEL // \tdiagonalStylesBlack\n// @if CK_DEBUG_STICKYPANEL // } = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' );\nimport '../../../theme/components/panel/stickypanel.css';\nconst toPx = /* #__PURE__ */ toUnit('px');\n/**\n * The sticky panel view class.\n */\nexport class StickyPanelView extends View {\n    /**\n     * Collection of the child views which creates balloon panel contents.\n     */\n    content;\n    /**\n     * The panel which accepts children into {@link #content} collection.\n     * Also an element which is positioned when {@link #isSticky}.\n     */\n    contentPanelElement;\n    /**\n     * A dummy element which visually fills the space as long as the\n     * actual panel is sticky. It prevents flickering of the UI.\n     */\n    _contentPanelPlaceholder;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('isActive', false);\n        this.set('isSticky', false);\n        this.set('limiterElement', null);\n        this.set('limiterBottomOffset', 50);\n        this.set('viewportTopOffset', 0);\n        this.set('_marginLeft', null);\n        this.set('_isStickyToTheBottomOfLimiter', false);\n        this.set('_stickyTopOffset', null);\n        this.set('_stickyBottomOffset', null);\n        this.content = this.createCollection();\n        this._contentPanelPlaceholder = new Template({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-sticky-panel__placeholder'\n                ],\n                style: {\n                    display: bind.to('isSticky', isSticky => isSticky ? 'block' : 'none'),\n                    height: bind.to('isSticky', isSticky => {\n                        return isSticky ? toPx(this._contentPanelRect.height) : null;\n                    })\n                }\n            }\n        }).render();\n        this.contentPanelElement = new Template({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-sticky-panel__content',\n                    // Toggle class of the panel when \"sticky\" state changes in the view.\n                    bind.if('isSticky', 'ck-sticky-panel__content_sticky'),\n                    bind.if('_isStickyToTheBottomOfLimiter', 'ck-sticky-panel__content_sticky_bottom-limit')\n                ],\n                style: {\n                    width: bind.to('isSticky', isSticky => {\n                        return isSticky ? toPx(this._contentPanelPlaceholder.getBoundingClientRect().width) : null;\n                    }),\n                    top: bind.to('_stickyTopOffset', value => value ? toPx(value) : value),\n                    bottom: bind.to('_stickyBottomOffset', value => value ? toPx(value) : value),\n                    marginLeft: bind.to('_marginLeft')\n                }\n            },\n            children: this.content\n        }).render();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-sticky-panel'\n                ]\n            },\n            children: [\n                this._contentPanelPlaceholder,\n                this.contentPanelElement\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Check if the panel should go into the sticky state immediately.\n        this.checkIfShouldBeSticky();\n        // Update sticky state of the panel as the window and ancestors are being scrolled.\n        this.listenTo(global.document, 'scroll', () => {\n            this.checkIfShouldBeSticky();\n        }, { useCapture: true });\n        // Synchronize with `model.isActive` because sticking an inactive panel is pointless.\n        this.listenTo(this, 'change:isActive', () => {\n            this.checkIfShouldBeSticky();\n        });\n        if (global.window.visualViewport) {\n            this.listenTo(global.window.visualViewport, 'scroll', () => {\n                this.checkIfShouldBeSticky();\n            });\n            this.listenTo(global.window.visualViewport, 'resize', () => {\n                this.checkIfShouldBeSticky();\n            });\n        }\n    }\n    /**\n     * Analyzes the environment to decide whether the panel should be sticky or not.\n     * Then handles the positioning of the panel.\n     */\n    checkIfShouldBeSticky() {\n        // @if CK_DEBUG_STICKYPANEL // RectDrawer.clear();\n        if (!this.limiterElement || !this.isActive) {\n            this._unstick();\n            return;\n        }\n        const limiterRect = new Rect(this.limiterElement);\n        let visibleLimiterRect = limiterRect.getVisible();\n        if (visibleLimiterRect) {\n            const windowRect = new Rect(global.window);\n            windowRect.top += this.viewportTopOffset;\n            windowRect.height -= this.viewportTopOffset;\n            visibleLimiterRect = visibleLimiterRect.getIntersection(windowRect);\n        }\n        const { left: visualViewportOffsetLeft, top: visualViewportOffsetTop } = getVisualViewportOffset();\n        limiterRect.moveBy(visualViewportOffsetLeft, visualViewportOffsetTop);\n        if (visibleLimiterRect) {\n            visibleLimiterRect.moveBy(visualViewportOffsetLeft, visualViewportOffsetTop);\n        }\n        // Stick the panel only if\n        // * the limiter's ancestors are intersecting with each other so that some of their rects are visible,\n        // * and the limiter's top edge is above the visible ancestors' top edge.\n        if (visibleLimiterRect && limiterRect.top < visibleLimiterRect.top) {\n            // Check if there's a change the panel can be sticky to the bottom of the limiter.\n            if (this._contentPanelRect.height + this.limiterBottomOffset > visibleLimiterRect.height) {\n                const stickyBottomOffset = Math.max(limiterRect.bottom - visibleLimiterRect.bottom, 0) + this.limiterBottomOffset;\n                // @if CK_DEBUG_STICKYPANEL // const stickyBottomOffsetRect = new Rect( {\n                // @if CK_DEBUG_STICKYPANEL // \ttop: limiterRect.bottom - stickyBottomOffset, left: 0, right: 2000,\n                // @if CK_DEBUG_STICKYPANEL // \tbottom: limiterRect.bottom - stickyBottomOffset, width: 2000, height: 1\n                // @if CK_DEBUG_STICKYPANEL // } );\n                // @if CK_DEBUG_STICKYPANEL // RectDrawer.draw( stickyBottomOffsetRect,\n                // @if CK_DEBUG_STICKYPANEL // \t{ outlineWidth: '1px', opacity: '.8', outlineColor: 'black' },\n                // @if CK_DEBUG_STICKYPANEL // \t'Sticky bottom offset',\n                // @if CK_DEBUG_STICKYPANEL // \t{ visualViewportOrigin: true }\n                // @if CK_DEBUG_STICKYPANEL // );\n                // Check if sticking the panel to the bottom of the limiter does not cause it to suddenly\n                // move upwards if there's not enough space for it.\n                // To avoid toolbar flickering we are adding 1 for potential style change (sticky has all borders set,\n                // non-sticky lacks bottom border).\n                if (this._contentPanelRect.height + stickyBottomOffset + 1 < limiterRect.height) {\n                    this._stickToBottomOfLimiter(stickyBottomOffset);\n                }\n                else {\n                    this._unstick();\n                }\n            }\n            else if (this._contentPanelRect.height + this.limiterBottomOffset < limiterRect.height) {\n                this._stickToTopOfAncestors(visibleLimiterRect.top);\n            }\n            else {\n                this._unstick();\n            }\n        }\n        else {\n            this._unstick();\n        }\n        // @if CK_DEBUG_STICKYPANEL // console.clear();\n        // @if CK_DEBUG_STICKYPANEL // console.log( 'isSticky', this.isSticky );\n        // @if CK_DEBUG_STICKYPANEL // console.log( '_isStickyToTheBottomOfLimiter', this._isStickyToTheBottomOfLimiter );\n        // @if CK_DEBUG_STICKYPANEL // console.log( '_stickyTopOffset', this._stickyTopOffset );\n        // @if CK_DEBUG_STICKYPANEL // console.log( '_stickyBottomOffset', this._stickyBottomOffset );\n        // @if CK_DEBUG_STICKYPANEL // if ( visibleLimiterRect ) {\n        // @if CK_DEBUG_STICKYPANEL // \tRectDrawer.draw( visibleLimiterRect,\n        // @if CK_DEBUG_STICKYPANEL // \t\t{ ...diagonalStylesBlack,\n        // @if CK_DEBUG_STICKYPANEL // \t\t\toutlineWidth: '3px', opacity: '.8', outlineColor: 'orange', outlineOffset: '-3px',\n        // @if CK_DEBUG_STICKYPANEL // \t\t\tbackgroundColor: 'rgba(0, 0, 255, .2)', zIndex: 2000 },\n        // @if CK_DEBUG_STICKYPANEL // \t\t'visibleLimiterRect',\n        // @if CK_DEBUG_STICKYPANEL // \t\t{ visualViewportOrigin: true }\n        // @if CK_DEBUG_STICKYPANEL // \t);\n        // @if CK_DEBUG_STICKYPANEL // }\n    }\n    /**\n     * Sticks the panel at the given CSS `top` offset.\n     *\n     * @private\n     * @param topOffset\n     */\n    _stickToTopOfAncestors(topOffset) {\n        this.isSticky = true;\n        this._isStickyToTheBottomOfLimiter = false;\n        this._stickyTopOffset = topOffset;\n        this._stickyBottomOffset = null;\n        this._marginLeft = toPx(-global.window.scrollX + getVisualViewportOffset().left);\n    }\n    /**\n     * Sticks the panel at the bottom of the limiter with a given CSS `bottom` offset.\n     *\n     * @private\n     * @param stickyBottomOffset\n     */\n    _stickToBottomOfLimiter(stickyBottomOffset) {\n        this.isSticky = true;\n        this._isStickyToTheBottomOfLimiter = true;\n        this._stickyTopOffset = null;\n        this._stickyBottomOffset = stickyBottomOffset;\n        this._marginLeft = toPx(-global.window.scrollX + getVisualViewportOffset().left);\n    }\n    /**\n     * Unsticks the panel putting it back to its original position.\n     *\n     * @private\n     */\n    _unstick() {\n        this.isSticky = false;\n        this._isStickyToTheBottomOfLimiter = false;\n        this._stickyTopOffset = null;\n        this._stickyBottomOffset = null;\n        this._marginLeft = null;\n    }\n    /**\n     * Returns the bounding rect of the {@link #contentPanelElement}.\n     *\n     * @private\n     */\n    get _contentPanelRect() {\n        return new Rect(this.contentPanelElement);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/toolbar/toolbarseparatorview\n */\nimport { View } from '../view.js';\n/**\n * The toolbar separator view class.\n */\nexport class ToolbarSeparatorView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-toolbar__separator'\n                ]\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/toolbar/toolbarlinebreakview\n */\nimport { View } from '../view.js';\n/**\n * The toolbar line break view class.\n */\nexport class ToolbarLineBreakView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-toolbar__line-break'\n                ]\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dropdown/dropdownpanelview\n */\nimport { View } from '../view.js';\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\n/**\n * The dropdown panel view class.\n *\n * See {@link module:ui/dropdown/dropdownview~DropdownView} to learn about the common usage.\n */\nexport class DropdownPanelView extends View {\n    /**\n     * Collection of the child views in this panel.\n     *\n     * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.\n     * See {@link module:ui/dropdown/utils~addListToDropdown} and\n     * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.\n     */\n    children;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('isVisible', false);\n        this.set('position', 'se');\n        this.children = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-reset',\n                    'ck-dropdown__panel',\n                    bind.to('position', value => `ck-dropdown__panel_${value}`),\n                    bind.if('isVisible', 'ck-dropdown__panel-visible')\n                ],\n                tabindex: '-1'\n            },\n            children: this.children,\n            on: {\n                // Drag and drop in the panel should not break the selection in the editor.\n                // https://github.com/ckeditor/ckeditor5-ui/issues/228\n                selectstart: bind.to(evt => {\n                    if (evt.target.tagName.toLocaleLowerCase() === 'input') {\n                        return;\n                    }\n                    evt.preventDefault();\n                })\n            }\n        });\n    }\n    /**\n     * Focuses the first view in the {@link #children} collection.\n     *\n     * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.\n     */\n    focus() {\n        if (this.children.length) {\n            const firstChild = this.children.first;\n            if (typeof firstChild.focus === 'function') {\n                firstChild.focus();\n            }\n            else {\n                /**\n                 * The child view of a dropdown could not be focused because it is missing the `focus()` method.\n                 *\n                 * This warning appears when a dropdown {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open} and it\n                 * attempts to focus the {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children first child} of its panel\n                 * but the child does not implement the\n                 * {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable focusable interface}.\n                 *\n                 * Focusing the content of a dropdown on open greatly improves the accessibility. Please make sure the view instance\n                 * provides the `focus()` method for the best user experience.\n                 *\n                 * @error ui-dropdown-panel-focus-child-missing-focus\n                 * @param {module:ui/view~View} childView Child view.\n                 * @param {module:ui/dropdown/dropdownpanelview~DropdownPanelView} dropdownPanel A parent of a child.\n                 */\n                logWarning('ui-dropdown-panel-focus-child-missing-focus', { childView: this.children.first, dropdownPanel: this });\n            }\n        }\n    }\n    /**\n     * Focuses the view element or last item in view collection on opening dropdown's panel.\n     *\n     * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.\n     */\n    focusLast() {\n        if (this.children.length) {\n            const lastChild = this.children.last;\n            if (typeof lastChild.focusLast === 'function') {\n                lastChild.focusLast();\n            }\n            else {\n                lastChild.focus();\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dropdown/dropdownview\n */\nimport { View } from '../view.js';\nimport { KeystrokeHandler, FocusTracker, getOptimalPosition } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/dropdown/dropdown.css';\n/**\n * The dropdown view class. It manages the dropdown button and dropdown panel.\n *\n * In most cases, the easiest way to create a dropdown is by using the {@link module:ui/dropdown/utils~createDropdown}\n * util:\n *\n * ```ts\n * const dropdown = createDropdown( locale );\n *\n * // Configure dropdown's button properties:\n * dropdown.buttonView.set( {\n * \tlabel: 'A dropdown',\n * \twithText: true\n * } );\n *\n * dropdown.render();\n *\n * dropdown.panelView.element.textContent = 'Content of the panel';\n *\n * // Will render a dropdown with a panel containing a \"Content of the panel\" text.\n * document.body.appendChild( dropdown.element );\n * ```\n *\n * If you want to add a richer content to the dropdown panel, you can use the {@link module:ui/dropdown/utils~addListToDropdown}\n * and {@link module:ui/dropdown/utils~addToolbarToDropdown} helpers. See more examples in\n * {@link module:ui/dropdown/utils~createDropdown} documentation.\n *\n * If you want to create a completely custom dropdown, then you can compose it manually:\n *\n * ```ts\n * const button = new DropdownButtonView( locale );\n * const panel = new DropdownPanelView( locale );\n * const dropdown = new DropdownView( locale, button, panel );\n *\n * button.set( {\n * \tlabel: 'A dropdown',\n * \twithText: true\n * } );\n *\n * dropdown.render();\n *\n * panel.element.textContent = 'Content of the panel';\n *\n * // Will render a dropdown with a panel containing a \"Content of the panel\" text.\n * document.body.appendChild( dropdown.element );\n * ```\n *\n * However, dropdown created this way will contain little behavior. You will need to implement handlers for actions\n * such as {@link module:ui/bindings/clickoutsidehandler~clickOutsideHandler clicking outside an open dropdown}\n * (which should close it) and support for arrow keys inside the panel. Therefore, unless you really know what\n * you do and you really need to do it, it is recommended to use the {@link module:ui/dropdown/utils~createDropdown} helper.\n */\nexport class DropdownView extends View {\n    /**\n     * Button of the dropdown view. Clicking the button opens the {@link #panelView}.\n     */\n    buttonView;\n    /**\n     * Panel of the dropdown. It opens when the {@link #buttonView} is\n     * {@link module:ui/button/button~Button#event:execute executed} (i.e. clicked).\n     *\n     * Child views can be added to the panel's `children` collection:\n     *\n     * ```ts\n     * dropdown.panelView.children.add( childView );\n     * ```\n     *\n     * See {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children} and\n     * {@link module:ui/viewcollection~ViewCollection#add}.\n     */\n    panelView;\n    /**\n     * Tracks information about the DOM focus in the dropdown.\n     */\n    focusTracker;\n    /**\n     * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages\n     * keystrokes of the dropdown:\n     *\n     * * <kbd>▼</kbd> opens the dropdown,\n     * * <kbd>◀</kbd> and <kbd>Esc</kbd> closes the dropdown.\n     */\n    keystrokes;\n    /**\n     * A child {@link module:ui/list/listview~ListView list view} of the dropdown located\n     * in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.\n     *\n     * **Note**: Only supported when dropdown has list view added using {@link module:ui/dropdown/utils~addListToDropdown}.\n     */\n    listView;\n    /**\n     * A child toolbar of the dropdown located in the\n     * {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.\n     *\n     * **Note**: Only supported when dropdown has a toolbar added using {@link module:ui/dropdown/utils~addToolbarToDropdown}.\n     */\n    toolbarView;\n    /**\n     * A child menu component of the dropdown located\n     * in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.\n     *\n     * **Note**: Only supported when dropdown has a menu added using {@link module:ui/dropdown/utils~addMenuToDropdown}.\n     */\n    menuView;\n    /**\n     * Creates an instance of the dropdown.\n     *\n     * Also see {@link #render}.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale, buttonView, panelView) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.buttonView = buttonView;\n        this.panelView = panelView;\n        this.set('isOpen', false);\n        this.set('isEnabled', true);\n        this.set('class', undefined);\n        this.set('id', undefined);\n        this.set('panelPosition', 'auto');\n        // Toggle the visibility of the panel when the dropdown becomes open.\n        this.panelView.bind('isVisible').to(this, 'isOpen');\n        this.keystrokes = new KeystrokeHandler();\n        this.focusTracker = new FocusTracker();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-dropdown',\n                    bind.to('class'),\n                    bind.if('isEnabled', 'ck-disabled', value => !value)\n                ],\n                id: bind.to('id'),\n                'aria-describedby': bind.to('ariaDescribedById')\n            },\n            children: [\n                buttonView,\n                panelView\n            ]\n        });\n        buttonView.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-dropdown__button'\n                ],\n                'data-cke-tooltip-disabled': bind.to('isOpen')\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.focusTracker.add(this.buttonView.element);\n        this.focusTracker.add(this.panelView.element);\n        // Toggle the dropdown when its button has been clicked.\n        this.listenTo(this.buttonView, 'open', () => {\n            this.isOpen = !this.isOpen;\n        });\n        // Let the dropdown control the position of the panel. The position must\n        // be updated every time the dropdown is open.\n        this.on('change:isOpen', (evt, name, isOpen) => {\n            if (!isOpen) {\n                return;\n            }\n            // If \"auto\", find the best position of the panel to fit into the viewport.\n            // Otherwise, simply assign the static position.\n            if (this.panelPosition === 'auto') {\n                const optimalPanelPosition = DropdownView._getOptimalPosition({\n                    element: this.panelView.element,\n                    target: this.buttonView.element,\n                    fitInViewport: true,\n                    positions: this._panelPositions\n                });\n                this.panelView.position = (optimalPanelPosition ? optimalPanelPosition.name : this._defaultPanelPositionName);\n            }\n            else {\n                this.panelView.position = this.panelPosition;\n            }\n        });\n        // Listen for keystrokes coming from within #element.\n        this.keystrokes.listenTo(this.element);\n        const closeDropdown = (data, cancel) => {\n            if (this.isOpen) {\n                this.isOpen = false;\n                cancel();\n            }\n        };\n        // Open the dropdown panel using the arrow down key, just like with return or space.\n        this.keystrokes.set('arrowdown', (data, cancel) => {\n            // Don't open if the dropdown is disabled or already open.\n            if (this.buttonView.isEnabled && !this.isOpen) {\n                this.isOpen = true;\n                cancel();\n            }\n        });\n        // Block the right arrow key (until nested dropdowns are implemented).\n        this.keystrokes.set('arrowright', (data, cancel) => {\n            if (this.isOpen) {\n                cancel();\n            }\n        });\n        // Close the dropdown using the arrow left/escape key.\n        this.keystrokes.set('arrowleft', closeDropdown);\n        this.keystrokes.set('esc', closeDropdown);\n    }\n    /**\n     * Focuses the {@link #buttonView}.\n     */\n    focus() {\n        this.buttonView.focus();\n    }\n    /**\n     * Returns {@link #panelView panel} positions to be used by the\n     * {@link module:utils/dom/position~getOptimalPosition `getOptimalPosition()`}\n     * utility considering the direction of the language the UI of the editor is displayed in.\n     */\n    get _panelPositions() {\n        const { south, north, southEast, southWest, northEast, northWest, southMiddleEast, southMiddleWest, northMiddleEast, northMiddleWest } = DropdownView.defaultPanelPositions;\n        if (this.locale.uiLanguageDirection !== 'rtl') {\n            return [\n                southEast, southWest, southMiddleEast, southMiddleWest, south,\n                northEast, northWest, northMiddleEast, northMiddleWest, north\n            ];\n        }\n        else {\n            return [\n                southWest, southEast, southMiddleWest, southMiddleEast, south,\n                northWest, northEast, northMiddleWest, northMiddleEast, north\n            ];\n        }\n    }\n    /**\n     * Returns the default position of the dropdown panel based on the direction of the UI language.\n     * It is used when the {@link #panelPosition} is set to `'auto'` and the panel has not found a\n     * suitable position to fit into the viewport.\n     */\n    get _defaultPanelPositionName() {\n        return this.locale.uiLanguageDirection === 'rtl' ? 'sw' : 'se';\n    }\n    /**\n     * A set of positioning functions used by the dropdown view to determine\n     * the optimal position (i.e. fitting into the browser viewport) of its\n     * {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel} when\n     * {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition} is set to 'auto'`.\n     *\n     * The available positioning functions are as follow:\n     *\n     * **South**\n     *\n     * * `south`\n     *\n     * ```\n     *\t\t\t[ Button ]\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southEast`\n     *\n     * ```\n     *\t\t[ Button ]\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southWest`\n     *\n     * ```\n     *\t\t         [ Button ]\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southMiddleEast`\n     *\n     * ```\n     *\t\t  [ Button ]\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     * ```\n     *\n     * * `southMiddleWest`\n     *\n     * ```\n     *\t\t       [ Button ]\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     * ```\n     *\n     * **North**\n     *\n     * * `north`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     *\t\t    [ Button ]\n     * ```\n     *\n     * * `northEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     *\t\t[ Button ]\n     * ```\n     *\n     * * `northWest`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     *\t\t         [ Button ]\n     * ```\n     *\n     * * `northMiddleEast`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     *\t\t  [ Button ]\n     * ```\n     *\n     * * `northMiddleWest`\n     *\n     * ```\n     *\t\t+-----------------+\n     *\t\t|      Panel      |\n     *\t\t+-----------------+\n     *\t\t       [ Button ]\n     * ```\n     *\n     * Positioning functions are compatible with {@link module:utils/dom/position~DomPoint}.\n     *\n     * The name that position function returns will be reflected in dropdown panel's class that\n     * controls its placement. See {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition}\n     * to learn more.\n     */\n    static defaultPanelPositions = {\n        south: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.bottom,\n                left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,\n                name: 's'\n            };\n        },\n        southEast: buttonRect => {\n            return {\n                top: buttonRect.bottom,\n                left: buttonRect.left,\n                name: 'se'\n            };\n        },\n        southWest: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.bottom,\n                left: buttonRect.left - panelRect.width + buttonRect.width,\n                name: 'sw'\n            };\n        },\n        southMiddleEast: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.bottom,\n                left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,\n                name: 'sme'\n            };\n        },\n        southMiddleWest: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.bottom,\n                left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,\n                name: 'smw'\n            };\n        },\n        north: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.top - panelRect.height,\n                left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,\n                name: 'n'\n            };\n        },\n        northEast: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.top - panelRect.height,\n                left: buttonRect.left,\n                name: 'ne'\n            };\n        },\n        northWest: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.top - panelRect.height,\n                left: buttonRect.left - panelRect.width + buttonRect.width,\n                name: 'nw'\n            };\n        },\n        northMiddleEast: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.top - panelRect.height,\n                left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,\n                name: 'nme'\n            };\n        },\n        northMiddleWest: (buttonRect, panelRect) => {\n            return {\n                top: buttonRect.top - panelRect.height,\n                left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,\n                name: 'nmw'\n            };\n        }\n    };\n    /**\n     * A function used to calculate the optimal position for the dropdown panel.\n     */\n    static _getOptimalPosition = getOptimalPosition;\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 10 10\\\"><path d=\\\"M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dropdown/button/dropdownbuttonview\n */\nimport { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';\nimport { ButtonView } from '../../button/buttonview.js';\nimport { IconView } from '../../icon/iconview.js';\n/**\n * The default dropdown button view class.\n *\n * ```ts\n * const view = new DropdownButtonView();\n *\n * view.set( {\n * \tlabel: 'A button',\n * \tkeystroke: 'Ctrl+B',\n * \ttooltip: true\n * } );\n *\n * view.render();\n *\n * document.body.append( view.element );\n * ```\n *\n * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.\n */\nexport class DropdownButtonView extends ButtonView {\n    /**\n     * An icon that displays arrow to indicate a dropdown button.\n     */\n    arrowView;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.arrowView = this._createArrowView();\n        this.extendTemplate({\n            attributes: {\n                'aria-haspopup': true,\n                'aria-expanded': this.bindTemplate.to('isOn', value => String(value))\n            }\n        });\n        // The DropdownButton interface expects the open event upon which will open the dropdown.\n        this.delegate('execute').to(this, 'open');\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.children.add(this.arrowView);\n    }\n    /**\n     * Creates a {@link module:ui/icon/iconview~IconView} instance as {@link #arrowView}.\n     */\n    _createArrowView() {\n        const arrowView = new IconView();\n        arrowView.content = IconDropdownArrow;\n        arrowView.extendTemplate({\n            attributes: {\n                class: 'ck-dropdown__arrow'\n            }\n        });\n        return arrowView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/list/listseparatorview\n */\nimport { View } from '../view.js';\n/**\n * The list separator view class.\n */\nexport class ListSeparatorView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.setTemplate({\n            tag: 'li',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-list__separator'\n                ]\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/list/listitemgroupview\n */\nimport { View } from '../view.js';\nimport { ListView } from './listview.js';\nimport { LabelView } from '../label/labelview.js';\nimport { ListSeparatorView } from './listseparatorview.js';\n/**\n * The list item group view class.\n */\nexport class ListItemGroupView extends View {\n    /**\n     * Label of the group view. Its text is configurable using the {@link #label label attribute}.\n     *\n     * If a custom label view is not passed in `ListItemGroupView` constructor, the label is an instance\n     * of {@link module:ui/label/labelview~LabelView}.\n     */\n    labelView;\n    /**\n     * Collection of the child list items inside this group.\n     */\n    items;\n    /**\n     * Collection of the child elements of the group.\n     */\n    children;\n    /**\n     * Creates an instance of the list item group view class.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param labelView The instance of the group's label. If not provided, an instance of\n     * {@link module:ui/label/labelview~LabelView} is used.\n     */\n    constructor(locale, labelView = new LabelView()) {\n        super(locale);\n        const bind = this.bindTemplate;\n        const nestedList = new ListView(locale);\n        this.set({\n            label: '',\n            isVisible: true\n        });\n        this.labelView = labelView;\n        this.labelView.bind('text').to(this, 'label');\n        this.children = this.createCollection();\n        this.children.addMany([this.labelView, nestedList]);\n        nestedList.set({\n            role: 'group',\n            ariaLabelledBy: labelView.id\n        });\n        // Disable focus tracking and accessible navigation in the child list.\n        nestedList.focusTracker.destroy();\n        nestedList.keystrokes.destroy();\n        this.items = nestedList.items;\n        this.setTemplate({\n            tag: 'li',\n            attributes: {\n                role: 'presentation',\n                class: [\n                    'ck',\n                    'ck-list__group',\n                    bind.if('isVisible', 'ck-hidden', value => !value)\n                ]\n            },\n            children: this.children\n        });\n    }\n    /**\n     * Focuses the list item (which is not a separator).\n     */\n    focus() {\n        if (this.items) {\n            const firstListItem = this.items.find(item => !(item instanceof ListSeparatorView));\n            if (firstListItem) {\n                firstListItem.focus();\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/list/listview\n */\nimport { View } from '../view.js';\nimport { FocusCycler } from '../focuscycler.js';\nimport { ListItemView } from './listitemview.js';\nimport { ListItemGroupView } from './listitemgroupview.js';\nimport { ViewCollection } from '../viewcollection.js';\nimport { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/list/list.css';\n/**\n * The list view class.\n */\nexport class ListView extends View {\n    /**\n     * The collection of focusable views in the list. It is used to determine accessible navigation\n     * between the {@link module:ui/list/listitemview~ListItemView list items} and\n     * {@link module:ui/list/listitemgroupview~ListItemGroupView list groups}.\n     */\n    focusables;\n    /**\n     * Collection of the child list views.\n     */\n    items;\n    /**\n     * Tracks information about DOM focus in the list.\n     */\n    focusTracker;\n    /**\n     * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * Helps cycling over focusable {@link #items} in the list.\n     */\n    _focusCycler;\n    /**\n     * A cached map of {@link module:ui/list/listitemgroupview~ListItemGroupView} to `change` event listeners for their `items`.\n     * Used for accessibility and keyboard navigation purposes.\n     */\n    _listItemGroupToChangeListeners = new WeakMap();\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.focusables = new ViewCollection();\n        this.items = this.createCollection();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this._focusCycler = new FocusCycler({\n            focusables: this.focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate list items backwards using the arrowup key.\n                focusPrevious: 'arrowup',\n                // Navigate toolbar items forwards using the arrowdown key.\n                focusNext: 'arrowdown'\n            }\n        });\n        this.set('ariaLabel', undefined);\n        this.set('ariaLabelledBy', undefined);\n        this.set('role', undefined);\n        this.setTemplate({\n            tag: 'ul',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-reset',\n                    'ck-list'\n                ],\n                role: bind.to('role'),\n                'aria-label': bind.to('ariaLabel'),\n                'aria-labelledby': bind.to('ariaLabelledBy')\n            },\n            children: this.items\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Items added before rendering should be known to the #focusTracker.\n        for (const item of this.items) {\n            if (item instanceof ListItemGroupView) {\n                this._registerFocusableItemsGroup(item);\n            }\n            else if (item instanceof ListItemView) {\n                this._registerFocusableListItem(item);\n            }\n        }\n        this.items.on('change', (evt, data) => {\n            for (const removed of data.removed) {\n                if (removed instanceof ListItemGroupView) {\n                    this._deregisterFocusableItemsGroup(removed);\n                }\n                else if (removed instanceof ListItemView) {\n                    this._deregisterFocusableListItem(removed);\n                }\n            }\n            for (const added of Array.from(data.added).reverse()) {\n                if (added instanceof ListItemGroupView) {\n                    this._registerFocusableItemsGroup(added, data.index);\n                }\n                else {\n                    this._registerFocusableListItem(added, data.index);\n                }\n            }\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the first focusable in {@link #items}.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Focuses the first focusable in {@link #items}.\n     */\n    focusFirst() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Focuses the last focusable in {@link #items}.\n     */\n    focusLast() {\n        this._focusCycler.focusLast();\n    }\n    /**\n     * Registers a list item view in the focus tracker.\n     *\n     * @param item The list item view to be registered.\n     * @param index Index of the list item view in the {@link #items} collection. If not specified, the item will be added at the end.\n     */\n    _registerFocusableListItem(item, index) {\n        this.focusTracker.add(item.element);\n        this.focusables.add(item, index);\n    }\n    /**\n     * Removes a list item view from the focus tracker.\n     *\n     * @param item The list item view to be removed.\n     */\n    _deregisterFocusableListItem(item) {\n        this.focusTracker.remove(item.element);\n        this.focusables.remove(item);\n    }\n    /**\n     * Gets a callback that will be called when the `items` collection of a {@link module:ui/list/listitemgroupview~ListItemGroupView}\n     * change.\n     *\n     * @param groupView The group view for which the callback will be created.\n     * @returns The callback function to be used for the items `change` event listener in a group.\n     */\n    _getOnGroupItemsChangeCallback(groupView) {\n        return (evt, data) => {\n            for (const removed of data.removed) {\n                this._deregisterFocusableListItem(removed);\n            }\n            for (const added of Array.from(data.added).reverse()) {\n                this._registerFocusableListItem(added, this.items.getIndex(groupView) + data.index);\n            }\n        };\n    }\n    /**\n     * Registers a list item group view (and its children) in the focus tracker.\n     *\n     * @param groupView A group view to be registered.\n     * @param groupIndex Index of the group view in the {@link #items} collection. If not specified, the group will be added at the end.\n     */\n    _registerFocusableItemsGroup(groupView, groupIndex) {\n        Array.from(groupView.items).forEach((child, childIndex) => {\n            const registeredChildIndex = typeof groupIndex !== 'undefined' ? groupIndex + childIndex : undefined;\n            this._registerFocusableListItem(child, registeredChildIndex);\n        });\n        const groupItemsChangeCallback = this._getOnGroupItemsChangeCallback(groupView);\n        // Cache the reference to the callback in case the group is removed (see _deregisterFocusableItemsGroup()).\n        this._listItemGroupToChangeListeners.set(groupView, groupItemsChangeCallback);\n        groupView.items.on('change', groupItemsChangeCallback);\n    }\n    /**\n     * Removes a list item group view (and its children) from the focus tracker.\n     *\n     * @param groupView The group view to be removed.\n     */\n    _deregisterFocusableItemsGroup(groupView) {\n        for (const child of groupView.items) {\n            this._deregisterFocusableListItem(child);\n        }\n        groupView.items.off('change', this._listItemGroupToChangeListeners.get(groupView));\n        this._listItemGroupToChangeListeners.delete(groupView);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dropdown/button/splitbuttonview\n */\nimport { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';\nimport { KeystrokeHandler, FocusTracker } from '@ckeditor/ckeditor5-utils';\nimport { View } from '../../view.js';\nimport { ButtonView } from '../../button/buttonview.js';\nimport '../../../theme/components/dropdown/splitbutton.css';\n/**\n * The split button view class.\n *\n * ```ts\n * const view = new SplitButtonView();\n *\n * view.set( {\n * \tlabel: 'A button',\n * \tkeystroke: 'Ctrl+B',\n * \ttooltip: true\n * } );\n *\n * view.render();\n *\n * document.body.append( view.element );\n * ```\n *\n * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.\n */\nexport class SplitButtonView extends View {\n    /**\n     * Collection of the child views inside of the split button {@link #element}.\n     */\n    children;\n    /**\n     * A main button of split button.\n     */\n    actionView;\n    /**\n     * A secondary button of split button that opens dropdown.\n     */\n    arrowView;\n    /**\n     * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages\n     * keystrokes of the split button:\n     *\n     * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,\n     * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.\n     */\n    keystrokes;\n    /**\n     * Tracks information about DOM focus in the dropdown.\n     */\n    focusTracker;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale, actionButton) {\n        super(locale);\n        const bind = this.bindTemplate;\n        // Implement the Button interface.\n        this.set('class', undefined);\n        this.set('labelStyle', undefined);\n        this.set('icon', undefined);\n        this.set('isEnabled', true);\n        this.set('isOn', false);\n        this.set('isToggleable', false);\n        this.set('isVisible', true);\n        this.set('keystroke', undefined);\n        this.set('withKeystroke', false);\n        this.set('label', undefined);\n        this.set('tabindex', -1);\n        this.set('tooltip', false);\n        this.set('tooltipPosition', 's');\n        this.set('type', 'button');\n        this.set('withText', false);\n        this.children = this.createCollection();\n        this.actionView = this._createActionView(actionButton);\n        this.arrowView = this._createArrowView();\n        this.keystrokes = new KeystrokeHandler();\n        this.focusTracker = new FocusTracker();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-splitbutton',\n                    bind.to('class'),\n                    bind.if('isVisible', 'ck-hidden', value => !value),\n                    this.arrowView.bindTemplate.if('isOn', 'ck-splitbutton_open')\n                ]\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.children.add(this.actionView);\n        this.children.add(this.arrowView);\n        this.focusTracker.add(this.actionView.element);\n        this.focusTracker.add(this.arrowView.element);\n        this.keystrokes.listenTo(this.element);\n        // Overrides toolbar focus cycling behavior.\n        this.keystrokes.set('arrowright', (evt, cancel) => {\n            if (this.focusTracker.focusedElement === this.actionView.element) {\n                this.arrowView.focus();\n                cancel();\n            }\n        });\n        // Overrides toolbar focus cycling behavior.\n        this.keystrokes.set('arrowleft', (evt, cancel) => {\n            if (this.focusTracker.focusedElement === this.arrowView.element) {\n                this.actionView.focus();\n                cancel();\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the {@link module:ui/button/buttonview~ButtonView#element} of the action part of split button.\n     */\n    focus() {\n        this.actionView.focus();\n    }\n    /**\n     * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button\n     * attributes.\n     */\n    _createActionView(actionButton) {\n        const actionView = actionButton || new ButtonView();\n        if (!actionButton) {\n            actionView.bind('icon', 'isEnabled', 'isOn', 'isToggleable', 'keystroke', 'label', 'tabindex', 'tooltip', 'tooltipPosition', 'type', 'withText').to(this);\n        }\n        actionView.extendTemplate({\n            attributes: {\n                class: 'ck-splitbutton__action'\n            }\n        });\n        actionView.delegate('execute').to(this);\n        return actionView;\n    }\n    /**\n     * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button\n     * attributes.\n     */\n    _createArrowView() {\n        const arrowView = new ButtonView();\n        const bind = arrowView.bindTemplate;\n        arrowView.icon = IconDropdownArrow;\n        arrowView.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-splitbutton__arrow'\n                ],\n                'data-cke-tooltip-disabled': bind.to('isOn'),\n                'aria-haspopup': true,\n                'aria-expanded': bind.to('isOn', value => String(value))\n            }\n        });\n        arrowView.bind('isEnabled').to(this);\n        arrowView.bind('label').to(this);\n        arrowView.bind('tooltip').to(this);\n        arrowView.delegate('execute').to(this, 'open');\n        return arrowView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/button/switchbuttonview\n */\nimport { View } from '../view.js';\nimport { ButtonView } from './buttonview.js';\nimport '../../theme/components/button/switchbutton.css';\n/**\n * The switch button view class.\n *\n * ```ts\n * const view = new SwitchButtonView();\n *\n * view.set( {\n * \twithText: true,\n * \tlabel: 'Switch me!'\n * } );\n *\n * view.render();\n *\n * document.body.append( view.element );\n * ```\n */\nexport class SwitchButtonView extends ButtonView {\n    /**\n     * The toggle switch of the button.\n     */\n    toggleSwitchView;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.isToggleable = true;\n        this.toggleSwitchView = this._createToggleView();\n        this.extendTemplate({\n            attributes: {\n                class: 'ck-switchbutton'\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.children.add(this.toggleSwitchView);\n    }\n    /**\n     * Creates a toggle child view.\n     */\n    _createToggleView() {\n        const toggleSwitchView = new View();\n        toggleSwitchView.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-button__toggle'\n                ]\n            },\n            children: [\n                {\n                    tag: 'span',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-button__toggle__inner'\n                        ]\n                    }\n                }\n            ]\n        });\n        return toggleSwitchView;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M6.972 16.615a1 1 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a1 1 0 0 1-.745.292\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { IconCheck } from '@ckeditor/ckeditor5-icons';\nimport { ButtonView } from './buttonview.js';\nimport { ButtonLabelView } from './buttonlabelview.js';\nimport { IconView } from '../icon/iconview.js';\nimport { View } from '../view.js';\nimport '../../theme/components/button/listitembutton.css';\n/**\n * Button that is used as dropdown list item entry.\n */\nexport class ListItemButtonView extends ButtonView {\n    /**\n     * Holds the view for the check icon of a button list item.\n     */\n    _checkIconHolderView = new CheckIconHolderView();\n    /**\n     * @inheritDoc\n     */\n    constructor(locale, labelView = new ButtonLabelView()) {\n        super(locale, labelView);\n        this.set({\n            hasCheckSpace: false,\n            _hasCheck: this.isToggleable\n        });\n        const bind = this.bindTemplate;\n        this.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-list-item-button',\n                    bind.if('isToggleable', 'ck-list-item-button_toggleable')\n                ]\n            }\n        });\n        this.bind('_hasCheck').to(this, 'hasCheckSpace', this, 'isToggleable', (hasCheckSpace, isToggleable) => hasCheckSpace || isToggleable);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        if (this._hasCheck) {\n            this.children.add(this._checkIconHolderView, 0);\n        }\n        this._watchCheckIconHolderMount();\n    }\n    /**\n     * Renders the check icon if the button is toggleable.\n     */\n    _watchCheckIconHolderMount() {\n        this._checkIconHolderView\n            .bind('isOn')\n            .to(this, 'isOn', value => this.isToggleable && value);\n        this.on('change:_hasCheck', (evt, propertyName, hasCheck) => {\n            const { children, _checkIconHolderView } = this;\n            if (hasCheck) {\n                children.add(_checkIconHolderView, 0);\n            }\n            else {\n                children.remove(_checkIconHolderView);\n            }\n        });\n    }\n}\n/**\n * @internal\n */\nexport class CheckIconHolderView extends View {\n    /**\n     * Collection of child views.\n     */\n    children;\n    /**\n     * The view for the check icon of the button list item.\n     */\n    _checkIconView = this._createCheckIconView();\n    /**\n     * @inheritDoc\n     */\n    constructor() {\n        super();\n        const bind = this.bindTemplate;\n        this.children = this.createCollection();\n        this.set('isOn', false);\n        this.setTemplate({\n            tag: 'span',\n            children: this.children,\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-list-item-button__check-holder',\n                    bind.to('isOn', isOn => isOn ? 'ck-on' : 'ck-off')\n                ]\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        if (this.isOn) {\n            this.children.add(this._checkIconView, 0);\n        }\n        this._watchCheckIconMount();\n    }\n    /**\n     * Renders the check icon if the button is toggleable.\n     */\n    _watchCheckIconMount() {\n        this.on('change:isOn', (evt, propertyName, isOn) => {\n            const { children, _checkIconView } = this;\n            if (isOn && !children.has(_checkIconView)) {\n                children.add(_checkIconView);\n            }\n            else if (!isOn && children.has(_checkIconView)) {\n                children.remove(_checkIconView);\n            }\n        });\n    }\n    /**\n     * Creates a check icon view.\n     */\n    _createCheckIconView() {\n        const iconView = new IconView();\n        iconView.content = IconCheck;\n        iconView.extendTemplate({\n            attributes: {\n                class: 'ck-list-item-button__check-icon'\n            }\n        });\n        return iconView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/dropdown/utils\n */\nimport { DropdownPanelView } from './dropdownpanelview.js';\nimport { DropdownView } from './dropdownview.js';\nimport { DropdownButtonView } from './button/dropdownbuttonview.js';\nimport { DropdownMenuRootListView } from './menu/dropdownmenurootlistview.js';\nimport { ToolbarView } from '../toolbar/toolbarview.js';\nimport { ListView } from '../list/listview.js';\nimport { ListItemView } from '../list/listitemview.js';\nimport { ListSeparatorView } from '../list/listseparatorview.js';\nimport { SplitButtonView } from './button/splitbuttonview.js';\nimport { SwitchButtonView } from '../button/switchbuttonview.js';\nimport { ViewCollection } from '../viewcollection.js';\nimport { clickOutsideHandler } from '../bindings/clickoutsidehandler.js';\nimport { global, priorities, logWarning } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/dropdown/toolbardropdown.css';\nimport '../../theme/components/dropdown/listdropdown.css';\nimport { ListItemGroupView } from '../list/listitemgroupview.js';\nimport { ListItemButtonView } from '../button/listitembuttonview.js';\n/**\n * A helper for creating dropdowns. It creates an instance of a {@link module:ui/dropdown/dropdownview~DropdownView dropdown},\n * with a {@link module:ui/dropdown/button/dropdownbutton~DropdownButton button},\n * {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView panel} and all standard dropdown's behaviors.\n *\n * # Creating dropdowns\n *\n * By default, the default {@link module:ui/dropdown/button/dropdownbuttonview~DropdownButtonView} class is used as\n * definition of the button:\n *\n * ```ts\n * const dropdown = createDropdown( model );\n *\n * // Configure dropdown's button properties:\n * dropdown.buttonView.set( {\n * \tlabel: 'A dropdown',\n * \twithText: true\n * } );\n *\n * dropdown.render();\n *\n * // Will render a dropdown labeled \"A dropdown\" with an empty panel.\n * document.body.appendChild( dropdown.element );\n * ```\n *\n * You can also provide other button views (they need to implement the\n * {@link module:ui/dropdown/button/dropdownbutton~DropdownButton} interface). For instance, you can use\n * {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} to create a dropdown with a split button.\n *\n * ```ts\n * const dropdown = createDropdown( locale, SplitButtonView );\n *\n * // Configure dropdown's button properties:\n * dropdown.buttonView.set( {\n * \tlabel: 'A dropdown',\n * \twithText: true\n * } );\n *\n * dropdown.buttonView.on( 'execute', () => {\n * \t// Add the behavior of the \"action part\" of the split button.\n * \t// Split button consists of the \"action part\" and \"arrow part\".\n * \t// The arrow opens the dropdown while the action part can have some other behavior.\n * } );\n *\n * dropdown.render();\n *\n * // Will render a dropdown labeled \"A dropdown\" with an empty panel.\n * document.body.appendChild( dropdown.element );\n * ```\n *\n * # Adding content to the dropdown's panel\n *\n * The content of the panel can be inserted directly into the `dropdown.panelView.element`:\n *\n * ```ts\n * dropdown.panelView.element.textContent = 'Content of the panel';\n * ```\n *\n * However, most of the time you will want to add there either a {@link module:ui/list/listview~ListView list of options}\n * or a list of buttons (i.e. a {@link module:ui/toolbar/toolbarview~ToolbarView toolbar}).\n * To simplify the task, you can use, respectively, {@link module:ui/dropdown/utils~addListToDropdown} or\n * {@link module:ui/dropdown/utils~addToolbarToDropdown} utils.\n *\n * @param locale The locale instance.\n * @param ButtonClassOrInstance The dropdown button view class. Needs to implement the\n * {@link module:ui/dropdown/button/dropdownbutton~DropdownButton} interface.\n * @returns The dropdown view instance.\n */\nexport function createDropdown(locale, ButtonClassOrInstance = DropdownButtonView) {\n    const buttonView = typeof ButtonClassOrInstance == 'function' ? new ButtonClassOrInstance(locale) : ButtonClassOrInstance;\n    const panelView = new DropdownPanelView(locale);\n    const dropdownView = new DropdownView(locale, buttonView, panelView);\n    buttonView.bind('isEnabled').to(dropdownView);\n    if (buttonView instanceof SplitButtonView) {\n        buttonView.arrowView.bind('isOn').to(dropdownView, 'isOpen');\n    }\n    else {\n        buttonView.bind('isOn').to(dropdownView, 'isOpen');\n    }\n    addDefaultBehaviors(dropdownView);\n    return dropdownView;\n}\n/**\n * Adds a menu UI component to a dropdown and sets all common behaviors and interactions between the dropdown and the menu.\n *\n * Use this helper to create multi-level dropdown menus that are displayed in a toolbar.\n *\n * Internally, it creates an instance of {@link module:ui/dropdown/menu/dropdownmenurootlistview~DropdownMenuRootListView}.\n *\n * Example:\n *\n * ```ts\n * const definitions = [\n * \t{\n * \t\tid: 'menu_1',\n * \t\tmenu: 'Menu 1',\n * \t\tchildren: [\n * \t\t\t{\n * \t\t\t\tid: 'menu_1_a',\n * \t\t\t\tlabel: 'Item A'\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\tid: 'menu_1_b',\n * \t\t\t\tlabel: 'Item B'\n * \t\t\t}\n * \t\t]\n * \t},\n * \t{\n * \t\tid: 'top_a',\n * \t\tlabel: 'Top Item A'\n * \t},\n * \t{\n * \t\tid: 'top_b',\n * \t\tlabel: 'Top Item B'\n * \t}\n * ];\n *\n * const dropdownView = createDropdown( editor.locale );\n *\n * addMenuToDropdown( dropdownView, editor.ui.view.body, definitions );\n * ```\n *\n * After using this helper, the `dropdown` will fire {@link module:ui/dropdown/dropdownview~DropdownViewEvent `execute`} event when\n * a nested menu button is pressed.\n *\n * The helper will make sure that the `dropdownMenuRootListView` is lazy loaded, i.e., the menu component structure will be initialized\n * and rendered only after the `dropdown` is opened for the first time.\n *\n * @param dropdownView A dropdown instance to which the menu component will be added.\n * @param body Body collection to which floating menu panels will be added.\n * @param definition The menu component definition.\n * @param options.ariaLabel Label used by assistive technologies to describe the top-level menu.\n */\nexport function addMenuToDropdown(dropdownView, body, definition, options = {}) {\n    dropdownView.menuView = new DropdownMenuRootListView(dropdownView.locale, body, definition);\n    dropdownView.focusTracker.add(dropdownView.menuView);\n    if (dropdownView.isOpen) {\n        addMenuToOpenDropdown(dropdownView, options);\n    }\n    else {\n        // Load the UI elements only after the dropdown is opened for the first time - lazy loading.\n        dropdownView.once('change:isOpen', () => {\n            addMenuToOpenDropdown(dropdownView, options);\n        }, { priority: 'highest' });\n    }\n}\nfunction addMenuToOpenDropdown(dropdownView, options) {\n    const dropdownMenuRootListView = dropdownView.menuView;\n    const t = dropdownView.locale.t;\n    dropdownMenuRootListView.delegate('menu:execute').to(dropdownView, 'execute');\n    dropdownMenuRootListView.listenTo(dropdownView, 'change:isOpen', (evt, name, isOpen) => {\n        if (!isOpen) {\n            dropdownMenuRootListView.closeMenus();\n        }\n    }, { priority: 'low' }); // Make sure this is fired after `focusDropdownButtonOnClose` behavior.\n    // When `dropdownMenuRootListView` is added as a `panelView` child, it becomes rendered (`panelView` is rendered at this point).\n    dropdownView.panelView.children.add(dropdownMenuRootListView);\n    // Nested menu panels are added to body collection, so they are not children of the `dropdownView` from DOM perspective.\n    // Add these panels to `dropdownView` focus tracker, so they are treated like part of the `dropdownView` for focus-related purposes.\n    for (const menu of dropdownMenuRootListView.menus) {\n        dropdownView.focusTracker.add(menu);\n    }\n    dropdownMenuRootListView.ariaLabel = options.ariaLabel || t('Dropdown menu');\n}\n/**\n * Adds an instance of {@link module:ui/toolbar/toolbarview~ToolbarView} to a dropdown.\n *\n * ```ts\n * const buttonsCreator = () => {\n * \tconst buttons = [];\n *\n * \t// Either create a new ButtonView instance or create existing.\n * \tbuttons.push( new ButtonView() );\n * \tbuttons.push( editor.ui.componentFactory.create( 'someButton' ) );\n * };\n *\n * const dropdown = createDropdown( locale );\n *\n * addToolbarToDropdown( dropdown, buttonsCreator, { isVertical: true } );\n *\n * // Will render a vertical button dropdown labeled \"A button dropdown\"\n * // with a button group in the panel containing two buttons.\n * // Buttons inside the dropdown will be created on first dropdown panel open.\n * dropdown.render()\n * document.body.appendChild( dropdown.element );\n * ```\n *\n * **Note:** To improve the accessibility, you can tell the dropdown to focus the first active button of the toolbar when the dropdown\n * {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open}. See the documentation of `options` to learn more.\n *\n * **Note:** Toolbar view will be created on first open of the dropdown.\n *\n * See {@link module:ui/dropdown/utils~createDropdown} and {@link module:ui/toolbar/toolbarview~ToolbarView}.\n *\n * @param dropdownView A dropdown instance to which `ToolbarView` will be added.\n * @param options.enableActiveItemFocusOnDropdownOpen When set `true`, the focus will automatically move to the first\n * active {@link module:ui/toolbar/toolbarview~ToolbarView#items item} of the toolbar upon\n * {@link module:ui/dropdown/dropdownview~DropdownView#isOpen opening} the dropdown. Active items are those with the `isOn` property set\n * `true` (for instance {@link module:ui/button/buttonview~ButtonView buttons}). If no active items is found, the toolbar will be focused\n * as a whole resulting in the focus moving to its first focusable item (default behavior of\n * {@link module:ui/dropdown/dropdownview~DropdownView}).\n * @param options.ariaLabel Label used by assistive technologies to describe toolbar element.\n * @param options.maxWidth The maximum width of the toolbar element.\n * Details: {@link module:ui/toolbar/toolbarview~ToolbarView#maxWidth}.\n * @param options.class An additional CSS class added to the toolbar element.\n * @param options.isCompact When set true, makes the toolbar look compact with toolbar element.\n * @param options.isVertical Controls the orientation of toolbar items.\n */\nexport function addToolbarToDropdown(dropdownView, buttonsOrCallback, options = {}) {\n    dropdownView.extendTemplate({\n        attributes: {\n            class: ['ck-toolbar-dropdown']\n        }\n    });\n    if (dropdownView.isOpen) {\n        addToolbarToOpenDropdown(dropdownView, buttonsOrCallback, options);\n    }\n    else {\n        dropdownView.once('change:isOpen', () => addToolbarToOpenDropdown(dropdownView, buttonsOrCallback, options), { priority: 'highest' });\n    }\n    if (options.enableActiveItemFocusOnDropdownOpen) {\n        // Accessibility: Focus the first active button in the toolbar when the dropdown gets open.\n        focusChildOnDropdownOpen(dropdownView, () => dropdownView.toolbarView.items.find((item) => item.isOn));\n    }\n}\n/**\n * Adds an instance of {@link module:ui/toolbar/toolbarview~ToolbarView} to a dropdown.\n */\nfunction addToolbarToOpenDropdown(dropdownView, buttonsOrCallback, options) {\n    const locale = dropdownView.locale;\n    const t = locale.t;\n    const toolbarView = dropdownView.toolbarView = new ToolbarView(locale);\n    const buttons = typeof buttonsOrCallback == 'function' ? buttonsOrCallback() : buttonsOrCallback;\n    toolbarView.ariaLabel = options.ariaLabel || t('Dropdown toolbar');\n    if (options.maxWidth) {\n        toolbarView.maxWidth = options.maxWidth;\n    }\n    if (options.class) {\n        toolbarView.class = options.class;\n    }\n    if (options.isCompact) {\n        toolbarView.isCompact = options.isCompact;\n    }\n    if (options.isVertical) {\n        toolbarView.isVertical = true;\n    }\n    if (buttons instanceof ViewCollection) {\n        toolbarView.items.bindTo(buttons).using(item => item);\n    }\n    else {\n        toolbarView.items.addMany(buttons);\n    }\n    dropdownView.panelView.children.add(toolbarView);\n    dropdownView.focusTracker.add(toolbarView);\n    toolbarView.items.delegate('execute').to(dropdownView);\n}\n/**\n * Adds an instance of {@link module:ui/list/listview~ListView} to a dropdown.\n *\n * ```ts\n * const items = new Collection<ListDropdownItemDefinition>();\n *\n * items.add( {\n * \ttype: 'button',\n * \tmodel: new Model( {\n * \t\twithText: true,\n * \t\tlabel: 'First item',\n * \t\tlabelStyle: 'color: red'\n * \t} )\n * } );\n *\n * items.add( {\n * \t type: 'button',\n * \t model: new Model( {\n * \t\twithText: true,\n * \t\tlabel: 'Second item',\n * \t\tlabelStyle: 'color: green',\n * \t\tclass: 'foo'\n * \t} )\n * } );\n *\n * const dropdown = createDropdown( locale );\n *\n * addListToDropdown( dropdown, items );\n *\n * // Will render a dropdown with a list in the panel containing two items.\n * dropdown.render()\n * document.body.appendChild( dropdown.element );\n * ```\n *\n * The `items` collection passed to this methods controls the presence and attributes of respective\n * {@link module:ui/list/listitemview~ListItemView list items}.\n *\n * **Note:** To improve the accessibility, when a list is added to the dropdown using this helper the dropdown will automatically attempt\n * to focus the first active item (a host to a {@link module:ui/button/buttonview~ButtonView} with\n * {@link module:ui/button/buttonview~ButtonView#isOn} set `true`) or the very first item when none are active.\n *\n * **Note:** List view will be created on first open of the dropdown.\n *\n * See {@link module:ui/dropdown/utils~createDropdown} and {@link module:list/list~List}.\n *\n * @param dropdownView A dropdown instance to which `ListVIew` will be added.\n * @param itemsOrCallback A collection of the list item definitions or a callback returning a list item definitions to populate the list.\n * @param options.ariaLabel Label used by assistive technologies to describe list element.\n * @param options.role Will be reflected by the `role` DOM attribute in `ListVIew` and used by assistive technologies.\n */\nexport function addListToDropdown(dropdownView, itemsOrCallback, options = {}) {\n    if (dropdownView.isOpen) {\n        addListToOpenDropdown(dropdownView, itemsOrCallback, options);\n    }\n    else {\n        dropdownView.once('change:isOpen', () => addListToOpenDropdown(dropdownView, itemsOrCallback, options), { priority: 'highest' });\n    }\n    // Accessibility: Focus the first active button in the list when the dropdown gets open.\n    focusChildOnDropdownOpen(dropdownView, () => dropdownView.listView.items.find(item => {\n        if (item instanceof ListItemView) {\n            return item.children.first.isOn;\n        }\n        return false;\n    }));\n}\n/**\n * Adds an instance of {@link module:ui/list/listview~ListView} to a dropdown.\n */\nfunction addListToOpenDropdown(dropdownView, itemsOrCallback, options) {\n    const locale = dropdownView.locale;\n    const listView = dropdownView.listView = new ListView(locale);\n    const items = typeof itemsOrCallback == 'function' ? itemsOrCallback() : itemsOrCallback;\n    listView.ariaLabel = options.ariaLabel;\n    listView.role = options.role;\n    bindViewCollectionItemsToDefinitions(dropdownView, listView.items, items, locale);\n    dropdownView.panelView.children.add(listView);\n    listView.items.delegate('execute').to(dropdownView);\n}\n/**\n * A helper to be used on an existing {@link module:ui/dropdown/dropdownview~DropdownView} that focuses\n * a specific child in DOM when the dropdown {@link module:ui/dropdown/dropdownview~DropdownView#isOpen gets open}.\n *\n * @param dropdownView A dropdown instance to which the focus behavior will be added.\n * @param childSelectorCallback A callback executed when the dropdown gets open. It should return a {@link module:ui/view~View}\n * instance (child of {@link module:ui/dropdown/dropdownview~DropdownView#panelView}) that will get focused or a falsy value.\n * If falsy value is returned, a default behavior of the dropdown will engage focusing the first focusable child in\n * the {@link module:ui/dropdown/dropdownview~DropdownView#panelView}.\n */\nexport function focusChildOnDropdownOpen(dropdownView, childSelectorCallback) {\n    dropdownView.on('change:isOpen', () => {\n        if (!dropdownView.isOpen) {\n            return;\n        }\n        const childToFocus = childSelectorCallback();\n        if (!childToFocus) {\n            return;\n        }\n        if (typeof childToFocus.focus === 'function') {\n            childToFocus.focus();\n        }\n        else {\n            /**\n             * The child view of a {@link module:ui/dropdown/dropdownview~DropdownView dropdown} is missing the `focus()` method\n             * and could not be focused when the dropdown got {@link module:ui/dropdown/dropdownview~DropdownView#isOpen open}.\n             *\n             * Making the content of a dropdown focusable in this case greatly improves the accessibility. Please make the view instance\n             * implements the {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable focusable interface} for the best user\n             * experience.\n             *\n             * @error ui-dropdown-focus-child-on-open-child-missing-focus\n             * @param {module:ui/view~View} view Child to focus.\n             */\n            logWarning('ui-dropdown-focus-child-on-open-child-missing-focus', { view: childToFocus });\n        }\n        // * Let the panel show up first (do not focus an invisible element).\n        // * Execute after focusDropdownPanelOnOpen(). See focusDropdownPanelOnOpen() to learn more.\n    }, { priority: priorities.low - 10 });\n}\n/**\n * Add a set of default behaviors to dropdown view.\n */\nfunction addDefaultBehaviors(dropdownView) {\n    closeDropdownOnClickOutside(dropdownView);\n    closeDropdownOnExecute(dropdownView);\n    closeDropdownOnBlur(dropdownView);\n    focusDropdownContentsOnArrows(dropdownView);\n    focusDropdownButtonOnClose(dropdownView);\n    focusDropdownPanelOnOpen(dropdownView);\n}\n/**\n * Adds a behavior to a dropdownView that closes opened dropdown when user clicks outside the dropdown.\n */\nfunction closeDropdownOnClickOutside(dropdownView) {\n    clickOutsideHandler({\n        emitter: dropdownView,\n        activator: () => dropdownView.isRendered && dropdownView.isOpen,\n        callback: () => {\n            dropdownView.isOpen = false;\n        },\n        contextElements: () => [\n            dropdownView.element,\n            // Include all elements connected to the dropdown's focus tracker, but exclude those that are direct children\n            // of DropdownView#element. They would be identified as descendants of #element anyway upon clicking and would\n            // not contribute to the logic.\n            ...getFocusTrackerTreeElements(dropdownView.focusTracker).filter(element => !dropdownView.element.contains(element))\n        ]\n    });\n}\n/**\n * Returns all DOM elements connected to a DropdownView's focus tracker, either directly (same DOM sub-tree)\n * or indirectly (external views registered in the focus tracker).\n */\nfunction getFocusTrackerTreeElements(focusTracker) {\n    return [\n        ...focusTracker.elements,\n        ...focusTracker.externalViews.flatMap(view => getFocusTrackerTreeElements(view.focusTracker))\n    ];\n}\n/**\n * Adds a behavior to a dropdownView that closes the dropdown view on \"execute\" event.\n */\nfunction closeDropdownOnExecute(dropdownView) {\n    // Close the dropdown when one of the list items has been executed.\n    dropdownView.on('execute', evt => {\n        // Toggling a switch button view should not close the dropdown.\n        if (evt.source instanceof SwitchButtonView) {\n            return;\n        }\n        dropdownView.isOpen = false;\n    });\n}\n/**\n * Adds a behavior to a dropdown view that closes opened dropdown when it loses focus.\n */\nfunction closeDropdownOnBlur(dropdownView) {\n    dropdownView.focusTracker.on('change:isFocused', (evt, name, isFocused) => {\n        if (isFocused || !dropdownView.isOpen) {\n            return;\n        }\n        dropdownView.isOpen = false;\n    });\n}\n/**\n * Adds a behavior to a dropdownView that focuses the dropdown's panel view contents on keystrokes.\n */\nfunction focusDropdownContentsOnArrows(dropdownView) {\n    // If the dropdown panel is already open, the arrow down key should focus the first child of the #panelView.\n    dropdownView.keystrokes.set('arrowdown', (data, cancel) => {\n        if (dropdownView.isOpen) {\n            dropdownView.panelView.focus();\n            cancel();\n        }\n    });\n    // If the dropdown panel is already open, the arrow up key should focus the last child of the #panelView.\n    dropdownView.keystrokes.set('arrowup', (data, cancel) => {\n        if (dropdownView.isOpen) {\n            dropdownView.panelView.focusLast();\n            cancel();\n        }\n    });\n}\n/**\n * Adds a behavior that focuses the #buttonView when the dropdown was closed but focus was within the #panelView element.\n * This makes sure the focus is never lost.\n */\nfunction focusDropdownButtonOnClose(dropdownView) {\n    dropdownView.on('change:isOpen', (evt, name, isOpen) => {\n        if (isOpen) {\n            return;\n        }\n        const elements = dropdownView.focusTracker.elements;\n        // If the dropdown was closed, move the focus back to the button (#12125).\n        // Don't touch the focus, if it moved somewhere else (e.g. moved to the editing root on #execute) (#12178).\n        // Note: Don't use the state of the DropdownView#focusTracker here. It fires #blur with the timeout.\n        if (elements.some(element => element.contains(global.document.activeElement))) {\n            dropdownView.buttonView.focus();\n        }\n    });\n}\n/**\n * Adds a behavior that focuses the #panelView when dropdown gets open (accessibility).\n */\nfunction focusDropdownPanelOnOpen(dropdownView) {\n    dropdownView.on('change:isOpen', (evt, name, isOpen) => {\n        if (!isOpen) {\n            return;\n        }\n        // Focus the first item in the dropdown when the dropdown opened.\n        dropdownView.panelView.focus();\n        // * Let the panel show up first (do not focus an invisible element).\n        // * Also, execute before focusChildOnDropdownOpen() to make sure this helper does not break the\n        //   focus of a specific child by kicking in too late and resetting the focus in the panel.\n    }, { priority: 'low' });\n}\n/**\n * This helper populates a dropdown list with items and groups according to the\n * collection of item definitions. A permanent binding is created in this process allowing\n * dynamic management of the dropdown list content.\n *\n * @param dropdownView\n * @param listItems\n * @param definitions\n * @param locale\n */\nfunction bindViewCollectionItemsToDefinitions(dropdownView, listItems, definitions, locale) {\n    bindDropdownToggleableButtonsAlignment(listItems);\n    listItems.bindTo(definitions).using(def => {\n        if (def.type === 'separator') {\n            return new ListSeparatorView(locale);\n        }\n        else if (def.type === 'group') {\n            const groupView = new ListItemGroupView(locale);\n            groupView.set({ label: def.label });\n            bindViewCollectionItemsToDefinitions(dropdownView, groupView.items, def.items, locale);\n            groupView.items.delegate('execute').to(dropdownView);\n            return groupView;\n        }\n        else if (def.type === 'button' || def.type === 'switchbutton') {\n            const isToggleable = def.model.role === 'menuitemcheckbox' || def.model.role === 'menuitemradio';\n            const listItemView = new ListItemView(locale);\n            let buttonView;\n            if (def.type === 'button') {\n                buttonView = new ListItemButtonView(locale, def.labelView);\n                buttonView.set({\n                    isToggleable\n                });\n            }\n            else {\n                buttonView = new SwitchButtonView(locale);\n            }\n            // Bind all model properties to the button view.\n            buttonView.bind(...Object.keys(def.model)).to(def.model);\n            buttonView.delegate('execute').to(listItemView);\n            listItemView.children.add(buttonView);\n            return listItemView;\n        }\n        return null;\n    });\n}\n/**\n * Sets up alignment handling for toggleable buttons in a dropdown list.\n *\n * Buttons in dropdowns have reserved space for a check icon when they are toggleable.\n * When at least one button in the list is toggleable, all other buttons (even non-toggleable ones)\n * will have space on their left side to align with toggleable buttons.\n *\n * This function handles a special case where a new toggleable button is added (or removed) to a list\n * where previous buttons weren't toggleable. In that case, those previous buttons will\n * automatically allocate space to align with the new toggleable button.\n *\n * Example:\n * ```\n * Before adding toggleable button:\n * +----------------+\n * | Normal Button  |\n * +----------------+\n * | Another Button |\n * +----------------+\n *\n * After adding toggleable button:\n * +-------------------+\n * |    Normal Button  |\n * +-------------------+\n * |    Another Button |\n * +-------------------+\n * | ✓ Toggle Button   |\n * +-------------------+\n * ```\n *\n * @param listItems Collection of list items to observe for toggleable buttons.\n */\nfunction bindDropdownToggleableButtonsAlignment(listItems) {\n    // Keep track of how many toggleable buttons are in the list.\n    let toggleableButtonsCount = 0;\n    // Helper function that checks if a view item is a list item button.\n    const pickListItemButtonIfPresent = (item) => {\n        // Check if the item is a ListItemView with a ListItemButtonView as its first child.\n        if (!(item instanceof ListItemView) || !(item.children.first instanceof ListItemButtonView)) {\n            return null;\n        }\n        return item.children.first;\n    };\n    // Helper function that checks if a view item is a toggleable button.\n    // Returns the button if it's toggleable - otherwise, returns null.\n    const pickListItemToggleableButtonIfPresent = (item) => {\n        const listItemButtonView = pickListItemButtonIfPresent(item);\n        // Only return buttons that are configured as toggleable.\n        if (!listItemButtonView || !listItemButtonView.isToggleable) {\n            return null;\n        }\n        return listItemButtonView;\n    };\n    // Updates all buttons in the list to either allocate space for check marks or not.\n    // This ensures all buttons are properly aligned regardless of their toggleable state.\n    const updateAllButtonsCheckSpace = (hasSpace) => {\n        for (const listItem of listItems) {\n            const listItemButton = pickListItemButtonIfPresent(listItem);\n            if (listItemButton) {\n                listItemButton.hasCheckSpace = hasSpace;\n            }\n        }\n    };\n    // Listen for changes in the list items collection.\n    listItems.on('change', (evt, data) => {\n        // Remember the current state - whether we have any toggleable buttons.\n        const prevToggleable = toggleableButtonsCount > 0;\n        // Process removed items - decrease count for each toggleable button removed.\n        for (const item of data.removed) {\n            if (pickListItemToggleableButtonIfPresent(item)) {\n                toggleableButtonsCount--;\n            }\n        }\n        // Process added items - increase count for each toggleable button added.\n        for (const item of data.added) {\n            const button = pickListItemButtonIfPresent(item);\n            if (!button) {\n                continue;\n            }\n            if (button.isToggleable) {\n                // Check if the button is toggleable and increase the count.\n                toggleableButtonsCount++;\n            }\n            // Depending on the current state, set the check space for the button.\n            button.hasCheckSpace = toggleableButtonsCount > 0;\n        }\n        // Check if the current state has changed.\n        const currentToggleable = toggleableButtonsCount > 0;\n        // Only update button alignment if we've crossed the threshold between\n        // having no toggleable buttons and having at least one.\n        if (prevToggleable !== currentToggleable) {\n            updateAllButtonsCheckSpace(currentToggleable);\n        }\n    });\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10.187 17H5.773q-.956 0-1.364-.415-.41-.416-.409-1.323V4.738q0-.926.419-1.332.418-.405 1.354-.406h4.68q1.035 0 1.793.124.76.124 1.36.478.512.296.906.75a3.26 3.26 0 0 1 .808 2.162q0 2.102-2.167 3.075 2.846.879 2.847 3.421a3.76 3.76 0 0 1-2.296 3.504 6 6 0 0 1-1.517.377q-.857.11-2 .11zm-.217-6.217H7v4.087h3.069q2.965 0 2.965-2.072 0-1.061-.768-1.537-.768-.478-2.296-.478M7 5.13v3.619h2.606q1.093 0 1.69-.2a1.6 1.6 0 0 0 .91-.765q.247-.4.247-.897 0-1.06-.778-1.409-.778-.348-2.375-.348z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><circle cx=\\\"9.5\\\" cy=\\\"4.5\\\" r=\\\"1.5\\\"/><circle cx=\\\"9.5\\\" cy=\\\"10.5\\\" r=\\\"1.5\\\"/><circle cx=\\\"9.5\\\" cy=\\\"16.5\\\" r=\\\"1.5\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/toolbar/toolbarview\n */\nimport { View } from '../view.js';\nimport { FocusCycler, isFocusable } from '../focuscycler.js';\nimport { ToolbarSeparatorView } from './toolbarseparatorview.js';\nimport { ToolbarLineBreakView } from './toolbarlinebreakview.js';\nimport { preventDefault } from '../bindings/preventdefault.js';\nimport { createDropdown, addToolbarToDropdown } from '../dropdown/utils.js';\nimport { normalizeToolbarConfig } from './normalizetoolbarconfig.js';\nimport { FocusTracker, KeystrokeHandler, Rect, ResizeObserver, global, isVisible, logWarning } from '@ckeditor/ckeditor5-utils';\nimport { IconAlignLeft, IconBold, IconImportExport, IconParagraph, IconPlus, IconText, IconThreeVerticalDots, IconPilcrow, IconDragIndicator } from '@ckeditor/ckeditor5-icons';\nimport { isObject } from 'es-toolkit/compat';\nimport '../../theme/components/toolbar/toolbar.css';\n/**\n * @internal\n */\nexport const NESTED_TOOLBAR_ICONS = /* #__PURE__ */ (() => ({\n    alignLeft: IconAlignLeft,\n    bold: IconBold,\n    importExport: IconImportExport,\n    paragraph: IconParagraph,\n    plus: IconPlus,\n    text: IconText,\n    threeVerticalDots: IconThreeVerticalDots,\n    pilcrow: IconPilcrow,\n    dragIndicator: IconDragIndicator\n}))();\n/**\n * The toolbar view class.\n */\nexport class ToolbarView extends View {\n    /**\n     * A reference to the options object passed to the constructor.\n     */\n    options;\n    /**\n     * A collection of toolbar items (buttons, dropdowns, etc.).\n     */\n    items;\n    /**\n     * Tracks information about the DOM focus in the toolbar.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}\n     * to handle keyboard navigation in the toolbar.\n     */\n    keystrokes;\n    /**\n     * A (child) view containing {@link #items toolbar items}.\n     */\n    itemsView;\n    /**\n     * A top–level collection aggregating building blocks of the toolbar.\n     *\n     *\t┌───────────────── ToolbarView ─────────────────┐\n     *\t| ┌──────────────── #children ────────────────┐ |\n     *\t| |   ┌──────────── #itemsView ───────────┐   | |\n     *\t| |   | [ item1 ] [ item2 ] ... [ itemN ] |   | |\n     *\t| |   └──────────────────────────────────-┘   | |\n     *\t| └───────────────────────────────────────────┘ |\n     *\t└───────────────────────────────────────────────┘\n     *\n     * By default, it contains the {@link #itemsView} but it can be extended with additional\n     * UI elements when necessary.\n     */\n    children;\n    /**\n     * A collection of {@link #items} that take part in the focus cycling\n     * (i.e. navigation using the keyboard). Usually, it contains a subset of {@link #items} with\n     * some optional UI elements that also belong to the toolbar and should be focusable\n     * by the user.\n     */\n    focusables;\n    /**\n     * Helps cycling over {@link #focusables focusable items} in the toolbar.\n     */\n    _focusCycler;\n    /**\n     * An instance of the active toolbar behavior that shapes its look and functionality.\n     *\n     * See {@link module:ui/toolbar/toolbarview~ToolbarBehavior} to learn more.\n     */\n    _behavior;\n    /**\n     * Creates an instance of the {@link module:ui/toolbar/toolbarview~ToolbarView} class.\n     *\n     * Also see {@link #render}.\n     *\n     * @param locale The localization services instance.\n     * @param options Configuration options of the toolbar.\n     */\n    constructor(locale, options) {\n        super(locale);\n        const bind = this.bindTemplate;\n        const t = this.t;\n        this.options = options || {};\n        this.set('ariaLabel', t('Editor toolbar'));\n        this.set('maxWidth', 'auto');\n        this.set('role', 'toolbar');\n        this.set('isGrouping', !!this.options.shouldGroupWhenFull);\n        this.items = this.createCollection();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.set('class', undefined);\n        this.set('isCompact', false);\n        // Static toolbar can be vertical when needed.\n        this.set('isVertical', false);\n        this.itemsView = new ItemsView(locale);\n        this.children = this.createCollection();\n        this.children.add(this.itemsView);\n        this.focusables = this.createCollection();\n        const isRtl = locale.uiLanguageDirection === 'rtl';\n        this._focusCycler = new FocusCycler({\n            focusables: this.focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate toolbar items backwards using the arrow[left,up] keys.\n                focusPrevious: [isRtl ? 'arrowright' : 'arrowleft', 'arrowup'],\n                // Navigate toolbar items forwards using the arrow[right,down] keys.\n                focusNext: [isRtl ? 'arrowleft' : 'arrowright', 'arrowdown']\n            }\n        });\n        const classes = [\n            'ck',\n            'ck-toolbar',\n            bind.to('class'),\n            bind.if('isCompact', 'ck-toolbar_compact'),\n            // To group items dynamically, the toolbar needs a dedicated CSS class. Only used for dynamic grouping.\n            bind.if('isGrouping', 'ck-toolbar_grouping'),\n            // When vertical, the toolbar has an additional CSS class. Only used for static layout.\n            bind.if('isVertical', 'ck-toolbar_vertical')\n        ];\n        if (this.options.shouldGroupWhenFull && this.options.isFloating) {\n            classes.push('ck-toolbar_floating');\n        }\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: classes,\n                role: bind.to('role'),\n                'aria-label': bind.to('ariaLabel'),\n                style: {\n                    maxWidth: bind.to('maxWidth')\n                },\n                tabindex: -1\n            },\n            children: this.children,\n            on: {\n                // https://github.com/ckeditor/ckeditor5-ui/issues/206\n                mousedown: preventDefault(this)\n            }\n        });\n        this._behavior = this.options.shouldGroupWhenFull ? new DynamicGrouping(this) : new StaticLayout(this);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.focusTracker.add(this.element);\n        // Children added before rendering should be known to the #focusTracker.\n        for (const item of this.items) {\n            this.focusTracker.add(item);\n        }\n        this.items.on('add', (evt, item) => {\n            this.focusTracker.add(item);\n        });\n        this.items.on('remove', (evt, item) => {\n            this.focusTracker.remove(item);\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n        this._behavior.render(this);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this._behavior.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n        return super.destroy();\n    }\n    /**\n     * Focuses the first focusable in {@link #focusables}.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Focuses the last focusable in {@link #focusables}.\n     */\n    focusLast() {\n        this._focusCycler.focusLast();\n    }\n    /**\n     * A utility that expands the plain toolbar configuration into\n     * {@link module:ui/toolbar/toolbarview~ToolbarView#items} using a given component factory.\n     *\n     * @param itemsOrConfig The toolbar items or the entire toolbar configuration object.\n     * @param factory A factory producing toolbar items.\n     * @param removeItems An array of items names to be removed from the configuration. When present, applies\n     * to this toolbar and all nested ones as well.\n     */\n    fillFromConfig(itemsOrConfig, factory, removeItems) {\n        this.items.addMany(this._buildItemsFromConfig(itemsOrConfig, factory, removeItems));\n    }\n    /**\n     * Changes the behavior of toolbar if it does not fit into the available space.\n     */\n    switchBehavior(newBehaviorType) {\n        if (this._behavior.type !== newBehaviorType) {\n            this._behavior.destroy();\n            this.itemsView.children.clear();\n            this.focusables.clear();\n            if (newBehaviorType === 'dynamic') {\n                this._behavior = new DynamicGrouping(this);\n                this._behavior.render(this);\n                this._behavior.refreshItems();\n            }\n            else {\n                this._behavior = new StaticLayout(this);\n                this._behavior.render(this);\n            }\n        }\n    }\n    /**\n     * A utility that expands the plain toolbar configuration into a list of view items using a given component factory.\n     *\n     * @param itemsOrConfig The toolbar items or the entire toolbar configuration object.\n     * @param factory A factory producing toolbar items.\n     * @param removeItems An array of items names to be removed from the configuration. When present, applies\n     * to this toolbar and all nested ones as well.\n     */\n    _buildItemsFromConfig(itemsOrConfig, factory, removeItems) {\n        const config = normalizeToolbarConfig(itemsOrConfig);\n        const normalizedRemoveItems = removeItems || config.removeItems;\n        const itemsToAdd = this._cleanItemsConfiguration(config.items, factory, normalizedRemoveItems)\n            .map(item => {\n            if (isObject(item)) {\n                return this._createNestedToolbarDropdown(item, factory, normalizedRemoveItems);\n            }\n            else if (item === '|') {\n                return new ToolbarSeparatorView();\n            }\n            else if (item === '-') {\n                return new ToolbarLineBreakView();\n            }\n            return factory.create(item);\n        })\n            .filter((item) => !!item);\n        return itemsToAdd;\n    }\n    /**\n     * Cleans up the {@link module:ui/toolbar/toolbarview~ToolbarView#items} of the toolbar by removing unwanted items and\n     * duplicated (obsolete) separators or line breaks.\n     *\n     * @param items The toolbar items configuration.\n     * @param factory A factory producing toolbar items.\n     * @param removeItems An array of items names to be removed from the configuration.\n     * @returns Items after the clean-up.\n     */\n    _cleanItemsConfiguration(items, factory, removeItems) {\n        const filteredItems = items\n            .filter((item, idx, items) => {\n            if (item === '|') {\n                return true;\n            }\n            // Items listed in `config.removeItems` should not be added to the toolbar.\n            if (removeItems.indexOf(item) !== -1) {\n                return false;\n            }\n            if (item === '-') {\n                // The toolbar line breaks must not be rendered when toolbar grouping is enabled.\n                // (https://github.com/ckeditor/ckeditor5/issues/8582)\n                if (this.options.shouldGroupWhenFull) {\n                    /**\n                     * The toolbar multiline breaks (`-` items) only work when the automatic button grouping\n                     * is disabled in the toolbar configuration.\n                     * To do this, set the `shouldNotGroupWhenFull` option to `true` in the editor configuration:\n                     *\n                     * ```ts\n                     * const config = {\n                     * \ttoolbar: {\n                     * \t\titems: [ ... ],\n                     * \t\tshouldNotGroupWhenFull: true\n                     * \t}\n                     * }\n                     * ```\n                     *\n                     * Learn more about {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar configuration}.\n                     *\n                     * @error toolbarview-line-break-ignored-when-grouping-items\n                     */\n                    logWarning('toolbarview-line-break-ignored-when-grouping-items', items);\n                    return false;\n                }\n                return true;\n            }\n            // For the items that cannot be instantiated we are sending warning message. We also filter them out.\n            if (!isObject(item) && !factory.has(item)) {\n                /**\n                 * There was a problem processing the configuration of the toolbar. The item with the given\n                 * name does not exist so it was omitted when rendering the toolbar.\n                 *\n                 * This warning usually shows up when the {@link module:core/plugin~Plugin} which is supposed\n                 * to provide a toolbar item has not been loaded or there is a typo in the\n                 * {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar configuration}.\n                 *\n                 * Make sure the plugin responsible for this toolbar item is loaded and the toolbar configuration\n                 * is correct, e.g. {@link module:basic-styles/bold~Bold} is loaded for the `'bold'` toolbar item.\n                 *\n                 * You can use the following snippet to retrieve all available toolbar items:\n                 *\n                 * ```ts\n                 * Array.from( editor.ui.componentFactory.names() );\n                 * ```\n                 *\n                 * @error toolbarview-item-unavailable\n                 * @param {string} item The name of the component or nested toolbar definition.\n                 */\n                logWarning('toolbarview-item-unavailable', { item });\n                return false;\n            }\n            return true;\n        });\n        return this._cleanSeparatorsAndLineBreaks(filteredItems);\n    }\n    /**\n     * Remove leading, trailing, and duplicated separators (`-` and `|`).\n     *\n     * @returns Toolbar items after the separator and line break clean-up.\n     */\n    _cleanSeparatorsAndLineBreaks(items) {\n        const nonSeparatorPredicate = (item) => (item !== '-' && item !== '|');\n        const count = items.length;\n        // Find an index of the first item that is not a separator.\n        const firstCommandItemIndex = items.findIndex(nonSeparatorPredicate);\n        // Items include separators only. There is no point in displaying them.\n        if (firstCommandItemIndex === -1) {\n            return [];\n        }\n        // Search from the end of the list, then convert found index back to the original direction.\n        const lastCommandItemIndex = count - items\n            .slice()\n            .reverse()\n            .findIndex(nonSeparatorPredicate);\n        return items\n            // Return items without the leading and trailing separators.\n            .slice(firstCommandItemIndex, lastCommandItemIndex)\n            // Remove duplicated separators.\n            .filter((name, idx, items) => {\n            // Filter only separators.\n            if (nonSeparatorPredicate(name)) {\n                return true;\n            }\n            const isDuplicated = idx > 0 && items[idx - 1] === name;\n            return !isDuplicated;\n        });\n    }\n    /**\n     * Creates a user-defined dropdown containing a toolbar with items.\n     *\n     * @param definition A definition of the nested toolbar dropdown.\n     * @param definition.label A label of the dropdown.\n     * @param definition.icon An icon of the drop-down. One of 'bold', 'plus', 'text', 'importExport', 'alignLeft',\n     * 'paragraph' or an SVG string. When `false` is passed, no icon will be used.\n     * @param definition.withText When set `true`, the label of the dropdown will be visible. See\n     * {@link module:ui/button/buttonview~ButtonView#withText} to learn more.\n     * @param definition.tooltip A tooltip of the dropdown button. See\n     * {@link module:ui/button/buttonview~ButtonView#tooltip} to learn more. Defaults to `true`.\n     * @param componentFactory Component factory used to create items\n     * of the nested toolbar.\n     */\n    _createNestedToolbarDropdown(definition, componentFactory, removeItems) {\n        let { label, icon, items, tooltip = true, withText = false } = definition;\n        items = this._cleanItemsConfiguration(items, componentFactory, removeItems);\n        // There is no point in rendering a dropdown without items.\n        if (!items.length) {\n            return null;\n        }\n        const locale = this.locale;\n        const dropdownView = createDropdown(locale);\n        if (!label) {\n            /**\n             * A dropdown definition in the toolbar configuration is missing a text label.\n             *\n             * Without a label, the dropdown becomes inaccessible to users relying on assistive technologies.\n             * Make sure the `label` property is set in your drop-down configuration:\n             *\n             * ```json\n             * {\n             * \tlabel: 'A human-readable label',\n             * \ticon: '...',\n             * \titems: [ ... ]\n             * },\n             * ```\n             *\n             * Learn more about {@link module:core/editor/editorconfig~EditorConfig#toolbar toolbar configuration}.\n             *\n             * @error toolbarview-nested-toolbar-dropdown-missing-label\n             */\n            logWarning('toolbarview-nested-toolbar-dropdown-missing-label', definition);\n        }\n        dropdownView.class = 'ck-toolbar__nested-toolbar-dropdown';\n        dropdownView.buttonView.set({\n            label,\n            tooltip,\n            withText: !!withText\n        });\n        // Allow disabling icon by passing false.\n        if (icon !== false) {\n            // A pre-defined icon picked by name, SVG string, a fallback (default) icon.\n            dropdownView.buttonView.icon = NESTED_TOOLBAR_ICONS[icon] || icon || IconThreeVerticalDots;\n        }\n        // If the icon is disabled, display the label automatically.\n        else {\n            dropdownView.buttonView.withText = true;\n        }\n        addToolbarToDropdown(dropdownView, () => (dropdownView.toolbarView._buildItemsFromConfig(items, componentFactory, removeItems)));\n        return dropdownView;\n    }\n}\n/**\n * An inner block of the {@link module:ui/toolbar/toolbarview~ToolbarView} hosting its\n * {@link module:ui/toolbar/toolbarview~ToolbarView#items}.\n */\nexport class ItemsView extends View {\n    /**\n     * A collection of items (buttons, dropdowns, etc.).\n     */\n    children;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.children = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-toolbar__items'\n                ]\n            },\n            children: this.children\n        });\n    }\n}\n/**\n * A toolbar behavior that makes it static and unresponsive to the changes of the environment.\n * At the same time, it also makes it possible to display a toolbar with a vertical layout\n * using the {@link module:ui/toolbar/toolbarview~ToolbarView#isVertical} property.\n */\nclass StaticLayout {\n    /**\n     * Toolbar behavior type.\n     */\n    type = 'static';\n    /**\n     * Creates an instance of the {@link module:ui/toolbar/toolbarview~StaticLayout} toolbar\n     * behavior.\n     *\n     * @param view An instance of the toolbar that this behavior is added to.\n     */\n    constructor(view) {\n        view.isGrouping = false;\n        // 1:1 pass–through binding, all ToolbarView#items are visible.\n        view.itemsView.children.bindTo(view.items).using(item => item);\n        // 1:1 pass–through binding, all ToolbarView#items are focusable.\n        view.focusables.bindTo(view.items).using(item => isFocusable(item) ? item : null);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() { }\n    /**\n     * @inheritDoc\n     */\n    destroy() { }\n}\n/**\n * A toolbar behavior that makes the items respond to changes in the geometry.\n *\n * In a nutshell, it groups {@link module:ui/toolbar/toolbarview~ToolbarView#items}\n * that do not fit visually into a single row of the toolbar (due to limited space).\n * Items that do not fit are aggregated in a dropdown displayed at the end of the toolbar.\n *\n * ```\n *\t┌──────────────────────────────────────── ToolbarView ──────────────────────────────────────────┐\n *\t| ┌─────────────────────────────────────── #children ─────────────────────────────────────────┐ |\n *\t| |   ┌─────── #itemsView ────────┐ ┌──────────────────────┐ ┌── #groupedItemsDropdown ───┐   | |\n *\t| |   |       #ungroupedItems     | | ToolbarSeparatorView | |        #groupedItems       |   | |\n *\t| |   └──────────────────────────-┘ └──────────────────────┘ └────────────────────────────┘   | |\n *\t| |                                  \\---------- only when toolbar items overflow -------/    | |\n *\t| └───────────────────────────────────────────────────────────────────────────────────────────┘ |\n *\t└───────────────────────────────────────────────────────────────────────────────────────────────┘\n * ```\n */\nclass DynamicGrouping {\n    /**\n     * Toolbar behavior type.\n     */\n    type = 'dynamic';\n    /**\n     * A toolbar view this behavior belongs to.\n     */\n    view;\n    /**\n     * A collection of toolbar children.\n     */\n    viewChildren;\n    /**\n     * A collection of focusable toolbar elements.\n     */\n    viewFocusables;\n    /**\n     * A view containing toolbar items.\n     */\n    viewItemsView;\n    /**\n     * Toolbar focus tracker.\n     */\n    viewFocusTracker;\n    /**\n     * Toolbar locale.\n     */\n    viewLocale;\n    /**\n     * A subset of toolbar {@link module:ui/toolbar/toolbarview~ToolbarView#items}.\n     * Aggregates items that fit into a single row of the toolbar and were not {@link #groupedItems grouped}\n     * into a {@link #groupedItemsDropdown dropdown}. Items of this collection are displayed in the\n     * {@link module:ui/toolbar/toolbarview~ToolbarView#itemsView}.\n     *\n     * When none of the {@link module:ui/toolbar/toolbarview~ToolbarView#items} were grouped, it\n     * matches the {@link module:ui/toolbar/toolbarview~ToolbarView#items} collection in size and order.\n     */\n    ungroupedItems;\n    /**\n     * A subset of toolbar {@link module:ui/toolbar/toolbarview~ToolbarView#items}.\n     * A collection of the toolbar items that do not fit into a single row of the toolbar.\n     * Grouped items are displayed in a dedicated {@link #groupedItemsDropdown dropdown}.\n     *\n     * When none of the {@link module:ui/toolbar/toolbarview~ToolbarView#items} were grouped,\n     * this collection is empty.\n     */\n    groupedItems;\n    /**\n     * The dropdown that aggregates {@link #groupedItems grouped items} that do not fit into a single\n     * row of the toolbar. It is displayed on demand as the last of\n     * {@link module:ui/toolbar/toolbarview~ToolbarView#children toolbar children} and offers another\n     * (nested) toolbar which displays items that would normally overflow.\n     */\n    groupedItemsDropdown;\n    /**\n     * An instance of the resize observer that helps dynamically determine the geometry of the toolbar\n     * and manage items that do not fit into a single row.\n     *\n     * **Note:** Created in {@link #_enableGroupingOnResize}.\n     *\n     * @readonly\n     */\n    resizeObserver = null;\n    /**\n     * A cached value of the horizontal padding style used by {@link #_updateGrouping}\n     * to manage the {@link module:ui/toolbar/toolbarview~ToolbarView#items} that do not fit into\n     * a single toolbar line. This value can be reused between updates because it is unlikely that\n     * the padding will change and re–using `Window.getComputedStyle()` is expensive.\n     *\n     * @readonly\n     */\n    cachedPadding = null;\n    /**\n     * A flag indicating that an items grouping update has been queued (e.g. due to the toolbar being visible)\n     * and should be executed immediately the next time the toolbar shows up.\n     *\n     * @readonly\n     */\n    shouldUpdateGroupingOnNextResize = false;\n    /**\n     * Toolbar element.\n     *\n     * @readonly\n     */\n    viewElement;\n    /**\n     * Creates an instance of the {@link module:ui/toolbar/toolbarview~DynamicGrouping} toolbar\n     * behavior.\n     *\n     * @param view An instance of the toolbar that this behavior is added to.\n     */\n    constructor(view) {\n        this.view = view;\n        this.viewChildren = view.children;\n        this.viewFocusables = view.focusables;\n        this.viewItemsView = view.itemsView;\n        this.viewFocusTracker = view.focusTracker;\n        this.viewLocale = view.locale;\n        this.view.isGrouping = true;\n        this.ungroupedItems = view.createCollection();\n        this.groupedItems = view.createCollection();\n        this.groupedItemsDropdown = this._createGroupedItemsDropdown();\n        // Only those items that were not grouped are visible to the user.\n        view.itemsView.children.bindTo(this.ungroupedItems).using(item => item);\n        // Make sure all #items visible in the main space of the toolbar are \"focuscyclable\".\n        this.ungroupedItems.on('change', this._updateFocusCyclableItems.bind(this));\n        // Make sure the #groupedItemsDropdown is also included in cycling when it appears.\n        view.children.on('change', this._updateFocusCyclableItems.bind(this));\n        // ToolbarView#items is dynamic. When an item is added or removed, it should be automatically\n        // represented in either grouped or ungrouped items at the right index.\n        // In other words #items == concat( #ungroupedItems, #groupedItems )\n        // (in length and order).\n        view.items.on('change', (evt, changeData) => {\n            const index = changeData.index;\n            const added = Array.from(changeData.added);\n            // Removing.\n            for (const removedItem of changeData.removed) {\n                if (index >= this.ungroupedItems.length) {\n                    this.groupedItems.remove(removedItem);\n                }\n                else {\n                    this.ungroupedItems.remove(removedItem);\n                }\n            }\n            // Adding.\n            for (let currentIndex = index; currentIndex < index + added.length; currentIndex++) {\n                const addedItem = added[currentIndex - index];\n                if (currentIndex > this.ungroupedItems.length) {\n                    this.groupedItems.add(addedItem, currentIndex - this.ungroupedItems.length);\n                }\n                else {\n                    this.ungroupedItems.add(addedItem, currentIndex);\n                }\n            }\n            // When new ungrouped items join in and land in #ungroupedItems, there's a chance it causes\n            // the toolbar to overflow.\n            // Consequently if removed from grouped or ungrouped items, there is a chance\n            // some new space is available and we could do some ungrouping.\n            this._updateGrouping();\n        });\n    }\n    /**\n     * Enables dynamic items grouping based on the dimensions of the toolbar.\n     *\n     * @param view An instance of the toolbar that this behavior is added to.\n     */\n    render(view) {\n        this.viewElement = view.element;\n        this._enableGroupingOnResize();\n        this._enableGroupingOnMaxWidthChange(view);\n    }\n    /**\n     * Cleans up the internals used by this behavior.\n     */\n    destroy() {\n        // The dropdown may not be in ToolbarView#children at the moment of toolbar destruction\n        // so let's make sure it's actually destroyed along with the toolbar.\n        this.groupedItemsDropdown.destroy();\n        // Do not try to remove the same elements if they are already removed.\n        if (this.viewChildren.length > 1) {\n            this.viewChildren.remove(this.groupedItemsDropdown);\n            this.viewChildren.remove(this.viewChildren.last);\n        }\n        this.resizeObserver.destroy();\n    }\n    /**\n     * Re-adds all items to the toolbar. Use when the toolbar is re-rendered and the items grouping is lost.\n     */\n    refreshItems() {\n        const view = this.view;\n        if (view.items.length) {\n            for (let currentIndex = 0; currentIndex < view.items.length; currentIndex++) {\n                const item = [...view.items][currentIndex];\n                this.ungroupedItems.add(item, currentIndex);\n            }\n            this._updateGrouping();\n        }\n    }\n    /**\n     * When called, it will check if any of the {@link #ungroupedItems} do not fit into a single row of the toolbar,\n     * and it will move them to the {@link #groupedItems} when it happens.\n     *\n     * At the same time, it will also check if there is enough space in the toolbar for the first of the\n     * {@link #groupedItems} to be returned back to {@link #ungroupedItems} and still fit into a single row\n     * without the toolbar wrapping.\n     */\n    _updateGrouping() {\n        // Do no grouping–related geometry analysis when the toolbar is detached from visible DOM,\n        // for instance before #render(), or after render but without a parent or a parent detached\n        // from DOM. DOMRects won't work anyway and there will be tons of warning in the console and\n        // nothing else. This happens, for instance, when the toolbar is detached from DOM and\n        // some logic adds or removes its #items.\n        if (!this.viewElement.ownerDocument.body.contains(this.viewElement)) {\n            return;\n        }\n        // Do not update grouping when the element is invisible. Such toolbar has DOMRect filled with zeros\n        // and that would cause all items to be grouped. Instead, queue the grouping so it runs next time\n        // the toolbar is visible (the next ResizeObserver callback execution). This is handy because\n        // the grouping could be caused by increasing the #maxWidth when the toolbar was invisible and the next\n        // time it shows up, some items could actually be ungrouped (https://github.com/ckeditor/ckeditor5/issues/6575).\n        if (!isVisible(this.viewElement)) {\n            this.shouldUpdateGroupingOnNextResize = true;\n            return;\n        }\n        // Remember how many items were initially grouped so at the it is possible to figure out if the number\n        // of grouped items has changed. If the number has changed, geometry of the toolbar has also changed.\n        const initialGroupedItemsCount = this.groupedItems.length;\n        let wereItemsGrouped;\n        // Group #items as long as some wrap to the next row. This will happen, for instance,\n        // when the toolbar is getting narrow and there is not enough space to display all items in\n        // a single row.\n        while (this._areItemsOverflowing) {\n            this._groupLastItem();\n            wereItemsGrouped = true;\n        }\n        // If none were grouped now but there were some items already grouped before,\n        // then, what the hell, maybe let's see if some of them can be ungrouped. This happens when,\n        // for instance, the toolbar is stretching and there's more space in it than before.\n        if (!wereItemsGrouped && this.groupedItems.length) {\n            // Ungroup items as long as none are overflowing or there are none to ungroup left.\n            while (this.groupedItems.length && !this._areItemsOverflowing) {\n                this._ungroupFirstItem();\n            }\n            // If the ungrouping ended up with some item wrapping to the next row,\n            // put it back to the group toolbar (\"undo the last ungroup\"). We don't know whether\n            // an item will wrap or not until we ungroup it (that's a DOM/CSS thing) so this\n            // clean–up is vital for the algorithm.\n            if (this._areItemsOverflowing) {\n                this._groupLastItem();\n            }\n        }\n        if (this.groupedItems.length !== initialGroupedItemsCount) {\n            this.view.fire('groupedItemsUpdate');\n        }\n    }\n    /**\n     * Returns `true` when {@link module:ui/toolbar/toolbarview~ToolbarView#element} children visually overflow,\n     * for instance if the toolbar is narrower than its members. Returns `false` otherwise.\n     */\n    get _areItemsOverflowing() {\n        // An empty toolbar cannot overflow.\n        if (!this.ungroupedItems.length) {\n            return false;\n        }\n        const element = this.viewElement;\n        const uiLanguageDirection = this.viewLocale.uiLanguageDirection;\n        const lastChildRect = new Rect(element.lastChild);\n        const toolbarRect = new Rect(element);\n        if (!this.cachedPadding) {\n            const computedStyle = global.window.getComputedStyle(element);\n            const paddingProperty = uiLanguageDirection === 'ltr' ? 'paddingRight' : 'paddingLeft';\n            // parseInt() is essential because of quirky floating point numbers logic and DOM.\n            // If the padding turned out too big because of that, the grouped items dropdown would\n            // always look (from the Rect perspective) like it overflows (while it's not).\n            this.cachedPadding = Number.parseInt(computedStyle[paddingProperty]);\n        }\n        if (uiLanguageDirection === 'ltr') {\n            return lastChildRect.right > toolbarRect.right - this.cachedPadding;\n        }\n        else {\n            return lastChildRect.left < toolbarRect.left + this.cachedPadding;\n        }\n    }\n    /**\n     * Enables the functionality that prevents {@link #ungroupedItems} from overflowing (wrapping to the next row)\n     * upon resize when there is little space available. Instead, the toolbar items are moved to the\n     * {@link #groupedItems} collection and displayed in a dropdown at the end of the row (which has its own nested toolbar).\n     *\n     * When called, the toolbar will automatically analyze the location of its {@link #ungroupedItems} and \"group\"\n     * them in the dropdown if necessary. It will also observe the browser window for size changes in\n     * the future and respond to them by grouping more items or reverting already grouped back, depending\n     * on the visual space available.\n     */\n    _enableGroupingOnResize() {\n        let previousWidth;\n        // TODO: Consider debounce.\n        this.resizeObserver = new ResizeObserver(this.viewElement, entry => {\n            if (!previousWidth || previousWidth !== entry.contentRect.width || this.shouldUpdateGroupingOnNextResize) {\n                this.shouldUpdateGroupingOnNextResize = false;\n                this._updateGrouping();\n                previousWidth = entry.contentRect.width;\n            }\n        });\n        this._updateGrouping();\n    }\n    /**\n     * Enables the grouping functionality, just like {@link #_enableGroupingOnResize} but the difference is that\n     * it listens to the changes of {@link module:ui/toolbar/toolbarview~ToolbarView#maxWidth} instead.\n     */\n    _enableGroupingOnMaxWidthChange(view) {\n        view.on('change:maxWidth', () => {\n            this._updateGrouping();\n        });\n    }\n    /**\n     * When called, it will remove the last item from {@link #ungroupedItems} and move it back\n     * to the {@link #groupedItems} collection.\n     *\n     * The opposite of {@link #_ungroupFirstItem}.\n     */\n    _groupLastItem() {\n        if (!this.groupedItems.length) {\n            this.viewChildren.add(new ToolbarSeparatorView());\n            this.viewChildren.add(this.groupedItemsDropdown);\n            this.viewFocusTracker.add(this.groupedItemsDropdown.element);\n        }\n        this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last), 0);\n    }\n    /**\n     * Moves the very first item belonging to {@link #groupedItems} back\n     * to the {@link #ungroupedItems} collection.\n     *\n     * The opposite of {@link #_groupLastItem}.\n     */\n    _ungroupFirstItem() {\n        this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first));\n        if (!this.groupedItems.length) {\n            this.viewChildren.remove(this.groupedItemsDropdown);\n            this.viewChildren.remove(this.viewChildren.last);\n            this.viewFocusTracker.remove(this.groupedItemsDropdown.element);\n        }\n    }\n    /**\n     * Creates the {@link #groupedItemsDropdown} that hosts the members of the {@link #groupedItems}\n     * collection when there is not enough space in the toolbar to display all items in a single row.\n     */\n    _createGroupedItemsDropdown() {\n        const locale = this.viewLocale;\n        const t = locale.t;\n        const dropdown = createDropdown(locale);\n        dropdown.class = 'ck-toolbar__grouped-dropdown';\n        // Make sure the dropdown never sticks out to the left/right. It should be under the main toolbar.\n        // (https://github.com/ckeditor/ckeditor5/issues/5608)\n        dropdown.panelPosition = locale.uiLanguageDirection === 'ltr' ? 'sw' : 'se';\n        addToolbarToDropdown(dropdown, this.groupedItems);\n        dropdown.buttonView.set({\n            label: t('Show more items'),\n            tooltip: true,\n            tooltipPosition: locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw',\n            icon: IconThreeVerticalDots\n        });\n        return dropdown;\n    }\n    /**\n     * Updates the {@link module:ui/toolbar/toolbarview~ToolbarView#focusables focus–cyclable items}\n     * collection so it represents the up–to–date state of the UI from the perspective of the user.\n     *\n     * For instance, the {@link #groupedItemsDropdown} can show up and hide but when it is visible,\n     * it must be subject to focus cycling in the toolbar.\n     *\n     * See the {@link module:ui/toolbar/toolbarview~ToolbarView#focusables collection} documentation\n     * to learn more about the purpose of this method.\n     */\n    _updateFocusCyclableItems() {\n        this.viewFocusables.clear();\n        this.ungroupedItems.map(item => {\n            if (isFocusable(item)) {\n                this.viewFocusables.add(item);\n            }\n        });\n        if (this.groupedItems.length) {\n            this.viewFocusables.add(this.groupedItemsDropdown);\n        }\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822zM14 5V2l3.3 3zm-3.692 12.5q.093.157.213.303L11.52 19H8v-.876a2.24 2.24 0 0 0 1.82-.624zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5M5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663z\\\"/><path d=\\\"m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m-7 6.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * A helper which executes a native `Event.preventDefault()` if the target of an event equals the\n * {@link module:ui/view~View#element element of the view}. It shortens the definition of a\n * {@link module:ui/view~View#template template}.\n *\n * ```ts\n * // In a class extending View.\n * import { preventDefault } from '@ckeditor/ckeditor5-ui/src/bindings/preventdefault';\n *\n * // ...\n *\n * this.setTemplate( {\n * \ttag: 'div',\n *\n * \ton: {\n * \t\t// Prevent the default mousedown action on this view.\n * \t\tmousedown: preventDefault( this )\n * \t}\n * } );\n * ```\n *\n * @param view View instance that defines the template.\n * @internal\n */\nexport function preventDefault(view) {\n    return view.bindTemplate.to(evt => {\n        if (evt.target === view.element) {\n            evt.preventDefault();\n        }\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/menubar/menubarmenubuttonview\n */\nimport { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';\nimport { IconView } from '../icon/iconview.js';\nimport { ListItemButtonView } from '../button/listitembuttonview.js';\nimport '../../theme/components/menubar/menubarmenubutton.css';\n/**\n * A menu {@link module:ui/menubar/menubarmenuview~MenuBarMenuView#buttonView} class. Buttons like this one\n * open both top-level bar menus as well as sub-menus.\n */\nexport class MenuBarMenuButtonView extends ListItemButtonView {\n    /**\n     * An icon that displays an arrow to indicate a direction of the menu.\n     */\n    arrowView;\n    /**\n     * Creates an instance of the menu bar button view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set({\n            withText: true,\n            role: 'menuitem'\n        });\n        this.arrowView = this._createArrowView();\n        this.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-menu-bar__menu__button'\n                ],\n                'aria-haspopup': true,\n                'aria-expanded': this.bindTemplate.to('isOn', value => String(value)),\n                'data-cke-tooltip-disabled': bind.to('isOn')\n            },\n            on: {\n                'mouseenter': bind.to('mouseenter')\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.children.add(this.arrowView);\n    }\n    /**\n     * Creates the {@link #arrowView} instance.\n     */\n    _createArrowView() {\n        const arrowView = new IconView();\n        arrowView.content = IconDropdownArrow;\n        arrowView.extendTemplate({\n            attributes: {\n                class: 'ck-menu-bar__menu__button__arrow'\n            }\n        });\n        return arrowView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { View } from '../view.js';\nimport '../../theme/components/menubar/menubarmenupanel.css';\n/**\n * A view representing a {@link module:ui/menubar/menubarmenuview~MenuBarMenuView#panelView} of a menu.\n */\nexport class MenuBarMenuPanelView extends View {\n    /**\n     * Collection of the child views in this panel.\n     */\n    children;\n    /**\n     * Creates an instance of the menu panel view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('isVisible', false);\n        this.set('position', 'se');\n        this.children = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-reset',\n                    'ck-menu-bar__menu__panel',\n                    bind.to('position', value => `ck-menu-bar__menu__panel_position_${value}`),\n                    bind.if('isVisible', 'ck-hidden', value => !value)\n                ],\n                tabindex: '-1'\n            },\n            children: this.children,\n            on: {\n                // Drag and drop in the panel should not break the selection in the editor.\n                // https://github.com/ckeditor/ckeditor5-ui/issues/228\n                selectstart: bind.to(evt => {\n                    if (evt.target.tagName.toLocaleLowerCase() === 'input') {\n                        return;\n                    }\n                    evt.preventDefault();\n                })\n            }\n        });\n    }\n    /**\n     * Focuses the first child of the panel (default) or the last one if the `direction` is `-1`.\n     */\n    focus(direction = 1) {\n        if (this.children.length) {\n            if (direction === 1) {\n                this.children.first.focus();\n            }\n            else {\n                this.children.last.focus();\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/menubar/menubarmenuview\n */\nimport { FocusTracker, KeystrokeHandler, getOptimalPosition } from '@ckeditor/ckeditor5-utils';\nimport { MenuBarMenuButtonView } from './menubarmenubuttonview.js';\nimport { MenuBarMenuBehaviors, MenuBarMenuViewPanelPositioningFunctions } from './utils.js';\nimport { View } from '../view.js';\nimport { MenuBarMenuPanelView } from './menubarmenupanelview.js';\nimport '../../theme/components/menubar/menubarmenu.css';\n/**\n * A menu view for the {@link module:ui/menubar/menubarview~MenuBarView}. Menus are building blocks of the menu bar,\n * they host other sub-menus and menu items (buttons) that users can interact with.\n */\nexport class MenuBarMenuView extends View {\n    /**\n     * Button of the menu view.\n     */\n    buttonView;\n    /**\n     * Panel of the menu. It hosts children of the menu.\n     */\n    panelView;\n    /**\n     * Tracks information about the DOM focus in the menu.\n     */\n    focusTracker;\n    /**\n     * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages\n     * keystrokes of the menu.\n     */\n    keystrokes;\n    /**\n     * Creates an instance of the menu view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.buttonView = new MenuBarMenuButtonView(locale);\n        this.buttonView.delegate('mouseenter').to(this);\n        this.buttonView.bind('isOn', 'isEnabled').to(this, 'isOpen', 'isEnabled');\n        this.panelView = new MenuBarMenuPanelView(locale);\n        this.panelView.bind('isVisible').to(this, 'isOpen');\n        this.keystrokes = new KeystrokeHandler();\n        this.focusTracker = new FocusTracker();\n        this.set('isOpen', false);\n        this.set('isEnabled', true);\n        this.set('panelPosition', 'w');\n        this.set('class', undefined);\n        this.set('parentMenuView', null);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-menu-bar__menu',\n                    bind.to('class'),\n                    bind.if('isEnabled', 'ck-disabled', value => !value),\n                    bind.if('parentMenuView', 'ck-menu-bar__menu_top-level', value => !value)\n                ]\n            },\n            children: [\n                this.buttonView,\n                this.panelView\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.focusTracker.add(this.buttonView.element);\n        this.focusTracker.add(this.panelView.element);\n        // Listen for keystrokes coming from within #element.\n        this.keystrokes.listenTo(this.element);\n        MenuBarMenuBehaviors.closeOnEscKey(this);\n        this._repositionPanelOnOpen();\n    }\n    // For now, this method cannot be called in the render process because the `parentMenuView` may be assigned\n    // after the rendering process.\n    //\n    // TODO: We should reconsider the way we handle this logic.\n    /**\n     * Attach all keyboard behaviors for the menu bar view.\n     *\n     * @internal\n     */\n    _attachBehaviors() {\n        // Top-level menus.\n        if (!this.parentMenuView) {\n            this._propagateArrowKeystrokeEvents();\n            MenuBarMenuBehaviors.openAndFocusPanelOnArrowDownKey(this);\n            MenuBarMenuBehaviors.toggleOnButtonClick(this);\n        }\n        else {\n            MenuBarMenuBehaviors.openOnButtonClick(this);\n            MenuBarMenuBehaviors.openOnArrowRightKey(this);\n            MenuBarMenuBehaviors.closeOnArrowLeftKey(this);\n            MenuBarMenuBehaviors.openAndFocusOnEnterKeyPress(this);\n            MenuBarMenuBehaviors.closeOnParentClose(this);\n        }\n    }\n    /**\n     * Fires `arrowright` and `arrowleft` events when the user pressed corresponding arrow keys.\n     */\n    _propagateArrowKeystrokeEvents() {\n        this.keystrokes.set('arrowright', (data, cancel) => {\n            this.fire('arrowright');\n            cancel();\n        });\n        this.keystrokes.set('arrowleft', (data, cancel) => {\n            this.fire('arrowleft');\n            cancel();\n        });\n    }\n    /**\n     * Sets the position of the panel when the menu opens. The panel is positioned\n     * so that it optimally uses the available space in the viewport.\n     */\n    _repositionPanelOnOpen() {\n        // Let the menu control the position of the panel. The position must be updated every time the menu is open.\n        this.on('change:isOpen', (evt, name, isOpen) => {\n            if (!isOpen) {\n                return;\n            }\n            const optimalPanelPosition = MenuBarMenuView._getOptimalPosition({\n                element: this.panelView.element,\n                target: this.buttonView.element,\n                fitInViewport: true,\n                positions: this._panelPositions\n            });\n            this.panelView.position = (optimalPanelPosition ? optimalPanelPosition.name : this._defaultMenuPositionName);\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    focus() {\n        this.buttonView.focus();\n    }\n    /**\n     * Positioning functions for the {@link #panelView} . They change depending on the role of the menu (top-level vs sub-menu) in\n     * the {@link module:ui/menubar/menubarview~MenuBarView menu bar} and the UI language direction.\n     */\n    get _panelPositions() {\n        const { southEast, southWest, northEast, northWest, westSouth, eastSouth, westNorth, eastNorth } = MenuBarMenuViewPanelPositioningFunctions;\n        if (this.locale.uiLanguageDirection === 'ltr') {\n            if (this.parentMenuView) {\n                return [eastSouth, eastNorth, westSouth, westNorth];\n            }\n            else {\n                return [southEast, southWest, northEast, northWest];\n            }\n        }\n        else {\n            if (this.parentMenuView) {\n                return [westSouth, westNorth, eastSouth, eastNorth];\n            }\n            else {\n                return [southWest, southEast, northWest, northEast];\n            }\n        }\n    }\n    /**\n     * The default position of the panel when the menu is opened.\n     * It is used when the optimal position cannot be calculated.\n     */\n    get _defaultMenuPositionName() {\n        if (this.locale.uiLanguageDirection === 'ltr') {\n            if (this.parentMenuView) {\n                return 'es';\n            }\n            else {\n                return 'se';\n            }\n        }\n        else {\n            if (this.parentMenuView) {\n                return 'ws';\n            }\n            else {\n                return 'sw';\n            }\n        }\n    }\n    /**\n     * A function used to calculate the optimal position for the dropdown panel.\n     *\n     * Referenced for unit testing purposes.\n     */\n    static _getOptimalPosition = getOptimalPosition;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ListItemView } from '../list/listitemview.js';\nimport { ListView } from '../list/listview.js';\nimport { ListItemButtonView } from '../button/listitembuttonview.js';\nimport { ButtonView } from '../button/buttonview.js';\n/**\n * A list of menu bar items, a child of {@link module:ui/menubar/menubarmenuview~MenuBarMenuView#panelView}.\n *\n * Use this class to create a list of items (options, buttons) to be displayed in a menu bar.\n *\n * To populate this list, use {@link module:ui/menubar/menubarmenulistitemview~MenuBarMenuListItemView} instances.\n */\nexport class MenuBarMenuListView extends ListView {\n    /**\n     * Creates an instance of the list view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.role = 'menu';\n        this.items.on('change', this._setItemsCheckSpace.bind(this));\n    }\n    /**\n     * This method adds empty space if there is any toggleable item in the list.\n     * It makes the list properly aligned.\n     */\n    _setItemsCheckSpace() {\n        const hasAnyToggleableItem = (Array\n            .from(this.items)\n            .some(item => {\n            const listButtonView = pickListButtonMenuViewIfPresent(item);\n            return listButtonView && listButtonView.isToggleable;\n        }));\n        this.items.forEach(item => {\n            const listButtonView = pickListButtonMenuViewIfPresent(item);\n            if (listButtonView) {\n                listButtonView.hasCheckSpace = hasAnyToggleableItem;\n            }\n        });\n    }\n}\n/**\n * Picks the first button menu view from the given item if present.\n *\n * @param item The item to check for a button menu view.\n * @returns The first button menu view found in the item, or `null` if not found.\n */\nfunction pickListButtonMenuViewIfPresent(item) {\n    if (!(item instanceof ListItemView)) {\n        return null;\n    }\n    return item\n        .children\n        .map(child => isNestedMenuLikeView(child) ? child.buttonView : child)\n        .find(item => item instanceof ListItemButtonView);\n}\n/**\n * Checks if the given item is a nested menu-like view. `MenuBarMenuView` imports this file\n * so to avoid circular dependencies, this function is defined in more generic way.\n *\n * @param item The item to check.\n * @returns `true` if the item is a nested menu-like view, `false` otherwise.\n */\nfunction isNestedMenuLikeView(item) {\n    return (typeof item === 'object' &&\n        'buttonView' in item &&\n        item.buttonView instanceof ButtonView);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ListItemButtonView } from '../button/listitembuttonview.js';\nimport '../../theme/components/menubar/menubarmenulistitembutton.css';\n/**\n * A menu bar list button view. Buttons like this one execute user actions.\n */\nexport class MenuBarMenuListItemButtonView extends ListItemButtonView {\n    /**\n     * Creates an instance of the menu bar list button view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.set({\n            withText: true,\n            withKeystroke: true,\n            tooltip: false,\n            role: 'menuitem'\n        });\n        this.extendTemplate({\n            attributes: {\n                class: ['ck-menu-bar__menu__item__button']\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/button/filedialogbuttonview\n */\nimport { View } from '../view.js';\nimport { ButtonView } from './buttonview.js';\nimport { ListItemButtonView } from './listitembuttonview.js';\n/**\n * The file dialog button view.\n *\n * This component provides a button that opens the native file selection dialog.\n * It can be used to implement the UI of a file upload feature.\n *\n * ```ts\n * const view = new FileDialogButtonView( locale );\n *\n * view.set( {\n * \tacceptedType: 'image/*',\n * \tallowMultipleFiles: true\n * \tlabel: t( 'Insert image' ),\n * \ticon: imageIcon,\n * \ttooltip: true\n * } );\n *\n * view.on( 'done', ( evt, files ) => {\n * \tfor ( const file of Array.from( files ) ) {\n * \t\tconsole.log( 'Selected file', file );\n * \t}\n * } );\n * ```\n */\nexport class FileDialogButtonView extends /* #__PURE__ */ FileDialogViewMixin(ButtonView) {\n}\n/**\n * The file dialog button view used in a lists.\n *\n * This component provides a button that opens the native file selection dialog.\n * It can be used to implement the UI of a file upload feature.\n *\n* ```ts\n * const view = new FileDialogListItemButtonView( locale );\n *\n * view.set( {\n * \tacceptedType: 'image/*',\n * \tallowMultipleFiles: true\n * \tlabel: t( 'Insert image' ),\n * \ticon: imageIcon,\n * \ttooltip: true\n * } );\n *\n * view.on( 'done', ( evt, files ) => {\n * \tfor ( const file of Array.from( files ) ) {\n * \t\tconsole.log( 'Selected file', file );\n * \t}\n * } );\n * ```\n */\nexport class FileDialogListItemButtonView extends /* #__PURE__ */ FileDialogViewMixin(ListItemButtonView) {\n}\n/**\n * Mixin function that enhances a base button view class with file dialog functionality. It is used\n * to create a button view class that opens the native select file dialog when clicked.\n *\n * The enhanced view includes a button and a hidden file input. When the button is clicked, the file dialog is opened.\n * The mixin adds properties and methods to the base class to handle the file selection.\n *\n * @param view The base class to be enhanced with file dialog functionality.\n * @returns A new class that extends the base class and includes the file dialog functionality.\n */\nexport function FileDialogViewMixin(view) {\n    class FileDialogView extends view {\n        /**\n         * A hidden `<input>` view used to execute file dialog.\n         */\n        _fileInputView;\n        /**\n         * @inheritDoc\n         */\n        constructor(...args) {\n            super(...args);\n            this._fileInputView = new FileInputView(this.locale);\n            this._fileInputView.bind('acceptedType').to(this);\n            this._fileInputView.bind('allowMultipleFiles').to(this);\n            this._fileInputView.delegate('done').to(this);\n            this.on('execute', () => {\n                this._fileInputView.open();\n            });\n            this.extendTemplate({\n                attributes: {\n                    class: 'ck-file-dialog-button'\n                }\n            });\n        }\n        /**\n         * @inheritDoc\n         */\n        render() {\n            super.render();\n            this.children.add(this._fileInputView);\n        }\n    }\n    return FileDialogView;\n}\n/**\n * The hidden file input view class.\n */\nclass FileInputView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.set('acceptedType', undefined);\n        this.set('allowMultipleFiles', false);\n        const bind = this.bindTemplate;\n        this.setTemplate({\n            tag: 'input',\n            attributes: {\n                class: [\n                    'ck-hidden'\n                ],\n                type: 'file',\n                tabindex: '-1',\n                accept: bind.to('acceptedType'),\n                multiple: bind.to('allowMultipleFiles')\n            },\n            on: {\n                // Removing from code coverage since we cannot programmatically set input element files.\n                change: bind.to(/* istanbul ignore next -- @preserve */ () => {\n                    if (this.element?.files?.length) {\n                        this.fire('done', this.element.files);\n                    }\n                    this.element.value = '';\n                })\n            }\n        });\n    }\n    /**\n     * Opens file dialog.\n     */\n    open() {\n        this.element.click();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { FileDialogListItemButtonView } from '../button/filedialogbuttonview.js';\nimport '../../theme/components/menubar/menubarmenulistitembutton.css';\n/**\n * A menu bar list file dialog button view. Buttons like this one execute user actions.\n *\n * This component provides a button that opens the native file selection dialog.\n */\nexport class MenuBarMenuListItemFileDialogButtonView extends FileDialogListItemButtonView {\n    /**\n     * Creates an instance of the menu bar list button view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.set({\n            withText: true,\n            withKeystroke: true,\n            tooltip: false,\n            role: 'menuitem'\n        });\n        this.extendTemplate({\n            attributes: {\n                class: ['ck-menu-bar__menu__item__button']\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/menubar/menubarview\n */\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\nimport { View } from '../view.js';\nimport { isObject } from 'es-toolkit/compat';\nimport { ListItemView } from '../list/listitemview.js';\nimport { ListSeparatorView } from '../list/listseparatorview.js';\nimport { MenuBarMenuView } from './menubarmenuview.js';\nimport { MenuBarMenuListView } from './menubarmenulistview.js';\nimport { MenuBarMenuListItemView } from './menubarmenulistitemview.js';\nimport { MenuBarMenuListItemButtonView } from './menubarmenulistitembuttonview.js';\nimport { MenuBarMenuListItemFileDialogButtonView } from './menubarmenulistitemfiledialogbuttonview.js';\nimport { MenuBarBehaviors, processMenuBarConfig } from './utils.js';\nconst EVENT_NAME_DELEGATES = ['mouseenter', 'arrowleft', 'arrowright', 'change:isOpen'];\nimport '../../theme/components/menubar/menubar.css';\n/**\n * The application menu bar component. It brings a set of top-level menus (and sub-menus) that can be used\n * to organize and access a large number of buttons.\n */\nexport class MenuBarView extends View {\n    /**\n     * Collection of the child views inside the {@link #element}.\n     */\n    children;\n    /**\n     * A list of {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} instances registered in the menu bar.\n     *\n     * @observable\n     */\n    menus = [];\n    /**\n     * Creates an instance of the menu bar view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        const t = locale.t;\n        const bind = this.bindTemplate;\n        this.set({\n            isOpen: false,\n            isFocusBorderEnabled: false\n        });\n        this._setupIsOpenUpdater();\n        this.children = this.createCollection();\n        // @if CK_DEBUG_MENU_BAR // // Logs events in the main event bus of the component.\n        // @if CK_DEBUG_MENU_BAR // this.on( 'menu', ( evt, data ) => {\n        // @if CK_DEBUG_MENU_BAR // \tconsole.log( `MenuBarView:${ evt.name }`, evt.path.map( view => view.element ) );\n        // @if CK_DEBUG_MENU_BAR // } );\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-menu-bar',\n                    bind.if('isFocusBorderEnabled', 'ck-menu-bar_focus-border-enabled')\n                ],\n                'aria-label': t('Editor menu bar'),\n                role: 'menubar'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * A utility that expands a plain menu bar configuration into a structure of menus (also: sub-menus)\n     * and items using a given {@link module:ui/componentfactory~ComponentFactory component factory}.\n     *\n     * See the {@link module:core/editor/editorconfig~EditorConfig#menuBar menu bar} in the editor\n     * configuration reference to learn how to configure the menu bar.\n     */\n    fillFromConfig(config, componentFactory, extraItems = []) {\n        const locale = this.locale;\n        const processedConfig = processMenuBarConfig({\n            normalizedConfig: config,\n            locale,\n            componentFactory,\n            extraItems\n        });\n        const topLevelCategoryMenuViews = processedConfig.items.map(menuDefinition => this._createMenu({\n            componentFactory,\n            menuDefinition\n        }));\n        this.children.addMany(topLevelCategoryMenuViews);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        MenuBarBehaviors.toggleMenusAndFocusItemsOnHover(this);\n        MenuBarBehaviors.closeMenusWhenTheBarCloses(this);\n        MenuBarBehaviors.closeMenuWhenAnotherOnTheSameLevelOpens(this);\n        MenuBarBehaviors.focusCycleMenusOnArrows(this);\n        MenuBarBehaviors.closeOnClickOutside(this);\n        MenuBarBehaviors.enableFocusHighlightOnInteraction(this);\n    }\n    /**\n     * Focuses the menu bar.\n     */\n    focus() {\n        if (this.children.first) {\n            this.children.first.focus();\n        }\n    }\n    /**\n     * Closes all menus in the bar.\n     */\n    close() {\n        for (const topLevelCategoryMenuView of this.children) {\n            topLevelCategoryMenuView.isOpen = false;\n        }\n    }\n    /**\n     * Disables all menus in the bar.\n     */\n    disable() {\n        for (const topLevelCategoryMenuView of this.children) {\n            topLevelCategoryMenuView.isEnabled = false;\n        }\n    }\n    /**\n     * Enables all menus in the bar.\n     */\n    enable() {\n        for (const topLevelCategoryMenuView of this.children) {\n            topLevelCategoryMenuView.isEnabled = true;\n        }\n    }\n    /**\n     * Registers a menu view in the menu bar. Every {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} instance must be registered\n     * in the menu bar to be properly managed.\n     */\n    registerMenu(menuView, parentMenuView = null) {\n        if (parentMenuView) {\n            menuView.delegate(...EVENT_NAME_DELEGATES).to(parentMenuView);\n            menuView.parentMenuView = parentMenuView;\n        }\n        else {\n            menuView.delegate(...EVENT_NAME_DELEGATES).to(this, name => 'menu:' + name);\n        }\n        menuView._attachBehaviors();\n        this.menus.push(menuView);\n    }\n    /**\n     * Creates a {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} based on the given definition.\n     */\n    _createMenu({ componentFactory, menuDefinition, parentMenuView }) {\n        const locale = this.locale;\n        const menuView = new MenuBarMenuView(locale);\n        this.registerMenu(menuView, parentMenuView);\n        menuView.buttonView.set({\n            label: menuDefinition.label\n        });\n        // Defer the creation of the menu structure until it gets open. This is a performance optimization\n        // that shortens the time needed to create the editor.\n        menuView.once('change:isOpen', () => {\n            const listView = new MenuBarMenuListView(locale);\n            listView.ariaLabel = menuDefinition.label;\n            menuView.panelView.children.add(listView);\n            listView.items.addMany(this._createMenuItems({ menuDefinition, parentMenuView: menuView, componentFactory }));\n        });\n        return menuView;\n    }\n    /**\n     * Creates a {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} items based on the given definition.\n     */\n    _createMenuItems({ menuDefinition, parentMenuView, componentFactory }) {\n        const locale = this.locale;\n        const items = [];\n        for (const menuGroupDefinition of menuDefinition.groups) {\n            for (const itemDefinition of menuGroupDefinition.items) {\n                const menuItemView = new MenuBarMenuListItemView(locale, parentMenuView);\n                if (isObject(itemDefinition)) {\n                    menuItemView.children.add(this._createMenu({\n                        componentFactory,\n                        menuDefinition: itemDefinition,\n                        parentMenuView\n                    }));\n                }\n                else {\n                    const componentView = this._createMenuItemContentFromFactory({\n                        componentName: itemDefinition,\n                        componentFactory,\n                        parentMenuView\n                    });\n                    if (!componentView) {\n                        continue;\n                    }\n                    menuItemView.children.add(componentView);\n                }\n                items.push(menuItemView);\n            }\n            // Separate groups with a separator.\n            if (menuGroupDefinition !== menuDefinition.groups[menuDefinition.groups.length - 1]) {\n                items.push(new ListSeparatorView(locale));\n            }\n        }\n        return items;\n    }\n    /**\n     * Uses the component factory to create a content of the menu item (a button or a sub-menu).\n     */\n    _createMenuItemContentFromFactory({ componentName, parentMenuView, componentFactory }) {\n        const componentView = componentFactory.create(componentName);\n        if (!(componentView instanceof MenuBarMenuView ||\n            componentView instanceof MenuBarMenuListItemButtonView ||\n            componentView instanceof MenuBarMenuListItemFileDialogButtonView)) {\n            /**\n             * Adding unsupported components to the {@link module:ui/menubar/menubarview~MenuBarView} is not possible.\n             *\n             * A component should be either a {@link module:ui/menubar/menubarmenuview~MenuBarMenuView} (sub-menu) or a\n             * {@link module:ui/menubar/menubarmenulistitembuttonview~MenuBarMenuListItemButtonView} (button).\n             *\n             * @error menu-bar-component-unsupported\n             * @param {string} componentName A name of the unsupported component used in the configuration.\n             * @param {module:ui/view~View} componentView An unsupported component view.\n             */\n            logWarning('menu-bar-component-unsupported', {\n                componentName,\n                componentView\n            });\n            return null;\n        }\n        this._registerMenuTree(componentView, parentMenuView);\n        // Close the whole menu bar when a component is executed.\n        componentView.on('execute', () => {\n            this.close();\n        });\n        return componentView;\n    }\n    /**\n     * Checks component and its children recursively and calls {@link #registerMenu}\n     * for each item that is {@link module:ui/menubar/menubarmenuview~MenuBarMenuView}.\n     *\n     * @internal\n     */\n    _registerMenuTree(componentView, parentMenuView) {\n        if (!(componentView instanceof MenuBarMenuView)) {\n            componentView.delegate('mouseenter').to(parentMenuView);\n            return;\n        }\n        this.registerMenu(componentView, parentMenuView);\n        const menuBarItemsList = componentView.panelView.children\n            .filter(child => child instanceof MenuBarMenuListView)[0];\n        if (!menuBarItemsList) {\n            componentView.delegate('mouseenter').to(parentMenuView);\n            return;\n        }\n        const nonSeparatorItems = menuBarItemsList.items.filter(item => item instanceof ListItemView);\n        for (const item of nonSeparatorItems) {\n            this._registerMenuTree(item.children.get(0), componentView);\n        }\n    }\n    /**\n     * Manages the state of the {@link #isOpen} property of the menu bar. Because the state is a sum of individual\n     * top-level menus' states, it's necessary to listen to their changes and update the state accordingly.\n     *\n     * Additionally, it prevents from unnecessary changes of `isOpen` when one top-level menu opens and another closes\n     * (regardless of in which order), maintaining a stable `isOpen === true` in that situation.\n     */\n    _setupIsOpenUpdater() {\n        let closeTimeout;\n        // TODO: This is not the prettiest approach but at least it's simple.\n        this.on('menu:change:isOpen', (evt, name, isOpen) => {\n            clearTimeout(closeTimeout);\n            if (isOpen) {\n                this.isOpen = true;\n            }\n            else {\n                closeTimeout = setTimeout(() => {\n                    this.isOpen = Array.from(this.children).some(menuView => menuView.isOpen);\n                }, 0);\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editableui/editableuiview\n */\nimport { View } from '../view.js';\n/**\n * The editable UI view class.\n */\nexport class EditableUIView extends View {\n    /**\n     * The name of the editable UI view.\n     */\n    name = null;\n    /**\n     * The editing view instance the editable is related to. Editable uses the editing\n     * view to dynamically modify its certain DOM attributes after {@link #render rendering}.\n     *\n     * **Note**: The DOM attributes are performed by the editing view and not UI\n     * {@link module:ui/view~View#bindTemplate template bindings} because once rendered,\n     * the editable DOM element must remain under the full control of the engine to work properly.\n     */\n    _editingView;\n    /**\n     * The element which is the main editable element (usually the one with `contentEditable=\"true\"`).\n     */\n    _editableElement;\n    /**\n     * Whether an external {@link #_editableElement} was passed into the constructor, which also means\n     * the view will not render its {@link #template}.\n     */\n    _hasExternalElement;\n    /**\n     * Creates an instance of EditableUIView class.\n     *\n     * @param locale The locale instance.\n     * @param editingView The editing view instance the editable is related to.\n     * @param editableElement The editable element. If not specified, this view\n     * should create it. Otherwise, the existing element should be used.\n     */\n    constructor(locale, editingView, editableElement) {\n        super(locale);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-content',\n                    'ck-editor__editable',\n                    'ck-rounded-corners'\n                ],\n                lang: locale.contentLanguage,\n                dir: locale.contentLanguageDirection\n            }\n        });\n        this.set('isFocused', false);\n        this._editableElement = editableElement;\n        this._hasExternalElement = !!this._editableElement;\n        this._editingView = editingView;\n    }\n    /**\n     * Renders the view by either applying the {@link #template} to the existing\n     * {@link module:ui/editableui/editableuiview~EditableUIView#_editableElement} or assigning {@link #element}\n     * as {@link module:ui/editableui/editableuiview~EditableUIView#_editableElement}.\n     */\n    render() {\n        super.render();\n        if (this._hasExternalElement) {\n            this.template.apply(this.element = this._editableElement);\n        }\n        else {\n            this._editableElement = this.element;\n        }\n        this.on('change:isFocused', () => this._updateIsFocusedClasses());\n        this._updateIsFocusedClasses();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        if (this._hasExternalElement) {\n            this.template.revert(this._editableElement);\n        }\n        super.destroy();\n    }\n    /**\n     * Whether an external {@link #_editableElement} was passed into the constructor, which also means\n     * the view will not render its {@link #template}.\n     */\n    get hasExternalElement() {\n        return this._hasExternalElement;\n    }\n    /**\n     * Updates the `ck-focused` and `ck-blurred` CSS classes on the {@link #element} according to\n     * the {@link #isFocused} property value using the {@link #_editingView editing view} API.\n     */\n    _updateIsFocusedClasses() {\n        const editingView = this._editingView;\n        if (editingView.isRenderingInProgress) {\n            updateAfterRender(this);\n        }\n        else {\n            update(this);\n        }\n        function update(view) {\n            editingView.change(writer => {\n                const viewRoot = editingView.document.getRoot(view.name);\n                writer.addClass(view.isFocused ? 'ck-focused' : 'ck-blurred', viewRoot);\n                writer.removeClass(view.isFocused ? 'ck-blurred' : 'ck-focused', viewRoot);\n            });\n        }\n        // In a case of a multi-root editor, a callback will be attached more than once (one callback for each root).\n        // While executing one callback the `isRenderingInProgress` observable is changing what causes executing another\n        // callback and render is called inside the already pending render.\n        // We need to be sure that callback is executed only when the value has changed from `true` to `false`.\n        // See https://github.com/ckeditor/ckeditor5/issues/1676.\n        function updateAfterRender(view) {\n            editingView.once('change:isRenderingInProgress', (evt, name, value) => {\n                if (!value) {\n                    update(view);\n                }\n                else {\n                    updateAfterRender(view);\n                }\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editableui/inline/inlineeditableuiview\n */\nimport { EditableUIView } from '../editableuiview.js';\n/**\n * The inline editable UI class implementing an inline {@link module:ui/editableui/editableuiview~EditableUIView}.\n */\nexport class InlineEditableUIView extends EditableUIView {\n    /**\n     * The cached options object passed to the constructor.\n     */\n    _options;\n    /**\n     * Creates an instance of the InlineEditableUIView class.\n     *\n     * @param locale The locale instance.\n     * @param editingView The editing view instance the editable is related to.\n     * @param editableElement The editable element. If not specified, the\n     * {@link module:ui/editableui/editableuiview~EditableUIView}\n     * will create it. Otherwise, the existing element will be used.\n     * @param options Additional configuration of the view.\n     * @param options.label The label of the editable for assistive technologies. If not provided, a default label is used or,\n     * the existing `aria-label` attribute value from the specified `editableElement` is preserved.\n     */\n    constructor(locale, editingView, editableElement, options = {}) {\n        super(locale, editingView, editableElement);\n        this._options = options;\n        this.extendTemplate({\n            attributes: {\n                role: 'textbox',\n                class: 'ck-editor__editable_inline'\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        const editingView = this._editingView;\n        editingView.change(writer => {\n            const viewRoot = editingView.document.getRoot(this.name);\n            writer.setAttribute('aria-label', this.getEditableAriaLabel(), viewRoot);\n        });\n    }\n    /**\n     * Returns a normalized label for the editable view based on the environment.\n     */\n    getEditableAriaLabel() {\n        const t = this.locale.t;\n        const label = this._options.label;\n        const editableElement = this._editableElement;\n        const editableName = this.name;\n        if (typeof label == 'string') {\n            return label;\n        }\n        else if (typeof label === 'object') {\n            return label[editableName];\n        }\n        else if (typeof label === 'function') {\n            return label(this);\n        }\n        else if (editableElement) {\n            const existingLabel = editableElement.getAttribute('aria-label');\n            if (existingLabel) {\n                return existingLabel;\n            }\n        }\n        return t('Rich Text Editor. Editing area: %0', editableName);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module editor-classic/classiceditoruiview\n */\nimport { BoxedEditorUIView, InlineEditableUIView, MenuBarView, StickyPanelView, ToolbarView } from 'ckeditor5/src/ui.js';\nimport '../theme/classiceditor.css';\n/**\n * Classic editor UI view. Uses an inline editable and a sticky toolbar, all\n * enclosed in a boxed UI view.\n */\nexport class ClassicEditorUIView extends BoxedEditorUIView {\n    /**\n     * Sticky panel view instance. This is a parent view of a {@link #toolbar}\n     * that makes toolbar sticky.\n     */\n    stickyPanel;\n    /**\n     * Toolbar view instance.\n     */\n    toolbar;\n    /**\n     * Editable UI view.\n     */\n    editable;\n    /**\n     * Creates an instance of the classic editor UI view.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param editingView The editing view instance this view is related to.\n     * @param options Configuration options for the view instance.\n     * @param options.shouldToolbarGroupWhenFull When set `true` enables automatic items grouping\n     * in the main {@link module:editor-classic/classiceditoruiview~ClassicEditorUIView#toolbar toolbar}.\n     * See {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} to learn more.\n     * @param options.label When set, this value will be used as an accessible `aria-label` of the\n     * {@link module:ui/editableui/editableuiview~EditableUIView editable view}.\n     */\n    constructor(locale, editingView, options = {}) {\n        super(locale);\n        this.stickyPanel = new StickyPanelView(locale);\n        this.toolbar = new ToolbarView(locale, {\n            shouldGroupWhenFull: options.shouldToolbarGroupWhenFull\n        });\n        if (options.useMenuBar) {\n            this.menuBarView = new MenuBarView(locale);\n        }\n        this.editable = new InlineEditableUIView(locale, editingView, undefined, {\n            label: options.label\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        if (this.menuBarView) {\n            // Set toolbar as a child of a stickyPanel and makes toolbar sticky.\n            this.stickyPanel.content.addMany([this.menuBarView, this.toolbar]);\n        }\n        else {\n            this.stickyPanel.content.add(this.toolbar);\n        }\n        this.top.add(this.stickyPanel);\n        this.main.add(this.editable);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/plugin\n */\n/* eslint-disable @typescript-eslint/no-invalid-void-type */\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * The base class for CKEditor plugin classes.\n */\nexport class Plugin extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * The editor instance.\n     *\n     * Note that most editors implement the {@link module:core/editor/editor~Editor#ui} property.\n     * However, editors with an external UI (i.e. Bootstrap-based) or a headless editor may not have this property or\n     * throw an error when accessing it.\n     *\n     * Because of above, to make plugins more universal, it is recommended to split features into:\n     *  - The \"editing\" part that uses the {@link module:core/editor/editor~Editor} class without `ui` property.\n     *  - The \"UI\" part that uses the {@link module:core/editor/editor~Editor} class and accesses `ui` property.\n     */\n    editor;\n    /**\n     * Holds identifiers for {@link #forceDisabled} mechanism.\n     */\n    _disableStack = new Set();\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super();\n        this.editor = editor;\n        this.set('isEnabled', true);\n    }\n    /**\n     * Disables the plugin.\n     *\n     * Plugin may be disabled by multiple features or algorithms (at once). When disabling a plugin, unique id should be passed\n     * (e.g. feature name). The same identifier should be used when {@link #clearForceDisabled enabling back} the plugin.\n     * The plugin becomes enabled only after all features {@link #clearForceDisabled enabled it back}.\n     *\n     * Disabling and enabling a plugin:\n     *\n     * ```ts\n     * plugin.isEnabled; // -> true\n     * plugin.forceDisabled( 'MyFeature' );\n     * plugin.isEnabled; // -> false\n     * plugin.clearForceDisabled( 'MyFeature' );\n     * plugin.isEnabled; // -> true\n     * ```\n     *\n     * Plugin disabled by multiple features:\n     *\n     * ```ts\n     * plugin.forceDisabled( 'MyFeature' );\n     * plugin.forceDisabled( 'OtherFeature' );\n     * plugin.clearForceDisabled( 'MyFeature' );\n     * plugin.isEnabled; // -> false\n     * plugin.clearForceDisabled( 'OtherFeature' );\n     * plugin.isEnabled; // -> true\n     * ```\n     *\n     * Multiple disabling with the same identifier is redundant:\n     *\n     * ```ts\n     * plugin.forceDisabled( 'MyFeature' );\n     * plugin.forceDisabled( 'MyFeature' );\n     * plugin.clearForceDisabled( 'MyFeature' );\n     * plugin.isEnabled; // -> true\n     * ```\n     *\n     * **Note:** some plugins or algorithms may have more complex logic when it comes to enabling or disabling certain plugins,\n     * so the plugin might be still disabled after {@link #clearForceDisabled} was used.\n     *\n     * @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the plugin.\n     */\n    forceDisabled(id) {\n        this._disableStack.add(id);\n        if (this._disableStack.size == 1) {\n            this.on('set:isEnabled', forceDisable, { priority: 'highest' });\n            this.isEnabled = false;\n        }\n    }\n    /**\n     * Clears forced disable previously set through {@link #forceDisabled}. See {@link #forceDisabled}.\n     *\n     * @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.\n     */\n    clearForceDisabled(id) {\n        this._disableStack.delete(id);\n        if (this._disableStack.size == 0) {\n            this.off('set:isEnabled', forceDisable);\n            this.isEnabled = true;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this.stopListening();\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isContextPlugin() {\n        return false;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get isOfficialPlugin() {\n        return false;\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get isPremiumPlugin() {\n        return false;\n    }\n}\n/**\n * Helper function that forces plugin to be disabled.\n */\nfunction forceDisable(evt) {\n    evt.return = false;\n    evt.stop();\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/command\n */\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Base class for the CKEditor commands.\n *\n * Commands are the main way to manipulate the editor contents and state. They are mostly used by UI elements (or by other\n * commands) to make changes in the model. Commands are available in every part of the code that has access to\n * the {@link module:core/editor/editor~Editor editor} instance.\n *\n * Instances of registered commands can be retrieved from {@link module:core/editor/editor~Editor#commands `editor.commands`}.\n * The easiest way to execute a command is through {@link module:core/editor/editor~Editor#execute `editor.execute()`}.\n *\n * By default, commands are disabled when the editor is in the {@link module:core/editor/editor~Editor#isReadOnly read-only} mode\n * but commands with the {@link module:core/command~Command#affectsData `affectsData`} flag set to `false` will not be disabled.\n */\nexport class Command extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * The editor on which this command will be used.\n     */\n    editor;\n    /**\n     * A flag indicating whether a command's `isEnabled` state should be changed depending on where the document\n     * selection is placed.\n     *\n     * By default, it is set to `true`. If the document selection is placed in a\n     * {@link module:engine/model/model~Model#canEditAt non-editable} place (such as non-editable root), the command becomes disabled.\n     *\n     * The flag should be changed to `false` in a concrete command's constructor if the command should not change its `isEnabled`\n     * accordingly to the document selection.\n     */\n    _isEnabledBasedOnSelection;\n    /**\n     * A flag indicating whether a command execution changes the editor data or not.\n     *\n     * @see #affectsData\n     */\n    _affectsData;\n    /**\n     * Holds identifiers for {@link #forceDisabled} mechanism.\n     */\n    _disableStack;\n    /**\n     * Creates a new `Command` instance.\n     *\n     * @param editor The editor on which this command will be used.\n     */\n    constructor(editor) {\n        super();\n        this.editor = editor;\n        this.set('value', undefined);\n        this.set('isEnabled', false);\n        this._affectsData = true;\n        this._isEnabledBasedOnSelection = true;\n        this._disableStack = new Set();\n        this.decorate('execute');\n        // By default, every command is refreshed when changes are applied to the model.\n        this.listenTo(this.editor.model.document, 'change', () => {\n            this.refresh();\n        });\n        this.listenTo(editor, 'change:isReadOnly', () => {\n            this.refresh();\n        });\n        // By default, commands are disabled if the selection is in non-editable place or editor is in read-only mode.\n        this.on('set:isEnabled', evt => {\n            if (!this.affectsData) {\n                return;\n            }\n            const selection = editor.model.document.selection;\n            const selectionInGraveyard = selection.getFirstPosition().root.rootName == '$graveyard';\n            const canEditAtSelection = !selectionInGraveyard && editor.model.canEditAt(selection);\n            // Disable if editor is read only, or when selection is in a place which cannot be edited.\n            //\n            // Checking `editor.isReadOnly` is needed for all commands that have `_isEnabledBasedOnSelection == false`.\n            // E.g. undo does not base on selection, but affects data and should be disabled when the editor is in read-only mode.\n            if (editor.isReadOnly || this._isEnabledBasedOnSelection && !canEditAtSelection) {\n                evt.return = false;\n                evt.stop();\n            }\n        }, { priority: 'highest' });\n        this.on('execute', evt => {\n            if (!this.isEnabled) {\n                evt.stop();\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * A flag indicating whether a command execution changes the editor data or not.\n     *\n     * Commands with `affectsData` set to `false` will not be automatically disabled in\n     * the {@link module:core/editor/editor~Editor#isReadOnly read-only mode} and\n     * {@glink features/read-only#related-features other editor modes} with restricted user write permissions.\n     *\n     * **Note:** You do not have to set it for your every command. It is `true` by default.\n     *\n     * @default true\n     */\n    get affectsData() {\n        return this._affectsData;\n    }\n    set affectsData(affectsData) {\n        this._affectsData = affectsData;\n    }\n    /**\n     * Refreshes the command. The command should update its {@link #isEnabled} and {@link #value} properties\n     * in this method.\n     *\n     * This method is automatically called when\n     * {@link module:engine/model/document~ModelDocument#event:change any changes are applied to the document}.\n     */\n    refresh() {\n        this.isEnabled = true;\n    }\n    /**\n     * Disables the command.\n     *\n     * Command may be disabled by multiple features or algorithms (at once). When disabling a command, unique id should be passed\n     * (e.g. the feature name). The same identifier should be used when {@link #clearForceDisabled enabling back} the command.\n     * The command becomes enabled only after all features {@link #clearForceDisabled enabled it back}.\n     *\n     * Disabling and enabling a command:\n     *\n     * ```ts\n     * command.isEnabled; // -> true\n     * command.forceDisabled( 'MyFeature' );\n     * command.isEnabled; // -> false\n     * command.clearForceDisabled( 'MyFeature' );\n     * command.isEnabled; // -> true\n     * ```\n     *\n     * Command disabled by multiple features:\n     *\n     * ```ts\n     * command.forceDisabled( 'MyFeature' );\n     * command.forceDisabled( 'OtherFeature' );\n     * command.clearForceDisabled( 'MyFeature' );\n     * command.isEnabled; // -> false\n     * command.clearForceDisabled( 'OtherFeature' );\n     * command.isEnabled; // -> true\n     * ```\n     *\n     * Multiple disabling with the same identifier is redundant:\n     *\n     * ```ts\n     * command.forceDisabled( 'MyFeature' );\n     * command.forceDisabled( 'MyFeature' );\n     * command.clearForceDisabled( 'MyFeature' );\n     * command.isEnabled; // -> true\n     * ```\n     *\n     * **Note:** some commands or algorithms may have more complex logic when it comes to enabling or disabling certain commands,\n     * so the command might be still disabled after {@link #clearForceDisabled} was used.\n     *\n     * @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the command.\n     */\n    forceDisabled(id) {\n        this._disableStack.add(id);\n        if (this._disableStack.size == 1) {\n            this.on('set:isEnabled', forceDisable, { priority: 'highest' });\n            this.isEnabled = false;\n        }\n    }\n    /**\n     * Clears forced disable previously set through {@link #forceDisabled}. See {@link #forceDisabled}.\n     *\n     * @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.\n     */\n    clearForceDisabled(id) {\n        this._disableStack.delete(id);\n        if (this._disableStack.size == 0) {\n            this.off('set:isEnabled', forceDisable);\n            this.refresh();\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * A command may accept parameters. They will be passed from {@link module:core/editor/editor~Editor#execute `editor.execute()`}\n     * to the command.\n     *\n     * The `execute()` method will automatically abort when the command is disabled ({@link #isEnabled} is `false`).\n     * This behavior is implemented by a high priority listener to the {@link #event:execute} event.\n     *\n     * In order to see how to disable a command from \"outside\" see the {@link #isEnabled} documentation.\n     *\n     * This method may return a value, which would be forwarded all the way down to the\n     * {@link module:core/editor/editor~Editor#execute `editor.execute()`}.\n     *\n     * @fires execute\n     */\n    execute(...args) { return undefined; } // eslint-disable-line @typescript-eslint/no-unused-vars\n    /**\n     * Destroys the command.\n     */\n    destroy() {\n        this.stopListening();\n    }\n}\n/**\n * Helper function that forces command to be disabled.\n */\nfunction forceDisable(evt) {\n    evt.return = false;\n    evt.stop();\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/multicommand\n */\nimport { Command } from './command.js';\nimport { insertToPriorityArray } from '@ckeditor/ckeditor5-utils';\n/**\n * A CKEditor command that aggregates other commands.\n *\n * This command is used to proxy multiple commands. The multi-command is enabled when\n * at least one of its registered child commands is enabled.\n * When executing a multi-command, the first enabled command with highest priority will be executed.\n *\n * ```ts\n * const multiCommand = new MultiCommand( editor );\n *\n * const commandFoo = new Command( editor );\n * const commandBar = new Command( editor );\n *\n * // Register a child command.\n * multiCommand.registerChildCommand( commandFoo );\n * // Register a child command with a low priority.\n * multiCommand.registerChildCommand( commandBar, { priority: 'low' } );\n *\n * // Enable one of the commands.\n * commandBar.isEnabled = true;\n *\n * multiCommand.execute(); // Will execute commandBar.\n * ```\n */\nexport class MultiCommand extends Command {\n    /**\n     * Registered child commands definitions.\n     */\n    _childCommandsDefinitions = [];\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        // Override base command refresh(): the command's state is changed when one of child commands changes states.\n    }\n    /**\n     * Executes the first enabled command which has the highest priority of all registered child commands.\n     *\n     * @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.\n     */\n    execute(...args) {\n        const command = this._getFirstEnabledCommand();\n        return !!command && command.execute(args);\n    }\n    /**\n     * Registers a child command.\n     *\n     * @param options An object with configuration options.\n     * @param options.priority Priority of a command to register.\n     */\n    registerChildCommand(command, options = {}) {\n        insertToPriorityArray(this._childCommandsDefinitions, { command, priority: options.priority || 'normal' });\n        // Change multi-command enabled state when one of registered commands changes state.\n        command.on('change:isEnabled', () => this._checkEnabled());\n        this._checkEnabled();\n    }\n    /**\n     * Checks if any of child commands is enabled.\n     */\n    _checkEnabled() {\n        this.isEnabled = !!this._getFirstEnabledCommand();\n    }\n    /**\n     * Returns a first enabled command with the highest priority or `undefined` if none of them is enabled.\n     */\n    _getFirstEnabledCommand() {\n        const commandDefinition = this._childCommandsDefinitions.find(({ command }) => command.isEnabled);\n        return commandDefinition && commandDefinition.command;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/commandcollection\n */\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Collection of commands. Its instance is available in {@link module:core/editor/editor~Editor#commands `editor.commands`}.\n */\nexport class CommandCollection {\n    /**\n     * Command map.\n     */\n    _commands;\n    /**\n     * Creates collection instance.\n     */\n    constructor() {\n        this._commands = new Map();\n    }\n    /**\n     * Registers a new command.\n     *\n     * @param commandName The name of the command.\n     */\n    add(commandName, command) {\n        this._commands.set(commandName, command);\n    }\n    /**\n     * Retrieves a command from the collection.\n     *\n     * @param commandName The name of the command.\n     */\n    get(commandName) {\n        return this._commands.get(commandName);\n    }\n    /**\n     * Executes a command.\n     *\n     * @param commandName The name of the command.\n     * @param commandParams Command parameters.\n     * @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.\n     */\n    execute(commandName, ...commandParams) {\n        const command = this.get(commandName);\n        if (!command) {\n            /**\n             * Command does not exist.\n             *\n             * @error commandcollection-command-not-found\n             * @param {string} commandName Name of the command.\n             */\n            throw new CKEditorError('commandcollection-command-not-found', this, { commandName });\n        }\n        return command.execute(...commandParams);\n    }\n    /**\n     * Returns iterator of command names.\n     */\n    *names() {\n        yield* this._commands.keys();\n    }\n    /**\n     * Returns iterator of command instances.\n     */\n    *commands() {\n        yield* this._commands.values();\n    }\n    /**\n     * Iterable interface.\n     *\n     * Returns `[ commandName, commandInstance ]` pairs.\n     */\n    [Symbol.iterator]() {\n        return this._commands[Symbol.iterator]();\n    }\n    /**\n     * Destroys all collection commands.\n     */\n    destroy() {\n        for (const command of this.commands()) {\n            command.destroy();\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/plugincollection\n */\nimport { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Manages a list of CKEditor plugins, including loading, resolving dependencies and initialization.\n */\nexport class PluginCollection extends /* #__PURE__ */ EmitterMixin() {\n    _context;\n    _plugins = new Map();\n    /**\n     * A map of plugin constructors that can be retrieved by their names.\n     */\n    _availablePlugins;\n    /**\n     * Map of {@link module:core/contextplugin~ContextPlugin context plugins} which can be retrieved by their constructors or instances.\n     */\n    _contextPlugins;\n    /**\n     * Creates an instance of the plugin collection class.\n     * Allows loading and initializing plugins and their dependencies.\n     * Allows providing a list of already loaded plugins. These plugins will not be destroyed along with this collection.\n     *\n     * @param availablePlugins Plugins (constructors) which the collection will be able to use\n     * when {@link module:core/plugincollection~PluginCollection#init} is used with the plugin names (strings, instead of constructors).\n     * Usually, the editor will pass its built-in plugins to the collection so they can later be\n     * used in `config.plugins` or `config.removePlugins` by names.\n     * @param contextPlugins A list of already initialized plugins represented by a `[ PluginConstructor, pluginInstance ]` pair.\n     */\n    constructor(context, availablePlugins = [], contextPlugins = []) {\n        super();\n        this._context = context;\n        this._availablePlugins = new Map();\n        for (const PluginConstructor of availablePlugins) {\n            if (PluginConstructor.pluginName) {\n                this._availablePlugins.set(PluginConstructor.pluginName, PluginConstructor);\n            }\n        }\n        this._contextPlugins = new Map();\n        for (const [PluginConstructor, pluginInstance] of contextPlugins) {\n            this._contextPlugins.set(PluginConstructor, pluginInstance);\n            this._contextPlugins.set(pluginInstance, PluginConstructor);\n            // To make it possible to require a plugin by its name.\n            if (PluginConstructor.pluginName) {\n                this._availablePlugins.set(PluginConstructor.pluginName, PluginConstructor);\n            }\n        }\n    }\n    /**\n     * Iterable interface.\n     *\n     * Returns `[ PluginConstructor, pluginInstance ]` pairs.\n     */\n    *[Symbol.iterator]() {\n        for (const entry of this._plugins) {\n            if (typeof entry[0] == 'function') {\n                yield entry;\n            }\n        }\n    }\n    /**\n     * Gets the plugin instance by its constructor or name.\n     *\n     * ```ts\n     * // Check if 'Clipboard' plugin was loaded.\n     * if ( editor.plugins.has( 'ClipboardPipeline' ) ) {\n     * \t// Get clipboard plugin instance\n     * \tconst clipboard = editor.plugins.get( 'ClipboardPipeline' );\n     *\n     * \tthis.listenTo( clipboard, 'inputTransformation', ( evt, data ) => {\n     * \t\t// Do something on clipboard input.\n     * \t} );\n     * }\n     * ```\n     *\n     * **Note**: This method will throw an error if a plugin is not loaded. Use `{@link #has editor.plugins.has()}`\n     * to check if a plugin is available.\n     *\n     * @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.\n     */\n    get(key) {\n        const plugin = this._plugins.get(key);\n        if (!plugin) {\n            let pluginName = key;\n            if (typeof key == 'function') {\n                pluginName = key.pluginName || key.name;\n            }\n            /**\n             * The plugin is not loaded and could not be obtained.\n             *\n             * Plugin classes (constructors) need to be provided to the editor and must be loaded before they can be obtained from\n             * the plugin collection.\n             *\n             * **Note**: You can use `{@link module:core/plugincollection~PluginCollection#has editor.plugins.has()}`\n             * to check if a plugin was loaded.\n             *\n             * @error plugincollection-plugin-not-loaded\n             * @param {string} plugin The name of the plugin which is not loaded.\n             */\n            throw new CKEditorError('plugincollection-plugin-not-loaded', this._context, { plugin: pluginName });\n        }\n        return plugin;\n    }\n    /**\n     * Checks if a plugin is loaded.\n     *\n     * ```ts\n     * // Check if the 'Clipboard' plugin was loaded.\n     * if ( editor.plugins.has( 'ClipboardPipeline' ) ) {\n     * \t// Now use the clipboard plugin instance:\n     * \tconst clipboard = editor.plugins.get( 'ClipboardPipeline' );\n     *\n     * \t// ...\n     * }\n     * ```\n     *\n     * @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.\n     */\n    has(key) {\n        return this._plugins.has(key);\n    }\n    /**\n     * Initializes a set of plugins and adds them to the collection.\n     *\n     * @param plugins An array of {@link module:core/plugin~PluginInterface plugin constructors}\n     * or {@link module:core/plugin~PluginStaticMembers#pluginName plugin names}.\n     * @param pluginsToRemove Names of the plugins or plugin constructors\n     * that should not be loaded (despite being specified in the `plugins` array).\n     * @param pluginsSubstitutions An array of {@link module:core/plugin~PluginInterface plugin constructors}\n     * that will be used to replace plugins of the same names that were passed in `plugins` or that are in their dependency tree.\n     * A useful option for replacing built-in plugins while creating tests (for mocking their APIs). Plugins that will be replaced\n     * must follow these rules:\n     *   * The new plugin must be a class.\n     *   * The new plugin must be named.\n     *   * Both plugins must not depend on other plugins.\n     * @returns A promise which gets resolved once all plugins are loaded and available in the collection.\n     */\n    init(plugins, pluginsToRemove = [], pluginsSubstitutions = []) {\n        // Plugin initialization procedure consists of 2 main steps:\n        // 1) collecting all available plugin constructors,\n        // 2) verification whether all required plugins can be instantiated.\n        //\n        // In the first step, all plugin constructors, available in the provided `plugins` array and inside\n        // plugin's dependencies (from the `Plugin.requires` array), are recursively collected and added to the existing\n        // `this._availablePlugins` map, but without any verification at the given moment. Performing the verification\n        // at this point (during the plugin constructor searching) would cause false errors to occur, that some plugin\n        // is missing but in fact it may be defined further in the array as the dependency of other plugin. After\n        // traversing the entire dependency tree, it will be checked if all required \"top level\" plugins are available.\n        //\n        // In the second step, the list of plugins that have not been explicitly removed is traversed to get all the\n        // plugin constructors to be instantiated in the correct order and to validate against some rules. Finally, if\n        // no plugin is missing and no other error has been found, they all will be instantiated.\n        // eslint-disable-next-line @typescript-eslint/no-this-alias\n        const that = this;\n        const context = this._context;\n        findAvailablePluginConstructors(plugins);\n        validatePlugins(plugins);\n        const pluginsToLoad = plugins.filter(plugin => !isPluginRemoved(plugin, pluginsToRemove));\n        const pluginConstructors = [...getPluginConstructors(pluginsToLoad)];\n        substitutePlugins(pluginConstructors, pluginsSubstitutions);\n        const pluginInstances = loadPlugins(pluginConstructors);\n        return initPlugins(pluginInstances, 'init')\n            .then(() => initPlugins(pluginInstances, 'afterInit'))\n            .then(() => pluginInstances);\n        function isPluginConstructor(plugin) {\n            return typeof plugin === 'function';\n        }\n        function isContextPlugin(plugin) {\n            return isPluginConstructor(plugin) && !!plugin.isContextPlugin;\n        }\n        function isPluginRemoved(plugin, pluginsToRemove) {\n            return pluginsToRemove.some(removedPlugin => {\n                if (removedPlugin === plugin) {\n                    return true;\n                }\n                if (getPluginName(plugin) === removedPlugin) {\n                    return true;\n                }\n                if (getPluginName(removedPlugin) === plugin) {\n                    return true;\n                }\n                return false;\n            });\n        }\n        function getPluginName(plugin) {\n            return isPluginConstructor(plugin) ?\n                plugin.pluginName || plugin.name :\n                plugin;\n        }\n        function findAvailablePluginConstructors(plugins, processed = new Set()) {\n            plugins.forEach(plugin => {\n                if (!isPluginConstructor(plugin)) {\n                    return;\n                }\n                if (processed.has(plugin)) {\n                    return;\n                }\n                processed.add(plugin);\n                if (plugin.pluginName && !that._availablePlugins.has(plugin.pluginName)) {\n                    that._availablePlugins.set(plugin.pluginName, plugin);\n                }\n                if (plugin.requires) {\n                    findAvailablePluginConstructors(plugin.requires, processed);\n                }\n            });\n        }\n        function getPluginConstructors(plugins, processed = new Set()) {\n            return plugins\n                .map(plugin => {\n                return isPluginConstructor(plugin) ?\n                    plugin :\n                    that._availablePlugins.get(plugin);\n            })\n                .reduce((result, plugin) => {\n                if (processed.has(plugin)) {\n                    return result;\n                }\n                processed.add(plugin);\n                if (plugin.requires) {\n                    validatePlugins(plugin.requires, plugin);\n                    getPluginConstructors(plugin.requires, processed).forEach(plugin => result.add(plugin));\n                }\n                return result.add(plugin);\n            }, new Set());\n        }\n        function validatePlugins(plugins, parentPluginConstructor = null) {\n            plugins\n                .map(plugin => {\n                return isPluginConstructor(plugin) ?\n                    plugin :\n                    that._availablePlugins.get(plugin) || plugin;\n            })\n                .forEach(plugin => {\n                checkMissingPlugin(plugin, parentPluginConstructor);\n                checkContextPlugin(plugin, parentPluginConstructor);\n                checkRemovedPlugin(plugin, parentPluginConstructor);\n            });\n        }\n        function checkMissingPlugin(plugin, parentPluginConstructor) {\n            if (isPluginConstructor(plugin)) {\n                return;\n            }\n            if (parentPluginConstructor) {\n                /**\n                 * A required \"soft\" dependency was not found on the plugin list.\n                 *\n                 * When configuring the editor, either prior to building (via\n                 * {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}) or when\n                 * creating a new instance of the editor (e.g. via\n                 * {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`}), you need to provide\n                 * some of the dependencies for other plugins that you used.\n                 *\n                 * This error is thrown when one of these dependencies was not provided. The name of the missing plugin\n                 * can be found in `missingPlugin` and the plugin that required it in `requiredBy`.\n                 *\n                 * In order to resolve it, you need to import the missing plugin and add it to the\n                 * current list of plugins (`Editor.builtinPlugins` or `config.plugins`/`config.extraPlugins`).\n                 *\n                 * Soft requirements were introduced in version 26.0.0. If you happen to stumble upon this error\n                 * when upgrading to version 26.0.0, read also the\n                 * {@glink updating/guides/update-to-26 Migration to 26.0.0} guide.\n                 *\n                 * @error plugincollection-soft-required\n                 * @param {string} missingPlugin The name of the required plugin.\n                 * @param {string} requiredBy The name of the plugin that requires the other plugin.\n                 */\n                throw new CKEditorError('plugincollection-soft-required', context, { missingPlugin: plugin, requiredBy: getPluginName(parentPluginConstructor) });\n            }\n            /**\n             * A plugin is not available and could not be loaded.\n             *\n             * Plugin classes (constructors) need to be provided to the editor before they can be loaded by name.\n             * This is usually done in the now deprecated CKEditor 5 builds by setting\n             * the {@link module:core/editor/editor~Editor.builtinPlugins} property.\n             *\n             * **If you see this warning when using one of the deprecated CKEditor 5 Builds**,\n             * it means that you tried to enable a plugin that was not included in that build. This may be due to a typo\n             * in the plugin name or simply because that plugin was not a part of this build.\n             *\n             * **Predefined builds are no longer supported and you need to\n             * {@glink updating/nim-migration/migration-to-new-installation-methods migrate to new installation methods}**.\n             *\n             * **If you see this warning when using one of the editor creators directly** (not a build), then it means\n             * that you tried loading plugins by name. However, unlike CKEditor 4, CKEditor 5 does not implement a \"plugin loader\".\n             * This means that CKEditor 5 does not know where to load the plugin modules from. Therefore, you need to\n             * provide each plugin through a reference (as a constructor function). Check out the examples in the\n             * {@glink getting-started/installation/cloud/quick-start Quick start} guide.\n             *\n             * @error plugincollection-plugin-not-found\n             * @param {string} plugin The name of the plugin which could not be loaded.\n             */\n            throw new CKEditorError('plugincollection-plugin-not-found', context, { plugin });\n        }\n        function checkContextPlugin(plugin, parentPluginConstructor) {\n            if (!isContextPlugin(parentPluginConstructor)) {\n                return;\n            }\n            if (isContextPlugin(plugin)) {\n                return;\n            }\n            /**\n             * If a plugin is a context plugin, all plugins it requires should also be context plugins\n             * instead of plugins. In other words, if one plugin can be used in the context,\n             * all its requirements should also be ready to be used in the context. Note that the context\n             * provides only a part of the API provided by the editor. If one plugin needs a full\n             * editor API, all plugins which require it are considered as plugins that need a full\n             * editor API.\n             *\n             * @error plugincollection-context-required\n             * @param {string} plugin The name of the required plugin.\n             * @param {string} requiredBy The name of the parent plugin.\n             */\n            throw new CKEditorError('plugincollection-context-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });\n        }\n        function checkRemovedPlugin(plugin, parentPluginConstructor) {\n            if (!parentPluginConstructor) {\n                return;\n            }\n            if (!isPluginRemoved(plugin, pluginsToRemove)) {\n                return;\n            }\n            /**\n             * Cannot load a plugin because one of its dependencies is listed in the `removePlugins` option.\n             *\n             * @error plugincollection-required\n             * @param {string} plugin The name of the required plugin.\n             * @param {string} requiredBy The name of the parent plugin.\n             */\n            throw new CKEditorError('plugincollection-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });\n        }\n        function loadPlugins(pluginConstructors) {\n            return pluginConstructors.map(PluginConstructor => {\n                let pluginInstance = that._contextPlugins.get(PluginConstructor);\n                pluginInstance = pluginInstance || new PluginConstructor(context);\n                that._add(PluginConstructor, pluginInstance);\n                return pluginInstance;\n            });\n        }\n        function initPlugins(pluginInstances, method) {\n            return pluginInstances.reduce((promise, plugin) => {\n                if (!plugin[method]) {\n                    return promise;\n                }\n                if (that._contextPlugins.has(plugin)) {\n                    return promise;\n                }\n                return promise.then(plugin[method].bind(plugin));\n            }, Promise.resolve());\n        }\n        /**\n         * Replaces plugin constructors with the specified set of plugins.\n         */\n        function substitutePlugins(pluginConstructors, pluginsSubstitutions) {\n            for (const pluginItem of pluginsSubstitutions) {\n                if (typeof pluginItem != 'function') {\n                    /**\n                     * The plugin replacing an existing plugin must be a function.\n                     *\n                     * @error plugincollection-replace-plugin-invalid-type\n                     * @param {never} pluginItem The plugin item.\n                     */\n                    throw new CKEditorError('plugincollection-replace-plugin-invalid-type', null, { pluginItem });\n                }\n                const pluginName = pluginItem.pluginName;\n                if (!pluginName) {\n                    /**\n                     * The plugin replacing an existing plugin must have a name.\n                     *\n                     * @error plugincollection-replace-plugin-missing-name\n                     * @param {module:core/plugin~PluginConstructor} pluginItem The plugin item.\n                     */\n                    throw new CKEditorError('plugincollection-replace-plugin-missing-name', null, { pluginItem });\n                }\n                if (pluginItem.requires && pluginItem.requires.length) {\n                    /**\n                     * The plugin replacing an existing plugin cannot depend on other plugins.\n                     *\n                     * @error plugincollection-plugin-for-replacing-cannot-have-dependencies\n                     * @param {string} pluginName The name of the plugin.\n                     */\n                    throw new CKEditorError('plugincollection-plugin-for-replacing-cannot-have-dependencies', null, { pluginName });\n                }\n                const pluginToReplace = that._availablePlugins.get(pluginName);\n                if (!pluginToReplace) {\n                    /**\n                     * The replaced plugin does not exist in the\n                     * {@link module:core/plugincollection~PluginCollection available plugins} collection.\n                     *\n                     * @error plugincollection-plugin-for-replacing-not-exist\n                     * @param {string} pluginName The name of the plugin.\n                     */\n                    throw new CKEditorError('plugincollection-plugin-for-replacing-not-exist', null, { pluginName });\n                }\n                const indexInPluginConstructors = pluginConstructors.indexOf(pluginToReplace);\n                if (indexInPluginConstructors === -1) {\n                    // The Context feature can substitute plugins as well.\n                    // It may happen that the editor will be created with the given context, where the plugin for substitute\n                    // was already replaced. In such a case, we don't want to do it again.\n                    if (that._contextPlugins.has(pluginToReplace)) {\n                        return;\n                    }\n                    /**\n                     * The replaced plugin will not be loaded so it cannot be replaced.\n                     *\n                     * @error plugincollection-plugin-for-replacing-not-loaded\n                     * @param {string} pluginName The name of the plugin.\n                     */\n                    throw new CKEditorError('plugincollection-plugin-for-replacing-not-loaded', null, { pluginName });\n                }\n                if (pluginToReplace.requires && pluginToReplace.requires.length) {\n                    /**\n                     * The replaced plugin cannot depend on other plugins.\n                     *\n                     * @error plugincollection-replaced-plugin-cannot-have-dependencies\n                     * @param {string} pluginName The name of the plugin.\n                     */\n                    throw new CKEditorError('plugincollection-replaced-plugin-cannot-have-dependencies', null, { pluginName });\n                }\n                pluginConstructors.splice(indexInPluginConstructors, 1, pluginItem);\n                that._availablePlugins.set(pluginName, pluginItem);\n            }\n        }\n    }\n    /**\n     * Destroys all loaded plugins.\n     */\n    destroy() {\n        const promises = [];\n        for (const [, pluginInstance] of this) {\n            if (typeof pluginInstance.destroy == 'function' && !this._contextPlugins.has(pluginInstance)) {\n                promises.push(pluginInstance.destroy());\n            }\n        }\n        return Promise.all(promises);\n    }\n    /**\n     * Adds the plugin to the collection. Exposed mainly for testing purposes.\n     *\n     * @param PluginConstructor The plugin constructor.\n     * @param plugin The instance of the plugin.\n     */\n    _add(PluginConstructor, plugin) {\n        this._plugins.set(PluginConstructor, plugin);\n        const pluginName = PluginConstructor.pluginName;\n        if (!pluginName) {\n            return;\n        }\n        if (this._plugins.has(pluginName)) {\n            /**\n             * Two plugins with the same {@link module:core/plugin~PluginStaticMembers#pluginName} were loaded.\n             * This will lead to runtime conflicts between these plugins.\n             *\n             * In practice, this warning usually means that new plugins were added to an existing CKEditor 5 build.\n             * Plugins should always be added to a source version of the editor (`@ckeditor/ckeditor5-editor-*`),\n             * not to an editor imported from one of the `@ckeditor/ckeditor5-build-*` packages.\n             *\n             * Check your import paths and the list of plugins passed to\n             * {@link module:core/editor/editor~Editor.create `Editor.create()`}\n             * or specified in {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}.\n             *\n             * Predefined builds are a deprecated solution and we strongly advise\n             * {@glink updating/nim-migration/migration-to-new-installation-methods migrating to new installation methods}.\n             *\n             * The second option is that your `node_modules/` directory contains duplicated versions of the same\n             * CKEditor 5 packages. Normally, on clean installations, npm deduplicates packages in `node_modules/`, so\n             * it may be enough to call `rm -rf node_modules && npm i`. However, if you installed conflicting versions\n             * of some packages, their dependencies may need to be installed in more than one version which may lead to this\n             * warning.\n             *\n             * Technically speaking, this error occurs because after adding a plugin to an existing editor build\n             * the dependencies of this plugin are being duplicated.\n             * They are already built into that editor build and now get added for the second time as dependencies\n             * of the plugin you are installing.\n             *\n             * @error plugincollection-plugin-name-conflict\n             * @param {string} pluginName The duplicated plugin name.\n             * @param {module:core/plugin~PluginConstructor} plugin1 The first plugin constructor.\n             * @param {module:core/plugin~PluginConstructor} plugin2 The second plugin constructor.\n             */\n            throw new CKEditorError('plugincollection-plugin-name-conflict', null, { pluginName, plugin1: this._plugins.get(pluginName).constructor, plugin2: PluginConstructor });\n        }\n        this._plugins.set(pluginName, plugin);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/context\n */\nimport { Config, Collection, CKEditorError, Locale } from '@ckeditor/ckeditor5-utils';\nimport { PluginCollection } from './plugincollection.js';\n/**\n * Provides a common, higher-level environment for solutions that use multiple {@link module:core/editor/editor~Editor editors}\n * or plugins that work outside the editor. Use it instead of {@link module:core/editor/editor~Editor.create `Editor.create()`}\n * in advanced application integrations.\n *\n * All configuration options passed to a context will be used as default options for the editor instances initialized in that context.\n *\n * {@link module:core/contextplugin~ContextPlugin Context plugins} passed to a context instance will be shared among all\n * editor instances initialized in this context. These will be the same plugin instances for all the editors.\n *\n * **Note:** The context can only be initialized with {@link module:core/contextplugin~ContextPlugin context plugins}\n * (e.g. [comments](https://ckeditor.com/collaboration/comments/)). Regular {@link module:core/plugin~Plugin plugins} require an\n * editor instance to work and cannot be added to a context.\n *\n * **Note:** You can add a context plugin to an editor instance, though.\n *\n * If you are using multiple editor instances on one page and use any context plugins, create a context to share the configuration and\n * plugins among these editors. Some plugins will use the information about all existing editors to better integrate between them.\n *\n * If you are using plugins that do not require an editor to work (e.g. [comments](https://ckeditor.com/collaboration/comments/)),\n * enable and configure them using the context.\n *\n * If you are using only a single editor on each page, use {@link module:core/editor/editor~Editor.create `Editor.create()`} instead.\n * In such a case, a context instance will be created by the editor instance in a transparent way.\n *\n * See {@link ~Context.create `Context.create()`} for usage examples.\n */\nexport class Context {\n    /**\n     * Stores all the configurations specific to this context instance.\n     */\n    config;\n    /**\n     * The plugins loaded and in use by this context instance.\n     */\n    plugins;\n    locale;\n    /**\n     * Shorthand for {@link module:utils/locale~Locale#t}.\n     */\n    t;\n    /**\n     * A list of editors that this context instance is injected to.\n     */\n    editors;\n    /**\n     * The default configuration which is built into the `Context` class.\n     *\n     * It was used in the now deprecated CKEditor 5 builds featuring `Context` to provide the default configuration options\n     * which are later used during the context initialization.\n     *\n     * ```ts\n     * Context.defaultConfig = {\n     * \tfoo: 1,\n     * \tbar: 2\n     * };\n     *\n     * Context\n     * \t.create()\n     * \t.then( context => {\n     * \t\tcontext.config.get( 'foo' ); // -> 1\n     * \t\tcontext.config.get( 'bar' ); // -> 2\n     * \t} );\n     *\n     * // The default options can be overridden by the configuration passed to create().\n     * Context\n     * \t.create( { bar: 3 } )\n     * \t.then( context => {\n     * \t\tcontext.config.get( 'foo' ); // -> 1\n     * \t\tcontext.config.get( 'bar' ); // -> 3\n     * \t} );\n     * ```\n     *\n     * See also {@link module:core/context~Context.builtinPlugins `Context.builtinPlugins`}\n     * and {@link module:core/editor/editor~Editor.defaultConfig `Editor.defaultConfig`}.\n     */\n    static defaultConfig;\n    /**\n     * An array of plugins built into the `Context` class.\n     *\n     * It was used in the now deprecated CKEditor 5 builds featuring `Context` to provide the default configuration options\n     * which are later used during the context initialization.\n     *\n     * They will be automatically initialized by `Context` unless `config.plugins` is passed.\n     *\n     * ```ts\n     * // Build some context plugins into the Context class first.\n     * Context.builtinPlugins = [ FooPlugin, BarPlugin ];\n     *\n     * // Normally, you need to define config.plugins, but since Context.builtinPlugins was\n     * // defined, now you can call create() without any configuration.\n     * Context\n     * \t.create()\n     * \t.then( context => {\n     * \t\tcontext.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.\n     * \t\tcontext.plugins.get( BarPlugin ); // -> An instance of the Bar plugin.\n     * \t} );\n     * ```\n     *\n     * See also {@link module:core/context~Context.defaultConfig `Context.defaultConfig`}\n     * and {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}.\n     */\n    static builtinPlugins;\n    /**\n     * Reference to the editor which created the context.\n     * Null when the context was created outside of the editor.\n     *\n     * It is used to destroy the context when removing the editor that has created the context.\n     */\n    _contextOwner = null;\n    /**\n     * Creates a context instance with a given configuration.\n     *\n     * Usually not to be used directly. See the static {@link module:core/context~Context.create `create()`} method.\n     *\n     * @param config The context configuration.\n     */\n    constructor(config) {\n        // We don't pass translations to the config, because its behavior of splitting keys\n        // with dots (e.g. `resize.width` => `resize: { width }`) breaks the translations.\n        const { translations, ...rest } = config || {};\n        this.config = new Config(rest, this.constructor.defaultConfig);\n        const availablePlugins = this.constructor.builtinPlugins;\n        this.config.define('plugins', availablePlugins);\n        this.plugins = new PluginCollection(this, availablePlugins);\n        const languageConfig = this.config.get('language') || {};\n        this.locale = new Locale({\n            uiLanguage: typeof languageConfig === 'string' ? languageConfig : languageConfig.ui,\n            contentLanguage: this.config.get('language.content'),\n            translations\n        });\n        this.t = this.locale.t;\n        this.editors = new Collection();\n    }\n    /**\n     * Loads and initializes plugins specified in the configuration.\n     *\n     * @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.\n     */\n    initPlugins() {\n        const plugins = this.config.get('plugins') || [];\n        const substitutePlugins = this.config.get('substitutePlugins') || [];\n        // Plugins for substitution should be checked as well.\n        for (const Plugin of plugins.concat(substitutePlugins)) {\n            if (typeof Plugin != 'function') {\n                /**\n                 * Only a constructor function is allowed as a {@link module:core/contextplugin~ContextPlugin context plugin}.\n                 *\n                 * @error context-initplugins-constructor-only\n                 */\n                throw new CKEditorError('context-initplugins-constructor-only', null, { Plugin });\n            }\n            if (Plugin.isContextPlugin !== true) {\n                /**\n                 * Only a plugin marked as a {@link module:core/contextplugin~ContextPlugin.isContextPlugin context plugin}\n                 * is allowed to be used with a context.\n                 *\n                 * @error context-initplugins-invalid-plugin\n                 */\n                throw new CKEditorError('context-initplugins-invalid-plugin', null, { Plugin });\n            }\n        }\n        return this.plugins.init(plugins, [], substitutePlugins);\n    }\n    /**\n     * Destroys the context instance and all editors used with the context,\n     * releasing all resources used by the context.\n     *\n     * @returns A promise that resolves once the context instance is fully destroyed.\n     */\n    destroy() {\n        return Promise.all(Array.from(this.editors, editor => editor.destroy()))\n            .then(() => this.plugins.destroy());\n    }\n    /**\n     * Adds a reference to the editor which is used with this context.\n     *\n     * When the given editor has created the context, the reference to this editor will be stored\n     * as a {@link ~Context#_contextOwner}.\n     *\n     * This method should only be used by the editor.\n     *\n     * @internal\n     * @param isContextOwner Stores the given editor as a context owner.\n     */\n    _addEditor(editor, isContextOwner) {\n        if (this._contextOwner) {\n            /**\n             * Cannot add multiple editors to the context which is created by the editor.\n             *\n             * @error context-addeditor-private-context\n             */\n            throw new CKEditorError('context-addeditor-private-context');\n        }\n        this.editors.add(editor);\n        if (isContextOwner) {\n            this._contextOwner = editor;\n        }\n    }\n    /**\n     * Removes a reference to the editor which was used with this context.\n     * When the context was created by the given editor, the context will be destroyed.\n     *\n     * This method should only be used by the editor.\n     *\n     * @internal\n     * @return A promise that resolves once the editor is removed from the context or when the context was destroyed.\n     */\n    _removeEditor(editor) {\n        if (this.editors.has(editor)) {\n            this.editors.remove(editor);\n        }\n        if (this._contextOwner === editor) {\n            return this.destroy();\n        }\n        return Promise.resolve();\n    }\n    /**\n     * Returns the context configuration which will be copied to the editors created using this context.\n     *\n     * The configuration returned by this method has the plugins configuration removed &ndash; plugins are shared with all editors\n     * through another mechanism.\n     *\n     * This method should only be used by the editor.\n     *\n     * @internal\n     * @returns Configuration as a plain object.\n     */\n    _getEditorConfig() {\n        const result = {};\n        for (const name of this.config.names()) {\n            if (!['plugins', 'removePlugins', 'extraPlugins'].includes(name)) {\n                result[name] = this.config.get(name);\n            }\n        }\n        return result;\n    }\n    /**\n     * Creates and initializes a new context instance.\n     *\n     * ```ts\n     * const commonConfig = { ... }; // Configuration for all the plugins and editors.\n     * const editorPlugins = [ ... ]; // Regular plugins here.\n     *\n     * Context\n     * \t.create( {\n     * \t\t// Only context plugins here.\n     * \t\tplugins: [ ... ],\n     *\n     * \t\t// Configure the language for all the editors (it cannot be overwritten).\n     * \t\tlanguage: { ... },\n     *\n     * \t\t// Configuration for context plugins.\n     * \t\tcomments: { ... },\n     * \t\t...\n     *\n     * \t\t// Default configuration for editor plugins.\n     * \t\ttoolbar: { ... },\n     * \t\timage: { ... },\n     * \t\t...\n     * \t} )\n     * \t.then( context => {\n     * \t\tconst promises = [];\n     *\n     * \t\tpromises.push( ClassicEditor.create(\n     * \t\t\tdocument.getElementById( 'editor1' ),\n     * \t\t\t{\n     * \t\t\t\teditorPlugins,\n     * \t\t\t\tcontext\n     * \t\t\t}\n     * \t\t) );\n     *\n     * \t\tpromises.push( ClassicEditor.create(\n     * \t\t\tdocument.getElementById( 'editor2' ),\n     * \t\t\t{\n     * \t\t\t\teditorPlugins,\n     * \t\t\t\tcontext,\n     * \t\t\t\ttoolbar: { ... } // You can overwrite the configuration of the context.\n     * \t\t\t}\n     * \t\t) );\n     *\n     * \t\treturn Promise.all( promises );\n     * \t} );\n     * ```\n     *\n     * @param config The context configuration.\n     * @returns A promise resolved once the context is ready. The promise resolves with the created context instance.\n     */\n    static create(config) {\n        return new Promise(resolve => {\n            const context = new this(config);\n            resolve(context.initPlugins().then(() => context));\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/contextplugin\n */\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * The base class for {@link module:core/context~Context} plugin classes.\n *\n * A context plugin can either be initialized for an {@link module:core/editor/editor~Editor editor} or for\n * a {@link module:core/context~Context context}. In other words, it can either\n * work within one editor instance or with one or more editor instances that use a single context.\n * It is the context plugin's role to implement handling for both modes.\n *\n * There are a few rules for interaction between the editor plugins and context plugins:\n *\n * * A context plugin can require another context plugin.\n * * An {@link module:core/plugin~Plugin editor plugin} can require a context plugin.\n * * A context plugin MUST NOT require an {@link module:core/plugin~Plugin editor plugin}.\n */\nexport class ContextPlugin extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * The context or editor instance.\n     */\n    context;\n    /**\n     * Creates a new plugin instance.\n     */\n    constructor(context) {\n        super();\n        this.context = context;\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this.stopListening();\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isContextPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return false;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/editingkeystrokehandler\n */\nimport { KeystrokeHandler } from '@ckeditor/ckeditor5-utils';\n/**\n * A keystroke handler for editor editing. Its instance is available\n * in {@link module:core/editor/editor~Editor#keystrokes} so plugins\n * can register their keystrokes.\n *\n * E.g. an undo plugin would do this:\n *\n * ```ts\n * editor.keystrokes.set( 'Ctrl+Z', 'undo' );\n * editor.keystrokes.set( 'Ctrl+Shift+Z', 'redo' );\n * editor.keystrokes.set( 'Ctrl+Y', 'redo' );\n * ```\n */\nexport class EditingKeystrokeHandler extends KeystrokeHandler {\n    /**\n     * The editor instance.\n     */\n    editor;\n    /**\n     * Creates an instance of the keystroke handler.\n     */\n    constructor(editor) {\n        super();\n        this.editor = editor;\n    }\n    /**\n     * Registers a handler for the specified keystroke.\n     *\n     * The handler can be specified as a command name or a callback.\n     *\n     * @param keystroke Keystroke defined in a format accepted by\n     * the {@link module:utils/keyboard~parseKeystroke} function.\n     * @param callback If a string is passed, then the keystroke will\n     * {@link module:core/editor/editor~Editor#execute execute a command}.\n     * If a function, then it will be called with the\n     * {@link module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data} object and\n     * a `cancel()` helper to both `preventDefault()` and `stopPropagation()` of the event.\n     * @param options Additional options.\n     * @param options.priority The priority of the keystroke callback. The higher the priority value\n     * the sooner the callback will be executed. Keystrokes having the same priority\n     * are called in the order they were added.\n     */\n    set(keystroke, callback, options = {}) {\n        if (typeof callback == 'string') {\n            const commandName = callback;\n            callback = (evtData, cancel) => {\n                this.editor.execute(commandName);\n                cancel();\n            };\n        }\n        super.set(keystroke, callback, options);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * An abstract watchdog class that handles most of the error handling process and the state of the underlying component.\n *\n * See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and how to use it.\n *\n * @internal\n */\nexport class Watchdog {\n    /**\n     * An array of crashes saved as an object with the following properties:\n     *\n     * * `message`: `String`,\n     * * `stack`: `String`,\n     * * `date`: `Number`,\n     * * `filename`: `String | undefined`,\n     * * `lineno`: `Number | undefined`,\n     * * `colno`: `Number | undefined`,\n     */\n    crashes = [];\n    /**\n     * Specifies the state of the item watched by the watchdog. The state can be one of the following values:\n     *\n     * * `initializing` &ndash; Before the first initialization, and after crashes, before the item is ready.\n     * * `ready` &ndash; A state when the user can interact with the item.\n     * * `crashed` &ndash; A state when an error occurs. It quickly changes to `initializing` or `crashedPermanently`\n     * depending on how many and how frequent errors have been caught recently.\n     * * `crashedPermanently` &ndash; A state when the watchdog stops reacting to errors and keeps the item it is watching crashed,\n     * * `destroyed` &ndash; A state when the item is manually destroyed by the user after calling `watchdog.destroy()`.\n     */\n    state = 'initializing';\n    /**\n     * @see module:watchdog/watchdog~WatchdogConfig\n     */\n    _crashNumberLimit;\n    /**\n     * Returns the result of the `Date.now()` call. It can be overridden in tests to mock time as some popular\n     * approaches like `sinon.useFakeTimers()` do not work well with error handling.\n     */\n    _now = Date.now;\n    /**\n     * @see module:watchdog/watchdog~WatchdogConfig\n     */\n    _minimumNonErrorTimePeriod;\n    /**\n     * Checks if the event error comes from the underlying item and restarts the item.\n     */\n    _boundErrorHandler;\n    /**\n     * A dictionary of event emitter listeners.\n     */\n    _listeners;\n    /**\n     * @param {module:watchdog/watchdog~WatchdogConfig} config The watchdog plugin configuration.\n     */\n    constructor(config) {\n        this.crashes = [];\n        this._crashNumberLimit = typeof config.crashNumberLimit === 'number' ? config.crashNumberLimit : 3;\n        this._minimumNonErrorTimePeriod = typeof config.minimumNonErrorTimePeriod === 'number' ? config.minimumNonErrorTimePeriod : 5000;\n        this._boundErrorHandler = evt => {\n            // `evt.error` is exposed by EventError while `evt.reason` is available in PromiseRejectionEvent.\n            const error = 'error' in evt ? evt.error : evt.reason;\n            // Note that `evt.reason` might be everything that is in the promise rejection.\n            // Similarly everything that is thrown lands in `evt.error`.\n            if (error instanceof Error) {\n                this._handleError(error, evt);\n            }\n        };\n        this._listeners = {};\n        if (!this._restart) {\n            throw new Error('The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. ' +\n                'Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.');\n        }\n    }\n    /**\n     * Destroys the watchdog and releases the resources.\n     */\n    destroy() {\n        this._stopErrorHandling();\n        this._listeners = {};\n    }\n    /**\n     * Starts listening to a specific event name by registering a callback that will be executed\n     * whenever an event with a given name fires.\n     *\n     * Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.\n     *\n     * @param eventName The event name.\n     * @param callback A callback which will be added to event listeners.\n     */\n    on(eventName, callback) {\n        if (!this._listeners[eventName]) {\n            this._listeners[eventName] = [];\n        }\n        this._listeners[eventName].push(callback);\n    }\n    /**\n     * Stops listening to the specified event name by removing the callback from event listeners.\n     *\n     * Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.\n     *\n     * @param eventName The event name.\n     * @param callback A callback which will be removed from event listeners.\n     */\n    off(eventName, callback) {\n        this._listeners[eventName] = this._listeners[eventName]\n            .filter(cb => cb !== callback);\n    }\n    /**\n     * Fires an event with a given event name and arguments.\n     *\n     * Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.\n     */\n    _fire(eventName, ...args) {\n        const callbacks = this._listeners[eventName] || [];\n        for (const callback of callbacks) {\n            callback.apply(this, [null, ...args]);\n        }\n    }\n    /**\n     * Starts error handling by attaching global error handlers.\n     */\n    _startErrorHandling() {\n        window.addEventListener('error', this._boundErrorHandler);\n        window.addEventListener('unhandledrejection', this._boundErrorHandler);\n    }\n    /**\n     * Stops error handling by detaching global error handlers.\n     */\n    _stopErrorHandling() {\n        window.removeEventListener('error', this._boundErrorHandler);\n        window.removeEventListener('unhandledrejection', this._boundErrorHandler);\n    }\n    /**\n     * Checks if an error comes from the watched item and restarts it.\n     * It reacts to {@link module:utils/ckeditorerror~CKEditorError `CKEditorError` errors} only.\n     *\n     * @fires error\n     * @param error Error.\n     * @param evt An error event.\n     */\n    _handleError(error, evt) {\n        // @if CK_DEBUG // const err = error as CKEditorError;\n        // @if CK_DEBUG // if ( err.is && err.is( 'CKEditorError' ) && err.context === undefined ) {\n        // @if CK_DEBUG // console.warn( 'The error is missing its context and Watchdog cannot restart the proper item.' );\n        // @if CK_DEBUG // }\n        if (this._shouldReactToError(error)) {\n            this.crashes.push({\n                message: error.message,\n                stack: error.stack,\n                // `evt.filename`, `evt.lineno` and `evt.colno` are available only in ErrorEvent events\n                filename: evt instanceof ErrorEvent ? evt.filename : undefined,\n                lineno: evt instanceof ErrorEvent ? evt.lineno : undefined,\n                colno: evt instanceof ErrorEvent ? evt.colno : undefined,\n                date: this._now()\n            });\n            const causesRestart = this._shouldRestart();\n            this.state = 'crashed';\n            this._fire('stateChange');\n            this._fire('error', { error, causesRestart });\n            if (causesRestart) {\n                this._restart();\n            }\n            else {\n                this.state = 'crashedPermanently';\n                this._fire('stateChange');\n            }\n        }\n    }\n    /**\n     * Checks whether an error should be handled by the watchdog.\n     *\n     * @param error An error that was caught by the error handling process.\n     */\n    _shouldReactToError(error) {\n        return (error.is &&\n            error.is('CKEditorError') &&\n            error.context !== undefined &&\n            // In some cases the watched item should not be restarted - e.g. during the item initialization.\n            // That's why the `null` was introduced as a correct error context which does cause restarting.\n            error.context !== null &&\n            // Do not react to errors if the watchdog is in states other than `ready`.\n            this.state === 'ready' &&\n            this._isErrorComingFromThisItem(error));\n    }\n    /**\n     * Checks if the watchdog should restart the underlying item.\n     */\n    _shouldRestart() {\n        if (this.crashes.length <= this._crashNumberLimit) {\n            return true;\n        }\n        const lastErrorTime = this.crashes[this.crashes.length - 1].date;\n        const firstMeaningfulErrorTime = this.crashes[this.crashes.length - 1 - this._crashNumberLimit].date;\n        const averageNonErrorTimePeriod = (lastErrorTime - firstMeaningfulErrorTime) / this._crashNumberLimit;\n        return averageNonErrorTimePeriod > this._minimumNonErrorTimePeriod;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module watchdog/utils/getsubnodes\n */\n/**\n * @internal\n */\nexport function getSubNodes(head, excludedProperties = new Set()) {\n    const nodes = [head];\n    // @if CK_DEBUG_WATCHDOG // const prevNodeMap = new Map();\n    // Nodes are stored to prevent infinite looping.\n    const subNodes = new Set();\n    let nodeIndex = 0;\n    while (nodes.length > nodeIndex) {\n        // Incrementing the iterator is much faster than changing size of the array with Array.prototype.shift().\n        const node = nodes[nodeIndex++];\n        if (subNodes.has(node) || !shouldNodeBeIncluded(node) || excludedProperties.has(node)) {\n            continue;\n        }\n        subNodes.add(node);\n        // Handle arrays, maps, sets, custom collections that implements `[ Symbol.iterator ]()`, etc.\n        if (Symbol.iterator in node) {\n            // The custom editor iterators might cause some problems if the editor is crashed.\n            try {\n                for (const n of node) {\n                    nodes.push(n);\n                    // @if CK_DEBUG_WATCHDOG // if ( !prevNodeMap.has( n ) ) {\n                    // @if CK_DEBUG_WATCHDOG // \tprevNodeMap.set( n, node );\n                    // @if CK_DEBUG_WATCHDOG // }\n                }\n            }\n            catch {\n                // Do not log errors for broken structures\n                // since we are in the error handling process already.\n            }\n        }\n        else {\n            for (const key in node) {\n                // We share a reference via the protobuf library within the editors,\n                // hence the shared value should be skipped. Although, it's not a perfect\n                // solution since new places like that might occur in the future.\n                if (key === 'defaultValue') {\n                    continue;\n                }\n                nodes.push(node[key]);\n                // @if CK_DEBUG_WATCHDOG // if ( !prevNodeMap.has( node[ key ] ) ) {\n                // @if CK_DEBUG_WATCHDOG // \tprevNodeMap.set( node[ key ], node );\n                // @if CK_DEBUG_WATCHDOG // }\n            }\n        }\n    }\n    // @if CK_DEBUG_WATCHDOG // return { subNodes, prevNodeMap } as any;\n    return subNodes;\n}\nfunction shouldNodeBeIncluded(node) {\n    const type = Object.prototype.toString.call(node);\n    const typeOfNode = typeof node;\n    return !(typeOfNode === 'number' ||\n        typeOfNode === 'boolean' ||\n        typeOfNode === 'string' ||\n        typeOfNode === 'symbol' ||\n        typeOfNode === 'function' ||\n        type === '[object Date]' ||\n        type === '[object RegExp]' ||\n        type === '[object Module]' ||\n        node === undefined ||\n        node === null ||\n        // This flag is meant to exclude singletons shared across editor instances. So when an error is thrown in one editor,\n        // the other editors connected through the reference to the same singleton are not restarted. This is a temporary workaround\n        // until a better solution is found.\n        // More in https://github.com/ckeditor/ckeditor5/issues/12292.\n        node._watchdogExcluded ||\n        // Skip native DOM objects, e.g. Window, nodes, events, etc.\n        node instanceof EventTarget ||\n        node instanceof Event);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module watchdog/utils/areconnectedthroughproperties\n */\nimport { getSubNodes } from './getsubnodes.js';\n/**\n * Traverses both structures to find out whether there is a reference that is shared between both structures.\n *\n * @internal\n */\nexport function areConnectedThroughProperties(target1, target2, excludedNodes = new Set()) {\n    if (target1 === target2 && isObject(target1)) {\n        return true;\n    }\n    // @if CK_DEBUG_WATCHDOG // return checkConnectionBetweenProps( target1, target2, excludedNodes );\n    const subNodes1 = getSubNodes(target1, excludedNodes);\n    const subNodes2 = getSubNodes(target2, excludedNodes);\n    for (const node of subNodes1) {\n        if (subNodes2.has(node)) {\n            return true;\n        }\n    }\n    return false;\n}\n/* istanbul ignore next -- @preserve */\n// eslint-disable-next-line\nfunction checkConnectionBetweenProps(target1, target2, excludedNodes) {\n    const { subNodes: subNodes1, prevNodeMap: prevNodeMap1 } = getSubNodes(target1, excludedNodes.subNodes);\n    const { subNodes: subNodes2, prevNodeMap: prevNodeMap2 } = getSubNodes(target2, excludedNodes.subNodes);\n    for (const sharedNode of subNodes1) {\n        if (subNodes2.has(sharedNode)) {\n            const connection = [];\n            connection.push(sharedNode);\n            let node = prevNodeMap1.get(sharedNode);\n            while (node && node !== target1) {\n                connection.push(node);\n                node = prevNodeMap1.get(node);\n            }\n            node = prevNodeMap2.get(sharedNode);\n            while (node && node !== target2) {\n                connection.unshift(node);\n                node = prevNodeMap2.get(node);\n            }\n            console.log('--------');\n            console.log({ target1 });\n            console.log({ sharedNode });\n            console.log({ target2 });\n            console.log({ connection });\n            return true;\n        }\n    }\n    return false;\n}\nfunction isObject(structure) {\n    return typeof structure === 'object' && structure !== null;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module watchdog/editorwatchdog\n */\nimport { throttle, cloneDeepWith, isElement } from 'es-toolkit/compat';\nimport { areConnectedThroughProperties } from './utils/areconnectedthroughproperties.js';\nimport { Watchdog } from './watchdog.js';\n/**\n * A watchdog for CKEditor 5 editors.\n *\n * See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and\n * how to use it.\n */\nexport class EditorWatchdog extends Watchdog {\n    /**\n     * The current editor instance.\n     */\n    _editor = null;\n    /**\n     * A promise associated with the life cycle of the editor (creation or destruction processes).\n     *\n     * It is used to prevent the initialization of the editor if the previous instance has not been destroyed yet,\n     * and conversely, to prevent the destruction of the editor if it has not been initialized.\n     */\n    _lifecyclePromise = null;\n    /**\n     * Throttled save method. The `save()` method is called the specified `saveInterval` after `throttledSave()` is called,\n     * unless a new action happens in the meantime.\n     */\n    _throttledSave;\n    /**\n     * The latest saved editor data represented as a root name -> root data object.\n     */\n    _data;\n    /**\n     * The last document version.\n     */\n    _lastDocumentVersion;\n    /**\n     * The editor source element or data.\n     */\n    _elementOrData;\n    /**\n     * Specifies whether the editor was initialized using document data (`true`) or HTML elements (`false`).\n     */\n    _initUsingData = true;\n    /**\n     * The latest record of the editor editable elements. Used to restart the editor.\n     */\n    _editables = {};\n    /**\n     * The editor configuration.\n     */\n    _config;\n    _excludedProps;\n    /**\n     * @param Editor The editor class.\n     * @param watchdogConfig The watchdog plugin configuration.\n     */\n    constructor(Editor, watchdogConfig = {}) {\n        super(watchdogConfig);\n        // this._editorClass = Editor;\n        this._throttledSave = throttle(this._save.bind(this), typeof watchdogConfig.saveInterval === 'number' ? watchdogConfig.saveInterval : 5000);\n        // Set default creator and destructor functions:\n        if (Editor) {\n            this._creator = ((elementOrData, config) => Editor.create(elementOrData, config));\n        }\n        this._destructor = editor => editor.destroy();\n    }\n    /**\n     * The current editor instance.\n     */\n    get editor() {\n        return this._editor;\n    }\n    /**\n     * @internal\n     */\n    get _item() {\n        return this._editor;\n    }\n    /**\n     * Sets the function that is responsible for the editor creation.\n     * It expects a function that should return a promise.\n     *\n     * ```ts\n     * watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );\n     * ```\n     */\n    setCreator(creator) {\n        this._creator = creator;\n    }\n    /**\n     * Sets the function that is responsible for the editor destruction.\n     * Overrides the default destruction function, which destroys only the editor instance.\n     * It expects a function that should return a promise or `undefined`.\n     *\n     * ```ts\n     * watchdog.setDestructor( editor => {\n     * \t// Do something before the editor is destroyed.\n     *\n     * \treturn editor\n     * \t\t.destroy()\n     * \t\t.then( () => {\n     * \t\t\t// Do something after the editor is destroyed.\n     * \t\t} );\n     * } );\n     * ```\n     */\n    setDestructor(destructor) {\n        this._destructor = destructor;\n    }\n    /**\n     * Restarts the editor instance. This method is called whenever an editor error occurs. It fires the `restart` event and changes\n     * the state to `initializing`.\n     *\n     * @fires restart\n     */\n    _restart() {\n        return Promise.resolve()\n            .then(() => {\n            this.state = 'initializing';\n            this._fire('stateChange');\n            return this._destroy();\n        })\n            .catch(err => {\n            console.error('An error happened during the editor destroying.', err);\n        })\n            .then(() => {\n            // Pre-process some data from the original editor config.\n            // Our goal here is to make sure that the restarted editor will be reinitialized with correct set of roots.\n            // We are not interested in any data set in config or in `.create()` first parameter. It will be replaced anyway.\n            // But we need to set them correctly to make sure that proper roots are created.\n            //\n            // Since a different set of roots will be created, `lazyRoots` and `rootsAttributes` properties must be managed too.\n            // Keys are root names, values are ''. Used when the editor was initialized by setting the first parameter to document data.\n            const existingRoots = {};\n            // Keeps lazy roots. They may be different when compared to initial config if some of the roots were loaded.\n            const lazyRoots = [];\n            // Roots attributes from the old config. Will be referred when setting new attributes.\n            const oldRootsAttributes = this._config.rootsAttributes || {};\n            // New attributes to be set. Is filled only for roots that still exist in the document.\n            const rootsAttributes = {};\n            // Traverse through the roots saved when the editor crashed and set up the discussed values.\n            for (const [rootName, rootData] of Object.entries(this._data.roots)) {\n                if (rootData.isLoaded) {\n                    existingRoots[rootName] = '';\n                    rootsAttributes[rootName] = oldRootsAttributes[rootName] || {};\n                }\n                else {\n                    lazyRoots.push(rootName);\n                }\n            }\n            const updatedConfig = {\n                ...this._config,\n                extraPlugins: this._config.extraPlugins || [],\n                lazyRoots,\n                rootsAttributes,\n                _watchdogInitialData: this._data\n            };\n            // Delete `initialData` as it is not needed. Data will be set by the watchdog based on `_watchdogInitialData`.\n            // First parameter of the editor `.create()` will be used to set up initial roots.\n            delete updatedConfig.initialData;\n            updatedConfig.extraPlugins.push(EditorWatchdogInitPlugin);\n            if (this._initUsingData) {\n                return this.create(existingRoots, updatedConfig, updatedConfig.context);\n            }\n            else {\n                // Set correct editables to make sure that proper roots are created and linked with DOM elements.\n                // No need to set initial data, as it would be discarded anyway.\n                //\n                // If one element was initially set in `elementOrData`, then use that original element to restart the editor.\n                // This is for compatibility purposes with single-root editor types.\n                if (isElement(this._elementOrData)) {\n                    return this.create(this._elementOrData, updatedConfig, updatedConfig.context);\n                }\n                else {\n                    return this.create(this._editables, updatedConfig, updatedConfig.context);\n                }\n            }\n        })\n            .then(() => {\n            this._fire('restart');\n        });\n    }\n    /**\n     * Creates the editor instance and keeps it running, using the defined creator and destructor.\n     *\n     * @param elementOrData The editor source element or the editor data.\n     * @param config The editor configuration.\n     * @param context A context for the editor.\n     */\n    create(elementOrData = this._elementOrData, config = this._config, context) {\n        this._lifecyclePromise = Promise.resolve(this._lifecyclePromise)\n            .then(() => {\n            super._startErrorHandling();\n            this._elementOrData = elementOrData;\n            // Use document data in the first parameter of the editor `.create()` call only if it was used like this originally.\n            // Use document data if a string or object with strings was passed.\n            this._initUsingData = typeof elementOrData == 'string' ||\n                (Object.keys(elementOrData).length > 0 && typeof Object.values(elementOrData)[0] == 'string');\n            // Clone configuration because it might be shared within multiple watchdog instances. Otherwise,\n            // when an error occurs in one of these editors, the watchdog will restart all of them.\n            this._config = this._cloneEditorConfiguration(config) || {};\n            this._config.context = context;\n            return this._creator(elementOrData, this._config);\n        })\n            .then(editor => {\n            this._editor = editor;\n            editor.model.document.on('change:data', this._throttledSave);\n            this._lastDocumentVersion = editor.model.document.version;\n            this._data = this._getData();\n            if (!this._initUsingData) {\n                this._editables = this._getEditables();\n            }\n            this.state = 'ready';\n            this._fire('stateChange');\n        }).finally(() => {\n            this._lifecyclePromise = null;\n        });\n        return this._lifecyclePromise;\n    }\n    /**\n     * Destroys the watchdog and the current editor instance. It fires the callback\n     * registered in {@link #setDestructor `setDestructor()`} and uses it to destroy the editor instance.\n     * It also sets the state to `destroyed`.\n     */\n    destroy() {\n        this._lifecyclePromise = Promise.resolve(this._lifecyclePromise)\n            .then(() => {\n            this.state = 'destroyed';\n            this._fire('stateChange');\n            super.destroy();\n            return this._destroy();\n        }).finally(() => {\n            this._lifecyclePromise = null;\n        });\n        return this._lifecyclePromise;\n    }\n    _destroy() {\n        return Promise.resolve()\n            .then(() => {\n            this._stopErrorHandling();\n            this._throttledSave.cancel();\n            const editor = this._editor;\n            this._editor = null;\n            // Remove the `change:data` listener before destroying the editor.\n            // Incorrectly written plugins may trigger firing `change:data` events during the editor destruction phase\n            // causing the watchdog to call `editor.getData()` when some parts of editor are already destroyed.\n            editor.model.document.off('change:data', this._throttledSave);\n            return this._destructor(editor);\n        });\n    }\n    /**\n     * Saves the editor data, so it can be restored after the crash even if the data cannot be fetched at\n     * the moment of the crash.\n     */\n    _save() {\n        const version = this._editor.model.document.version;\n        try {\n            this._data = this._getData();\n            if (!this._initUsingData) {\n                this._editables = this._getEditables();\n            }\n            this._lastDocumentVersion = version;\n        }\n        catch (err) {\n            console.error(err, 'An error happened during restoring editor data. ' +\n                'Editor will be restored from the previously saved data.');\n        }\n    }\n    /**\n     * @internal\n     */\n    _setExcludedProperties(props) {\n        this._excludedProps = props;\n    }\n    /**\n     * Gets all data that is required to reinitialize editor instance.\n     */\n    _getData() {\n        const editor = this._editor;\n        const roots = editor.model.document.roots.filter(root => root.isAttached() && root.rootName != '$graveyard');\n        const { plugins } = editor;\n        // `as any` to avoid linking from external private repo.\n        const commentsRepository = plugins.has('CommentsRepository') && plugins.get('CommentsRepository');\n        const trackChanges = plugins.has('TrackChanges') && plugins.get('TrackChanges');\n        const data = {\n            roots: {},\n            markers: {},\n            commentThreads: JSON.stringify([]),\n            suggestions: JSON.stringify([])\n        };\n        roots.forEach(root => {\n            data.roots[root.rootName] = {\n                content: JSON.stringify(Array.from(root.getChildren())),\n                attributes: JSON.stringify(Array.from(root.getAttributes())),\n                isLoaded: root._isLoaded\n            };\n        });\n        for (const marker of editor.model.markers) {\n            if (!marker._affectsData) {\n                continue;\n            }\n            data.markers[marker.name] = {\n                rangeJSON: marker.getRange().toJSON(),\n                usingOperation: marker._managedUsingOperations,\n                affectsData: marker._affectsData\n            };\n        }\n        if (commentsRepository) {\n            data.commentThreads = JSON.stringify(commentsRepository.getCommentThreads({ toJSON: true, skipNotAttached: true }));\n        }\n        if (trackChanges) {\n            data.suggestions = JSON.stringify(trackChanges.getSuggestions({ toJSON: true, skipNotAttached: true }));\n        }\n        return data;\n    }\n    /**\n     * For each attached model root, returns its HTML editable element (if available).\n     */\n    _getEditables() {\n        const editables = {};\n        for (const rootName of this.editor.model.document.getRootNames()) {\n            const editable = this.editor.ui.getEditableElement(rootName);\n            if (editable) {\n                editables[rootName] = editable;\n            }\n        }\n        return editables;\n    }\n    /**\n     * Traverses the error context and the current editor to find out whether these structures are connected\n     * to each other via properties.\n     *\n     * @internal\n     */\n    _isErrorComingFromThisItem(error) {\n        return areConnectedThroughProperties(this._editor, error.context, this._excludedProps);\n    }\n    /**\n     * Clones the editor configuration.\n     */\n    _cloneEditorConfiguration(config) {\n        return cloneDeepWith(config, (value, key) => {\n            // Leave DOM references.\n            if (isElement(value)) {\n                return value;\n            }\n            if (key === 'context') {\n                return value;\n            }\n        });\n    }\n}\n/**\n * Internal plugin that is used to stop the default editor initialization and restoring the editor state\n * based on the `editor.config._watchdogInitialData` data.\n */\nclass EditorWatchdogInitPlugin {\n    editor;\n    _data;\n    constructor(editor) {\n        this.editor = editor;\n        this._data = editor.config.get('_watchdogInitialData');\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        // Stops the default editor initialization and use the saved data to restore the editor state.\n        // Some of data could not be initialize as a config properties. It is important to keep the data\n        // in the same form as it was before the restarting.\n        this.editor.data.on('init', evt => {\n            evt.stop();\n            this.editor.model.enqueueChange({ isUndoable: false }, writer => {\n                this._restoreCollaborationData();\n                this._restoreEditorData(writer);\n            });\n            this.editor.data.fire('ready');\n            // Keep priority `'high' - 1` to be sure that RTC initialization will be first.\n        }, { priority: 1000 - 1 });\n    }\n    /**\n     * Creates a model node (element or text) based on provided JSON.\n     */\n    _createNode(writer, jsonNode) {\n        if ('name' in jsonNode) {\n            // If child has name property, it is an Element.\n            const element = writer.createElement(jsonNode.name, jsonNode.attributes);\n            if (jsonNode.children) {\n                for (const child of jsonNode.children) {\n                    element._appendChild(this._createNode(writer, child));\n                }\n            }\n            return element;\n        }\n        else {\n            // Otherwise, it is a Text node.\n            return writer.createText(jsonNode.data, jsonNode.attributes);\n        }\n    }\n    /**\n     * Restores the editor by setting the document data, roots attributes and markers.\n     */\n    _restoreEditorData(writer) {\n        const editor = this.editor;\n        Object.entries(this._data.roots).forEach(([rootName, { content, attributes }]) => {\n            const parsedNodes = JSON.parse(content);\n            const parsedAttributes = JSON.parse(attributes);\n            const rootElement = editor.model.document.getRoot(rootName);\n            for (const [key, value] of parsedAttributes) {\n                writer.setAttribute(key, value, rootElement);\n            }\n            for (const child of parsedNodes) {\n                const node = this._createNode(writer, child);\n                writer.insert(node, rootElement, 'end');\n            }\n        });\n        Object.entries(this._data.markers).forEach(([markerName, markerOptions]) => {\n            const { document } = editor.model;\n            const { rangeJSON: { start, end }, ...options } = markerOptions;\n            const root = document.getRoot(start.root);\n            const startPosition = writer.createPositionFromPath(root, start.path, start.stickiness);\n            const endPosition = writer.createPositionFromPath(root, end.path, end.stickiness);\n            const range = writer.createRange(startPosition, endPosition);\n            writer.addMarker(markerName, {\n                range,\n                ...options\n            });\n        });\n    }\n    /**\n     * Restores the editor collaboration data - comment threads and suggestions.\n     */\n    _restoreCollaborationData() {\n        // `as any` to avoid linking from external private repo.\n        const parsedCommentThreads = JSON.parse(this._data.commentThreads);\n        const parsedSuggestions = JSON.parse(this._data.suggestions);\n        if (this.editor.plugins.has('CommentsRepository')) {\n            const commentsRepository = this.editor.plugins.get('CommentsRepository');\n            // First, remove the existing comments that were created by integration plugins during initialization.\n            // These comments may be outdated, and new instances will be created in the next step based on the saved data.\n            for (const commentThread of commentsRepository.getCommentThreads()) {\n                // Use the internal API since it removes the comment thread directly and does not trigger events\n                // that could cause side effects, such as removing markers.\n                commentsRepository._removeCommentThread({ threadId: commentThread.id });\n            }\n            parsedCommentThreads.forEach(commentThreadData => {\n                const channelId = this.editor.config.get('collaboration.channelId');\n                const commentsRepository = this.editor.plugins.get('CommentsRepository');\n                commentsRepository.addCommentThread({ channelId, ...commentThreadData });\n            });\n        }\n        if (this.editor.plugins.has('TrackChangesEditing')) {\n            const trackChangesEditing = this.editor.plugins.get('TrackChangesEditing');\n            // First, remove the existing suggestions that were created by integration plugins during initialization.\n            // These suggestions may be outdated, and new instances will be created in the next step based on the saved data.\n            for (const suggestion of trackChangesEditing.getSuggestions()) {\n                trackChangesEditing._removeSuggestion(suggestion);\n            }\n            parsedSuggestions.forEach(suggestionData => {\n                trackChangesEditing.addSuggestionData(suggestionData);\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module watchdog/contextwatchdog\n */\nimport { Watchdog } from './watchdog.js';\nimport { EditorWatchdog } from './editorwatchdog.js';\nimport { areConnectedThroughProperties } from './utils/areconnectedthroughproperties.js';\nimport { getSubNodes } from './utils/getsubnodes.js';\nconst mainQueueId = Symbol('MainQueueId');\n/**\n * A watchdog for the {@link module:core/context~Context} class.\n *\n * See the {@glink features/watchdog Watchdog feature guide} to learn the rationale behind it and\n * how to use it.\n */\nexport class ContextWatchdog extends Watchdog {\n    /**\n     * A map of internal watchdogs for added items.\n     */\n    _watchdogs = new Map();\n    /**\n     * The watchdog configuration.\n     */\n    _watchdogConfig;\n    /**\n     * The current context instance.\n     */\n    _context = null;\n    /**\n     * Context properties (nodes/references) that are gathered during the initial context creation\n     * and are used to distinguish the origin of an error.\n     */\n    _contextProps = new Set();\n    /**\n     * An action queue, which is used to handle async functions queuing.\n     */\n    _actionQueues = new ActionQueues();\n    /**\n     * The configuration for the {@link module:core/context~Context}.\n     */\n    _contextConfig;\n    /**\n     * The watched item.\n     */\n    _item;\n    /**\n     * The context watchdog class constructor.\n     *\n     * ```ts\n     * const watchdog = new ContextWatchdog( Context );\n     *\n     * await watchdog.create( contextConfiguration );\n     *\n     * await watchdog.add( item );\n     * ```\n     *\n     * See the {@glink features/watchdog Watchdog feature guide} to learn more how to use this feature.\n     *\n     * @param Context The {@link module:core/context~Context} class.\n     * @param watchdogConfig The watchdog configuration.\n     */\n    constructor(Context, watchdogConfig = {}) {\n        super(watchdogConfig);\n        this._watchdogConfig = watchdogConfig;\n        // Default creator and destructor.\n        this._creator = contextConfig => Context.create(contextConfig);\n        this._destructor = context => context.destroy();\n        this._actionQueues.onEmpty(() => {\n            if (this.state === 'initializing') {\n                this.state = 'ready';\n                this._fire('stateChange');\n            }\n        });\n    }\n    /**\n     * Sets the function that is responsible for the context creation.\n     * It expects a function that should return a promise (or `undefined`).\n     *\n     * ```ts\n     * watchdog.setCreator( config => Context.create( config ) );\n     * ```\n     */\n    setCreator(creator) {\n        this._creator = creator;\n    }\n    /**\n     * Sets the function that is responsible for the context destruction.\n     * Overrides the default destruction function, which destroys only the context instance.\n     * It expects a function that should return a promise (or `undefined`).\n     *\n     * ```ts\n     * watchdog.setDestructor( context => {\n     * \t// Do something before the context is destroyed.\n     *\n     * \treturn context\n     * \t\t.destroy()\n     * \t\t.then( () => {\n     * \t\t\t// Do something after the context is destroyed.\n     * \t\t} );\n     * } );\n     * ```\n     */\n    setDestructor(destructor) {\n        this._destructor = destructor;\n    }\n    /**\n     * The context instance. Keep in mind that this property might be changed when the context watchdog restarts,\n     * so do not keep this instance internally. Always operate on the `ContextWatchdog#context` property.\n     */\n    get context() {\n        return this._context;\n    }\n    /**\n     * Initializes the context watchdog. Once it is created, the watchdog takes care about\n     * recreating the context and the provided items, and starts the error handling mechanism.\n     *\n     * ```ts\n     * await watchdog.create( {\n     * \tplugins: []\n     * } );\n     * ```\n     *\n     * @param contextConfig The context configuration. See {@link module:core/context~Context}.\n     */\n    create(contextConfig = {}) {\n        return this._actionQueues.enqueue(mainQueueId, () => {\n            this._contextConfig = contextConfig;\n            return this._create();\n        });\n    }\n    /**\n     * Returns an item instance with the given `itemId`.\n     *\n     * ```ts\n     * const editor1 = watchdog.getItem( 'editor1' );\n     * ```\n     *\n     * @param itemId The item ID.\n     * @returns The item instance or `undefined` if an item with a given ID has not been found.\n     */\n    getItem(itemId) {\n        const watchdog = this._getWatchdog(itemId);\n        return watchdog._item;\n    }\n    /**\n     * Gets the state of the given item. See {@link #state} for a list of available states.\n     *\n     * ```ts\n     * const editor1State = watchdog.getItemState( 'editor1' );\n     * ```\n     *\n     * @param itemId Item ID.\n     * @returns The state of the item.\n     */\n    getItemState(itemId) {\n        const watchdog = this._getWatchdog(itemId);\n        return watchdog.state;\n    }\n    /**\n     * Adds items to the watchdog. Once created, instances of these items will be available using the {@link #getItem} method.\n     *\n     * Items can be passed together as an array of objects:\n     *\n     * ```ts\n     * await watchdog.add( [ {\n     * \tid: 'editor1',\n     * \ttype: 'editor',\n     * \tsourceElementOrData: document.querySelector( '#editor' ),\n     * \tconfig: {\n     * \t\tplugins: [ Essentials, Paragraph, Bold, Italic ],\n     * \t\ttoolbar: [ 'bold', 'italic', 'alignment' ]\n     * \t},\n     * \tcreator: ( element, config ) => ClassicEditor.create( element, config )\n     * } ] );\n     * ```\n     *\n     * Or one by one as objects:\n     *\n     * ```ts\n     * await watchdog.add( {\n     * \tid: 'editor1',\n     * \ttype: 'editor',\n     * \tsourceElementOrData: document.querySelector( '#editor' ),\n     * \tconfig: {\n     * \t\tplugins: [ Essentials, Paragraph, Bold, Italic ],\n     * \t\ttoolbar: [ 'bold', 'italic', 'alignment' ]\n     * \t},\n     * \tcreator: ( element, config ) => ClassicEditor.create( element, config )\n     * ] );\n     * ```\n     *\n     * Then an instance can be retrieved using the {@link #getItem} method:\n     *\n     * ```ts\n     * const editor1 = watchdog.getItem( 'editor1' );\n     * ```\n     *\n     * Note that this method can be called multiple times, but for performance reasons it is better\n     * to pass all items together.\n     *\n     * @param itemConfigurationOrItemConfigurations An item configuration object or an array of item configurations.\n     */\n    add(itemConfigurationOrItemConfigurations) {\n        const itemConfigurations = toArray(itemConfigurationOrItemConfigurations);\n        return Promise.all(itemConfigurations.map(item => {\n            return this._actionQueues.enqueue(item.id, () => {\n                if (this.state === 'destroyed') {\n                    throw new Error('Cannot add items to destroyed watchdog.');\n                }\n                if (!this._context) {\n                    throw new Error('Context was not created yet. You should call the `ContextWatchdog#create()` method first.');\n                }\n                let watchdog;\n                if (this._watchdogs.has(item.id)) {\n                    throw new Error(`Item with the given id is already added: '${item.id}'.`);\n                }\n                if (item.type === 'editor') {\n                    watchdog = new EditorWatchdog(null, this._watchdogConfig);\n                    watchdog.setCreator(item.creator);\n                    watchdog._setExcludedProperties(this._contextProps);\n                    if (item.destructor) {\n                        watchdog.setDestructor(item.destructor);\n                    }\n                    this._watchdogs.set(item.id, watchdog);\n                    // Enqueue the internal watchdog errors within the main queue.\n                    // And propagate the internal `error` events as `itemError` event.\n                    watchdog.on('error', (evt, { error, causesRestart }) => {\n                        this._fire('itemError', { itemId: item.id, error });\n                        // Do not enqueue the item restart action if the item will not restart.\n                        if (!causesRestart) {\n                            return;\n                        }\n                        this._actionQueues.enqueue(item.id, () => new Promise(res => {\n                            const rethrowRestartEventOnce = () => {\n                                watchdog.off('restart', rethrowRestartEventOnce);\n                                this._fire('itemRestart', { itemId: item.id });\n                                res();\n                            };\n                            watchdog.on('restart', rethrowRestartEventOnce);\n                        }));\n                    });\n                    return watchdog.create(item.sourceElementOrData, item.config, this._context);\n                }\n                else {\n                    throw new Error(`Not supported item type: '${item.type}'.`);\n                }\n            });\n        }));\n    }\n    /**\n     * Removes and destroys item(s) with given ID(s).\n     *\n     * ```ts\n     * await watchdog.remove( 'editor1' );\n     * ```\n     *\n     * Or\n     *\n     * ```ts\n     * await watchdog.remove( [ 'editor1', 'editor2' ] );\n     * ```\n     *\n     * @param itemIdOrItemIds Item ID or an array of item IDs.\n     */\n    remove(itemIdOrItemIds) {\n        const itemIds = toArray(itemIdOrItemIds);\n        return Promise.all(itemIds.map(itemId => {\n            return this._actionQueues.enqueue(itemId, () => {\n                const watchdog = this._getWatchdog(itemId);\n                this._watchdogs.delete(itemId);\n                return watchdog.destroy();\n            });\n        }));\n    }\n    /**\n     * Destroys the context watchdog and all added items.\n     * Once the context watchdog is destroyed, new items cannot be added.\n     *\n     * ```ts\n     * await watchdog.destroy();\n     * ```\n     */\n    destroy() {\n        return this._actionQueues.enqueue(mainQueueId, () => {\n            this.state = 'destroyed';\n            this._fire('stateChange');\n            super.destroy();\n            return this._destroy();\n        });\n    }\n    /**\n     * Restarts the context watchdog.\n     */\n    _restart() {\n        return this._actionQueues.enqueue(mainQueueId, () => {\n            this.state = 'initializing';\n            this._fire('stateChange');\n            return this._destroy()\n                .catch(err => {\n                console.error('An error happened during destroying the context or items.', err);\n            })\n                .then(() => this._create())\n                .then(() => this._fire('restart'));\n        });\n    }\n    /**\n     * Initializes the context watchdog.\n     */\n    _create() {\n        return Promise.resolve()\n            .then(() => {\n            this._startErrorHandling();\n            return this._creator(this._contextConfig);\n        })\n            .then(context => {\n            this._context = context;\n            this._contextProps = getSubNodes(this._context);\n            return Promise.all(Array.from(this._watchdogs.values())\n                .map(watchdog => {\n                watchdog._setExcludedProperties(this._contextProps);\n                return watchdog.create(undefined, undefined, this._context);\n            }));\n        });\n    }\n    /**\n     * Destroys the context instance and all added items.\n     */\n    _destroy() {\n        return Promise.resolve()\n            .then(() => {\n            this._stopErrorHandling();\n            const context = this._context;\n            this._context = null;\n            this._contextProps = new Set();\n            return Promise.all(Array.from(this._watchdogs.values())\n                .map(watchdog => watchdog.destroy()))\n                // Context destructor destroys each editor.\n                .then(() => this._destructor(context));\n        });\n    }\n    /**\n     * Returns the watchdog for a given item ID.\n     *\n     * @param itemId Item ID.\n     */\n    _getWatchdog(itemId) {\n        const watchdog = this._watchdogs.get(itemId);\n        if (!watchdog) {\n            throw new Error(`Item with the given id was not registered: ${itemId}.`);\n        }\n        return watchdog;\n    }\n    /**\n     * Checks whether an error comes from the context instance and not from the item instances.\n     *\n     * @internal\n     */\n    _isErrorComingFromThisItem(error) {\n        for (const watchdog of this._watchdogs.values()) {\n            if (watchdog._isErrorComingFromThisItem(error)) {\n                return false;\n            }\n        }\n        return areConnectedThroughProperties(this._context, error.context);\n    }\n}\n/**\n * Manager of action queues that allows queuing async functions.\n */\nclass ActionQueues {\n    _onEmptyCallbacks = [];\n    _queues = new Map();\n    _activeActions = 0;\n    /**\n     * Used to register callbacks that will be run when the queue becomes empty.\n     *\n     * @param onEmptyCallback A callback that will be run whenever the queue becomes empty.\n     */\n    onEmpty(onEmptyCallback) {\n        this._onEmptyCallbacks.push(onEmptyCallback);\n    }\n    /**\n     * It adds asynchronous actions (functions) to the proper queue and runs them one by one.\n     *\n     * @param queueId The action queue ID.\n     * @param action A function that should be enqueued.\n     */\n    enqueue(queueId, action) {\n        const isMainAction = queueId === mainQueueId;\n        this._activeActions++;\n        if (!this._queues.get(queueId)) {\n            this._queues.set(queueId, Promise.resolve());\n        }\n        // List all sources of actions that the current action needs to await for.\n        // For the main action wait for all other actions.\n        // For the item action wait only for the item queue and the main queue.\n        const awaitedActions = isMainAction ?\n            Promise.all(this._queues.values()) :\n            Promise.all([this._queues.get(mainQueueId), this._queues.get(queueId)]);\n        const queueWithAction = awaitedActions.then(action);\n        // Catch all errors in the main queue to stack promises even if an error occurred in the past.\n        const nonErrorQueue = queueWithAction.catch(() => { });\n        this._queues.set(queueId, nonErrorQueue);\n        return queueWithAction.finally(() => {\n            this._activeActions--;\n            if (this._queues.get(queueId) === nonErrorQueue && this._activeActions === 0) {\n                this._onEmptyCallbacks.forEach(cb => cb());\n            }\n        });\n    }\n}\n/**\n * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.\n *\n * @param elementOrArray The value to transform to an array.\n * @returns An array created from data.\n */\nfunction toArray(elementOrArray) {\n    return Array.isArray(elementOrArray) ? elementOrArray : [elementOrArray];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/accessibility\n */\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\nconst DEFAULT_CATEGORY_ID = 'contentEditing';\n/**\n * @internal\n */\nexport const DEFAULT_GROUP_ID = 'common';\n/**\n * A common namespace for various accessibility features of the editor.\n *\n * **Information about editor keystrokes**\n *\n * * The information about keystrokes available in the editor is stored in the {@link #keystrokeInfos} property.\n * * New info entries can be added using the {@link #addKeystrokeInfoCategory}, {@link #addKeystrokeInfoGroup},\n * and {@link #addKeystrokeInfos} methods.\n */\nexport class Accessibility {\n    /**\n     * Stores information about keystrokes brought by editor features for the users to interact with the editor, mainly\n     * keystroke combinations and their accessible labels.\n     *\n     * This information is particularly useful for screen reader and other assistive technology users. It gets displayed\n     * by the {@link module:ui/editorui/accessibilityhelp/accessibilityhelp~AccessibilityHelp Accessibility help} dialog.\n     *\n     * Keystrokes are organized in categories and groups. They can be added using ({@link #addKeystrokeInfoCategory},\n     * {@link #addKeystrokeInfoGroup}, and {@link #addKeystrokeInfos}) methods.\n     *\n     * Please note that:\n     * * two categories are always available:\n     *   * `'contentEditing'` for keystrokes related to content creation,\n     *   * `'navigation'` for keystrokes related to navigation in the UI and the content.\n     * * unless specified otherwise, new keystrokes are added into the `'contentEditing'` category and the `'common'`\n     * keystroke group within that category while using the {@link #addKeystrokeInfos} method.\n     */\n    keystrokeInfos = new Map();\n    /**\n     * The editor instance.\n     */\n    _editor;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        this._editor = editor;\n        const isMenuBarVisible = editor.config.get('menuBar.isVisible');\n        const t = editor.locale.t;\n        this.addKeystrokeInfoCategory({\n            id: DEFAULT_CATEGORY_ID,\n            label: t('Content editing keystrokes'),\n            description: t('These keyboard shortcuts allow for quick access to content editing features.')\n        });\n        const navigationKeystrokes = [\n            {\n                label: t('Close contextual balloons, dropdowns, and dialogs'),\n                keystroke: 'Esc'\n            },\n            {\n                label: t('Open the accessibility help dialog'),\n                keystroke: 'Alt+0'\n            },\n            {\n                label: t('Move focus between form fields (inputs, buttons, etc.)'),\n                keystroke: [['Tab'], ['Shift+Tab']]\n            },\n            {\n                label: t('Move focus to the toolbar, navigate between toolbars'),\n                keystroke: 'Alt+F10',\n                mayRequireFn: true\n            },\n            {\n                label: t('Navigate through the toolbar or menu bar'),\n                keystroke: [['arrowup'], ['arrowright'], ['arrowdown'], ['arrowleft']]\n            },\n            {\n                // eslint-disable-next-line @stylistic/max-len\n                label: t('Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.'),\n                keystroke: [['Enter'], ['Space']]\n            }\n        ];\n        if (isMenuBarVisible) {\n            navigationKeystrokes.push({\n                label: t('Move focus to the menu bar, navigate between menu bars'),\n                keystroke: 'Alt+F9',\n                mayRequireFn: true\n            });\n        }\n        this.addKeystrokeInfoCategory({\n            id: 'navigation',\n            label: t('User interface and content navigation keystrokes'),\n            description: t('Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.'),\n            groups: [\n                {\n                    id: 'common',\n                    keystrokes: navigationKeystrokes\n                }\n            ]\n        });\n    }\n    /**\n     * Adds a top-level category in the {@link #keystrokeInfos keystroke information database} with a label and optional description.\n     *\n     * Categories organize keystrokes and help users to find the right keystroke. Each category can have multiple groups\n     * of keystrokes that narrow down the context in which the keystrokes are available. Every keystroke category comes\n     * with a `'common'` group by default.\n     *\n     * By default, two categories are available:\n     * * `'contentEditing'` for keystrokes related to content creation,\n     * * `'navigation'` for keystrokes related to navigation in the UI and the content.\n     *\n     * To create a new keystroke category with new groups, use the following code:\n     *\n     * ```js\n     * class MyPlugin extends Plugin {\n     * \t// ...\n     * \tinit() {\n     * \t\tconst editor = this.editor;\n     * \t\tconst t = editor.t;\n     *\n     * \t\t// ...\n     *\n     * \t\teditor.accessibility.addKeystrokeInfoCategory( {\n     * \t\t\tid: 'myCategory',\n     * \t\t\tlabel: t( 'My category' ),\n     * \t\t\tdescription: t( 'My category description.' ),\n     * \t\t\tgroups: [\n     * \t\t\t\t{\n     * \t\t\t\t\tid: 'myGroup',\n     * \t\t\t\t\tlabel: t( 'My keystroke group' ),\n     * \t\t\t\t\tkeystrokes: [\n     * \t\t\t\t\t\t{\n     * \t\t\t\t\t\t\tlabel: t( 'Keystroke label 1' ),\n     * \t\t\t\t\t\t\tkeystroke: 'Ctrl+Shift+N'\n     * \t\t\t\t\t\t},\n     * \t\t\t\t\t\t{\n     * \t\t\t\t\t\t\tlabel: t( 'Keystroke label 2' ),\n     * \t\t\t\t\t\t\tkeystroke: 'Ctrl+Shift+M'\n     * \t\t\t\t\t\t}\n     * \t\t\t\t\t]\n     * \t\t\t\t}\n     * \t\t\t]\n     * \t\t};\n     * \t}\n     * }\n     * ```\n     *\n     * See {@link #keystrokeInfos}, {@link #addKeystrokeInfoGroup}, and {@link #addKeystrokeInfos}.\n     */\n    addKeystrokeInfoCategory({ id, label, description, groups }) {\n        this.keystrokeInfos.set(id, {\n            id,\n            label,\n            description,\n            groups: new Map()\n        });\n        this.addKeystrokeInfoGroup({\n            categoryId: id,\n            id: DEFAULT_GROUP_ID\n        });\n        if (groups) {\n            groups.forEach(group => {\n                this.addKeystrokeInfoGroup({\n                    categoryId: id,\n                    ...group\n                });\n            });\n        }\n    }\n    /**\n     * Adds a group of keystrokes in a specific category to the {@link #keystrokeInfos keystroke information database}.\n     *\n     * Groups narrow down the context in which the keystrokes are available. When `categoryId` is not specified,\n     * the group goes to the `'contentEditing'` category (default).\n     *\n     * To create a new group within an existing category, use the following code:\n     *\n     * ```js\n     * class MyPlugin extends Plugin {\n     * \t// ...\n     * \tinit() {\n     * \t\tconst editor = this.editor;\n     * \t\tconst t = editor.t;\n     *\n     * \t\t// ...\n     *\n     * \t\teditor.accessibility.addKeystrokeInfoGroup( {\n     * \t\t\tid: 'myGroup',\n     * \t\t\tcategoryId: 'navigation',\n     * \t\t\tlabel: t( 'My keystroke group' ),\n     * \t\t\tkeystrokes: [\n     * \t\t\t\t{\n     * \t\t\t\t\tlabel: t( 'Keystroke label 1' ),\n     * \t\t\t\t\tkeystroke: 'Ctrl+Shift+N'\n     * \t\t\t\t},\n     * \t\t\t\t{\n     * \t\t\t\t\tlabel: t( 'Keystroke label 2' ),\n     * \t\t\t\t\tkeystroke: 'Ctrl+Shift+M'\n     * \t\t\t\t}\n     * \t\t\t]\n     * \t\t} );\n     * \t}\n     * }\n     * ```\n     *\n     * See {@link #keystrokeInfos}, {@link #addKeystrokeInfoCategory}, and {@link #addKeystrokeInfos}.\n     */\n    addKeystrokeInfoGroup({ categoryId = DEFAULT_CATEGORY_ID, id, label, keystrokes }) {\n        const category = this.keystrokeInfos.get(categoryId);\n        if (!category) {\n            throw new CKEditorError('accessibility-unknown-keystroke-info-category', this._editor, { groupId: id, categoryId });\n        }\n        category.groups.set(id, {\n            id,\n            label,\n            keystrokes: keystrokes || []\n        });\n    }\n    /**\n     * Adds information about keystrokes to the {@link #keystrokeInfos keystroke information database}.\n     *\n     * Keystrokes without specified `groupId` or `categoryId` go to the `'common'` group in the `'contentEditing'` category (default).\n     *\n     * To add a keystroke brought by your plugin (using default group and category), use the following code:\n     *\n     * ```js\n     * class MyPlugin extends Plugin {\n     * \t// ...\n     * \tinit() {\n     * \t\tconst editor = this.editor;\n     * \t\tconst t = editor.t;\n     *\n     * \t\t// ...\n     *\n     * \t\teditor.accessibility.addKeystrokeInfos( {\n     * \t\t\tkeystrokes: [\n     * \t\t\t\t{\n     * \t\t\t\t\tlabel: t( 'Keystroke label' ),\n     * \t\t\t\t\tkeystroke: 'CTRL+B'\n     * \t\t\t\t}\n     * \t\t\t]\n     * \t\t} );\n     * \t}\n     * }\n     * ```\n     * To add a keystroke in a specific existing `'widget'` group in the default `'contentEditing'` category:\n     *\n     * ```js\n     * class MyPlugin extends Plugin {\n     * \t// ...\n     * \tinit() {\n     * \t\tconst editor = this.editor;\n     * \t\tconst t = editor.t;\n     *\n     * \t\t// ...\n     *\n     * \t\teditor.accessibility.addKeystrokeInfos( {\n     * \t\t\t// Add a keystroke to the existing \"widget\" group.\n     * \t\t\tgroupId: 'widget',\n     * \t\t\tkeystrokes: [\n     * \t\t\t\t{\n     * \t\t\t\t\tlabel: t( 'A an action on a selected widget' ),\n     * \t\t\t\t\tkeystroke: 'Ctrl+D',\n     * \t\t\t\t}\n     * \t\t\t]\n     * \t\t} );\n     * \t}\n     * }\n     * ```\n     *\n     * To add a keystroke to another existing category (using default group):\n     *\n     * ```js\n     * class MyPlugin extends Plugin {\n     * \t// ...\n     * \tinit() {\n     * \t\tconst editor = this.editor;\n     * \t\tconst t = editor.t;\n     *\n     * \t\t// ...\n     *\n     * \t\teditor.accessibility.addKeystrokeInfos( {\n     * \t\t\t// Add keystrokes to the \"navigation\" category (one of defaults).\n     * \t\t\tcategoryId: 'navigation',\n     * \t\t\tkeystrokes: [\n     * \t\t\t\t{\n     * \t\t\t\t\tlabel: t( 'Keystroke label' ),\n     * \t\t\t\t\tkeystroke: 'CTRL+B'\n     * \t\t\t\t}\n     * \t\t\t]\n     * \t\t} );\n     * \t}\n     * }\n     * ```\n     *\n     * See {@link #keystrokeInfos}, {@link #addKeystrokeInfoGroup}, and {@link #addKeystrokeInfoCategory}.\n     */\n    addKeystrokeInfos({ categoryId = DEFAULT_CATEGORY_ID, groupId = DEFAULT_GROUP_ID, keystrokes }) {\n        if (!this.keystrokeInfos.has(categoryId)) {\n            /**\n             * Cannot add keystrokes in an unknown category. Use\n             * {@link module:core/accessibility~Accessibility#addKeystrokeInfoCategory}\n             * to add a new category or make sure the specified category exists.\n             *\n             * @error accessibility-unknown-keystroke-info-category\n             * @param {string} categoryId The id of the unknown keystroke category.\n             * @param {module:core/accessibility~AddKeystrokeInfosData#keystrokes} keystrokes Keystroke definitions about to be added.\n             */\n            throw new CKEditorError('accessibility-unknown-keystroke-info-category', this._editor, { categoryId, keystrokes });\n        }\n        const category = this.keystrokeInfos.get(categoryId);\n        if (!category.groups.has(groupId)) {\n            /**\n             * Cannot add keystrokes to an unknown group.\n             *\n             * Use {@link module:core/accessibility~Accessibility#addKeystrokeInfoGroup}\n             * to add a new group or make sure the specified group exists.\n             *\n             * @error accessibility-unknown-keystroke-info-group\n             * @param {string} groupId The id of the unknown keystroke group.\n             * @param {string} categoryId The id of category the unknown group should belong to.\n             * @param {module:core/accessibility~AddKeystrokeInfosData#keystrokes} keystrokes Keystroke definitions about to be added.\n             */\n            throw new CKEditorError('accessibility-unknown-keystroke-info-group', this._editor, { groupId, categoryId, keystrokes });\n        }\n        category.groups.get(groupId).keystrokes.push(...keystrokes);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/editor/utils/editorusagedata\n */\nimport { env, global, uid } from '@ckeditor/ckeditor5-utils';\n/**\n * This part of the code is not executed in open-source implementations using a GPL key.\n * It only runs when a specific license key is provided. If you are uncertain whether\n * this applies to your installation, please contact our support team.\n *\n * @internal\n */\nexport function getEditorUsageData(editor) {\n    return {\n        sessionId: getSessionId(),\n        pageSessionId: getPageSessionID(),\n        hostname: window.location.hostname,\n        version: globalThis.CKEDITOR_VERSION,\n        type: getEditorType(editor),\n        plugins: getPluginsUsageData(editor.plugins),\n        distribution: getDistributionUsageData(),\n        env: getEnvUsageData(),\n        integration: Object.create(null),\n        menuBar: {\n            isVisible: !!editor.config.get('menuBar.isVisible')\n        },\n        language: {\n            ui: editor.locale.uiLanguage,\n            content: editor.locale.contentLanguage\n        },\n        toolbar: {\n            main: getToolbarUsageData(editor.config.get('toolbar')),\n            block: getToolbarUsageData(editor.config.get('blockToolbar')),\n            balloon: getToolbarUsageData(editor.config.get('balloonToolbar'))\n        }\n    };\n}\nfunction getEditorType(editor) {\n    return Object.getPrototypeOf(editor).constructor.editorName;\n}\nfunction getPluginsUsageData(collection) {\n    return Array\n        .from(collection)\n        .filter(([PluginConstructor]) => !!PluginConstructor.pluginName)\n        .map(([PluginConstructor]) => {\n        const { pluginName, isContextPlugin, isOfficialPlugin, isPremiumPlugin } = PluginConstructor;\n        return {\n            isContext: !!isContextPlugin,\n            isOfficial: !!isOfficialPlugin,\n            isPremium: !!isPremiumPlugin,\n            name: pluginName\n        };\n    });\n}\nfunction getToolbarUsageData(toolbarConfig) {\n    if (!toolbarConfig) {\n        return undefined;\n    }\n    const normalizedToolbar = Array.isArray(toolbarConfig) ?\n        { items: toolbarConfig } :\n        toolbarConfig;\n    const flattenToolbarConfigNames = extractToolbarConfigItemsNames(normalizedToolbar.items || []);\n    const isMultiline = flattenToolbarConfigNames.includes('-');\n    return {\n        isMultiline,\n        shouldNotGroupWhenFull: !!normalizedToolbar.shouldNotGroupWhenFull,\n        items: stripToolbarSeparatorItems(flattenToolbarConfigNames)\n    };\n    function stripToolbarSeparatorItems(items) {\n        return items.filter((item) => item !== '|' && item !== '-');\n    }\n    function extractToolbarConfigItemsNames(items) {\n        return items.flatMap(item => {\n            if (typeof item === 'string') {\n                return [item];\n            }\n            return extractToolbarConfigItemsNames(item.items);\n        });\n    }\n}\nfunction getDistributionUsageData() {\n    return {\n        channel: (window[Symbol.for('cke distribution')] || 'sh')\n    };\n}\nfunction getEnvUsageData() {\n    let os = 'unknown';\n    let browser = 'unknown';\n    if (env.isMac) {\n        os = 'mac';\n    }\n    else if (env.isWindows) {\n        os = 'windows';\n    }\n    else if (env.isiOS) {\n        os = 'ios';\n    }\n    else if (env.isAndroid) {\n        os = 'android';\n    }\n    if (env.isGecko) {\n        browser = 'gecko';\n    }\n    else if (env.isBlink) {\n        browser = 'blink';\n    }\n    else if (env.isSafari) {\n        browser = 'safari';\n    }\n    return {\n        os,\n        browser\n    };\n}\nfunction getSessionId() {\n    if (!localStorage.getItem('__ckeditor-session-id')) {\n        localStorage.setItem('__ckeditor-session-id', uid());\n    }\n    return localStorage.getItem('__ckeditor-session-id');\n}\nfunction getPageSessionID() {\n    global.window.CKEDITOR_PAGE_SESSION_ID = global.window.CKEDITOR_PAGE_SESSION_ID || uid();\n    return global.window.CKEDITOR_PAGE_SESSION_ID;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/editor/editor\n */\nimport { set, get } from 'es-toolkit/compat';\nimport { Config, CKEditorError, ObservableMixin, logError, releaseDate, toArray, uid, crc32, decodeLicenseKey, isFeatureBlockedByLicenseKey } from '@ckeditor/ckeditor5-utils';\nimport { Conversion, DataController, EditingController, Model, StylesProcessor } from '@ckeditor/ckeditor5-engine';\nimport { ContextWatchdog, EditorWatchdog } from '@ckeditor/ckeditor5-watchdog';\nimport { Context } from '../context.js';\nimport { PluginCollection } from '../plugincollection.js';\nimport { CommandCollection } from '../commandcollection.js';\nimport { EditingKeystrokeHandler } from '../editingkeystrokehandler.js';\nimport { Accessibility } from '../accessibility.js';\nimport { getEditorUsageData } from './utils/editorusagedata.js';\nimport '../../theme/core.css';\n/**\n * The class representing a basic, generic editor.\n *\n * Check out the list of its subclasses to learn about specific editor implementations.\n *\n * All editor implementations (like {@link module:editor-classic/classiceditor~ClassicEditor} or\n * {@link module:editor-inline/inlineeditor~InlineEditor}) should extend this class. They can add their\n * own methods and properties.\n *\n * When you are implementing a plugin, this editor represents the API\n * which your plugin can expect to get when using its {@link module:core/plugin~Plugin#editor} property.\n *\n * This API should be sufficient in order to implement the \"editing\" part of your feature\n * (schema definition, conversion, commands, keystrokes, etc.).\n * It does not define the editor UI, which is available only if\n * the specific editor implements also the {@link ~Editor#ui} property\n * (as most editor implementations do).\n */\nexport class Editor extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * A required name of the editor class. The name should reflect the constructor name.\n     */\n    static get editorName() {\n        return 'Editor';\n    }\n    /**\n     * A namespace for the accessibility features of the editor.\n     */\n    accessibility;\n    /**\n     * Commands registered to the editor.\n     *\n     * Use the shorthand {@link #execute `editor.execute()`} method to execute commands:\n     *\n     * ```ts\n     * // Execute the bold command:\n     * editor.execute( 'bold' );\n     *\n     * // Check the state of the bold command:\n     * editor.commands.get( 'bold' ).value;\n     * ```\n     */\n    commands;\n    /**\n     * Stores all configurations specific to this editor instance.\n     *\n     * ```ts\n     * editor.config.get( 'image.toolbar' );\n     * // -> [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ]\n     * ```\n     */\n    config;\n    /**\n     * Conversion manager through which you can register model-to-view and view-to-model converters.\n     *\n     * See the {@link module:engine/conversion/conversion~Conversion} documentation to learn how to add converters.\n     */\n    conversion;\n    /**\n     * The {@link module:engine/controller/datacontroller~DataController data controller}.\n     * Used e.g. for setting and retrieving the editor data.\n     */\n    data;\n    /**\n     * The {@link module:engine/controller/editingcontroller~EditingController editing controller}.\n     * Controls user input and rendering the content for editing.\n     */\n    editing;\n    /**\n     * The locale instance.\n     */\n    locale;\n    /**\n     * The editor's model.\n     *\n     * The central point of the editor's abstract data model.\n     */\n    model;\n    /**\n     * The plugins loaded and in use by this editor instance.\n     *\n     * ```ts\n     * editor.plugins.get( 'ClipboardPipeline' ); // -> An instance of the clipboard pipeline plugin.\n     * ```\n     */\n    plugins;\n    /**\n     * An instance of the {@link module:core/editingkeystrokehandler~EditingKeystrokeHandler}.\n     *\n     * It allows setting simple keystrokes:\n     *\n     * ```ts\n     * // Execute the bold command on Ctrl+E:\n     * editor.keystrokes.set( 'Ctrl+E', 'bold' );\n     *\n     * // Execute your own callback:\n     * editor.keystrokes.set( 'Ctrl+E', ( data, cancel ) => {\n     * \tconsole.log( data.keyCode );\n     *\n     * \t// Prevent the default (native) action and stop the underlying keydown event\n     * \t// so no other editor feature will interfere.\n     * \tcancel();\n     * } );\n     * ```\n     *\n     * Note: Certain typing-oriented keystrokes (like <kbd>Backspace</kbd> or <kbd>Enter</kbd>) are handled\n     * by a low-level mechanism and trying to listen to them via the keystroke handler will not work reliably.\n     * To handle these specific keystrokes, see the events fired by the\n     * {@link module:engine/view/document~ViewDocument editing view document} (`editor.editing.view.document`).\n     */\n    keystrokes;\n    /**\n     * Shorthand for {@link module:utils/locale~Locale#t}.\n     *\n     * @see module:utils/locale~Locale#t\n     */\n    t;\n    /**\n     * The default configuration which is built into the editor class.\n     *\n     * It was used in the now deprecated CKEditor 5 builds to provide the default configuration options\n     * which are later used during the editor initialization.\n     *\n     * ```ts\n     * ClassicEditor.defaultConfig = {\n     * \tfoo: 1,\n     * \tbar: 2\n     * };\n     *\n     * ClassicEditor\n     * \t.create( sourceElement )\n     * \t.then( editor => {\n     * \t\teditor.config.get( 'foo' ); // -> 1\n     * \t\teditor.config.get( 'bar' ); // -> 2\n     * \t} );\n     *\n     * // The default options can be overridden by the configuration passed to create().\n     * ClassicEditor\n     * \t.create( sourceElement, { bar: 3 } )\n     * \t.then( editor => {\n     * \t\teditor.config.get( 'foo' ); // -> 1\n     * \t\teditor.config.get( 'bar' ); // -> 3\n     * \t} );\n     * ```\n     *\n     * See also {@link module:core/editor/editor~Editor.builtinPlugins}.\n     */\n    static defaultConfig;\n    /**\n     * An array of plugins built into this editor class.\n     *\n     * It is used in the now deprecated CKEditor 5 builds to provide a list of plugins which are later automatically initialized\n     * during the editor initialization.\n     *\n     * They will be automatically initialized by the editor, unless listed in `config.removePlugins` and\n     * unless `config.plugins` is passed.\n     *\n     * ```ts\n     * // Build some plugins into the editor class first.\n     * ClassicEditor.builtinPlugins = [ FooPlugin, BarPlugin ];\n     *\n     * // Normally, you need to define config.plugins, but since ClassicEditor.builtinPlugins was\n     * // defined, now you can call create() without any configuration.\n     * ClassicEditor\n     * \t.create( sourceElement )\n     * \t.then( editor => {\n     * \t\teditor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.\n     * \t\teditor.plugins.get( BarPlugin ); // -> An instance of the Bar plugin.\n     * \t} );\n     *\n     * ClassicEditor\n     * \t.create( sourceElement, {\n     * \t\t// Do not initialize these plugins (note: it is defined by a string):\n     * \t\tremovePlugins: [ 'Foo' ]\n     * \t} )\n     * \t.then( editor => {\n     * \t\teditor.plugins.get( FooPlugin ); // -> Undefined.\n     * \t\teditor.config.get( BarPlugin ); // -> An instance of the Bar plugin.\n     * \t} );\n     *\n     * ClassicEditor\n     * \t.create( sourceElement, {\n     * \t\t// Load only this plugin. It can also be defined by a string if\n     * \t\t// this plugin was built into the editor class.\n     * \t\tplugins: [ FooPlugin ]\n     * \t} )\n     * \t.then( editor => {\n     * \t\teditor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.\n     * \t\teditor.config.get( BarPlugin ); // -> Undefined.\n     * \t} );\n     * ```\n     *\n     * See also {@link module:core/editor/editor~Editor.defaultConfig}.\n     */\n    static builtinPlugins;\n    /**\n     * The editor context.\n     * When it is not provided through the configuration, the editor creates it.\n     */\n    _context;\n    /**\n     * A set of lock IDs for the {@link #isReadOnly} getter.\n     */\n    _readOnlyLocks;\n    /**\n     * Creates a new instance of the editor class.\n     *\n     * Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.\n     *\n     * @param config The editor configuration.\n     */\n    constructor(config = {}) {\n        super();\n        if ('sanitizeHtml' in config) {\n            /**\n             * Configuration property `config.sanitizeHtml` was removed in CKEditor version 43.1.0 and is no longer supported.\n             *\n             * Please use `config.htmlEmbed.sanitizeHtml` and/or `config.mergeFields.sanitizeHtml` instead.\n             *\n             * @error editor-config-sanitizehtml-not-supported\n             */\n            throw new CKEditorError('editor-config-sanitizehtml-not-supported');\n        }\n        const constructor = this.constructor;\n        // We don't pass translations to the config, because its behavior of splitting keys\n        // with dots (e.g. `resize.width` => `resize: { width }`) breaks the translations.\n        const { translations: defaultTranslations, ...defaultConfig } = constructor.defaultConfig || {};\n        const { translations = defaultTranslations, ...rest } = config;\n        // Prefer the language passed as the argument to the constructor instead of the constructor's `defaultConfig`, if both are set.\n        const language = config.language || defaultConfig.language;\n        this._context = config.context || new Context({ language, translations });\n        this._context._addEditor(this, !config.context);\n        // Clone the plugins to make sure that the plugin array will not be shared\n        // between editors and make the watchdog feature work correctly.\n        const availablePlugins = Array.from(constructor.builtinPlugins || []);\n        this.config = new Config(rest, defaultConfig);\n        this.config.define('plugins', availablePlugins);\n        this.config.define(this._context._getEditorConfig());\n        checkLicenseKeyIsDefined(this.config);\n        this.plugins = new PluginCollection(this, availablePlugins, this._context.plugins);\n        this.locale = this._context.locale;\n        this.t = this.locale.t;\n        this._readOnlyLocks = new Set();\n        this.commands = new CommandCollection();\n        this.set('state', 'initializing');\n        this.once('ready', () => (this.state = 'ready'), { priority: 'high' });\n        this.once('destroy', () => (this.state = 'destroyed'), { priority: 'high' });\n        this.model = new Model(this.config);\n        this.on('change:isReadOnly', () => {\n            this.model.document.isReadOnly = this.isReadOnly;\n        });\n        const stylesProcessor = new StylesProcessor();\n        this.data = new DataController(this.model, stylesProcessor);\n        this.editing = new EditingController(this.model, stylesProcessor);\n        this.editing.view.document.bind('isReadOnly').to(this);\n        this.conversion = new Conversion([this.editing.downcastDispatcher, this.data.downcastDispatcher], this.data.upcastDispatcher);\n        this.conversion.addAlias('dataDowncast', this.data.downcastDispatcher);\n        this.conversion.addAlias('editingDowncast', this.editing.downcastDispatcher);\n        this.keystrokes = new EditingKeystrokeHandler(this);\n        this.keystrokes.listenTo(this.editing.view.document);\n        this.accessibility = new Accessibility(this);\n        verifyLicenseKey(this);\n        // Checks if the license key is defined and throws an error if it is not.\n        function checkLicenseKeyIsDefined(config) {\n            let licenseKey = config.get('licenseKey');\n            if (!licenseKey && window.CKEDITOR_GLOBAL_LICENSE_KEY) {\n                licenseKey = window.CKEDITOR_GLOBAL_LICENSE_KEY;\n                config.set('licenseKey', licenseKey);\n            }\n            if (!licenseKey) {\n                /**\n                 * The `licenseKey` property is missing in the editor configuration.\n                 *\n                 * * If you are using the editor in a commercial setup, please provide your license key.\n                 * * If you still need to acquire a key, please [contact us](https://ckeditor.com/contact/) or\n                 *   [create a free account with a 14 day premium features trial](https://portal.ckeditor.com/checkout?plan=free).\n                 * * If you are using the editor under a GPL license or another license from our Open Source Initiative,\n                 *   use the 'GPL' license key instead.\n                 *\n                 * ```js\n                 * ClassicEditor.create( document.querySelector( '#editor' ), {\n                 * \tlicenseKey: '<YOUR_LICENSE_KEY>', // Or 'GPL'.\n                 * \t// ... Other configuration options ...\n                 * } ) ;\n                 *\n                 * @error license-key-missing\n                 */\n                throw new CKEditorError('license-key-missing');\n            }\n        }\n        function verifyLicenseKey(editor) {\n            const licenseKey = editor.config.get('licenseKey');\n            const distributionChannel = window[Symbol.for('cke distribution')] || 'sh';\n            function blockEditor(reason, name) {\n                editor.enableReadOnlyMode(Symbol('invalidLicense'));\n                editor._showLicenseError(reason, name);\n            }\n            function hasAllRequiredFields(licensePayload) {\n                const requiredFields = ['exp', 'jti', 'vc'];\n                return requiredFields.every(field => field in licensePayload);\n            }\n            function getCrcInputData(licensePayload) {\n                const keysToCheck = Object.getOwnPropertyNames(licensePayload).sort();\n                const filteredValues = keysToCheck\n                    .filter(key => key != 'vc' && licensePayload[key] != null)\n                    .map(key => licensePayload[key]);\n                return filteredValues;\n            }\n            function checkLicensedHosts(licensedHosts) {\n                const { hostname } = new URL(window.location.href);\n                if (licensedHosts.includes(hostname)) {\n                    return true;\n                }\n                const segments = hostname.split('.');\n                return licensedHosts\n                    // Filter out hosts without wildcards.\n                    .filter(host => host.includes('*'))\n                    // Split the hosts into segments.\n                    .map(host => host.split('.'))\n                    // Filter out hosts that have more segments than the current hostname.\n                    .filter(host => host.length <= segments.length)\n                    // Pad the beginning of the licensed host if it's shorter than the current hostname.\n                    .map(host => Array(segments.length - host.length).fill(host[0] === '*' ? '*' : '').concat(host))\n                    // Check if some license host matches the hostname.\n                    .some(octets => segments.every((segment, index) => octets[index] === segment || octets[index] === '*'));\n            }\n            function warnAboutNonProductionLicenseKey(licenseType) {\n                const capitalizedLicenseType = licenseType[0].toUpperCase() + licenseType.slice(1);\n                const article = licenseType === 'evaluation' ? 'an' : 'a';\n                console.info(`%cCKEditor 5 ${capitalizedLicenseType} License`, 'color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;');\n                console.warn(`⚠️ You are using ${article} ${licenseType} license of CKEditor 5` +\n                    `${licenseType === 'trial' ? ' which is for evaluation purposes only' : ''}. ` +\n                    'For production usage, please obtain a production license at https://portal.ckeditor.com/');\n            }\n            if (licenseKey == 'GPL') {\n                if (distributionChannel == 'cloud') {\n                    blockEditor('distributionChannel');\n                }\n                return;\n            }\n            const licensePayload = decodeLicenseKey(licenseKey);\n            if (!licensePayload) {\n                blockEditor('invalid');\n                return;\n            }\n            if (!hasAllRequiredFields(licensePayload)) {\n                blockEditor('invalid');\n                return;\n            }\n            if (licensePayload.distributionChannel && !toArray(licensePayload.distributionChannel).includes(distributionChannel)) {\n                blockEditor('distributionChannel');\n                return;\n            }\n            if (crc32(getCrcInputData(licensePayload)) != licensePayload.vc.toLowerCase()) {\n                blockEditor('invalid');\n                return;\n            }\n            const expirationDate = new Date(licensePayload.exp * 1000);\n            if (expirationDate < releaseDate) {\n                blockEditor('expired');\n                return;\n            }\n            const licensedHosts = licensePayload.licensedHosts;\n            if (licensedHosts && licensedHosts.length > 0 && !checkLicensedHosts(licensedHosts)) {\n                blockEditor('domainLimit');\n                return;\n            }\n            if (['evaluation', 'trial'].includes(licensePayload.licenseType) && licensePayload.exp * 1000 < Date.now()) {\n                blockEditor('expired');\n                return;\n            }\n            if (['development', 'evaluation', 'trial'].includes(licensePayload.licenseType)) {\n                const { licenseType } = licensePayload;\n                window.CKEDITOR_WARNING_SUPPRESSIONS = window.CKEDITOR_WARNING_SUPPRESSIONS || {};\n                if (!window.CKEDITOR_WARNING_SUPPRESSIONS[licenseType]) {\n                    warnAboutNonProductionLicenseKey(licenseType);\n                    window.CKEDITOR_WARNING_SUPPRESSIONS[licenseType] = true;\n                }\n            }\n            if (['evaluation', 'trial'].includes(licensePayload.licenseType)) {\n                const licenseType = licensePayload.licenseType;\n                const timerId = setTimeout(() => {\n                    blockEditor(`${licenseType}Limit`);\n                }, 600000);\n                editor.on('destroy', () => {\n                    clearTimeout(timerId);\n                });\n            }\n            if (licensePayload.usageEndpoint) {\n                editor.once('ready', () => {\n                    const request = {\n                        requestId: uid(),\n                        requestTime: Math.round(Date.now() / 1000),\n                        license: licenseKey,\n                        editor: collectUsageData(editor)\n                    };\n                    /**\n                     * This part of the code is not executed in open-source implementations using a GPL key.\n                     * It only runs when a specific license key is provided. If you are uncertain whether\n                     * this applies to your installation, please contact our support team.\n                     */\n                    editor._sendUsageRequest(licensePayload.usageEndpoint, request).then(response => {\n                        const { status, message } = response;\n                        if (message) {\n                            console.warn(message);\n                        }\n                        if (status != 'ok') {\n                            blockEditor('usageLimit');\n                        }\n                    }, () => {\n                        /**\n                         * Your license key cannot be validated due to a network issue.\n                         * Please ensure that your setup does not block requests to the validation endpoint.\n                         *\n                         * @error license-key-validation-endpoint-not-reachable\n                         * @param {string} url The URL that was attempted to be reached for validation.\n                         */\n                        logError('license-key-validation-endpoint-not-reachable', { url: licensePayload.usageEndpoint });\n                    });\n                }, { priority: 'high' });\n            }\n        }\n    }\n    /**\n     * Defines whether the editor is in the read-only mode.\n     *\n     * In read-only mode the editor {@link #commands commands} are disabled so it is not possible\n     * to modify the document by using them. Also, the editable element(s) become non-editable.\n     *\n     * In order to make the editor read-only, you need to call the {@link #enableReadOnlyMode} method:\n     *\n     * ```ts\n     * editor.enableReadOnlyMode( 'feature-id' );\n     * ```\n     *\n     * Later, to turn off the read-only mode, call {@link #disableReadOnlyMode}:\n     *\n     * ```ts\n     * editor.disableReadOnlyMode( 'feature-id' );\n     * ```\n     *\n     * @readonly\n     * @observable\n     */\n    get isReadOnly() {\n        return this._readOnlyLocks.size > 0;\n    }\n    set isReadOnly(value) {\n        /**\n         * The {@link module:core/editor/editor~Editor#isReadOnly Editor#isReadOnly} property is read-only since version `34.0.0`\n         * and can be set only using {@link module:core/editor/editor~Editor#enableReadOnlyMode `Editor#enableReadOnlyMode( lockId )`} and\n         * {@link module:core/editor/editor~Editor#disableReadOnlyMode `Editor#disableReadOnlyMode( lockId )`}.\n         *\n         * Usage before version `34.0.0`:\n         *\n         * ```ts\n         * editor.isReadOnly = true;\n         * editor.isReadOnly = false;\n         * ```\n         *\n         * Usage since version `34.0.0`:\n         *\n         * ```ts\n         * editor.enableReadOnlyMode( 'my-feature-id' );\n         * editor.disableReadOnlyMode( 'my-feature-id' );\n         * ```\n         *\n         * @error editor-isreadonly-has-no-setter\n         */\n        throw new CKEditorError('editor-isreadonly-has-no-setter');\n    }\n    /**\n     * Turns on the read-only mode in the editor.\n     *\n     * Editor can be switched to or out of the read-only mode by many features, under various circumstances. The editor supports locking\n     * mechanism for the read-only mode. It enables easy control over the read-only mode when many features wants to turn it on or off at\n     * the same time, without conflicting with each other. It guarantees that you will not make the editor editable accidentally (which\n     * could lead to errors).\n     *\n     * Each read-only mode request is identified by a unique id (also called \"lock\"). If multiple plugins requested to turn on the\n     * read-only mode, then, the editor will become editable only after all these plugins turn the read-only mode off (using the same ids).\n     *\n     * Note, that you cannot force the editor to disable the read-only mode if other plugins set it.\n     *\n     * After the first `enableReadOnlyMode()` call, the {@link #isReadOnly `isReadOnly` property} will be set to `true`:\n     *\n     * ```ts\n     * editor.isReadOnly; // `false`.\n     * editor.enableReadOnlyMode( 'my-feature-id' );\n     * editor.isReadOnly; // `true`.\n     * ```\n     *\n     * You can turn off the read-only mode (\"clear the lock\") using the {@link #disableReadOnlyMode `disableReadOnlyMode()`} method:\n     *\n     * ```ts\n     * editor.enableReadOnlyMode( 'my-feature-id' );\n     * // ...\n     * editor.disableReadOnlyMode( 'my-feature-id' );\n     * editor.isReadOnly; // `false`.\n     * ```\n     *\n     * All \"locks\" need to be removed to enable editing:\n     *\n     * ```ts\n     * editor.enableReadOnlyMode( 'my-feature-id' );\n     * editor.enableReadOnlyMode( 'my-other-feature-id' );\n     * // ...\n     * editor.disableReadOnlyMode( 'my-feature-id' );\n     * editor.isReadOnly; // `true`.\n     * editor.disableReadOnlyMode( 'my-other-feature-id' );\n     * editor.isReadOnly; // `false`.\n     * ```\n     *\n     * @param lockId A unique ID for setting the editor to the read-only state.\n     */\n    enableReadOnlyMode(lockId) {\n        if (typeof lockId !== 'string' && typeof lockId !== 'symbol') {\n            /**\n             * The lock ID is missing or it is not a string or symbol.\n             *\n             * @error editor-read-only-lock-id-invalid\n             * @param {never} lockId Lock ID.\n             */\n            throw new CKEditorError('editor-read-only-lock-id-invalid', null, { lockId });\n        }\n        if (this._readOnlyLocks.has(lockId)) {\n            return;\n        }\n        this._readOnlyLocks.add(lockId);\n        if (this._readOnlyLocks.size === 1) {\n            // Manually fire the `change:isReadOnly` event as only getter is provided.\n            this.fire('change:isReadOnly', 'isReadOnly', true, false);\n        }\n    }\n    /**\n     * Removes the read-only lock from the editor with given lock ID.\n     *\n     * When no lock is present on the editor anymore, then the {@link #isReadOnly `isReadOnly` property} will be set to `false`.\n     *\n     * @param lockId The lock ID for setting the editor to the read-only state.\n     */\n    disableReadOnlyMode(lockId) {\n        if (typeof lockId !== 'string' && typeof lockId !== 'symbol') {\n            throw new CKEditorError('editor-read-only-lock-id-invalid', null, { lockId });\n        }\n        if (!this._readOnlyLocks.has(lockId)) {\n            return;\n        }\n        this._readOnlyLocks.delete(lockId);\n        if (this._readOnlyLocks.size === 0) {\n            // Manually fire the `change:isReadOnly` event as only getter is provided.\n            this.fire('change:isReadOnly', 'isReadOnly', false, true);\n        }\n    }\n    /**\n     * Sets the data in the editor.\n     *\n     * ```ts\n     * editor.setData( '<p>This is editor!</p>' );\n     * ```\n     *\n     * If your editor implementation uses multiple roots, you should pass an object with keys corresponding\n     * to the editor root names and values equal to the data that should be set in each root:\n     *\n     * ```ts\n     * editor.setData( {\n     *     header: '<p>Content for header part.</p>',\n     *     content: '<p>Content for main part.</p>',\n     *     footer: '<p>Content for footer part.</p>'\n     * } );\n     * ```\n     *\n     * By default the editor accepts HTML. This can be controlled by injecting a different data processor.\n     * See the {@glink features/markdown Markdown output} guide for more details.\n     *\n     * @param data Input data.\n     */\n    setData(data) {\n        this.data.set(data);\n    }\n    /**\n     * Gets the data from the editor.\n     *\n     * ```ts\n     * editor.getData(); // -> '<p>This is editor!</p>'\n     * ```\n     *\n     * If your editor implementation uses multiple roots, you should pass root name as one of the options:\n     *\n     * ```ts\n     * editor.getData( { rootName: 'header' } ); // -> '<p>Content for header part.</p>'\n     * ```\n     *\n     * By default, the editor outputs HTML. This can be controlled by injecting a different data processor.\n     * See the {@glink features/markdown Markdown output} guide for more details.\n     *\n     * A warning is logged when you try to retrieve data for a detached root, as most probably this is a mistake. A detached root should\n     * be treated like it is removed, and you should not save its data. Note, that the detached root data is always an empty string.\n     *\n     * @param options Additional configuration for the retrieved data.\n     * Editor features may introduce more configuration options that can be set through this parameter.\n     * @param options.rootName Root name. Defaults to `'main'`.\n     * @param options.trim Whether returned data should be trimmed. This option is set to `'empty'` by default,\n     * which means that whenever editor content is considered empty, an empty string is returned. To turn off trimming\n     * use `'none'`. In such cases exact content will be returned (for example `'<p>&nbsp;</p>'` for an empty editor).\n     * @returns Output data.\n     */\n    getData(options) {\n        return this.data.get(options);\n    }\n    /**\n     * Loads and initializes plugins specified in the configuration.\n     *\n     * @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.\n     */\n    initPlugins() {\n        const config = this.config;\n        const plugins = config.get('plugins');\n        const removePlugins = config.get('removePlugins') || [];\n        const extraPlugins = config.get('extraPlugins') || [];\n        const substitutePlugins = config.get('substitutePlugins') || [];\n        return this.plugins.init(plugins.concat(extraPlugins), removePlugins, substitutePlugins)\n            .then(plugins => {\n            checkPluginsAllowedByLicenseKey(this);\n            return plugins;\n        });\n        function checkPluginsAllowedByLicenseKey(editor) {\n            const licenseKey = editor.config.get('licenseKey');\n            if (licenseKey === 'GPL') {\n                return;\n            }\n            const decodedPayload = decodeLicenseKey(licenseKey);\n            if (!decodedPayload) {\n                return;\n            }\n            const disallowedPlugin = [...editor.plugins]\n                .map(([pluginConstructor]) => pluginConstructor)\n                .find(pluginConstructor => {\n                if (!pluginConstructor.pluginName) {\n                    return false;\n                }\n                if (!pluginConstructor.licenseFeatureCode) {\n                    return false;\n                }\n                return isFeatureBlockedByLicenseKey(decodedPayload, pluginConstructor.licenseFeatureCode);\n            });\n            if (disallowedPlugin) {\n                editor.enableReadOnlyMode(Symbol('invalidLicense'));\n                editor._showLicenseError('pluginNotAllowed', disallowedPlugin.pluginName);\n            }\n        }\n    }\n    /**\n     * Destroys the editor instance, releasing all resources used by it.\n     *\n     * **Note** The editor cannot be destroyed during the initialization phase so if it is called\n     * while the editor {@link #state is being initialized}, it will wait for the editor initialization before destroying it.\n     *\n     * @fires destroy\n     * @returns A promise that resolves once the editor instance is fully destroyed.\n     */\n    destroy() {\n        let readyPromise = Promise.resolve();\n        if (this.state == 'initializing') {\n            readyPromise = new Promise(resolve => this.once('ready', resolve));\n        }\n        return readyPromise\n            .then(() => {\n            this.fire('destroy');\n            this.stopListening();\n            this.commands.destroy();\n        })\n            .then(() => this.plugins.destroy())\n            .then(() => {\n            this.model.destroy();\n            this.data.destroy();\n            this.editing.destroy();\n            this.keystrokes.destroy();\n        })\n            // Remove the editor from the context.\n            // When the context was created by this editor, the context will be destroyed.\n            .then(() => this._context._removeEditor(this));\n    }\n    /**\n     * Executes the specified command with given parameters.\n     *\n     * Shorthand for:\n     *\n     * ```ts\n     * editor.commands.get( commandName ).execute( ... );\n     * ```\n     *\n     * @param commandName The name of the command to execute.\n     * @param commandParams Command parameters.\n     * @returns The value returned by the {@link module:core/commandcollection~CommandCollection#execute `commands.execute()`}.\n     */\n    execute(commandName, ...commandParams) {\n        try {\n            return this.commands.execute(commandName, ...commandParams);\n        }\n        catch (err) {\n            // @if CK_DEBUG // throw err;\n            /* istanbul ignore next -- @preserve */\n            CKEditorError.rethrowUnexpectedError(err, this);\n        }\n    }\n    /**\n     * Focuses the editor.\n     *\n     * **Note** To explicitly focus the editing area of the editor, use the\n     * {@link module:engine/view/view~EditingView#focus `editor.editing.view.focus()`} method of the editing view.\n     *\n     * Check out the {@glink framework/deep-dive/ui/focus-tracking#focus-in-the-editor-ui Focus in the editor UI} section\n     * of the {@glink framework/deep-dive/ui/focus-tracking Deep dive into focus tracking} guide to learn more.\n     */\n    focus() {\n        this.editing.view.focus();\n    }\n    /* istanbul ignore next -- @preserve */\n    /**\n     * Creates and initializes a new editor instance.\n     *\n     * This is an abstract method. Every editor type needs to implement its own initialization logic.\n     *\n     * See the `create()` methods of the existing editor types to learn how to use them:\n     *\n     * * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}\n     * * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}\n     * * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}\n     * * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}\n     */\n    static create(...args) {\n        throw new Error('This is an abstract method.');\n    }\n    /**\n     * The {@link module:core/context~Context} class.\n     *\n     * Exposed as static editor field for easier access in editor builds.\n     */\n    static Context = Context;\n    /**\n     * The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.\n     *\n     * Exposed as static editor field for easier access in editor builds.\n     */\n    static EditorWatchdog = EditorWatchdog;\n    /**\n     * The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.\n     *\n     * Exposed as static editor field for easier access in editor builds.\n     */\n    static ContextWatchdog = ContextWatchdog;\n    _showLicenseError(reason, name) {\n        setTimeout(() => {\n            if (reason == 'invalid') {\n                /**\n                 * The license key provided is invalid. Please ensure that it is copied correctly\n                 * from the [Customer Portal](http://portal.ckeditor.com). If the issue persists,\n                 * please [contact our customer support](https://ckeditor.com/contact/).\n                 *\n                 * @error invalid-license-key\n                 */\n                throw new CKEditorError('invalid-license-key');\n            }\n            if (reason == 'expired') {\n                /**\n                 * Your license key has expired.\n                 *\n                 * If you used our free trial, you either need to switch to\n                 * [open-source license](https://ckeditor.com/docs/ckeditor5/latest/getting-started/licensing/license-and-legal.html), or\n                 * in case of a commercial plan, change the trial key to production key or development key.\n                 * Switching from trial, you also need to align the editor configuration to the features available in your plan.\n                 *\n                 * If you already had one of our Cloud or Custom plans, please renew your license in the\n                 * [Customer Portal](https://portal.ckeditor.com).\n                 *\n                 * @error license-key-expired\n                 */\n                throw new CKEditorError('license-key-expired');\n            }\n            if (reason == 'domainLimit') {\n                /**\n                 * The provided license does not allow the editor to run on this domain.\n                 * Some license keys are restricted to local test environments only.\n                 * For more details, please refer to the\n                 * {@glink getting-started/licensing/license-key-and-activation#license-key-types license key type documentation}.\n                 *\n                 * @error license-key-domain-limit\n                 */\n                throw new CKEditorError('license-key-domain-limit');\n            }\n            if (reason == 'pluginNotAllowed') {\n                // It's safe to assume `name` exists because `pluginNotAllowed` must know a plugin name when checking the license.\n                const gluePluginName = name.replace(/(Editing|UI)$/, '');\n                const containsGluePlugin = this.plugins.has(gluePluginName);\n                /**\n                 * The plugin you are trying to use is not permitted under your current license.\n                 * Please check the available features on the\n                 * [Customer Portal](https://portal.ckeditor.com) or\n                 * [contact support](https://ckeditor.com/contact/) for more information.\n                 *\n                 * @error license-key-plugin-not-allowed\n                 * @param {String} pluginName The plugin you tried to load.\n                 */\n                throw new CKEditorError('license-key-plugin-not-allowed', null, {\n                    pluginName: containsGluePlugin ? gluePluginName : name\n                });\n            }\n            if (reason == 'featureNotAllowed') {\n                /**\n                 * The feature you are trying to use is not permitted under your current license.\n                 * Please check the available features on the\n                 * [Customer Portal](https://portal.ckeditor.com) or\n                 * [contact support](https://ckeditor.com/contact/) for more information.\n                 *\n                 * @error license-key-feature-not-allowed\n                 * @param {String} featureName The feature you tried to use.\n                 */\n                throw new CKEditorError('license-key-feature-not-allowed', null, { featureName: name });\n            }\n            if (reason == 'evaluationLimit') {\n                /**\n                 * You have exceeded the editor operation limit available for your evaluation license key.\n                 * Please restart the editor to continue using it.\n                 * {@glink getting-started/licensing/license-key-and-activation#license-key-types Read more about license key types}.\n                 *\n                 * @error license-key-evaluation-limit\n                 */\n                throw new CKEditorError('license-key-evaluation-limit');\n            }\n            if (reason == 'trialLimit') {\n                /**\n                 * You have exceeded the editor operation limit for your trial license key.\n                 * Please restart the editor to continue using it.\n                 * {@glink getting-started/licensing/license-key-and-activation#license-key-types Read more about license key types}.\n                 *\n                 * @error license-key-trial-limit\n                 */\n                throw new CKEditorError('license-key-trial-limit');\n            }\n            if (reason == 'developmentLimit') {\n                /**\n                 * You have exceeded the operation limit for your development license key within the editor.\n                 * Please restart the editor to continue using it.\n                 * {@glink getting-started/licensing/license-key-and-activation#license-key-types Read more about license key types}.\n                 *\n                 * @error license-key-development-limit\n                 */\n                throw new CKEditorError('license-key-development-limit');\n            }\n            if (reason == 'usageLimit') {\n                /**\n                 * You have reached the usage limit of your license key. This can occur in the following situations:\n                 *\n                 * * You are on a free subscription without a connected payment method and have exceeded the allowed usage threshold.\n                 * * Your account has overdue invoices and the grace period has ended.\n                 *\n                 * To extend the limit and restore access, please update the required details in the\n                 * [Customer Portal](https://portal.ckeditor.com) or\n                 * [contact our customer support](https://ckeditor.com/contact).\n                 *\n                 * @error license-key-usage-limit\n                 */\n                throw new CKEditorError('license-key-usage-limit');\n            }\n            if (reason == 'distributionChannel') {\n                /**\n                 * Your license does not allow the current distribution channel.\n                 *\n                 * These are the available distribution channels:\n                 * * Self-hosted - the editor is installed via npm or from a ZIP package\n                 * * Cloud - the editor is run from CDN\n                 *\n                 * The licenses available include:\n                 * * GPL license for open-source users.\n                 * * Commercial plans (Cloud or sales-assisted).\n                 *\n                 * The relation between distribution channels and licenses works as follows:\n                 * * With the 'GPL' license key, you may use the editor installed via npm or a ZIP package (self-hosted).\n                 * * With the CKEditor Cloud plans, you may use the editor via our CDN.\n                 * * With the CKEditor Custom plans, depending on your plan details, you can use the editor via npm\n                 *   or a ZIP package (self-hosted) or Cloud (CDN).\n                 *\n                 * {@glink getting-started/licensing/usage-based-billing#key-terms Read more about distributions in the documentation}.\n                 * Please verify your installation or [contact support](https://ckeditor.com/contact/) for assistance.\n                 * Should you need to migrate your installation from npm to CDN, please refer to our\n                 * [dedicated migration guides](https://ckeditor.com/docs/ckeditor5/latest/updating/migrations/vanilla-js.html).\n                 *\n                 * @error license-key-invalid-distribution-channel\n                 */\n                throw new CKEditorError('license-key-invalid-distribution-channel');\n            }\n            /* istanbul ignore next -- @preserve */\n            // eslint-disable-next-line @typescript-eslint/no-unused-vars\n            const unreachable = reason;\n        }, 0);\n        this._showLicenseError = () => { };\n    }\n    /**\n     * This part of the code is _not_ executed in installations under the GPL license (with `config.licenseKey = 'GPL'`).\n     *\n     * It is only executed when a specific license key is provided. If you are uncertain whether\n     * this applies to your installation, please contact our support team.\n     */\n    async _sendUsageRequest(endpoint, request) {\n        const headers = new Headers({ 'Content-Type': 'application/json' });\n        const response = await fetch(new URL(endpoint), {\n            method: 'POST',\n            headers,\n            body: JSON.stringify(request)\n        });\n        if (!response.ok) {\n            // TODO: refine message.\n            throw new Error(`HTTP Response: ${response.status}`);\n        }\n        return response.json();\n    }\n}\nfunction collectUsageData(editor) {\n    const collectedData = getEditorUsageData(editor);\n    function setUsageData(path, value) {\n        if (get(collectedData, path) !== undefined) {\n            /**\n             * The error thrown when trying to set the usage data path that was already set.\n             * Make sure that you are not setting the same path multiple times.\n             *\n             * @error editor-usage-data-path-already-set\n             * @param {string} path The path that was already set.\n             */\n            throw new CKEditorError('editor-usage-data-path-already-set', { path });\n        }\n        set(collectedData, path, value);\n    }\n    editor.fire('collectUsageData', {\n        setUsageData\n    });\n    return collectedData;\n}\n/**\n * This error is thrown when trying to pass a `<textarea>` element to a `create()` function of an editor class.\n *\n * The only editor type which can be initialized on `<textarea>` elements is\n * the {@glink getting-started/setup/editor-types#classic-editor classic editor}.\n * This editor hides the passed element and inserts its own UI next to it. Other types of editors reuse the passed element as their root\n * editable element and therefore `<textarea>` is not appropriate for them. Use a `<div>` or another text container instead:\n *\n * ```html\n * <div id=\"editor\">\n * \t<p>Initial content.</p>\n * </div>\n * ```\n *\n * @error editor-wrong-element\n */\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/crc32\n */\n/**\n * Generates a CRC lookup table.\n * This function creates and returns a 256-element array of pre-computed CRC values for quick CRC calculation.\n * It uses the polynomial 0xEDB88320 to compute each value in the loop, optimizing future CRC calculations.\n */\nfunction makeCrcTable() {\n    const crcTable = [];\n    for (let n = 0; n < 256; n++) {\n        let c = n;\n        for (let k = 0; k < 8; k++) {\n            if (c & 1) {\n                c = 0xEDB88320 ^ (c >>> 1);\n            }\n            else {\n                c = c >>> 1;\n            }\n        }\n        crcTable[n] = c;\n    }\n    return crcTable;\n}\n/**\n * Calculates CRC-32 checksum for a given inputData to verify the integrity of data.\n *\n * @param inputData Accepts a single value (string, number, boolean), an array of strings, or an array of all of the above types.\n * Non-string values are converted to strings before calculating the checksum.\n * The checksum calculation is based on the concatenated string representation of the input values:\n * * `crc32('foo')` is equivalent to `crc32(['foo'])`\n * * `crc32(123)` is equivalent to `crc32(['123'])`\n * * `crc32(true)` is equivalent to `crc32(['true'])`\n * * `crc32(['foo', 123, true])` produces the same result as `crc32('foo123true')`\n * * Nested arrays of strings are flattened, so `crc32([['foo', 'bar'], 'baz'])` is equivalent to `crc32(['foobar', 'baz'])`\n *\n * @returns The CRC-32 checksum, returned as a hexadecimal string.\n */\nexport function crc32(inputData) {\n    const dataArray = Array.isArray(inputData) ? inputData : [inputData];\n    const crcTable = makeCrcTable();\n    let crc = 0 ^ (-1);\n    // Convert data to a single string.\n    const dataString = dataArray.map(item => {\n        if (Array.isArray(item)) {\n            return item.join('');\n        }\n        return String(item);\n    }).join('');\n    // Calculate the CRC for the resulting string.\n    for (let i = 0; i < dataString.length; i++) {\n        const byte = dataString.charCodeAt(i);\n        crc = (crc >>> 8) ^ crcTable[(crc ^ byte) & 0xFF];\n    }\n    crc = (crc ^ (-1)) >>> 0; // Force unsigned integer.\n    return crc.toString(16).padStart(8, '0');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/isfeatureblockedbylicensekey\n */\n/**\n * Checks whether a feature (represented by an unique id) is blocked by the provided license key.\n *\n * @param licensePayload Decoded license key.\n * @param licenseFeatureCode An unique feature id to check.\n */\nexport function isFeatureBlockedByLicenseKey(licensePayload, licenseFeatureCode) {\n    const blockedFeatures = licensePayload.removeFeatures || [];\n    return blockedFeatures.includes(licenseFeatureCode);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/editor/utils/elementapimixin\n */\nimport { CKEditorError, setDataInElement } from '@ckeditor/ckeditor5-utils';\n/**\n * Implementation of the {@link module:core/editor/utils/elementapimixin~ElementApi}.\n */\nexport function ElementApiMixin(base) {\n    class Mixin extends base {\n        sourceElement;\n        updateSourceElement(data) {\n            if (!this.sourceElement) {\n                /**\n                 * Cannot update the source element of a detached editor.\n                 *\n                 * The {@link module:core/editor/utils/elementapimixin~ElementApi#updateSourceElement `updateSourceElement()`}\n                 * method cannot be called if you did not pass an element to `Editor.create()`.\n                 *\n                 * @error editor-missing-sourceelement\n                 */\n                throw new CKEditorError('editor-missing-sourceelement', this);\n            }\n            const shouldUpdateSourceElement = this.config.get('updateSourceElementOnDestroy');\n            const isSourceElementTextArea = this.sourceElement instanceof HTMLTextAreaElement;\n            // The data returned by the editor might be unsafe, so we want to prevent rendering\n            // unsafe content inside the source element different than <textarea>, which is considered\n            // secure. This behavior could be changed by setting the `updateSourceElementOnDestroy`\n            // configuration option to `true`.\n            if (!shouldUpdateSourceElement && !isSourceElementTextArea) {\n                setDataInElement(this.sourceElement, '');\n                return;\n            }\n            const dataToSet = typeof data === 'string' ? data : this.data.get();\n            setDataInElement(this.sourceElement, dataToSet);\n        }\n    }\n    return Mixin;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/pendingactions\n */\nimport { ContextPlugin } from './contextplugin.js';\nimport { CKEditorError, Collection, ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * The list of pending editor actions.\n *\n * This plugin should be used to synchronise plugins that execute long-lasting actions\n * (e.g. file upload) with the editor integration. It gives the developer who integrates the editor\n * an easy way to check if there are any actions pending whenever such information is needed.\n * All plugins that register a pending action also provide a message about the action that is ongoing\n * which can be displayed to the user. This lets them decide if they want to interrupt the action or wait.\n *\n * Adding and updating a pending action:\n *\n * ```ts\n * const pendingActions = editor.plugins.get( 'PendingActions' );\n * const action = pendingActions.add( 'Upload in progress: 0%.' );\n *\n * // You can update the message:\n * action.message = 'Upload in progress: 10%.';\n * ```\n *\n * Removing a pending action:\n *\n * ```ts\n * const pendingActions = editor.plugins.get( 'PendingActions' );\n * const action = pendingActions.add( 'Unsaved changes.' );\n *\n * pendingActions.remove( action );\n * ```\n *\n * Getting pending actions:\n *\n * ```ts\n * const pendingActions = editor.plugins.get( 'PendingActions' );\n *\n * const action1 = pendingActions.add( 'Action 1' );\n * const action2 = pendingActions.add( 'Action 2' );\n *\n * pendingActions.first; // Returns action1\n * Array.from( pendingActions ); // Returns [ action1, action2 ]\n * ```\n *\n * This plugin is used by features like {@link module:upload/filerepository~FileRepository} to register their ongoing actions\n * and by features like {@link module:autosave/autosave~Autosave} to detect whether there are any ongoing actions.\n * Read more about saving the data in the\n * {@glink getting-started/setup/getting-and-setting-data Saving and getting data} guide.\n */\nexport class PendingActions extends ContextPlugin {\n    /**\n     * A list of pending actions.\n     */\n    _actions;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'PendingActions';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this.set('hasAny', false);\n        this._actions = new Collection({ idProperty: '_id' });\n        this._actions.delegate('add', 'remove').to(this);\n    }\n    /**\n     * Adds an action to the list of pending actions.\n     *\n     * This method returns an action object with an observable message property.\n     * The action object can be later used in the {@link #remove} method. It also allows you to change the message.\n     *\n     * @param message The action message.\n     * @returns An observable object that represents a pending action.\n     */\n    add(message) {\n        if (typeof message !== 'string') {\n            /**\n             * The message must be a string.\n             *\n             * @error pendingactions-add-invalid-message\n             */\n            throw new CKEditorError('pendingactions-add-invalid-message', this);\n        }\n        const action = new (ObservableMixin())();\n        action.set('message', message);\n        this._actions.add(action);\n        this.hasAny = true;\n        return action;\n    }\n    /**\n     * Removes an action from the list of pending actions.\n     *\n     * @param action An action object.\n     */\n    remove(action) {\n        this._actions.remove(action);\n        this.hasAny = !!this._actions.length;\n    }\n    /**\n     * Returns the first action from the list or null if the list is empty\n     *\n     * @returns The pending action object.\n     */\n    get first() {\n        return this._actions.get(0);\n    }\n    /**\n     * Iterable interface.\n     */\n    [Symbol.iterator]() {\n        return this._actions[Symbol.iterator]();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module editor-classic/classiceditor\n */\nimport { ClassicEditorUI } from './classiceditorui.js';\nimport { ClassicEditorUIView } from './classiceditoruiview.js';\nimport { Editor, ElementApiMixin, attachToForm } from 'ckeditor5/src/core.js';\nimport { getDataFromElement, CKEditorError } from 'ckeditor5/src/utils.js';\nimport { isElement as _isElement } from 'es-toolkit/compat';\n/**\n * The classic editor implementation. It uses an inline editable and a sticky toolbar, all enclosed in a boxed UI.\n * See the {@glink examples/builds/classic-editor demo}.\n *\n * In order to create a classic editor instance, use the static\n * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method.\n */\nexport class ClassicEditor extends /* #__PURE__ */ ElementApiMixin(Editor) {\n    /**\n     * @inheritDoc\n     */\n    static get editorName() {\n        return 'ClassicEditor';\n    }\n    /**\n     * @inheritDoc\n     */\n    ui;\n    /**\n     * Creates an instance of the classic editor.\n     *\n     * **Note:** do not use the constructor to create editor instances. Use the static\n     * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`} method instead.\n     *\n     * @param sourceElementOrData The DOM element that will be the source for the created editor\n     * or the editor's initial data. For more information see\n     * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}.\n     * @param config The editor configuration.\n     */\n    constructor(sourceElementOrData, config = {}) {\n        // If both `config.initialData` is set and initial data is passed as the constructor parameter, then throw.\n        if (!isElement(sourceElementOrData) && config.initialData !== undefined) {\n            // Documented in core/editor/editorconfig.jsdoc.\n            // eslint-disable-next-line ckeditor5-rules/ckeditor-error-message\n            throw new CKEditorError('editor-create-initial-data', null);\n        }\n        super(config);\n        this.config.define('menuBar.isVisible', false);\n        if (this.config.get('initialData') === undefined) {\n            this.config.set('initialData', getInitialData(sourceElementOrData));\n        }\n        if (isElement(sourceElementOrData)) {\n            this.sourceElement = sourceElementOrData;\n        }\n        this.model.document.createRoot();\n        const shouldToolbarGroupWhenFull = !this.config.get('toolbar.shouldNotGroupWhenFull');\n        const menuBarConfig = this.config.get('menuBar');\n        const view = new ClassicEditorUIView(this.locale, this.editing.view, {\n            shouldToolbarGroupWhenFull,\n            useMenuBar: menuBarConfig.isVisible,\n            label: this.config.get('label')\n        });\n        this.ui = new ClassicEditorUI(this, view);\n        attachToForm(this);\n    }\n    /**\n     * Destroys the editor instance, releasing all resources used by it.\n     *\n     * Updates the original editor element with the data if the\n     * {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy `updateSourceElementOnDestroy`}\n     * configuration option is set to `true`.\n     */\n    destroy() {\n        if (this.sourceElement) {\n            this.updateSourceElement();\n        }\n        this.ui.destroy();\n        return super.destroy();\n    }\n    /**\n     * Creates a new classic editor instance.\n     *\n     * There are three ways how the editor can be initialized.\n     *\n     * # Replacing a DOM element (and loading data from it)\n     *\n     * You can initialize the editor using an existing DOM element:\n     *\n     * ```ts\n     * ClassicEditor\n     * \t.create( document.querySelector( '#editor' ) )\n     * \t.then( editor => {\n     * \t\tconsole.log( 'Editor was initialized', editor );\n     * \t} )\n     * \t.catch( err => {\n     * \t\tconsole.error( err.stack );\n     * \t} );\n     * ```\n     *\n     * The element's content will be used as the editor data and the element will be replaced by the editor UI.\n     *\n     * # Creating a detached editor\n     *\n     * Alternatively, you can initialize the editor by passing the initial data directly as a string.\n     * In this case, the editor will render an element that must be inserted into the DOM:\n     *\n     * ```ts\n     * ClassicEditor\n     * \t.create( '<p>Hello world!</p>' )\n     * \t.then( editor => {\n     * \t\tconsole.log( 'Editor was initialized', editor );\n     *\n     * \t\t// Initial data was provided so the editor UI element needs to be added manually to the DOM.\n     * \t\tdocument.body.appendChild( editor.ui.element );\n     * \t} )\n     * \t.catch( err => {\n     * \t\tconsole.error( err.stack );\n     * \t} );\n     * ```\n     *\n     * This lets you dynamically append the editor to your web page whenever it is convenient for you. You may use this method if your\n     * web page content is generated on the client side and the DOM structure is not ready at the moment when you initialize the editor.\n     *\n     * # Replacing a DOM element (and data provided in `config.initialData`)\n     *\n     * You can also mix these two ways by providing a DOM element to be used and passing the initial data through the configuration:\n     *\n     * ```ts\n     * ClassicEditor\n     * \t.create( document.querySelector( '#editor' ), {\n     * \t\tinitialData: '<h2>Initial data</h2><p>Foo bar.</p>'\n     * \t} )\n     * \t.then( editor => {\n     * \t\tconsole.log( 'Editor was initialized', editor );\n     * \t} )\n     * \t.catch( err => {\n     * \t\tconsole.error( err.stack );\n     * \t} );\n     * ```\n     *\n     * This method can be used to initialize the editor on an existing element with the specified content in case if your integration\n     * makes it difficult to set the content of the source element.\n     *\n     * Note that an error will be thrown if you pass the initial data both as the first parameter and also in the configuration.\n     *\n     * # Configuring the editor\n     *\n     * See the {@link module:core/editor/editorconfig~EditorConfig editor configuration documentation} to learn more about\n     * customizing plugins, toolbar and more.\n     *\n     * @param sourceElementOrData The DOM element that will be the source for the created editor\n     * or the editor's initial data.\n     *\n     * If a DOM element is passed, its content will be automatically loaded to the editor upon initialization\n     * and the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element editor element} will replace the passed element\n     * in the DOM (the original one will be hidden and the editor will be injected next to it).\n     *\n     * If the {@link module:core/editor/editorconfig~EditorConfig#updateSourceElementOnDestroy updateSourceElementOnDestroy}\n     * option is set to `true`, the editor data will be set back to the original element once the editor is destroyed and when a form,\n     * in which this element is contained, is submitted (if the original element is a `<textarea>`). This ensures seamless integration\n     * with native web forms.\n     *\n     * If the initial data is passed, a detached editor will be created. In this case you need to insert it into the DOM manually.\n     * It is available under the {@link module:editor-classic/classiceditorui~ClassicEditorUI#element `editor.ui.element`} property.\n     *\n     * @param config The editor configuration.\n     * @returns A promise resolved once the editor is ready. The promise resolves with the created editor instance.\n     */\n    static create(sourceElementOrData, config = {}) {\n        return new Promise(resolve => {\n            const editor = new this(sourceElementOrData, config);\n            resolve(editor.initPlugins()\n                .then(() => editor.ui.init(isElement(sourceElementOrData) ? sourceElementOrData : null))\n                .then(() => editor.data.init(editor.config.get('initialData')))\n                .then(() => editor.fire('ready'))\n                .then(() => editor));\n        });\n    }\n}\nfunction getInitialData(sourceElementOrData) {\n    return isElement(sourceElementOrData) ? getDataFromElement(sourceElementOrData) : sourceElementOrData;\n}\nfunction isElement(value) {\n    return _isElement(value);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module utils/dom/getdatafromelement\n */\n/**\n * Gets data from a given source element.\n *\n * @param el The element from which the data will be retrieved.\n * @returns The data string.\n */\nexport function getDataFromElement(el) {\n    if (el instanceof HTMLTextAreaElement) {\n        return el.value;\n    }\n    return el.innerHTML;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module core/editor/utils/attachtoform\n */\nimport { isFunction } from 'es-toolkit/compat';\nimport { CKEditorError } from '@ckeditor/ckeditor5-utils';\n/**\n * Checks if the editor is initialized on a `<textarea>` element that belongs to a form. If yes, it updates the editor's element\n * content before submitting the form.\n *\n * This helper requires the {@link module:core/editor/utils/elementapimixin~ElementApi ElementApi interface}.\n *\n * @param editor Editor instance.\n */\nexport function attachToForm(editor) {\n    if (!isFunction(editor.updateSourceElement)) {\n        /**\n         * The editor passed to `attachToForm()` must implement the\n         * {@link module:core/editor/utils/elementapimixin~ElementApi} interface.\n         *\n         * @error attachtoform-missing-elementapi-interface\n         */\n        throw new CKEditorError('attachtoform-missing-elementapi-interface', editor);\n    }\n    const sourceElement = editor.sourceElement;\n    // Only when replacing a textarea which is inside of a form element.\n    if (isTextArea(sourceElement) && sourceElement.form) {\n        let originalSubmit;\n        const form = sourceElement.form;\n        const onSubmit = () => editor.updateSourceElement();\n        // Replace the original form#submit() to call a custom submit function first.\n        // Check if #submit is a function because the form might have an input named \"submit\".\n        if (isFunction(form.submit)) {\n            originalSubmit = form.submit;\n            form.submit = () => {\n                onSubmit();\n                originalSubmit.apply(form);\n            };\n        }\n        // Update the replaced textarea with data before each form#submit event.\n        form.addEventListener('submit', onSubmit);\n        // Remove the submit listener and revert the original submit method on\n        // editor#destroy.\n        editor.on('destroy', () => {\n            form.removeEventListener('submit', onSubmit);\n            if (originalSubmit) {\n                form.submit = originalSubmit;\n            }\n        });\n    }\n}\nfunction isTextArea(sourceElement) {\n    return !!sourceElement && sourceElement.tagName.toLowerCase() === 'textarea';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/clipboardobserver\n */\nimport { EventInfo, getRangeFromMouseEvent } from '@ckeditor/ckeditor5-utils';\nimport { ViewDataTransfer, DomEventObserver } from '@ckeditor/ckeditor5-engine';\n/**\n * Clipboard events observer.\n *\n * Fires the following events:\n *\n * * {@link module:engine/view/document~ViewDocument#event:clipboardInput},\n * * {@link module:engine/view/document~ViewDocument#event:paste},\n * * {@link module:engine/view/document~ViewDocument#event:copy},\n * * {@link module:engine/view/document~ViewDocument#event:cut},\n * * {@link module:engine/view/document~ViewDocument#event:drop},\n * * {@link module:engine/view/document~ViewDocument#event:dragover},\n * * {@link module:engine/view/document~ViewDocument#event:dragging},\n * * {@link module:engine/view/document~ViewDocument#event:dragstart},\n * * {@link module:engine/view/document~ViewDocument#event:dragend},\n * * {@link module:engine/view/document~ViewDocument#event:dragenter},\n * * {@link module:engine/view/document~ViewDocument#event:dragleave}.\n *\n * **Note**: This observer is not available by default (ckeditor5-engine does not add it on its own).\n * To make it available, it needs to be added to {@link module:engine/view/document~ViewDocument} by using\n * the {@link module:engine/view/view~EditingView#addObserver `View#addObserver()`} method. Alternatively, you can load the\n * {@link module:clipboard/clipboard~Clipboard} plugin which adds this observer automatically (because it uses it).\n */\nexport class ClipboardObserver extends DomEventObserver {\n    domEventType = [\n        'paste', 'copy', 'cut', 'drop', 'dragover', 'dragstart', 'dragend', 'dragenter', 'dragleave'\n    ];\n    constructor(view) {\n        super(view);\n        const viewDocument = this.document;\n        this.listenTo(viewDocument, 'paste', handleInput('clipboardInput'), { priority: 'low' });\n        this.listenTo(viewDocument, 'drop', handleInput('clipboardInput'), { priority: 'low' });\n        this.listenTo(viewDocument, 'dragover', handleInput('dragging'), { priority: 'low' });\n        function handleInput(type) {\n            return (evt, data) => {\n                data.preventDefault();\n                const targetRanges = data.dropRange ? [data.dropRange] : null;\n                const eventInfo = new EventInfo(viewDocument, type);\n                viewDocument.fire(eventInfo, {\n                    dataTransfer: data.dataTransfer,\n                    method: evt.name,\n                    targetRanges,\n                    target: data.target,\n                    domEvent: data.domEvent\n                });\n                // If CKEditor handled the input, do not bubble the original event any further.\n                // This helps external integrations recognize that fact and act accordingly.\n                // https://github.com/ckeditor/ckeditor5-upload/issues/92\n                if (eventInfo.stop.called) {\n                    data.stopPropagation();\n                }\n            };\n        }\n    }\n    onDomEvent(domEvent) {\n        const nativeDataTransfer = 'clipboardData' in domEvent ? domEvent.clipboardData : domEvent.dataTransfer;\n        const cacheFiles = domEvent.type == 'drop' || domEvent.type == 'paste';\n        const evtData = {\n            dataTransfer: new ViewDataTransfer(nativeDataTransfer, { cacheFiles })\n        };\n        if (domEvent.type == 'drop' || domEvent.type == 'dragover') {\n            const domRange = getRangeFromMouseEvent(domEvent);\n            evtData.dropRange = domRange && this.view.domConverter.domRangeToView(domRange);\n        }\n        this.fire(domEvent.type, domEvent, evtData);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n// Elements which should not have empty-line padding.\n// Most `view.ContainerElement` want to be separate by new-line, but some are creating one structure\n// together (like `<li>`) so it is better to separate them by only one \"\\n\".\nconst smallPaddingElements = ['figcaption', 'li'];\nconst listElements = ['ol', 'ul'];\n/**\n * Converts {@link module:engine/view/item~ViewItem view item} and all of its children to plain text.\n *\n * @param converter The converter instance.\n * @param viewItem View item to convert.\n * @returns Plain text representation of `viewItem`.\n */\nexport function viewToPlainText(converter, viewItem) {\n    if (viewItem.is('$text') || viewItem.is('$textProxy')) {\n        return viewItem.data;\n    }\n    if (viewItem.is('element', 'img') && viewItem.hasAttribute('alt')) {\n        return viewItem.getAttribute('alt');\n    }\n    if (viewItem.is('element', 'br')) {\n        return '\\n'; // Convert soft breaks to single line break (#8045).\n    }\n    /**\n     * Item is a document fragment, attribute element or container element. It doesn't\n     * have it's own text value, so we need to convert its children elements.\n     */\n    let text = '';\n    let prev = null;\n    for (const child of viewItem.getChildren()) {\n        text += newLinePadding(child, prev) + viewToPlainText(converter, child);\n        prev = child;\n    }\n    // If item is a raw element, the only way to get its content is to render it and read the text directly from DOM.\n    if (viewItem.is('rawElement')) {\n        const doc = document.implementation.createHTMLDocument('');\n        const tempElement = doc.createElement('div');\n        viewItem.render(tempElement, converter);\n        text += domElementToPlainText(tempElement);\n    }\n    return text;\n}\n/**\n * Recursively converts DOM element and all of its children to plain text.\n */\nfunction domElementToPlainText(element) {\n    let text = '';\n    if (element.nodeType === Node.TEXT_NODE) {\n        return element.textContent;\n    }\n    else if (element.tagName === 'BR') {\n        return '\\n';\n    }\n    for (const child of element.childNodes) {\n        text += domElementToPlainText(child);\n    }\n    return text;\n}\n/**\n * Returns new line padding to prefix the given elements with.\n */\nfunction newLinePadding(element, previous) {\n    if (!previous) {\n        // Don't add padding to first elements in a level.\n        return '';\n    }\n    if (element.is('element', 'li') && !element.isEmpty && element.getChild(0).is('containerElement')) {\n        // Separate document list items with empty lines.\n        return '\\n\\n';\n    }\n    if (listElements.includes(element.name) && listElements.includes(previous.name)) {\n        /**\n         * Because `<ul>` and `<ol>` are ViewAttributeElements, two consecutive lists will not have any padding between\n         * them (see the `if` statement below). To fix this, we need to make an exception for this case.\n         */\n        return '\\n\\n';\n    }\n    if (!element.is('containerElement') && !previous.is('containerElement')) {\n        // Don't add padding between non-container elements.\n        return '';\n    }\n    if (smallPaddingElements.includes(element.name) || smallPaddingElements.includes(previous.name)) {\n        // Add small padding between selected container elements.\n        return '\\n';\n    }\n    // Do not add padding around the elements that won't be rendered.\n    if (element.is('element') && element.getCustomProperty('dataPipeline:transparentRendering') ||\n        previous.is('element') && previous.getCustomProperty('dataPipeline:transparentRendering')) {\n        return '';\n    }\n    // Add empty lines between container elements.\n    return '\\n\\n';\n}\n","function identity(x) {\n    return x;\n}\n\nexport { identity };\n","import { isMatch } from './isMatch.mjs';\nimport { isObject } from './isObject.mjs';\nimport { isPrimitive } from '../../predicate/isPrimitive.mjs';\nimport { eq } from '../util/eq.mjs';\n\nfunction isMatchWith(target, source, compare) {\n    if (typeof compare !== 'function') {\n        return isMatch(target, source);\n    }\n    return isMatchWithInternal(target, source, function doesMatch(objValue, srcValue, key, object, source, stack) {\n        const isEqual = compare(objValue, srcValue, key, object, source, stack);\n        if (isEqual !== undefined) {\n            return Boolean(isEqual);\n        }\n        return isMatchWithInternal(objValue, srcValue, doesMatch, stack);\n    }, new Map());\n}\nfunction isMatchWithInternal(target, source, compare, stack) {\n    if (source === target) {\n        return true;\n    }\n    switch (typeof source) {\n        case 'object': {\n            return isObjectMatch(target, source, compare, stack);\n        }\n        case 'function': {\n            const sourceKeys = Object.keys(source);\n            if (sourceKeys.length > 0) {\n                return isMatchWithInternal(target, { ...source }, compare, stack);\n            }\n            return eq(target, source);\n        }\n        default: {\n            if (!isObject(target)) {\n                return eq(target, source);\n            }\n            if (typeof source === 'string') {\n                return source === '';\n            }\n            return true;\n        }\n    }\n}\nfunction isObjectMatch(target, source, compare, stack) {\n    if (source == null) {\n        return true;\n    }\n    if (Array.isArray(source)) {\n        return isArrayMatch(target, source, compare, stack);\n    }\n    if (source instanceof Map) {\n        return isMapMatch(target, source, compare, stack);\n    }\n    if (source instanceof Set) {\n        return isSetMatch(target, source, compare, stack);\n    }\n    const keys = Object.keys(source);\n    if (target == null) {\n        return keys.length === 0;\n    }\n    if (keys.length === 0) {\n        return true;\n    }\n    if (stack && stack.has(source)) {\n        return stack.get(source) === target;\n    }\n    if (stack) {\n        stack.set(source, target);\n    }\n    try {\n        for (let i = 0; i < keys.length; i++) {\n            const key = keys[i];\n            if (!isPrimitive(target) && !(key in target)) {\n                return false;\n            }\n            if (source[key] === undefined && target[key] !== undefined) {\n                return false;\n            }\n            if (source[key] === null && target[key] !== null) {\n                return false;\n            }\n            const isEqual = compare(target[key], source[key], key, target, source, stack);\n            if (!isEqual) {\n                return false;\n            }\n        }\n        return true;\n    }\n    finally {\n        if (stack) {\n            stack.delete(source);\n        }\n    }\n}\nfunction isMapMatch(target, source, compare, stack) {\n    if (source.size === 0) {\n        return true;\n    }\n    if (!(target instanceof Map)) {\n        return false;\n    }\n    for (const [key, sourceValue] of source.entries()) {\n        const targetValue = target.get(key);\n        const isEqual = compare(targetValue, sourceValue, key, target, source, stack);\n        if (isEqual === false) {\n            return false;\n        }\n    }\n    return true;\n}\nfunction isArrayMatch(target, source, compare, stack) {\n    if (source.length === 0) {\n        return true;\n    }\n    if (!Array.isArray(target)) {\n        return false;\n    }\n    const countedIndex = new Set();\n    for (let i = 0; i < source.length; i++) {\n        const sourceItem = source[i];\n        let found = false;\n        for (let j = 0; j < target.length; j++) {\n            if (countedIndex.has(j)) {\n                continue;\n            }\n            const targetItem = target[j];\n            let matches = false;\n            const isEqual = compare(targetItem, sourceItem, i, target, source, stack);\n            if (isEqual) {\n                matches = true;\n            }\n            if (matches) {\n                countedIndex.add(j);\n                found = true;\n                break;\n            }\n        }\n        if (!found) {\n            return false;\n        }\n    }\n    return true;\n}\nfunction isSetMatch(target, source, compare, stack) {\n    if (source.size === 0) {\n        return true;\n    }\n    if (!(target instanceof Set)) {\n        return false;\n    }\n    return isArrayMatch([...target], [...source], compare, stack);\n}\n\nexport { isMatchWith, isSetMatch };\n","import { isMatchWith } from './isMatchWith.mjs';\n\nfunction isMatch(target, source) {\n    return isMatchWith(target, source, () => undefined);\n}\n\nexport { isMatch };\n","import { identity } from '../../function/identity.mjs';\nimport { property } from '../object/property.mjs';\nimport { matches } from '../predicate/matches.mjs';\nimport { matchesProperty } from '../predicate/matchesProperty.mjs';\n\nfunction iteratee(value) {\n    if (value == null) {\n        return identity;\n    }\n    switch (typeof value) {\n        case 'function': {\n            return value;\n        }\n        case 'object': {\n            if (Array.isArray(value) && value.length === 2) {\n                return matchesProperty(value[0], value[1]);\n            }\n            return matches(value);\n        }\n        case 'string':\n        case 'symbol':\n        case 'number': {\n            return property(value);\n        }\n    }\n}\n\nexport { iteratee };\n","import { isMatch } from './isMatch.mjs';\nimport { toKey } from '../_internal/toKey.mjs';\nimport { cloneDeep } from '../object/cloneDeep.mjs';\nimport { get } from '../object/get.mjs';\nimport { has } from '../object/has.mjs';\n\nfunction matchesProperty(property, source) {\n    switch (typeof property) {\n        case 'object': {\n            if (Object.is(property?.valueOf(), -0)) {\n                property = '-0';\n            }\n            break;\n        }\n        case 'number': {\n            property = toKey(property);\n            break;\n        }\n    }\n    source = cloneDeep(source);\n    return function (target) {\n        const result = get(target, property);\n        if (result === undefined) {\n            return has(target, property);\n        }\n        if (source === undefined) {\n            return result === undefined;\n        }\n        return isMatch(result, source);\n    };\n}\n\nexport { matchesProperty };\n","import { isDeepKey } from '../_internal/isDeepKey.mjs';\nimport { isIndex } from '../_internal/isIndex.mjs';\nimport { isArguments } from '../predicate/isArguments.mjs';\nimport { toPath } from '../util/toPath.mjs';\n\nfunction has(object, path) {\n    let resolvedPath;\n    if (Array.isArray(path)) {\n        resolvedPath = path;\n    }\n    else if (typeof path === 'string' && isDeepKey(path) && object?.[path] == null) {\n        resolvedPath = toPath(path);\n    }\n    else {\n        resolvedPath = [path];\n    }\n    if (resolvedPath.length === 0) {\n        return false;\n    }\n    let current = object;\n    for (let i = 0; i < resolvedPath.length; i++) {\n        const key = resolvedPath[i];\n        if (current == null || !Object.hasOwn(current, key)) {\n            const isSparseIndex = (Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length;\n            if (!isSparseIndex) {\n                return false;\n            }\n        }\n        current = current[key];\n    }\n    return true;\n}\n\nexport { has };\n","import { isMatch } from './isMatch.mjs';\nimport { cloneDeep } from '../../object/cloneDeep.mjs';\n\nfunction matches(source) {\n    source = cloneDeep(source);\n    return (target) => {\n        return isMatch(target, source);\n    };\n}\n\nexport { matches };\n","import { cloneDeepWithImpl } from './cloneDeepWith.mjs';\n\nfunction cloneDeep(obj) {\n    return cloneDeepWithImpl(obj, undefined, obj, new Map(), undefined);\n}\n\nexport { cloneDeep };\n","import { get } from './get.mjs';\n\nfunction property(path) {\n    return function (object) {\n        return get(object, path);\n    };\n}\n\nexport { property };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/clipboardmarkersutils\n */\nimport { mapValues } from 'es-toolkit/compat';\nimport { uid } from '@ckeditor/ckeditor5-utils';\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { ModelRange } from '@ckeditor/ckeditor5-engine';\n/**\n * Part of the clipboard logic. Responsible for collecting markers from selected fragments\n * and restoring them with proper positions in pasted elements.\n *\n * @internal\n */\nexport class ClipboardMarkersUtils extends Plugin {\n    /**\n     * Map of marker names that can be copied.\n     *\n     * @internal\n     */\n    _markersToCopy = new Map();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ClipboardMarkersUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Registers marker name as copyable in clipboard pipeline.\n     *\n     * @param markerName Name of marker that can be copied.\n     * @param config Configuration that describes what can be performed on specified marker.\n     * @internal\n     */\n    _registerMarkerToCopy(markerName, config) {\n        this._markersToCopy.set(markerName, config);\n    }\n    /**\n     * Performs copy markers on provided selection and paste it to fragment returned from `getCopiedFragment`.\n     *\n     * \t1. Picks all markers in provided selection.\n     * \t2. Inserts fake markers to document.\n     * \t3. Gets copied selection fragment from document.\n     * \t4. Removes fake elements from fragment and document.\n     * \t5. Inserts markers in the place of removed fake markers.\n     *\n     * Due to selection modification, when inserting items, `getCopiedFragment` must *always* operate on `writer.model.document.selection'.\n     * Do not use any other custom selection object within callback, as this will lead to out-of-bounds exceptions in rare scenarios.\n     *\n     * @param action Type of clipboard action.\n     * @param selection Selection to be checked.\n     * @param getCopiedFragment\tCallback that performs copy of selection and returns it as fragment.\n     * @internal\n     */\n    _copySelectedFragmentWithMarkers(action, selection, getCopiedFragment = writer => writer.model.getSelectedContent(writer.model.document.selection)) {\n        return this.editor.model.change(writer => {\n            const oldSelection = writer.model.document.selection;\n            // In some scenarios, such like in drag & drop, passed `selection` parameter is not actually\n            // the same `selection` as the `writer.model.document.selection` which means that `_insertFakeMarkersToSelection`\n            // is not affecting passed `selection` `start` and `end` positions but rather modifies `writer.model.document.selection`.\n            //\n            // It is critical due to fact that when we have selection that starts [ 0, 0 ] and ends at [ 1, 0 ]\n            // and after inserting fake marker it will point to such marker instead of new widget position at start: [ 1, 0 ] end: [2, 0 ].\n            // `writer.insert` modifies only original `writer.model.document.selection`.\n            writer.setSelection(selection);\n            const sourceSelectionInsertedMarkers = this._insertFakeMarkersIntoSelection(writer, writer.model.document.selection, action);\n            const fragment = getCopiedFragment(writer);\n            const fakeMarkersRangesInsideRange = this._removeFakeMarkersInsideElement(writer, fragment);\n            // <fake-marker> [Foo] Bar</fake-marker>\n            //      ^                    ^\n            // In `_insertFakeMarkersIntoSelection` call we inserted fake marker just before first element.\n            // The problem is that the first element can be start position of selection so insertion fake-marker\n            // before such element shifts selection (so selection that was at [0, 0] now is at [0, 1]).\n            // It means that inserted fake-marker is no longer present inside such selection and is orphaned.\n            // This function checks special case of such problem. Markers that are orphaned at the start position\n            // and end position in the same time. Basically it means that they overlaps whole element.\n            for (const [markerName, elements] of Object.entries(sourceSelectionInsertedMarkers)) {\n                fakeMarkersRangesInsideRange[markerName] ||= writer.createRangeIn(fragment);\n                for (const element of elements) {\n                    writer.remove(element);\n                }\n            }\n            fragment.markers.clear();\n            for (const [markerName, range] of Object.entries(fakeMarkersRangesInsideRange)) {\n                fragment.markers.set(markerName, range);\n            }\n            // Revert back selection to previous one.\n            writer.setSelection(oldSelection);\n            return fragment;\n        });\n    }\n    /**\n     * Performs paste of markers on already pasted element.\n     *\n     * \t1. Inserts fake markers that are present in fragment element (such fragment will be processed in `getPastedDocumentElement`).\n     * \t2. Calls `getPastedDocumentElement` and gets element that is inserted into root model.\n     * \t3. Removes all fake markers present in transformed element.\n     * \t4. Inserts new markers with removed fake markers ranges into pasted fragment.\n     *\n     * There are multiple edge cases that have to be considered before calling this function:\n     *\n     * \t* `markers` are inserted into the same element that must be later transformed inside `getPastedDocumentElement`.\n     * \t* Fake marker elements inside `getPastedDocumentElement` can be cloned, but their ranges cannot overlap.\n     * \t* If `duplicateOnPaste` is `true` in marker config then associated marker ID is regenerated before pasting.\n     *\n     * @param markers Object that maps marker name to corresponding range.\n     * @param getPastedDocumentElement Getter used to get target markers element.\n     * @internal\n     */\n    _pasteMarkersIntoTransformedElement(markers, getPastedDocumentElement) {\n        const pasteMarkers = this._getPasteMarkersFromRangeMap(markers);\n        return this.editor.model.change(writer => {\n            // Inserts fake markers into source fragment / element that is later transformed inside `getPastedDocumentElement`.\n            const sourceFragmentFakeMarkers = this._insertFakeMarkersElements(writer, pasteMarkers);\n            // Modifies document fragment (for example, cloning table cells) and then inserts it into the document.\n            const transformedElement = getPastedDocumentElement(writer);\n            // Removes markers in pasted and transformed fragment in root document.\n            const removedFakeMarkers = this._removeFakeMarkersInsideElement(writer, transformedElement);\n            // Cleans up fake markers inserted into source fragment (that one before transformation which is not pasted).\n            for (const element of Object.values(sourceFragmentFakeMarkers).flat()) {\n                writer.remove(element);\n            }\n            // Inserts to root document fake markers.\n            for (const [markerName, range] of Object.entries(removedFakeMarkers)) {\n                if (!writer.model.markers.has(markerName)) {\n                    writer.addMarker(markerName, {\n                        usingOperation: true,\n                        affectsData: true,\n                        range\n                    });\n                }\n            }\n            return transformedElement;\n        });\n    }\n    /**\n     * Pastes document fragment with markers to document.\n     * If `duplicateOnPaste` is `true` in marker config then associated markers IDs\n     * are regenerated before pasting to avoid markers duplications in content.\n     *\n     * @param fragment Document fragment that should contain already processed by pipeline markers.\n     * @internal\n     */\n    _pasteFragmentWithMarkers(fragment) {\n        const pasteMarkers = this._getPasteMarkersFromRangeMap(fragment.markers);\n        fragment.markers.clear();\n        for (const copyableMarker of pasteMarkers) {\n            fragment.markers.set(copyableMarker.name, copyableMarker.range);\n        }\n        return this.editor.model.insertContent(fragment);\n    }\n    /**\n     * In some situations we have to perform copy on selected fragment with certain markers. This function allows to temporarily bypass\n     * restrictions on markers that we want to copy.\n     *\n     * This function executes `executor()` callback. For the duration of the callback, if the clipboard pipeline is used to copy\n     * content, markers with the specified name will be copied to the clipboard as well.\n     *\n     * @param markerName Which markers should be copied.\n     * @param executor Callback executed.\n     * @param config Optional configuration flags used to copy (such like partial copy flag).\n     * @internal\n     */\n    _forceMarkersCopy(markerName, executor, config = {\n        allowedActions: 'all',\n        copyPartiallySelected: true,\n        duplicateOnPaste: true\n    }) {\n        const before = this._markersToCopy.get(markerName);\n        this._markersToCopy.set(markerName, config);\n        executor();\n        if (before) {\n            this._markersToCopy.set(markerName, before);\n        }\n        else {\n            this._markersToCopy.delete(markerName);\n        }\n    }\n    /**\n     * Checks if marker can be copied.\n     *\n     * @param markerName Name of checked marker.\n     * @param action Type of clipboard action. If null then checks only if marker is registered as copyable.\n     * @internal\n     */\n    _isMarkerCopyable(markerName, action) {\n        const config = this._getMarkerClipboardConfig(markerName);\n        if (!config) {\n            return false;\n        }\n        // If there is no action provided then only presence of marker is checked.\n        if (!action) {\n            return true;\n        }\n        const { allowedActions } = config;\n        return allowedActions === 'all' || allowedActions.includes(action);\n    }\n    /**\n     * Checks if marker has any clipboard copy behavior configuration.\n     *\n     * @param markerName Name of checked marker.\n     */\n    _hasMarkerConfiguration(markerName) {\n        return !!this._getMarkerClipboardConfig(markerName);\n    }\n    /**\n     * Returns marker's configuration flags passed during registration.\n     *\n     * @param markerName Name of marker that should be returned.\n     * @internal\n     */\n    _getMarkerClipboardConfig(markerName) {\n        const [markerNamePrefix] = markerName.split(':');\n        return this._markersToCopy.get(markerNamePrefix) || null;\n    }\n    /**\n     * First step of copying markers. It looks for markers intersecting with given selection and inserts `$marker` elements\n     * at positions where document markers start or end. This way `$marker` elements can be easily copied together with\n     * the rest of the content of the selection.\n     *\n     * @param writer An instance of the model writer.\n     * @param selection Selection to be checked.\n     * @param action Type of clipboard action.\n     */\n    _insertFakeMarkersIntoSelection(writer, selection, action) {\n        const copyableMarkers = this._getCopyableMarkersFromSelection(writer, selection, action);\n        return this._insertFakeMarkersElements(writer, copyableMarkers);\n    }\n    /**\n     * Returns array of markers that can be copied in specified selection.\n     *\n     * If marker cannot be copied partially (according to `copyPartiallySelected` configuration flag) and\n     * is not present entirely in any selection range then it will be skipped.\n     *\n     * @param writer An instance of the model writer.\n     * @param selection  Selection which will be checked.\n     * @param action Type of clipboard action. If null then checks only if marker is registered as copyable.\n     */\n    _getCopyableMarkersFromSelection(writer, selection, action) {\n        const selectionRanges = Array.from(selection.getRanges());\n        // Picks all markers in provided ranges. Ensures that there are no duplications if\n        // there are multiple ranges that intersects with the same marker.\n        const markersInRanges = new Set(selectionRanges.flatMap(selectionRange => Array.from(writer.model.markers.getMarkersIntersectingRange(selectionRange))));\n        const isSelectionMarkerCopyable = (marker) => {\n            // Check if marker exists in configuration and provided action can be performed on it.\n            const isCopyable = this._isMarkerCopyable(marker.name, action);\n            if (!isCopyable) {\n                return false;\n            }\n            // Checks if configuration disallows to copy marker only if part of its content is selected.\n            //\n            // Example:\n            // \t<marker-a> Hello [ World ] </marker-a>\n            //\t\t\t\t\t\t^ selection\n            //\n            // In this scenario `marker-a` won't be copied because selection doesn't overlap its content entirely.\n            const { copyPartiallySelected } = this._getMarkerClipboardConfig(marker.name);\n            if (!copyPartiallySelected) {\n                const markerRange = marker.getRange();\n                return selectionRanges.some(selectionRange => selectionRange.containsRange(markerRange, true));\n            }\n            return true;\n        };\n        return Array\n            .from(markersInRanges)\n            .filter(isSelectionMarkerCopyable)\n            .map((copyableMarker) => {\n            // During `dragstart` event original marker is still present in tree.\n            // It is removed after the clipboard drop event, so none of the copied markers are inserted at the end.\n            // It happens because there already markers with specified `marker.name` when clipboard is trying to insert data\n            // and it aborts inserting.\n            const name = action === 'dragstart' ? this._getUniqueMarkerName(copyableMarker.name) : copyableMarker.name;\n            return {\n                name,\n                range: copyableMarker.getRange()\n            };\n        });\n    }\n    /**\n     * Picks all markers from markers map that can be pasted.\n     * If `duplicateOnPaste` is `true`, it regenerates their IDs to ensure uniqueness.\n     * If marker is not registered, it will be kept in the array anyway.\n     *\n     * @param markers Object that maps marker name to corresponding range.\n     * @param action Type of clipboard action. If null then checks only if marker is registered as copyable.\n     */\n    _getPasteMarkersFromRangeMap(markers, action = null) {\n        const { model } = this.editor;\n        const entries = markers instanceof Map ? Array.from(markers.entries()) : Object.entries(markers);\n        return entries.flatMap(([markerName, range]) => {\n            if (!this._hasMarkerConfiguration(markerName)) {\n                return [\n                    {\n                        name: markerName,\n                        range\n                    }\n                ];\n            }\n            if (this._isMarkerCopyable(markerName, action)) {\n                const copyMarkerConfig = this._getMarkerClipboardConfig(markerName);\n                const isInGraveyard = model.markers.has(markerName) &&\n                    model.markers.get(markerName).getRange().root.rootName === '$graveyard';\n                if (copyMarkerConfig.duplicateOnPaste || isInGraveyard) {\n                    markerName = this._getUniqueMarkerName(markerName);\n                }\n                return [\n                    {\n                        name: markerName,\n                        range\n                    }\n                ];\n            }\n            return [];\n        });\n    }\n    /**\n     * Inserts specified array of fake markers elements to document and assigns them `type` and `name` attributes.\n     * Fake markers elements are used to calculate position of markers on pasted fragment that were transformed during\n     * steps between copy and paste.\n     *\n     * @param writer An instance of the model writer.\n     * @param markers Array of markers that will be inserted.\n     */\n    _insertFakeMarkersElements(writer, markers) {\n        const mappedMarkers = {};\n        const sortedMarkers = markers\n            .flatMap(marker => {\n            const { start, end } = marker.range;\n            return [\n                { position: start, marker, type: 'start' },\n                { position: end, marker, type: 'end' }\n            ];\n        })\n            // Markers position is sorted backwards to ensure that the insertion of fake markers will not change\n            // the position of the next markers.\n            .sort(({ position: posA }, { position: posB }) => posA.isBefore(posB) ? 1 : -1);\n        for (const { position, marker, type } of sortedMarkers) {\n            const fakeMarker = writer.createElement('$marker', {\n                'data-name': marker.name,\n                'data-type': type\n            });\n            if (!mappedMarkers[marker.name]) {\n                mappedMarkers[marker.name] = [];\n            }\n            mappedMarkers[marker.name].push(fakeMarker);\n            writer.insert(fakeMarker, position);\n        }\n        return mappedMarkers;\n    }\n    /**\n     * Removes all `$marker` elements from the given document fragment.\n     *\n     * Returns an object where keys are marker names, and values are ranges corresponding to positions\n     * where `$marker` elements were inserted.\n     *\n     * If the document fragment had only one `$marker` element for given marker (start or end) the other boundary is set automatically\n     * (to the end or start of the document fragment, respectively).\n     *\n     * @param writer An instance of the model writer.\n     * @param rootElement The element to be checked.\n     */\n    _removeFakeMarkersInsideElement(writer, rootElement) {\n        const fakeMarkersElements = this._getAllFakeMarkersFromElement(writer, rootElement);\n        const fakeMarkersRanges = fakeMarkersElements.reduce((acc, fakeMarker) => {\n            const position = fakeMarker.markerElement && writer.createPositionBefore(fakeMarker.markerElement);\n            let prevFakeMarker = acc[fakeMarker.name];\n            // Handle scenario when tables clone cells with the same fake node. Example:\n            //\n            // <cell><fake-marker-a></cell> <cell><fake-marker-a></cell> <cell><fake-marker-a></cell>\n            //                                          ^ cloned                    ^ cloned\n            //\n            // The easiest way to bypass this issue is to rename already existing in map nodes and\n            // set them new unique name.\n            let skipAssign = false;\n            if (prevFakeMarker?.start && prevFakeMarker?.end) {\n                const config = this._getMarkerClipboardConfig(fakeMarker.name);\n                if (config.duplicateOnPaste) {\n                    acc[this._getUniqueMarkerName(fakeMarker.name)] = acc[fakeMarker.name];\n                }\n                else {\n                    skipAssign = true;\n                }\n                prevFakeMarker = null;\n            }\n            if (!skipAssign) {\n                acc[fakeMarker.name] = {\n                    ...prevFakeMarker,\n                    [fakeMarker.type]: position\n                };\n            }\n            if (fakeMarker.markerElement) {\n                writer.remove(fakeMarker.markerElement);\n            }\n            return acc;\n        }, {});\n        // We cannot construct ranges directly in previous reduce because element ranges can overlap.\n        // In other words lets assume we have such scenario:\n        // <fake-marker-start /> <paragraph /> <fake-marker-2-start /> <fake-marker-end /> <fake-marker-2-end />\n        //\n        // We have to remove `fake-marker-start` firstly and then remove `fake-marker-2-start`.\n        // Removal of `fake-marker-2-start` affects `fake-marker-end` position so we cannot create\n        // connection between `fake-marker-start` and `fake-marker-end` without iterating whole set firstly.\n        return mapValues(fakeMarkersRanges, range => new ModelRange(range.start || writer.createPositionFromPath(rootElement, [0]), range.end || writer.createPositionAt(rootElement, 'end')));\n    }\n    /**\n     * Returns array that contains list of fake markers with corresponding `$marker` elements.\n     *\n     * For each marker, there can be two `$marker` elements or only one (if the document fragment contained\n     * only the beginning or only the end of a marker).\n     *\n     * @param writer An instance of the model writer.\n     * @param rootElement The element to be checked.\n     */\n    _getAllFakeMarkersFromElement(writer, rootElement) {\n        const foundFakeMarkers = Array\n            .from(writer.createRangeIn(rootElement))\n            .flatMap(({ item }) => {\n            if (!item.is('element', '$marker')) {\n                return [];\n            }\n            const name = item.getAttribute('data-name');\n            const type = item.getAttribute('data-type');\n            return [\n                {\n                    markerElement: item,\n                    name,\n                    type\n                }\n            ];\n        });\n        const prependFakeMarkers = [];\n        const appendFakeMarkers = [];\n        for (const fakeMarker of foundFakeMarkers) {\n            if (fakeMarker.type === 'end') {\n                // <fake-marker> [ phrase</fake-marker> phrase ]\n                //   ^\n                // Handle case when marker is just before start of selection.\n                // Only end marker is inside selection.\n                const hasMatchingStartMarker = foundFakeMarkers.some(otherFakeMarker => otherFakeMarker.name === fakeMarker.name && otherFakeMarker.type === 'start');\n                if (!hasMatchingStartMarker) {\n                    prependFakeMarkers.push({\n                        markerElement: null,\n                        name: fakeMarker.name,\n                        type: 'start'\n                    });\n                }\n            }\n            if (fakeMarker.type === 'start') {\n                // [<fake-marker>phrase]</fake-marker>\n                //                           ^\n                // Handle case when fake marker is after selection.\n                // Only start marker is inside selection.\n                const hasMatchingEndMarker = foundFakeMarkers.some(otherFakeMarker => otherFakeMarker.name === fakeMarker.name && otherFakeMarker.type === 'end');\n                if (!hasMatchingEndMarker) {\n                    appendFakeMarkers.unshift({\n                        markerElement: null,\n                        name: fakeMarker.name,\n                        type: 'end'\n                    });\n                }\n            }\n        }\n        return [\n            ...prependFakeMarkers,\n            ...foundFakeMarkers,\n            ...appendFakeMarkers\n        ];\n    }\n    /**\n     * When copy of markers occurs we have to make sure that pasted markers have different names\n     * than source markers. This functions helps with assigning unique part to marker name to\n     * prevent duplicated markers error.\n     *\n     * @param name Name of marker\n     */\n    _getUniqueMarkerName(name) {\n        const parts = name.split(':');\n        const newId = uid().substring(1, 6);\n        // It looks like the marker already is UID marker so in this scenario just swap\n        // last part of marker name and assign new UID.\n        //\n        // example: comment:{ threadId }:{ id } => comment:{ threadId }:{ newId }\n        if (parts.length === 3) {\n            return `${parts.slice(0, 2).join(':')}:${newId}`;\n        }\n        // Assign new segment to marker name with id.\n        //\n        // example: comment => comment:{ newId }\n        return `${parts.join(':')}:${newId}`;\n    }\n}\n","import { identity } from '../../function/identity.mjs';\nimport { mapValues as mapValues$1 } from '../../object/mapValues.mjs';\nimport { iteratee } from '../util/iteratee.mjs';\n\nfunction mapValues(object, getNewValue = identity) {\n    if (object == null) {\n        return {};\n    }\n    return mapValues$1(object, iteratee(getNewValue));\n}\n\nexport { mapValues };\n","function mapValues(object, getNewValue) {\n    const result = {};\n    const keys = Object.keys(object);\n    for (let i = 0; i < keys.length; i++) {\n        const key = keys[i];\n        const value = object[key];\n        result[key] = getNewValue(value, key, object);\n    }\n    return result;\n}\n\nexport { mapValues };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/clipboardpipeline\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { EventInfo } from '@ckeditor/ckeditor5-utils';\nimport { ClipboardObserver } from './clipboardobserver.js';\nimport { plainTextToHtml } from './utils/plaintexttohtml.js';\nimport { normalizeClipboardData } from './utils/normalizeclipboarddata.js';\nimport { viewToPlainText } from './utils/viewtoplaintext.js';\nimport { ClipboardMarkersUtils } from './clipboardmarkersutils.js';\n// Input pipeline events overview:\n//\n//              ┌──────────────────────┐          ┌──────────────────────┐\n//              │     view.Document    │          │     view.Document    │\n//              │         paste        │          │         drop         │\n//              └───────────┬──────────┘          └───────────┬──────────┘\n//                          │                                 │\n//                          └────────────────┌────────────────┘\n//                                           │\n//                                 ┌─────────V────────┐\n//                                 │   view.Document  │   Retrieves text/html or text/plain from data.dataTransfer\n//                                 │  clipboardInput  │   and processes it to view.DocumentFragment.\n//                                 └─────────┬────────┘\n//                                           │\n//                               ┌───────────V───────────┐\n//                               │   ClipboardPipeline   │   Converts view.DocumentFragment to model.DocumentFragment.\n//                               │  inputTransformation  │\n//                               └───────────┬───────────┘\n//                                           │\n//                                ┌──────────V──────────┐\n//                                │  ClipboardPipeline  │   Calls model.insertContent().\n//                                │   contentInsertion  │\n//                                └─────────────────────┘\n//\n//\n// Output pipeline events overview:\n//\n//              ┌──────────────────────┐          ┌──────────────────────┐\n//              │     view.Document    │          │     view.Document    │   Retrieves the selected model.DocumentFragment\n//              │         copy         │          │          cut         │   and fires the `outputTransformation` event.\n//              └───────────┬──────────┘          └───────────┬──────────┘\n//                          │                                 │\n//                          └────────────────┌────────────────┘\n//                                           │\n//                               ┌───────────V───────────┐\n//                               │   ClipboardPipeline   │   Processes model.DocumentFragment and converts it to\n//                               │  outputTransformation │   view.DocumentFragment.\n//                               └───────────┬───────────┘\n//                                           │\n//                                 ┌─────────V────────┐\n//                                 │   view.Document  │   Processes view.DocumentFragment to text/html and text/plain\n//                                 │  clipboardOutput │   and stores the results in data.dataTransfer.\n//                                 └──────────────────┘\n//\n/**\n * The clipboard pipeline feature. It is responsible for intercepting the `paste` and `drop` events and\n * passing the pasted content through a series of events in order to insert it into the editor's content.\n * It also handles the `cut` and `copy` events to fill the native clipboard with the serialized editor's data.\n *\n * # Input pipeline\n *\n * The behavior of the default handlers (all at a `low` priority):\n *\n * ## Event: `paste` or `drop`\n *\n * 1. Translates the event data.\n * 2. Fires the {@link module:engine/view/document~ViewDocument#event:clipboardInput `view.Document#clipboardInput`} event.\n *\n * ## Event: `view.Document#clipboardInput`\n *\n * 1. If the `data.content` event field is already set (by some listener on a higher priority), it takes this content and fires the event\n *    from the last point.\n * 2. Otherwise, it retrieves `text/html` or `text/plain` from `data.dataTransfer`.\n * 3. Normalizes the raw data by applying simple filters on string data.\n * 4. Processes the raw data to {@link module:engine/view/documentfragment~ViewDocumentFragment `view.DocumentFragment`} with the\n *    {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.\n * 5. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation\n *   `ClipboardPipeline#inputTransformation`} event with the view document fragment in the `data.content` event field.\n *\n * ## Event: `ClipboardPipeline#inputTransformation`\n *\n * 1. Converts {@link module:engine/view/documentfragment~ViewDocumentFragment `view.DocumentFragment`} from the `data.content` field to\n *    {@link module:engine/model/documentfragment~ModelDocumentFragment `model.DocumentFragment`}.\n * 2. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:contentInsertion `ClipboardPipeline#contentInsertion`}\n *    event with the model document fragment in the `data.content` event field.\n *    **Note**: The `ClipboardPipeline#contentInsertion` event is fired within a model change block to allow other handlers\n *    to run in the same block without post-fixers called in between (i.e., the selection post-fixer).\n *\n * ## Event: `ClipboardPipeline#contentInsertion`\n *\n * 1. Calls {@link module:engine/model/model~Model#insertContent `model.insertContent()`} to insert `data.content`\n *    at the current selection position.\n *\n * # Output pipeline\n *\n * The behavior of the default handlers (all at a `low` priority):\n *\n * ## Event: `copy`, `cut` or `dragstart`\n *\n * 1. Retrieves the selected {@link module:engine/model/documentfragment~ModelDocumentFragment `model.DocumentFragment`} by calling\n *    {@link module:engine/model/model~Model#getSelectedContent `model#getSelectedContent()`}.\n * 2. Converts the model document fragment to {@link module:engine/view/documentfragment~ViewDocumentFragment `view.DocumentFragment`}.\n * 3. Fires the {@link module:engine/view/document~ViewDocument#event:clipboardOutput `view.Document#clipboardOutput`} event\n *    with the view document fragment in the `data.content` event field.\n *\n * ## Event: `view.Document#clipboardOutput`\n *\n * 1. Processes `data.content` to HTML and plain text with the\n *    {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.\n * 2. Updates the `data.dataTransfer` data for `text/html` and `text/plain` with the processed data.\n * 3. For the `cut` method, calls {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}\n *    on the current selection.\n *\n * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.\n */\nexport class ClipboardPipeline extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ClipboardPipeline';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ClipboardMarkersUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        view.addObserver(ClipboardObserver);\n        this._setupPasteDrop();\n        this._setupCopyCut();\n    }\n    /**\n     * Fires Clipboard `'outputTransformation'` event for given parameters.\n     *\n     * @internal\n     */\n    _fireOutputTransformationEvent(dataTransfer, selection, method) {\n        const clipboardMarkersUtils = this.editor.plugins.get('ClipboardMarkersUtils');\n        this.editor.model.enqueueChange({ isUndoable: method === 'cut' }, () => {\n            const documentFragment = clipboardMarkersUtils._copySelectedFragmentWithMarkers(method, selection);\n            this.fire('outputTransformation', {\n                dataTransfer,\n                content: documentFragment,\n                method\n            });\n        });\n    }\n    /**\n     * The clipboard paste pipeline.\n     */\n    _setupPasteDrop() {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const clipboardMarkersUtils = this.editor.plugins.get('ClipboardMarkersUtils');\n        // Pasting is disabled when selection is in non-editable place.\n        // Dropping is disabled in drag and drop handler.\n        this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {\n            if (data.method == 'paste' && !editor.model.canEditAt(editor.model.document.selection)) {\n                evt.stop();\n            }\n        }, { priority: 'highest' });\n        this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {\n            const dataTransfer = data.dataTransfer;\n            let content;\n            // Some feature could already inject content in the higher priority event handler (i.e., codeBlock).\n            if (data.content) {\n                content = data.content;\n            }\n            else {\n                let contentData = '';\n                if (dataTransfer.getData('text/html')) {\n                    contentData = normalizeClipboardData(dataTransfer.getData('text/html'));\n                }\n                else if (dataTransfer.getData('text/plain')) {\n                    contentData = plainTextToHtml(dataTransfer.getData('text/plain'));\n                }\n                content = this.editor.data.htmlProcessor.toView(contentData);\n            }\n            const eventInfo = new EventInfo(this, 'inputTransformation');\n            const sourceEditorId = dataTransfer.getData('application/ckeditor5-editor-id') || null;\n            this.fire(eventInfo, {\n                content,\n                dataTransfer,\n                sourceEditorId,\n                targetRanges: data.targetRanges,\n                method: data.method\n            });\n            // If CKEditor handled the input, do not bubble the original event any further.\n            // This helps external integrations recognize this fact and act accordingly.\n            // https://github.com/ckeditor/ckeditor5-upload/issues/92\n            if (eventInfo.stop.called) {\n                evt.stop();\n            }\n            view.scrollToTheSelection();\n        }, { priority: 'low' });\n        this.listenTo(this, 'inputTransformation', (evt, data) => {\n            if (data.content.isEmpty) {\n                return;\n            }\n            const dataController = this.editor.data;\n            // Convert the pasted content into a model document fragment.\n            // The conversion is contextual, but in this case an \"all allowed\" context is needed\n            // and for that we use the $clipboardHolder item.\n            const modelFragment = dataController.toModel(data.content, '$clipboardHolder');\n            if (modelFragment.childCount == 0) {\n                return;\n            }\n            evt.stop();\n            // Fire content insertion event in a single change block to allow other handlers to run in the same block\n            // without post-fixers called in between (i.e., the selection post-fixer).\n            model.change(() => {\n                this.fire('contentInsertion', {\n                    content: modelFragment,\n                    method: data.method,\n                    sourceEditorId: data.sourceEditorId,\n                    dataTransfer: data.dataTransfer,\n                    targetRanges: data.targetRanges\n                });\n            });\n        }, { priority: 'low' });\n        this.listenTo(this, 'contentInsertion', (evt, data) => {\n            data.resultRange = clipboardMarkersUtils._pasteFragmentWithMarkers(data.content);\n        }, { priority: 'low' });\n    }\n    /**\n     * The clipboard copy/cut pipeline.\n     */\n    _setupCopyCut() {\n        const editor = this.editor;\n        const modelDocument = editor.model.document;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const onCopyCut = (evt, data) => {\n            const dataTransfer = data.dataTransfer;\n            data.preventDefault();\n            this._fireOutputTransformationEvent(dataTransfer, modelDocument.selection, evt.name);\n        };\n        this.listenTo(viewDocument, 'copy', onCopyCut, { priority: 'low' });\n        this.listenTo(viewDocument, 'cut', (evt, data) => {\n            // Cutting is disabled when selection is in non-editable place.\n            // See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26.\n            if (!editor.model.canEditAt(editor.model.document.selection)) {\n                data.preventDefault();\n            }\n            else {\n                onCopyCut(evt, data);\n            }\n        }, { priority: 'low' });\n        this.listenTo(this, 'outputTransformation', (evt, data) => {\n            const content = editor.data.toView(data.content, { isClipboardPipeline: true });\n            viewDocument.fire('clipboardOutput', {\n                dataTransfer: data.dataTransfer,\n                content,\n                method: data.method\n            });\n        }, { priority: 'low' });\n        this.listenTo(viewDocument, 'clipboardOutput', (evt, data) => {\n            if (!data.content.isEmpty) {\n                data.dataTransfer.setData('text/html', this.editor.data.htmlProcessor.toData(data.content));\n                data.dataTransfer.setData('text/plain', viewToPlainText(editor.data.htmlProcessor.domConverter, data.content));\n                data.dataTransfer.setData('application/ckeditor5-editor-id', this.editor.id);\n            }\n            if (data.method == 'cut') {\n                editor.model.deleteContent(modelDocument.selection);\n            }\n        }, { priority: 'low' });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/utils/normalizeclipboarddata\n */\n/**\n * Removes some popular browser quirks out of the clipboard data (HTML).\n * Removes all HTML comments. These are considered an internal thing and it makes little sense if they leak into the editor data.\n *\n * @param data The HTML data to normalize.\n * @returns Normalized HTML.\n * @internal\n */\nexport function normalizeClipboardData(data) {\n    return data\n        .replace(/<span(?: class=\"Apple-converted-space\"|)>(\\s+)<\\/span>/g, (fullMatch, spaces) => {\n        // Handle the most popular and problematic case when even a single space becomes an nbsp;.\n        // Decode those to normal spaces. Read more in https://github.com/ckeditor/ckeditor5-clipboard/issues/2.\n        if (spaces.length == 1) {\n            return ' ';\n        }\n        return spaces;\n    })\n        // Remove all HTML comments.\n        .replace(/<!--[\\s\\S]*?-->/g, '');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/utils/plaintexttohtml\n */\n/**\n * Converts plain text to its HTML-ized version.\n *\n * @param text The plain text to convert.\n * @returns HTML generated from the plain text.\n */\nexport function plainTextToHtml(text) {\n    text = text\n        // Encode &.\n        .replace(/&/g, '&amp;')\n        // Encode <>.\n        .replace(/</g, '&lt;')\n        .replace(/>/g, '&gt;')\n        // Creates a paragraph for each double line break.\n        .replace(/\\r?\\n\\r?\\n/g, '</p><p>')\n        // Creates a line break for each single line break.\n        .replace(/\\r?\\n/g, '<br>')\n        // Replace tabs with four spaces.\n        .replace(/\\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;')\n        // Preserve trailing spaces (only the first and last one – the rest is handled below).\n        .replace(/^\\s/, '&nbsp;')\n        .replace(/\\s$/, '&nbsp;')\n        // Preserve other subsequent spaces now.\n        .replace(/\\s\\s/g, ' &nbsp;');\n    if (text.includes('</p><p>') || text.includes('<br>')) {\n        // If we created paragraphs above, add the trailing ones.\n        text = `<p>${text}</p>`;\n    }\n    // TODO:\n    // * What about '\\nfoo' vs ' foo'?\n    return text;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Change buffer allows to group atomic changes (like characters that have been typed) into\n * {@link module:engine/model/batch~Batch batches}.\n *\n * Batches represent single undo steps, hence changes added to one single batch are undone together.\n *\n * The buffer has a configurable limit of atomic changes that it can accommodate. After the limit was\n * exceeded (see {@link ~TypingChangeBuffer#input}), a new batch is created in {@link ~TypingChangeBuffer#batch}.\n *\n * To use the change buffer you need to let it know about the number of changes that were added to the batch:\n *\n * ```ts\n * const buffer = new ChangeBuffer( model, LIMIT );\n *\n * // Later on in your feature:\n * buffer.batch.insert( pos, insertedCharacters );\n * buffer.input( insertedCharacters.length );\n * ```\n */\nexport class TypingChangeBuffer {\n    /**\n     * The model instance.\n     */\n    model;\n    /**\n     * The maximum number of atomic changes which can be contained in one batch.\n     */\n    limit;\n    /**\n     * Whether the buffer is locked. A locked buffer cannot be reset unless it gets unlocked.\n     */\n    _isLocked;\n    /**\n     * The number of atomic changes in the buffer. Once it exceeds the {@link #limit},\n     * the {@link #batch batch} is set to a new one.\n     */\n    _size;\n    /**\n     * The current batch instance.\n     */\n    _batch = null;\n    /**\n     * The callback to document the change event which later needs to be removed.\n     */\n    _changeCallback;\n    /**\n     * The callback to document selection `change:attribute` and `change:range` events which resets the buffer.\n     */\n    _selectionChangeCallback;\n    /**\n     * Creates a new instance of the change buffer.\n     *\n     * @param limit The maximum number of atomic changes which can be contained in one batch.\n     */\n    constructor(model, limit = 20) {\n        this.model = model;\n        this._size = 0;\n        this.limit = limit;\n        this._isLocked = false;\n        // The function to be called in order to notify the buffer about batches which appeared in the document.\n        // The callback will check whether it is a new batch and in that case the buffer will be flushed.\n        //\n        // The reason why the buffer needs to be flushed whenever a new batch appears is that the changes added afterwards\n        // should be added to a new batch. For instance, when the user types, then inserts an image, and then types again,\n        // the characters typed after inserting the image should be added to a different batch than the characters typed before.\n        this._changeCallback = (evt, batch) => {\n            if (batch.isLocal && batch.isUndoable && batch !== this._batch) {\n                this._reset(true);\n            }\n        };\n        this._selectionChangeCallback = () => {\n            this._reset();\n        };\n        this.model.document.on('change', this._changeCallback);\n        this.model.document.selection.on('change:range', this._selectionChangeCallback);\n        this.model.document.selection.on('change:attribute', this._selectionChangeCallback);\n    }\n    /**\n     * The current batch to which a feature should add its operations. Once the {@link #size}\n     * is reached or exceeds the {@link #limit}, the batch is set to a new instance and the size is reset.\n     */\n    get batch() {\n        if (!this._batch) {\n            this._batch = this.model.createBatch({ isTyping: true });\n        }\n        return this._batch;\n    }\n    /**\n     * The number of atomic changes in the buffer. Once it exceeds the {@link #limit},\n     * the {@link #batch batch} is set to a new one.\n     */\n    get size() {\n        return this._size;\n    }\n    /**\n     * The input number of changes into the buffer. Once the {@link #size} is\n     * reached or exceeds the {@link #limit}, the batch is set to a new instance and the size is reset.\n     *\n     * @param changeCount The number of atomic changes to input.\n     */\n    input(changeCount) {\n        this._size += changeCount;\n        if (this._size >= this.limit) {\n            this._reset(true);\n        }\n    }\n    /**\n     * Whether the buffer is locked. A locked buffer cannot be reset unless it gets unlocked.\n     */\n    get isLocked() {\n        return this._isLocked;\n    }\n    /**\n     * Locks the buffer.\n     */\n    lock() {\n        this._isLocked = true;\n    }\n    /**\n     * Unlocks the buffer.\n     */\n    unlock() {\n        this._isLocked = false;\n    }\n    /**\n     * Destroys the buffer.\n     */\n    destroy() {\n        this.model.document.off('change', this._changeCallback);\n        this.model.document.selection.off('change:range', this._selectionChangeCallback);\n        this.model.document.selection.off('change:attribute', this._selectionChangeCallback);\n    }\n    /**\n     * Resets the change buffer.\n     *\n     * @param ignoreLock Whether internal lock {@link #isLocked} should be ignored.\n     */\n    _reset(ignoreLock = false) {\n        if (!this.isLocked || ignoreLock) {\n            this._batch = null;\n            this._size = 0;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/inserttextcommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\nimport { TypingChangeBuffer } from './utils/changebuffer.js';\n/**\n * The insert text command. Used by the {@link module:typing/input~Input input feature} to handle typing.\n */\nexport class InsertTextCommand extends Command {\n    /**\n     * Typing's change buffer used to group subsequent changes into batches.\n     */\n    _buffer;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param undoStepSize The maximum number of atomic changes\n     * which can be contained in one batch in the command buffer.\n     */\n    constructor(editor, undoStepSize) {\n        super(editor);\n        this._buffer = new TypingChangeBuffer(editor.model, undoStepSize);\n        // Since this command may execute on different selectable than selection, it should be checked directly in execute block.\n        this._isEnabledBasedOnSelection = false;\n    }\n    /**\n     * The current change buffer.\n     */\n    get buffer() {\n        return this._buffer;\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._buffer.destroy();\n    }\n    /**\n     * Executes the input command. It replaces the content within the given range with the given text.\n     * Replacing is a two step process, first the content within the range is removed and then the new text is inserted\n     * at the beginning of the range (which after the removal is a collapsed range).\n     *\n     * @fires execute\n     * @param options The command options.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const doc = model.document;\n        const text = options.text || '';\n        const textInsertions = text.length;\n        let selection = doc.selection;\n        if (options.selection) {\n            selection = options.selection;\n        }\n        else if (options.range) {\n            selection = model.createSelection(options.range);\n        }\n        // Stop executing if selectable is in non-editable place.\n        if (!model.canEditAt(selection)) {\n            return;\n        }\n        const resultRange = options.resultRange;\n        model.enqueueChange(this._buffer.batch, writer => {\n            this._buffer.lock();\n            // Store selection attributes before deleting old content to preserve formatting and link.\n            // This unifies the behavior between ModelDocumentSelection and Selection provided as input option.\n            const selectionAttributes = Array.from(doc.selection.getAttributes());\n            model.deleteContent(selection);\n            if (text) {\n                model.insertContent(writer.createText(text, selectionAttributes), selection);\n            }\n            if (resultRange) {\n                writer.setSelection(resultRange);\n            }\n            else if (!selection.is('documentSelection')) {\n                writer.setSelection(selection);\n            }\n            this._buffer.unlock();\n            this._buffer.input(textInsertions);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/inserttextobserver\n */\nimport { env, EventInfo } from '@ckeditor/ckeditor5-utils';\nimport { ViewDocumentDomEventData, Observer, FocusObserver } from '@ckeditor/ckeditor5-engine';\n// @if CK_DEBUG_TYPING // const { _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );\nconst TYPING_INPUT_TYPES = [\n    // For collapsed range:\n    //\t- This one is a regular typing (all browsers, all systems).\n    //\t- This one is used by Chrome when typing accented letter – 2nd step when the user selects the accent (Mac).\n    // For non-collapsed range:\n    //\t- This one is used by Chrome when typing accented letter – when the selection box first appears (Mac).\n    //\t- This one is used by Safari when accepting spell check suggestions from the context menu (Mac).\n    'insertText',\n    // This one is used by Safari when typing accented letter (Mac).\n    // This one is used by Safari when accepting spell check suggestions from the autocorrection pop-up (Mac).\n    'insertReplacementText'\n];\nconst TYPING_INPUT_TYPES_ANDROID = [\n    ...TYPING_INPUT_TYPES,\n    'insertCompositionText'\n];\n/**\n * Text insertion observer introduces the {@link module:engine/view/document~ViewDocument#event:insertText} event.\n */\nexport class InsertTextObserver extends Observer {\n    /**\n     * Instance of the focus observer. Insert text observer calls\n     * {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.\n     */\n    focusObserver;\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        this.focusObserver = view.getObserver(FocusObserver);\n        // On Android composition events should immediately be applied to the model. Rendering is not disabled.\n        // On non-Android the model is updated only on composition end.\n        // On Android we can't rely on composition start/end to update model.\n        const typingInputTypes = env.isAndroid ? TYPING_INPUT_TYPES_ANDROID : TYPING_INPUT_TYPES;\n        const viewDocument = view.document;\n        viewDocument.on('beforeinput', (evt, data) => {\n            if (!this.isEnabled) {\n                return;\n            }\n            const { data: text, targetRanges, inputType, domEvent, isComposing } = data;\n            if (!typingInputTypes.includes(inputType)) {\n                return;\n            }\n            // Mark the latest focus change as complete (we are typing in editable after the focus\n            // so the selection is in the focused element).\n            this.focusObserver.flush();\n            const eventInfo = new EventInfo(viewDocument, 'insertText');\n            viewDocument.fire(eventInfo, new ViewDocumentDomEventData(view, domEvent, {\n                text,\n                selection: view.createSelection(targetRanges),\n                isComposing\n            }));\n            // Stop the beforeinput event if `delete` event was stopped.\n            // https://github.com/ckeditor/ckeditor5/issues/753\n            if (eventInfo.stop.called) {\n                evt.stop();\n            }\n        });\n        // On Android composition events are immediately applied to the model.\n        // On non-Android the model is updated only on composition end.\n        // On Android we can't rely on composition start/end to update model.\n        if (!env.isAndroid) {\n            // Note: The priority must be lower than the CompositionObserver handler to call it after the renderer is unblocked.\n            // This is important for view to DOM position mapping.\n            // This causes the effect of first remove composed DOM and then reapply it after model modification.\n            viewDocument.on('compositionend', (evt, { data, domEvent }) => {\n                if (!this.isEnabled) {\n                    return;\n                }\n                // In case of aborted composition.\n                if (!data) {\n                    return;\n                }\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'InsertTextObserver',\n                // @if CK_DEBUG_TYPING // \t\t`%cFire insertText event, %c${ JSON.stringify( data ) }`,\n                // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n                // @if CK_DEBUG_TYPING // \t\t 'color: blue'\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                // How do we know where to insert the composed text?\n                // 1. The SelectionObserver is blocked and the view is not updated with the composition changes.\n                // 2. The last moment before it's locked is the `compositionstart` event.\n                // 3. The `SelectionObserver` is listening for `compositionstart` event and immediately converts\n                //    the selection. Handle this at the low priority so after the rendering is blocked.\n                viewDocument.fire('insertText', new ViewDocumentDomEventData(view, domEvent, {\n                    text: data,\n                    isComposing: true\n                }));\n            }, { priority: 'low' });\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    observe() { }\n    /**\n     * @inheritDoc\n     */\n    stopObserving() { }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/input\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { env } from '@ckeditor/ckeditor5-utils';\nimport { InsertTextCommand } from './inserttextcommand.js';\nimport { InsertTextObserver } from './inserttextobserver.js';\nimport { ModelLiveRange, _tryFixingModelRange } from '@ckeditor/ckeditor5-engine';\nimport { debounce } from 'es-toolkit/compat';\n// @if CK_DEBUG_TYPING // const { _debouncedLine, _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );\n/**\n * Handles text input coming from the keyboard or other input methods.\n */\nexport class Input extends Plugin {\n    /**\n     * The queue of `insertText` command executions that are waiting for the DOM to get updated after beforeinput event.\n     */\n    _typingQueue;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Input';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        const mapper = editor.editing.mapper;\n        const modelSelection = model.document.selection;\n        this._typingQueue = new TypingQueue(editor);\n        view.addObserver(InsertTextObserver);\n        // TODO The above default configuration value should be defined using editor.config.define() once it's fixed.\n        const insertTextCommand = new InsertTextCommand(editor, editor.config.get('typing.undoStep') || 20);\n        // Register `insertText` command and add `input` command as an alias for backward compatibility.\n        editor.commands.add('insertText', insertTextCommand);\n        editor.commands.add('input', insertTextCommand);\n        this.listenTo(view.document, 'beforeinput', () => {\n            // Flush queue on the next beforeinput event because it could happen\n            // that the mutation observer does not notice the DOM change in time.\n            this._typingQueue.flush('next beforeinput');\n        }, { priority: 'high' });\n        this.listenTo(view.document, 'insertText', (evt, data) => {\n            const { text, selection: viewSelection } = data;\n            // In case of a synthetic event, make sure that selection is not fake.\n            if (view.document.selection.isFake && viewSelection && view.document.selection.isSimilar(viewSelection)) {\n                data.preventDefault();\n            }\n            // In case of typing on a non-collapsed range, we have to handle it ourselves as a browser\n            // could modify the DOM unpredictably.\n            // Noticed cases:\n            // * <pre><code>[foo</code></pre><p>]bar</p>\n            // * <p>[foo</p><pre>]<code>bar</code></pre>\n            // * <p>[foo</p><blockquote><p>]bar</p></blockquote>\n            //\n            // Especially tricky case is when a code block follows a paragraph as code block on the view side\n            // is rendered as a <code> element inside a <pre> element, but only the <code> element is mapped to the model.\n            // While mapping view position <pre>]<code> to model, the model position results before the <codeBlock> element,\n            // and this triggers selection fixer to cover only text in the previous paragraph.\n            //\n            // This is safe for composition as those events are not cancellable\n            // and the preventDefault() and defaultPrevented are not affected.\n            if (viewSelection && Array.from(viewSelection.getRanges()).some(range => !range.isCollapsed)) {\n                data.preventDefault();\n            }\n            if (!insertTextCommand.isEnabled) {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n                // @if CK_DEBUG_TYPING // \t\t'%cInsertText command is disabled - prevent DOM change.',\n                // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                data.preventDefault();\n                return;\n            }\n            let modelRanges;\n            // If view selection was specified, translate it to model selection.\n            if (viewSelection) {\n                modelRanges = Array.from(viewSelection.getRanges())\n                    .map(viewRange => mapper.toModelRange(viewRange))\n                    .map(modelRange => _tryFixingModelRange(modelRange, model.schema) || modelRange);\n            }\n            else {\n                modelRanges = Array.from(modelSelection.getRanges());\n            }\n            let insertText = text;\n            // Typing in English on Android is firing composition events for the whole typed word.\n            // We need to check the target range text to only apply the difference.\n            if (env.isAndroid) {\n                const selectedText = Array.from(modelRanges[0].getItems()).reduce((rangeText, node) => {\n                    return rangeText + (node.is('$textProxy') ? node.data : '');\n                }, '');\n                if (selectedText) {\n                    if (selectedText.length <= insertText.length) {\n                        if (insertText.startsWith(selectedText)) {\n                            insertText = insertText.substring(selectedText.length);\n                            modelRanges[0].start = modelRanges[0].start.getShiftedBy(selectedText.length);\n                        }\n                    }\n                    else {\n                        if (selectedText.startsWith(insertText)) {\n                            // TODO this should be mapped as delete?\n                            modelRanges[0].start = modelRanges[0].start.getShiftedBy(insertText.length);\n                            insertText = '';\n                        }\n                    }\n                }\n                if (insertText.length == 0 && modelRanges[0].isCollapsed) {\n                    // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                    // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n                    // @if CK_DEBUG_TYPING // \t\t'%cIgnore insertion of an empty data to the collapsed range.',\n                    // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n                    // @if CK_DEBUG_TYPING // \t) );\n                    // @if CK_DEBUG_TYPING // }\n                    return;\n                }\n            }\n            // Note: the TypingQueue stores live-ranges internally as RTC could change the model while waiting for mutations.\n            const commandData = {\n                text: insertText,\n                selection: model.createSelection(modelRanges)\n            };\n            // This is a beforeinput event, so we need to wait until the browser updates the DOM,\n            // and we could apply changes to the model and verify if the DOM is valid.\n            // The browser applies changes to the DOM not immediately on beforeinput event.\n            // We just wait for mutation observer to notice changes or as a fallback a timeout.\n            //\n            // Previously we were cancelling the non-composition events, but it caused issues especially in Safari.\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n            // @if CK_DEBUG_TYPING // \t\t`%cQueue insertText:%c \"${ commandData.text }\"%c ` +\n            // @if CK_DEBUG_TYPING // \t\t`[${ commandData.selection.getFirstPosition().path }]-` +\n            // @if CK_DEBUG_TYPING // \t\t`[${ commandData.selection.getLastPosition().path }]` +\n            // @if CK_DEBUG_TYPING // \t\t` queue size: ${ this._typingQueue.length + 1 }`,\n            // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n            // @if CK_DEBUG_TYPING // \t\t'color: blue',\n            // @if CK_DEBUG_TYPING // \t\t''\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            this._typingQueue.push(commandData, Boolean(data.isComposing));\n            if (data.domEvent.defaultPrevented) {\n                this._typingQueue.flush('beforeinput default prevented');\n            }\n        });\n        // Delete selected content on composition start.\n        if (env.isAndroid) {\n            // On Android with English keyboard, the composition starts just by putting caret\n            // at the word end or by selecting a table column. This is not a real composition started.\n            // Trigger delete content on first composition key pressed.\n            this.listenTo(view.document, 'keydown', (evt, data) => {\n                if (modelSelection.isCollapsed || data.keyCode != 229 || !view.document.isComposing) {\n                    return;\n                }\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconst firstPositionPath = modelSelection.getFirstPosition()!.path;\n                // @if CK_DEBUG_TYPING // \tconst lastPositionPath = modelSelection.getLastPosition()!.path;\n                // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n                // @if CK_DEBUG_TYPING // \t\t'%cKeyDown 229%c -> model.deleteContent() ' +\n                // @if CK_DEBUG_TYPING // \t\t`[${ firstPositionPath }]-[${ lastPositionPath }]`,\n                // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n                // @if CK_DEBUG_TYPING // \t\t''\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                deleteSelectionContent(model, insertTextCommand);\n            });\n        }\n        else {\n            // Note: The priority must precede the CompositionObserver handler to call it before\n            // the renderer is blocked, because we want to render this change.\n            this.listenTo(view.document, 'compositionstart', () => {\n                if (modelSelection.isCollapsed) {\n                    return;\n                }\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconst firstPositionPath = modelSelection.getFirstPosition()!.path;\n                // @if CK_DEBUG_TYPING // \tconst lastPositionPath = modelSelection.getLastPosition()!.path;\n                // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n                // @if CK_DEBUG_TYPING // \t\t'%cComposition start%c -> model.deleteContent() ' +\n                // @if CK_DEBUG_TYPING // \t\t`[${ firstPositionPath }]-[${ lastPositionPath }]`,\n                // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n                // @if CK_DEBUG_TYPING // \t\t'',\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                deleteSelectionContent(model, insertTextCommand);\n            }, { priority: 'high' });\n        }\n        // Apply changes to the model as they are applied to the DOM by the browser.\n        // On beforeinput event, the DOM is not yet modified. We wait for detected mutations to apply model changes.\n        this.listenTo(view.document, 'mutations', (evt, { mutations }) => {\n            // Check if mutations are relevant for queued changes.\n            if (this._typingQueue.hasAffectedElements()) {\n                for (const { node } of mutations) {\n                    const viewElement = findMappedViewAncestor(node, mapper);\n                    const modelElement = mapper.toModelElement(viewElement);\n                    if (this._typingQueue.isElementAffected(modelElement)) {\n                        this._typingQueue.flush('mutations');\n                        return;\n                    }\n                }\n            }\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n            // @if CK_DEBUG_TYPING // \t\t'%cMutations not related to the composition.',\n            // @if CK_DEBUG_TYPING // \t\t'font-style: italic'\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n        });\n        // Make sure that all changes are applied to the model before the end of composition.\n        this.listenTo(view.document, 'compositionend', () => {\n            this._typingQueue.flush('before composition end');\n        }, { priority: 'high' });\n        // Trigger mutations check after the composition completes to fix all DOM changes that got ignored during composition.\n        // On Android, the Renderer is not disabled while composing. While updating DOM nodes, we ignore some changes\n        // that are not that important (like NBSP vs. plain space character) and could break the composition flow.\n        // After composition is completed, we trigger additional `mutations` event for elements affected by the composition\n        // so the Renderer can adjust the DOM to the expected structure without breaking the composition.\n        this.listenTo(view.document, 'compositionend', () => {\n            // There could be new item queued on the composition end, so flush it.\n            this._typingQueue.flush('after composition end');\n            const mutations = [];\n            if (this._typingQueue.hasAffectedElements()) {\n                for (const element of this._typingQueue.flushAffectedElements()) {\n                    const viewElement = mapper.toViewElement(element);\n                    if (!viewElement) {\n                        continue;\n                    }\n                    mutations.push({ type: 'children', node: viewElement });\n                }\n            }\n            // Fire composition mutations, if any.\n            //\n            // For non-Android:\n            // After the composition end, we need to verify if there are no left-overs.\n            // Listening at the lowest priority, so after the `InsertTextObserver` added above (all composed text\n            // should already be applied to the model, view, and DOM).\n            // On non-Android the `Renderer` is blocked while the user is composing, but the `MutationObserver` still collects\n            // mutated nodes and fires `mutations` events.\n            // Those events are recorded by the `Renderer` but not applied to the DOM while composing.\n            // We need to trigger those checks (and fixes) once again but this time without specifying the exact mutations\n            // since they are already recorded by the `Renderer`.\n            // It in most cases just clears the internal record of mutated text nodes\n            // since all changes should already be applied to the DOM.\n            // This is especially needed when a user cancels composition, so we can clear nodes marked to sync.\n            if (mutations.length || !env.isAndroid) {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'Input',\n                // @if CK_DEBUG_TYPING // \t\t'%cFire post-composition mutation fixes.',\n                // @if CK_DEBUG_TYPING // \t\t'font-weight: bold'\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                view.document.fire('mutations', { mutations });\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n                // @if CK_DEBUG_TYPING // }\n            }\n        }, { priority: 'lowest' });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._typingQueue.destroy();\n    }\n}\n/**\n * The queue of `insertText` command executions that are waiting for the DOM to get updated after beforeinput event.\n */\nclass TypingQueue {\n    /**\n     * The editor instance.\n     */\n    editor;\n    /**\n     * Debounced queue flush as a safety mechanism for cases of mutation observer not triggering.\n     */\n    flushDebounced = debounce(() => this.flush('timeout'), 50);\n    /**\n     * The queue of `insertText` command executions that are waiting for the DOM to get updated after beforeinput event.\n     */\n    _queue = [];\n    /**\n     * Whether there is any composition enqueued or plain typing only.\n     */\n    _isComposing = false;\n    /**\n     * A set of model elements. The typing happened in those elements. It's used for mutations check.\n     */\n    _affectedElements = new Set();\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        this.editor = editor;\n    }\n    /**\n     * Destroys the helper object.\n     */\n    destroy() {\n        this.flushDebounced.cancel();\n        this._affectedElements.clear();\n        while (this._queue.length) {\n            this.shift();\n        }\n    }\n    /**\n     * Returns the size of the queue.\n     */\n    get length() {\n        return this._queue.length;\n    }\n    /**\n     * Push next insertText command data to the queue.\n     */\n    push(commandData, isComposing) {\n        const commandLiveData = {\n            text: commandData.text\n        };\n        if (commandData.selection) {\n            commandLiveData.selectionRanges = [];\n            for (const range of commandData.selection.getRanges()) {\n                commandLiveData.selectionRanges.push(ModelLiveRange.fromRange(range));\n                // Keep reference to the model element for later mutation checks.\n                this._affectedElements.add(range.start.parent);\n            }\n        }\n        this._queue.push(commandLiveData);\n        this._isComposing ||= isComposing;\n        this.flushDebounced();\n    }\n    /**\n     * Shift the first item from the insertText command data queue.\n     */\n    shift() {\n        const commandLiveData = this._queue.shift();\n        const commandData = {\n            text: commandLiveData.text\n        };\n        if (commandLiveData.selectionRanges) {\n            const ranges = commandLiveData.selectionRanges\n                .map(liveRange => detachLiveRange(liveRange))\n                .filter((range) => !!range);\n            if (ranges.length) {\n                commandData.selection = this.editor.model.createSelection(ranges);\n            }\n        }\n        return commandData;\n    }\n    /**\n     * Applies all queued insertText command executions.\n     *\n     * @param reason Used only for debugging.\n     */\n    flush(reason) {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        this.flushDebounced.cancel();\n        if (!this._queue.length) {\n            return;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.group( ..._buildLogMessage( this, 'Input',\n        // @if CK_DEBUG_TYPING // \t\t`%cFlush insertText queue on ${ reason }.`,\n        // @if CK_DEBUG_TYPING // \t\t'font-weight: bold'\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        const insertTextCommand = editor.commands.get('insertText');\n        const buffer = insertTextCommand.buffer;\n        model.enqueueChange(buffer.batch, () => {\n            buffer.lock();\n            while (this._queue.length) {\n                const commandData = this.shift();\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n                // @if CK_DEBUG_TYPING // \t\t`%cExecute queued insertText:%c \"${ commandData.text }\"%c ` +\n                // @if CK_DEBUG_TYPING // \t\t\t`[${ commandData.selection.getFirstPosition().path }]-` +\n                // @if CK_DEBUG_TYPING // \t\t\t`[${ commandData.selection.getLastPosition().path }]`,\n                // @if CK_DEBUG_TYPING // \t\t'font-weight: bold',\n                // @if CK_DEBUG_TYPING // \t\t'color: blue',\n                // @if CK_DEBUG_TYPING // \t\t''\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                editor.execute('insertText', commandData);\n            }\n            buffer.unlock();\n            if (!this._isComposing) {\n                // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n                // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'Input',\n                // @if CK_DEBUG_TYPING // \t\t'Clear affected elements set'\n                // @if CK_DEBUG_TYPING // \t) );\n                // @if CK_DEBUG_TYPING // }\n                this._affectedElements.clear();\n            }\n            this._isComposing = false;\n        });\n        view.scrollToTheSelection();\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.groupEnd();\n        // @if CK_DEBUG_TYPING // }\n    }\n    /**\n     * Returns `true` if the given model element is related to recent typing.\n     */\n    isElementAffected(element) {\n        return this._affectedElements.has(element);\n    }\n    /**\n     * Returns `true` if there are any affected elements in the queue.\n     */\n    hasAffectedElements() {\n        return this._affectedElements.size > 0;\n    }\n    /**\n     * Returns an array of typing-related elements and clears the internal list.\n     */\n    flushAffectedElements() {\n        const result = Array.from(this._affectedElements);\n        this._affectedElements.clear();\n        return result;\n    }\n}\n/**\n * Deletes the content selected by the document selection at the start of composition.\n */\nfunction deleteSelectionContent(model, insertTextCommand) {\n    // By relying on the state of the input command we allow disabling the entire input easily\n    // by just disabling the input command. We could’ve used here the delete command but that\n    // would mean requiring the delete feature which would block loading one without the other.\n    // We could also check the editor.isReadOnly property, but that wouldn't allow to block\n    // the input without blocking other features.\n    if (!insertTextCommand.isEnabled) {\n        return;\n    }\n    const buffer = insertTextCommand.buffer;\n    buffer.lock();\n    model.enqueueChange(buffer.batch, () => {\n        model.deleteContent(model.document.selection);\n    });\n    buffer.unlock();\n}\n/**\n * Detaches a ModelLiveRange and returns the static range from it.\n */\nfunction detachLiveRange(liveRange) {\n    const range = liveRange.toRange();\n    liveRange.detach();\n    if (range.root.rootName == '$graveyard') {\n        return null;\n    }\n    return range;\n}\n/**\n * For the given `viewNode`, finds and returns the closest ancestor of this node that has a mapping to the model.\n */\nfunction findMappedViewAncestor(viewNode, mapper) {\n    let node = (viewNode.is('$text') ? viewNode.parent : viewNode);\n    while (!mapper.toModelElement(node)) {\n        node = node.parent;\n    }\n    return node;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/deletecommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\nimport { count } from '@ckeditor/ckeditor5-utils';\nimport { TypingChangeBuffer } from './utils/changebuffer.js';\n// @if CK_DEBUG_TYPING // const { _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );\n/**\n * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and\n * <kbd>Backspace</kbd> keys.\n */\nexport class DeleteCommand extends Command {\n    /**\n     * The directionality of the delete describing in what direction it should\n     * consume the content when the selection is collapsed.\n     */\n    direction;\n    /**\n     * Delete's change buffer used to group subsequent changes into batches.\n     */\n    _buffer;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param direction The directionality of the delete describing in what direction it\n     * should consume the content when the selection is collapsed.\n     */\n    constructor(editor, direction) {\n        super(editor);\n        this.direction = direction;\n        this._buffer = new TypingChangeBuffer(editor.model, editor.config.get('typing.undoStep'));\n        // Since this command may execute on different selectable than selection, it should be checked directly in execute block.\n        this._isEnabledBasedOnSelection = false;\n    }\n    /**\n     * The current change buffer.\n     */\n    get buffer() {\n        return this._buffer;\n    }\n    /**\n     * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content\n     * or a piece of content in the {@link #direction defined direction}.\n     *\n     * @fires execute\n     * @param options The command options.\n     * @param options.unit See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.\n     * @param options.sequence A number describing which subsequent delete event it is without the key being released.\n     * See the {@link module:engine/view/document~ViewDocument#event:delete} event data.\n     * @param options.selection Selection to remove. If not set, current model selection will be used.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const doc = model.document;\n        model.enqueueChange(this._buffer.batch, writer => {\n            this._buffer.lock();\n            const selection = writer.createSelection(options.selection || doc.selection);\n            // Don't execute command when selection is in non-editable place.\n            if (!model.canEditAt(selection)) {\n                return;\n            }\n            const sequence = options.sequence || 1;\n            // Do not replace the whole selected content if selection was collapsed.\n            // This prevents such situation:\n            //\n            // <h1></h1><p>[]</p>\t-->  <h1>[</h1><p>]</p> \t\t-->  <p></p>\n            // starting content\t\t-->   after `modifySelection`\t-->  after `deleteContent`.\n            const doNotResetEntireContent = selection.isCollapsed;\n            // Try to extend the selection in the specified direction.\n            if (selection.isCollapsed) {\n                model.modifySelection(selection, {\n                    direction: this.direction,\n                    unit: options.unit,\n                    treatEmojiAsSingleUnit: true\n                });\n            }\n            // Check if deleting in an empty editor. See #61.\n            if (this._shouldEntireContentBeReplacedWithParagraph(sequence)) {\n                this._replaceEntireContentWithParagraph(writer);\n                return;\n            }\n            // Check if deleting in the first empty block.\n            // See https://github.com/ckeditor/ckeditor5/issues/8137.\n            if (this._shouldReplaceFirstBlockWithParagraph(selection, sequence)) {\n                this.editor.execute('paragraph', { selection });\n                return;\n            }\n            // If selection is still collapsed, then there's nothing to delete.\n            if (selection.isCollapsed) {\n                return;\n            }\n            let changeCount = 0;\n            selection.getFirstRange().getMinimalFlatRanges().forEach(range => {\n                changeCount += count(range.getWalker({ singleCharacters: true, ignoreElementEnd: true, shallow: true }));\n            });\n            // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n            // @if CK_DEBUG_TYPING // \tconsole.log( ..._buildLogMessage( this, 'DeleteCommand',\n            // @if CK_DEBUG_TYPING // \t\t'Delete content',\n            // @if CK_DEBUG_TYPING // \t\t`[${ selection.getFirstPosition()!.path }]-[${ selection.getLastPosition()!.path }]`,\n            // @if CK_DEBUG_TYPING // \t\toptions\n            // @if CK_DEBUG_TYPING // \t) );\n            // @if CK_DEBUG_TYPING // }\n            model.deleteContent(selection, {\n                doNotResetEntireContent,\n                direction: this.direction\n            });\n            this._buffer.input(changeCount);\n            writer.setSelection(selection);\n            this._buffer.unlock();\n        });\n    }\n    /**\n     * If the user keeps <kbd>Backspace</kbd> or <kbd>Delete</kbd> key pressed, the content of the current\n     * editable will be cleared. However, this will not yet lead to resetting the remaining block to a paragraph\n     * (which happens e.g. when the user does <kbd>Ctrl</kbd> + <kbd>A</kbd>, <kbd>Backspace</kbd>).\n     *\n     * But, if the user pressed the key in an empty editable for the first time,\n     * we want to replace the entire content with a paragraph if:\n     *\n     * * the current limit element is empty,\n     * * the paragraph is allowed in the limit element,\n     * * the limit doesn't already have a paragraph inside.\n     *\n     * See https://github.com/ckeditor/ckeditor5-typing/issues/61.\n     *\n     * @param sequence A number describing which subsequent delete event it is without the key being released.\n     */\n    _shouldEntireContentBeReplacedWithParagraph(sequence) {\n        // Does nothing if user pressed and held the \"Backspace\" or \"Delete\" key.\n        if (sequence > 1) {\n            return false;\n        }\n        const model = this.editor.model;\n        const doc = model.document;\n        const selection = doc.selection;\n        const limitElement = model.schema.getLimitElement(selection);\n        // If a collapsed selection contains the whole content it means that the content is empty\n        // (from the user perspective).\n        const limitElementIsEmpty = selection.isCollapsed && selection.containsEntireContent(limitElement);\n        if (!limitElementIsEmpty) {\n            return false;\n        }\n        if (!model.schema.checkChild(limitElement, 'paragraph')) {\n            return false;\n        }\n        const limitElementFirstChild = limitElement.getChild(0);\n        // Does nothing if the limit element already contains only a paragraph.\n        // We ignore the case when paragraph might have some inline elements (<p><inlineWidget>[]</inlineWidget></p>)\n        // because we don't support such cases yet and it's unclear whether inlineWidget shouldn't be a limit itself.\n        if (limitElementFirstChild && limitElementFirstChild.is('element', 'paragraph')) {\n            return false;\n        }\n        return true;\n    }\n    /**\n     * The entire content is replaced with the paragraph. Selection is moved inside the paragraph.\n     *\n     * @param writer The model writer.\n     */\n    _replaceEntireContentWithParagraph(writer) {\n        const model = this.editor.model;\n        const doc = model.document;\n        const selection = doc.selection;\n        const limitElement = model.schema.getLimitElement(selection);\n        const paragraph = writer.createElement('paragraph');\n        writer.remove(writer.createRangeIn(limitElement));\n        writer.insert(paragraph, limitElement);\n        writer.setSelection(paragraph, 0);\n    }\n    /**\n     * Checks if the selection is inside an empty element that is the first child of the limit element\n     * and should be replaced with a paragraph.\n     *\n     * @param selection The selection.\n     * @param sequence A number describing which subsequent delete event it is without the key being released.\n     */\n    _shouldReplaceFirstBlockWithParagraph(selection, sequence) {\n        const model = this.editor.model;\n        // Does nothing if user pressed and held the \"Backspace\" key or it was a \"Delete\" button.\n        if (sequence > 1 || this.direction != 'backward') {\n            return false;\n        }\n        if (!selection.isCollapsed) {\n            return false;\n        }\n        const position = selection.getFirstPosition();\n        const limitElement = model.schema.getLimitElement(position);\n        const limitElementFirstChild = limitElement.getChild(0);\n        // Only elements that are direct children of the limit element can be replaced.\n        // Unwrapping from a block quote should be handled in a dedicated feature.\n        if (position.parent != limitElementFirstChild) {\n            return false;\n        }\n        // A block should be replaced only if it was empty.\n        if (!selection.containsEntireContent(limitElementFirstChild)) {\n            return false;\n        }\n        // Replace with a paragraph only if it's allowed there.\n        if (!model.schema.checkChild(limitElement, 'paragraph')) {\n            return false;\n        }\n        // Does nothing if the limit element already contains only a paragraph.\n        if (limitElementFirstChild.name == 'paragraph') {\n            return false;\n        }\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/deleteobserver\n */\nimport { env, keyCodes, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair } from '@ckeditor/ckeditor5-utils';\nimport { BubblingEventInfo, ViewDocumentDomEventData, Observer } from '@ckeditor/ckeditor5-engine';\nconst DELETE_CHARACTER = 'character';\nconst DELETE_WORD = 'word';\nconst DELETE_CODE_POINT = 'codePoint';\nconst DELETE_SELECTION = 'selection';\nconst DELETE_BACKWARD = 'backward';\nconst DELETE_FORWARD = 'forward';\nconst DELETE_EVENT_TYPES = {\n    // --------------------------------------- Backward delete types -----------------------------------------------------\n    // This happens in Safari on Mac when some content is selected and Ctrl + K is pressed.\n    deleteContent: {\n        unit: DELETE_SELECTION,\n        // According to the Input Events Level 2 spec, this delete type has no direction\n        // but to keep things simple, let's default to backward.\n        direction: DELETE_BACKWARD\n    },\n    // Chrome and Safari on Mac: Backspace or Ctrl + H\n    deleteContentBackward: {\n        // This kind of deletions must be done on the code point-level instead of target range provided by the DOM beforeinput event.\n        // Take for instance \"👨‍👩‍👧‍👧\", it equals:\n        //\n        //\t* [ \"👨\", \"ZERO WIDTH JOINER\", \"👩\", \"ZERO WIDTH JOINER\", \"👧\", \"ZERO WIDTH JOINER\", \"👧\" ]\n        //\t* or simply \"\\u{1F468}\\u200D\\u{1F469}\\u200D\\u{1F467}\\u200D\\u{1F467}\"\n        //\n        // The range provided by the browser would cause the entire multi-byte grapheme to disappear while the user\n        // intention when deleting backwards (\"👨‍👩‍👧‍👧[]\", then backspace) is gradual \"decomposition\" (first to \"👨‍👩‍👧‍[]\",\n        // then to \"👨‍👩‍[]\", etc.).\n        //\n        //\t* \"👨‍👩‍👧‍👧[]\" + backward delete (by code point)  -> results in \"👨‍👩‍👧[]\", removed the last \"👧\" 👍\n        //\t* \"👨‍👩‍👧‍👧[]\" + backward delete (by character)  -> results in \"[]\", removed the whole grapheme 👎\n        //\n        // Deleting by code-point is simply a better UX. See \"deleteContentForward\" to learn more.\n        unit: DELETE_CODE_POINT,\n        direction: DELETE_BACKWARD\n    },\n    // On Mac: Option + Backspace.\n    // On iOS: Hold the backspace for a while and the whole words will start to disappear.\n    deleteWordBackward: {\n        unit: DELETE_WORD,\n        direction: DELETE_BACKWARD\n    },\n    // Safari on Mac: Cmd + Backspace\n    deleteHardLineBackward: {\n        unit: DELETE_SELECTION,\n        direction: DELETE_BACKWARD\n    },\n    // Chrome on Mac: Cmd + Backspace.\n    deleteSoftLineBackward: {\n        unit: DELETE_SELECTION,\n        direction: DELETE_BACKWARD\n    },\n    // --------------------------------------- Forward delete types -----------------------------------------------------\n    // Chrome on Mac: Fn + Backspace or Ctrl + D\n    // Safari on Mac: Ctrl + K or Ctrl + D\n    deleteContentForward: {\n        // Unlike backward delete, this delete must be performed by character instead of by code point, which\n        // provides the best UX for working with accented letters.\n        // Take, for example \"b̂\" (\"\\u0062\\u0302\", or [ \"LATIN SMALL LETTER B\", \"COMBINING CIRCUMFLEX ACCENT\" ]):\n        //\n        //\t* \"b̂[]\" + backward delete (by code point)  -> results in \"b[]\", removed the combining mark 👍\n        //\t* \"[]b̂\" + forward delete (by code point)   -> results in \"[]^\", a bare combining mark does that not make sense when alone 👎\n        //\t* \"[]b̂\" + forward delete (by character)    -> results in \"[]\", removed both \"b\" and the combining mark 👍\n        //\n        // See: \"deleteContentBackward\" to learn more.\n        unit: DELETE_CHARACTER,\n        direction: DELETE_FORWARD\n    },\n    // On Mac: Fn + Option + Backspace.\n    deleteWordForward: {\n        unit: DELETE_WORD,\n        direction: DELETE_FORWARD\n    },\n    // Chrome on Mac: Ctrl + K (you have to disable the Link plugin first, though, because it uses the same keystroke)\n    // This is weird that it does not work in Safari on Mac despite being listed in the official shortcuts listing\n    // on Apple's webpage.\n    deleteHardLineForward: {\n        unit: DELETE_SELECTION,\n        direction: DELETE_FORWARD\n    },\n    // At this moment there is no known way to trigger this event type but let's keep it for the symmetry with\n    // deleteSoftLineBackward.\n    deleteSoftLineForward: {\n        unit: DELETE_SELECTION,\n        direction: DELETE_FORWARD\n    }\n};\n/**\n * Delete observer introduces the {@link module:engine/view/document~ViewDocument#event:delete} event.\n *\n * @internal\n */\nexport class DeleteObserver extends Observer {\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        const document = view.document;\n        // It matters how many subsequent deletions were made, e.g. when the backspace key was pressed and held\n        // by the user for some time. For instance, if such scenario ocurred and the heading the selection was\n        // anchored to was the only content of the editor, it will not be converted into a paragraph (the user\n        // wanted to clean it up, not remove it, it's about UX). Check out the DeleteCommand implementation to learn more.\n        //\n        // Fun fact: Safari on Mac won't fire beforeinput for backspace in an empty heading (only content).\n        let sequence = 0;\n        document.on('keydown', () => {\n            sequence++;\n        });\n        document.on('keyup', () => {\n            sequence = 0;\n        });\n        document.on('beforeinput', (evt, data) => {\n            if (!this.isEnabled) {\n                return;\n            }\n            const { targetRanges, domEvent, inputType } = data;\n            const deleteEventSpec = DELETE_EVENT_TYPES[inputType];\n            if (!deleteEventSpec) {\n                return;\n            }\n            const deleteData = {\n                direction: deleteEventSpec.direction,\n                unit: deleteEventSpec.unit,\n                sequence\n            };\n            if (deleteData.unit == DELETE_SELECTION) {\n                deleteData.selectionToRemove = view.createSelection(targetRanges[0]);\n            }\n            // The default deletion unit for deleteContentBackward is a single code point\n            // but if the browser provides a wider target range then we should use it.\n            if (inputType === 'deleteContentBackward') {\n                // On Android, deleteContentBackward has sequence 1 by default.\n                if (env.isAndroid) {\n                    deleteData.sequence = 1;\n                }\n                // The beforeInput event wants more than a single character to be removed.\n                if (shouldUseTargetRanges(targetRanges)) {\n                    deleteData.unit = DELETE_SELECTION;\n                    deleteData.selectionToRemove = view.createSelection(targetRanges);\n                }\n            }\n            const eventInfo = new BubblingEventInfo(document, 'delete', targetRanges[0]);\n            document.fire(eventInfo, new ViewDocumentDomEventData(view, domEvent, deleteData));\n            // Stop the beforeinput event if `delete` event was stopped.\n            // https://github.com/ckeditor/ckeditor5/issues/753\n            if (eventInfo.stop.called) {\n                evt.stop();\n            }\n        });\n        // TODO: to be removed when https://bugs.chromium.org/p/chromium/issues/detail?id=1365311 is solved.\n        if (env.isBlink) {\n            enableChromeWorkaround(this);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    observe() { }\n    /**\n     * @inheritDoc\n     */\n    stopObserving() { }\n}\n/**\n * Enables workaround for the issue https://github.com/ckeditor/ckeditor5/issues/11904.\n */\nfunction enableChromeWorkaround(observer) {\n    const view = observer.view;\n    const document = view.document;\n    let pressedKeyCode = null;\n    let beforeInputReceived = false;\n    document.on('keydown', (evt, { keyCode }) => {\n        pressedKeyCode = keyCode;\n        beforeInputReceived = false;\n    });\n    document.on('keyup', (evt, { keyCode, domEvent }) => {\n        const selection = document.selection;\n        const shouldFireDeleteEvent = observer.isEnabled &&\n            keyCode == pressedKeyCode &&\n            isDeleteKeyCode(keyCode) &&\n            !selection.isCollapsed &&\n            !beforeInputReceived;\n        pressedKeyCode = null;\n        if (shouldFireDeleteEvent) {\n            const targetRange = selection.getFirstRange();\n            const eventInfo = new BubblingEventInfo(document, 'delete', targetRange);\n            const deleteData = {\n                unit: DELETE_SELECTION,\n                direction: getDeleteDirection(keyCode),\n                selectionToRemove: selection\n            };\n            document.fire(eventInfo, new ViewDocumentDomEventData(view, domEvent, deleteData));\n        }\n    });\n    document.on('beforeinput', (evt, { inputType }) => {\n        const deleteEventSpec = DELETE_EVENT_TYPES[inputType];\n        const isMatchingBeforeInput = isDeleteKeyCode(pressedKeyCode) &&\n            deleteEventSpec &&\n            deleteEventSpec.direction == getDeleteDirection(pressedKeyCode);\n        if (isMatchingBeforeInput) {\n            beforeInputReceived = true;\n        }\n    }, { priority: 'high' });\n    document.on('beforeinput', (evt, { inputType, data }) => {\n        const shouldIgnoreBeforeInput = pressedKeyCode == keyCodes.delete &&\n            inputType == 'insertText' &&\n            data == '\\x7f'; // Delete character :P\n        if (shouldIgnoreBeforeInput) {\n            evt.stop();\n        }\n    }, { priority: 'high' });\n    function isDeleteKeyCode(keyCode) {\n        return keyCode == keyCodes.backspace || keyCode == keyCodes.delete;\n    }\n    function getDeleteDirection(keyCode) {\n        return keyCode == keyCodes.backspace ? DELETE_BACKWARD : DELETE_FORWARD;\n    }\n}\n/**\n * Verifies whether the given target ranges cover more than a single character and should be used instead of a single code-point deletion.\n */\nfunction shouldUseTargetRanges(targetRanges) {\n    // The collapsed target range could happen for example while deleting inside an inline filler\n    // (it's mapped to collapsed position before an inline filler).\n    if (targetRanges.length != 1 || targetRanges[0].isCollapsed) {\n        return false;\n    }\n    const walker = targetRanges[0].getWalker({\n        direction: 'backward',\n        singleCharacters: true,\n        ignoreElementEnd: true\n    });\n    let count = 0;\n    for (const { nextPosition, item } of walker) {\n        if (nextPosition.parent.is('$text')) {\n            const data = nextPosition.parent.data;\n            const offset = nextPosition.offset;\n            // Count combined symbols and emoji sequences as a single character.\n            if (isInsideSurrogatePair(data, offset) ||\n                isInsideCombinedSymbol(data, offset) ||\n                isInsideEmojiSequence(data, offset)) {\n                continue;\n            }\n            count++;\n        }\n        else if (item.is('containerElement') || item.is('emptyElement')) {\n            count++;\n        }\n        if (count > 1) {\n            return true;\n        }\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/delete\n */\nimport { _tryFixingModelRange, BubblingEventInfo, ViewDocumentDomEventData } from '@ckeditor/ckeditor5-engine';\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { keyCodes } from '@ckeditor/ckeditor5-utils';\nimport { DeleteCommand } from './deletecommand.js';\nimport { DeleteObserver } from './deleteobserver.js';\n/**\n * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other\n * keystrokes and user actions that result in deleting content in the editor.\n */\nexport class Delete extends Plugin {\n    /**\n     * Whether pressing backspace should trigger undo action\n     */\n    _undoOnBackspace;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Delete';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const modelDocument = editor.model.document;\n        view.addObserver(DeleteObserver);\n        this._undoOnBackspace = false;\n        const deleteForwardCommand = new DeleteCommand(editor, 'forward');\n        // Register `deleteForward` command and add `forwardDelete` command as an alias for backward compatibility.\n        editor.commands.add('deleteForward', deleteForwardCommand);\n        editor.commands.add('forwardDelete', deleteForwardCommand);\n        editor.commands.add('delete', new DeleteCommand(editor, 'backward'));\n        this.listenTo(viewDocument, 'delete', (evt, data) => {\n            // When not in composition, we handle the action, so prevent the default one.\n            // When in composition, it's the browser who modify the DOM (renderer is disabled).\n            if (!viewDocument.isComposing) {\n                data.preventDefault();\n            }\n            const { direction, sequence, selectionToRemove, unit } = data;\n            const commandName = direction === 'forward' ? 'deleteForward' : 'delete';\n            const commandData = { sequence };\n            if (unit == 'selection') {\n                const modelRanges = Array.from(selectionToRemove.getRanges())\n                    .map(viewRange => editor.editing.mapper.toModelRange(viewRange))\n                    .map(modelRange => _tryFixingModelRange(modelRange, editor.model.schema) || modelRange);\n                commandData.selection = editor.model.createSelection(modelRanges);\n            }\n            else {\n                commandData.unit = unit;\n            }\n            editor.execute(commandName, commandData);\n            view.scrollToTheSelection();\n        }, { priority: 'low' });\n        // Handle the Backspace key while at the beginning of a nested editable. See https://github.com/ckeditor/ckeditor5/issues/17383.\n        this.listenTo(viewDocument, 'keydown', (evt, data) => {\n            if (viewDocument.isComposing ||\n                data.keyCode != keyCodes.backspace ||\n                !modelDocument.selection.isCollapsed) {\n                return;\n            }\n            const ancestorLimit = editor.model.schema.getLimitElement(modelDocument.selection);\n            const limitStartPosition = editor.model.createPositionAt(ancestorLimit, 0);\n            if (limitStartPosition.isTouching(modelDocument.selection.getFirstPosition())) {\n                // Stop the beforeinput event as it could be invalid.\n                data.preventDefault();\n                // Create a fake delete event so all features can act on it and the target range is proper.\n                const modelRange = editor.model.schema.getNearestSelectionRange(limitStartPosition, 'forward');\n                if (!modelRange) {\n                    return;\n                }\n                const viewSelection = view.createSelection(editor.editing.mapper.toViewRange(modelRange));\n                const targetRange = viewSelection.getFirstRange();\n                const eventInfo = new BubblingEventInfo(document, 'delete', targetRange);\n                const deleteData = {\n                    unit: 'selection',\n                    direction: 'backward',\n                    selectionToRemove: viewSelection\n                };\n                viewDocument.fire(eventInfo, new ViewDocumentDomEventData(view, data.domEvent, deleteData));\n            }\n        });\n        if (this.editor.plugins.has('UndoEditing')) {\n            this.listenTo(viewDocument, 'delete', (evt, data) => {\n                if (this._undoOnBackspace && data.direction == 'backward' && data.sequence == 1 && data.unit == 'codePoint') {\n                    this._undoOnBackspace = false;\n                    editor.execute('undo');\n                    data.preventDefault();\n                    evt.stop();\n                }\n            }, { context: '$capture' });\n            this.listenTo(modelDocument, 'change', () => {\n                this._undoOnBackspace = false;\n            });\n        }\n    }\n    /**\n     * If the next user action after calling this method is pressing backspace, it would undo the last change.\n     *\n     * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.\n     */\n    requestUndoOnBackspace() {\n        if (this.editor.plugins.has('UndoEditing')) {\n            this._undoOnBackspace = true;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/typing\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { Input } from './input.js';\nimport { Delete } from './delete.js';\n/**\n * The typing feature. It handles typing.\n *\n * This is a \"glue\" plugin which loads the {@link module:typing/input~Input} and {@link module:typing/delete~Delete}\n * plugins.\n */\nexport class Typing extends Plugin {\n    static get requires() {\n        return [Input, Delete];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Typing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns the last text line from the given range.\n *\n * \"The last text line\" is understood as text (from one or more text nodes) which is limited either by a parent block\n * or by inline elements (e.g. `<softBreak>`).\n *\n * ```ts\n * const rangeToCheck = model.createRange(\n * \tmodel.createPositionAt( paragraph, 0 ),\n * \tmodel.createPositionAt( paragraph, 'end' )\n * );\n *\n * const { text, range } = getLastTextLine( rangeToCheck, model );\n * ```\n *\n * For model below, the returned `text` will be \"Foo bar baz\" and `range` will be set on whole `<paragraph>` content:\n *\n * ```xml\n * <paragraph>Foo bar baz<paragraph>\n * ```\n *\n * However, in below case, `text` will be set to \"baz\" and `range` will be set only on \"baz\".\n *\n * ```xml\n * <paragraph>Foo<softBreak></softBreak>bar<softBreak></softBreak>baz<paragraph>\n * ```\n */\nexport function getLastTextLine(range, model) {\n    let start = range.start;\n    const text = Array.from(range.getWalker({ ignoreElementEnd: false })).reduce((rangeText, { item }) => {\n        // Trim text to a last occurrence of an inline element and update range start.\n        if (!(item.is('$text') || item.is('$textProxy'))) {\n            start = model.createPositionAfter(item);\n            return '';\n        }\n        return rangeText + item.data;\n    }, '');\n    return { text, range: model.createRange(start, range.end) };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/textwatcher\n */\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\nimport { getLastTextLine } from './utils/getlasttextline.js';\n/**\n * The text watcher feature.\n *\n * Fires the {@link module:typing/textwatcher~TextWatcher#event:matched:data `matched:data`},\n * {@link module:typing/textwatcher~TextWatcher#event:matched:selection `matched:selection`} and\n * {@link module:typing/textwatcher~TextWatcher#event:unmatched `unmatched`} events on typing or selection changes.\n */\nexport class TextWatcher extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * The editor's model.\n     */\n    model;\n    /**\n     * The function used to match the text.\n     *\n     * The test callback can return 3 values:\n     *\n     * * `false` if there is no match,\n     * * `true` if there is a match,\n     * * an object if there is a match and we want to pass some additional information to the {@link #event:matched:data} event.\n     */\n    testCallback;\n    /**\n     * Whether there is a match currently.\n     */\n    _hasMatch;\n    /**\n     * Creates a text watcher instance.\n     *\n     * @param testCallback See {@link module:typing/textwatcher~TextWatcher#testCallback}.\n     */\n    constructor(model, testCallback) {\n        super();\n        this.model = model;\n        this.testCallback = testCallback;\n        this._hasMatch = false;\n        this.set('isEnabled', true);\n        // Toggle text watching on isEnabled state change.\n        this.on('change:isEnabled', () => {\n            if (this.isEnabled) {\n                this._startListening();\n            }\n            else {\n                this.stopListening(model.document.selection);\n                this.stopListening(model.document);\n            }\n        });\n        this._startListening();\n    }\n    /**\n     * Flag indicating whether there is a match currently.\n     */\n    get hasMatch() {\n        return this._hasMatch;\n    }\n    /**\n     * Starts listening to the editor for typing and selection events.\n     */\n    _startListening() {\n        const model = this.model;\n        const document = model.document;\n        this.listenTo(document.selection, 'change:range', (evt, { directChange }) => {\n            // Indirect changes (i.e. when the user types or external changes are applied) are handled in the document's change event.\n            if (!directChange) {\n                return;\n            }\n            // Act only on collapsed selection.\n            if (!document.selection.isCollapsed) {\n                if (this.hasMatch) {\n                    this.fire('unmatched');\n                    this._hasMatch = false;\n                }\n                return;\n            }\n            this._evaluateTextBeforeSelection('selection');\n        });\n        this.listenTo(document, 'change:data', (evt, batch) => {\n            if (batch.isUndo || !batch.isLocal) {\n                return;\n            }\n            this._evaluateTextBeforeSelection('data', { batch });\n        });\n    }\n    /**\n     * Checks the editor content for matched text.\n     *\n     * @fires matched:data\n     * @fires matched:selection\n     * @fires unmatched\n     *\n     * @param suffix A suffix used for generating the event name.\n     * @param data Data object for event.\n     */\n    _evaluateTextBeforeSelection(suffix, data = {}) {\n        const model = this.model;\n        const document = model.document;\n        const selection = document.selection;\n        const rangeBeforeSelection = model.createRange(model.createPositionAt(selection.focus.parent, 0), selection.focus);\n        const { text, range } = getLastTextLine(rangeBeforeSelection, model);\n        const testResult = this.testCallback(text);\n        if (!testResult && this.hasMatch) {\n            this.fire('unmatched');\n        }\n        this._hasMatch = !!testResult;\n        if (testResult) {\n            const eventData = Object.assign(data, { text, range });\n            // If the test callback returns an object with additional data, assign the data as well.\n            if (typeof testResult == 'object') {\n                Object.assign(eventData, testResult);\n            }\n            this.fire(`matched:${suffix}`, eventData);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/twostepcaretmovement\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { keyCodes } from '@ckeditor/ckeditor5-utils';\nimport { MouseObserver, TouchObserver } from '@ckeditor/ckeditor5-engine';\n/**\n * This plugin enables the two-step caret (phantom) movement behavior for\n * {@link module:typing/twostepcaretmovement~TwoStepCaretMovement#registerAttribute registered attributes}\n * on arrow right (<kbd>→</kbd>) and left (<kbd>←</kbd>) key press.\n *\n * Thanks to this (phantom) caret movement the user is able to type before/after as well as at the\n * beginning/end of an attribute.\n *\n * **Note:** This plugin support right–to–left (Arabic, Hebrew, etc.) content by mirroring its behavior\n * but for the sake of simplicity examples showcase only left–to–right use–cases.\n *\n * # Forward movement\n *\n * ## \"Entering\" an attribute:\n *\n * When this plugin is enabled and registered for the `a` attribute and the selection is right before it\n * (at the attribute boundary), pressing the right arrow key will not move the selection but update its\n * attributes accordingly:\n *\n * * When enabled:\n *\n * ```xml\n * foo{}<$text a=\"true\">bar</$text>\n * ```\n *\n * \t<kbd>→</kbd>\n *\n * ```xml\n * foo<$text a=\"true\">{}bar</$text>\n * ```\n *\n * * When disabled:\n *\n * ```xml\n * foo{}<$text a=\"true\">bar</$text>\n * ```\n *\n * \t<kbd>→</kbd>\n *\n * ```xml\n * foo<$text a=\"true\">b{}ar</$text>\n * ```\n *\n *\n * ## \"Leaving\" an attribute:\n *\n * * When enabled:\n *\n * ```xml\n * <$text a=\"true\">bar{}</$text>baz\n * ```\n *\n * \t<kbd>→</kbd>\n *\n * ```xml\n * <$text a=\"true\">bar</$text>{}baz\n * ```\n *\n * * When disabled:\n *\n * ```xml\n * <$text a=\"true\">bar{}</$text>baz\n * ```\n *\n * \t<kbd>→</kbd>\n *\n * ```xml\n * <$text a=\"true\">bar</$text>b{}az\n * ```\n *\n * # Backward movement\n *\n * * When enabled:\n *\n * ```xml\n * <$text a=\"true\">bar</$text>{}baz\n * ```\n *\n * \t<kbd>←</kbd>\n *\n * ```xml\n * <$text a=\"true\">bar{}</$text>baz\n * ```\n *\n * * When disabled:\n *\n * ```xml\n * <$text a=\"true\">bar</$text>{}baz\n * ```\n *\n * \t<kbd>←</kbd>\n *\n * ```xml\n * <$text a=\"true\">ba{}r</$text>b{}az\n * ```\n *\n * # Multiple attributes\n *\n * * When enabled and many attributes starts or ends at the same position:\n *\n * ```xml\n * <$text a=\"true\" b=\"true\">bar</$text>{}baz\n * ```\n *\n * \t<kbd>←</kbd>\n *\n * ```xml\n * <$text a=\"true\" b=\"true\">bar{}</$text>baz\n * ```\n *\n * * When enabled and one procedes another:\n *\n * ```xml\n * <$text a=\"true\">bar</$text><$text b=\"true\">{}bar</$text>\n * ```\n *\n * \t<kbd>←</kbd>\n *\n * ```xml\n * <$text a=\"true\">bar{}</$text><$text b=\"true\">bar</$text>\n * ```\n *\n */\nexport class TwoStepCaretMovement extends Plugin {\n    /**\n     * A set of attributes to handle.\n     */\n    attributes;\n    /**\n     * The current UID of the overridden gravity, as returned by\n     * {@link module:engine/model/writer~ModelWriter#overrideSelectionGravity}.\n     */\n    _overrideUid;\n    /**\n     * A flag indicating that the automatic gravity restoration should not happen upon the next\n     * gravity restoration.\n     * {@link module:engine/model/selection~ModelSelection#event:change:range} event.\n     */\n    _isNextGravityRestorationSkipped = false;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TwoStepCaretMovement';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this.attributes = new Set();\n        this._overrideUid = null;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        const locale = editor.locale;\n        const modelSelection = model.document.selection;\n        // Listen to keyboard events and handle the caret movement according to the 2-step caret logic.\n        this.listenTo(view.document, 'arrowKey', (evt, data) => {\n            // This implementation works only for collapsed selection.\n            if (!modelSelection.isCollapsed) {\n                return;\n            }\n            // When user tries to expand the selection or jump over the whole word or to the beginning/end then\n            // two-steps movement is not necessary.\n            if (data.shiftKey || data.altKey || data.ctrlKey) {\n                return;\n            }\n            const arrowRightPressed = data.keyCode == keyCodes.arrowright;\n            const arrowLeftPressed = data.keyCode == keyCodes.arrowleft;\n            // When neither left or right arrow has been pressed then do noting.\n            if (!arrowRightPressed && !arrowLeftPressed) {\n                return;\n            }\n            const contentDirection = locale.contentLanguageDirection;\n            let isMovementHandled = false;\n            if ((contentDirection === 'ltr' && arrowRightPressed) || (contentDirection === 'rtl' && arrowLeftPressed)) {\n                isMovementHandled = this._handleForwardMovement(data);\n            }\n            else {\n                isMovementHandled = this._handleBackwardMovement(data);\n            }\n            // Stop the keydown event if the two-step caret movement handled it. Avoid collisions\n            // with other features which may also take over the caret movement (e.g. Widget).\n            if (isMovementHandled === true) {\n                evt.stop();\n            }\n        }, { context: '$text', priority: 'highest' });\n        // The automatic gravity restoration logic.\n        this.listenTo(modelSelection, 'change:range', (evt, data) => {\n            // Skipping the automatic restoration is needed if the selection should change\n            // but the gravity must remain overridden afterwards. See the #handleBackwardMovement\n            // to learn more.\n            if (this._isNextGravityRestorationSkipped) {\n                this._isNextGravityRestorationSkipped = false;\n                return;\n            }\n            // Skip automatic restore when the gravity is not overridden — simply, there's nothing to restore\n            // at this moment.\n            if (!this._isGravityOverridden) {\n                return;\n            }\n            // Skip automatic restore when the change is indirect AND the selection is at the attribute boundary.\n            // It means that e.g. if the change was external (collaboration) and the user had their\n            // selection around the link, its gravity should remain intact in this change:range event.\n            if (!data.directChange && isBetweenDifferentAttributes(modelSelection.getFirstPosition(), this.attributes)) {\n                return;\n            }\n            this._restoreGravity();\n        });\n        // Handle a click at the beginning/end of a two-step element.\n        this._enableClickingAfterNode();\n        // Change the attributes of the selection in certain situations after the two-step node was inserted into the document.\n        this._enableInsertContentSelectionAttributesFixer();\n        // Handle removing the content after the two-step node.\n        this._handleDeleteContentAfterNode();\n    }\n    /**\n     * Registers a given attribute for the two-step caret movement.\n     *\n     * @param attribute Name of the attribute to handle.\n     */\n    registerAttribute(attribute) {\n        this.attributes.add(attribute);\n    }\n    /**\n     * Updates the document selection and the view according to the two–step caret movement state\n     * when moving **forwards**. Executed upon `keypress` in the {@link module:engine/view/view~EditingView}.\n     *\n     * @internal\n     * @param eventData Data of the key press.\n     * @returns `true` when the handler prevented caret movement.\n     */\n    _handleForwardMovement(eventData) {\n        const attributes = this.attributes;\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const position = selection.getFirstPosition();\n        // DON'T ENGAGE 2-SCM if gravity is already overridden. It means that we just entered\n        //\n        // \t\t<paragraph>foo<$text attribute>{}bar</$text>baz</paragraph>\n        //\n        // or left the attribute\n        //\n        // \t\t<paragraph>foo<$text attribute>bar</$text>{}baz</paragraph>\n        //\n        // and the gravity will be restored automatically.\n        if (this._isGravityOverridden) {\n            return false;\n        }\n        // DON'T ENGAGE 2-SCM when the selection is at the beginning of the block AND already has the\n        // attribute:\n        // * when the selection was initially set there using the mouse,\n        // * when the editor has just started\n        //\n        //\t\t<paragraph><$text attribute>{}bar</$text>baz</paragraph>\n        //\n        if (position.isAtStart && hasAnyAttribute(selection, attributes)) {\n            return false;\n        }\n        // ENGAGE 2-SCM When at least one of the observed attributes changes its value (incl. starts, ends).\n        //\n        //\t\t<paragraph>foo<$text attribute>bar{}</$text>baz</paragraph>\n        //\t\t<paragraph>foo<$text attribute>bar{}</$text><$text otherAttribute>baz</$text></paragraph>\n        //\t\t<paragraph>foo<$text attribute=1>bar{}</$text><$text attribute=2>baz</$text></paragraph>\n        //\t\t<paragraph>foo{}<$text attribute>bar</$text>baz</paragraph>\n        //\n        if (isBetweenDifferentAttributes(position, attributes)) {\n            if (eventData) {\n                preventCaretMovement(eventData);\n            }\n            // CLEAR 2-SCM attributes if we are at the end of one 2-SCM and before\n            // the next one with a different value of the same attribute.\n            //\n            //\t\t<paragraph>foo<$text attribute=1>bar{}</$text><$text attribute=2>bar</$text>baz</paragraph>\n            //\n            if (hasAnyAttribute(selection, attributes) &&\n                isBetweenDifferentAttributes(position, attributes, true)) {\n                clearSelectionAttributes(model, attributes);\n            }\n            else {\n                this._overrideGravity();\n            }\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Updates the document selection and the view according to the two–step caret movement state\n     * when moving **backwards**. Executed upon `keypress` in the {@link module:engine/view/view~EditingView}.\n     *\n     * @internal\n     * @param eventData Data of the key press.\n     * @returns `true` when the handler prevented caret movement\n     */\n    _handleBackwardMovement(eventData) {\n        const attributes = this.attributes;\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const position = selection.getFirstPosition();\n        // When the gravity is already overridden (by this plugin), it means we are on the two-step position.\n        // Prevent the movement, restore the gravity and update selection attributes.\n        //\n        //\t\t<paragraph>foo<$text attribute=1>bar</$text><$text attribute=2>{}baz</$text></paragraph>\n        //\t\t<paragraph>foo<$text attribute>bar</$text><$text otherAttribute>{}baz</$text></paragraph>\n        //\t\t<paragraph>foo<$text attribute>{}bar</$text>baz</paragraph>\n        //\t\t<paragraph>foo<$text attribute>bar</$text>{}baz</paragraph>\n        //\n        if (this._isGravityOverridden) {\n            if (eventData) {\n                preventCaretMovement(eventData);\n            }\n            this._restoreGravity();\n            // CLEAR 2-SCM attributes if we are at the end of one 2-SCM and before\n            // the next one with a different value of the same attribute.\n            //\n            //\t\t<paragraph>foo<$text attribute=1>bar</$text><$text attribute=2>{}bar</$text>baz</paragraph>\n            //\n            if (isBetweenDifferentAttributes(position, attributes, true)) {\n                clearSelectionAttributes(model, attributes);\n            }\n            else {\n                setSelectionAttributesFromTheNodeBefore(model, attributes, position);\n            }\n            return true;\n        }\n        else {\n            // REMOVE SELECTION ATTRIBUTE when restoring gravity towards a non-existent content at the\n            // beginning of the block.\n            //\n            // \t\t<paragraph>{}<$text attribute>bar</$text></paragraph>\n            //\n            if (position.isAtStart) {\n                if (hasAnyAttribute(selection, attributes)) {\n                    if (eventData) {\n                        preventCaretMovement(eventData);\n                    }\n                    setSelectionAttributesFromTheNodeBefore(model, attributes, position);\n                    return true;\n                }\n                return false;\n            }\n            // SET 2-SCM attributes if we are between nodes with the same attribute but with different values.\n            //\n            //\t\t<paragraph>foo<$text attribute=1>bar</$text>[]<$text attribute=2>bar</$text>baz</paragraph>\n            //\n            if (!hasAnyAttribute(selection, attributes) &&\n                isBetweenDifferentAttributes(position, attributes, true)) {\n                if (eventData) {\n                    preventCaretMovement(eventData);\n                }\n                setSelectionAttributesFromTheNodeBefore(model, attributes, position);\n                return true;\n            }\n            // When we are moving from natural gravity, to the position of the 2SCM, we need to override the gravity,\n            // and make sure it won't be restored. Unless it's at the end of the block and an observed attribute.\n            // We need to check if the caret is a one position before the attribute boundary:\n            //\n            //\t\t<paragraph>foo<$text attribute=1>bar</$text><$text attribute=2>b{}az</$text></paragraph>\n            //\t\t<paragraph>foo<$text attribute>bar</$text><$text otherAttribute>b{}az</$text></paragraph>\n            //\t\t<paragraph>foo<$text attribute>b{}ar</$text>baz</paragraph>\n            //\t\t<paragraph>foo<$text attribute>bar</$text>b{}az</paragraph>\n            //\n            if (isStepAfterAnyAttributeBoundary(position, attributes)) {\n                // ENGAGE 2-SCM if the selection has no attribute. This may happen when the user\n                // left the attribute using a FORWARD 2-SCM.\n                //\n                // \t\t<paragraph><$text attribute>bar</$text>{}</paragraph>\n                //\n                if (position.isAtEnd &&\n                    !hasAnyAttribute(selection, attributes) &&\n                    isBetweenDifferentAttributes(position, attributes)) {\n                    if (eventData) {\n                        preventCaretMovement(eventData);\n                    }\n                    setSelectionAttributesFromTheNodeBefore(model, attributes, position);\n                    return true;\n                }\n                // Skip the automatic gravity restore upon the next selection#change:range event.\n                // If not skipped, it would automatically restore the gravity, which should remain\n                // overridden.\n                this._isNextGravityRestorationSkipped = true;\n                this._overrideGravity();\n                // Don't return \"true\" here because we didn't call _preventCaretMovement.\n                // Returning here will destabilize the filler logic, which also listens to\n                // keydown (and the event would be stopped).\n                return false;\n            }\n        }\n        return false;\n    }\n    /**\n     * Starts listening to {@link module:engine/view/document~ViewDocument#event:mousedown} and\n     * {@link module:engine/view/document~ViewDocument#event:selectionChange} and puts the selection before/after a 2-step node\n     * if clicked at the beginning/ending of the 2-step node.\n     *\n     * The purpose of this action is to allow typing around the 2-step node directly after a click.\n     *\n     * See https://github.com/ckeditor/ckeditor5/issues/1016.\n     */\n    _enableClickingAfterNode() {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const document = editor.editing.view.document;\n        editor.editing.view.addObserver(MouseObserver);\n        editor.editing.view.addObserver(TouchObserver);\n        let touched = false;\n        let clicked = false;\n        // This event should be fired before selection on mobile devices.\n        this.listenTo(document, 'touchstart', () => {\n            clicked = false;\n            touched = true;\n        });\n        // Track mouse click event.\n        // Keep in mind that it's often called after the selection change on iOS devices.\n        // On the Android devices, it's called before the selection change.\n        // That's why we watch `touchstart` event on mobile and set `touched` flag, as it's fired before the selection change.\n        // See more: https://github.com/ckeditor/ckeditor5/issues/17171\n        this.listenTo(document, 'mousedown', () => {\n            clicked = true;\n        });\n        // When the selection has changed...\n        this.listenTo(document, 'selectionChange', () => {\n            const attributes = this.attributes;\n            if (!clicked && !touched) {\n                return;\n            }\n            // ...and it was caused by the click or touch...\n            clicked = false;\n            touched = false;\n            // ...and no text is selected...\n            if (!selection.isCollapsed) {\n                return;\n            }\n            // ...and clicked text is the 2-step node...\n            if (!hasAnyAttribute(selection, attributes)) {\n                return;\n            }\n            const position = selection.getFirstPosition();\n            if (!isBetweenDifferentAttributes(position, attributes)) {\n                return;\n            }\n            // The selection at the start of a block would use surrounding attributes\n            // from text after the selection so just clear 2-SCM attributes.\n            //\n            // Also, clear attributes for selection between same attribute with different values.\n            if (position.isAtStart ||\n                isBetweenDifferentAttributes(position, attributes, true)) {\n                clearSelectionAttributes(model, attributes);\n            }\n            else if (!this._isGravityOverridden) {\n                this._overrideGravity();\n            }\n        });\n    }\n    /**\n     * Starts listening to {@link module:engine/model/model~Model#event:insertContent} and corrects the model\n     * selection attributes if the selection is at the end of a two-step node after inserting the content.\n     *\n     * The purpose of this action is to improve the overall UX because the user is no longer \"trapped\" by the\n     * two-step attribute of the selection, and they can type a \"clean\" (`linkHref`–less) text right away.\n     *\n     * See https://github.com/ckeditor/ckeditor5/issues/6053.\n     */\n    _enableInsertContentSelectionAttributesFixer() {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const attributes = this.attributes;\n        this.listenTo(model, 'insertContent', () => {\n            const position = selection.getFirstPosition();\n            if (hasAnyAttribute(selection, attributes) &&\n                isBetweenDifferentAttributes(position, attributes)) {\n                clearSelectionAttributes(model, attributes);\n            }\n        }, { priority: 'low' });\n    }\n    /**\n     * Starts listening to {@link module:engine/model/model~Model#deleteContent} and checks whether\n     * removing a content right after the tow-step attribute.\n     *\n     * If so, the selection should not preserve the two-step attribute. However, if\n     * the {@link module:typing/twostepcaretmovement~TwoStepCaretMovement} plugin is active and\n     * the selection has the two-step attribute due to overridden gravity (at the end), the two-step attribute should stay untouched.\n     *\n     * The purpose of this action is to allow removing the link text and keep the selection outside the link.\n     *\n     * See https://github.com/ckeditor/ckeditor5/issues/7521.\n     */\n    _handleDeleteContentAfterNode() {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const view = editor.editing.view;\n        let isBackspace = false;\n        let shouldPreserveAttributes = false;\n        // Detect pressing `Backspace`.\n        this.listenTo(view.document, 'delete', (evt, data) => {\n            isBackspace = data.direction === 'backward';\n        }, { priority: 'high' });\n        // Before removing the content, check whether the selection is inside a two-step attribute.\n        // If so, we want to preserve those attributes.\n        this.listenTo(model, 'deleteContent', () => {\n            if (!isBackspace) {\n                return;\n            }\n            const position = selection.getFirstPosition();\n            shouldPreserveAttributes = hasAnyAttribute(selection, this.attributes) &&\n                !isStepAfterAnyAttributeBoundary(position, this.attributes);\n        }, { priority: 'high' });\n        // After removing the content, check whether the current selection should preserve the `linkHref` attribute.\n        this.listenTo(model, 'deleteContent', () => {\n            if (!isBackspace) {\n                return;\n            }\n            isBackspace = false;\n            // Do not escape two-step attribute if it was inside it before content deletion.\n            if (shouldPreserveAttributes) {\n                return;\n            }\n            // Use `model.enqueueChange()` in order to execute the callback at the end of the changes process.\n            editor.model.enqueueChange(() => {\n                const position = selection.getFirstPosition();\n                if (hasAnyAttribute(selection, this.attributes) &&\n                    isBetweenDifferentAttributes(position, this.attributes)) {\n                    if (position.isAtStart || isBetweenDifferentAttributes(position, this.attributes, true)) {\n                        clearSelectionAttributes(model, this.attributes);\n                    }\n                    else if (!this._isGravityOverridden) {\n                        this._overrideGravity();\n                    }\n                }\n            });\n        }, { priority: 'low' });\n    }\n    /**\n     * `true` when the gravity is overridden for the plugin.\n     */\n    get _isGravityOverridden() {\n        return !!this._overrideUid;\n    }\n    /**\n     * Overrides the gravity using the {@link module:engine/model/writer~ModelWriter model writer}\n     * and stores the information about this fact in the {@link #_overrideUid}.\n     *\n     * A shorthand for {@link module:engine/model/writer~ModelWriter#overrideSelectionGravity}.\n     */\n    _overrideGravity() {\n        this._overrideUid = this.editor.model.change(writer => {\n            return writer.overrideSelectionGravity();\n        });\n    }\n    /**\n     * Restores the gravity using the {@link module:engine/model/writer~ModelWriter model writer}.\n     *\n     * A shorthand for {@link module:engine/model/writer~ModelWriter#restoreSelectionGravity}.\n     */\n    _restoreGravity() {\n        this.editor.model.change(writer => {\n            writer.restoreSelectionGravity(this._overrideUid);\n            this._overrideUid = null;\n        });\n    }\n}\n/**\n * Checks whether the selection has any of given attributes.\n */\nfunction hasAnyAttribute(selection, attributes) {\n    for (const observedAttribute of attributes) {\n        if (selection.hasAttribute(observedAttribute)) {\n            return true;\n        }\n    }\n    return false;\n}\n/**\n * Applies the given attributes to the current selection using using the\n * values from the node before the current position. Uses\n * the {@link module:engine/model/writer~ModelWriter model writer}.\n */\nfunction setSelectionAttributesFromTheNodeBefore(model, attributes, position) {\n    const nodeBefore = position.nodeBefore;\n    model.change(writer => {\n        if (nodeBefore) {\n            const attributes = [];\n            const isInlineObject = model.schema.isObject(nodeBefore) && model.schema.isInline(nodeBefore);\n            for (const [key, value] of nodeBefore.getAttributes()) {\n                if (model.schema.checkAttribute('$text', key) &&\n                    (!isInlineObject || model.schema.getAttributeProperties(key).copyFromObject !== false)) {\n                    attributes.push([key, value]);\n                }\n            }\n            writer.setSelectionAttribute(attributes);\n        }\n        else {\n            writer.removeSelectionAttribute(attributes);\n        }\n    });\n}\n/**\n * Removes 2-SCM attributes from the selection.\n */\nfunction clearSelectionAttributes(model, attributes) {\n    model.change(writer => {\n        writer.removeSelectionAttribute(attributes);\n    });\n}\n/**\n * Prevents the caret movement in the view by calling `preventDefault` on the event data.\n *\n * @alias data.preventDefault\n */\nfunction preventCaretMovement(data) {\n    data.preventDefault();\n}\n/**\n * Checks whether the step before `isBetweenDifferentAttributes()`.\n */\nfunction isStepAfterAnyAttributeBoundary(position, attributes) {\n    const positionBefore = position.getShiftedBy(-1);\n    return isBetweenDifferentAttributes(positionBefore, attributes);\n}\n/**\n * Checks whether the given position is between different values of given attributes.\n */\nfunction isBetweenDifferentAttributes(position, attributes, isStrict = false) {\n    const { nodeBefore, nodeAfter } = position;\n    for (const observedAttribute of attributes) {\n        const attrBefore = nodeBefore ? nodeBefore.getAttribute(observedAttribute) : undefined;\n        const attrAfter = nodeAfter ? nodeAfter.getAttribute(observedAttribute) : undefined;\n        if (isStrict && (attrBefore === undefined || attrAfter === undefined)) {\n            continue;\n        }\n        if (attrAfter !== attrBefore) {\n            return true;\n        }\n    }\n    return false;\n}\n","function toString(value) {\n    if (value == null) {\n        return '';\n    }\n    if (typeof value === 'string') {\n        return value;\n    }\n    if (Array.isArray(value)) {\n        return value.map(toString).join(',');\n    }\n    const result = String(value);\n    if (result === '0' && Object.is(Number(value), -0)) {\n        return '-0';\n    }\n    return result;\n}\n\nexport { toString };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/texttransformation\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { TextWatcher } from './textwatcher.js';\nimport { escapeRegExp } from 'es-toolkit/compat';\n// All named transformations.\nconst TRANSFORMATIONS = {\n    // Common symbols:\n    copyright: { from: '(c)', to: '©' },\n    registeredTrademark: { from: '(r)', to: '®' },\n    trademark: { from: '(tm)', to: '™' },\n    // Mathematical:\n    oneHalf: { from: /(^|[^/a-z0-9])(1\\/2)([^/a-z0-9])$/i, to: [null, '½', null] },\n    oneThird: { from: /(^|[^/a-z0-9])(1\\/3)([^/a-z0-9])$/i, to: [null, '⅓', null] },\n    twoThirds: { from: /(^|[^/a-z0-9])(2\\/3)([^/a-z0-9])$/i, to: [null, '⅔', null] },\n    oneForth: { from: /(^|[^/a-z0-9])(1\\/4)([^/a-z0-9])$/i, to: [null, '¼', null] },\n    threeQuarters: { from: /(^|[^/a-z0-9])(3\\/4)([^/a-z0-9])$/i, to: [null, '¾', null] },\n    lessThanOrEqual: { from: '<=', to: '≤' },\n    greaterThanOrEqual: { from: '>=', to: '≥' },\n    notEqual: { from: '!=', to: '≠' },\n    arrowLeft: { from: '<-', to: '←' },\n    arrowRight: { from: '->', to: '→' },\n    // Typography:\n    horizontalEllipsis: { from: '...', to: '…' },\n    enDash: { from: /(^| )(--)( )$/, to: [null, '–', null] },\n    emDash: { from: /(^| )(---)( )$/, to: [null, '—', null] },\n    // Quotations:\n    // English, US\n    quotesPrimary: { from: buildQuotesRegExp('\"'), to: [null, '“', null, '”'] },\n    quotesSecondary: { from: buildQuotesRegExp('\\''), to: [null, '‘', null, '’'] },\n    // English, UK\n    quotesPrimaryEnGb: { from: buildQuotesRegExp('\\''), to: [null, '‘', null, '’'] },\n    quotesSecondaryEnGb: { from: buildQuotesRegExp('\"'), to: [null, '“', null, '”'] },\n    // Polish\n    quotesPrimaryPl: { from: buildQuotesRegExp('\"'), to: [null, '„', null, '”'] },\n    quotesSecondaryPl: { from: buildQuotesRegExp('\\''), to: [null, '‚', null, '’'] }\n};\n// Transformation groups.\nconst TRANSFORMATION_GROUPS = {\n    symbols: ['copyright', 'registeredTrademark', 'trademark'],\n    mathematical: [\n        'oneHalf', 'oneThird', 'twoThirds', 'oneForth', 'threeQuarters',\n        'lessThanOrEqual', 'greaterThanOrEqual', 'notEqual',\n        'arrowLeft', 'arrowRight'\n    ],\n    typography: ['horizontalEllipsis', 'enDash', 'emDash'],\n    quotes: ['quotesPrimary', 'quotesSecondary']\n};\n// A set of default transformations provided by the feature.\nconst DEFAULT_TRANSFORMATIONS = [\n    'symbols',\n    'mathematical',\n    'typography',\n    'quotes'\n];\n/**\n * The text transformation plugin.\n */\nexport class TextTransformation extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return ['Delete', 'Input'];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TextTransformation';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('typing', {\n            transformations: {\n                include: DEFAULT_TRANSFORMATIONS\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const model = this.editor.model;\n        const modelSelection = model.document.selection;\n        modelSelection.on('change:range', () => {\n            // Disable plugin when selection is inside a code block.\n            this.isEnabled = !modelSelection.anchor.parent.is('element', 'codeBlock');\n        });\n        this._enableTransformationWatchers();\n    }\n    /**\n     * Create new TextWatcher listening to the editor for typing and selection events.\n     */\n    _enableTransformationWatchers() {\n        const editor = this.editor;\n        const model = editor.model;\n        const deletePlugin = editor.plugins.get('Delete');\n        const normalizedTransformations = normalizeTransformations(editor.config.get('typing.transformations'));\n        const testCallback = (text) => {\n            for (const normalizedTransformation of normalizedTransformations) {\n                const from = normalizedTransformation.from;\n                const match = from.test(text);\n                if (match) {\n                    return { normalizedTransformation };\n                }\n            }\n        };\n        const watcher = new TextWatcher(editor.model, testCallback);\n        watcher.on('matched:data', (evt, data) => {\n            if (!data.batch.isTyping) {\n                return;\n            }\n            const { from, to } = data.normalizedTransformation;\n            const matches = from.exec(data.text);\n            const replaces = to(matches.slice(1));\n            const matchedRange = data.range;\n            let changeIndex = matches.index;\n            model.enqueueChange(writer => {\n                for (let i = 1; i < matches.length; i++) {\n                    const match = matches[i];\n                    const replaceWith = replaces[i - 1];\n                    if (replaceWith == null) {\n                        changeIndex += match.length;\n                        continue;\n                    }\n                    const replacePosition = matchedRange.start.getShiftedBy(changeIndex);\n                    const replaceRange = model.createRange(replacePosition, replacePosition.getShiftedBy(match.length));\n                    const attributes = getTextAttributesAfterPosition(replacePosition);\n                    model.insertContent(writer.createText(replaceWith, attributes), replaceRange);\n                    changeIndex += replaceWith.length;\n                }\n                model.enqueueChange(() => {\n                    deletePlugin.requestUndoOnBackspace();\n                });\n            });\n        });\n        watcher.bind('isEnabled').to(this);\n    }\n}\n/**\n * Normalizes the configuration `from` parameter value.\n * The normalized value for the `from` parameter is a RegExp instance. If the passed `from` is already a RegExp instance,\n * it is returned unchanged.\n */\nfunction normalizeFrom(from) {\n    if (typeof from == 'string') {\n        return new RegExp(`(${escapeRegExp(from)})$`);\n    }\n    // `from` is already a regular expression.\n    return from;\n}\n/**\n * Normalizes the configuration `to` parameter value.\n * The normalized value for the `to` parameter is a function that takes an array and returns an array. See more in the\n * configuration description. If the passed `to` is already a function, it is returned unchanged.\n */\nfunction normalizeTo(to) {\n    if (typeof to == 'string') {\n        return () => [to];\n    }\n    else if (to instanceof Array) {\n        return () => to;\n    }\n    // `to` is already a function.\n    return to;\n}\n/**\n * For given `position` returns attributes for the text that is after that position.\n * The text can be in the same text node as the position (`foo[]bar`) or in the next text node (`foo[]<$text bold=\"true\">bar</$text>`).\n */\nfunction getTextAttributesAfterPosition(position) {\n    const textNode = position.textNode ? position.textNode : position.nodeAfter;\n    return textNode.getAttributes();\n}\n/**\n * Returns a RegExp pattern string that detects a sentence inside a quote.\n *\n * @param quoteCharacter The character to create a pattern for.\n */\nfunction buildQuotesRegExp(quoteCharacter) {\n    return new RegExp(`(^|\\\\s)(${quoteCharacter})([^${quoteCharacter}]*)(${quoteCharacter})$`);\n}\n/**\n * Reads text transformation config and returns normalized array of transformations objects.\n */\nfunction normalizeTransformations(config) {\n    const extra = config.extra || [];\n    const remove = config.remove || [];\n    const isNotRemoved = (transformation) => !remove.includes(transformation);\n    const configured = config.include.concat(extra).filter(isNotRemoved);\n    return expandGroupsAndRemoveDuplicates(configured)\n        .filter(isNotRemoved) // Filter out 'remove' transformations as they might be set in group.\n        .map(transformation => (typeof transformation == 'string' && TRANSFORMATIONS[transformation] ? TRANSFORMATIONS[transformation] : transformation))\n        // Filter out transformations set as string that has not been found.\n        .filter((transformation) => typeof transformation === 'object')\n        .map(transformation => ({\n        from: normalizeFrom(transformation.from),\n        to: normalizeTo(transformation.to)\n    }));\n}\n/**\n * Reads definitions and expands named groups if needed to transformation names.\n * This method also removes duplicated named transformations if any.\n */\nfunction expandGroupsAndRemoveDuplicates(definitions) {\n    // Set is using to make sure that transformation names are not duplicated.\n    const definedTransformations = new Set();\n    for (const transformationOrGroup of definitions) {\n        if (typeof transformationOrGroup == 'string' && TRANSFORMATION_GROUPS[transformationOrGroup]) {\n            for (const transformation of TRANSFORMATION_GROUPS[transformationOrGroup]) {\n                definedTransformations.add(transformation);\n            }\n        }\n        else {\n            definedTransformations.add(transformationOrGroup);\n        }\n    }\n    return Array.from(definedTransformations);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns a model range that covers all consecutive nodes with the same `attributeName` and its `value`\n * that intersect the given `position`.\n *\n * It can be used e.g. to get the entire range on which the `linkHref` attribute needs to be changed when having a\n * selection inside a link.\n *\n * @param position The start position.\n * @param attributeName The attribute name.\n * @param value The attribute value.\n * @param model The model instance.\n * @returns The link range.\n */\nexport function findAttributeRange(position, attributeName, value, model) {\n    return model.createRange(findAttributeRangeBound(position, attributeName, value, true, model), findAttributeRangeBound(position, attributeName, value, false, model));\n}\n/**\n * Walks forward or backward (depends on the `lookBack` flag), node by node, as long as they have the same attribute value\n * and returns a position just before or after (depends on the `lookBack` flag) the last matched node.\n *\n * @param position The start position.\n * @param attributeName The attribute name.\n * @param value The attribute value.\n * @param lookBack Whether the walk direction is forward (`false`) or backward (`true`).\n * @returns The position just before the last matched node.\n */\nexport function findAttributeRangeBound(position, attributeName, value, lookBack, model) {\n    // Get node before or after position (depends on `lookBack` flag).\n    // When position is inside text node then start searching from text node.\n    let node = position.textNode || (lookBack ? position.nodeBefore : position.nodeAfter);\n    let lastNode = null;\n    while (node && node.getAttribute(attributeName) == value) {\n        lastNode = node;\n        node = lookBack ? node.previousSibling : node.nextSibling;\n    }\n    return lastNode ? model.createPositionAt(lastNode, lookBack ? 'before' : 'after') : position;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module typing/utils/inlinehighlight\n */\nimport { findAttributeRange } from './findattributerange.js';\n/**\n * Adds a visual highlight style to an attribute element in which the selection is anchored.\n * Together with two-step caret movement, they indicate that the user is typing inside the element.\n *\n * Highlight is turned on by adding the given class to the attribute element in the view:\n *\n * * The class is removed before the conversion has started, as callbacks added with the `'highest'` priority\n * to {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} events.\n * * The class is added in the view post fixer, after other changes in the model tree were converted to the view.\n *\n * This way, adding and removing the highlight does not interfere with conversion.\n *\n * Usage:\n *\n * ```ts\n * import { inlineHighlight } from '@ckeditor/ckeditor5-typing/src/utils/inlinehighlight';\n *\n * // Make `ck-link_selected` class be applied on an `a` element\n * // whenever the corresponding `linkHref` attribute element is selected.\n * inlineHighlight( editor, 'linkHref', 'a', 'ck-link_selected' );\n * ```\n *\n * @param editor The editor instance.\n * @param attributeName The attribute name to check.\n * @param tagName The tagName of a view item.\n * @param className The class name to apply in the view.\n */\nexport function inlineHighlight(editor, attributeName, tagName, className) {\n    const view = editor.editing.view;\n    const highlightedElements = new Set();\n    // Adding the class.\n    view.document.registerPostFixer(writer => {\n        const selection = editor.model.document.selection;\n        let changed = false;\n        if (selection.hasAttribute(attributeName)) {\n            const modelRange = findAttributeRange(selection.getFirstPosition(), attributeName, selection.getAttribute(attributeName), editor.model);\n            const viewRange = editor.editing.mapper.toViewRange(modelRange);\n            // There might be multiple view elements in the `viewRange`, for example, when the `a` element is\n            // broken by a UIElement.\n            for (const item of viewRange.getItems()) {\n                if (item.is('element', tagName) && !item.hasClass(className)) {\n                    writer.addClass(className, item);\n                    highlightedElements.add(item);\n                    changed = true;\n                }\n            }\n        }\n        return changed;\n    });\n    // Removing the class.\n    editor.conversion.for('editingDowncast').add(dispatcher => {\n        // Make sure the highlight is removed on every possible event, before conversion is started.\n        dispatcher.on('insert', removeHighlight, { priority: 'highest' });\n        dispatcher.on('remove', removeHighlight, { priority: 'highest' });\n        dispatcher.on('attribute', removeHighlight, { priority: 'highest' });\n        dispatcher.on('selection', removeHighlight, { priority: 'highest' });\n        function removeHighlight() {\n            view.change(writer => {\n                for (const item of highlightedElements.values()) {\n                    writer.removeClass(className, item);\n                    highlightedElements.delete(item);\n                }\n            });\n        }\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns attributes that should be preserved on the enter keystroke.\n *\n * Filtering is realized based on `copyOnEnter` attribute property. Read more about attribute properties\n * {@link module:engine/model/schema~ModelSchema#setAttributeProperties here}.\n *\n * @param schema Model's schema.\n * @param allAttributes Attributes to filter.\n * @internal\n */\nexport function* getCopyOnEnterAttributes(schema, allAttributes) {\n    for (const attribute of allAttributes) {\n        if (attribute && schema.getAttributeProperties(attribute[0]).copyOnEnter) {\n            yield attribute;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module enter/entercommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\nimport { getCopyOnEnterAttributes } from './utils.js';\n/**\n * Enter command used by the {@link module:enter/enter~Enter Enter feature} to handle the <kbd>Enter</kbd> keystroke.\n */\nexport class EnterCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        this.editor.model.change(writer => {\n            this.enterBlock(writer);\n            this.fire('afterExecute', { writer });\n        });\n    }\n    /**\n     * Splits a block where the document selection is placed, in the way how the <kbd>Enter</kbd> key is expected to work:\n     *\n     * ```\n     * <p>Foo[]bar</p>   ->   <p>Foo</p><p>[]bar</p>\n     * <p>Foobar[]</p>   ->   <p>Foobar</p><p>[]</p>\n     * <p>Fo[ob]ar</p>   ->   <p>Fo</p><p>[]ar</p>\n     * ```\n     *\n     * In some cases, the split will not happen:\n     *\n     * ```\n     * // The selection parent is a limit element:\n     * <figcaption>A[bc]d</figcaption>   ->   <figcaption>A[]d</figcaption>\n     *\n     * // The selection spans over multiple elements:\n     * <h>x[x</h><p>y]y<p>   ->   <h>x</h><p>[]y</p>\n     * ```\n     *\n     * @param writer Writer to use when performing the enter action.\n     * @returns Boolean indicating if the block was split.\n     */\n    enterBlock(writer) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const schema = model.schema;\n        const isSelectionEmpty = selection.isCollapsed;\n        const range = selection.getFirstRange();\n        const startElement = range.start.parent;\n        const endElement = range.end.parent;\n        // Don't touch the roots and other limit elements.\n        if (schema.isLimit(startElement) || schema.isLimit(endElement)) {\n            // Delete the selected content but only if inside a single limit element.\n            // Abort, when crossing limit elements boundary (e.g. <limit1>x[x</limit1>donttouchme<limit2>y]y</limit2>).\n            // This is an edge case and it's hard to tell what should actually happen because such a selection\n            // is not entirely valid.\n            if (!isSelectionEmpty && startElement == endElement) {\n                model.deleteContent(selection);\n            }\n            return false;\n        }\n        if (isSelectionEmpty) {\n            const attributesToCopy = getCopyOnEnterAttributes(writer.model.schema, selection.getAttributes());\n            splitBlock(writer, range.start);\n            writer.setSelectionAttribute(attributesToCopy);\n            return true;\n        }\n        else {\n            const leaveUnmerged = !(range.start.isAtStart && range.end.isAtEnd);\n            const isContainedWithinOneElement = (startElement == endElement);\n            model.deleteContent(selection, { leaveUnmerged });\n            if (leaveUnmerged) {\n                // Partially selected elements.\n                //\n                // <h>x[xx]x</h>\t\t-> <h>x^x</h>\t\t\t-> <h>x</h><h>^x</h>\n                if (isContainedWithinOneElement) {\n                    splitBlock(writer, selection.focus);\n                    return true;\n                }\n                // Selection over multiple elements.\n                //\n                // <h>x[x</h><p>y]y<p>\t-> <h>x^</h><p>y</p>\t-> <h>x</h><p>^y</p>\n                else {\n                    writer.setSelection(endElement, 0);\n                }\n            }\n        }\n        return false;\n    }\n}\nfunction splitBlock(writer, splitPos) {\n    writer.split(splitPos);\n    writer.setSelection(splitPos.parent.nextSibling, 0);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module enter/enterobserver\n */\nimport { Observer, ViewDocumentDomEventData, BubblingEventInfo } from '@ckeditor/ckeditor5-engine';\nimport { env } from '@ckeditor/ckeditor5-utils';\nconst ENTER_EVENT_TYPES = {\n    insertParagraph: { isSoft: false },\n    insertLineBreak: { isSoft: true }\n};\n/**\n * Enter observer introduces the {@link module:engine/view/document~ViewDocument#event:enter `Document#enter`} event.\n */\nexport class EnterObserver extends Observer {\n    /**\n     * @inheritDoc\n     */\n    constructor(view) {\n        super(view);\n        const doc = this.document;\n        let shiftPressed = false;\n        doc.on('keydown', (evt, data) => {\n            shiftPressed = data.shiftKey;\n        });\n        doc.on('beforeinput', (evt, data) => {\n            if (!this.isEnabled) {\n                return;\n            }\n            let inputType = data.inputType;\n            // See https://github.com/ckeditor/ckeditor5/issues/13321.\n            if (env.isSafari && shiftPressed && inputType == 'insertParagraph') {\n                inputType = 'insertLineBreak';\n            }\n            const domEvent = data.domEvent;\n            const enterEventSpec = ENTER_EVENT_TYPES[inputType];\n            if (!enterEventSpec) {\n                return;\n            }\n            const event = new BubblingEventInfo(doc, 'enter', data.targetRanges[0]);\n            doc.fire(event, new ViewDocumentDomEventData(view, domEvent, {\n                isSoft: enterEventSpec.isSoft\n            }));\n            // Stop `beforeinput` event if `enter` event was stopped.\n            // https://github.com/ckeditor/ckeditor5/issues/753\n            if (event.stop.called) {\n                evt.stop();\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    observe() { }\n    /**\n     * @inheritDoc\n     */\n    stopObserving() { }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module enter/enter\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { EnterCommand } from './entercommand.js';\nimport { EnterObserver } from './enterobserver.js';\n/**\n * This plugin handles the <kbd>Enter</kbd> keystroke (hard line break) in the editor.\n *\n * See also the {@link module:enter/shiftenter~ShiftEnter} plugin.\n *\n * For more information about this feature see the {@glink api/enter package page}.\n */\nexport class Enter extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Enter';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    init() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const t = this.editor.t;\n        view.addObserver(EnterObserver);\n        editor.commands.add('enter', new EnterCommand(editor));\n        this.listenTo(viewDocument, 'enter', (evt, data) => {\n            // When not in composition, we handle the action, so prevent the default one.\n            // When in composition, it's the browser who modify the DOM (renderer is disabled).\n            if (!viewDocument.isComposing) {\n                data.preventDefault();\n            }\n            // The soft enter key is handled by the ShiftEnter plugin.\n            if (data.isSoft) {\n                return;\n            }\n            editor.execute('enter');\n            view.scrollToTheSelection();\n        }, { priority: 'low' });\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Insert a hard break (a new paragraph)'),\n                    keystroke: 'Enter'\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module enter/shiftentercommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\nimport { getCopyOnEnterAttributes } from './utils.js';\n/**\n * ShiftEnter command. It is used by the {@link module:enter/shiftenter~ShiftEnter ShiftEnter feature} to handle\n * the <kbd>Shift</kbd>+<kbd>Enter</kbd> keystroke.\n */\nexport class ShiftEnterCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const model = this.editor.model;\n        const doc = model.document;\n        model.change(writer => {\n            softBreakAction(model, writer, doc.selection);\n            this.fire('afterExecute', { writer });\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const doc = model.document;\n        this.isEnabled = isEnabled(model.schema, doc.selection);\n    }\n}\n/**\n * Checks whether the ShiftEnter command should be enabled in the specified selection.\n */\nfunction isEnabled(schema, selection) {\n    // At this moment it is okay to support single range selections only.\n    // But in the future we may need to change that.\n    if (selection.rangeCount > 1) {\n        return false;\n    }\n    const anchorPos = selection.anchor;\n    // Check whether the break element can be inserted in the current selection anchor.\n    if (!anchorPos || !schema.checkChild(anchorPos, 'softBreak')) {\n        return false;\n    }\n    const range = selection.getFirstRange();\n    const startElement = range.start.parent;\n    const endElement = range.end.parent;\n    // Do not modify the content if selection is cross-limit elements.\n    if ((isInsideLimitElement(startElement, schema) || isInsideLimitElement(endElement, schema)) && startElement !== endElement) {\n        return false;\n    }\n    return true;\n}\n/**\n * Creates a break in the way that the <kbd>Shift</kbd>+<kbd>Enter</kbd> keystroke is expected to work.\n */\nfunction softBreakAction(model, writer, selection) {\n    const isSelectionEmpty = selection.isCollapsed;\n    const range = selection.getFirstRange();\n    const startElement = range.start.parent;\n    const endElement = range.end.parent;\n    const isContainedWithinOneElement = (startElement == endElement);\n    if (isSelectionEmpty) {\n        const attributesToCopy = getCopyOnEnterAttributes(model.schema, selection.getAttributes());\n        insertBreak(model, writer, range.end);\n        writer.removeSelectionAttribute(selection.getAttributeKeys());\n        writer.setSelectionAttribute(attributesToCopy);\n    }\n    else {\n        const leaveUnmerged = !(range.start.isAtStart && range.end.isAtEnd);\n        model.deleteContent(selection, { leaveUnmerged });\n        // Selection within one element:\n        //\n        // <h>x[xx]x</h>\t\t-> <h>x^x</h>\t\t\t-> <h>x<br>^x</h>\n        if (isContainedWithinOneElement) {\n            insertBreak(model, writer, selection.focus);\n        }\n        // Selection over multiple elements.\n        //\n        // <h>x[x</h><p>y]y<p>\t-> <h>x^</h><p>y</p>\t-> <h>x</h><p>^y</p>\n        //\n        // We chose not to insert a line break in this case because:\n        //\n        // * it's not a very common scenario,\n        // * it actually surprised me when I saw the \"expected behavior\" in real life.\n        //\n        // It's ok if the user will need to be more specific where they want the <br> to be inserted.\n        else {\n            // Move the selection to the 2nd element (last step of the example above).\n            if (leaveUnmerged) {\n                writer.setSelection(endElement, 0);\n            }\n        }\n    }\n}\nfunction insertBreak(model, writer, position) {\n    const breakLineElement = writer.createElement('softBreak');\n    model.insertContent(breakLineElement, position);\n    writer.setSelection(breakLineElement, 'after');\n}\n/**\n * Checks whether the specified `element` is a child of the limit element.\n *\n * Checking whether the `<p>` element is inside a limit element:\n *   - `<$root><p>Text.</p></$root> => false`\n *   - `<$root><limitElement><p>Text</p></limitElement></$root> => true`\n */\nfunction isInsideLimitElement(element, schema) {\n    // `$root` is a limit element but in this case is an invalid element.\n    if (element.is('rootElement')) {\n        return false;\n    }\n    return schema.isLimit(element) || isInsideLimitElement(element.parent, schema);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module enter/shiftenter\n */\nimport { ShiftEnterCommand } from './shiftentercommand.js';\nimport { EnterObserver } from './enterobserver.js';\nimport { Plugin } from '@ckeditor/ckeditor5-core';\n/**\n * This plugin handles the <kbd>Shift</kbd>+<kbd>Enter</kbd> keystroke (soft line break) in the editor.\n *\n * See also the {@link module:enter/enter~Enter} plugin.\n *\n * For more information about this feature see the {@glink api/enter package page}.\n */\nexport class ShiftEnter extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ShiftEnter';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const t = this.editor.t;\n        // Configure the schema.\n        schema.register('softBreak', {\n            allowWhere: '$text',\n            isInline: true\n        });\n        // Configure converters.\n        conversion.for('upcast')\n            .elementToElement({\n            model: 'softBreak',\n            view: 'br'\n        });\n        conversion.for('downcast')\n            .elementToElement({\n            model: 'softBreak',\n            view: (modelElement, { writer }) => writer.createEmptyElement('br')\n        });\n        view.addObserver(EnterObserver);\n        editor.commands.add('shiftEnter', new ShiftEnterCommand(editor));\n        this.listenTo(viewDocument, 'enter', (evt, data) => {\n            // When not in composition, we handle the action, so prevent the default one.\n            // When in composition, it's the browser who modify the DOM (renderer is disabled).\n            if (!viewDocument.isComposing) {\n                data.preventDefault();\n            }\n            // The hard enter key is handled by the Enter plugin.\n            if (!data.isSoft) {\n                return;\n            }\n            editor.execute('shiftEnter');\n            view.scrollToTheSelection();\n        }, { priority: 'low' });\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Insert a soft break (a <code>&lt;br&gt;</code> element)'),\n                    keystroke: 'Shift+Enter'\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/highlightstack\n */\nimport { EmitterMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Class used to handle the correct order of highlights on elements.\n *\n * When different highlights are applied to same element the correct order should be preserved:\n *\n * * highlight with highest priority should be applied,\n * * if two highlights have same priority - sort by CSS class provided in\n * {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor}.\n *\n * This way, highlight will be applied with the same rules it is applied on texts.\n */\nexport class WidgetHighlightStack extends /* #__PURE__ */ EmitterMixin() {\n    _stack = [];\n    /**\n     * Adds highlight descriptor to the stack.\n     *\n     * @fires change:top\n     */\n    add(descriptor, writer) {\n        const stack = this._stack;\n        // Save top descriptor and insert new one. If top is changed - fire event.\n        const oldTop = stack[0];\n        this._insertDescriptor(descriptor);\n        const newTop = stack[0];\n        // When new object is at the top and stores different information.\n        if (oldTop !== newTop && !compareDescriptors(oldTop, newTop)) {\n            this.fire('change:top', {\n                oldDescriptor: oldTop,\n                newDescriptor: newTop,\n                writer\n            });\n        }\n    }\n    /**\n     * Removes highlight descriptor from the stack.\n     *\n     * @fires change:top\n     * @param id Id of the descriptor to remove.\n     */\n    remove(id, writer) {\n        const stack = this._stack;\n        const oldTop = stack[0];\n        this._removeDescriptor(id);\n        const newTop = stack[0];\n        // When new object is at the top and stores different information.\n        if (oldTop !== newTop && !compareDescriptors(oldTop, newTop)) {\n            this.fire('change:top', {\n                oldDescriptor: oldTop,\n                newDescriptor: newTop,\n                writer\n            });\n        }\n    }\n    /**\n     * Inserts a given descriptor in correct place in the stack. It also takes care about updating information\n     * when descriptor with same id is already present.\n     */\n    _insertDescriptor(descriptor) {\n        const stack = this._stack;\n        const index = stack.findIndex(item => item.id === descriptor.id);\n        // Inserting exact same descriptor - do nothing.\n        if (compareDescriptors(descriptor, stack[index])) {\n            return;\n        }\n        // If descriptor with same id but with different information is on the stack - remove it.\n        if (index > -1) {\n            stack.splice(index, 1);\n        }\n        // Find correct place to insert descriptor in the stack.\n        // It has different information (for example priority) so it must be re-inserted in correct place.\n        let i = 0;\n        while (stack[i] && shouldABeBeforeB(stack[i], descriptor)) {\n            i++;\n        }\n        stack.splice(i, 0, descriptor);\n    }\n    /**\n     * Removes descriptor with given id from the stack.\n     *\n     * @param id Descriptor's id.\n     */\n    _removeDescriptor(id) {\n        const stack = this._stack;\n        const index = stack.findIndex(item => item.id === id);\n        // If descriptor with same id is on the list - remove it.\n        if (index > -1) {\n            stack.splice(index, 1);\n        }\n    }\n}\n/**\n * Compares two descriptors by checking their priority and class list.\n *\n * @returns Returns true if both descriptors are defined and have same priority and classes.\n */\nfunction compareDescriptors(a, b) {\n    return a && b && a.priority == b.priority && classesToString(a.classes) == classesToString(b.classes);\n}\n/**\n * Checks whenever first descriptor should be placed in the stack before second one.\n */\nfunction shouldABeBeforeB(a, b) {\n    if (a.priority > b.priority) {\n        return true;\n    }\n    else if (a.priority < b.priority) {\n        return false;\n    }\n    // When priorities are equal and names are different - use classes to compare.\n    return classesToString(a.classes) > classesToString(b.classes);\n}\n/**\n * Converts CSS classes passed with {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor} to\n * sorted string.\n */\nfunction classesToString(classes) {\n    return Array.isArray(classes) ? classes.sort().join(',') : classes;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/utils\n */\nimport { IconDragHandle } from '@ckeditor/ckeditor5-icons';\nimport { Rect, CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';\nimport { IconView } from '@ckeditor/ckeditor5-ui';\nimport { WidgetHighlightStack } from './highlightstack.js';\nimport { getTypeAroundFakeCaretPosition } from './widgettypearound/utils.js';\n/**\n * CSS class added to each widget element.\n */\nexport const WIDGET_CLASS_NAME = 'ck-widget';\n/**\n * CSS class added to currently selected widget element.\n */\nexport const WIDGET_SELECTED_CLASS_NAME = 'ck-widget_selected';\n/**\n * Returns `true` if given {@link module:engine/view/node~ViewNode} is an {@link module:engine/view/element~ViewElement} and a widget.\n */\nexport function isWidget(node) {\n    if (!node.is('element')) {\n        return false;\n    }\n    return !!node.getCustomProperty('widget');\n}\n/**\n * Converts the given {@link module:engine/view/element~ViewElement} to a widget in the following way:\n *\n * * sets the `contenteditable` attribute to `\"false\"`,\n * * adds the `ck-widget` CSS class,\n * * adds a custom {@link module:engine/view/element~ViewElement#getFillerOffset `getFillerOffset()`} method returning `null`,\n * * adds a custom property allowing to recognize widget elements by using {@link ~isWidget `isWidget()`},\n * * implements the {@link ~setHighlightHandling view highlight on widgets}.\n *\n * This function needs to be used in conjunction with\n * {@link module:engine/conversion/downcasthelpers~DowncastHelpers downcast conversion helpers}\n * like {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToElement `elementToElement()`}.\n * Moreover, typically you will want to use `toWidget()` only for `editingDowncast`, while keeping the `dataDowncast` clean.\n *\n * For example, in order to convert a `<widget>` model element to `<div class=\"widget\">` in the view, you can define\n * such converters:\n *\n * ```ts\n * editor.conversion.for( 'editingDowncast' )\n * \t.elementToElement( {\n * \t\tmodel: 'widget',\n * \t\tview: ( modelItem, { writer } ) => {\n * \t\t\tconst div = writer.createContainerElement( 'div', { class: 'widget' } );\n *\n * \t\t\treturn toWidget( div, writer, { label: 'some widget' } );\n * \t\t}\n * \t} );\n *\n * editor.conversion.for( 'dataDowncast' )\n * \t.elementToElement( {\n * \t\tmodel: 'widget',\n * \t\tview: ( modelItem, { writer } ) => {\n * \t\t\treturn writer.createContainerElement( 'div', { class: 'widget' } );\n * \t\t}\n * \t} );\n * ```\n *\n * See the full source code of the widget (with a nested editable) schema definition and converters in\n * [this sample](https://github.com/ckeditor/ckeditor5-widget/blob/master/tests/manual/widget-with-nestededitable.js).\n *\n * @param options Additional options.\n * @param options.label Element's label provided to the {@link ~setLabel} function. It can be passed as\n * a plain string or a function returning a string. It represents the widget for assistive technologies (like screen readers).\n * @param options.hasSelectionHandle If `true`, the widget will have a selection handle added.\n * @returns Returns the same element.\n */\nexport function toWidget(element, writer, options = {}) {\n    if (!element.is('containerElement')) {\n        /**\n         * The element passed to `toWidget()` must be a {@link module:engine/view/containerelement~ViewContainerElement}\n         * instance.\n         *\n         * @error widget-to-widget-wrong-element-type\n         * @param {any} element The view element passed to `toWidget()`.\n         */\n        throw new CKEditorError('widget-to-widget-wrong-element-type', null, { element });\n    }\n    writer.setAttribute('contenteditable', 'false', element);\n    writer.addClass(WIDGET_CLASS_NAME, element);\n    writer.setCustomProperty('widget', true, element);\n    element.getFillerOffset = getFillerOffset;\n    writer.setCustomProperty('widgetLabel', [], element);\n    if (options.label) {\n        setLabel(element, options.label);\n    }\n    if (options.hasSelectionHandle) {\n        addSelectionHandle(element, writer);\n    }\n    setHighlightHandling(element, writer);\n    return element;\n}\n/**\n * Default handler for adding a highlight on a widget.\n * It adds CSS class and attributes basing on the given highlight descriptor.\n */\nfunction addHighlight(element, descriptor, writer) {\n    if (descriptor.classes) {\n        writer.addClass(toArray(descriptor.classes), element);\n    }\n    if (descriptor.attributes) {\n        for (const key in descriptor.attributes) {\n            writer.setAttribute(key, descriptor.attributes[key], element);\n        }\n    }\n}\n/**\n * Default handler for removing a highlight from a widget.\n * It removes CSS class and attributes basing on the given highlight descriptor.\n */\nfunction removeHighlight(element, descriptor, writer) {\n    if (descriptor.classes) {\n        writer.removeClass(toArray(descriptor.classes), element);\n    }\n    if (descriptor.attributes) {\n        for (const key in descriptor.attributes) {\n            writer.removeAttribute(key, element);\n        }\n    }\n}\n/**\n * Sets highlight handling methods. Uses {@link module:widget/highlightstack~WidgetHighlightStack} to\n * properly determine which highlight descriptor should be used at given time.\n */\nexport function setHighlightHandling(element, writer, add = addHighlight, remove = removeHighlight) {\n    const stack = new WidgetHighlightStack();\n    stack.on('change:top', (evt, data) => {\n        if (data.oldDescriptor) {\n            remove(element, data.oldDescriptor, data.writer);\n        }\n        if (data.newDescriptor) {\n            add(element, data.newDescriptor, data.writer);\n        }\n    });\n    const addHighlightCallback = (element, descriptor, writer) => stack.add(descriptor, writer);\n    const removeHighlightCallback = (element, id, writer) => stack.remove(id, writer);\n    writer.setCustomProperty('addHighlight', addHighlightCallback, element);\n    writer.setCustomProperty('removeHighlight', removeHighlightCallback, element);\n}\n/**\n * Sets label for given element.\n * It can be passed as a plain string or a function returning a string. Function will be called each time label is retrieved by\n * {@link ~getLabel `getLabel()`}.\n */\nexport function setLabel(element, labelOrCreator) {\n    const widgetLabel = element.getCustomProperty('widgetLabel');\n    widgetLabel.push(labelOrCreator);\n}\n/**\n * Returns the label of the provided element.\n */\nexport function getLabel(element) {\n    const widgetLabel = element.getCustomProperty('widgetLabel');\n    return widgetLabel.reduce((prev, current) => {\n        if (typeof current === 'function') {\n            return prev ? prev + '. ' + current() : current();\n        }\n        else {\n            return prev ? prev + '. ' + current : current;\n        }\n    }, '');\n}\n/**\n * Adds functionality to the provided {@link module:engine/view/editableelement~ViewEditableElement} to act as a widget's editable:\n *\n * * sets the `contenteditable` attribute to `true` when\n * {@link module:engine/view/editableelement~ViewEditableElement#isReadOnly} is `false`,\n * otherwise sets it to `false`,\n * * adds the `ck-editor__editable` and `ck-editor__nested-editable` CSS classes,\n * * adds the `ck-editor__nested-editable_focused` CSS class when the editable is focused and removes it when it is blurred.\n * * implements the {@link ~setHighlightHandling view highlight on widget's editable}.\n * * sets the `role` attribute to `textbox` for accessibility purposes.\n *\n * Similarly to {@link ~toWidget `toWidget()`} this function should be used in `editingDowncast` only and it is usually\n * used together with {@link module:engine/conversion/downcasthelpers~DowncastHelpers#elementToElement `elementToElement()`}.\n *\n * For example, in order to convert a `<nested>` model element to `<div class=\"nested\">` in the view, you can define\n * such converters:\n *\n * ```ts\n * editor.conversion.for( 'editingDowncast' )\n * \t.elementToElement( {\n * \t\tmodel: 'nested',\n * \t\tview: ( modelItem, { writer } ) => {\n * \t\t\tconst div = writer.createEditableElement( 'div', { class: 'nested' } );\n *\n * \t\t\treturn toWidgetEditable( nested, writer, { label: 'label for editable' } );\n * \t\t}\n * \t} );\n *\n * editor.conversion.for( 'dataDowncast' )\n * \t.elementToElement( {\n * \t\tmodel: 'nested',\n * \t\tview: ( modelItem, { writer } ) => {\n * \t\t\treturn writer.createContainerElement( 'div', { class: 'nested' } );\n * \t\t}\n * \t} );\n * ```\n *\n * See the full source code of the widget (with nested editable) schema definition and converters in\n * [this sample](https://github.com/ckeditor/ckeditor5-widget/blob/master/tests/manual/widget-with-nestededitable.js).\n *\n * @param options Additional options.\n * @param options.label Editable's label used by assistive technologies (e.g. screen readers).\n * @param options.withAriaRole Whether to add the role=\"textbox\" attribute on the editable. Defaults to `true`.\n * @returns Returns the same element that was provided in the `editable` parameter\n */\nexport function toWidgetEditable(editable, writer, options = {}) {\n    writer.addClass(['ck-editor__editable', 'ck-editor__nested-editable'], editable);\n    // Set role=\"textbox\" only if explicitly requested (defaults to true for backward compatibility).\n    if (options.withAriaRole !== false) {\n        writer.setAttribute('role', 'textbox', editable);\n    }\n    // Setting tabindex=-1 on contenteditable=false makes it focusable. It propagates focus to the editable\n    // element and makes it possible to highlight nested editables as focused. It's not what we want\n    // for read-only editables though.\n    // See more: https://github.com/ckeditor/ckeditor5/issues/18965\n    if (!editable.isReadOnly) {\n        writer.setAttribute('tabindex', '-1', editable);\n    }\n    if (options.label) {\n        writer.setAttribute('aria-label', options.label, editable);\n    }\n    // Set initial contenteditable value.\n    writer.setAttribute('contenteditable', editable.isReadOnly ? 'false' : 'true', editable);\n    // Bind the contenteditable property to element#isReadOnly.\n    editable.on('change:isReadOnly', (evt, property, isReadonly) => {\n        writer.setAttribute('contenteditable', isReadonly ? 'false' : 'true', editable);\n        if (isReadonly) {\n            writer.removeAttribute('tabindex', editable);\n        }\n        else {\n            writer.setAttribute('tabindex', '-1', editable);\n        }\n    });\n    editable.on('change:isFocused', (evt, property, is) => {\n        if (is) {\n            writer.addClass('ck-editor__nested-editable_focused', editable);\n        }\n        else {\n            writer.removeClass('ck-editor__nested-editable_focused', editable);\n        }\n    });\n    setHighlightHandling(editable, writer);\n    return editable;\n}\n/**\n * Returns a model range which is optimal (in terms of UX) for inserting a widget block.\n *\n * For instance, if a selection is in the middle of a paragraph, the collapsed range before this paragraph\n * will be returned so that it is not split. If the selection is at the end of a paragraph,\n * the collapsed range after this paragraph will be returned.\n *\n * Note: If the selection is placed in an empty block, the range in that block will be returned. If that range\n * is then passed to {@link module:engine/model/model~Model#insertContent}, the block will be fully replaced\n * by the inserted widget block.\n *\n * @param selection The selection based on which the insertion position should be calculated.\n * @param model Model instance.\n * @returns The optimal range.\n */\nexport function findOptimalInsertionRange(selection, model) {\n    const selectedElement = selection.getSelectedElement();\n    if (selectedElement) {\n        const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(selection);\n        // If the WidgetTypeAround \"fake caret\" is displayed, use its position for the insertion\n        // to provide the most predictable UX (https://github.com/ckeditor/ckeditor5/issues/7438).\n        if (typeAroundFakeCaretPosition) {\n            return model.createRange(model.createPositionAt(selectedElement, typeAroundFakeCaretPosition));\n        }\n    }\n    return model.schema.findOptimalInsertionRange(selection);\n}\n/**\n * A util to be used in order to map view positions to correct model positions when implementing a widget\n * which renders non-empty view element for an empty model element.\n *\n * For example:\n *\n * ```\n * // Model:\n * <placeholder type=\"name\"></placeholder>\n *\n * // View:\n * <span class=\"placeholder\">name</span>\n * ```\n *\n * In such case, view positions inside `<span>` cannot be correctly mapped to the model (because the model element is empty).\n * To handle mapping positions inside `<span class=\"placeholder\">` to the model use this util as follows:\n *\n * ```ts\n * editor.editing.mapper.on(\n * \t'viewToModelPosition',\n * \tviewToModelPositionOutsideModelElement( model, viewElement => viewElement.hasClass( 'placeholder' ) )\n * );\n * ```\n *\n * The callback will try to map the view offset of selection to an expected model position.\n *\n * 1. When the position is at the end (or in the middle) of the inline widget:\n *\n * ```\n * // View:\n * <p>foo <span class=\"placeholder\">name|</span> bar</p>\n *\n * // Model:\n * <paragraph>foo <placeholder type=\"name\"></placeholder>| bar</paragraph>\n * ```\n *\n * 2. When the position is at the beginning of the inline widget:\n *\n * ```\n * // View:\n * <p>foo <span class=\"placeholder\">|name</span> bar</p>\n *\n * // Model:\n * <paragraph>foo |<placeholder type=\"name\"></placeholder> bar</paragraph>\n * ```\n *\n * @param model Model instance on which the callback operates.\n * @param viewElementMatcher Function that is passed a view element and should return `true` if the custom mapping\n * should be applied to the given view element.\n */\nexport function viewToModelPositionOutsideModelElement(model, viewElementMatcher) {\n    return (evt, data) => {\n        const { mapper, viewPosition } = data;\n        const viewParent = mapper.findMappedViewAncestor(viewPosition);\n        if (!viewElementMatcher(viewParent)) {\n            return;\n        }\n        const modelParent = mapper.toModelElement(viewParent);\n        data.modelPosition = model.createPositionAt(modelParent, viewPosition.isAtStart ? 'before' : 'after');\n    };\n}\n/**\n * Default filler offset function applied to all widget elements.\n */\nfunction getFillerOffset() {\n    return null;\n}\n/**\n * Adds a drag handle to the widget.\n */\nfunction addSelectionHandle(widgetElement, writer) {\n    const selectionHandle = writer.createUIElement('div', { class: 'ck ck-widget__selection-handle' }, function (domDocument) {\n        const domElement = this.toDomElement(domDocument);\n        // Use the IconView from the ui library.\n        const icon = new IconView();\n        icon.set('content', IconDragHandle);\n        // Render the icon view right away to append its #element to the selectionHandle DOM element.\n        icon.render();\n        domElement.appendChild(icon.element);\n        return domElement;\n    });\n    // Append the selection handle into the widget wrapper.\n    writer.insert(writer.createPositionAt(widgetElement, 0), selectionHandle);\n    writer.addClass(['ck-widget_with-selection-handle'], widgetElement);\n}\n/**\n * Starting from a DOM resize host element (an element that receives dimensions as a result of resizing),\n * this helper returns the width of the found ancestor element.\n *\n *\t* It searches up to 5 levels of ancestors only.\n *\n * @param domResizeHost Resize host DOM element that receives dimensions as a result of resizing.\n * @returns Width of ancestor element in pixels or 0 if no ancestor with a computed width has been found.\n */\nexport function calculateResizeHostAncestorWidth(domResizeHost) {\n    const getElementComputedWidth = (element) => {\n        const { width, paddingLeft, paddingRight } = element.ownerDocument.defaultView.getComputedStyle(element);\n        return parseFloat(width) - (parseFloat(paddingLeft) || 0) - (parseFloat(paddingRight) || 0);\n    };\n    const domResizeHostParent = domResizeHost.parentElement;\n    if (!domResizeHostParent) {\n        return 0;\n    }\n    // Need to use computed style as it properly excludes parent's paddings from the returned value.\n    let parentWidth = getElementComputedWidth(domResizeHostParent);\n    // Sometimes parent width cannot be accessed. If that happens we should go up in the elements tree\n    // and try to get width from next ancestor.\n    // https://github.com/ckeditor/ckeditor5/issues/10776\n    const ancestorLevelLimit = 5;\n    let currentLevel = 0;\n    let checkedElement = domResizeHostParent;\n    while (isNaN(parentWidth)) {\n        checkedElement = checkedElement.parentElement;\n        if (++currentLevel > ancestorLevelLimit) {\n            return 0;\n        }\n        parentWidth = getElementComputedWidth(checkedElement);\n    }\n    return parentWidth;\n}\n/**\n * Calculates a relative width of a `domResizeHost` compared to its ancestor in percents.\n *\n * @param domResizeHost Resize host DOM element.\n * @returns Percentage value between 0 and 100.\n */\nexport function calculateResizeHostPercentageWidth(domResizeHost, resizeHostRect = new Rect(domResizeHost)) {\n    const parentWidth = calculateResizeHostAncestorWidth(domResizeHost);\n    if (!parentWidth) {\n        return 0;\n    }\n    return resizeHostRect.width / parentWidth * 100;\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 16 16\\\"><path d=\\\"M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5z\\\"/><path fill-opacity=\\\".256\\\" d=\\\"M1 1h14v14H1z\\\"/><g class=\\\"ck-icon__selected-indicator\\\"><path d=\\\"M7 0h2v1H7zM0 7h1v2H0zm15 0h1v2h-1zm-8 8h2v1H7z\\\"/><path fill-opacity=\\\".254\\\" d=\\\"M1 1h14v14H1z\\\"/></g></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgettypearound/utils\n */\nimport { isWidget } from '../utils.js';\n/**\n * The name of the type around model selection attribute responsible for\n * displaying a fake caret next to a selected widget.\n *\n * @internal\n */\nexport const TYPE_AROUND_SELECTION_ATTRIBUTE = 'widget-type-around';\n/**\n * Checks if an element is a widget that qualifies to get the widget type around UI.\n */\nexport function isTypeAroundWidget(viewElement, modelElement, schema) {\n    return !!viewElement && isWidget(viewElement) && !schema.isInline(modelElement);\n}\n/**\n * For the passed HTML element, this helper finds the closest widget type around button ancestor.\n *\n * @internal\n */\nexport function getClosestTypeAroundDomButton(domElement) {\n    return domElement.closest('.ck-widget__type-around__button');\n}\n/**\n * For the passed widget type around button element, this helper determines at which position\n * the paragraph would be inserted into the content if, for instance, the button was\n * clicked by the user.\n *\n * @internal\n * @returns The position of the button.\n */\nexport function getTypeAroundButtonPosition(domElement) {\n    return domElement.classList.contains('ck-widget__type-around__button_before') ? 'before' : 'after';\n}\n/**\n * For the passed HTML element, this helper returns the closest view widget ancestor.\n *\n * @internal\n */\nexport function getClosestWidgetViewElement(domElement, domConverter) {\n    const widgetDomElement = domElement.closest('.ck-widget');\n    return domConverter.mapDomToView(widgetDomElement);\n}\n/**\n * For the passed selection instance, it returns the position of the fake caret displayed next to a widget.\n *\n * **Note**: If the fake caret is not currently displayed, `null` is returned.\n *\n * @internal\n * @returns The position of the fake caret or `null` when none is present.\n */\nexport function getTypeAroundFakeCaretPosition(selection) {\n    return selection.getAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgettypearound/widgettypearound\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { IconReturnArrow } from '@ckeditor/ckeditor5-icons';\nimport { Template } from '@ckeditor/ckeditor5-ui';\nimport { Enter } from '@ckeditor/ckeditor5-enter';\nimport { Delete } from '@ckeditor/ckeditor5-typing';\nimport { env, isForwardArrowKeyCode } from '@ckeditor/ckeditor5-utils';\nimport { isTypeAroundWidget, getClosestTypeAroundDomButton, getTypeAroundButtonPosition, getClosestWidgetViewElement, getTypeAroundFakeCaretPosition, TYPE_AROUND_SELECTION_ATTRIBUTE } from './utils.js';\nimport { isWidget } from '../utils.js';\n// @if CK_DEBUG_TYPING // const { _buildLogMessage } = require( '@ckeditor/ckeditor5-engine/src/dev-utils/utils.js' );\nimport '../../theme/widgettypearound.css';\nconst POSSIBLE_INSERTION_POSITIONS = ['before', 'after'];\n// Do the SVG parsing once and then clone the result <svg> DOM element for each new button.\nconst RETURN_ARROW_ICON_ELEMENT = new DOMParser().parseFromString(IconReturnArrow, 'image/svg+xml').firstChild;\nconst PLUGIN_DISABLED_EDITING_ROOT_CLASS = 'ck-widget__type-around_disabled';\n/**\n * A plugin that allows users to type around widgets where normally it is impossible to place the caret due\n * to limitations of web browsers. These \"tight spots\" occur, for instance, before (or after) a widget being\n * the first (or last) child of its parent or between two block widgets.\n *\n * This plugin extends the {@link module:widget/widget~Widget `Widget`} plugin and injects the user interface\n * with two buttons into each widget instance in the editor. Each of the buttons can be clicked by the\n * user if the widget is next to the \"tight spot\". Once clicked, a paragraph is created with the selection anchored\n * in it so that users can type (or insert content, paste, etc.) straight away.\n */\nexport class WidgetTypeAround extends Plugin {\n    /**\n     * A reference to the model widget element that has the fake caret active\n     * on either side of it. It is later used to remove CSS classes associated with the fake caret\n     * when the widget no longer needs it.\n     */\n    _currentFakeCaretModelElement = null;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'WidgetTypeAround';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Enter, Delete];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        // Set a CSS class on the view editing root when the plugin is disabled so all the buttons\n        // and lines visually disappear. All the interactions are disabled in individual plugin methods.\n        this.on('change:isEnabled', (evt, data, isEnabled) => {\n            editingView.change(writer => {\n                for (const root of editingView.document.roots) {\n                    if (isEnabled) {\n                        writer.removeClass(PLUGIN_DISABLED_EDITING_ROOT_CLASS, root);\n                    }\n                    else {\n                        writer.addClass(PLUGIN_DISABLED_EDITING_ROOT_CLASS, root);\n                    }\n                }\n            });\n            if (!isEnabled) {\n                editor.model.change(writer => {\n                    writer.removeSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE);\n                });\n            }\n        });\n        this._enableTypeAroundUIInjection();\n        this._enableInsertingParagraphsOnButtonClick();\n        this._enableInsertingParagraphsOnEnterKeypress();\n        this._enableInsertingParagraphsOnTypingKeystroke();\n        this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows();\n        this._enableDeleteIntegration();\n        this._enableInsertContentIntegration();\n        this._enableInsertObjectIntegration();\n        this._enableDeleteContentIntegration();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._currentFakeCaretModelElement = null;\n    }\n    /**\n     * Inserts a new paragraph next to a widget element with the selection anchored in it.\n     *\n     * **Note**: This method is heavily user-oriented and will both focus the editing view and scroll\n     * the viewport to the selection in the inserted paragraph.\n     *\n     * @param widgetModelElement The model widget element next to which a paragraph is inserted.\n     * @param position The position where the paragraph is inserted. Either `'before'` or `'after'` the widget.\n     */\n    _insertParagraph(widgetModelElement, position) {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const attributesToCopy = editor.model.schema.getAttributesWithProperty(widgetModelElement, 'copyOnReplace', true);\n        editor.execute('insertParagraph', {\n            position: editor.model.createPositionAt(widgetModelElement, position),\n            attributes: attributesToCopy\n        });\n        editingView.focus();\n        editingView.scrollToTheSelection();\n    }\n    /**\n     * A wrapper for the {@link module:utils/emittermixin~Emitter#listenTo} method that executes the callbacks only\n     * when the plugin {@link #isEnabled is enabled}.\n     *\n     * @param emitter The object that fires the event.\n     * @param event The name of the event.\n     * @param callback The function to be called on event.\n     * @param options Additional options.\n     */\n    _listenToIfEnabled(emitter, event, callback, options) {\n        this.listenTo(emitter, event, (...args) => {\n            // Do not respond if the plugin is disabled.\n            if (this.isEnabled) {\n                callback(...args);\n            }\n        }, options);\n    }\n    /**\n     * Similar to {@link #_insertParagraph}, this method inserts a paragraph except that it\n     * does not expect a position. Instead, it performs the insertion next to a selected widget\n     * according to the `widget-type-around` model selection attribute value (fake caret position).\n     *\n     * Because this method requires the `widget-type-around` attribute to be set,\n     * the insertion can only happen when the widget's fake caret is active (e.g. activated\n     * using the keyboard).\n     *\n     * @returns Returns `true` when the paragraph was inserted (the attribute was present) and `false` otherwise.\n     */\n    _insertParagraphAccordingToFakeCaretPosition() {\n        const editor = this.editor;\n        const model = editor.model;\n        const modelSelection = model.document.selection;\n        const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(modelSelection);\n        if (!typeAroundFakeCaretPosition) {\n            return false;\n        }\n        // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {\n        // @if CK_DEBUG_TYPING // \tconsole.info( ..._buildLogMessage( this, 'WidgetTypeAround',\n        // @if CK_DEBUG_TYPING // \t\t'Fake caret -> insert paragraph',\n        // @if CK_DEBUG_TYPING // \t) );\n        // @if CK_DEBUG_TYPING // }\n        const selectedModelElement = modelSelection.getSelectedElement();\n        this._insertParagraph(selectedModelElement, typeAroundFakeCaretPosition);\n        return true;\n    }\n    /**\n     * Creates a listener in the editing conversion pipeline that injects the widget type around\n     * UI into every single widget instance created in the editor.\n     *\n     * The UI is delivered as a {@link module:engine/view/uielement~ViewUIElement}\n     * wrapper which renders DOM buttons that users can use to insert paragraphs.\n     */\n    _enableTypeAroundUIInjection() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const t = editor.locale.t;\n        const buttonTitles = {\n            before: t('Insert paragraph before block'),\n            after: t('Insert paragraph after block')\n        };\n        editor.editing.downcastDispatcher.on('insert', (evt, data, conversionApi) => {\n            const viewElement = conversionApi.mapper.toViewElement(data.item);\n            if (!viewElement) {\n                return;\n            }\n            // Filter out non-widgets and inline widgets.\n            if (isTypeAroundWidget(viewElement, data.item, schema)) {\n                injectUIIntoWidget(conversionApi.writer, buttonTitles, viewElement);\n                const widgetLabel = viewElement.getCustomProperty('widgetLabel');\n                widgetLabel.push(() => {\n                    return this.isEnabled ? t('Press Enter to type after or press Shift + Enter to type before the widget') : '';\n                });\n            }\n        }, { priority: 'low' });\n    }\n    /**\n     * Brings support for the fake caret that appears when either:\n     *\n     * * the selection moves to a widget from a position next to it using arrow keys,\n     * * the arrow key is pressed when the widget is already selected.\n     *\n     * The fake caret lets the user know that they can start typing or just press\n     * <kbd>Enter</kbd> to insert a paragraph at the position next to a widget as suggested by the fake caret.\n     *\n     * The fake caret disappears when the user changes the selection or the editor\n     * gets blurred.\n     *\n     * The whole idea is as follows:\n     *\n     * 1. A user does one of the 2 scenarios described at the beginning.\n     * 2. The \"keydown\" listener is executed and the decision is made whether to show or hide the fake caret.\n     * 3. If it should show up, the `widget-type-around` model selection attribute is set indicating\n     *    on which side of the widget it should appear.\n     * 4. The selection dispatcher reacts to the selection attribute and sets CSS classes responsible for the\n     *    fake caret on the view widget.\n     * 5. If the fake caret should disappear, the selection attribute is removed and the dispatcher\n     *    does the CSS class clean-up in the view.\n     * 6. Additionally, `change:range` and `FocusTracker#isFocused` listeners also remove the selection\n     *    attribute (the former also removes widget CSS classes).\n     */\n    _enableTypeAroundFakeCaretActivationUsingKeyboardArrows() {\n        const editor = this.editor;\n        const model = editor.model;\n        const modelSelection = model.document.selection;\n        const schema = model.schema;\n        const editingView = editor.editing.view;\n        // This is the main listener responsible for the fake caret.\n        // Note: The priority must precede the default Widget class keydown handler (\"high\").\n        this._listenToIfEnabled(editingView.document, 'arrowKey', (evt, domEventData) => {\n            this._handleArrowKeyPress(evt, domEventData);\n        }, { context: [isWidget, '$text'], priority: 'high' });\n        // This listener makes sure the widget type around selection attribute will be gone from the model\n        // selection as soon as the model range changes. This attribute only makes sense when a widget is selected\n        // (and the \"fake horizontal caret\" is visible) so whenever the range changes (e.g. selection moved somewhere else),\n        // let's get rid of the attribute so that the selection downcast dispatcher isn't even bothered.\n        this._listenToIfEnabled(modelSelection, 'change:range', (evt, data) => {\n            // Do not reset the selection attribute when the change was indirect.\n            if (!data.directChange) {\n                return;\n            }\n            // Get rid of the widget type around attribute of the selection on every change:range.\n            // If the range changes, it means for sure, the user is no longer in the active (\"fake horizontal caret\") mode.\n            editor.model.change(writer => {\n                writer.removeSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE);\n            });\n        });\n        // Get rid of the widget type around attribute of the selection on every document change\n        // that makes widget not selected any more (i.e. widget was removed).\n        this._listenToIfEnabled(model.document, 'change:data', () => {\n            const selectedModelElement = modelSelection.getSelectedElement();\n            if (selectedModelElement) {\n                const selectedViewElement = editor.editing.mapper.toViewElement(selectedModelElement);\n                if (isTypeAroundWidget(selectedViewElement, selectedModelElement, schema)) {\n                    return;\n                }\n            }\n            editor.model.change(writer => {\n                writer.removeSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE);\n            });\n        });\n        // React to changes of the model selection attribute made by the arrow keys listener.\n        // If the block widget is selected and the attribute changes, downcast the attribute to special\n        // CSS classes associated with the active (\"fake horizontal caret\") mode of the widget.\n        this._listenToIfEnabled(editor.editing.downcastDispatcher, 'selection', (evt, data, conversionApi) => {\n            const writer = conversionApi.writer;\n            if (this._currentFakeCaretModelElement) {\n                const selectedViewElement = conversionApi.mapper.toViewElement(this._currentFakeCaretModelElement);\n                if (selectedViewElement) {\n                    // Get rid of CSS classes associated with the active (\"fake horizontal caret\") mode from the view widget.\n                    writer.removeClass(POSSIBLE_INSERTION_POSITIONS.map(positionToWidgetCssClass), selectedViewElement);\n                    this._currentFakeCaretModelElement = null;\n                }\n            }\n            const selectedModelElement = data.selection.getSelectedElement();\n            if (!selectedModelElement) {\n                return;\n            }\n            const selectedViewElement = conversionApi.mapper.toViewElement(selectedModelElement);\n            if (!isTypeAroundWidget(selectedViewElement, selectedModelElement, schema)) {\n                return;\n            }\n            const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(data.selection);\n            if (!typeAroundFakeCaretPosition) {\n                return;\n            }\n            writer.addClass(positionToWidgetCssClass(typeAroundFakeCaretPosition), selectedViewElement);\n            // Remember the view widget that got the \"fake-caret\" CSS class. This class should be removed ASAP when the\n            // selection changes\n            this._currentFakeCaretModelElement = selectedModelElement;\n        });\n        this._listenToIfEnabled(editor.ui.focusTracker, 'change:isFocused', (evt, name, isFocused) => {\n            if (!isFocused) {\n                editor.model.change(writer => {\n                    writer.removeSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE);\n                });\n            }\n        });\n        function positionToWidgetCssClass(position) {\n            return `ck-widget_type-around_show-fake-caret_${position}`;\n        }\n    }\n    /**\n     * A listener executed on each \"keydown\" in the view document, a part of\n     * {@link #_enableTypeAroundFakeCaretActivationUsingKeyboardArrows}.\n     *\n     * It decides whether the arrow keypress should activate the fake caret or not (also whether it should\n     * be deactivated).\n     *\n     * The fake caret activation is done by setting the `widget-type-around` model selection attribute\n     * in this listener, and stopping and preventing the event that would normally be handled by the widget\n     * plugin that is responsible for the regular keyboard navigation near/across all widgets (that\n     * includes inline widgets, which are ignored by the widget type around plugin).\n     */\n    _handleArrowKeyPress(evt, domEventData) {\n        const editor = this.editor;\n        const model = editor.model;\n        const modelSelection = model.document.selection;\n        const schema = model.schema;\n        const editingView = editor.editing.view;\n        // Selection expanding/shrinking is handled without the fake caret by the widget plugin.\n        if (domEventData.shiftKey) {\n            return;\n        }\n        const keyCode = domEventData.keyCode;\n        const isForward = isForwardArrowKeyCode(keyCode, editor.locale.contentLanguageDirection);\n        const selectedViewElement = editingView.document.selection.getSelectedElement();\n        const selectedModelElement = editor.editing.mapper.toModelElement(selectedViewElement);\n        let shouldStopAndPreventDefault;\n        // Handle keyboard navigation when a type-around-compatible widget is currently selected.\n        if (isTypeAroundWidget(selectedViewElement, selectedModelElement, schema)) {\n            shouldStopAndPreventDefault = this._handleArrowKeyPressOnSelectedWidget(isForward);\n        }\n        // Handle keyboard arrow navigation when the selection is next to a type-around-compatible widget\n        // and the widget is about to be selected.\n        else if (modelSelection.isCollapsed) {\n            shouldStopAndPreventDefault = this._handleArrowKeyPressWhenSelectionNextToAWidget(isForward);\n        }\n        // Handle collapsing a non-collapsed selection that is wider than on a single widget.\n        else if (!domEventData.shiftKey) {\n            shouldStopAndPreventDefault = this._handleArrowKeyPressWhenNonCollapsedSelection(isForward);\n        }\n        if (shouldStopAndPreventDefault) {\n            domEventData.preventDefault();\n            evt.stop();\n        }\n    }\n    /**\n     * Handles the keyboard navigation on \"keydown\" when a widget is currently selected and activates or deactivates\n     * the fake caret for that widget, depending on the current value of the `widget-type-around` model\n     * selection attribute and the direction of the pressed arrow key.\n     *\n     * @param isForward `true` when the pressed arrow key was responsible for the forward model selection movement\n     * as in {@link module:utils/keyboard~isForwardArrowKeyCode}.\n     * @returns Returns `true` when the keypress was handled and no other keydown listener of the editor should\n     * process the event any further. Returns `false` otherwise.\n     */\n    _handleArrowKeyPressOnSelectedWidget(isForward) {\n        const editor = this.editor;\n        const model = editor.model;\n        const modelSelection = model.document.selection;\n        const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(modelSelection);\n        return model.change(writer => {\n            // If the fake caret is displayed...\n            if (typeAroundFakeCaretPosition) {\n                const isLeavingWidget = typeAroundFakeCaretPosition === (isForward ? 'after' : 'before');\n                // If the keyboard arrow works against the value of the selection attribute...\n                // then remove the selection attribute but prevent default DOM actions\n                // and do not let the Widget plugin listener move the selection. This brings\n                // the widget back to the state, for instance, like if was selected using the mouse.\n                //\n                // **Note**: If leaving the widget when the fake caret is active, then the default\n                // Widget handler will change the selection and, in turn, this will automatically discard\n                // the selection attribute.\n                if (!isLeavingWidget) {\n                    writer.removeSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE);\n                    return true;\n                }\n            }\n            // If the fake caret wasn't displayed, let's set it now according to the direction of the arrow\n            // key press. This also means we cannot let the Widget plugin listener move the selection.\n            else {\n                writer.setSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE, isForward ? 'after' : 'before');\n                return true;\n            }\n            return false;\n        });\n    }\n    /**\n     * Handles the keyboard navigation on \"keydown\" when **no** widget is selected but the selection is **directly** next\n     * to one and upon the fake caret should become active for this widget upon arrow keypress\n     * (AKA entering/selecting the widget).\n     *\n     * **Note**: This code mirrors the implementation from the widget plugin but also adds the selection attribute.\n     * Unfortunately, there is no safe way to let the widget plugin do the selection part first and then just set the\n     * selection attribute here in the widget type around plugin. This is why this code must duplicate some from the widget plugin.\n     *\n     * @param isForward `true` when the pressed arrow key was responsible for the forward model selection movement\n     * as in {@link module:utils/keyboard~isForwardArrowKeyCode}.\n     * @returns Returns `true` when the keypress was handled and no other keydown listener of the editor should\n     * process the event any further. Returns `false` otherwise.\n     */\n    _handleArrowKeyPressWhenSelectionNextToAWidget(isForward) {\n        const editor = this.editor;\n        const model = editor.model;\n        const schema = model.schema;\n        const widgetPlugin = editor.plugins.get('Widget');\n        // This is the widget the selection is about to be set on.\n        const modelElementNextToSelection = widgetPlugin._getObjectElementNextToSelection(isForward);\n        const viewElementNextToSelection = editor.editing.mapper.toViewElement(modelElementNextToSelection);\n        if (isTypeAroundWidget(viewElementNextToSelection, modelElementNextToSelection, schema)) {\n            model.change(writer => {\n                widgetPlugin._setSelectionOverElement(modelElementNextToSelection);\n                writer.setSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE, isForward ? 'before' : 'after');\n            });\n            // The change() block above does the same job as the Widget plugin. The event can\n            // be safely canceled.\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Handles the keyboard navigation on \"keydown\" when a widget is currently selected (together with some other content)\n     * and the widget is the first or last element in the selection. It activates or deactivates the fake caret for that widget.\n     *\n     * @param isForward `true` when the pressed arrow key was responsible for the forward model selection movement\n     * as in {@link module:utils/keyboard~isForwardArrowKeyCode}.\n     * @returns Returns `true` when the keypress was handled and no other keydown listener of the editor should\n     * process the event any further. Returns `false` otherwise.\n     */\n    _handleArrowKeyPressWhenNonCollapsedSelection(isForward) {\n        const editor = this.editor;\n        const model = editor.model;\n        const schema = model.schema;\n        const mapper = editor.editing.mapper;\n        const modelSelection = model.document.selection;\n        const selectedModelNode = isForward ?\n            modelSelection.getLastPosition().nodeBefore :\n            modelSelection.getFirstPosition().nodeAfter;\n        const selectedViewNode = mapper.toViewElement(selectedModelNode);\n        // There is a widget at the collapse position so collapse the selection to the fake caret on it.\n        if (isTypeAroundWidget(selectedViewNode, selectedModelNode, schema)) {\n            model.change(writer => {\n                writer.setSelection(selectedModelNode, 'on');\n                writer.setSelectionAttribute(TYPE_AROUND_SELECTION_ATTRIBUTE, isForward ? 'after' : 'before');\n            });\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Registers a `mousedown` listener for the view document which intercepts events\n     * coming from the widget type around UI, which happens when a user clicks one of the buttons\n     * that insert a paragraph next to a widget.\n     */\n    _enableInsertingParagraphsOnButtonClick() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        this._listenToIfEnabled(editingView.document, 'mousedown', (evt, domEventData) => {\n            const button = getClosestTypeAroundDomButton(domEventData.domTarget);\n            if (!button) {\n                return;\n            }\n            const buttonPosition = getTypeAroundButtonPosition(button);\n            const widgetViewElement = getClosestWidgetViewElement(button, editingView.domConverter);\n            const widgetModelElement = editor.editing.mapper.toModelElement(widgetViewElement);\n            this._insertParagraph(widgetModelElement, buttonPosition);\n            domEventData.preventDefault();\n            evt.stop();\n        });\n    }\n    /**\n     * Creates the <kbd>Enter</kbd> key listener on the view document that allows the user to insert a paragraph\n     * near the widget when either:\n     *\n     * * The fake caret was first activated using the arrow keys,\n     * * The entire widget is selected in the model.\n     *\n     * In the first case, the new paragraph is inserted according to the `widget-type-around` selection\n     * attribute (see {@link #_handleArrowKeyPress}).\n     *\n     * In the second case, the new paragraph is inserted based on whether a soft (<kbd>Shift</kbd>+<kbd>Enter</kbd>) keystroke\n     * was pressed or not.\n     */\n    _enableInsertingParagraphsOnEnterKeypress() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const editingView = editor.editing.view;\n        this._listenToIfEnabled(editingView.document, 'enter', (evt, domEventData) => {\n            // This event could be triggered from inside the widget but we are interested\n            // only when the widget is selected itself.\n            if (evt.eventPhase != 'atTarget') {\n                return;\n            }\n            const selectedModelElement = selection.getSelectedElement();\n            const selectedViewElement = editor.editing.mapper.toViewElement(selectedModelElement);\n            const schema = editor.model.schema;\n            let wasHandled;\n            // First check if the widget is selected and there's a type around selection attribute associated\n            // with the fake caret that would tell where to insert a new paragraph.\n            if (this._insertParagraphAccordingToFakeCaretPosition()) {\n                wasHandled = true;\n            }\n            // Then, if there is no selection attribute associated with the fake caret, check if the widget\n            // simply is selected and create a new paragraph according to the keystroke (Shift+)Enter.\n            else if (isTypeAroundWidget(selectedViewElement, selectedModelElement, schema)) {\n                this._insertParagraph(selectedModelElement, domEventData.isSoft ? 'before' : 'after');\n                wasHandled = true;\n            }\n            if (wasHandled) {\n                domEventData.preventDefault();\n                evt.stop();\n            }\n        }, { context: isWidget });\n    }\n    /**\n     * Similar to the {@link #_enableInsertingParagraphsOnEnterKeypress}, it allows the user\n     * to insert a paragraph next to a widget when the fake caret was activated using arrow\n     * keys but it responds to typing instead of <kbd>Enter</kbd>.\n     *\n     * Listener enabled by this method will insert a new paragraph according to the `widget-type-around`\n     * model selection attribute as the user simply starts typing, which creates the impression that the fake caret\n     * behaves like a real one rendered by the browser (AKA your text appears where the caret was).\n     *\n     * **Note**: At the moment this listener creates 2 undo steps: one for the `insertParagraph` command\n     * and another one for actual typing. It is not a disaster but this may need to be fixed\n     * sooner or later.\n     */\n    _enableInsertingParagraphsOnTypingKeystroke() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        // Note: The priority must precede the default Input plugin insertText handler.\n        this._listenToIfEnabled(viewDocument, 'insertText', (evt, data) => {\n            if (this._insertParagraphAccordingToFakeCaretPosition()) {\n                // The view selection in the event data contains the widget. If the new paragraph\n                // was inserted, modify the view selection passed along with the insertText event\n                // so the default event handler in the Input plugin starts typing inside the paragraph.\n                // Otherwise, the typing would be over the widget.\n                data.selection = viewDocument.selection;\n            }\n        }, { priority: 'high' });\n        if (env.isAndroid) {\n            // On Android with English keyboard, the composition starts just by putting caret\n            // at the word end or by selecting a table column. This is not a real composition started.\n            // Trigger delete content on first composition key pressed.\n            this._listenToIfEnabled(viewDocument, 'keydown', (evt, data) => {\n                if (data.keyCode == 229) {\n                    this._insertParagraphAccordingToFakeCaretPosition();\n                }\n            });\n        }\n        else {\n            // Note: The priority must precede the default Input plugin compositionstart handler (to call it before delete content).\n            this._listenToIfEnabled(viewDocument, 'compositionstart', () => {\n                this._insertParagraphAccordingToFakeCaretPosition();\n            }, { priority: 'highest' });\n        }\n    }\n    /**\n     * It creates a \"delete\" event listener on the view document to handle cases when the <kbd>Delete</kbd> or <kbd>Backspace</kbd>\n     * is pressed and the fake caret is currently active.\n     *\n     * The fake caret should create an illusion of a real browser caret so that when it appears before or after\n     * a widget, pressing <kbd>Delete</kbd> or <kbd>Backspace</kbd> should remove a widget or delete the content\n     * before or after a widget (depending on the content surrounding the widget).\n     */\n    _enableDeleteIntegration() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const model = editor.model;\n        const schema = model.schema;\n        this._listenToIfEnabled(editingView.document, 'delete', (evt, domEventData) => {\n            // This event could be triggered from inside the widget but we are interested\n            // only when the widget is selected itself.\n            if (evt.eventPhase != 'atTarget') {\n                return;\n            }\n            const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(model.document.selection);\n            // This listener handles only these cases when the fake caret is active.\n            if (!typeAroundFakeCaretPosition) {\n                return;\n            }\n            const direction = domEventData.direction;\n            const selectedModelWidget = model.document.selection.getSelectedElement();\n            const isFakeCaretBefore = typeAroundFakeCaretPosition === 'before';\n            const isDeleteForward = direction == 'forward';\n            const shouldDeleteEntireWidget = isFakeCaretBefore === isDeleteForward;\n            if (shouldDeleteEntireWidget) {\n                editor.execute('delete', {\n                    selection: model.createSelection(selectedModelWidget, 'on')\n                });\n            }\n            else {\n                const range = schema.getNearestSelectionRange(model.createPositionAt(selectedModelWidget, typeAroundFakeCaretPosition), direction);\n                // If there is somewhere to move selection to, then there will be something to delete.\n                if (range) {\n                    // If the range is NOT collapsed, then we know that the range contains an object (see getNearestSelectionRange() docs).\n                    if (!range.isCollapsed) {\n                        model.change(writer => {\n                            writer.setSelection(range);\n                            editor.execute(isDeleteForward ? 'deleteForward' : 'delete');\n                        });\n                    }\n                    else {\n                        const probe = model.createSelection(range.start);\n                        model.modifySelection(probe, { direction });\n                        // If the range is collapsed, let's see if a non-collapsed range exists that can could be deleted.\n                        // If such range exists, use the editor command because it it safe for collaboration (it merges where it can).\n                        if (!probe.focus.isEqual(range.start)) {\n                            model.change(writer => {\n                                writer.setSelection(range);\n                                editor.execute(isDeleteForward ? 'deleteForward' : 'delete');\n                            });\n                        }\n                        // If there is no non-collapsed range to be deleted then we are sure that there is an empty element\n                        // next to a widget that should be removed. \"delete\" and \"deleteForward\" commands cannot get rid of it\n                        // so calling Model#deleteContent here manually.\n                        else {\n                            const deepestEmptyRangeAncestor = getDeepestEmptyElementAncestor(schema, range.start.parent);\n                            model.deleteContent(model.createSelection(deepestEmptyRangeAncestor, 'on'), {\n                                doNotAutoparagraph: true\n                            });\n                        }\n                    }\n                }\n            }\n            // If some content was deleted, don't let the handler from the Widget plugin kick in.\n            // If nothing was deleted, then the default handler will have nothing to do anyway.\n            domEventData.preventDefault();\n            evt.stop();\n        }, { context: isWidget });\n    }\n    /**\n     * Attaches the {@link module:engine/model/model~Model#event:insertContent} event listener that, for instance, allows the user to paste\n     * content near a widget when the fake caret is first activated using the arrow keys.\n     *\n     * The content is inserted according to the `widget-type-around` selection attribute (see {@link #_handleArrowKeyPress}).\n     */\n    _enableInsertContentIntegration() {\n        const editor = this.editor;\n        const model = this.editor.model;\n        const documentSelection = model.document.selection;\n        this._listenToIfEnabled(editor.model, 'insertContent', (evt, [content, selectable]) => {\n            if (selectable && !selectable.is('documentSelection')) {\n                return;\n            }\n            const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(documentSelection);\n            if (!typeAroundFakeCaretPosition) {\n                return;\n            }\n            evt.stop();\n            return model.change(writer => {\n                const selectedElement = documentSelection.getSelectedElement();\n                const position = model.createPositionAt(selectedElement, typeAroundFakeCaretPosition);\n                const selection = writer.createSelection(position);\n                const result = model.insertContent(content, selection);\n                writer.setSelection(selection);\n                return result;\n            });\n        }, { priority: 'high' });\n    }\n    /**\n     * Attaches the {@link module:engine/model/model~Model#event:insertObject} event listener that modifies the\n     * `options.findOptimalPosition`parameter to position of fake caret in relation to selected element\n     * to reflect user's intent of desired insertion position.\n     *\n     * The object is inserted according to the `widget-type-around` selection attribute (see {@link #_handleArrowKeyPress}).\n     */\n    _enableInsertObjectIntegration() {\n        const editor = this.editor;\n        const model = this.editor.model;\n        const documentSelection = model.document.selection;\n        this._listenToIfEnabled(editor.model, 'insertObject', (evt, args) => {\n            const [, selectable, options = {}] = args;\n            if (selectable && !selectable.is('documentSelection')) {\n                return;\n            }\n            const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(documentSelection);\n            if (!typeAroundFakeCaretPosition) {\n                return;\n            }\n            options.findOptimalPosition = typeAroundFakeCaretPosition;\n            args[3] = options;\n        }, { priority: 'high' });\n    }\n    /**\n     * Attaches the {@link module:engine/model/model~Model#event:deleteContent} event listener to block the event when the fake\n     * caret is active.\n     *\n     * This is required for cases that trigger {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}\n     * before calling {@link module:engine/model/model~Model#insertContent `model.insertContent()`} like, for instance,\n     * plain text pasting.\n     */\n    _enableDeleteContentIntegration() {\n        const editor = this.editor;\n        const model = this.editor.model;\n        const documentSelection = model.document.selection;\n        this._listenToIfEnabled(editor.model, 'deleteContent', (evt, [selection]) => {\n            if (selection && !selection.is('documentSelection')) {\n                return;\n            }\n            const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(documentSelection);\n            // Disable removing the selection content while pasting plain text.\n            if (typeAroundFakeCaretPosition) {\n                evt.stop();\n            }\n        }, { priority: 'high' });\n    }\n}\n/**\n * Injects the type around UI into a view widget instance.\n */\nfunction injectUIIntoWidget(viewWriter, buttonTitles, widgetViewElement) {\n    const typeAroundWrapper = viewWriter.createUIElement('div', {\n        class: 'ck ck-reset_all ck-widget__type-around'\n    }, function (domDocument) {\n        const wrapperDomElement = this.toDomElement(domDocument);\n        injectButtons(wrapperDomElement, buttonTitles);\n        injectFakeCaret(wrapperDomElement);\n        return wrapperDomElement;\n    });\n    // Inject the type around wrapper into the widget's wrapper.\n    viewWriter.insert(viewWriter.createPositionAt(widgetViewElement, 'end'), typeAroundWrapper);\n}\n/**\n * FYI: Not using the IconView class because each instance would need to be destroyed to avoid memory leaks\n * and it's pretty hard to figure out when a view (widget) is gone for good so it's cheaper to use raw\n * <svg> here.\n */\nfunction injectButtons(wrapperDomElement, buttonTitles) {\n    for (const position of POSSIBLE_INSERTION_POSITIONS) {\n        const buttonTemplate = new Template({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-widget__type-around__button',\n                    `ck-widget__type-around__button_${position}`\n                ],\n                title: buttonTitles[position],\n                'aria-hidden': 'true'\n            },\n            children: [\n                wrapperDomElement.ownerDocument.importNode(RETURN_ARROW_ICON_ELEMENT, true)\n            ]\n        });\n        wrapperDomElement.appendChild(buttonTemplate.render());\n    }\n}\nfunction injectFakeCaret(wrapperDomElement) {\n    const caretTemplate = new Template({\n        tag: 'div',\n        attributes: {\n            class: [\n                'ck',\n                'ck-widget__type-around__fake-caret'\n            ]\n        }\n    });\n    wrapperDomElement.appendChild(caretTemplate.render());\n}\n/**\n * Returns the ancestor of an element closest to the root which is empty. For instance,\n * for `<baz>`:\n *\n * ```\n * <foo>abc<bar><baz></baz></bar></foo>\n * ```\n *\n * it returns `<bar>`.\n */\nfunction getDeepestEmptyElementAncestor(schema, element) {\n    let deepestEmptyAncestor = element;\n    for (const ancestor of element.getAncestors({ parentFirst: true })) {\n        if (ancestor.childCount > 1 || schema.isLimit(ancestor)) {\n            break;\n        }\n        deepestEmptyAncestor = ancestor;\n    }\n    return deepestEmptyAncestor;\n}\n","export default \"<svg viewBox=\\\"0 0 10 8\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><path d=\\\"M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/verticalnavigation\n */\nimport { keyCodes, Rect } from '@ckeditor/ckeditor5-utils';\n/**\n * Returns 'keydown' handler for up/down arrow keys that modifies the caret movement if it's in a text line next to an object.\n *\n * @param editing The editing controller.\n */\nexport function verticalWidgetNavigationHandler(editing) {\n    const model = editing.model;\n    return (evt, data) => {\n        const arrowUpPressed = data.keyCode == keyCodes.arrowup;\n        const arrowDownPressed = data.keyCode == keyCodes.arrowdown;\n        const expandSelection = data.shiftKey;\n        const selection = model.document.selection;\n        if (!arrowUpPressed && !arrowDownPressed) {\n            return;\n        }\n        const isForward = arrowDownPressed;\n        // Find a range between selection and closest limit element.\n        const range = findTextRangeFromSelection(editing, selection, isForward);\n        // There is no selection position inside the limit element.\n        if (!range) {\n            return;\n        }\n        // If already at the edge of a limit element.\n        if (range.isCollapsed) {\n            // A collapsed selection at limit edge - nothing more to do.\n            if (selection.isCollapsed) {\n                return;\n            }\n            // A non collapsed selection is at the limit edge while expanding the selection - let others do their stuff.\n            else if (expandSelection) {\n                return;\n            }\n        }\n        // If the range is a single line (there is no word wrapping) then move the selection to the position closest to the limit element.\n        //\n        // We can't move the selection directly to the isObject element (eg. table cell) because of dual position at the end/beginning\n        // of wrapped line (it's at the same time at the end of one line and at the start of the next line).\n        if (range.isCollapsed || isSingleLineRange(editing, range, isForward)) {\n            model.change(writer => {\n                const newPosition = isForward ? range.end : range.start;\n                if (expandSelection) {\n                    const newSelection = model.createSelection(selection.anchor);\n                    newSelection.setFocus(newPosition);\n                    writer.setSelection(newSelection);\n                }\n                else {\n                    writer.setSelection(newPosition);\n                }\n            });\n            evt.stop();\n            data.preventDefault();\n            data.stopPropagation();\n        }\n    };\n}\n/**\n * Finds the range between selection and closest limit element (in the direction of navigation).\n * The position next to limit element is adjusted to the closest allowed `$text` position.\n *\n * Returns `null` if, according to the schema, the resulting range cannot contain a `$text` element.\n *\n * @param editing The editing controller.\n * @param selection The current selection.\n * @param isForward The expected navigation direction.\n */\nfunction findTextRangeFromSelection(editing, selection, isForward) {\n    const model = editing.model;\n    if (isForward) {\n        const startPosition = selection.focus;\n        const endPosition = getNearestNonInlineLimit(model, startPosition, 'forward');\n        // There is no limit element, browser should handle this.\n        if (!endPosition) {\n            return;\n        }\n        const range = model.createRange(startPosition, endPosition);\n        const lastRangePosition = getNearestTextPosition(model.schema, range, 'backward');\n        if (lastRangePosition) {\n            return model.createRange(startPosition, lastRangePosition);\n        }\n    }\n    else {\n        const endPosition = selection.focus;\n        const startPosition = getNearestNonInlineLimit(model, endPosition, 'backward');\n        // There is no limit element, browser should handle this.\n        if (!startPosition) {\n            return;\n        }\n        const range = model.createRange(startPosition, endPosition);\n        const firstRangePosition = getNearestTextPosition(model.schema, range, 'forward');\n        if (firstRangePosition) {\n            return model.createRange(firstRangePosition, endPosition);\n        }\n    }\n}\n/**\n * Finds the limit element position that is closest to startPosition.\n *\n * @param direction Search direction.\n */\nfunction getNearestNonInlineLimit(model, startPosition, direction) {\n    const schema = model.schema;\n    const range = model.createRangeIn(startPosition.root);\n    const walkerValueType = direction == 'forward' ? 'elementStart' : 'elementEnd';\n    for (const { previousPosition, item, type } of range.getWalker({ startPosition, direction })) {\n        if (schema.isLimit(item) && !schema.isInline(item)) {\n            return previousPosition;\n        }\n        // Stop looking for isLimit element if the next element is a block element (it is for sure not single line).\n        if (type == walkerValueType && schema.isBlock(item)) {\n            return null;\n        }\n    }\n    return null;\n}\n/**\n * Basing on the provided range, finds the first or last (depending on `direction`) position inside the range\n * that can contain `$text` (according to schema).\n *\n * @param schema The schema.\n * @param range The range to find the position in.\n * @param direction Search direction.\n * @returns The nearest selection position.\n *\n */\nfunction getNearestTextPosition(schema, range, direction) {\n    const position = direction == 'backward' ? range.end : range.start;\n    if (schema.checkChild(position, '$text')) {\n        return position;\n    }\n    for (const { nextPosition } of range.getWalker({ direction })) {\n        if (schema.checkChild(nextPosition, '$text')) {\n            return nextPosition;\n        }\n    }\n}\n/**\n * Checks if the DOM range corresponding to the provided model range renders as a single line by analyzing DOMRects\n * (verifying if they visually wrap content to the next line).\n *\n * @param editing The editing controller.\n * @param modelRange The current table cell content range.\n * @param isForward The expected navigation direction.\n */\nfunction isSingleLineRange(editing, modelRange, isForward) {\n    const model = editing.model;\n    const domConverter = editing.view.domConverter;\n    // Wrapped lines contain exactly the same position at the end of current line\n    // and at the beginning of next line. That position's client rect is at the end\n    // of current line. In case of caret at first position of the last line that 'dual'\n    // position would be detected as it's not the last line.\n    if (isForward) {\n        const probe = model.createSelection(modelRange.start);\n        model.modifySelection(probe);\n        // If the new position is at the end of the container then we can't use this position\n        // because it would provide incorrect result for eg caption of image and selection\n        // just before end of it. Also in this case there is no \"dual\" position.\n        if (!probe.focus.isAtEnd && !modelRange.start.isEqual(probe.focus)) {\n            modelRange = model.createRange(probe.focus, modelRange.end);\n        }\n    }\n    const viewRange = editing.mapper.toViewRange(modelRange);\n    const domRange = domConverter.viewRangeToDom(viewRange);\n    const rects = Rect.getDomRangeRects(domRange);\n    let boundaryVerticalPosition;\n    for (const rect of rects) {\n        if (boundaryVerticalPosition === undefined) {\n            boundaryVerticalPosition = Math.round(rect.bottom);\n            continue;\n        }\n        // Let's check if this rect is in new line.\n        if (Math.round(rect.top) >= boundaryVerticalPosition) {\n            return false;\n        }\n        boundaryVerticalPosition = Math.max(boundaryVerticalPosition, Math.round(rect.bottom));\n    }\n    return true;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widget\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { PointerObserver, MouseObserver, ModelTreeWalker } from '@ckeditor/ckeditor5-engine';\nimport { Delete } from '@ckeditor/ckeditor5-typing';\nimport { env, keyCodes, getLocalizedArrowKeyCodeDirection, getRangeFromMouseEvent, compareArrays } from '@ckeditor/ckeditor5-utils';\nimport { WidgetTypeAround } from './widgettypearound/widgettypearound.js';\nimport { getTypeAroundFakeCaretPosition } from './widgettypearound/utils.js';\nimport { verticalWidgetNavigationHandler } from './verticalnavigation.js';\nimport { getLabel, isWidget, WIDGET_SELECTED_CLASS_NAME } from './utils.js';\nimport '../theme/widget.css';\n/**\n * The widget plugin. It enables base support for widgets.\n *\n * See {@glink api/widget package page} for more details and documentation.\n *\n * This plugin enables multiple behaviors required by widgets:\n *\n * * The model to view selection converter for the editing pipeline (it handles widget custom selection rendering).\n * If a converted selection wraps around a widget element, that selection is marked as\n * {@link module:engine/view/selection~ViewSelection#isFake fake}. Additionally, the `ck-widget_selected` CSS class\n * is added to indicate that widget has been selected.\n * * The mouse and keyboard events handling on and around widget elements.\n */\nexport class Widget extends Plugin {\n    /**\n     * Holds previously selected widgets.\n     */\n    _previouslySelected = new Set();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Widget';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [WidgetTypeAround, Delete];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const t = editor.t;\n        // Model to view selection converter.\n        // Converts selection placed over widget element to fake selection.\n        //\n        // By default, the selection is downcasted by the engine to surround the attribute element, even though its only\n        // child is an inline widget. A similar thing also happens when a collapsed marker is rendered as a UI element\n        // next to an inline widget: the view selection contains both the widget and the marker.\n        //\n        // This prevents creating a correct fake selection when this inline widget is selected. Normalize the selection\n        // in these cases based on the model:\n        //\n        //\t\t[<attributeElement><inlineWidget /></attributeElement>] -> <attributeElement>[<inlineWidget />]</attributeElement>\n        //\t\t[<uiElement></uiElement><inlineWidget />] -> <uiElement></uiElement>[<inlineWidget />]\n        //\n        // Thanks to this:\n        //\n        // * fake selection can be set correctly,\n        // * any logic depending on (View)Selection#getSelectedElement() also works OK.\n        //\n        // See https://github.com/ckeditor/ckeditor5/issues/9524.\n        this.editor.editing.downcastDispatcher.on('selection', (evt, data, conversionApi) => {\n            const viewWriter = conversionApi.writer;\n            const modelSelection = data.selection;\n            // The collapsed selection can't contain any widget.\n            if (modelSelection.isCollapsed) {\n                return;\n            }\n            const selectedModelElement = modelSelection.getSelectedElement();\n            if (!selectedModelElement) {\n                return;\n            }\n            const selectedViewElement = editor.editing.mapper.toViewElement(selectedModelElement);\n            if (!isWidget(selectedViewElement)) {\n                return;\n            }\n            if (!conversionApi.consumable.consume(modelSelection, 'selection')) {\n                return;\n            }\n            viewWriter.setSelection(viewWriter.createRangeOn(selectedViewElement), {\n                fake: true,\n                label: getLabel(selectedViewElement)\n            });\n        });\n        // Mark all widgets inside the selection with the css class.\n        // This handler is registered at the 'low' priority so it's triggered after the real selection conversion.\n        this.editor.editing.downcastDispatcher.on('selection', (evt, data, conversionApi) => {\n            // Remove selected class from previously selected widgets.\n            this._clearPreviouslySelectedWidgets(conversionApi.writer);\n            const viewWriter = conversionApi.writer;\n            const viewSelection = viewWriter.document.selection;\n            let lastMarked = null;\n            for (const range of viewSelection.getRanges()) {\n                // Note: There could be multiple selected widgets in a range but no fake selection.\n                // All of them must be marked as selected, for instance [<widget></widget><widget></widget>]\n                for (const value of range) {\n                    const node = value.item;\n                    // Do not mark nested widgets in selected one. See: #4594\n                    if (isWidget(node) && !isChild(node, lastMarked)) {\n                        viewWriter.addClass(WIDGET_SELECTED_CLASS_NAME, node);\n                        this._previouslySelected.add(node);\n                        lastMarked = node;\n                    }\n                }\n            }\n        }, { priority: 'low' });\n        // If mouse down is pressed on widget - create selection over whole widget.\n        view.addObserver(MouseObserver);\n        view.addObserver(PointerObserver);\n        this.listenTo(viewDocument, 'mousedown', (...args) => this._onMousedown(...args));\n        this.listenTo(viewDocument, 'pointerdown', (...args) => this._onPointerdown(...args));\n        // There are two keydown listeners working on different priorities. This allows other\n        // features such as WidgetTypeAround or TableKeyboard to attach their listeners in between\n        // and customize the behavior even further in different content/selection scenarios.\n        //\n        // * The first listener handles changing the selection on arrow key press\n        // if the widget is selected or if the selection is next to a widget and the widget\n        // should become selected upon the arrow key press.\n        //\n        // * The second (late) listener makes sure the default browser action on arrow key press is\n        // prevented when a widget is selected. This prevents the selection from being moved\n        // from a fake selection container.\n        this.listenTo(viewDocument, 'arrowKey', (...args) => {\n            this._handleSelectionChangeOnArrowKeyPress(...args);\n        }, { context: [isWidget, '$text'] });\n        this.listenTo(viewDocument, 'arrowKey', (...args) => {\n            this._preventDefaultOnArrowKeyPress(...args);\n        }, { context: '$root' });\n        this.listenTo(viewDocument, 'arrowKey', verticalWidgetNavigationHandler(this.editor.editing), { context: '$text' });\n        // Handle custom delete behaviour.\n        this.listenTo(viewDocument, 'delete', (evt, data) => {\n            if (this._handleDelete(data.direction == 'forward')) {\n                data.preventDefault();\n                evt.stop();\n            }\n        }, { context: '$root' });\n        // Handle Tab/Shift+Tab key.\n        this.listenTo(viewDocument, 'tab', (evt, data) => {\n            if (this._selectNextEditable(data.shiftKey ? 'backward' : 'forward')) {\n                view.scrollToTheSelection();\n                data.preventDefault();\n                evt.stop();\n            }\n        }, {\n            context: node => isWidget(node) || node.is('editableElement'),\n            priority: 'low'\n        });\n        // Handle Esc key while inside a nested editable.\n        this.listenTo(viewDocument, 'keydown', (evt, data) => {\n            if (data.keystroke != keyCodes.esc) {\n                return;\n            }\n            if (this._selectAncestorWidget()) {\n                data.preventDefault();\n                evt.stop();\n            }\n        }, {\n            context: node => node.is('editableElement'),\n            priority: 'low'\n        });\n        // Add the information about the keystrokes to the accessibility database.\n        editor.accessibility.addKeystrokeInfoGroup({\n            id: 'widget',\n            label: t('Keystrokes that can be used when a widget is selected (for example: image, table, etc.)'),\n            keystrokes: [\n                {\n                    label: t('Move focus from an editable area back to the parent widget'),\n                    keystroke: 'Esc'\n                },\n                {\n                    label: t('Insert a new paragraph directly after a widget'),\n                    keystroke: 'Enter'\n                },\n                {\n                    label: t('Insert a new paragraph directly before a widget'),\n                    keystroke: 'Shift+Enter'\n                },\n                {\n                    label: t('Move the caret to allow typing directly before a widget'),\n                    keystroke: [['arrowup'], ['arrowleft']]\n                },\n                {\n                    label: t('Move the caret to allow typing directly after a widget'),\n                    keystroke: [['arrowdown'], ['arrowright']]\n                }\n            ]\n        });\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:mousedown mousedown} events on widget elements.\n     */\n    _onMousedown(eventInfo, domEventData) {\n        const element = domEventData.target;\n        // Some of DOM elements have no view element representation so it may be null.\n        if (!element) {\n            return;\n        }\n        // If triple click should select entire paragraph.\n        if (domEventData.domEvent.detail >= 3) {\n            if (this._selectBlockContent(element)) {\n                domEventData.preventDefault();\n            }\n        }\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:pointerdown pointerdown} events on widget elements.\n     */\n    _onPointerdown(eventInfo, domEventData) {\n        if (!domEventData.domEvent.isPrimary) {\n            return;\n        }\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        let element = domEventData.target;\n        // Some of DOM elements have no view element representation so it may be null.\n        if (!element) {\n            return;\n        }\n        // If target is not a widget element - check if one of the ancestors is.\n        if (!isWidget(element)) {\n            const editableOrWidgetElement = findClosestEditableOrWidgetAncestor(element);\n            if (!editableOrWidgetElement) {\n                return;\n            }\n            if (isWidget(editableOrWidgetElement)) {\n                element = editableOrWidgetElement;\n            }\n            else {\n                // Pick view range from the point where the mouse was clicked.\n                const clickTargetFromPoint = getElementFromMouseEvent(view, domEventData);\n                if (clickTargetFromPoint && isWidget(clickTargetFromPoint)) {\n                    element = clickTargetFromPoint;\n                }\n                else {\n                    return;\n                }\n            }\n        }\n        // On Android and iOS selection would jump to the first table cell, on other devices\n        // we can't block it (and don't need to) because of drag and drop support.\n        // In iOS drag and drop works anyway on a long press.\n        if (env.isAndroid || env.isiOS) {\n            domEventData.preventDefault();\n        }\n        // Focus editor if is not focused already.\n        if (!viewDocument.isFocused) {\n            view.focus();\n        }\n        // Create model selection over widget.\n        const modelElement = editor.editing.mapper.toModelElement(element);\n        this._setSelectionOverElement(modelElement);\n    }\n    /**\n     * Selects entire block content, e.g. on triple click it selects entire paragraph.\n     */\n    _selectBlockContent(element) {\n        const editor = this.editor;\n        const model = editor.model;\n        const mapper = editor.editing.mapper;\n        const schema = model.schema;\n        const viewElement = mapper.findMappedViewAncestor(this.editor.editing.view.createPositionAt(element, 0));\n        const modelElement = findTextBlockAncestor(mapper.toModelElement(viewElement), model.schema);\n        if (!modelElement) {\n            return false;\n        }\n        model.change(writer => {\n            const nextTextBlock = !schema.isLimit(modelElement) ?\n                findNextTextBlock(writer.createPositionAfter(modelElement), schema) :\n                null;\n            const start = writer.createPositionAt(modelElement, 0);\n            const end = nextTextBlock ?\n                writer.createPositionAt(nextTextBlock, 0) :\n                writer.createPositionAt(modelElement, 'end');\n            writer.setSelection(writer.createRange(start, end));\n        });\n        return true;\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and changes\n     * the model selection when:\n     *\n     * * arrow key is pressed when the widget is selected,\n     * * the selection is next to a widget and the widget should become selected upon the arrow key press.\n     *\n     * See {@link #_preventDefaultOnArrowKeyPress}.\n     */\n    _handleSelectionChangeOnArrowKeyPress(eventInfo, domEventData) {\n        const keyCode = domEventData.keyCode;\n        const model = this.editor.model;\n        const schema = model.schema;\n        const modelSelection = model.document.selection;\n        const selectedElement = modelSelection.getSelectedElement();\n        const direction = getLocalizedArrowKeyCodeDirection(keyCode, this.editor.locale.contentLanguageDirection);\n        const isForward = direction == 'down' || direction == 'right';\n        const isVerticalNavigation = direction == 'up' || direction == 'down';\n        // Collapsing a non-collapsed selection.\n        if (!domEventData.shiftKey && !modelSelection.isCollapsed) {\n            // If object element is selected or object is at the edge of selection.\n            if (hasObjectAtEdge(modelSelection, schema)) {\n                const position = isForward ? modelSelection.getLastPosition() : modelSelection.getFirstPosition();\n                const newRange = schema.getNearestSelectionRange(position, isForward ? 'forward' : 'backward');\n                if (newRange) {\n                    model.change(writer => {\n                        writer.setSelection(newRange);\n                    });\n                    domEventData.preventDefault();\n                    eventInfo.stop();\n                }\n            }\n            // Else is handled by the browser.\n            return;\n        }\n        // Adjust selection for fake caret and for selection direction when single object is selected.\n        const originalSelection = getModelSelectionAdjusted(model, isForward);\n        // Clone current selection to use it as a probe. We must leave default selection as it is so it can return\n        // to its current state after undo.\n        const probe = model.createSelection(originalSelection);\n        model.modifySelection(probe, { direction: isForward ? 'forward' : 'backward' });\n        // The selection didn't change so there is nothing there.\n        if (probe.isEqual(originalSelection)) {\n            return;\n        }\n        // Move probe one step further to make it visually recognizable.\n        if (probe.focus.isTouching(originalSelection.focus)) {\n            model.modifySelection(probe, { direction: isForward ? 'forward' : 'backward' });\n        }\n        const lastSelectedNode = isForward ? originalSelection.focus.nodeBefore : originalSelection.focus.nodeAfter;\n        const nodeBeforeProbe = probe.focus.nodeBefore;\n        const nodeAfterProbe = probe.focus.nodeAfter;\n        const lastProbeNode = isForward ? nodeBeforeProbe : nodeAfterProbe;\n        if (domEventData.shiftKey) {\n            // Expand selection from a selected object or include object in selection.\n            if (selectedElement && schema.isObject(selectedElement) ||\n                lastProbeNode && schema.isObject(lastProbeNode) ||\n                lastSelectedNode && schema.isObject(lastSelectedNode)) {\n                model.change(writer => {\n                    writer.setSelection(probe);\n                });\n                domEventData.preventDefault();\n                eventInfo.stop();\n            }\n        }\n        else {\n            // Select an object when moving caret over it.\n            if (lastProbeNode && schema.isObject(lastProbeNode)) {\n                if (schema.isInline(lastProbeNode) && isVerticalNavigation) {\n                    return;\n                }\n                model.change(writer => {\n                    writer.setSelection(lastProbeNode, 'on');\n                });\n                domEventData.preventDefault();\n                eventInfo.stop();\n            }\n        }\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and prevents\n     * the default browser behavior to make sure the fake selection is not being moved from a fake selection\n     * container.\n     *\n     * See {@link #_handleSelectionChangeOnArrowKeyPress}.\n     */\n    _preventDefaultOnArrowKeyPress(eventInfo, domEventData) {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const objectElement = model.document.selection.getSelectedElement();\n        // If object element is selected.\n        if (objectElement && schema.isObject(objectElement)) {\n            domEventData.preventDefault();\n            eventInfo.stop();\n        }\n    }\n    /**\n     * Handles delete keys: backspace and delete.\n     *\n     * @param isForward Set to true if delete was performed in forward direction.\n     * @returns Returns `true` if keys were handled correctly.\n     */\n    _handleDelete(isForward) {\n        const modelDocument = this.editor.model.document;\n        const modelSelection = modelDocument.selection;\n        // Do nothing when the read only mode is enabled.\n        if (!this.editor.model.canEditAt(modelSelection)) {\n            return;\n        }\n        // Do nothing on non-collapsed selection.\n        if (!modelSelection.isCollapsed) {\n            return;\n        }\n        const objectElement = this._getObjectElementNextToSelection(isForward);\n        if (objectElement) {\n            this.editor.model.change(writer => {\n                let previousNode = modelSelection.anchor.parent;\n                // Remove previous element if empty.\n                while (previousNode.isEmpty) {\n                    const nodeToRemove = previousNode;\n                    previousNode = nodeToRemove.parent;\n                    writer.remove(nodeToRemove);\n                }\n                this._setSelectionOverElement(objectElement);\n            });\n            return true;\n        }\n    }\n    /**\n     * Sets {@link module:engine/model/selection~ModelSelection document's selection} over given element.\n     *\n     * @internal\n     */\n    _setSelectionOverElement(element) {\n        this.editor.model.change(writer => {\n            writer.setSelection(writer.createRangeOn(element));\n        });\n    }\n    /**\n     * Checks if {@link module:engine/model/element~ModelElement element} placed next to the current\n     * {@link module:engine/model/selection~ModelSelection model selection} exists and is marked in\n     * {@link module:engine/model/schema~ModelSchema schema} as `object`.\n     *\n     * @internal\n     * @param forward Direction of checking.\n     */\n    _getObjectElementNextToSelection(forward) {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const modelSelection = model.document.selection;\n        // Clone current selection to use it as a probe. We must leave default selection as it is so it can return\n        // to its current state after undo.\n        const probe = model.createSelection(modelSelection);\n        model.modifySelection(probe, { direction: forward ? 'forward' : 'backward' });\n        // The selection didn't change so there is nothing there.\n        if (probe.isEqual(modelSelection)) {\n            return null;\n        }\n        const objectElement = forward ? probe.focus.nodeBefore : probe.focus.nodeAfter;\n        if (objectElement && schema.isObject(objectElement)) {\n            return objectElement;\n        }\n        return null;\n    }\n    /**\n     * Removes CSS class from previously selected widgets.\n     */\n    _clearPreviouslySelectedWidgets(writer) {\n        for (const widget of this._previouslySelected) {\n            writer.removeClass(WIDGET_SELECTED_CLASS_NAME, widget);\n        }\n        this._previouslySelected.clear();\n    }\n    /**\n     * Moves the document selection into the next editable or block widget.\n     */\n    _selectNextEditable(direction) {\n        const editing = this.editor.editing;\n        const view = editing.view;\n        const model = this.editor.model;\n        const viewSelection = view.document.selection;\n        const modelSelection = model.document.selection;\n        // Find start position.\n        let startPosition;\n        // Multiple table cells are selected - use focus cell.\n        if (modelSelection.rangeCount > 1) {\n            const selectionRange = modelSelection.isBackward ?\n                modelSelection.getFirstRange() :\n                modelSelection.getLastRange();\n            startPosition = editing.mapper.toViewPosition(direction == 'forward' ?\n                selectionRange.end :\n                selectionRange.start);\n        }\n        else {\n            startPosition = direction == 'forward' ?\n                viewSelection.getFirstPosition() :\n                viewSelection.getLastPosition();\n        }\n        const modelRange = this._findNextFocusRange(startPosition, direction);\n        if (modelRange) {\n            model.change(writer => {\n                writer.setSelection(modelRange);\n            });\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Looks for next focus point in the document starting from the given view position and direction.\n     * The focus point is either a block widget or an editable.\n     *\n     * @internal\n     */\n    _findNextFocusRange(startPosition, direction) {\n        const editing = this.editor.editing;\n        const view = editing.view;\n        const model = this.editor.model;\n        const viewSelection = view.document.selection;\n        const editableElement = viewSelection.editableElement;\n        const editablePath = editableElement.getPath();\n        let selectedElement = viewSelection.getSelectedElement();\n        if (selectedElement && !isWidget(selectedElement)) {\n            selectedElement = null;\n        }\n        // Look for the next editable.\n        const viewRange = direction == 'forward' ?\n            view.createRange(startPosition, view.createPositionAt(startPosition.root, 'end')) :\n            view.createRange(view.createPositionAt(startPosition.root, 0), startPosition);\n        for (const { nextPosition } of viewRange.getWalker({ direction })) {\n            const item = nextPosition.parent;\n            // Some widget along the way except the currently selected one.\n            if (isWidget(item) && item != selectedElement) {\n                const modelElement = editing.mapper.toModelElement(item);\n                // Do not select inline widgets.\n                if (!model.schema.isBlock(modelElement)) {\n                    continue;\n                }\n                // Do not select widget itself when going out of widget or iterating over sibling elements in a widget.\n                if (compareArrays(editablePath, item.getPath()) != 'extension') {\n                    return model.createRangeOn(modelElement);\n                }\n            }\n            // Encountered an editable element.\n            else if (item.is('editableElement')) {\n                // Ignore the current editable for text selection,\n                // but use it when widget was selected to be able to jump after the widget.\n                if (item == editableElement && !selectedElement) {\n                    continue;\n                }\n                const modelPosition = editing.mapper.toModelPosition(nextPosition);\n                const newRange = model.schema.getNearestSelectionRange(modelPosition, direction);\n                // There is nothing to select so just jump to the next one.\n                if (!newRange) {\n                    continue;\n                }\n                // In the same editable while widget was selected - do not select the editable content.\n                if (item == editableElement && selectedElement) {\n                    return newRange;\n                }\n                // Select the content of editable element when iterating over sibling editable elements\n                // or going deeper into nested widgets.\n                if (compareArrays(editablePath, item.getPath()) != 'extension') {\n                    // Find a limit element closest to the new selection range.\n                    return model.createRangeIn(model.schema.getLimitElement(newRange));\n                }\n                return newRange;\n            }\n        }\n        return null;\n    }\n    /**\n     * Updates the document selection so that it selects first ancestor widget.\n     */\n    _selectAncestorWidget() {\n        const editor = this.editor;\n        const mapper = editor.editing.mapper;\n        const selection = editor.editing.view.document.selection;\n        const positionParent = selection.getFirstPosition().parent;\n        const positionParentElement = positionParent.is('$text') ?\n            positionParent.parent :\n            positionParent;\n        const viewElement = positionParentElement.findAncestor(isWidget);\n        if (!viewElement) {\n            return false;\n        }\n        const modelElement = mapper.toModelElement(viewElement);\n        /* istanbul ignore next -- @preserve */\n        if (!modelElement) {\n            return false;\n        }\n        editor.model.change(writer => {\n            writer.setSelection(modelElement, 'on');\n        });\n        return true;\n    }\n}\n/**\n * Returns true if there is an object on an edge of the given selection.\n */\nfunction hasObjectAtEdge(modelSelection, schema) {\n    const firstPosition = modelSelection.getFirstPosition();\n    const lastPosition = modelSelection.getLastPosition();\n    const firstSelectedNode = firstPosition.nodeAfter;\n    const lastSelectedNode = lastPosition.nodeBefore;\n    return (!!firstSelectedNode && schema.isObject(firstSelectedNode) ||\n        !!lastSelectedNode && schema.isObject(lastSelectedNode));\n}\n/**\n * Returns new instance of the model selection adjusted for fake caret and selection direction on widgets.\n */\nfunction getModelSelectionAdjusted(model, isForward) {\n    const modelSelection = model.document.selection;\n    const selectedElement = modelSelection.getSelectedElement();\n    // Adjust selection for fake caret.\n    const typeAroundFakeCaretPosition = getTypeAroundFakeCaretPosition(modelSelection);\n    if (selectedElement && typeAroundFakeCaretPosition == 'before') {\n        return model.createSelection(selectedElement, 'before');\n    }\n    else if (selectedElement && typeAroundFakeCaretPosition == 'after') {\n        return model.createSelection(selectedElement, 'after');\n    }\n    // Make a copy of selection with adjusted direction for object selected.\n    return model.createSelection(modelSelection.getRanges(), {\n        backward: !!selectedElement && model.schema.isObject(selectedElement) ? !isForward : modelSelection.isBackward\n    });\n}\n/**\n * Finds the closest ancestor element that is either an editable element or a widget.\n *\n * @param element The element from which to start searching.\n * @returns The closest ancestor element that is either an editable element or a widget, or null if none is found.\n */\nfunction findClosestEditableOrWidgetAncestor(element) {\n    let currentElement = element;\n    while (currentElement) {\n        if (currentElement.is('editableElement') || isWidget(currentElement)) {\n            return currentElement;\n        }\n        currentElement = currentElement.parent;\n    }\n    return null;\n}\n/**\n * Retrieves the ViewElement associated with a mouse event in the editing view.\n *\n * @param view The editing view.\n * @param domEventData The DOM event data containing the mouse event.\n * @returns The ViewElement associated with the mouse event, or null if not found.\n */\nfunction getElementFromMouseEvent(view, domEventData) {\n    const domRange = getRangeFromMouseEvent(domEventData.domEvent);\n    let viewRange = null;\n    if (domRange) {\n        viewRange = view.domConverter.domRangeToView(domRange);\n    }\n    else {\n        // Fallback to create range in target element. It happens frequently on Safari browser.\n        // See more: https://github.com/ckeditor/ckeditor5/issues/16978\n        viewRange = view.createRange(view.createPositionAt(domEventData.target, 0));\n    }\n    if (!viewRange) {\n        return null;\n    }\n    const viewPosition = viewRange.start;\n    if (!viewPosition.parent) {\n        return null;\n    }\n    let viewNode = viewPosition.parent;\n    if (viewPosition.parent.is('editableElement')) {\n        if (viewPosition.isAtEnd && viewPosition.nodeBefore) {\n            // Click after a widget tend to return position at the end of the editable element\n            // so use the node before it if range is at the end of a parent.\n            viewNode = viewPosition.nodeBefore;\n        }\n        else if (viewPosition.isAtStart && viewPosition.nodeAfter) {\n            // Click before a widget tend to return position at the start of the editable element\n            // so use the node after it if range is at the start of a parent.\n            // See more: https://github.com/ckeditor/ckeditor5/issues/16992\n            viewNode = viewPosition.nodeAfter;\n        }\n    }\n    if (viewNode.is('$text')) {\n        return viewNode.parent;\n    }\n    return viewNode;\n}\n/**\n * Checks whether the specified `element` is a child of the `parent` element.\n *\n * @param element An element to check.\n * @param parent A parent for the element.\n */\nfunction isChild(element, parent) {\n    if (!parent) {\n        return false;\n    }\n    return Array.from(element.getAncestors()).includes(parent);\n}\n/**\n * Returns nearest text block ancestor.\n */\nfunction findTextBlockAncestor(modelElement, schema) {\n    for (const element of modelElement.getAncestors({ includeSelf: true, parentFirst: true })) {\n        if (schema.checkChild(element, '$text')) {\n            return element;\n        }\n        // Do not go beyond nested editable.\n        if (schema.isLimit(element) && !schema.isObject(element)) {\n            break;\n        }\n    }\n    return null;\n}\n/**\n * Returns next text block where could put selection.\n */\nfunction findNextTextBlock(position, schema) {\n    const treeWalker = new ModelTreeWalker({ startPosition: position });\n    for (const { item } of treeWalker) {\n        if (schema.isLimit(item) || !item.is('element')) {\n            return null;\n        }\n        if (schema.checkChild(item, '$text')) {\n            return item;\n        }\n    }\n    return null;\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/panel/balloon/contextualballoon\n */\nimport { BalloonPanelView } from './balloonpanelview.js';\nimport { View } from '../../view.js';\nimport { ButtonView } from '../../button/buttonview.js';\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { CKEditorError, FocusTracker, Rect, toUnit } from '@ckeditor/ckeditor5-utils';\nimport { IconNextArrow, IconPreviousArrow } from '@ckeditor/ckeditor5-icons';\nimport '../../../theme/components/panel/balloonrotator.css';\nimport '../../../theme/components/panel/fakepanel.css';\nconst toPx = /* #__PURE__ */ toUnit('px');\n/**\n * Provides the common contextual balloon for the editor.\n *\n * The role of this plugin is to unify the contextual balloons logic, simplify views management and help\n * avoid the unnecessary complexity of handling multiple {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView}\n * instances in the editor.\n *\n * This plugin allows for creating single or multiple panel stacks.\n *\n * Each stack may have multiple views, with the one on the top being visible. When the visible view is removed from the stack,\n * the previous view becomes visible.\n *\n * It might be useful to implement nested navigation in a balloon. For instance, a toolbar view may contain a link button.\n * When you click it, a link view (which lets you set the URL) is created and put on top of the toolbar view, so the link panel\n * is displayed. When you finish editing the link and close (remove) the link view, the toolbar view is visible again.\n *\n * However, there are cases when there are multiple independent balloons to be displayed, for instance, if the selection\n * is inside two inline comments at the same time. For such cases, you can create two independent panel stacks.\n * The contextual balloon plugin will create a navigation bar to let the users switch between these panel stacks using the \"Next\"\n * and \"Previous\" buttons.\n *\n * If there are no views in the current stack, the balloon panel will try to switch to the next stack. If there are no\n * panels in any stack, the balloon panel will be hidden.\n *\n * **Note**: To force the balloon panel to show only one view, even if there are other stacks, use the `singleViewMode=true` option\n * when {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon#add adding} a view to a panel.\n *\n * From the implementation point of view, the contextual ballon plugin is reusing a single\n * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView} instance to display multiple contextual balloon\n * panels in the editor. It also creates a special {@link module:ui/panel/balloon/contextualballoon~RotatorView rotator view},\n * used to manage multiple panel stacks. Rotator view is a child of the balloon panel view and the parent of the specific\n * view you want to display. If there is more than one panel stack to be displayed, the rotator view will add a\n * navigation bar. If there is only one stack, the rotator view is transparent (it does not add any UI elements).\n */\nexport class ContextualBalloon extends Plugin {\n    /**\n     * The {@link module:utils/dom/position~DomOptimalPositionOptions#limiter position limiter}\n     * for the {@link #view balloon}, used when no `limiter` has been passed into {@link #add}\n     * or {@link #updatePosition}.\n     *\n     * By default, a function that obtains the farthest DOM\n     * {@link module:engine/view/rooteditableelement~ViewRootEditableElement}\n     * of the {@link module:engine/view/document~ViewDocument#selection}.\n     */\n    positionLimiter;\n    visibleStack;\n    /**\n     * The map of views and their stacks.\n     */\n    _viewToStack = new Map();\n    /**\n     * The map of IDs and stacks.\n     */\n    _idToStack = new Map();\n    /**\n     * The common balloon panel view.\n     */\n    _view = null;\n    /**\n     * Rotator view embedded in the contextual balloon.\n     * Displays the currently visible view in the balloon and provides navigation for switching stacks.\n     */\n    _rotatorView = null;\n    /**\n     * Displays fake panels under the balloon panel view when multiple stacks are added to the balloon.\n     */\n    _fakePanelsView = null;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ContextualBalloon';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this.positionLimiter = () => {\n            const view = this.editor.editing.view;\n            const viewDocument = view.document;\n            const editableElement = viewDocument.selection.editableElement;\n            if (editableElement) {\n                return view.domConverter.mapViewToDom(editableElement.root);\n            }\n            return null;\n        };\n        this.decorate('getPositionOptions');\n        this.set('visibleView', null);\n        this.set('_numberOfStacks', 0);\n        this.set('_singleViewMode', false);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        if (this._view) {\n            this._view.destroy();\n        }\n        if (this._rotatorView) {\n            this._rotatorView.destroy();\n        }\n        if (this._fakePanelsView) {\n            this._fakePanelsView.destroy();\n        }\n    }\n    /**\n     * The common balloon panel view.\n     */\n    get view() {\n        if (!this._view) {\n            this._createPanelView();\n        }\n        return this._view;\n    }\n    /**\n     * Returns `true` when the given view is in one of the stacks. Otherwise returns `false`.\n     */\n    hasView(view) {\n        return Array.from(this._viewToStack.keys()).includes(view);\n    }\n    /**\n     * Adds a new view to the stack and makes it visible if the current stack is visible\n     * or it is the first view in the balloon.\n     *\n     * @param data The configuration of the view.\n     * @param data.stackId The ID of the stack that the view is added to. Defaults to `'main'`.\n     * @param data.view The content of the balloon.\n     * @param data.position Positioning options.\n     * @param data.balloonClassName An additional CSS class added to the {@link #view balloon} when visible.\n     * @param data.withArrow Whether the {@link #view balloon} should be rendered with an arrow. Defaults to `true`.\n     * @param data.singleViewMode Whether the view should be the only visible view even if other stacks were added. Defaults to `false`.\n     */\n    add(data) {\n        if (!this._view) {\n            this._createPanelView();\n        }\n        if (this.hasView(data.view)) {\n            /**\n             * Trying to add configuration of the same view more than once.\n             *\n             * @error contextualballoon-add-view-exist\n             */\n            throw new CKEditorError('contextualballoon-add-view-exist', [this, data]);\n        }\n        const stackId = data.stackId || 'main';\n        // If new stack is added, creates it and show view from this stack.\n        if (!this._idToStack.has(stackId)) {\n            this._idToStack.set(stackId, new Map([[data.view, data]]));\n            this._viewToStack.set(data.view, this._idToStack.get(stackId));\n            this._numberOfStacks = this._idToStack.size;\n            if (!this._visibleStack || data.singleViewMode) {\n                this.showStack(stackId);\n            }\n            return;\n        }\n        const stack = this._idToStack.get(stackId);\n        if (data.singleViewMode) {\n            this.showStack(stackId);\n        }\n        // Add new view to the stack.\n        stack.set(data.view, data);\n        this._viewToStack.set(data.view, stack);\n        // And display it if is added to the currently visible stack.\n        if (stack === this._visibleStack) {\n            this._showView(data);\n        }\n    }\n    /**\n     * Removes the given view from the stack. If the removed view was visible,\n     * the view preceding it in the stack will become visible instead.\n     * When there is no view in the stack, the next stack will be displayed.\n     * When there are no more stacks, the balloon will hide.\n     *\n     * @param view A view to be removed from the balloon.\n     */\n    remove(view) {\n        if (!this.hasView(view)) {\n            /**\n             * Trying to remove the configuration of the view not defined in the stack.\n             *\n             * @error contextualballoon-remove-view-not-exist\n             */\n            throw new CKEditorError('contextualballoon-remove-view-not-exist', [this, view]);\n        }\n        const stack = this._viewToStack.get(view);\n        if (this._singleViewMode && this.visibleView === view) {\n            this._singleViewMode = false;\n        }\n        // When visible view will be removed we need to show a preceding view or next stack\n        // if a view is the only view in the stack.\n        if (this.visibleView === view) {\n            if (stack.size === 1) {\n                if (this._idToStack.size > 1) {\n                    this._showNextStack();\n                }\n                else {\n                    this.view.hide();\n                    this.visibleView = null;\n                    this._rotatorView.hideView();\n                }\n            }\n            else {\n                this._showView(Array.from(stack.values())[stack.size - 2]);\n            }\n        }\n        if (stack.size === 1) {\n            this._idToStack.delete(this._getStackId(stack));\n            this._numberOfStacks = this._idToStack.size;\n        }\n        else {\n            stack.delete(view);\n        }\n        this._viewToStack.delete(view);\n    }\n    /**\n     * Updates the position of the balloon using the position data of the first visible view in the stack.\n     * When new position data is given, the position data of the currently visible view will be updated.\n     *\n     * @param position Position options.\n     */\n    updatePosition(position) {\n        if (position) {\n            this._visibleStack.get(this.visibleView).position = position;\n        }\n        this.view.pin(this.getPositionOptions());\n        this._fakePanelsView.updatePosition();\n    }\n    /**\n     * Returns position options of the last view in the stack.\n     * This keeps the balloon in the same position when the view is changed.\n     */\n    getPositionOptions() {\n        let position = Array.from(this._visibleStack.values()).pop().position;\n        if (position) {\n            // Use the default limiter if none has been specified.\n            if (!position.limiter) {\n                // Don't modify the original options object.\n                position = Object.assign({}, position, {\n                    limiter: this.positionLimiter\n                });\n            }\n            // Don't modify the original options object.\n            position = Object.assign({}, position, {\n                viewportOffsetConfig: {\n                    ...this.editor.ui.viewportOffset,\n                    top: this.editor.ui.viewportOffset.visualTop\n                }\n            });\n        }\n        return position;\n    }\n    /**\n     * Shows the last view from the stack of a given ID.\n     */\n    showStack(id) {\n        this.visibleStack = id;\n        const stack = this._idToStack.get(id);\n        if (!stack) {\n            /**\n             * Trying to show a stack that does not exist.\n             *\n             * @error contextualballoon-showstack-stack-not-exist\n             */\n            throw new CKEditorError('contextualballoon-showstack-stack-not-exist', this);\n        }\n        if (this._visibleStack === stack) {\n            return;\n        }\n        this._showView(Array.from(stack.values()).pop());\n    }\n    /**\n     * Initializes view instances.\n     */\n    _createPanelView() {\n        this._view = new BalloonPanelView(this.editor.locale);\n        this.editor.ui.view.body.add(this._view);\n        this._rotatorView = this._createRotatorView();\n        this._fakePanelsView = this._createFakePanelsView();\n    }\n    /**\n     * Returns the stack of the currently visible view.\n     */\n    get _visibleStack() {\n        return this._viewToStack.get(this.visibleView);\n    }\n    /**\n     * Returns the ID of the given stack.\n     */\n    _getStackId(stack) {\n        const entry = Array.from(this._idToStack.entries()).find(entry => entry[1] === stack);\n        return entry[0];\n    }\n    /**\n     * Shows the last view from the next stack.\n     */\n    _showNextStack() {\n        const stacks = Array.from(this._idToStack.values());\n        let nextIndex = stacks.indexOf(this._visibleStack) + 1;\n        if (!stacks[nextIndex]) {\n            nextIndex = 0;\n        }\n        this.showStack(this._getStackId(stacks[nextIndex]));\n    }\n    /**\n     * Shows the last view from the previous stack.\n     */\n    _showPrevStack() {\n        const stacks = Array.from(this._idToStack.values());\n        let nextIndex = stacks.indexOf(this._visibleStack) - 1;\n        if (!stacks[nextIndex]) {\n            nextIndex = stacks.length - 1;\n        }\n        this.showStack(this._getStackId(stacks[nextIndex]));\n    }\n    /**\n     * Creates a rotator view.\n     */\n    _createRotatorView() {\n        const view = new RotatorView(this.editor.locale);\n        const t = this.editor.locale.t;\n        this.view.content.add(view);\n        // Hide navigation when there is only a one stack & not in single view mode.\n        view.bind('isNavigationVisible').to(this, '_numberOfStacks', this, '_singleViewMode', (value, isSingleViewMode) => {\n            return !isSingleViewMode && value > 1;\n        });\n        // Update balloon position after toggling navigation.\n        view.on('change:isNavigationVisible', () => (this.updatePosition()), { priority: 'low' });\n        // Update stacks counter value.\n        view.bind('counter').to(this, 'visibleView', this, '_numberOfStacks', (visibleView, numberOfStacks) => {\n            if (numberOfStacks < 2) {\n                return '';\n            }\n            const current = Array.from(this._idToStack.values()).indexOf(this._visibleStack) + 1;\n            return t('%0 of %1', [current, numberOfStacks]);\n        });\n        view.buttonNextView.on('execute', () => {\n            // When current view has a focus then move focus to the editable before removing it,\n            // otherwise editor will lost focus.\n            if (view.focusTracker.isFocused) {\n                this.editor.editing.view.focus();\n            }\n            this._showNextStack();\n        });\n        view.buttonPrevView.on('execute', () => {\n            // When current view has a focus then move focus to the editable before removing it,\n            // otherwise editor will lost focus.\n            if (view.focusTracker.isFocused) {\n                this.editor.editing.view.focus();\n            }\n            this._showPrevStack();\n        });\n        return view;\n    }\n    /**\n     * Creates a fake panels view.\n     */\n    _createFakePanelsView() {\n        const view = new FakePanelsView(this.editor.locale, this.view);\n        view.bind('numberOfPanels').to(this, '_numberOfStacks', this, '_singleViewMode', (number, isSingleViewMode) => {\n            const showPanels = !isSingleViewMode && number >= 2;\n            return showPanels ? Math.min(number - 1, 2) : 0;\n        });\n        view.listenTo(this.view, 'change:top', () => view.updatePosition());\n        view.listenTo(this.view, 'change:left', () => view.updatePosition());\n        this.editor.ui.view.body.add(view);\n        return view;\n    }\n    /**\n     * Sets the view as the content of the balloon and attaches the balloon using position\n     * options of the first view.\n     *\n     * @param data Configuration.\n     * @param data.view The view to show in the balloon.\n     * @param data.balloonClassName Additional class name which will be added to the {@link #view balloon}.\n     * @param data.withArrow Whether the {@link #view balloon} should be rendered with an arrow.\n     */\n    _showView({ view, balloonClassName = '', withArrow = true, singleViewMode = false }) {\n        this.view.class = balloonClassName;\n        this.view.withArrow = withArrow;\n        this._rotatorView.showView(view);\n        this.visibleView = view;\n        this.view.pin(this.getPositionOptions());\n        this._fakePanelsView.updatePosition();\n        if (singleViewMode) {\n            this._singleViewMode = true;\n        }\n    }\n}\n/**\n * Rotator view is a helper class for the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon}.\n * It is used for displaying the last view from the current stack and providing navigation buttons for switching stacks.\n * See the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon} documentation to learn more.\n * @internal\n */\nexport class RotatorView extends View {\n    /**\n     * Used for checking if a view is focused or not.\n     */\n    focusTracker;\n    /**\n     * Navigation button for switching the stack to the previous one.\n     */\n    buttonPrevView;\n    /**\n     * Navigation button for switching the stack to the next one.\n     */\n    buttonNextView;\n    /**\n     * A collection of the child views that creates the rotator content.\n     */\n    content;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const t = locale.t;\n        const bind = this.bindTemplate;\n        this.set('isNavigationVisible', true);\n        this.focusTracker = new FocusTracker();\n        this.buttonPrevView = this._createButtonView(t('Previous'), IconPreviousArrow);\n        this.buttonNextView = this._createButtonView(t('Next'), IconNextArrow);\n        this.content = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-balloon-rotator'\n                ],\n                'z-index': '-1'\n            },\n            children: [\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck-balloon-rotator__navigation',\n                            bind.to('isNavigationVisible', value => value ? '' : 'ck-hidden')\n                        ]\n                    },\n                    children: [\n                        this.buttonPrevView,\n                        {\n                            tag: 'span',\n                            attributes: {\n                                class: [\n                                    'ck-balloon-rotator__counter'\n                                ]\n                            },\n                            children: [\n                                {\n                                    text: bind.to('counter')\n                                }\n                            ]\n                        },\n                        this.buttonNextView\n                    ]\n                },\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: 'ck-balloon-rotator__content'\n                    },\n                    children: this.content\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.focusTracker.add(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n    }\n    /**\n     * Shows a given view.\n     *\n     * @param view The view to show.\n     */\n    showView(view) {\n        this.hideView();\n        this.content.add(view);\n    }\n    /**\n     * Hides the currently displayed view.\n     */\n    hideView() {\n        this.content.clear();\n    }\n    /**\n     * Creates a navigation button view.\n     *\n     * @param label The button label.\n     * @param icon The button icon.\n     */\n    _createButtonView(label, icon) {\n        const view = new ButtonView(this.locale);\n        view.set({\n            label,\n            icon,\n            tooltip: true\n        });\n        return view;\n    }\n}\n/**\n * Displays additional layers under the balloon when multiple stacks are added to the balloon.\n */\nclass FakePanelsView extends View {\n    /**\n     * Collection of the child views which creates fake panel content.\n     */\n    content;\n    /**\n     * Context.\n     */\n    _balloonPanelView;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale, balloonPanelView) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('top', 0);\n        this.set('left', 0);\n        this.set('height', 0);\n        this.set('width', 0);\n        this.set('numberOfPanels', 0);\n        this.content = this.createCollection();\n        this._balloonPanelView = balloonPanelView;\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck-fake-panel',\n                    bind.to('numberOfPanels', number => number ? '' : 'ck-hidden')\n                ],\n                style: {\n                    top: bind.to('top', toPx),\n                    left: bind.to('left', toPx),\n                    width: bind.to('width', toPx),\n                    height: bind.to('height', toPx)\n                }\n            },\n            children: this.content\n        });\n        this.on('change:numberOfPanels', (evt, name, next, prev) => {\n            if (next > prev) {\n                this._addPanels(next - prev);\n            }\n            else {\n                this._removePanels(prev - next);\n            }\n            this.updatePosition();\n        });\n    }\n    _addPanels(number) {\n        while (number--) {\n            const view = new View();\n            view.setTemplate({ tag: 'div' });\n            this.content.add(view);\n            this.registerChild(view);\n        }\n    }\n    _removePanels(number) {\n        while (number--) {\n            const view = this.content.last;\n            this.content.remove(view);\n            this.deregisterChild(view);\n            view.destroy();\n        }\n    }\n    /**\n     * Updates coordinates of fake panels.\n     */\n    updatePosition() {\n        if (this.numberOfPanels) {\n            const { top, left } = this._balloonPanelView;\n            const { width, height } = new Rect(this._balloonPanelView.element);\n            Object.assign(this, { top, left, width, height });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgettoolbarrepository\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { BalloonPanelView, ContextualBalloon, ToolbarView } from '@ckeditor/ckeditor5-ui';\nimport { CKEditorError, logWarning } from '@ckeditor/ckeditor5-utils';\nimport { isWidget } from './utils.js';\n/**\n * Widget toolbar repository plugin. A central point for registering widget toolbars. This plugin handles the whole\n * toolbar rendering process and exposes a concise API.\n *\n * To add a toolbar for your widget use the {@link ~WidgetToolbarRepository#register `WidgetToolbarRepository#register()`} method.\n *\n * The following example comes from the {@link module:image/imagetoolbar~ImageToolbar} plugin:\n *\n * ```ts\n * class ImageToolbar extends Plugin {\n * \tstatic get requires() {\n * \t\treturn [ WidgetToolbarRepository ];\n * \t}\n *\n * \tafterInit() {\n * \t\tconst editor = this.editor;\n * \t\tconst widgetToolbarRepository = editor.plugins.get( WidgetToolbarRepository );\n *\n * \t\twidgetToolbarRepository.register( 'image', {\n * \t\t\titems: editor.config.get( 'image.toolbar' ),\n * \t\t\tgetRelatedElement: getClosestSelectedImageWidget\n * \t\t} );\n * \t}\n * }\n * ```\n */\nexport class WidgetToolbarRepository extends Plugin {\n    /**\n     * A map of toolbar definitions.\n     */\n    _toolbarDefinitions = new Map();\n    _balloon;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'WidgetToolbarRepository';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Disables the default balloon toolbar for all widgets.\n        if (editor.plugins.has('BalloonToolbar')) {\n            const balloonToolbar = editor.plugins.get('BalloonToolbar');\n            this.listenTo(balloonToolbar, 'show', evt => {\n                if (isWidgetSelected(editor.editing.view.document.selection)) {\n                    evt.stop();\n                }\n            }, { priority: 'high' });\n        }\n        this._balloon = this.editor.plugins.get('ContextualBalloon');\n        this.on('change:isEnabled', () => {\n            this._updateToolbarsVisibility();\n        });\n        this.listenTo(editor.ui, 'update', () => {\n            this._updateToolbarsVisibility();\n        });\n        // UI#update is not fired after focus is back in editor, we need to check if balloon panel should be visible.\n        this.listenTo(editor.ui.focusTracker, 'change:isFocused', () => {\n            this._updateToolbarsVisibility();\n        }, { priority: 'low' });\n    }\n    destroy() {\n        super.destroy();\n        for (const toolbarConfig of this._toolbarDefinitions.values()) {\n            toolbarConfig.view.destroy();\n        }\n    }\n    /**\n     * Registers toolbar in the WidgetToolbarRepository. It renders it in the `ContextualBalloon` based on the value of the invoked\n     * `getRelatedElement` function. Toolbar items are gathered from `items` array.\n     * The balloon's CSS class is by default `ck-toolbar-container` and may be override with the `balloonClassName` option.\n     *\n     * Note: This method should be called in the {@link module:core/plugin~PluginInterface#afterInit `Plugin#afterInit()`}\n     * callback (or later) to make sure that the given toolbar items were already registered by other plugins.\n     *\n     * @param toolbarId An id for the toolbar. Used to\n     * @param options Detailed options\n     * @param options.ariaLabel Label used by assistive technologies to describe this toolbar element.\n     * @param options.items Array of toolbar items.\n     * @param options.getRelatedElement Callback which returns an element the toolbar should be attached to.\n     * @param options.balloonClassName CSS class for the widget balloon.\n     */\n    register(toolbarId, { ariaLabel, items, getRelatedElement, balloonClassName = 'ck-toolbar-container', positions }) {\n        // Trying to register a toolbar without any item.\n        if (!items.length) {\n            /**\n             * When {@link module:widget/widgettoolbarrepository~WidgetToolbarRepository#register registering} a new widget toolbar, you\n             * need to provide a non-empty array with the items that will be inserted into the toolbar.\n             *\n             * If you see this error when integrating the editor, you likely forgot to configure one of the widget toolbars.\n             *\n             * See for instance:\n             *\n             * * {@link module:table/tableconfig~TableConfig#contentToolbar `config.table.contentToolbar`}\n             * * {@link module:image/imageconfig~ImageConfig#toolbar `config.image.toolbar`}\n             *\n             * @error widget-toolbar-no-items\n             * @param {string} toolbarId The id of the toolbar that has not been configured correctly.\n             */\n            logWarning('widget-toolbar-no-items', { toolbarId });\n            return;\n        }\n        const editor = this.editor;\n        const t = editor.t;\n        const toolbarView = new ToolbarView(editor.locale);\n        toolbarView.ariaLabel = ariaLabel || t('Widget toolbar');\n        if (this._toolbarDefinitions.has(toolbarId)) {\n            /**\n             * Toolbar with the given id was already added.\n             *\n             * @error widget-toolbar-duplicated\n             * @param {string} toolbarId Toolbar id.\n             */\n            throw new CKEditorError('widget-toolbar-duplicated', this, { toolbarId });\n        }\n        const toolbarDefinition = {\n            view: toolbarView,\n            getRelatedElement,\n            balloonClassName,\n            itemsConfig: items,\n            positions,\n            initialized: false\n        };\n        // Register the toolbar so it becomes available for Alt+F10 and Esc navigation.\n        editor.ui.addToolbar(toolbarView, {\n            isContextual: true,\n            beforeFocus: () => {\n                const relatedElement = getRelatedElement(editor.editing.view.document.selection);\n                if (relatedElement) {\n                    this._showToolbar(toolbarDefinition, relatedElement);\n                }\n            },\n            afterBlur: () => {\n                this._hideToolbar(toolbarDefinition);\n            }\n        });\n        this._toolbarDefinitions.set(toolbarId, toolbarDefinition);\n    }\n    /**\n     * Iterates over stored toolbars and makes them visible or hidden.\n     */\n    _updateToolbarsVisibility() {\n        let maxRelatedElementDepth = 0;\n        let deepestRelatedElement = null;\n        let deepestToolbarDefinition = null;\n        for (const definition of this._toolbarDefinitions.values()) {\n            const relatedElement = definition.getRelatedElement(this.editor.editing.view.document.selection);\n            if (!this.isEnabled || !relatedElement) {\n                if (this._isToolbarInBalloon(definition)) {\n                    this._hideToolbar(definition);\n                }\n            }\n            else if (!this.editor.ui.focusTracker.isFocused) {\n                if (this._isToolbarVisible(definition)) {\n                    this._hideToolbar(definition);\n                }\n            }\n            else {\n                const relatedElementDepth = relatedElement.getAncestors().length;\n                // Many toolbars can express willingness to be displayed but they do not know about\n                // each other. Figure out which toolbar is deepest in the view tree to decide which\n                // should be displayed. For instance, if a selected image is inside a table cell, display\n                // the ImageToolbar rather than the TableToolbar (#60).\n                if (relatedElementDepth > maxRelatedElementDepth) {\n                    maxRelatedElementDepth = relatedElementDepth;\n                    deepestRelatedElement = relatedElement;\n                    deepestToolbarDefinition = definition;\n                }\n            }\n        }\n        if (deepestToolbarDefinition) {\n            this._showToolbar(deepestToolbarDefinition, deepestRelatedElement);\n        }\n    }\n    /**\n     * Hides the given toolbar.\n     */\n    _hideToolbar(toolbarDefinition) {\n        this._balloon.remove(toolbarDefinition.view);\n        this.stopListening(this._balloon, 'change:visibleView');\n    }\n    /**\n     * Shows up the toolbar if the toolbar is not visible.\n     * Otherwise, repositions the toolbar's balloon when toolbar's view is the most top view in balloon stack.\n     *\n     * It might happen here that the toolbar's view is under another view. Then do nothing as the other toolbar view\n     * should be still visible after the {@link module:ui/editorui/editorui~EditorUI#event:update}.\n     */\n    _showToolbar(toolbarDefinition, relatedElement) {\n        if (this._isToolbarVisible(toolbarDefinition)) {\n            repositionContextualBalloon(this.editor, relatedElement, toolbarDefinition.positions);\n        }\n        else if (!this._isToolbarInBalloon(toolbarDefinition)) {\n            if (!toolbarDefinition.initialized) {\n                toolbarDefinition.initialized = true;\n                toolbarDefinition.view.fillFromConfig(toolbarDefinition.itemsConfig, this.editor.ui.componentFactory);\n            }\n            this._balloon.add({\n                view: toolbarDefinition.view,\n                position: getBalloonPositionData(this.editor, relatedElement, toolbarDefinition.positions),\n                balloonClassName: toolbarDefinition.balloonClassName\n            });\n            // Update toolbar position each time stack with toolbar view is switched to visible.\n            // This is in a case target element has changed when toolbar was in invisible stack\n            // e.g. target image was wrapped by a block quote.\n            // See https://github.com/ckeditor/ckeditor5-widget/issues/92.\n            this.listenTo(this._balloon, 'change:visibleView', () => {\n                for (const definition of this._toolbarDefinitions.values()) {\n                    if (this._isToolbarVisible(definition)) {\n                        const relatedElement = definition.getRelatedElement(this.editor.editing.view.document.selection);\n                        repositionContextualBalloon(this.editor, relatedElement, toolbarDefinition.positions);\n                    }\n                }\n            });\n        }\n    }\n    _isToolbarVisible(toolbar) {\n        return this._balloon.visibleView === toolbar.view;\n    }\n    _isToolbarInBalloon(toolbar) {\n        return this._balloon.hasView(toolbar.view);\n    }\n}\nfunction repositionContextualBalloon(editor, relatedElement, positions) {\n    const balloon = editor.plugins.get('ContextualBalloon');\n    const position = getBalloonPositionData(editor, relatedElement, positions);\n    balloon.updatePosition(position);\n}\nfunction getBalloonPositionData(editor, relatedElement, positions) {\n    const editingView = editor.editing.view;\n    const defaultPositions = BalloonPanelView.defaultPositions;\n    return {\n        target: editingView.domConverter.mapViewToDom(relatedElement),\n        positions: positions || [\n            defaultPositions.northArrowSouth,\n            defaultPositions.northArrowSouthWest,\n            defaultPositions.northArrowSouthEast,\n            defaultPositions.southArrowNorth,\n            defaultPositions.southArrowNorthWest,\n            defaultPositions.southArrowNorthEast,\n            defaultPositions.viewportStickyNorth\n        ]\n    };\n}\nfunction isWidgetSelected(selection) {\n    const viewElement = selection.getSelectedElement();\n    return !!(viewElement && isWidget(viewElement));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgetresize/resizerstate\n */\nimport { ObservableMixin, Rect } from '@ckeditor/ckeditor5-utils';\nimport { calculateResizeHostPercentageWidth } from '../utils.js';\n/**\n * Stores the internal state of a single resizable object.\n */\nexport class WidgetResizeState extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * The reference point of the resizer where the dragging started. It is used to measure the distance the user cursor\n     * traveled, so how much the image should be enlarged.\n     * This information is only known after the DOM was rendered, so it will be updated later.\n     *\n     * @internal\n     */\n    _referenceCoordinates;\n    /**\n     * Resizer options.\n     */\n    _options;\n    /**\n     * The original width (pixels) of the resized object when the resize process was started.\n     *\n     * @readonly\n     */\n    _originalWidth;\n    /**\n     * The original height (pixels) of the resized object when the resize process was started.\n     *\n     * @readonly\n     */\n    _originalHeight;\n    /**\n     * The original width (percents) of the resized object when the resize process was started.\n     *\n     * @readonly\n     */\n    _originalWidthPercents;\n    /**\n     * A width to height ratio of the resized image.\n     *\n     * @readonly\n     */\n    _aspectRatio;\n    /**\n     * @param options Resizer options.\n     */\n    constructor(options) {\n        super();\n        this.set('activeHandlePosition', null);\n        this.set('proposedWidthPercents', null);\n        this.set('proposedWidth', null);\n        this.set('proposedHeight', null);\n        this.set('proposedHandleHostWidth', null);\n        this.set('proposedHandleHostHeight', null);\n        this._options = options;\n        this._referenceCoordinates = null;\n    }\n    /**\n     * The original width (pixels) of the resized object when the resize process was started.\n     */\n    get originalWidth() {\n        return this._originalWidth;\n    }\n    /**\n     * The original height (pixels) of the resized object when the resize process was started.\n     */\n    get originalHeight() {\n        return this._originalHeight;\n    }\n    /**\n     * The original width (percents) of the resized object when the resize process was started.\n     */\n    get originalWidthPercents() {\n        return this._originalWidthPercents;\n    }\n    /**\n     * A width to height ratio of the resized image.\n     */\n    get aspectRatio() {\n        return this._aspectRatio;\n    }\n    /**\n     *\n     * @param domResizeHandle The handle used to calculate the reference point.\n     */\n    begin(domResizeHandle, domHandleHost, domResizeHost) {\n        const clientRect = new Rect(domHandleHost);\n        this.activeHandlePosition = getHandlePosition(domResizeHandle);\n        this._referenceCoordinates = getAbsoluteBoundaryPoint(domHandleHost, getOppositePosition(this.activeHandlePosition));\n        this._originalWidth = clientRect.width;\n        this._originalHeight = clientRect.height;\n        this._aspectRatio = clientRect.width / clientRect.height;\n        const widthStyle = domResizeHost.style.width;\n        if (widthStyle && widthStyle.match(/^\\d+(\\.\\d*)?%$/)) {\n            this._originalWidthPercents = parseFloat(widthStyle);\n        }\n        else {\n            this._originalWidthPercents = calculateResizeHostPercentageWidth(domResizeHost, clientRect);\n        }\n    }\n    update(newSize) {\n        this.proposedWidth = newSize.width;\n        this.proposedHeight = newSize.height;\n        this.proposedWidthPercents = newSize.widthPercents;\n        this.proposedHandleHostWidth = newSize.handleHostWidth;\n        this.proposedHandleHostHeight = newSize.handleHostHeight;\n    }\n}\n/**\n * Returns coordinates of the top-left corner of an element, relative to the document's top-left corner.\n *\n * @param resizerPosition The position of the resize handle, e.g. `\"top-left\"`, `\"bottom-right\"`.\n */\nfunction getAbsoluteBoundaryPoint(element, resizerPosition) {\n    const elementRect = new Rect(element);\n    const positionParts = resizerPosition.split('-');\n    const ret = {\n        x: positionParts[1] == 'right' ? elementRect.right : elementRect.left,\n        y: positionParts[0] == 'bottom' ? elementRect.bottom : elementRect.top\n    };\n    ret.x += element.ownerDocument.defaultView.scrollX;\n    ret.y += element.ownerDocument.defaultView.scrollY;\n    return ret;\n}\n/**\n * @param resizerPosition The expected resizer position, like `\"top-left\"`, `\"bottom-right\"`.\n * @returns A prefixed HTML class name for the resizer element.\n */\nfunction getResizerHandleClass(resizerPosition) {\n    return `ck-widget__resizer__handle-${resizerPosition}`;\n}\n/**\n * Determines the position of a given resize handle.\n *\n * @param domHandle Handle used to calculate the reference point.\n * @returns Returns a string like `\"top-left\"` or `undefined` if not matched.\n */\nfunction getHandlePosition(domHandle) {\n    const resizerPositions = ['top-left', 'top-right', 'bottom-right', 'bottom-left'];\n    for (const position of resizerPositions) {\n        if (domHandle.classList.contains(getResizerHandleClass(position))) {\n            return position;\n        }\n    }\n}\n/**\n * @param position Like `\"top-left\"`.\n * @returns Inverted `position`, e.g. it returns `\"bottom-right\"` if `\"top-left\"` was given as `position`.\n */\nfunction getOppositePosition(position) {\n    const parts = position.split('-');\n    const replacements = {\n        top: 'bottom',\n        bottom: 'top',\n        left: 'right',\n        right: 'left'\n    };\n    return `${replacements[parts[0]]}-${replacements[parts[1]]}`;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgetresize/sizeview\n */\nimport { View } from '@ckeditor/ckeditor5-ui';\n/**\n * A view displaying the proposed new element size during the resizing.\n *\n * @internal\n */\nexport class SizeView extends View {\n    constructor() {\n        super();\n        const bind = this.bindTemplate;\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-size-view',\n                    bind.to('_viewPosition', value => value ? `ck-orientation-${value}` : '')\n                ],\n                style: {\n                    display: bind.if('_isVisible', 'none', visible => !visible)\n                }\n            },\n            children: [{\n                    text: bind.to('_label')\n                }]\n        });\n    }\n    /**\n     * A method used for binding the `SizeView` instance properties to the `ResizeState` instance observable properties.\n     *\n     * @internal\n     * @param options An object defining the resizer options, used for setting the proper size label.\n     * @param resizeState The `ResizeState` class instance, used for keeping the `SizeView` state up to date.\n     */\n    _bindToState(options, resizeState) {\n        this.bind('_isVisible').to(resizeState, 'proposedWidth', resizeState, 'proposedHeight', (width, height) => width !== null && height !== null);\n        this.bind('_label').to(resizeState, 'proposedHandleHostWidth', resizeState, 'proposedHandleHostHeight', resizeState, 'proposedWidthPercents', (width, height, widthPercents) => {\n            if (options.unit === 'px') {\n                return `${width}×${height}`;\n            }\n            else {\n                return `${widthPercents}%`;\n            }\n        });\n        this.bind('_viewPosition').to(resizeState, 'activeHandlePosition', resizeState, 'proposedHandleHostWidth', resizeState, 'proposedHandleHostHeight', \n        // If the widget is too small to contain the size label, display the label above.\n        (position, width, height) => width < 50 || height < 50 ? 'above-center' : position);\n    }\n    /**\n     * A method used for cleaning up. It removes the bindings and hides the view.\n     *\n     * @internal\n     */\n    _dismiss() {\n        this.unbind();\n        this._isVisible = false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgetresize/resizer\n */\nimport { Template } from '@ckeditor/ckeditor5-ui';\nimport { Rect, ObservableMixin, compareArrays } from '@ckeditor/ckeditor5-utils';\nimport { WidgetResizeState } from './resizerstate.js';\nimport { SizeView } from './sizeview.js';\n/**\n * Represents a resizer for a single resizable object.\n */\nexport class WidgetResizer extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.\n     *\n     * Note that a new state is created for each resize transaction.\n     */\n    _state;\n    /**\n     * A view displaying the proposed new element size during the resizing.\n     */\n    _sizeView;\n    /**\n     * Options passed to the {@link #constructor}.\n     */\n    _options;\n    /**\n     * A wrapper that is controlled by the resizer. This is usually a widget element.\n     */\n    _viewResizerWrapper = null;\n    /**\n     * The width of the resized {@link module:widget/widgetresize~WidgetResizerOptions#viewElement viewElement} before the resizing started.\n     */\n    _initialViewWidth;\n    /**\n     * @param options Resizer options.\n     */\n    constructor(options) {\n        super();\n        this._options = options;\n        this.set('isEnabled', true);\n        this.set('isSelected', false);\n        this.bind('isVisible').to(this, 'isEnabled', this, 'isSelected', (isEnabled, isSelected) => isEnabled && isSelected);\n        this.decorate('begin');\n        this.decorate('cancel');\n        this.decorate('commit');\n        this.decorate('updateSize');\n        this.on('commit', event => {\n            // State might not be initialized yet. In this case, prevent further handling and make sure that the resizer is\n            // cleaned up (#5195).\n            if (!this.state.proposedWidth && !this.state.proposedWidthPercents) {\n                this._cleanup();\n                event.stop();\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.\n     *\n     * Note that a new state is created for each resize transaction.\n     */\n    get state() {\n        return this._state;\n    }\n    /**\n     * Makes resizer visible in the UI.\n     */\n    show() {\n        const editingView = this._options.editor.editing.view;\n        editingView.change(writer => {\n            writer.removeClass('ck-hidden', this._viewResizerWrapper);\n        });\n    }\n    /**\n     * Hides resizer in the UI.\n     */\n    hide() {\n        const editingView = this._options.editor.editing.view;\n        editingView.change(writer => {\n            writer.addClass('ck-hidden', this._viewResizerWrapper);\n        });\n    }\n    /**\n     * Attaches the resizer to the DOM.\n     */\n    attach() {\n        // eslint-disable-next-line @typescript-eslint/no-this-alias\n        const that = this;\n        const widgetElement = this._options.viewElement;\n        const editingView = this._options.editor.editing.view;\n        editingView.change(writer => {\n            const viewResizerWrapper = writer.createUIElement('div', {\n                class: 'ck ck-reset_all ck-widget__resizer'\n            }, function (domDocument) {\n                const domElement = this.toDomElement(domDocument);\n                that._appendHandles(domElement);\n                that._appendSizeUI(domElement);\n                return domElement;\n            });\n            // Append the resizer wrapper to the widget's wrapper.\n            writer.insert(writer.createPositionAt(widgetElement, 'end'), viewResizerWrapper);\n            writer.addClass('ck-widget_with-resizer', widgetElement);\n            this._viewResizerWrapper = viewResizerWrapper;\n            if (!this.isVisible) {\n                this.hide();\n            }\n        });\n        this.on('change:isVisible', () => {\n            if (this.isVisible) {\n                this.show();\n                this.redraw();\n            }\n            else {\n                this.hide();\n            }\n        });\n    }\n    /**\n     * Starts the resizing process.\n     *\n     * Creates a new {@link #state} for the current process.\n     *\n     * @fires begin\n     * @param domResizeHandle Clicked handle.\n     */\n    begin(domResizeHandle) {\n        this._state = new WidgetResizeState(this._options);\n        this._sizeView._bindToState(this._options, this.state);\n        this._initialViewWidth = this._options.viewElement.getStyle('width');\n        this.state.begin(domResizeHandle, this._getHandleHost(), this._getResizeHost());\n    }\n    /**\n     * Updates the proposed size based on `domEventData`.\n     *\n     * @fires updateSize\n     */\n    updateSize(domEventData) {\n        const newSize = this._proposeNewSize(domEventData);\n        const editingView = this._options.editor.editing.view;\n        editingView.change(writer => {\n            const unit = this._options.unit || '%';\n            const newWidth = (unit === '%' ? newSize.widthPercents : newSize.width) + unit;\n            writer.setStyle('width', newWidth, this._options.viewElement);\n        });\n        // Get an actual image width, and:\n        // * reflect this size to the resize wrapper\n        // * apply this **real** size to the state\n        const domHandleHost = this._getHandleHost();\n        const domHandleHostRect = new Rect(domHandleHost);\n        const handleHostWidth = Math.round(domHandleHostRect.width);\n        const handleHostHeight = Math.round(domHandleHostRect.height);\n        // Handle max-width limitation.\n        const domResizeHostRect = new Rect(domHandleHost);\n        newSize.width = Math.round(domResizeHostRect.width);\n        newSize.height = Math.round(domResizeHostRect.height);\n        this.redraw(domHandleHostRect);\n        this.state.update({\n            ...newSize,\n            handleHostWidth,\n            handleHostHeight\n        });\n    }\n    /**\n     * Applies the geometry proposed with the resizer.\n     *\n     * @fires commit\n     */\n    commit() {\n        const unit = this._options.unit || '%';\n        const newValue = (unit === '%' ? this.state.proposedWidthPercents : this.state.proposedWidth) + unit;\n        // Both cleanup and onCommit callback are very likely to make view changes. Ensure that it is made in a single step.\n        this._options.editor.editing.view.change(() => {\n            this._cleanup();\n            this._options.onCommit(newValue);\n        });\n    }\n    /**\n     * Cancels and rejects the proposed resize dimensions, hiding the UI.\n     *\n     * @fires cancel\n     */\n    cancel() {\n        this._cleanup();\n    }\n    /**\n     * Destroys the resizer.\n     */\n    destroy() {\n        this.cancel();\n    }\n    /**\n     * Redraws the resizer.\n     *\n     * @param handleHostRect Handle host rectangle might be given to improve performance.\n     */\n    redraw(handleHostRect) {\n        const domWrapper = this._domResizerWrapper;\n        // Refresh only if resizer exists in the DOM.\n        if (!existsInDom(domWrapper)) {\n            return;\n        }\n        const widgetWrapper = domWrapper.parentElement;\n        const handleHost = this._getHandleHost();\n        const resizerWrapper = this._viewResizerWrapper;\n        const currentDimensions = [\n            resizerWrapper.getStyle('width'),\n            resizerWrapper.getStyle('height'),\n            resizerWrapper.getStyle('left'),\n            resizerWrapper.getStyle('top')\n        ];\n        let newDimensions;\n        if (widgetWrapper.isSameNode(handleHost)) {\n            const clientRect = handleHostRect || new Rect(handleHost);\n            newDimensions = [\n                clientRect.width + 'px',\n                clientRect.height + 'px',\n                undefined,\n                undefined\n            ];\n        }\n        // In case a resizing host is not a widget wrapper, we need to compensate\n        // for any additional offsets the resize host might have. E.g. wrapper padding\n        // or simply another editable. By doing that the border and resizers are shown\n        // only around the resize host.\n        else {\n            newDimensions = [\n                handleHost.offsetWidth + 'px',\n                handleHost.offsetHeight + 'px',\n                handleHost.offsetLeft + 'px',\n                handleHost.offsetTop + 'px'\n            ];\n        }\n        // Make changes to the view only if the resizer should actually get new dimensions.\n        // Otherwise, if View#change() was always called, this would cause EditorUI#update\n        // loops because the WidgetResize plugin listens to EditorUI#update and updates\n        // the resizer.\n        // https://github.com/ckeditor/ckeditor5/issues/7633\n        if (compareArrays(currentDimensions, newDimensions) !== 'same') {\n            this._options.editor.editing.view.change(writer => {\n                writer.setStyle({\n                    width: newDimensions[0],\n                    height: newDimensions[1],\n                    left: newDimensions[2],\n                    top: newDimensions[3]\n                }, resizerWrapper);\n            });\n        }\n    }\n    containsHandle(domElement) {\n        return this._domResizerWrapper.contains(domElement);\n    }\n    static isResizeHandle(domElement) {\n        return domElement.classList.contains('ck-widget__resizer__handle');\n    }\n    /**\n     * Cleans up the context state.\n     */\n    _cleanup() {\n        this._sizeView._dismiss();\n        const editingView = this._options.editor.editing.view;\n        editingView.change(writer => {\n            writer.setStyle('width', this._initialViewWidth, this._options.viewElement);\n        });\n    }\n    /**\n     * Calculates the proposed size as the resize handles are dragged.\n     *\n     * @param domEventData Event data that caused the size update request. It should be used to calculate the proposed size.\n     */\n    _proposeNewSize(domEventData) {\n        const state = this.state;\n        const currentCoordinates = extractCoordinates(domEventData);\n        const isCentered = this._options.isCentered ? this._options.isCentered(this) : true;\n        // Enlargement defines how much the resize host has changed in a given axis. Naturally it could be a negative number\n        // meaning that it has been shrunk.\n        //\n        // +----------------+--+\n        // |                |  |\n        // |       img      |  |\n        // |  /handle host  |  |\n        // +----------------+  | ^\n        // |                   | | - enlarge y\n        // +-------------------+ v\n        // \t\t\t\t\t<-->\n        // \t\t\t\t\t enlarge x\n        const enlargement = {\n            x: state._referenceCoordinates.x - (currentCoordinates.x + state.originalWidth),\n            y: (currentCoordinates.y - state.originalHeight) - state._referenceCoordinates.y\n        };\n        if (isCentered && state.activeHandlePosition.endsWith('-right')) {\n            enlargement.x = currentCoordinates.x - (state._referenceCoordinates.x + state.originalWidth);\n        }\n        // Objects needs to be resized twice as much in horizontal axis if centered, since enlargement is counted from\n        // one resized corner to your cursor. It needs to be duplicated to compensate for the other side too.\n        if (isCentered) {\n            enlargement.x *= 2;\n        }\n        // const resizeHost = this._getResizeHost();\n        // The size proposed by the user. It does not consider the aspect ratio.\n        let width = Math.abs(state.originalWidth + enlargement.x);\n        let height = Math.abs(state.originalHeight + enlargement.y);\n        // Dominant determination must take the ratio into account.\n        const dominant = width / state.aspectRatio > height ? 'width' : 'height';\n        if (dominant == 'width') {\n            height = width / state.aspectRatio;\n        }\n        else {\n            width = height * state.aspectRatio;\n        }\n        return {\n            width: Math.round(width),\n            height: Math.round(height),\n            widthPercents: Math.min(Math.round(state.originalWidthPercents / state.originalWidth * width * 100) / 100, 100)\n        };\n    }\n    /**\n     * Obtains the resize host.\n     *\n     * Resize host is an object that receives dimensions which are the result of resizing.\n     */\n    _getResizeHost() {\n        const widgetWrapper = this._domResizerWrapper.parentElement;\n        return this._options.getResizeHost(widgetWrapper);\n    }\n    /**\n     * Obtains the handle host.\n     *\n     * Handle host is an object that the handles are aligned to.\n     *\n     * Handle host will not always be an entire widget itself. Take an image as an example. The image widget\n     * contains an image and a caption. Only the image should be surrounded with handles.\n     */\n    _getHandleHost() {\n        const widgetWrapper = this._domResizerWrapper.parentElement;\n        return this._options.getHandleHost(widgetWrapper);\n    }\n    /**\n     * DOM container of the entire resize UI.\n     *\n     * Note that this property will have a value only after the element bound with the resizer is rendered\n     * (otherwise `null`).\n     */\n    get _domResizerWrapper() {\n        return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper);\n    }\n    /**\n     * Renders the resize handles in the DOM.\n     *\n     * @param domElement The resizer wrapper.\n     */\n    _appendHandles(domElement) {\n        const resizerPositions = ['top-left', 'top-right', 'bottom-right', 'bottom-left'];\n        for (const currentPosition of resizerPositions) {\n            domElement.appendChild((new Template({\n                tag: 'div',\n                attributes: {\n                    class: `ck-widget__resizer__handle ${getResizerClass(currentPosition)}`\n                }\n            }).render()));\n        }\n    }\n    /**\n     * Sets up the {@link #_sizeView} property and adds it to the passed `domElement`.\n     */\n    _appendSizeUI(domElement) {\n        this._sizeView = new SizeView();\n        // Make sure icon#element is rendered before passing to appendChild().\n        this._sizeView.render();\n        domElement.appendChild(this._sizeView.element);\n    }\n}\n/**\n * @param resizerPosition Expected resizer position like `\"top-left\"`, `\"bottom-right\"`.\n * @returns A prefixed HTML class name for the resizer element\n */\nfunction getResizerClass(resizerPosition) {\n    return `ck-widget__resizer__handle-${resizerPosition}`;\n}\nfunction extractCoordinates(event) {\n    return {\n        x: event.pageX,\n        y: event.pageY\n    };\n}\nfunction existsInDom(element) {\n    return element && element.ownerDocument && element.ownerDocument.contains(element);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module widget/widgetresize\n */\nimport { WidgetResizer } from './widgetresize/resizer.js';\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { MouseObserver } from '@ckeditor/ckeditor5-engine';\nimport { DomEmitterMixin, global } from '@ckeditor/ckeditor5-utils';\nimport { throttle } from 'es-toolkit/compat';\nimport '../theme/widgetresize.css';\n/**\n * The widget resize feature plugin.\n *\n * Use the {@link module:widget/widgetresize~WidgetResize#attachTo} method to create a resizer for the specified widget.\n */\nexport class WidgetResize extends Plugin {\n    /**\n     * A map of resizers created using this plugin instance.\n     */\n    _resizers = new Map();\n    _observer;\n    _redrawSelectedResizerThrottled;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'WidgetResize';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editing = this.editor.editing;\n        const domDocument = global.window.document;\n        this.set('selectedResizer', null);\n        this.set('_activeResizer', null);\n        editing.view.addObserver(MouseObserver);\n        this._observer = new (DomEmitterMixin())();\n        this.listenTo(editing.view.document, 'mousedown', this._mouseDownListener.bind(this), { priority: 'high' });\n        this._observer.listenTo(domDocument, 'mousemove', this._mouseMoveListener.bind(this));\n        this._observer.listenTo(domDocument, 'mouseup', this._mouseUpListener.bind(this));\n        this._redrawSelectedResizerThrottled = throttle(() => this.redrawSelectedResizer(), 200);\n        // Redrawing on any change of the UI of the editor (including content changes).\n        this.editor.ui.on('update', this._redrawSelectedResizerThrottled);\n        // Remove view widget-resizer mappings for widgets that have been removed from the document.\n        // https://github.com/ckeditor/ckeditor5/issues/10156\n        // https://github.com/ckeditor/ckeditor5/issues/10266\n        this.editor.model.document.on('change', () => {\n            for (const [viewElement, resizer] of this._resizers) {\n                if (!viewElement.isAttached()) {\n                    this._resizers.delete(viewElement);\n                    resizer.destroy();\n                }\n            }\n        }, { priority: 'lowest' });\n        // Resizers need to be redrawn upon window resize, because new window might shrink resize host.\n        this._observer.listenTo(global.window, 'resize', this._redrawSelectedResizerThrottled);\n        const viewSelection = this.editor.editing.view.document.selection;\n        viewSelection.on('change', () => {\n            const selectedElement = viewSelection.getSelectedElement();\n            const resizer = this.getResizerByViewElement(selectedElement) || null;\n            if (resizer) {\n                this.select(resizer);\n            }\n            else {\n                this.deselect();\n            }\n        });\n    }\n    /**\n     * Redraws the selected resizer if there is any selected resizer and if it is visible.\n     */\n    redrawSelectedResizer() {\n        if (this.selectedResizer && this.selectedResizer.isVisible) {\n            this.selectedResizer.redraw();\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._observer.stopListening();\n        for (const resizer of this._resizers.values()) {\n            resizer.destroy();\n        }\n        this._redrawSelectedResizerThrottled.cancel();\n    }\n    /**\n     * Marks resizer as selected.\n     */\n    select(resizer) {\n        this.deselect();\n        this.selectedResizer = resizer;\n        this.selectedResizer.isSelected = true;\n    }\n    /**\n     * Deselects currently set resizer.\n     */\n    deselect() {\n        if (this.selectedResizer) {\n            this.selectedResizer.isSelected = false;\n        }\n        this.selectedResizer = null;\n    }\n    /**\n     * @param options Resizer options.\n     */\n    attachTo(options) {\n        const resizer = new WidgetResizer(options);\n        const plugins = this.editor.plugins;\n        resizer.attach();\n        if (plugins.has('WidgetToolbarRepository')) {\n            // Hiding widget toolbar to improve the performance\n            // (https://github.com/ckeditor/ckeditor5-widget/pull/112#issuecomment-564528765).\n            const widgetToolbarRepository = plugins.get('WidgetToolbarRepository');\n            resizer.on('begin', () => {\n                widgetToolbarRepository.forceDisabled('resize');\n            }, { priority: 'lowest' });\n            resizer.on('cancel', () => {\n                widgetToolbarRepository.clearForceDisabled('resize');\n            }, { priority: 'highest' });\n            resizer.on('commit', () => {\n                widgetToolbarRepository.clearForceDisabled('resize');\n            }, { priority: 'highest' });\n        }\n        this._resizers.set(options.viewElement, resizer);\n        const viewSelection = this.editor.editing.view.document.selection;\n        const selectedElement = viewSelection.getSelectedElement();\n        // If the element the resizer is created for is currently focused, it should become visible.\n        if (this.getResizerByViewElement(selectedElement) == resizer) {\n            this.select(resizer);\n        }\n        return resizer;\n    }\n    /**\n     * Returns a resizer created for a given view element (widget element).\n     *\n     * @param viewElement View element associated with the resizer.\n     */\n    getResizerByViewElement(viewElement) {\n        return this._resizers.get(viewElement);\n    }\n    /**\n     * Returns a resizer that contains a given resize handle.\n     */\n    _getResizerByHandle(domResizeHandle) {\n        for (const resizer of this._resizers.values()) {\n            if (resizer.containsHandle(domResizeHandle)) {\n                return resizer;\n            }\n        }\n    }\n    /**\n     * @param domEventData Native DOM event.\n     */\n    _mouseDownListener(event, domEventData) {\n        const resizeHandle = domEventData.domTarget;\n        if (!WidgetResizer.isResizeHandle(resizeHandle)) {\n            return;\n        }\n        this._activeResizer = this._getResizerByHandle(resizeHandle) || null;\n        if (this._activeResizer) {\n            this._activeResizer.begin(resizeHandle);\n            // Do not call other events when resizing. See: #6755.\n            event.stop();\n            domEventData.preventDefault();\n        }\n    }\n    /**\n     * @param domEventData Native DOM event.\n     */\n    _mouseMoveListener(event, domEventData) {\n        if (this._activeResizer) {\n            this._activeResizer.updateSize(domEventData);\n        }\n    }\n    _mouseUpListener() {\n        if (this._activeResizer) {\n            this._activeResizer.commit();\n            this._activeResizer = null;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/lineview\n */\n/* istanbul ignore file -- @preserve */\nimport { View } from '@ckeditor/ckeditor5-ui';\nimport { toUnit } from '@ckeditor/ckeditor5-utils';\nconst toPx = /* #__PURE__ */ toUnit('px');\n/**\n * The horizontal drop target line view.\n *\n * @internal\n */\nexport class LineView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor() {\n        super();\n        const bind = this.bindTemplate;\n        this.set({\n            isVisible: false,\n            left: null,\n            top: null,\n            width: null\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-clipboard-drop-target-line',\n                    bind.if('isVisible', 'ck-hidden', value => !value)\n                ],\n                style: {\n                    left: bind.to('left', left => toPx(left)),\n                    top: bind.to('top', top => toPx(top)),\n                    width: bind.to('width', width => toPx(width))\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/dragdroptarget\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { global, Rect, DomEmitterMixin, delay, ResizeObserver } from '@ckeditor/ckeditor5-utils';\nimport { LineView } from './lineview.js';\nimport { throttle } from 'es-toolkit/compat';\n/**\n * Part of the Drag and Drop handling. Responsible for finding and displaying the drop target.\n *\n * @internal\n */\nexport class DragDropTarget extends Plugin {\n    /**\n     * A delayed callback removing the drop marker.\n     *\n     * @internal\n     */\n    removeDropMarkerDelayed = delay(() => this.removeDropMarker(), 40);\n    /**\n     * A throttled callback updating the drop marker.\n     */\n    _updateDropMarkerThrottled = throttle(targetRange => this._updateDropMarker(targetRange), 40);\n    /**\n     * A throttled callback reconverting the drop parker.\n     */\n    _reconvertMarkerThrottled = throttle(() => {\n        if (this.editor.model.markers.has('drop-target')) {\n            this.editor.editing.reconvertMarker('drop-target');\n        }\n    }, 0);\n    /**\n     * The horizontal drop target line view.\n     */\n    _dropTargetLineView = new LineView();\n    /**\n     * DOM Emitter.\n     */\n    _domEmitter = new (DomEmitterMixin())();\n    /**\n     * Map of document scrollable elements.\n     */\n    _scrollables = new Map();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'DragDropTarget';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this._setupDropMarker();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this._domEmitter.stopListening();\n        for (const { resizeObserver } of this._scrollables.values()) {\n            resizeObserver.destroy();\n        }\n        this._updateDropMarkerThrottled.cancel();\n        this.removeDropMarkerDelayed.cancel();\n        this._reconvertMarkerThrottled.cancel();\n        return super.destroy();\n    }\n    /**\n     * Finds the drop target range and updates the drop marker.\n     *\n     * @return The updated drop target range or null if no valid range was found.\n     * @internal\n     */\n    updateDropMarker(targetViewElement, targetViewRanges, clientX, clientY, blockMode, draggedRange) {\n        this.removeDropMarkerDelayed.cancel();\n        const targetRange = findDropTargetRange(this.editor, targetViewElement, targetViewRanges, clientX, clientY, blockMode, draggedRange);\n        /* istanbul ignore next -- @preserve */\n        if (!targetRange) {\n            return null;\n        }\n        if (draggedRange && draggedRange.containsRange(targetRange)) {\n            // Target range is inside the dragged range.\n            this.removeDropMarker();\n            return null;\n        }\n        if (targetRange && !this.editor.model.canEditAt(targetRange)) {\n            // Do not show drop marker if target place is not editable.\n            this.removeDropMarker();\n            return null;\n        }\n        this._updateDropMarkerThrottled(targetRange);\n        return targetRange;\n    }\n    /**\n     * Finds the final drop target range.\n     *\n     * @internal\n     */\n    getFinalDropRange(targetViewElement, targetViewRanges, clientX, clientY, blockMode, draggedRange) {\n        const targetRange = findDropTargetRange(this.editor, targetViewElement, targetViewRanges, clientX, clientY, blockMode, draggedRange);\n        // The dragging markers must be removed after searching for the target range because sometimes\n        // the target lands on the marker itself.\n        this.removeDropMarker();\n        return targetRange;\n    }\n    /**\n     * Removes the drop target marker.\n     *\n     * @internal\n     */\n    removeDropMarker() {\n        const model = this.editor.model;\n        this.removeDropMarkerDelayed.cancel();\n        this._updateDropMarkerThrottled.cancel();\n        this._dropTargetLineView.isVisible = false;\n        if (model.markers.has('drop-target')) {\n            model.change(writer => {\n                writer.removeMarker('drop-target');\n            });\n        }\n    }\n    /**\n     * Creates downcast conversion for the drop target marker.\n     */\n    _setupDropMarker() {\n        const editor = this.editor;\n        editor.ui.view.body.add(this._dropTargetLineView);\n        // Drop marker conversion for hovering over widgets.\n        editor.conversion.for('editingDowncast').markerToHighlight({\n            model: 'drop-target',\n            view: {\n                classes: ['ck-clipboard-drop-target-range']\n            }\n        });\n        // Drop marker conversion for in text and block drop target.\n        editor.conversion.for('editingDowncast').markerToElement({\n            model: 'drop-target',\n            view: (data, { writer }) => {\n                // Inline drop.\n                if (editor.model.schema.checkChild(data.markerRange.start, '$text')) {\n                    this._dropTargetLineView.isVisible = false;\n                    return this._createDropTargetPosition(writer);\n                }\n                // Block drop.\n                else {\n                    if (data.markerRange.isCollapsed) {\n                        this._updateDropTargetLine(data.markerRange);\n                    }\n                    else {\n                        this._dropTargetLineView.isVisible = false;\n                    }\n                }\n            }\n        });\n    }\n    /**\n     * Updates the drop target marker to the provided range.\n     *\n     * @param targetRange The range to set the marker to.\n     */\n    _updateDropMarker(targetRange) {\n        const editor = this.editor;\n        const markers = editor.model.markers;\n        editor.model.change(writer => {\n            if (markers.has('drop-target')) {\n                if (!markers.get('drop-target').getRange().isEqual(targetRange)) {\n                    writer.updateMarker('drop-target', { range: targetRange });\n                }\n            }\n            else {\n                writer.addMarker('drop-target', {\n                    range: targetRange,\n                    usingOperation: false,\n                    affectsData: false\n                });\n            }\n        });\n    }\n    /**\n     * Creates the UI element for vertical (in-line) drop target.\n     */\n    _createDropTargetPosition(writer) {\n        return writer.createUIElement('span', { class: 'ck ck-clipboard-drop-target-position' }, function (domDocument) {\n            const domElement = this.toDomElement(domDocument);\n            // Using word joiner to make this marker as high as text and also making text not break on marker.\n            domElement.append('\\u2060', domDocument.createElement('span'), '\\u2060');\n            return domElement;\n        });\n    }\n    /**\n     * Updates the horizontal drop target line.\n     */\n    _updateDropTargetLine(range) {\n        const editing = this.editor.editing;\n        const nodeBefore = range.start.nodeBefore;\n        const nodeAfter = range.start.nodeAfter;\n        const nodeParent = range.start.parent;\n        const viewElementBefore = nodeBefore ? editing.mapper.toViewElement(nodeBefore) : null;\n        const domElementBefore = viewElementBefore ? editing.view.domConverter.mapViewToDom(viewElementBefore) : null;\n        const viewElementAfter = nodeAfter ? editing.mapper.toViewElement(nodeAfter) : null;\n        const domElementAfter = viewElementAfter ? editing.view.domConverter.mapViewToDom(viewElementAfter) : null;\n        const viewElementParent = editing.mapper.toViewElement(nodeParent);\n        if (!viewElementParent) {\n            return;\n        }\n        const domElementParent = editing.view.domConverter.mapViewToDom(viewElementParent);\n        const domScrollableRect = this._getScrollableRect(viewElementParent);\n        const { scrollX, scrollY } = global.window;\n        const rectBefore = domElementBefore ? new Rect(domElementBefore) : null;\n        const rectAfter = domElementAfter ? new Rect(domElementAfter) : null;\n        const rectParent = new Rect(domElementParent).excludeScrollbarsAndBorders();\n        const above = rectBefore ? rectBefore.bottom : rectParent.top;\n        const below = rectAfter ? rectAfter.top : rectParent.bottom;\n        const parentStyle = global.window.getComputedStyle(domElementParent);\n        const top = (above <= below ? (above + below) / 2 : below);\n        if (domScrollableRect.top < top && top < domScrollableRect.bottom) {\n            const left = rectParent.left + parseFloat(parentStyle.paddingLeft);\n            const right = rectParent.right - parseFloat(parentStyle.paddingRight);\n            const leftClamped = Math.max(left + scrollX, domScrollableRect.left);\n            const rightClamped = Math.min(right + scrollX, domScrollableRect.right);\n            this._dropTargetLineView.set({\n                isVisible: true,\n                left: leftClamped,\n                top: top + scrollY,\n                width: rightClamped - leftClamped\n            });\n        }\n        else {\n            this._dropTargetLineView.isVisible = false;\n        }\n    }\n    /**\n     * Finds the closest scrollable element rect for the given view element.\n     */\n    _getScrollableRect(viewElement) {\n        const rootName = viewElement.root.rootName;\n        let domScrollable;\n        if (this._scrollables.has(rootName)) {\n            domScrollable = this._scrollables.get(rootName).domElement;\n        }\n        else {\n            const domElement = this.editor.editing.view.domConverter.mapViewToDom(viewElement);\n            domScrollable = findScrollableElement(domElement);\n            this._domEmitter.listenTo(domScrollable, 'scroll', this._reconvertMarkerThrottled, { usePassive: true });\n            const resizeObserver = new ResizeObserver(domScrollable, this._reconvertMarkerThrottled);\n            this._scrollables.set(rootName, {\n                domElement: domScrollable,\n                resizeObserver\n            });\n        }\n        return new Rect(domScrollable).excludeScrollbarsAndBorders();\n    }\n}\n/**\n * Returns fixed selection range for given position and target element.\n */\nfunction findDropTargetRange(editor, targetViewElement, targetViewRanges, clientX, clientY, blockMode, draggedRange) {\n    const model = editor.model;\n    const mapper = editor.editing.mapper;\n    const targetModelElement = getClosestMappedModelElement(editor, targetViewElement);\n    let modelElement = targetModelElement;\n    while (modelElement) {\n        if (!blockMode) {\n            if (model.schema.checkChild(modelElement, '$text')) {\n                if (targetViewRanges) {\n                    const targetViewPosition = targetViewRanges[0].start;\n                    const targetModelPosition = mapper.toModelPosition(targetViewPosition);\n                    const canDropOnPosition = !draggedRange || Array\n                        .from(draggedRange.getItems({ shallow: true }))\n                        .some(item => model.schema.checkChild(targetModelPosition, item));\n                    if (canDropOnPosition) {\n                        if (model.schema.checkChild(targetModelPosition, '$text')) {\n                            return model.createRange(targetModelPosition);\n                        }\n                        else if (targetViewPosition) {\n                            // This is the case of dropping inside a span wrapper of an inline image.\n                            return findDropTargetRangeForElement(editor, getClosestMappedModelElement(editor, targetViewPosition.parent), clientX, clientY);\n                        }\n                    }\n                }\n            }\n            else if (model.schema.isInline(modelElement)) {\n                return findDropTargetRangeForElement(editor, modelElement, clientX, clientY);\n            }\n        }\n        if (model.schema.isBlock(modelElement)) {\n            return findDropTargetRangeForElement(editor, modelElement, clientX, clientY);\n        }\n        else if (model.schema.checkChild(modelElement, '$block')) {\n            const childNodes = Array.from(modelElement.getChildren())\n                .filter((node) => node.is('element') && !shouldIgnoreElement(editor, node));\n            let startIndex = 0;\n            let endIndex = childNodes.length;\n            if (endIndex == 0) {\n                return model.createRange(model.createPositionAt(modelElement, 'end'));\n            }\n            while (startIndex < endIndex - 1) {\n                const middleIndex = Math.floor((startIndex + endIndex) / 2);\n                const side = findElementSide(editor, childNodes[middleIndex], clientX, clientY);\n                if (side == 'before') {\n                    endIndex = middleIndex;\n                }\n                else {\n                    startIndex = middleIndex;\n                }\n            }\n            return findDropTargetRangeForElement(editor, childNodes[startIndex], clientX, clientY);\n        }\n        modelElement = modelElement.parent;\n    }\n    return null;\n}\n/**\n * Returns true for elements which should be ignored.\n */\nfunction shouldIgnoreElement(editor, modelElement) {\n    const mapper = editor.editing.mapper;\n    const domConverter = editor.editing.view.domConverter;\n    const viewElement = mapper.toViewElement(modelElement);\n    if (!viewElement) {\n        return true;\n    }\n    const domElement = domConverter.mapViewToDom(viewElement);\n    return global.window.getComputedStyle(domElement).float != 'none';\n}\n/**\n * Returns target range relative to the given element.\n */\nfunction findDropTargetRangeForElement(editor, modelElement, clientX, clientY) {\n    const model = editor.model;\n    return model.createRange(model.createPositionAt(modelElement, findElementSide(editor, modelElement, clientX, clientY)));\n}\n/**\n * Resolves whether drop marker should be before or after the given element.\n */\nfunction findElementSide(editor, modelElement, clientX, clientY) {\n    const mapper = editor.editing.mapper;\n    const domConverter = editor.editing.view.domConverter;\n    const viewElement = mapper.toViewElement(modelElement);\n    const domElement = domConverter.mapViewToDom(viewElement);\n    const rect = new Rect(domElement);\n    if (editor.model.schema.isInline(modelElement)) {\n        return clientX < (rect.left + rect.right) / 2 ? 'before' : 'after';\n    }\n    else {\n        return clientY < (rect.top + rect.bottom) / 2 ? 'before' : 'after';\n    }\n}\n/**\n * Returns the closest model element for the specified view element.\n */\nfunction getClosestMappedModelElement(editor, element) {\n    const mapper = editor.editing.mapper;\n    const view = editor.editing.view;\n    const targetModelElement = mapper.toModelElement(element);\n    if (targetModelElement) {\n        return targetModelElement;\n    }\n    // Find mapped ancestor if the target is inside not mapped element (for example inline code element).\n    const viewPosition = view.createPositionBefore(element);\n    const viewElement = mapper.findMappedViewAncestor(viewPosition);\n    return mapper.toModelElement(viewElement);\n}\n/**\n * Returns the closest scrollable ancestor DOM element.\n *\n * It is assumed that `domNode` is attached to the document.\n */\nfunction findScrollableElement(domNode) {\n    let domElement = domNode;\n    do {\n        domElement = domElement.parentElement;\n        const overflow = global.window.getComputedStyle(domElement).overflowY;\n        if (overflow == 'auto' || overflow == 'scroll') {\n            break;\n        }\n    } while (domElement.tagName != 'BODY');\n    return domElement;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/dragdropblocktoolbar\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { env, global, DomEmitterMixin } from '@ckeditor/ckeditor5-utils';\nimport { ClipboardObserver } from './clipboardobserver.js';\n/**\n * Integration of a block Drag and Drop support with the block toolbar.\n *\n * @internal\n */\nexport class DragDropBlockToolbar extends Plugin {\n    /**\n     * Whether current dragging is started by block toolbar button dragging.\n     */\n    _isBlockDragging = false;\n    /**\n     * DOM Emitter.\n     */\n    _domEmitter = new (DomEmitterMixin())();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'DragDropBlockToolbar';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        this.listenTo(editor, 'change:isReadOnly', (evt, name, isReadOnly) => {\n            if (isReadOnly) {\n                this.forceDisabled('readOnlyMode');\n                this._isBlockDragging = false;\n            }\n            else {\n                this.clearForceDisabled('readOnlyMode');\n            }\n        });\n        if (env.isAndroid) {\n            this.forceDisabled('noAndroidSupport');\n        }\n        if (editor.plugins.has('BlockToolbar')) {\n            const blockToolbar = editor.plugins.get('BlockToolbar');\n            const element = blockToolbar.buttonView.element;\n            this._domEmitter.listenTo(element, 'dragstart', (evt, data) => this._handleBlockDragStart(data));\n            this._domEmitter.listenTo(global.document, 'dragover', (evt, data) => this._handleBlockDragging(data));\n            this._domEmitter.listenTo(global.document, 'drop', (evt, data) => this._handleBlockDragging(data));\n            this._domEmitter.listenTo(global.document, 'dragend', () => this._handleBlockDragEnd(), { useCapture: true });\n            if (this.isEnabled) {\n                element.setAttribute('draggable', 'true');\n            }\n            this.on('change:isEnabled', (evt, name, isEnabled) => {\n                element.setAttribute('draggable', isEnabled ? 'true' : 'false');\n            });\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this._domEmitter.stopListening();\n        return super.destroy();\n    }\n    /**\n     * The `dragstart` event handler.\n     */\n    _handleBlockDragStart(domEvent) {\n        if (!this.isEnabled) {\n            return;\n        }\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const view = this.editor.editing.view;\n        const blocks = Array.from(selection.getSelectedBlocks());\n        const draggedRange = model.createRange(model.createPositionBefore(blocks[0]), model.createPositionAfter(blocks[blocks.length - 1]));\n        model.change(writer => writer.setSelection(draggedRange));\n        this._isBlockDragging = true;\n        view.focus();\n        view.getObserver(ClipboardObserver).onDomEvent(domEvent);\n    }\n    /**\n     * The `dragover` and `drop` event handler.\n     */\n    _handleBlockDragging(domEvent) {\n        if (!this.isEnabled || !this._isBlockDragging) {\n            return;\n        }\n        const clientX = domEvent.clientX + (this.editor.locale.contentLanguageDirection == 'ltr' ? 100 : -100);\n        const clientY = domEvent.clientY;\n        const target = document.elementFromPoint(clientX, clientY);\n        const view = this.editor.editing.view;\n        if (!target || !target.closest('.ck-editor__editable')) {\n            return;\n        }\n        view.getObserver(ClipboardObserver).onDomEvent({\n            ...domEvent,\n            type: domEvent.type,\n            dataTransfer: domEvent.dataTransfer,\n            target,\n            clientX,\n            clientY,\n            preventDefault: () => domEvent.preventDefault(),\n            stopPropagation: () => domEvent.stopPropagation()\n        });\n    }\n    /**\n     * The `dragend` event handler.\n     */\n    _handleBlockDragEnd() {\n        this._isBlockDragging = false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/dragdrop\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { ModelLiveRange, PointerObserver } from '@ckeditor/ckeditor5-engine';\nimport { Widget, isWidget } from '@ckeditor/ckeditor5-widget';\nimport { env, uid, global, createElement, DomEmitterMixin, delay, Rect } from '@ckeditor/ckeditor5-utils';\nimport { ClipboardPipeline } from './clipboardpipeline.js';\nimport { ClipboardObserver } from './clipboardobserver.js';\nimport { DragDropTarget } from './dragdroptarget.js';\nimport { DragDropBlockToolbar } from './dragdropblocktoolbar.js';\nimport '../theme/clipboard.css';\n// Drag and drop events overview:\n//\n//                ┌──────────────────┐\n//                │     mousedown    │   Sets the draggable attribute.\n//                └─────────┬────────┘\n//                          │\n//                          └─────────────────────┐\n//                          │                     │\n//                          │           ┌─────────V────────┐\n//                          │           │      mouseup     │   Dragging did not start, removes the draggable attribute.\n//                          │           └──────────────────┘\n//                          │\n//                ┌─────────V────────┐   Retrieves the selected model.DocumentFragment\n//                │     dragstart    │   and converts it to view.DocumentFragment.\n//                └─────────┬────────┘\n//                          │\n//                ┌─────────V────────┐   Processes view.DocumentFragment to text/html and text/plain\n//                │  clipboardOutput │   and stores the results in data.dataTransfer.\n//                └─────────┬────────┘\n//                          │\n//                          │   DOM dragover\n//                          ┌────────────┐\n//                          │            │\n//                ┌─────────V────────┐   │\n//                │     dragging     │   │   Updates the drop target marker.\n//                └─────────┬────────┘   │\n//                          │            │\n//            ┌─────────────└────────────┘\n//            │             │            │\n//            │   ┌─────────V────────┐   │\n//            │   │     dragleave    │   │   Removes the drop target marker.\n//            │   └─────────┬────────┘   │\n//            │             │            │\n//        ┌───│─────────────┘            │\n//        │   │             │            │\n//        │   │   ┌─────────V────────┐   │\n//        │   │   │     dragenter    │   │   Focuses the editor view.\n//        │   │   └─────────┬────────┘   │\n//        │   │             │            │\n//        │   │             └────────────┘\n//        │   │\n//        │   └─────────────┐\n//        │   │             │\n//        │   │   ┌─────────V────────┐\n//        └───┐   │       drop       │   (The default handler of the clipboard pipeline).\n//            │   └─────────┬────────┘\n//            │             │\n//            │   ┌─────────V────────┐   Resolves the final data.targetRanges.\n//            │   │  clipboardInput  │   Aborts if dropping on dragged content.\n//            │   └─────────┬────────┘\n//            │             │\n//            │   ┌─────────V────────┐\n//            │   │  clipboardInput  │   (The default handler of the clipboard pipeline).\n//            │   └─────────┬────────┘\n//            │             │\n//            │ ┌───────────V───────────┐\n//            │ │  inputTransformation  │   (The default handler of the clipboard pipeline).\n//            │ └───────────┬───────────┘\n//            │             │\n//            │  ┌──────────V──────────┐\n//            │  │   contentInsertion  │   Updates the document selection to drop range.\n//            │  └──────────┬──────────┘\n//            │             │\n//            │  ┌──────────V──────────┐\n//            │  │   contentInsertion  │   (The default handler of the clipboard pipeline).\n//            │  └──────────┬──────────┘\n//            │             │\n//            │  ┌──────────V──────────┐\n//            │  │   contentInsertion  │   Removes the content from the original range if the insertion was successful.\n//            │  └──────────┬──────────┘\n//            │             │\n//            └─────────────┐\n//                          │\n//                ┌─────────V────────┐\n//                │      dragend     │   Removes the drop marker and cleans the state.\n//                └──────────────────┘\n//\n/**\n * The drag and drop feature. It works on top of the {@link module:clipboard/clipboardpipeline~ClipboardPipeline}.\n *\n * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.\n *\n * @internal\n */\nexport class DragDrop extends Plugin {\n    /**\n     * The live range over the original content that is being dragged.\n     */\n    _draggedRange;\n    /**\n     * The UID of current dragging that is used to verify if the drop started in the same editor as the drag start.\n     *\n     * **Note**: This is a workaround for broken 'dragend' events (they are not fired if the source text node got removed).\n     */\n    _draggingUid;\n    /**\n     * The reference to the model element that currently has a `draggable` attribute set (it is set while dragging).\n     */\n    _draggableElement;\n    /**\n     * A delayed callback removing draggable attributes.\n     */\n    _clearDraggableAttributesDelayed = delay(() => this._clearDraggableAttributes(), 40);\n    /**\n     * Whether the dragged content can be dropped only in block context.\n     */\n    // TODO handle drag from other editor instance\n    // TODO configure to use block, inline or both\n    _blockMode = false;\n    /**\n     * DOM Emitter.\n     */\n    _domEmitter = new (DomEmitterMixin())();\n    /**\n     * The DOM element used to generate dragged preview image.\n     */\n    _previewContainer;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'DragDrop';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ClipboardPipeline, Widget, DragDropTarget, DragDropBlockToolbar];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        this._draggedRange = null;\n        this._draggingUid = '';\n        this._draggableElement = null;\n        view.addObserver(ClipboardObserver);\n        view.addObserver(PointerObserver);\n        this._setupDragging();\n        this._setupContentInsertionIntegration();\n        this._setupClipboardInputIntegration();\n        this._setupDraggableAttributeHandling();\n        this.listenTo(editor, 'change:isReadOnly', (evt, name, isReadOnly) => {\n            if (isReadOnly) {\n                this.forceDisabled('readOnlyMode');\n            }\n            else {\n                this.clearForceDisabled('readOnlyMode');\n            }\n        });\n        this.on('change:isEnabled', (evt, name, isEnabled) => {\n            if (!isEnabled) {\n                this._finalizeDragging(false);\n            }\n        });\n        if (env.isAndroid) {\n            this.forceDisabled('noAndroidSupport');\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        if (this._draggedRange) {\n            this._draggedRange.detach();\n            this._draggedRange = null;\n        }\n        if (this._previewContainer) {\n            this._previewContainer.remove();\n        }\n        this._domEmitter.stopListening();\n        this._clearDraggableAttributesDelayed.cancel();\n        return super.destroy();\n    }\n    /**\n     * Drag and drop events handling.\n     */\n    _setupDragging() {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const dragDropTarget = editor.plugins.get(DragDropTarget);\n        // The handler for the drag start; it is responsible for setting data transfer object.\n        this.listenTo(viewDocument, 'dragstart', (evt, data) => {\n            // Don't drag the editable element itself.\n            if (data.target?.is('editableElement')) {\n                data.preventDefault();\n                return;\n            }\n            this._prepareDraggedRange(data.target);\n            if (!this._draggedRange) {\n                data.preventDefault();\n                return;\n            }\n            this._draggingUid = uid();\n            const canEditAtDraggedRange = this.isEnabled && editor.model.canEditAt(this._draggedRange);\n            data.dataTransfer.effectAllowed = canEditAtDraggedRange ? 'copyMove' : 'copy';\n            data.dataTransfer.setData('application/ckeditor5-dragging-uid', this._draggingUid);\n            const draggedSelection = model.createSelection(this._draggedRange.toRange());\n            const clipboardPipeline = this.editor.plugins.get('ClipboardPipeline');\n            clipboardPipeline._fireOutputTransformationEvent(data.dataTransfer, draggedSelection, 'dragstart');\n            const { dataTransfer, domTarget, domEvent } = data;\n            const { clientX } = domEvent;\n            this._updatePreview({ dataTransfer, domTarget, clientX });\n            data.stopPropagation();\n            if (!canEditAtDraggedRange) {\n                this._draggedRange.detach();\n                this._draggedRange = null;\n                this._draggingUid = '';\n            }\n        }, { priority: 'low' });\n        // The handler for finalizing drag and drop. It should always be triggered after dragging completes\n        // even if it was completed in a different application.\n        // Note: This is not fired if source text node got removed while downcasting a marker.\n        this.listenTo(viewDocument, 'dragend', (evt, data) => {\n            this._finalizeDragging(!data.dataTransfer.isCanceled && data.dataTransfer.dropEffect == 'move');\n        }, { priority: 'low' });\n        // Reset block dragging mode even if dropped outside the editable.\n        this._domEmitter.listenTo(global.document, 'dragend', () => {\n            this._blockMode = false;\n        }, { useCapture: true });\n        // Dragging over the editable.\n        this.listenTo(viewDocument, 'dragenter', () => {\n            if (!this.isEnabled) {\n                return;\n            }\n            view.focus();\n        });\n        // Dragging out of the editable.\n        this.listenTo(viewDocument, 'dragleave', () => {\n            // We do not know if the mouse left the editor or just some element in it, so let us wait a few milliseconds\n            // to check if 'dragover' is not fired.\n            dragDropTarget.removeDropMarkerDelayed();\n        });\n        // Handler for moving dragged content over the target area.\n        this.listenTo(viewDocument, 'dragging', (evt, data) => {\n            if (!this.isEnabled) {\n                data.dataTransfer.dropEffect = 'none';\n                return;\n            }\n            const { clientX, clientY } = data.domEvent;\n            const targetRange = dragDropTarget.updateDropMarker(data.target, data.targetRanges, clientX, clientY, this._blockMode, this._draggedRange);\n            // Do not allow dropping if there is no valid target range (e.g., dropping on non-editable place).\n            if (!targetRange) {\n                data.dataTransfer.dropEffect = 'none';\n                return;\n            }\n            // If this is content being dragged from another editor, moving out of current editor instance\n            // is not possible until 'dragend' event case will be fixed.\n            if (!this._draggedRange) {\n                data.dataTransfer.dropEffect = 'copy';\n            }\n            // In Firefox it is already set and effect allowed remains the same as originally set.\n            if (!env.isGecko) {\n                if (data.dataTransfer.effectAllowed == 'copy') {\n                    data.dataTransfer.dropEffect = 'copy';\n                }\n                else if (['all', 'copyMove'].includes(data.dataTransfer.effectAllowed)) {\n                    data.dataTransfer.dropEffect = 'move';\n                }\n            }\n            evt.stop();\n        }, { priority: 'low' });\n    }\n    /**\n     * Integration with the `clipboardInput` event.\n     */\n    _setupClipboardInputIntegration() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const dragDropTarget = editor.plugins.get(DragDropTarget);\n        // Update the event target ranges and abort dropping if dropping over itself.\n        this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {\n            if (data.method != 'drop') {\n                return;\n            }\n            const { clientX, clientY } = data.domEvent;\n            const targetRange = dragDropTarget.getFinalDropRange(data.target, data.targetRanges, clientX, clientY, this._blockMode, this._draggedRange);\n            if (!targetRange) {\n                this._finalizeDragging(false);\n                evt.stop();\n                return;\n            }\n            // Since we cannot rely on the drag end event, we must check if the local drag range is from the current drag and drop\n            // or it is from some previous not cleared one.\n            if (this._draggedRange && this._draggingUid != data.dataTransfer.getData('application/ckeditor5-dragging-uid')) {\n                this._draggedRange.detach();\n                this._draggedRange = null;\n                this._draggingUid = '';\n            }\n            // Do not do anything if some content was dragged within the same document to the same position.\n            const isMove = getFinalDropEffect(data.dataTransfer) == 'move';\n            if (isMove && this._draggedRange && this._draggedRange.containsRange(targetRange, true)) {\n                this._finalizeDragging(false);\n                evt.stop();\n                return;\n            }\n            // Override the target ranges with the one adjusted to the best one for a drop.\n            data.targetRanges = [editor.editing.mapper.toViewRange(targetRange)];\n        }, { priority: 'high' });\n    }\n    /**\n     * Integration with the `contentInsertion` event of the clipboard pipeline.\n     */\n    _setupContentInsertionIntegration() {\n        const clipboardPipeline = this.editor.plugins.get(ClipboardPipeline);\n        clipboardPipeline.on('contentInsertion', (evt, data) => {\n            if (!this.isEnabled || data.method !== 'drop') {\n                return;\n            }\n            // Update the selection to the target range in the same change block to avoid selection post-fixing\n            // and to be able to clone text attributes for plain text dropping.\n            const ranges = data.targetRanges.map(viewRange => this.editor.editing.mapper.toModelRange(viewRange));\n            this.editor.model.change(writer => writer.setSelection(ranges));\n        }, { priority: 'high' });\n        clipboardPipeline.on('contentInsertion', (evt, data) => {\n            if (!this.isEnabled || data.method !== 'drop') {\n                return;\n            }\n            // Remove dragged range content, remove markers, clean after dragging.\n            const isMove = getFinalDropEffect(data.dataTransfer) == 'move';\n            // Whether any content was inserted (insertion might fail if the schema is disallowing some elements\n            // (for example an image caption allows only the content of a block but not blocks themselves.\n            // Some integrations might not return valid range (i.e., table pasting).\n            const isSuccess = !data.resultRange || !data.resultRange.isCollapsed;\n            this._finalizeDragging(isSuccess && isMove);\n        }, { priority: 'lowest' });\n    }\n    /**\n     * Adds listeners that add the `draggable` attribute to the elements while the mouse button is down so the dragging could start.\n     */\n    _setupDraggableAttributeHandling() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        // Add the 'draggable' attribute to the widget while pressing the selection handle.\n        // This is required for widgets to be draggable. In Chrome it will enable dragging text nodes.\n        this.listenTo(viewDocument, 'pointerdown', (evt, data) => {\n            // The lack of data can be caused by editor tests firing fake mouse events. This should not occur\n            // in real-life scenarios but this greatly simplifies editor tests that would otherwise fail a lot.\n            if (env.isAndroid || !data) {\n                return;\n            }\n            this._clearDraggableAttributesDelayed.cancel();\n            // Check if this is a mousedown over the widget (but not a nested editable).\n            let draggableElement = findDraggableWidget(data.target);\n            // Note: There is a limitation that if more than a widget is selected (a widget and some text)\n            // and dragging starts on the widget, then only the widget is dragged.\n            // If this was not a widget then we should check if we need to drag some text content.\n            // In Chrome set a 'draggable' attribute on closest editable to allow immediate dragging of the selected text range.\n            // In Firefox this is not needed. In Safari it makes the whole editable draggable (not just textual content).\n            // Disabled in read-only mode because draggable=\"true\" + contenteditable=\"false\" results\n            // in not firing selectionchange event ever, which makes the selection stuck in read-only mode.\n            if (env.isBlink && !editor.isReadOnly && !draggableElement && !viewDocument.selection.isCollapsed) {\n                const selectedElement = viewDocument.selection.getSelectedElement();\n                if (!selectedElement || !isWidget(selectedElement)) {\n                    draggableElement = viewDocument.selection.editableElement;\n                }\n            }\n            if (draggableElement) {\n                view.change(writer => {\n                    writer.setAttribute('draggable', 'true', draggableElement);\n                });\n                // Keep the reference to the model element in case the view element gets removed while dragging.\n                this._draggableElement = editor.editing.mapper.toModelElement(draggableElement);\n            }\n        });\n        // Remove the draggable attribute in case no dragging started (only mousedown + mouseup).\n        this.listenTo(viewDocument, 'pointerup', () => {\n            if (!env.isAndroid) {\n                this._clearDraggableAttributesDelayed();\n            }\n        });\n    }\n    /**\n     * Removes the `draggable` attribute from the element that was used for dragging.\n     */\n    _clearDraggableAttributes() {\n        const editing = this.editor.editing;\n        editing.view.change(writer => {\n            // Remove 'draggable' attribute.\n            if (this._draggableElement && this._draggableElement.root.rootName != '$graveyard') {\n                writer.removeAttribute('draggable', editing.mapper.toViewElement(this._draggableElement));\n            }\n            this._draggableElement = null;\n        });\n    }\n    /**\n     * Deletes the dragged content from its original range and clears the dragging state.\n     *\n     * @param moved Whether the move succeeded.\n     */\n    _finalizeDragging(moved) {\n        const editor = this.editor;\n        const model = editor.model;\n        const dragDropTarget = editor.plugins.get(DragDropTarget);\n        dragDropTarget.removeDropMarker();\n        this._clearDraggableAttributes();\n        if (editor.plugins.has('WidgetToolbarRepository')) {\n            const widgetToolbarRepository = editor.plugins.get('WidgetToolbarRepository');\n            widgetToolbarRepository.clearForceDisabled('dragDrop');\n        }\n        this._draggingUid = '';\n        if (this._previewContainer) {\n            this._previewContainer.remove();\n            this._previewContainer = undefined;\n        }\n        if (!this._draggedRange) {\n            return;\n        }\n        // Delete moved content.\n        if (moved && this.isEnabled) {\n            model.change(writer => {\n                const selection = model.createSelection(this._draggedRange);\n                model.deleteContent(selection, { doNotAutoparagraph: true });\n                // Check result selection if it does not require auto-paragraphing of empty container.\n                const selectionParent = selection.getFirstPosition().parent;\n                if (selectionParent.isEmpty &&\n                    !model.schema.checkChild(selectionParent, '$text') &&\n                    model.schema.checkChild(selectionParent, 'paragraph')) {\n                    writer.insertElement('paragraph', selectionParent, 0);\n                }\n            });\n        }\n        this._draggedRange.detach();\n        this._draggedRange = null;\n    }\n    /**\n     * Sets the dragged source range based on event target and document selection.\n     */\n    _prepareDraggedRange(target) {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        // Check if this is dragstart over the widget (but not a nested editable).\n        const draggableWidget = target ? findDraggableWidget(target) : null;\n        if (draggableWidget) {\n            const modelElement = editor.editing.mapper.toModelElement(draggableWidget);\n            this._draggedRange = ModelLiveRange.fromRange(model.createRangeOn(modelElement));\n            this._blockMode = model.schema.isBlock(modelElement);\n            // Disable toolbars so they won't obscure the drop area.\n            if (editor.plugins.has('WidgetToolbarRepository')) {\n                const widgetToolbarRepository = editor.plugins.get('WidgetToolbarRepository');\n                widgetToolbarRepository.forceDisabled('dragDrop');\n            }\n            return;\n        }\n        // If this was not a widget we should check if we need to drag some text content.\n        if (selection.isCollapsed && !selection.getFirstPosition().parent.isEmpty) {\n            return;\n        }\n        const blocks = Array.from(selection.getSelectedBlocks());\n        const draggedRange = selection.getFirstRange();\n        if (blocks.length == 0) {\n            this._draggedRange = ModelLiveRange.fromRange(draggedRange);\n            return;\n        }\n        const blockRange = getRangeIncludingFullySelectedParents(model, blocks);\n        if (blocks.length > 1) {\n            this._draggedRange = ModelLiveRange.fromRange(blockRange);\n            this._blockMode = true;\n            // TODO block mode for dragging from outside editor? or inline? or both?\n        }\n        else if (blocks.length == 1) {\n            const touchesBlockEdges = draggedRange.start.isTouching(blockRange.start) &&\n                draggedRange.end.isTouching(blockRange.end);\n            this._draggedRange = ModelLiveRange.fromRange(touchesBlockEdges ? blockRange : draggedRange);\n            this._blockMode = touchesBlockEdges;\n        }\n        model.change(writer => writer.setSelection(this._draggedRange.toRange()));\n    }\n    /**\n     * Updates the dragged preview image.\n     */\n    _updatePreview({ dataTransfer, domTarget, clientX }) {\n        const view = this.editor.editing.view;\n        const editable = view.document.selection.editableElement;\n        const domEditable = view.domConverter.mapViewToDom(editable);\n        const computedStyle = global.window.getComputedStyle(domEditable);\n        if (!this._previewContainer) {\n            this._previewContainer = createElement(global.document, 'div', {\n                style: 'position: fixed; left: -999999px;'\n            });\n            global.document.body.appendChild(this._previewContainer);\n        }\n        else if (this._previewContainer.firstElementChild) {\n            this._previewContainer.removeChild(this._previewContainer.firstElementChild);\n        }\n        const preview = createElement(global.document, 'div');\n        preview.className = 'ck ck-content ck-clipboard-preview';\n        const domRect = new Rect(domEditable);\n        const domEditablePaddingLeft = parseFloat(computedStyle.paddingLeft);\n        const domEditablePaddingRight = parseFloat(computedStyle.paddingRight);\n        const editableWidth = parseFloat(computedStyle.width) - domEditablePaddingLeft - domEditablePaddingRight;\n        // Dragging by the drag handle outside editable element.\n        if (!domEditable.contains(domTarget)) {\n            if (!env.isiOS) {\n                const offsetLeft = domRect.left - clientX + domEditablePaddingLeft;\n                preview.style.width = `${editableWidth + offsetLeft}px`;\n                preview.style.paddingLeft = `${offsetLeft}px`;\n            }\n            else {\n                // Without a padding as on iOS preview have a background and padding would be visible.\n                preview.style.width = `${editableWidth}px`;\n                preview.style.backgroundColor = 'var(--ck-color-base-background)';\n            }\n        }\n        else if (env.isiOS) {\n            // Custom preview for iOS. Note that it must have some dimensions for iOS to start dragging element.\n            preview.style.maxWidth = `${editableWidth}px`;\n            preview.style.padding = '10px';\n            preview.style.minWidth = '200px';\n            preview.style.minHeight = '20px';\n            preview.style.boxSizing = 'border-box';\n            preview.style.backgroundColor = 'var(--ck-color-base-background)';\n        }\n        else {\n            // If domTarget is inside the editable root, browsers will display the preview correctly by themselves.\n            return;\n        }\n        view.domConverter.setContentOf(preview, dataTransfer.getData('text/html'));\n        dataTransfer.setDragImage(preview, 0, 0);\n        this._previewContainer.appendChild(preview);\n    }\n}\n/**\n * Returns the drop effect that should be a result of dragging the content.\n * This function is handling a quirk when checking the effect in the 'drop' DOM event.\n */\nfunction getFinalDropEffect(dataTransfer) {\n    if (env.isGecko) {\n        return dataTransfer.dropEffect;\n    }\n    return ['all', 'copyMove'].includes(dataTransfer.effectAllowed) ? 'move' : 'copy';\n}\n/**\n * Returns a widget element that should be dragged.\n */\nfunction findDraggableWidget(target) {\n    // This is directly an editable so not a widget for sure.\n    if (target.is('editableElement')) {\n        return null;\n    }\n    // TODO: Let's have a isWidgetSelectionHandleDomElement() helper in ckeditor5-widget utils.\n    if (target.hasClass('ck-widget__selection-handle')) {\n        return target.findAncestor(isWidget);\n    }\n    // Direct hit on a widget.\n    if (isWidget(target)) {\n        return target;\n    }\n    // Find closest ancestor that is either a widget or an editable element...\n    const ancestor = target.findAncestor(node => isWidget(node) || node.is('editableElement'));\n    // ...and if closer was the widget then enable dragging it.\n    if (isWidget(ancestor)) {\n        return ancestor;\n    }\n    return null;\n}\n/**\n * Recursively checks if common parent of provided elements doesn't have any other children. If that's the case,\n * it returns range including this parent. Otherwise, it returns only the range from first to last element.\n *\n * Example:\n *\n * <blockQuote>\n *   <paragraph>[Test 1</paragraph>\n *   <paragraph>Test 2</paragraph>\n *   <paragraph>Test 3]</paragraph>\n * <blockQuote>\n *\n * Because all elements inside the `blockQuote` are selected, the range is extended to include the `blockQuote` too.\n * If only first and second paragraphs would be selected, the range would not include it.\n */\nfunction getRangeIncludingFullySelectedParents(model, elements) {\n    const firstElement = elements[0];\n    const lastElement = elements[elements.length - 1];\n    const parent = firstElement.getCommonAncestor(lastElement);\n    const startPosition = model.createPositionBefore(firstElement);\n    const endPosition = model.createPositionAfter(lastElement);\n    if (parent &&\n        parent.is('element') &&\n        !model.schema.isLimit(parent)) {\n        const parentRange = model.createRangeOn(parent);\n        const touchesStart = startPosition.isTouching(parentRange.start);\n        const touchesEnd = endPosition.isTouching(parentRange.end);\n        if (touchesStart && touchesEnd) {\n            // Selection includes all elements in the parent.\n            return getRangeIncludingFullySelectedParents(model, [parent]);\n        }\n    }\n    return model.createRange(startPosition, endPosition);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/pasteplaintext\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { ClipboardObserver } from './clipboardobserver.js';\nimport { ClipboardPipeline } from './clipboardpipeline.js';\n/**\n * The plugin detects the user's intention to paste plain text.\n *\n * For example, it detects the <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> keystroke.\n */\nexport class PastePlainText extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'PastePlainText';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ClipboardPipeline];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        const selection = model.document.selection;\n        view.addObserver(ClipboardObserver);\n        editor.plugins.get(ClipboardPipeline).on('contentInsertion', (evt, data) => {\n            if (!isUnformattedInlineContent(data.content, model)) {\n                return;\n            }\n            model.change(writer => {\n                // Formatting attributes should be preserved.\n                const textAttributes = Array.from(selection.getAttributes())\n                    .filter(([key]) => model.schema.getAttributeProperties(key).isFormatting);\n                if (!selection.isCollapsed) {\n                    model.deleteContent(selection, { doNotAutoparagraph: true });\n                }\n                // Also preserve other attributes if they survived the content deletion (because they were not fully selected).\n                // For example linkHref is not a formatting attribute but it should be preserved if pasted text was in the middle\n                // of a link.\n                textAttributes.push(...selection.getAttributes());\n                const range = writer.createRangeIn(data.content);\n                for (const item of range.getItems()) {\n                    for (const attribute of textAttributes) {\n                        if (model.schema.checkAttribute(item, attribute[0])) {\n                            writer.setAttribute(attribute[0], attribute[1], item);\n                        }\n                    }\n                }\n            });\n        });\n    }\n}\n/**\n * Returns true if specified `documentFragment` represents the unformatted inline content.\n */\nfunction isUnformattedInlineContent(documentFragment, model) {\n    let range = model.createRangeIn(documentFragment);\n    // We consider three scenarios here. The document fragment may include:\n    //\n    // 1. Only text and inline objects. Then it could be unformatted inline content.\n    // 2. Exactly one block element on top-level, eg. <p>Foobar</p> or <h2>Title</h2>.\n    //    In this case, check this element content, it could be treated as unformatted inline content.\n    // 3. More block elements or block objects, then it is not unformatted inline content.\n    //\n    // We will check for scenario 2. specifically, and if it happens, we will unwrap it and follow with the regular algorithm.\n    //\n    if (documentFragment.childCount == 1) {\n        const child = documentFragment.getChild(0);\n        if (child.is('element') && model.schema.isBlock(child) && !model.schema.isObject(child) && !model.schema.isLimit(child)) {\n            // Scenario 2. as described above.\n            range = model.createRangeIn(child);\n        }\n    }\n    for (const child of range.getItems()) {\n        if (!model.schema.isInline(child)) {\n            return false;\n        }\n        const attributeKeys = Array.from(child.getAttributeKeys());\n        if (attributeKeys.find(key => model.schema.getAttributeProperties(key).isFormatting)) {\n            return false;\n        }\n    }\n    return true;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module clipboard/clipboard\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { ClipboardPipeline } from './clipboardpipeline.js';\nimport { DragDrop } from './dragdrop.js';\nimport { PastePlainText } from './pasteplaintext.js';\nimport { ClipboardMarkersUtils } from './clipboardmarkersutils.js';\n/**\n * The clipboard feature.\n *\n * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n * * {@link module:clipboard/clipboardpipeline~ClipboardPipeline}\n * * {@link module:clipboard/dragdrop~DragDrop}\n * * {@link module:clipboard/pasteplaintext~PastePlainText}\n */\nexport class Clipboard extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Clipboard';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ClipboardMarkersUtils, ClipboardPipeline, DragDrop, PastePlainText];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        // Add the information about the keystrokes to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Copy selected content'),\n                    keystroke: 'CTRL+C'\n                },\n                {\n                    label: t('Paste content'),\n                    keystroke: 'CTRL+V'\n                },\n                {\n                    label: t('Paste content as plain text'),\n                    keystroke: 'CTRL+SHIFT+V'\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module select-all/selectallcommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\n/**\n * The select all command.\n *\n * It is used by the {@link module:select-all/selectallediting~SelectAllEditing select all editing feature} to handle\n * the <kbd>Ctrl/⌘</kbd>+<kbd>A</kbd> keystroke.\n *\n * Executing this command changes the {@glink framework/architecture/editing-engine#model model}\n * selection so it contains the entire content of the editable root of the editor the selection is\n * {@link module:engine/model/selection~ModelSelection#anchor anchored} in.\n *\n * If the selection was anchored in a {@glink framework/tutorials/widgets/implementing-a-block-widget nested editable}\n * (e.g. a caption of an image), the new selection will contain its entire content. Successive executions of this command\n * will expand the selection to encompass more and more content up to the entire editable root of the editor.\n */\nexport class SelectAllCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // It does not affect data so should be enabled in read-only mode.\n        this.affectsData = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        let scopeElement = model.schema.getLimitElement(selection);\n        // If an entire scope is selected, or the selection's ancestor is not a scope yet,\n        // browse through ancestors to find the enclosing parent scope.\n        if (selection.containsEntireContent(scopeElement) || !isSelectAllScope(model.schema, scopeElement)) {\n            do {\n                scopeElement = scopeElement.parent;\n                // Do nothing, if the entire `root` is already selected.\n                if (!scopeElement) {\n                    return;\n                }\n            } while (!isSelectAllScope(model.schema, scopeElement));\n        }\n        model.change(writer => {\n            writer.setSelection(scopeElement, 'in');\n        });\n    }\n}\n/**\n * Checks whether the element is a valid select-all scope. Returns true, if the element is a\n * {@link module:engine/model/schema~ModelSchema#isLimit limit}, and can contain any text or paragraph.\n *\n * @param schema Schema to check against.\n * @param element Model element.\n */\nfunction isSelectAllScope(schema, element) {\n    return schema.isLimit(element) && (schema.checkChild(element, '$text') || schema.checkChild(element, 'paragraph'));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module select-all/selectallediting\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { getCode, parseKeystroke } from '@ckeditor/ckeditor5-utils';\nimport { SelectAllCommand } from './selectallcommand.js';\nconst SELECT_ALL_KEYSTROKE = /* #__PURE__ */ parseKeystroke('Ctrl+A');\n/**\n * The select all editing feature.\n *\n * It registers the `'selectAll'` {@link module:select-all/selectallcommand~SelectAllCommand command}\n * and the <kbd>Ctrl/⌘</kbd>+<kbd>A</kbd> keystroke listener which executes it.\n */\nexport class SelectAllEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SelectAllEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        editor.commands.add('selectAll', new SelectAllCommand(editor));\n        this.listenTo(viewDocument, 'keydown', (eventInfo, domEventData) => {\n            if (getCode(domEventData) === SELECT_ALL_KEYSTROKE) {\n                editor.execute('selectAll');\n                domEventData.preventDefault();\n            }\n        });\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Select all'),\n                    keystroke: 'CTRL+A'\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module select-all/selectallui\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { IconSelectAll } from '@ckeditor/ckeditor5-icons';\nimport { ButtonView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui';\n/**\n * The select all UI feature.\n *\n * It registers the `'selectAll'` UI button in the editor's\n * {@link module:ui/componentfactory~ComponentFactory component factory}. When clicked, the button\n * executes the {@link module:select-all/selectallcommand~SelectAllCommand select all command}.\n */\nexport class SelectAllUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SelectAllUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('selectAll', () => {\n            const buttonView = this._createButton(ButtonView);\n            buttonView.set({\n                tooltip: true\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:selectAll', () => {\n            return this._createButton(MenuBarMenuListItemButtonView);\n        });\n    }\n    /**\n     * Creates a button for select all command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('selectAll');\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            label: t('Select all'),\n            icon: IconSelectAll,\n            keystroke: 'Ctrl+A'\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute('selectAll');\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75m18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75m-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module select-all/selectall\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { SelectAllEditing } from './selectallediting.js';\nimport { SelectAllUI } from './selectallui.js';\n/**\n * The select all feature.\n *\n * This is a \"glue\" plugin which loads the {@link module:select-all/selectallediting~SelectAllEditing select all editing feature}\n * and the {@link module:select-all/selectallui~SelectAllUI select all UI feature}.\n *\n * Please refer to the documentation of individual features to learn more.\n */\nexport class SelectAll extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [SelectAllEditing, SelectAllUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SelectAll';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module undo/basecommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\nimport { transformOperationSets, NoOperation } from '@ckeditor/ckeditor5-engine';\n/**\n * Base class for the undo feature commands: {@link module:undo/undocommand~UndoCommand} and {@link module:undo/redocommand~RedoCommand}.\n */\nexport class UndoRedoBaseCommand extends Command {\n    /**\n     * Stack of items stored by the command. These are pairs of:\n     *\n     * * {@link module:engine/model/batch~Batch batch} saved by the command,\n     * * {@link module:engine/model/selection~ModelSelection selection} state at the moment of saving the batch.\n     */\n    _stack = [];\n    /**\n     * Stores all batches that were created by this command.\n     *\n     * @internal\n     */\n    _createdBatches = new WeakSet();\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // Refresh state, so the command is inactive right after initialization.\n        this.refresh();\n        // This command should not depend on selection change.\n        this._isEnabledBasedOnSelection = false;\n        // Set the transparent batch for the `editor.data.set()` call if the\n        // batch type is not set already.\n        this.listenTo(editor.data, 'set', (evt, data) => {\n            // Create a shallow copy of the options to not change the original args.\n            // And make sure that an object is assigned to data[ 1 ].\n            data[1] = { ...data[1] };\n            const options = data[1];\n            // If batch type is not set, default to non-undoable batch.\n            if (!options.batchType) {\n                options.batchType = { isUndoable: false };\n            }\n        }, { priority: 'high' });\n        // Clear the stack for the `transparent` batches.\n        this.listenTo(editor.data, 'set', (evt, data) => {\n            // We can assume that the object exists and it has a `batchType` property.\n            // It was ensured with a higher priority listener before.\n            const options = data[1];\n            if (!options.batchType.isUndoable) {\n                this.clearStack();\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._stack.length > 0;\n    }\n    /**\n     * Returns all batches created by this command.\n     */\n    get createdBatches() {\n        return this._createdBatches;\n    }\n    /**\n     * Stores a batch in the command, together with the selection state of the {@link module:engine/model/document~ModelDocument document}\n     * created by the editor which this command is registered to.\n     *\n     * @param batch The batch to add.\n     */\n    addBatch(batch) {\n        const docSelection = this.editor.model.document.selection;\n        const selection = {\n            ranges: docSelection.hasOwnRange ? Array.from(docSelection.getRanges()) : [],\n            isBackward: docSelection.isBackward\n        };\n        this._stack.push({ batch, selection });\n        this.refresh();\n    }\n    /**\n     * Removes all items from the stack.\n     */\n    clearStack() {\n        this._stack = [];\n        this.refresh();\n    }\n    /**\n     * Restores the {@link module:engine/model/document~ModelDocument#selection document selection} state after a batch was undone.\n     *\n     * @param ranges Ranges to be restored.\n     * @param isBackward A flag describing whether the restored range was selected forward or backward.\n     * @param operations Operations which has been applied since selection has been stored.\n     */\n    _restoreSelection(ranges, isBackward, operations) {\n        const model = this.editor.model;\n        const document = model.document;\n        // This will keep the transformed selection ranges.\n        const selectionRanges = [];\n        // Transform all ranges from the restored selection.\n        const transformedRangeGroups = ranges.map(range => range.getTransformedByOperations(operations));\n        const allRanges = transformedRangeGroups.flat();\n        for (const rangeGroup of transformedRangeGroups) {\n            // While transforming there could appear ranges that are contained by other ranges, we shall ignore them.\n            const transformed = rangeGroup\n                .filter(range => range.root != document.graveyard)\n                .filter(range => !isRangeContainedByAnyOtherRange(range, allRanges));\n            // All the transformed ranges ended up in graveyard.\n            if (!transformed.length) {\n                continue;\n            }\n            // After the range got transformed, we have an array of ranges. Some of those\n            // ranges may be \"touching\" -- they can be next to each other and could be merged.\n            normalizeRanges(transformed);\n            // For each `range` from `ranges`, we take only one transformed range.\n            // This is because we want to prevent situation where single-range selection\n            // got transformed to multi-range selection.\n            selectionRanges.push(transformed[0]);\n        }\n        // @if CK_DEBUG_ENGINE // console.log( `Restored selection by undo: ${ selectionRanges.join( ', ' ) }` );\n        // `selectionRanges` may be empty if all ranges ended up in graveyard. If that is the case, do not restore selection.\n        if (selectionRanges.length) {\n            model.change(writer => {\n                writer.setSelection(selectionRanges, { backward: isBackward });\n            });\n        }\n    }\n    /**\n     * Undoes a batch by reversing that batch, transforming reversed batch and finally applying it.\n     * This is a helper method for {@link #execute}.\n     *\n     * @param batchToUndo The batch to be undone.\n     * @param undoingBatch The batch that will contain undoing changes.\n     */\n    _undo(batchToUndo, undoingBatch) {\n        const model = this.editor.model;\n        const document = model.document;\n        // All changes done by the command execution will be saved as one batch.\n        this._createdBatches.add(undoingBatch);\n        const operationsToUndo = batchToUndo.operations.slice().filter(operation => operation.isDocumentOperation);\n        operationsToUndo.reverse();\n        // We will process each operation from `batchToUndo`, in reverse order. If there were operations A, B and C in undone batch,\n        // we need to revert them in reverse order, so first C' (reversed C), then B', then A'.\n        for (const operationToUndo of operationsToUndo) {\n            const nextBaseVersion = operationToUndo.baseVersion + 1;\n            const historyOperations = Array.from(document.history.getOperations(nextBaseVersion));\n            const transformedSets = transformOperationSets([operationToUndo.getReversed()], historyOperations, {\n                useRelations: true,\n                document: this.editor.model.document,\n                padWithNoOps: false,\n                forceWeakRemove: true\n            });\n            const reversedOperations = transformedSets.operationsA;\n            // After reversed operation has been transformed by all history operations, apply it.\n            for (let operation of reversedOperations) {\n                // Do not apply any operation on non-editable space.\n                const affectedSelectable = operation.affectedSelectable;\n                if (affectedSelectable && !model.canEditAt(affectedSelectable)) {\n                    operation = new NoOperation(operation.baseVersion);\n                }\n                // Before applying, add the operation to the `undoingBatch`.\n                undoingBatch.addOperation(operation);\n                model.applyOperation(operation);\n                document.history.setOperationAsUndone(operationToUndo, operation);\n            }\n        }\n    }\n}\n/**\n * Normalizes list of ranges by joining intersecting or \"touching\" ranges.\n *\n * @param ranges Ranges to be normalized.\n */\nfunction normalizeRanges(ranges) {\n    ranges.sort((a, b) => a.start.isBefore(b.start) ? -1 : 1);\n    for (let i = 1; i < ranges.length; i++) {\n        const previousRange = ranges[i - 1];\n        const joinedRange = previousRange.getJoined(ranges[i], true);\n        if (joinedRange) {\n            // Replace the ranges on the list with the new joined range.\n            i--;\n            ranges.splice(i, 2, joinedRange);\n        }\n    }\n}\nfunction isRangeContainedByAnyOtherRange(range, ranges) {\n    return ranges.some(otherRange => otherRange !== range && otherRange.containsRange(range, true));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module undo/undocommand\n */\nimport { UndoRedoBaseCommand } from './basecommand.js';\n/**\n * The undo command stores {@link module:engine/model/batch~Batch batches} applied to the\n * {@link module:engine/model/document~ModelDocument document} and is able to undo a batch by reversing it and transforming by\n * batches from {@link module:engine/model/document~ModelDocument#history history} that happened after the reversed batch.\n *\n * The undo command also takes care of restoring the {@link module:engine/model/document~ModelDocument#selection document selection}.\n */\nexport class UndoCommand extends UndoRedoBaseCommand {\n    /**\n     * Executes the command. This method reverts a {@link module:engine/model/batch~Batch batch} added to the command's stack, transforms\n     * and applies the reverted version on the {@link module:engine/model/document~ModelDocument document} and removes the batch from\n     * the stack. Then, it restores the {@link module:engine/model/document~ModelDocument#selection document selection}.\n     *\n     * @fires execute\n     * @fires revert\n     * @param batch A batch that should be undone. If not set, the last added batch will be undone.\n     */\n    execute(batch = null) {\n        // If batch is not given, set `batchIndex` to the last index in command stack.\n        const batchIndex = batch ? this._stack.findIndex(a => a.batch == batch) : this._stack.length - 1;\n        const item = this._stack.splice(batchIndex, 1)[0];\n        const undoingBatch = this.editor.model.createBatch({ isUndo: true });\n        // All changes have to be done in one `enqueueChange` callback so other listeners will not\n        // step between consecutive operations, or won't do changes to the document before selection is properly restored.\n        this.editor.model.enqueueChange(undoingBatch, () => {\n            this._undo(item.batch, undoingBatch);\n            const operations = this.editor.model.document.history.getOperations(item.batch.baseVersion);\n            this._restoreSelection(item.selection.ranges, item.selection.isBackward, operations);\n        });\n        // Firing `revert` event after the change block to make sure that it includes all changes from post-fixers\n        // and make sure that the selection is \"stabilized\" (the selection range is saved after undo is executed and then\n        // restored on redo, so it is important that the selection range is saved after post-fixers are done).\n        this.fire('revert', item.batch, undoingBatch);\n        this.refresh();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module undo/redocommand\n */\nimport { UndoRedoBaseCommand } from './basecommand.js';\n/**\n * The redo command stores {@link module:engine/model/batch~Batch batches} that were used to undo a batch by\n * {@link module:undo/undocommand~UndoCommand}. It is able to redo a previously undone batch by reversing the undoing\n * batches created by `UndoCommand`. The reversed batch is transformed by all the batches from\n * {@link module:engine/model/document~ModelDocument#history history} that happened after the reversed undo batch.\n *\n * The redo command also takes care of restoring the {@link module:engine/model/document~ModelDocument#selection document selection}.\n */\nexport class RedoCommand extends UndoRedoBaseCommand {\n    /**\n     * Executes the command. This method reverts the last {@link module:engine/model/batch~Batch batch} added to\n     * the command's stack, applies the reverted and transformed version on the\n     * {@link module:engine/model/document~ModelDocument document} and removes the batch from the stack.\n     * Then, it restores the {@link module:engine/model/document~ModelDocument#selection document selection}.\n     *\n     * @fires execute\n     */\n    execute() {\n        const item = this._stack.pop();\n        const redoingBatch = this.editor.model.createBatch({ isUndo: true });\n        // All changes have to be done in one `enqueueChange` callback so other listeners will not step between consecutive\n        // operations, or won't do changes to the document before selection is properly restored.\n        this.editor.model.enqueueChange(redoingBatch, () => {\n            const lastOperation = item.batch.operations[item.batch.operations.length - 1];\n            const nextBaseVersion = lastOperation.baseVersion + 1;\n            const operations = this.editor.model.document.history.getOperations(nextBaseVersion);\n            this._restoreSelection(item.selection.ranges, item.selection.isBackward, operations);\n            this._undo(item.batch, redoingBatch);\n        });\n        // Firing `revert` event after the change block to make sure that it includes all changes from post-fixers\n        // and make sure that the selection is \"stabilized\" (the selection range is saved after undo is executed and then\n        // restored on redo, so it is important that the selection range is saved after post-fixers are done).\n        this.fire('revert', item.batch, redoingBatch);\n        this.refresh();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module undo/undoediting\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { UndoCommand } from './undocommand.js';\nimport { RedoCommand } from './redocommand.js';\n/**\n * The undo engine feature.\n *\n * It introduces the `'undo'` and `'redo'` commands to the editor.\n */\nexport class UndoEditing extends Plugin {\n    /**\n     * The command that manages the undo {@link module:engine/model/batch~Batch batches} stack (history).\n     * Created and registered during the {@link #init feature initialization}.\n     */\n    _undoCommand;\n    /**\n     * The command that manages the redo {@link module:engine/model/batch~Batch batches} stack (history).\n     * Created and registered during the {@link #init feature initialization}.\n     */\n    _redoCommand;\n    /**\n     * Keeps track of which batches were registered in undo.\n     */\n    _batchRegistry = new WeakSet();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'UndoEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        // Create commands.\n        this._undoCommand = new UndoCommand(editor);\n        this._redoCommand = new RedoCommand(editor);\n        // Register command to the editor.\n        editor.commands.add('undo', this._undoCommand);\n        editor.commands.add('redo', this._redoCommand);\n        this.listenTo(editor.model, 'applyOperation', (evt, args) => {\n            const operation = args[0];\n            // Do not register batch if the operation is not a document operation.\n            // This prevents from creating empty undo steps, where all operations where non-document operations.\n            // Non-document operations creates and alters content in detached tree fragments (for example, document fragments).\n            // Most of time this is preparing data before it is inserted into actual tree (for example during copy & paste).\n            // Such operations should not be reversed.\n            if (!operation.isDocumentOperation) {\n                return;\n            }\n            const batch = operation.batch;\n            const isRedoBatch = this._redoCommand.createdBatches.has(batch);\n            const isUndoBatch = this._undoCommand.createdBatches.has(batch);\n            const wasProcessed = this._batchRegistry.has(batch);\n            // Skip the batch if it was already processed.\n            if (wasProcessed) {\n                return;\n            }\n            // Add the batch to the registry so it will not be processed again.\n            this._batchRegistry.add(batch);\n            if (!batch.isUndoable) {\n                return;\n            }\n            if (isRedoBatch) {\n                // If this batch comes from `redoCommand`, add it to the `undoCommand` stack.\n                this._undoCommand.addBatch(batch);\n            }\n            else if (!isUndoBatch) {\n                // If the batch comes neither  from `redoCommand` nor from `undoCommand` then it is a new, regular batch.\n                // Add the batch to the `undoCommand` stack and clear the `redoCommand` stack.\n                this._undoCommand.addBatch(batch);\n                this._redoCommand.clearStack();\n            }\n        }, { priority: 'highest' });\n        this.listenTo(this._undoCommand, 'revert', (evt, undoneBatch, undoingBatch) => {\n            this._redoCommand.addBatch(undoingBatch);\n        });\n        editor.keystrokes.set('CTRL+Z', 'undo');\n        editor.keystrokes.set('CTRL+Y', 'redo');\n        editor.keystrokes.set('CTRL+SHIFT+Z', 'redo');\n        // Add the information about the keystrokes to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Undo'),\n                    keystroke: 'CTRL+Z'\n                },\n                {\n                    label: t('Redo'),\n                    keystroke: [['CTRL+Y'], ['CTRL+SHIFT+Z']]\n                }\n            ]\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.75.75 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.8.8 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.75.75 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.8.8 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module undo/undoui\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { ButtonView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui';\nimport { IconUndo, IconRedo } from '@ckeditor/ckeditor5-icons';\n/**\n * The undo UI feature. It introduces the `'undo'` and `'redo'` buttons to the editor.\n */\nexport class UndoUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'UndoUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const t = editor.t;\n        const localizedUndoIcon = locale.uiLanguageDirection == 'ltr' ? IconUndo : IconRedo;\n        const localizedRedoIcon = locale.uiLanguageDirection == 'ltr' ? IconRedo : IconUndo;\n        this._addButtonsToFactory('undo', t('Undo'), 'CTRL+Z', localizedUndoIcon);\n        this._addButtonsToFactory('redo', t('Redo'), 'CTRL+Y', localizedRedoIcon);\n    }\n    /**\n     * Creates a button for the specified command.\n     *\n     * @param name Command name.\n     * @param label Button label.\n     * @param keystroke Command keystroke.\n     * @param Icon Source of the icon.\n     */\n    _addButtonsToFactory(name, label, keystroke, Icon) {\n        const editor = this.editor;\n        editor.ui.componentFactory.add(name, () => {\n            const buttonView = this._createButton(ButtonView, name, label, keystroke, Icon);\n            buttonView.set({\n                tooltip: true\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:' + name, () => {\n            return this._createButton(MenuBarMenuListItemButtonView, name, label, keystroke, Icon);\n        });\n    }\n    /**\n     * TODO\n     */\n    _createButton(ButtonClass, name, label, keystroke, Icon) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get(name);\n        const view = new ButtonClass(locale);\n        view.set({\n            label,\n            icon: Icon,\n            keystroke\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        this.listenTo(view, 'execute', () => {\n            editor.execute(name);\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module undo/undo\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { UndoEditing } from './undoediting.js';\nimport { UndoUI } from './undoui.js';\n/**\n * The undo feature.\n *\n * This is a \"glue\" plugin which loads the {@link module:undo/undoediting~UndoEditing undo editing feature}\n * and the {@link module:undo/undoui~UndoUI undo UI feature}.\n *\n * Below is an explanation of the undo mechanism working together with {@link module:engine/model/history~History History}:\n *\n * Whenever an {@link module:engine/model/operation/operation~Operation operation} is applied to the\n * {@link module:engine/model/document~ModelDocument document}, it is saved to `History` as is.\n * The {@link module:engine/model/batch~Batch batch} that owns that operation is also saved, in\n * {@link module:undo/undocommand~UndoCommand}, together with the selection that was present in the document before the\n * operation was applied. A batch is saved instead of the operation because changes are undone batch-by-batch, not operation-by-operation\n * and a batch is seen as one undo step.\n *\n * After changes happen to the document, the `History` and `UndoCommand` stack can be represented as follows:\n *\n * ```\n *    History                            Undo stack\n * ==============             ==================================\n * [operation A1]                      [  batch A  ]\n * [operation B1]                      [  batch B  ]\n * [operation B2]                      [  batch C  ]\n * [operation C1]\n * [operation C2]\n * [operation B3]\n * [operation C3]\n * ```\n *\n * Where operations starting with the same letter are from same batch.\n *\n * Undoing a batch means that a set of operations which will reverse the effects of that batch needs to be generated.\n * For example, if a batch added several letters, undoing the batch should remove them. It is important to apply undoing\n * operations in the reversed order, so if a batch has operation `X`, `Y`, `Z`, reversed operations `Zr`, `Yr` and `Xr`\n * need to be applied. Otherwise reversed operation `Xr` would operate on a wrong document state, because operation `X`\n * does not know that operations `Y` and `Z` happened.\n *\n * After operations from an undone batch got {@link module:engine/model/operation/operation~Operation#getReversed reversed},\n * one needs to make sure if they are ready to be applied. In the scenario above, operation `C3` is the last operation and `C3r`\n * bases on up-to-date document state, so it can be applied to the document.\n *\n * ```\n *      History                             Undo stack\n * =================             ==================================\n * [ operation A1  ]                      [  batch A  ]\n * [ operation B1  ]                      [  batch B  ]\n * [ operation B2  ]             [   processing undoing batch C   ]\n * [ operation C1  ]\n * [ operation C2  ]\n * [ operation B3  ]\n * [ operation C3  ]\n * [ operation C3r ]\n * ```\n *\n * Next is operation `C2`, reversed to `C2r`. `C2r` bases on `C2`, so it bases on the wrong document state. It needs to be\n * transformed by operations from history that happened after it, so it \"knows\" about them. Let us assume that `C2' = C2r * B3 * C3 * C3r`,\n * where `*` means \"transformed by\". Rest of operations from that batch are processed in the same fashion.\n *\n * ```\n *      History                             Undo stack                                      Redo stack\n * =================             ==================================             ==================================\n * [ operation A1  ]                      [  batch A  ]                                    [ batch Cr ]\n * [ operation B1  ]                      [  batch B  ]\n * [ operation B2  ]\n * [ operation C1  ]\n * [ operation C2  ]\n * [ operation B3  ]\n * [ operation C3  ]\n * [ operation C3r ]\n * [ operation C2' ]\n * [ operation C1' ]\n * ```\n *\n * Selective undo works on the same basis, however, instead of undoing the last batch in the undo stack, any batch can be undone.\n * The same algorithm applies: operations from a batch (i.e. `A1`) are reversed and then transformed by operations stored in history.\n *\n * Redo also is very similar to undo. It has its own stack that is filled with undoing (reversed batches). Operations from\n * the batch that is re-done are reversed-back, transformed in proper order and applied to the document.\n *\n * ```\n *      History                             Undo stack                                      Redo stack\n * =================             ==================================             ==================================\n * [ operation A1  ]                      [  batch A  ]\n * [ operation B1  ]                      [  batch B  ]\n * [ operation B2  ]                      [ batch Crr ]\n * [ operation C1  ]\n * [ operation C2  ]\n * [ operation B3  ]\n * [ operation C3  ]\n * [ operation C3r ]\n * [ operation C2' ]\n * [ operation C1' ]\n * [ operation C1'r]\n * [ operation C2'r]\n * [ operation C3rr]\n * ```\n */\nexport class Undo extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [UndoEditing, UndoUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Undo';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103z\\\"/><path d=\\\"M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17m0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10\\\" clip-rule=\\\"evenodd\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { DialogView, DialogViewPosition } from './dialogview.js';\n/**\n * The dialog controller class. It is used to show and hide the {@link module:ui/dialog/dialogview~DialogView}.\n */\nexport class Dialog extends Plugin {\n    /**\n     * The currently visible dialog view instance.\n     */\n    view;\n    /**\n     * The `Dialog` plugin instance which most recently showed the dialog.\n     *\n     * Only one dialog can be visible at once, even if there are many editor instances on the page.\n     * If an editor wants to show a dialog, it should first hide the dialog that is already opened.\n     * But only the `Dialog` instance that showed the dialog is able able to properly hide it.\n     * This is why we need to store it in a globally available space (static property).\n     * This way every `Dialog` plugin in every editor is able to correctly close any open dialog window.\n     */\n    static _visibleDialogPlugin;\n    /**\n     * A configurable callback called when the dialog is hidden.\n     */\n    _onHide;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Dialog';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        const t = editor.t;\n        this._initShowHideListeners();\n        this._initFocusToggler();\n        this._initMultiRootIntegration();\n        this.set({\n            id: null,\n            isOpen: false\n        });\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            categoryId: 'navigation',\n            keystrokes: [{\n                    label: t('Move focus in and out of an active dialog window'),\n                    keystroke: 'Ctrl+F6',\n                    mayRequireFn: true\n                }]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        if (Dialog._visibleDialogPlugin === this) {\n            this._unlockBodyScroll();\n        }\n    }\n    /**\n     * Initiates listeners for the `show` and `hide` events emitted by this plugin.\n     *\n     * We could not simply decorate the {@link #show} and {@link #hide} methods to fire events,\n     * because they would be fired in the wrong order &ndash; first would be `show` and then `hide`\n     * (because showing the dialog actually starts with hiding the previously visible one).\n     * Hence, we added private methods {@link #_show} and {@link #_hide} which are called on events\n     * in the desired sequence.\n     */\n    _initShowHideListeners() {\n        this.on('show', (evt, args) => {\n            this._show(args);\n        });\n        // 'low' priority allows to add custom callback between `_show()` and `onShow()`.\n        this.on('show', (evt, args) => {\n            if (args.onShow) {\n                args.onShow(this);\n            }\n        }, { priority: 'low' });\n        this.on('hide', () => {\n            if (Dialog._visibleDialogPlugin) {\n                Dialog._visibleDialogPlugin._hide();\n            }\n        });\n        // 'low' priority allows to add custom callback between `_hide()` and `onHide()`.\n        this.on('hide', () => {\n            if (this._onHide) {\n                this._onHide(this);\n                this._onHide = undefined;\n            }\n        }, { priority: 'low' });\n    }\n    /**\n     * Initiates keystroke handler for toggling the focus between the editor and the dialog view.\n     */\n    _initFocusToggler() {\n        const editor = this.editor;\n        editor.keystrokes.set('Ctrl+F6', (data, cancel) => {\n            if (!this.isOpen || this.view.isModal) {\n                return;\n            }\n            if (this.view.focusTracker.isFocused) {\n                editor.editing.view.focus();\n            }\n            else {\n                this.view.focus();\n            }\n            cancel();\n        });\n    }\n    /**\n     * Provides an integration between the root attaching and detaching and positioning of the view.\n     */\n    _initMultiRootIntegration() {\n        const model = this.editor.model;\n        model.document.on('change:data', () => {\n            if (!this.view) {\n                return;\n            }\n            const changedRoots = model.document.differ.getChangedRoots();\n            for (const changes of changedRoots) {\n                if (changes.state) {\n                    this.view.updatePosition();\n                }\n            }\n        });\n    }\n    /**\n     * Displays a dialog window.\n     *\n     * This method requires a {@link ~DialogDefinition} that defines the dialog's content, title, icon, action buttons, etc.\n     *\n     * For example, the following definition will create a dialog with:\n     * * A header consisting of an icon, a title, and a \"Close\" button (it is added by default).\n     * * A content consisting of a view with a single paragraph.\n     * * A footer consisting of two buttons: \"Yes\" and \"No\".\n     *\n     * ```js\n     * // Create the view that will be used as the dialog's content.\n     * const textView = new View( locale );\n     *\n     * textView.setTemplate( {\n     * \ttag: 'div',\n     * \tattributes: {\n     * \t\tstyle: {\n     * \t\t\tpadding: 'var(--ck-spacing-large)',\n     * \t\t\twhiteSpace: 'initial',\n     * \t\t\twidth: '100%',\n     * \t\t\tmaxWidth: '500px'\n     * \t\t},\n     * \t\ttabindex: -1\n     * \t},\n     * \tchildren: [\n     * \t\t'Lorem ipsum dolor sit amet...'\n     * \t]\n     * } );\n     *\n     * // Show the dialog.\n     * editor.plugins.get( 'Dialog' ).show( {\n     *\tid: 'myDialog',\n     * \ticon: 'myIcon', // This should be an SVG string.\n     * \ttitle: 'My dialog',\n     * \tcontent: textView,\n     * \tactionButtons: [\n     *\t\t{\n     *\t\t\tlabel: t( 'Yes' ),\n     *\t\t\tclass: 'ck-button-action',\n     *\t\t\twithText: true,\n     *\t\t\tonExecute: () => dialog.hide()\n     *\t\t},\n     *\t\t{\n     *\t\t\tlabel: t( 'No' ),\n     *\t\t\twithText: true,\n     *\t\t\tonExecute: () => dialog.hide()\n     *\t\t}\n     *\t]\n     * } );\n     * ```\n     *\n     * By specifying the {@link ~DialogDefinition#onShow} and {@link ~DialogDefinition#onHide} callbacks\n     * it is also possible to add callbacks that will be called when the dialog is shown or hidden.\n     *\n     * For example, the callbacks in the following definition:\n     * * Disable the default behavior of the <kbd>Esc</kbd> key.\n     * * Fire a custom event when the dialog gets hidden.\n     *\n     * ```js\n     * editor.plugins.get( 'Dialog' ).show( {\n     * \t// ...\n     * \tonShow: dialog => {\n     * \t\tdialog.view.on( 'close', ( evt, data ) => {\n     * \t\t\t// Only prevent the event from the \"Esc\" key - do not affect the other ways of closing the dialog.\n     * \t\t\tif ( data.source === 'escKeyPress' ) {\n     * \t\t\t\tevt.stop();\n     * \t\t\t}\n     * \t\t} );\n     * \t},\n     * \tonHide: dialog => {\n     * \t\tdialog.fire( 'dialogDestroyed' );\n     * \t}\n     * } );\n     * ```\n     *\n     * Internally, calling this method:\n     * 1. Hides the currently visible dialog (if any) calling the {@link #hide} method\n     * (fires the {@link ~DialogHideEvent hide event}).\n     * 2. Fires the {@link ~DialogShowEvent show event} which allows for adding callbacks that customize the\n     * behavior of the dialog.\n     * 3. Shows the dialog.\n     */\n    show(dialogDefinition) {\n        this.hide();\n        this.fire(`show:${dialogDefinition.id}`, dialogDefinition);\n    }\n    /**\n     * Handles creating the {@link module:ui/dialog/dialogview~DialogView} instance and making it visible.\n     */\n    _show({ id, icon, title, hasCloseButton = true, content, actionButtons, className, isModal, position, onHide, keystrokeHandlerOptions }) {\n        const editor = this.editor;\n        this.view = new DialogView(editor.locale, {\n            getCurrentDomRoot: () => {\n                return editor.editing.view.getDomRoot(editor.model.document.selection.anchor.root.rootName);\n            },\n            getViewportOffset: () => {\n                return editor.ui.viewportOffset;\n            },\n            keystrokeHandlerOptions\n        });\n        const view = this.view;\n        view.on('close', () => {\n            this.hide();\n        });\n        editor.ui.view.body.add(view);\n        editor.keystrokes.listenTo(view.element);\n        // Unless the user specified a position, modals should always be centered on the screen.\n        // Otherwise, let's keep dialogs centered in the editing root by default.\n        if (!position) {\n            position = isModal ? DialogViewPosition.SCREEN_CENTER : DialogViewPosition.EDITOR_CENTER;\n        }\n        if (isModal) {\n            this._lockBodyScroll();\n        }\n        view.set({\n            position,\n            _isVisible: true,\n            className,\n            isModal\n        });\n        view.setupParts({\n            icon,\n            title,\n            hasCloseButton,\n            content,\n            actionButtons\n        });\n        this.id = id;\n        if (onHide) {\n            this._onHide = onHide;\n        }\n        this.isOpen = true;\n        Dialog._visibleDialogPlugin = this;\n    }\n    /**\n     * Hides the dialog. This method is decorated to enable interacting on the {@link ~DialogHideEvent hide event}.\n     *\n     * See {@link #show}.\n     */\n    hide() {\n        if (Dialog._visibleDialogPlugin) {\n            Dialog._visibleDialogPlugin.fire(`hide:${Dialog._visibleDialogPlugin.id}`);\n        }\n    }\n    /**\n     * Destroys the {@link module:ui/dialog/dialogview~DialogView} and cleans up the stored dialog state.\n     */\n    _hide() {\n        if (!this.view) {\n            return;\n        }\n        const editor = this.editor;\n        const view = this.view;\n        if (view.isModal) {\n            this._unlockBodyScroll();\n        }\n        // Reset the content view to prevent its children from being destroyed in the standard\n        // View#destroy() (and collections) chain. If the content children were left in there,\n        // they would have to be re-created by the feature using the dialog every time the dialog\n        // shows up.\n        if (view.contentView) {\n            view.contentView.reset();\n        }\n        editor.ui.view.body.remove(view);\n        editor.ui.focusTracker.remove(view.element);\n        editor.keystrokes.stopListening(view.element);\n        view.destroy();\n        editor.editing.view.focus();\n        this.id = null;\n        this.isOpen = false;\n        Dialog._visibleDialogPlugin = null;\n    }\n    /**\n     * Makes the <body> unscrollable (e.g. when the modal shows up).\n     */\n    _lockBodyScroll() {\n        document.documentElement.classList.add('ck-dialog-scroll-locked');\n    }\n    /**\n     * Makes the <body> scrollable again (e.g. once the modal hides).\n     */\n    _unlockBodyScroll() {\n        document.documentElement.classList.remove('ck-dialog-scroll-locked');\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/accessibilityhelp/accessibilityhelpcontentview\n */\nimport { createElement, env, getEnvKeystrokeText } from '@ckeditor/ckeditor5-utils';\nimport { View } from '../../view.js';\nimport { LabelView } from '../../label/labelview.js';\n/**\n * The view displaying keystrokes in the Accessibility help dialog.\n */\nexport class AccessibilityHelpContentView extends View {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale, keystrokes) {\n        super(locale);\n        const t = locale.t;\n        const helpLabel = new LabelView();\n        helpLabel.text = t('Help Contents. To close this dialog press ESC.');\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-accessibility-help-dialog__content'],\n                'aria-labelledby': helpLabel.id,\n                role: 'document',\n                tabindex: -1\n            },\n            children: [\n                createElement(document, 'p', {}, t('Below, you can find a list of keyboard shortcuts that can be used in the editor.')),\n                ...this._createCategories(Array.from(keystrokes.values())),\n                helpLabel\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    focus() {\n        this.element.focus();\n    }\n    /**\n     * Creates `<section><h3>Category label</h3>...</section>` elements for each category of keystrokes.\n     */\n    _createCategories(categories) {\n        return categories.map(categoryDefinition => {\n            const elements = [\n                // Category header.\n                createElement(document, 'h3', {}, categoryDefinition.label),\n                // Category definitions (<dl>) and their optional headers (<h4>).\n                ...Array.from(categoryDefinition.groups.values())\n                    .map(groupDefinition => this._createGroup(groupDefinition))\n                    .flat()\n            ];\n            // Category description (<p>).\n            if (categoryDefinition.description) {\n                elements.splice(1, 0, createElement(document, 'p', {}, categoryDefinition.description));\n            }\n            return createElement(document, 'section', {}, elements);\n        });\n    }\n    /**\n     * Creates `[<h4>Optional label</h4>]<dl>...</dl>` elements for each group of keystrokes in a category.\n     */\n    _createGroup(groupDefinition) {\n        const definitionAndDescriptionElements = groupDefinition.keystrokes\n            .sort((a, b) => a.label.localeCompare(b.label))\n            .map(keystrokeDefinition => this._createGroupRow(keystrokeDefinition))\n            .flat();\n        const elements = [\n            createElement(document, 'dl', {}, definitionAndDescriptionElements)\n        ];\n        if (groupDefinition.label) {\n            elements.unshift(createElement(document, 'h4', {}, groupDefinition.label));\n        }\n        return elements;\n    }\n    /**\n     * Creates `<dt>Keystroke label</dt><dd>Keystroke definition</dd>` elements for each keystroke in a group.\n     */\n    _createGroupRow(keystrokeDefinition) {\n        const t = this.locale.t;\n        const dt = createElement(document, 'dt');\n        const dd = createElement(document, 'dd');\n        const normalizedKeystrokeDefinition = normalizeKeystrokeDefinition(keystrokeDefinition.keystroke);\n        const keystrokeAlternativeHTMLs = [];\n        for (const keystrokeAlternative of normalizedKeystrokeDefinition) {\n            keystrokeAlternativeHTMLs.push(keystrokeAlternative.map(keystrokeToEnvKbd).join(''));\n        }\n        dt.innerHTML = keystrokeDefinition.label;\n        dd.innerHTML = keystrokeAlternativeHTMLs.join(', ') +\n            (keystrokeDefinition.mayRequireFn && env.isMac ? ` ${t('(may require <kbd>Fn</kbd>)')}` : '');\n        return [dt, dd];\n    }\n}\nfunction keystrokeToEnvKbd(keystroke) {\n    return getEnvKeystrokeText(keystroke)\n        .split('+')\n        .map(part => `<kbd>${part}</kbd>`)\n        .join('+');\n}\nfunction normalizeKeystrokeDefinition(definition) {\n    if (typeof definition === 'string') {\n        return [[definition]];\n    }\n    if (typeof definition[0] === 'string') {\n        return [definition];\n    }\n    return definition;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/editorui/accessibilityhelp/accessibilityhelp\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { IconAccessibility } from '@ckeditor/ckeditor5-icons';\nimport { ButtonView } from '../../button/buttonview.js';\nimport { Dialog } from '../../dialog/dialog.js';\nimport { MenuBarMenuListItemButtonView } from '../../menubar/menubarmenulistitembuttonview.js';\nimport { AccessibilityHelpContentView } from './accessibilityhelpcontentview.js';\nimport { getEnvKeystrokeText } from '@ckeditor/ckeditor5-utils';\nimport '../../../theme/components/editorui/accessibilityhelp.css';\n/**\n * A plugin that brings the accessibility help dialog to the editor available under the <kbd>Alt</kbd>+<kbd>0</kbd>\n * keystroke and via the \"Accessibility help\" toolbar button. The dialog displays a list of keystrokes that can be used\n * by the user to perform various actions in the editor.\n *\n * Keystroke information is loaded from {@link module:core/accessibility~Accessibility#keystrokeInfos}. New entries can be\n * added using the API provided by the {@link module:core/accessibility~Accessibility} class.\n */\nexport class AccessibilityHelp extends Plugin {\n    /**\n     * The view that displays the dialog content (list of keystrokes).\n     * Created when the dialog is opened for the first time.\n     */\n    contentView = null;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Dialog];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'AccessibilityHelp';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        editor.ui.componentFactory.add('accessibilityHelp', () => {\n            const button = this._createButton(ButtonView);\n            button.set({\n                tooltip: true,\n                withText: false,\n                label: t('Accessibility help')\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('menuBar:accessibilityHelp', () => {\n            const button = this._createButton(MenuBarMenuListItemButtonView);\n            button.label = t('Accessibility');\n            return button;\n        });\n        editor.keystrokes.set('Alt+0', (evt, cancel) => {\n            this._toggleDialog();\n            cancel();\n        });\n        this._setupRootLabels();\n    }\n    /**\n     * Creates a button to show accessibility help dialog, for use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const dialog = editor.plugins.get('Dialog');\n        const locale = editor.locale;\n        const view = new ButtonClass(locale);\n        view.set({\n            keystroke: 'Alt+0',\n            icon: IconAccessibility,\n            isToggleable: true\n        });\n        view.on('execute', () => this._toggleDialog());\n        view.bind('isOn').to(dialog, 'id', id => id === 'accessibilityHelp');\n        return view;\n    }\n    /**\n     * Injects a help text into each editing root's `aria-label` attribute allowing assistive technology users\n     * to discover the availability of the Accessibility help dialog.\n     */\n    _setupRootLabels() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const t = editor.t;\n        editor.ui.on('ready', () => {\n            editingView.change(writer => {\n                for (const root of editingView.document.roots) {\n                    addAriaLabelTextToRoot(writer, root);\n                }\n            });\n            editor.on('addRoot', (evt, modelRoot) => {\n                const viewRoot = editor.editing.view.document.getRoot(modelRoot.rootName);\n                editingView.change(writer => addAriaLabelTextToRoot(writer, viewRoot));\n            }, { priority: 'low' });\n        });\n        function addAriaLabelTextToRoot(writer, viewRoot) {\n            const currentAriaLabel = viewRoot.getAttribute('aria-label');\n            const newAriaLabel = [currentAriaLabel, t('Press %0 for help.', [getEnvKeystrokeText('Alt+0')])]\n                .filter(segment => segment)\n                .join('. ');\n            writer.setAttribute('aria-label', newAriaLabel, viewRoot);\n        }\n    }\n    /**\n     * Shows the accessibility help dialog. Also, creates {@link #contentView} on demand.\n     */\n    _toggleDialog() {\n        const editor = this.editor;\n        const dialog = editor.plugins.get('Dialog');\n        const t = editor.locale.t;\n        if (!this.contentView) {\n            this.contentView = new AccessibilityHelpContentView(editor.locale, editor.accessibility.keystrokeInfos);\n        }\n        if (dialog.id === 'accessibilityHelp') {\n            dialog.hide();\n        }\n        else {\n            dialog.show({\n                id: 'accessibilityHelp',\n                className: 'ck-accessibility-help-dialog',\n                title: t('Accessibility help'),\n                icon: IconAccessibility,\n                hasCloseButton: true,\n                content: this.contentView\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module upload/filereader\n */\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * Wrapper over the native `FileReader`.\n */\nexport class FileReader extends /* #__PURE__ */ ObservableMixin() {\n    total;\n    /**\n     * Instance of native FileReader.\n     */\n    _reader;\n    /**\n     * Holds the data of an already loaded file. The file must be first loaded\n     * by using {@link module:upload/filereader~FileReader#read `read()`}.\n     */\n    _data;\n    /**\n     * Creates an instance of the FileReader.\n     */\n    constructor() {\n        super();\n        const reader = new window.FileReader();\n        this._reader = reader;\n        this._data = undefined;\n        this.set('loaded', 0);\n        reader.onprogress = evt => {\n            this.loaded = evt.loaded;\n        };\n    }\n    /**\n     * Returns error that occurred during file reading.\n     */\n    get error() {\n        return this._reader.error;\n    }\n    /**\n     * Holds the data of an already loaded file. The file must be first loaded\n     * by using {@link module:upload/filereader~FileReader#read `read()`}.\n     */\n    get data() {\n        return this._data;\n    }\n    /**\n     * Reads the provided file.\n     *\n     * @param file Native File object.\n     * @returns Returns a promise that will be resolved with file's content.\n     * The promise will be rejected in case of an error or when the reading process is aborted.\n     */\n    read(file) {\n        const reader = this._reader;\n        this.total = file.size;\n        return new Promise((resolve, reject) => {\n            reader.onload = () => {\n                const result = reader.result;\n                this._data = result;\n                resolve(result);\n            };\n            reader.onerror = () => {\n                reject('error');\n            };\n            reader.onabort = () => {\n                reject('aborted');\n            };\n            this._reader.readAsDataURL(file);\n        });\n    }\n    /**\n     * Aborts file reader.\n     */\n    abort() {\n        this._reader.abort();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module upload/filerepository\n */\nimport { Plugin, PendingActions } from '@ckeditor/ckeditor5-core';\nimport { CKEditorError, Collection, ObservableMixin, logWarning, uid } from '@ckeditor/ckeditor5-utils';\nimport { FileReader } from './filereader.js';\n/**\n * File repository plugin. A central point for managing file upload.\n *\n * To use it, first you need an upload adapter. Upload adapter's job is to handle communication with the server\n * (sending the file and handling server's response). You can use one of the existing plugins introducing upload adapters\n * (e.g. {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter} or\n * {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter}) or write your own one – see\n * the {@glink framework/deep-dive/upload-adapter Custom image upload adapter deep-dive} guide.\n *\n * Then, you can use {@link module:upload/filerepository~FileRepository#createLoader `createLoader()`} and the returned\n * {@link module:upload/filerepository~FileLoader} instance to load and upload files.\n */\nexport class FileRepository extends Plugin {\n    /**\n     * Collection of loaders associated with this repository.\n     */\n    loaders = new Collection();\n    /**\n     * Loaders mappings used to retrieve loaders references.\n     */\n    _loadersMap = new Map();\n    /**\n     * Reference to a pending action registered in a {@link module:core/pendingactions~PendingActions} plugin\n     * while upload is in progress. When there is no upload then value is `null`.\n     */\n    _pendingAction = null;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FileRepository';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [PendingActions];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        // Keeps upload in a sync with pending actions.\n        this.loaders.on('change', () => this._updatePendingAction());\n        this.set('uploaded', 0);\n        this.set('uploadTotal', null);\n        this.bind('uploadedPercent').to(this, 'uploaded', this, 'uploadTotal', (uploaded, total) => {\n            return total ? (uploaded / total * 100) : 0;\n        });\n    }\n    /**\n     * Returns the loader associated with specified file or promise.\n     *\n     * To get loader by id use `fileRepository.loaders.get( id )`.\n     *\n     * @param fileOrPromise Native file or promise handle.\n     */\n    getLoader(fileOrPromise) {\n        return this._loadersMap.get(fileOrPromise) || null;\n    }\n    /**\n     * Creates a loader instance for the given file.\n     *\n     * Requires {@link #createUploadAdapter} factory to be defined.\n     *\n     * @param fileOrPromise Native File object or native Promise object which resolves to a File.\n     */\n    createLoader(fileOrPromise) {\n        if (!this.createUploadAdapter) {\n            /**\n             * You need to enable an upload adapter in order to be able to upload files.\n             *\n             * This warning shows up when {@link module:upload/filerepository~FileRepository} is being used\n             * without {@link module:upload/filerepository~FileRepository#createUploadAdapter defining an upload adapter}.\n             *\n             * **If you see this warning when using one of the now deprecated\n             * {@glink getting-started/legacy/installation-methods/predefined-builds CKEditor 5 Builds}**\n             * it means that you did not configure any of the upload adapters available by default in those builds.\n             *\n             * Predefined builds are a deprecated solution and we strongly advise\n             * {@glink updating/nim-migration/migration-to-new-installation-methods migrating to new installation methods}.\n             *\n             * See the {@glink features/images/image-upload/image-upload comprehensive \"Image upload overview\"} to learn which upload\n             * adapters are available in the builds and how to configure them.\n             *\n             * Otherwise, if you see this warning, there is a chance that you enabled\n             * a feature like {@link module:image/imageupload~ImageUpload},\n             * or {@link module:image/imageupload/imageuploadui~ImageUploadUI} but you did not enable any upload adapter.\n             * You can choose one of the existing upload adapters listed in the\n             * {@glink features/images/image-upload/image-upload \"Image upload overview\"}.\n             *\n             * You can also implement your {@glink framework/deep-dive/upload-adapter own image upload adapter}.\n             *\n             * @error filerepository-no-upload-adapter\n             */\n            logWarning('filerepository-no-upload-adapter');\n            return null;\n        }\n        const loader = new FileLoader(Promise.resolve(fileOrPromise), this.createUploadAdapter);\n        this.loaders.add(loader);\n        this._loadersMap.set(fileOrPromise, loader);\n        // Store also file => loader mapping so loader can be retrieved by file instance returned upon Promise resolution.\n        if (fileOrPromise instanceof Promise) {\n            loader.file\n                .then(file => {\n                this._loadersMap.set(file, loader);\n            })\n                // Every then() must have a catch().\n                // File loader state (and rejections) are handled in read() and upload().\n                // Also, see the \"does not swallow the file promise rejection\" test.\n                .catch(() => { });\n        }\n        loader.on('change:uploaded', () => {\n            let aggregatedUploaded = 0;\n            for (const loader of this.loaders) {\n                aggregatedUploaded += loader.uploaded;\n            }\n            this.uploaded = aggregatedUploaded;\n        });\n        loader.on('change:uploadTotal', () => {\n            let aggregatedTotal = 0;\n            for (const loader of this.loaders) {\n                if (loader.uploadTotal) {\n                    aggregatedTotal += loader.uploadTotal;\n                }\n            }\n            this.uploadTotal = aggregatedTotal;\n        });\n        return loader;\n    }\n    /**\n     * Destroys the given loader.\n     *\n     * @param fileOrPromiseOrLoader File or Promise associated with that loader or loader itself.\n     */\n    destroyLoader(fileOrPromiseOrLoader) {\n        const loader = fileOrPromiseOrLoader instanceof FileLoader ? fileOrPromiseOrLoader : this.getLoader(fileOrPromiseOrLoader);\n        loader._destroy();\n        this.loaders.remove(loader);\n        this._loadersMap.forEach((value, key) => {\n            if (value === loader) {\n                this._loadersMap.delete(key);\n            }\n        });\n    }\n    /**\n     * Registers or deregisters pending action bound with upload progress.\n     */\n    _updatePendingAction() {\n        const pendingActions = this.editor.plugins.get(PendingActions);\n        if (this.loaders.length) {\n            if (!this._pendingAction) {\n                const t = this.editor.t;\n                const getMessage = (value) => `${t('Upload in progress')} ${parseInt(value)}%.`;\n                this._pendingAction = pendingActions.add(getMessage(this.uploadedPercent));\n                this._pendingAction.bind('message').to(this, 'uploadedPercent', getMessage);\n            }\n        }\n        else {\n            pendingActions.remove(this._pendingAction);\n            this._pendingAction = null;\n        }\n    }\n}\n/**\n * File loader class.\n *\n * It is used to control the process of reading the file and uploading it using the specified upload adapter.\n */\nclass FileLoader extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Unique id of FileLoader instance.\n     *\n     * @readonly\n     */\n    id;\n    /**\n     * Additional wrapper over the initial file promise passed to this loader.\n     */\n    _filePromiseWrapper;\n    /**\n     * Adapter instance associated with this file loader.\n     */\n    _adapter;\n    /**\n     * FileReader used by FileLoader.\n     */\n    _reader;\n    /**\n     * Creates a new instance of `FileLoader`.\n     *\n     * @param filePromise A promise which resolves to a file instance.\n     * @param uploadAdapterCreator The function which returns {@link module:upload/filerepository~UploadAdapter} instance.\n     */\n    constructor(filePromise, uploadAdapterCreator) {\n        super();\n        this.id = uid();\n        this._filePromiseWrapper = this._createFilePromiseWrapper(filePromise);\n        this._adapter = uploadAdapterCreator(this);\n        this._reader = new FileReader();\n        this.set('status', 'idle');\n        this.set('uploaded', 0);\n        this.set('uploadTotal', null);\n        this.bind('uploadedPercent').to(this, 'uploaded', this, 'uploadTotal', (uploaded, total) => {\n            return total ? (uploaded / total * 100) : 0;\n        });\n        this.set('uploadResponse', null);\n    }\n    /**\n     * A `Promise` which resolves to a `File` instance associated with this file loader.\n     */\n    get file() {\n        if (!this._filePromiseWrapper) {\n            // Loader was destroyed, return promise which resolves to null.\n            return Promise.resolve(null);\n        }\n        else {\n            // The `this._filePromiseWrapper.promise` is chained and not simply returned to handle a case when:\n            //\n            //\t\t* The `loader.file.then( ... )` is called by external code (returned promise is pending).\n            //\t\t* Then `loader._destroy()` is called (call is synchronous) which destroys the `loader`.\n            //\t\t* Promise returned by the first `loader.file.then( ... )` call is resolved.\n            //\n            // Returning `this._filePromiseWrapper.promise` will still resolve to a `File` instance so there\n            // is an additional check needed in the chain to see if `loader` was destroyed in the meantime.\n            return this._filePromiseWrapper.promise.then(file => this._filePromiseWrapper ? file : null);\n        }\n    }\n    /**\n     * Returns the file data. To read its data, you need for first load the file\n     * by using the {@link module:upload/filerepository~FileLoader#read `read()`} method.\n     */\n    get data() {\n        return this._reader.data;\n    }\n    /**\n     * Reads file using {@link module:upload/filereader~FileReader}.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `filerepository-read-wrong-status` when status\n     * is different than `idle`.\n     *\n     * Example usage:\n     *\n     * ```ts\n     * fileLoader.read()\n     * \t.then( data => { ... } )\n     * \t.catch( err => {\n     * \t\tif ( err === 'aborted' ) {\n     * \t\t\tconsole.log( 'Reading aborted.' );\n     * \t\t} else {\n     * \t\t\tconsole.log( 'Reading error.', err );\n     * \t\t}\n     * \t} );\n     * ```\n     *\n     * @returns Returns promise that will be resolved with read data. Promise will be rejected if error\n     * occurs or if read process is aborted.\n     */\n    read() {\n        if (this.status != 'idle') {\n            /**\n             * You cannot call read if the status is different than idle.\n             *\n             * @error filerepository-read-wrong-status\n             */\n            throw new CKEditorError('filerepository-read-wrong-status', this);\n        }\n        this.status = 'reading';\n        return this.file\n            .then(file => this._reader.read(file))\n            .then(data => {\n            // Edge case: reader was aborted after file was read - double check for proper status.\n            // It can happen when image was deleted during its upload.\n            if (this.status !== 'reading') {\n                throw this.status;\n            }\n            this.status = 'idle';\n            return data;\n        })\n            .catch(err => {\n            if (err === 'aborted') {\n                this.status = 'aborted';\n                throw 'aborted';\n            }\n            this.status = 'error';\n            throw this._reader.error ? this._reader.error : err;\n        });\n    }\n    /**\n     * Reads file using the provided {@link module:upload/filerepository~UploadAdapter}.\n     *\n     * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `filerepository-upload-wrong-status` when status\n     * is different than `idle`.\n     * Example usage:\n     *\n     * ```ts\n     * fileLoader.upload()\n     * \t.then( data => { ... } )\n     * \t.catch( e => {\n     * \t\tif ( e === 'aborted' ) {\n     * \t\t\tconsole.log( 'Uploading aborted.' );\n     * \t\t} else {\n     * \t\t\tconsole.log( 'Uploading error.', e );\n     * \t\t}\n     * \t} );\n     * ```\n     *\n     * @returns Returns promise that will be resolved with response data. Promise will be rejected if error\n     * occurs or if read process is aborted.\n     */\n    upload() {\n        if (this.status != 'idle') {\n            /**\n             * You cannot call upload if the status is different than idle.\n             *\n             * @error filerepository-upload-wrong-status\n             */\n            throw new CKEditorError('filerepository-upload-wrong-status', this);\n        }\n        this.status = 'uploading';\n        return this.file\n            .then(() => this._adapter.upload())\n            .then(data => {\n            this.uploadResponse = data;\n            this.status = 'idle';\n            return data;\n        })\n            .catch(err => {\n            if (this.status === 'aborted') {\n                throw 'aborted';\n            }\n            this.status = 'error';\n            throw err;\n        });\n    }\n    /**\n     * Aborts loading process.\n     */\n    abort() {\n        const status = this.status;\n        this.status = 'aborted';\n        if (!this._filePromiseWrapper.isFulfilled) {\n            // Edge case: file loader is aborted before read() is called\n            // so it might happen that no one handled the rejection of this promise.\n            // See https://github.com/ckeditor/ckeditor5-upload/pull/100\n            this._filePromiseWrapper.promise.catch(() => { });\n            this._filePromiseWrapper.rejecter('aborted');\n        }\n        else if (status == 'reading') {\n            this._reader.abort();\n        }\n        else if (status == 'uploading' && this._adapter.abort) {\n            this._adapter.abort();\n        }\n        this._destroy();\n    }\n    /**\n     * Performs cleanup.\n     *\n     * @internal\n     */\n    _destroy() {\n        this._filePromiseWrapper = undefined;\n        this._reader = undefined;\n        this._adapter = undefined;\n        this.uploadResponse = undefined;\n    }\n    /**\n     * Wraps a given file promise into another promise giving additional\n     * control (resolving, rejecting, checking if fulfilled) over it.\n     *\n     * @param filePromise The initial file promise to be wrapped.\n     */\n    _createFilePromiseWrapper(filePromise) {\n        const wrapper = {};\n        wrapper.promise = new Promise((resolve, reject) => {\n            wrapper.rejecter = reject;\n            wrapper.isFulfilled = false;\n            filePromise\n                .then(file => {\n                wrapper.isFulfilled = true;\n                resolve(file);\n            })\n                .catch(err => {\n                wrapper.isFulfilled = true;\n                reject(err);\n            });\n        });\n        return wrapper;\n    }\n}\nexport { FileLoader };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module upload/adapters/simpleuploadadapter\n */\nimport { Plugin } from '@ckeditor/ckeditor5-core';\nimport { FileRepository } from '../filerepository.js';\nimport { logWarning } from '@ckeditor/ckeditor5-utils';\n/**\n * The Simple upload adapter allows uploading images to an application running on your server using\n * the [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) API with a\n * minimal {@link module:upload/uploadconfig~SimpleUploadConfig editor configuration}.\n *\n * ```ts\n * ClassicEditor\n * \t.create( document.querySelector( '#editor' ), {\n * \t\tsimpleUpload: {\n * \t\t\tuploadUrl: 'http://example.com',\n * \t\t\theaders: {\n * \t\t\t\t...\n * \t\t\t}\n * \t\t}\n * \t} )\n * \t.then( ... )\n * \t.catch( ... );\n * ```\n *\n * See the {@glink features/images/image-upload/simple-upload-adapter \"Simple upload adapter\"} guide to learn how to\n * learn more about the feature (configuration, server–side requirements, etc.).\n *\n * Check out the {@glink features/images/image-upload/image-upload comprehensive \"Image upload overview\"} to learn about\n * other ways to upload images into CKEditor 5.\n */\nexport class SimpleUploadAdapter extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FileRepository];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SimpleUploadAdapter';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'SUA';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const options = this.editor.config.get('simpleUpload');\n        if (!options) {\n            return;\n        }\n        if (!options.uploadUrl) {\n            /**\n             * The {@link module:upload/uploadconfig~SimpleUploadConfig#uploadUrl `config.simpleUpload.uploadUrl`}\n             * configuration required by the {@link module:upload/adapters/simpleuploadadapter~SimpleUploadAdapter `SimpleUploadAdapter`}\n             * is missing. Make sure the correct URL is specified for the image upload to work properly.\n             *\n             * @error simple-upload-adapter-missing-uploadurl\n             */\n            logWarning('simple-upload-adapter-missing-uploadurl');\n            return;\n        }\n        this.editor.plugins.get(FileRepository).createUploadAdapter = loader => {\n            return new Adapter(loader, options);\n        };\n    }\n}\n/**\n * Upload adapter.\n */\nclass Adapter {\n    /**\n     * FileLoader instance to use during the upload.\n     */\n    loader;\n    /**\n     * The configuration of the adapter.\n     */\n    options;\n    xhr;\n    /**\n     * Creates a new adapter instance.\n     */\n    constructor(loader, options) {\n        this.loader = loader;\n        this.options = options;\n    }\n    /**\n     * Starts the upload process.\n     *\n     * @see module:upload/filerepository~UploadAdapter#upload\n     */\n    upload() {\n        return this.loader.file\n            .then(file => new Promise((resolve, reject) => {\n            this._initRequest();\n            this._initListeners(resolve, reject, file);\n            this._sendRequest(file);\n        }));\n    }\n    /**\n     * Aborts the upload process.\n     *\n     * @see module:upload/filerepository~UploadAdapter#abort\n     */\n    abort() {\n        if (this.xhr) {\n            this.xhr.abort();\n        }\n    }\n    /**\n     * Initializes the `XMLHttpRequest` object using the URL specified as\n     * {@link module:upload/uploadconfig~SimpleUploadConfig#uploadUrl `simpleUpload.uploadUrl`} in the editor's\n     * configuration.\n     */\n    _initRequest() {\n        const xhr = this.xhr = new XMLHttpRequest();\n        xhr.open('POST', this.options.uploadUrl, true);\n        xhr.responseType = 'json';\n    }\n    /**\n     * Initializes XMLHttpRequest listeners\n     *\n     * @param resolve Callback function to be called when the request is successful.\n     * @param reject Callback function to be called when the request cannot be completed.\n     * @param file Native File object.\n     */\n    _initListeners(resolve, reject, file) {\n        const xhr = this.xhr;\n        const loader = this.loader;\n        const genericErrorText = `Couldn't upload file: ${file.name}.`;\n        xhr.addEventListener('error', () => reject(genericErrorText));\n        xhr.addEventListener('abort', () => reject());\n        xhr.addEventListener('load', () => {\n            const response = xhr.response;\n            if (!response || response.error) {\n                return reject(response && response.error && response.error.message ? response.error.message : genericErrorText);\n            }\n            const urls = response.url ? { default: response.url } : response.urls;\n            // Resolve with the normalized `urls` property and pass the rest of the response\n            // to allow customizing the behavior of features relying on the upload adapters.\n            resolve({\n                ...response,\n                urls\n            });\n        });\n        // Upload progress when it is supported.\n        /* istanbul ignore else -- @preserve */\n        if (xhr.upload) {\n            xhr.upload.addEventListener('progress', evt => {\n                if (evt.lengthComputable) {\n                    loader.uploadTotal = evt.total;\n                    loader.uploaded = evt.loaded;\n                }\n            });\n        }\n    }\n    /**\n     * Prepares the data and sends the request.\n     *\n     * @param file File instance to be uploaded.\n     */\n    _sendRequest(file) {\n        // Set headers if specified.\n        let headers = this.options.headers || {};\n        if (typeof headers === 'function') {\n            headers = headers(file);\n        }\n        // Use the withCredentials flag if specified.\n        const withCredentials = this.options.withCredentials || false;\n        for (const headerName of Object.keys(headers)) {\n            this.xhr.setRequestHeader(headerName, headers[headerName]);\n        }\n        this.xhr.withCredentials = withCredentials;\n        // Prepare the form data.\n        const data = new FormData();\n        data.append('upload', file);\n        // Send the request.\n        this.xhr.send(data);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module adapter-ckfinder/utils\n */\nconst TOKEN_COOKIE_NAME = 'ckCsrfToken';\nconst TOKEN_LENGTH = 40;\nconst tokenCharset = 'abcdefghijklmnopqrstuvwxyz0123456789';\n/**\n * Returns the CSRF token value. The value is a hash stored in `document.cookie`\n * under the `ckCsrfToken` key. The CSRF token can be used to secure the communication\n * between the web browser and the CKFinder server.\n *\n * @internal\n */\nexport function getCsrfToken() {\n    let token = getCookie(TOKEN_COOKIE_NAME);\n    if (!token || token.length != TOKEN_LENGTH) {\n        token = generateToken(TOKEN_LENGTH);\n        setCookie(TOKEN_COOKIE_NAME, token);\n    }\n    return token;\n}\n/**\n * Returns the value of the cookie with a given name or `null` if the cookie is not found.\n *\n * @internal\n */\nexport function getCookie(name) {\n    name = name.toLowerCase();\n    const parts = document.cookie.split(';');\n    for (const part of parts) {\n        const pair = part.split('=');\n        const key = decodeURIComponent(pair[0].trim().toLowerCase());\n        if (key === name) {\n            return decodeURIComponent(pair[1]);\n        }\n    }\n    return null;\n}\n/**\n * Sets the value of the cookie with a given name.\n *\n * @internal\n */\nexport function setCookie(name, value) {\n    document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';path=/';\n}\n/**\n * Generates the CSRF token with the given length.\n */\nfunction generateToken(length) {\n    let result = '';\n    const randValues = new Uint8Array(length);\n    window.crypto.getRandomValues(randValues);\n    for (let j = 0; j < randValues.length; j++) {\n        const character = tokenCharset.charAt(randValues[j] % tokenCharset.length);\n        result += Math.random() > 0.5 ? character.toUpperCase() : character;\n    }\n    return result;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module adapter-ckfinder/uploadadapter\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FileRepository } from 'ckeditor5/src/upload.js';\nimport { getCsrfToken } from './utils.js';\n/**\n * A plugin that enables file uploads in CKEditor 5 using the CKFinder server–side connector.\n *\n * See the {@glink features/file-management/ckfinder \"CKFinder file manager integration\"} guide to learn how to configure\n * and use this feature as well as find out more about the full integration with the file manager\n * provided by the {@link module:ckfinder/ckfinder~CKFinder} plugin.\n *\n * Check out the {@glink features/images/image-upload/image-upload comprehensive \"Image upload overview\"} guide to learn\n * about other ways to upload images into CKEditor 5.\n */\nexport class CKFinderUploadAdapter extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FileRepository];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CKFinderUploadAdapter';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const url = this.editor.config.get('ckfinder.uploadUrl');\n        if (!url) {\n            return;\n        }\n        // Register CKFinderAdapter\n        this.editor.plugins.get(FileRepository).createUploadAdapter = loader => new UploadAdapter(loader, url, this.editor.t);\n    }\n}\n/**\n * Upload adapter for CKFinder.\n */\nclass UploadAdapter {\n    /**\n     * FileLoader instance to use during the upload.\n     */\n    loader;\n    /**\n     * Upload URL.\n     */\n    url;\n    /**\n     * Locale translation method.\n     */\n    t;\n    xhr;\n    /**\n     * Creates a new adapter instance.\n     */\n    constructor(loader, url, t) {\n        this.loader = loader;\n        this.url = url;\n        this.t = t;\n    }\n    /**\n     * Starts the upload process.\n     *\n     * @see module:upload/filerepository~UploadAdapter#upload\n     */\n    upload() {\n        return this.loader.file.then(file => {\n            return new Promise((resolve, reject) => {\n                this._initRequest();\n                this._initListeners(resolve, reject, file);\n                this._sendRequest(file);\n            });\n        });\n    }\n    /**\n     * Aborts the upload process.\n     *\n     * @see module:upload/filerepository~UploadAdapter#abort\n     */\n    abort() {\n        if (this.xhr) {\n            this.xhr.abort();\n        }\n    }\n    /**\n     * Initializes the XMLHttpRequest object.\n     */\n    _initRequest() {\n        const xhr = this.xhr = new XMLHttpRequest();\n        xhr.open('POST', this.url, true);\n        xhr.responseType = 'json';\n    }\n    /**\n     * Initializes XMLHttpRequest listeners.\n     *\n     * @param resolve Callback function to be called when the request is successful.\n     * @param reject Callback function to be called when the request cannot be completed.\n     * @param file File instance to be uploaded.\n     */\n    _initListeners(resolve, reject, file) {\n        const xhr = this.xhr;\n        const loader = this.loader;\n        const t = this.t;\n        const genericError = t('Cannot upload file:') + ` ${file.name}.`;\n        xhr.addEventListener('error', () => reject(genericError));\n        xhr.addEventListener('abort', () => reject());\n        xhr.addEventListener('load', () => {\n            const response = xhr.response;\n            if (!response || !response.uploaded) {\n                return reject(response && response.error && response.error.message ? response.error.message : genericError);\n            }\n            resolve({\n                default: response.url\n            });\n        });\n        // Upload progress when it's supported.\n        /* istanbul ignore else -- @preserve */\n        if (xhr.upload) {\n            xhr.upload.addEventListener('progress', evt => {\n                if (evt.lengthComputable) {\n                    loader.uploadTotal = evt.total;\n                    loader.uploaded = evt.loaded;\n                }\n            });\n        }\n    }\n    /**\n     * Prepares the data and sends the request.\n     *\n     * @param file File instance to be uploaded.\n     */\n    _sendRequest(file) {\n        // Prepare form data.\n        const data = new FormData();\n        data.append('upload', file);\n        data.append('ckCsrfToken', getCsrfToken());\n        // Send request.\n        this.xhr.send(data);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ModelLiveRange, ModelSchemaContext } from 'ckeditor5/src/engine.js';\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * The block autoformatting engine. It allows to format various block patterns. For example,\n * it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.\n *\n * The autoformatting operation is integrated with the undo manager,\n * so the autoformatting step can be undone if the user's intention was not to format the text.\n *\n * See the {@link module:autoformat/blockautoformatediting~blockAutoformatEditing `blockAutoformatEditing`} documentation\n * to learn how to create custom block autoformatters. You can also use\n * the {@link module:autoformat/autoformat~Autoformat} feature which enables a set of default autoformatters\n * (lists, headings, bold and italic).\n *\n * @module autoformat/blockautoformatediting\n */\n/**\n * Creates a listener triggered on {@link module:engine/model/document~ModelDocument#event:change:data `change:data`} event in the document.\n * Calls the callback when inserted text matches the regular expression or the command name\n * if provided instead of the callback.\n *\n * Examples of usage:\n *\n * To convert a paragraph into heading 1 when `- ` is typed, using just the command name:\n *\n * ```ts\n * blockAutoformatEditing( editor, plugin, /^\\- $/, 'heading1' );\n * ```\n *\n * To convert a paragraph into heading 1 when `- ` is typed, using just the callback:\n *\n * ```ts\n * blockAutoformatEditing( editor, plugin, /^\\- $/, ( context ) => {\n * \tconst { match } = context;\n * \tconst headingLevel = match[ 1 ].length;\n *\n * \teditor.execute( 'heading', {\n * \t\tformatId: `heading${ headingLevel }`\n * \t} );\n * } );\n * ```\n *\n * @param editor The editor instance.\n * @param plugin The autoformat plugin instance.\n * @param pattern The regular expression to execute on just inserted text. The regular expression is tested against the text\n * from the beginning until the caret position.\n * @param callbackOrCommand The callback to execute or the command to run when the text is matched.\n * In case of providing the callback, it receives the following parameter:\n * * match RegExp.exec() result of matching the pattern to inserted text.\n */\nexport function blockAutoformatEditing(editor, plugin, pattern, callbackOrCommand) {\n    let callback;\n    let command = null;\n    if (typeof callbackOrCommand == 'function') {\n        callback = callbackOrCommand;\n    }\n    else {\n        // We assume that the actual command name was provided.\n        command = editor.commands.get(callbackOrCommand);\n        callback = () => {\n            editor.execute(callbackOrCommand);\n        };\n    }\n    editor.model.document.on('change:data', (evt, batch) => {\n        if (command && !command.isEnabled || !plugin.isEnabled) {\n            return;\n        }\n        const range = first(editor.model.document.selection.getRanges());\n        if (!range.isCollapsed) {\n            return;\n        }\n        if (batch.isUndo || !batch.isLocal) {\n            return;\n        }\n        const changes = Array.from(editor.model.document.differ.getChanges());\n        const entry = changes[0];\n        // Typing is represented by only a single change.\n        if (changes.length != 1 || entry.type !== 'insert' || entry.name != '$text' || entry.length != 1) {\n            return;\n        }\n        const blockToFormat = entry.position.parent;\n        // Block formatting should be disabled in codeBlocks (#5800).\n        if (blockToFormat.is('element', 'codeBlock')) {\n            return;\n        }\n        // Only list commands and custom callbacks can be applied inside a list.\n        if (blockToFormat.is('element', 'listItem') &&\n            typeof callbackOrCommand !== 'function' &&\n            !['numberedList', 'bulletedList', 'todoList'].includes(callbackOrCommand)) {\n            return;\n        }\n        // In case a command is bound, do not re-execute it over an existing block style which would result in a style removal.\n        // Instead, just drop processing so that autoformat trigger text is not lost. E.g. writing \"# \" in a level 1 heading.\n        if (command && command.value === true) {\n            return;\n        }\n        const firstNode = blockToFormat.getChild(0);\n        const firstNodeRange = editor.model.createRangeOn(firstNode);\n        // Range is only expected to be within or at the very end of the first text node.\n        if (!firstNodeRange.containsRange(range) && !range.end.isEqual(firstNodeRange.end)) {\n            return;\n        }\n        const match = pattern.exec(firstNode.data.substr(0, range.end.offset));\n        // ...and this text node's data match the pattern.\n        if (!match) {\n            return;\n        }\n        // Use enqueueChange to create new batch to separate typing batch from the auto-format changes.\n        editor.model.enqueueChange(writer => {\n            const selection = editor.model.document.selection;\n            // Matched range.\n            const start = writer.createPositionAt(blockToFormat, 0);\n            const end = writer.createPositionAt(blockToFormat, match[0].length);\n            const range = new ModelLiveRange(start, end);\n            const wasChanged = callback({ match });\n            // Remove matched text.\n            if (wasChanged !== false) {\n                // Store selection attributes to restore them after matched text removed.\n                const selectionAttributes = Array.from(selection.getAttributes());\n                writer.remove(range);\n                const selectionRange = selection.getFirstRange();\n                const blockRange = writer.createRangeIn(blockToFormat);\n                // If the block is empty and the document selection has been moved when\n                // applying formatting (e.g. is now in newly created block).\n                if (blockToFormat.isEmpty && !blockRange.isEqual(selectionRange) && !blockRange.containsRange(selectionRange, true)) {\n                    writer.remove(blockToFormat);\n                }\n                // Restore selection attributes.\n                restoreSelectionAttributes(writer, selection, selectionAttributes);\n            }\n            range.detach();\n            editor.model.enqueueChange(() => {\n                const deletePlugin = editor.plugins.get('Delete');\n                deletePlugin.requestUndoOnBackspace();\n            });\n        });\n    });\n}\n/**\n * Restore allowed selection attributes.\n */\nfunction restoreSelectionAttributes(writer, selection, selectionAttributes) {\n    const schema = writer.model.schema;\n    const selectionPosition = selection.getFirstPosition();\n    let selectionSchemaContext = new ModelSchemaContext(selectionPosition);\n    if (schema.checkChild(selectionSchemaContext, '$text')) {\n        selectionSchemaContext = selectionSchemaContext.push('$text');\n    }\n    for (const [attributeName, attributeValue] of selectionAttributes) {\n        if (schema.checkAttribute(selectionSchemaContext, attributeName)) {\n            writer.setSelectionAttribute(attributeName, attributeValue);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Enables autoformatting mechanism for a given {@link module:core/editor/editor~Editor}.\n *\n * It formats the matched text by applying the given model attribute or by running the provided formatting callback.\n * On every {@link module:engine/model/document~ModelDocument#event:change:data data change} in the model document\n * the autoformatting engine checks the text on the left of the selection\n * and executes the provided action if the text matches given criteria (regular expression or callback).\n *\n * @param editor The editor instance.\n * @param plugin The autoformat plugin instance.\n * @param testRegexpOrCallback The regular expression or callback to execute on text.\n * Provided regular expression *must* have three capture groups. The first and the third capture group\n * should match opening and closing delimiters. The second capture group should match the text to format.\n *\n * ```ts\n * // Matches the `**bold text**` pattern.\n * // There are three capturing groups:\n * // - The first to match the starting `**` delimiter.\n * // - The second to match the text to format.\n * // - The third to match the ending `**` delimiter.\n * inlineAutoformatEditing( editor, plugin, /(\\*\\*)([^\\*]+?)(\\*\\*)$/g, formatCallback );\n * ```\n *\n * When a function is provided instead of the regular expression, it will be executed with the text to match as a parameter.\n * The function should return proper \"ranges\" to delete and format.\n *\n * ```ts\n * {\n * \tremove: [\n * \t\t[ 0, 1 ],\t// Remove the first letter from the given text.\n * \t\t[ 5, 6 ]\t// Remove the 6th letter from the given text.\n * \t],\n * \tformat: [\n * \t\t[ 1, 5 ]\t// Format all letters from 2nd to 5th.\n * \t]\n * }\n * ```\n *\n * @param formatCallback A callback to apply actual formatting.\n * It should return `false` if changes should not be applied (e.g. if a command is disabled).\n *\n * ```ts\n * inlineAutoformatEditing( editor, plugin, /(\\*\\*)([^\\*]+?)(\\*\\*)$/g, ( writer, rangesToFormat ) => {\n * \tconst command = editor.commands.get( 'bold' );\n *\n * \tif ( !command.isEnabled ) {\n * \t\treturn false;\n * \t}\n *\n * \tconst validRanges = editor.model.schema.getValidRanges( rangesToFormat, 'bold' );\n *\n * \tfor ( let range of validRanges ) {\n * \t\twriter.setAttribute( 'bold', true, range );\n * \t}\n * } );\n * ```\n */\nexport function inlineAutoformatEditing(editor, plugin, testRegexpOrCallback, formatCallback) {\n    let regExp;\n    let testCallback;\n    if (testRegexpOrCallback instanceof RegExp) {\n        regExp = testRegexpOrCallback;\n    }\n    else {\n        testCallback = testRegexpOrCallback;\n    }\n    // A test callback run on changed text.\n    testCallback = testCallback || (text => {\n        let result;\n        const remove = [];\n        const format = [];\n        while ((result = regExp.exec(text)) !== null) {\n            // There should be full match and 3 capture groups.\n            if (result && result.length < 4) {\n                break;\n            }\n            let { index, '1': leftDel, '2': content, '3': rightDel } = result;\n            // Real matched string - there might be some non-capturing groups so we need to recalculate starting index.\n            const found = leftDel + content + rightDel;\n            index += result[0].length - found.length;\n            // Start and End offsets of delimiters to remove.\n            const delStart = [\n                index,\n                index + leftDel.length\n            ];\n            const delEnd = [\n                index + leftDel.length + content.length,\n                index + leftDel.length + content.length + rightDel.length\n            ];\n            remove.push(delStart);\n            remove.push(delEnd);\n            format.push([index + leftDel.length, index + leftDel.length + content.length]);\n        }\n        return {\n            remove,\n            format\n        };\n    });\n    editor.model.document.on('change:data', (evt, batch) => {\n        if (batch.isUndo || !batch.isLocal || !plugin.isEnabled) {\n            return;\n        }\n        const model = editor.model;\n        const selection = model.document.selection;\n        // Do nothing if selection is not collapsed.\n        if (!selection.isCollapsed) {\n            return;\n        }\n        const changes = Array.from(model.document.differ.getChanges());\n        const entry = changes[0];\n        // Typing is represented by only a single change.\n        if (changes.length != 1 || entry.type !== 'insert' || entry.name != '$text' || entry.length != 1) {\n            return;\n        }\n        const focus = selection.focus;\n        const block = focus.parent;\n        const { text, range } = getTextAfterCode(model.createRange(model.createPositionAt(block, 0), focus), model);\n        const testOutput = testCallback(text);\n        const rangesToFormat = testOutputToRanges(range.start, testOutput.format, model);\n        const rangesToRemove = testOutputToRanges(range.start, testOutput.remove, model);\n        if (!(rangesToFormat.length && rangesToRemove.length)) {\n            return;\n        }\n        // Use enqueueChange to create new batch to separate typing batch from the auto-format changes.\n        model.enqueueChange(writer => {\n            // Apply format.\n            const hasChanged = formatCallback(writer, rangesToFormat);\n            // Strict check on `false` to have backward compatibility (when callbacks were returning `undefined`).\n            if (hasChanged === false) {\n                return;\n            }\n            // Remove delimiters - use reversed order to not mix the offsets while removing.\n            for (const range of rangesToRemove.reverse()) {\n                writer.remove(range);\n            }\n            model.enqueueChange(() => {\n                const deletePlugin = editor.plugins.get('Delete');\n                deletePlugin.requestUndoOnBackspace();\n            });\n        });\n    });\n}\n/**\n * Converts output of the test function provided to the inlineAutoformatEditing and converts it to the model ranges\n * inside provided block.\n */\nfunction testOutputToRanges(start, arrays, model) {\n    return arrays\n        .filter(array => (array[0] !== undefined && array[1] !== undefined))\n        .map(array => {\n        return model.createRange(start.getShiftedBy(array[0]), start.getShiftedBy(array[1]));\n    });\n}\n/**\n * Returns the last text line after the last code element from the given range.\n * It is similar to {@link module:typing/utils/getlasttextline.getLastTextLine `getLastTextLine()`},\n * but it ignores any text before the last `code`.\n */\nfunction getTextAfterCode(range, model) {\n    let start = range.start;\n    const text = Array.from(range.getItems()).reduce((rangeText, node) => {\n        // Trim text to a last occurrence of an inline element and update range start.\n        if (!(node.is('$text') || node.is('$textProxy')) || node.getAttribute('code')) {\n            start = model.createPositionAfter(node);\n            return '';\n        }\n        return rangeText + node.data;\n    }, '');\n    return { text, range: model.createRange(start, range.end) };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Delete } from 'ckeditor5/src/typing.js';\nimport { blockAutoformatEditing } from './blockautoformatediting.js';\nimport { inlineAutoformatEditing } from './inlineautoformatediting.js';\n/**\n * Enables a set of predefined autoformatting actions.\n *\n * For a detailed overview, check the {@glink features/autoformat Autoformatting} feature guide\n * and the {@glink api/autoformat package page}.\n */\nexport class Autoformat extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Delete];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Autoformat';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        this._addListAutoformats();\n        this._addBasicStylesAutoformats();\n        this._addHeadingAutoformats();\n        this._addBlockQuoteAutoformats();\n        this._addCodeBlockAutoformats();\n        this._addHorizontalLineAutoformats();\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Revert autoformatting action'),\n                    keystroke: 'Backspace'\n                }\n            ]\n        });\n    }\n    /**\n     * Adds autoformatting related to the {@link module:list/list~List}.\n     *\n     * When typed:\n     * - `* ` or `- ` &ndash; A paragraph will be changed into a bulleted list.\n     * - `1. ` or `1) ` &ndash; A paragraph will be changed into a numbered list (\"1\" can be any digit or a list of digits).\n     * - `[] ` or `[ ] ` &ndash; A paragraph will be changed into a to-do list.\n     * - `[x] ` or `[ x ] ` &ndash; A paragraph will be changed into a checked to-do list.\n     */\n    _addListAutoformats() {\n        const commands = this.editor.commands;\n        if (commands.get('bulletedList')) {\n            blockAutoformatEditing(this.editor, this, /^[*-]\\s$/, 'bulletedList');\n        }\n        if (commands.get('numberedList')) {\n            blockAutoformatEditing(this.editor, this, /^1[.|)]\\s$/, 'numberedList');\n        }\n        if (commands.get('todoList')) {\n            blockAutoformatEditing(this.editor, this, /^\\[\\s?\\]\\s$/, 'todoList');\n        }\n        if (commands.get('checkTodoList')) {\n            blockAutoformatEditing(this.editor, this, /^\\[\\s?x\\s?\\]\\s$/, () => {\n                this.editor.execute('todoList');\n                this.editor.execute('checkTodoList');\n            });\n        }\n    }\n    /**\n     * Adds autoformatting related to the {@link module:basic-styles/bold~Bold},\n     * {@link module:basic-styles/italic~Italic}, {@link module:basic-styles/code~Code}\n     * and {@link module:basic-styles/strikethrough~Strikethrough}\n     *\n     * When typed:\n     * - `**foobar**` &ndash; `**` characters are removed and `foobar` is set to bold,\n     * - `__foobar__` &ndash; `__` characters are removed and `foobar` is set to bold,\n     * - `*foobar*` &ndash; `*` characters are removed and `foobar` is set to italic,\n     * - `_foobar_` &ndash; `_` characters are removed and `foobar` is set to italic,\n     * - ``` `foobar` &ndash; ``` ` ``` characters are removed and `foobar` is set to code,\n     * - `~~foobar~~` &ndash; `~~` characters are removed and `foobar` is set to strikethrough.\n     */\n    _addBasicStylesAutoformats() {\n        const commands = this.editor.commands;\n        if (commands.get('bold')) {\n            const boldCallback = getCallbackFunctionForInlineAutoformat(this.editor, 'bold');\n            inlineAutoformatEditing(this.editor, this, /(?:^|\\s)(\\*\\*)([^*]+)(\\*\\*)$/g, boldCallback);\n            inlineAutoformatEditing(this.editor, this, /(?:^|\\s)(__)([^_]+)(__)$/g, boldCallback);\n        }\n        if (commands.get('italic')) {\n            const italicCallback = getCallbackFunctionForInlineAutoformat(this.editor, 'italic');\n            // The italic autoformatter cannot be triggered by the bold markers, so we need to check the\n            // text before the pattern (e.g. `(?:^|[^\\*])`).\n            inlineAutoformatEditing(this.editor, this, /(?:^|\\s)(\\*)([^*_]+)(\\*)$/g, italicCallback);\n            inlineAutoformatEditing(this.editor, this, /(?:^|\\s)(_)([^_]+)(_)$/g, italicCallback);\n        }\n        if (commands.get('code')) {\n            const codeCallback = getCallbackFunctionForInlineAutoformat(this.editor, 'code');\n            inlineAutoformatEditing(this.editor, this, /(`)([^`]+)(`)$/g, codeCallback);\n        }\n        if (commands.get('strikethrough')) {\n            const strikethroughCallback = getCallbackFunctionForInlineAutoformat(this.editor, 'strikethrough');\n            inlineAutoformatEditing(this.editor, this, /(~~)([^~]+)(~~)$/g, strikethroughCallback);\n        }\n    }\n    /**\n     * Adds autoformatting related to {@link module:heading/heading~Heading}.\n     *\n     * It is using a number at the end of the command name to associate it with the proper trigger:\n     *\n     * * `heading` with a `heading1` value will be executed when typing `#`,\n     * * `heading` with a `heading2` value will be executed when typing `##`,\n     * * ... up to `heading6` for `######`.\n     */\n    _addHeadingAutoformats() {\n        const command = this.editor.commands.get('heading');\n        if (command) {\n            command.modelElements\n                .filter(name => name.match(/^heading[1-6]$/))\n                .forEach(modelName => {\n                const level = modelName[7];\n                const pattern = new RegExp(`^(#{${level}})\\\\s$`);\n                blockAutoformatEditing(this.editor, this, pattern, () => {\n                    // Should only be active if command is enabled and heading style associated with pattern is inactive.\n                    if (!command.isEnabled || command.value === modelName) {\n                        return false;\n                    }\n                    this.editor.execute('heading', { value: modelName });\n                });\n            });\n        }\n    }\n    /**\n     * Adds autoformatting related to {@link module:block-quote/blockquote~BlockQuote}.\n     *\n     * When typed:\n     * * `> ` &ndash; A paragraph will be changed to a block quote.\n     */\n    _addBlockQuoteAutoformats() {\n        if (this.editor.commands.get('blockQuote')) {\n            blockAutoformatEditing(this.editor, this, /^>\\s$/, 'blockQuote');\n        }\n    }\n    /**\n     * Adds autoformatting related to {@link module:code-block/codeblock~CodeBlock}.\n     *\n     * When typed:\n     * - `` ``` `` &ndash; A paragraph will be changed to a code block.\n     */\n    _addCodeBlockAutoformats() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        if (editor.commands.get('codeBlock')) {\n            blockAutoformatEditing(editor, this, /^```$/, () => {\n                if (selection.getFirstPosition().parent.is('element', 'listItem')) {\n                    return false;\n                }\n                this.editor.execute('codeBlock', {\n                    usePreviousLanguageChoice: true\n                });\n            });\n        }\n    }\n    /**\n     * Adds autoformatting related to {@link module:horizontal-line/horizontalline~HorizontalLine}.\n     *\n     * When typed:\n     * - `` --- `` &ndash; Will be replaced with a horizontal line.\n     */\n    _addHorizontalLineAutoformats() {\n        if (this.editor.commands.get('horizontalLine')) {\n            blockAutoformatEditing(this.editor, this, /^---$/, 'horizontalLine');\n        }\n    }\n}\n/**\n * Helper function for getting `inlineAutoformatEditing` callbacks that checks if command is enabled.\n */\nfunction getCallbackFunctionForInlineAutoformat(editor, attributeKey) {\n    return (writer, rangesToFormat) => {\n        const command = editor.commands.get(attributeKey);\n        if (!command.isEnabled) {\n            return false;\n        }\n        const validRanges = editor.model.schema.getValidRanges(rangesToFormat, attributeKey);\n        for (const range of validRanges) {\n            writer.setAttribute(attributeKey, true, range);\n        }\n        // After applying attribute to the text, remove given attribute from the selection.\n        // This way user is able to type a text without attribute used by auto formatter.\n        writer.removeSelectionAttribute(attributeKey);\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/attributecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * An extension of the base {@link module:core/command~Command} class, which provides utilities for a command\n * that toggles a single attribute on a text or an element.\n *\n * `AttributeCommand` uses {@link module:engine/model/document~ModelDocument#selection}\n * to decide which nodes (if any) should be changed, and applies or removes the attribute from them.\n *\n * The command checks the {@link module:engine/model/model~Model#schema} to decide if it can be enabled\n * for the current selection and to which nodes the attribute can be applied.\n */\nexport class AttributeCommand extends Command {\n    /**\n     * The attribute that will be set by the command.\n     */\n    attributeKey;\n    /**\n     * @param attributeKey Attribute that will be set by the command.\n     */\n    constructor(editor, attributeKey) {\n        super(editor);\n        this.attributeKey = attributeKey;\n    }\n    /**\n     * Updates the command's {@link #value} and {@link #isEnabled} based on the current selection.\n     */\n    refresh() {\n        const model = this.editor.model;\n        const doc = model.document;\n        this.value = this._getValueFromFirstAllowedNode();\n        this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);\n    }\n    /**\n     * Executes the command &ndash; applies the attribute to the selection or removes it from the selection.\n     *\n     * If the command is active (`value == true`), it will remove attributes. Otherwise, it will set attributes.\n     *\n     * The execution result differs, depending on the {@link module:engine/model/document~ModelDocument#selection}:\n     *\n     * * If the selection is on a range, the command applies the attribute to all nodes in that range\n     * (if they are allowed to have this attribute by the {@link module:engine/model/schema~ModelSchema schema}).\n     * * If the selection is collapsed in a non-empty node, the command applies the attribute to the\n     * {@link module:engine/model/document~ModelDocument#selection} itself (note that typed characters copy attributes from the selection).\n     * * If the selection is collapsed in an empty node, the command applies the attribute to the parent node of the selection (note\n     * that the selection inherits all attributes from a node if it is in an empty node).\n     *\n     * @fires execute\n     * @param options Command options.\n     * @param options.forceValue If set, it will force the command behavior. If `true`,\n     * the command will apply the attribute, otherwise the command will remove the attribute.\n     * If not set, the command will look for its current value to decide what it should do.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const doc = model.document;\n        const selection = doc.selection;\n        const value = (options.forceValue === undefined) ? !this.value : options.forceValue;\n        model.change(writer => {\n            if (selection.isCollapsed) {\n                if (value) {\n                    writer.setSelectionAttribute(this.attributeKey, true);\n                }\n                else {\n                    writer.removeSelectionAttribute(this.attributeKey);\n                }\n            }\n            else {\n                const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey);\n                for (const range of ranges) {\n                    if (value) {\n                        writer.setAttribute(this.attributeKey, value, range);\n                    }\n                    else {\n                        writer.removeAttribute(this.attributeKey, range);\n                    }\n                }\n            }\n        });\n    }\n    /**\n     * Checks the attribute value of the first node in the selection that allows the attribute.\n     * For the collapsed selection returns the selection attribute.\n     *\n     * @returns The attribute value.\n     */\n    _getValueFromFirstAllowedNode() {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selection = model.document.selection;\n        if (selection.isCollapsed) {\n            return selection.hasAttribute(this.attributeKey);\n        }\n        for (const range of selection.getRanges()) {\n            for (const item of range.getItems()) {\n                if (schema.checkAttribute(item, this.attributeKey)) {\n                    return item.hasAttribute(this.attributeKey);\n                }\n            }\n        }\n        return false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/bold/boldediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst BOLD = 'bold';\n/**\n * The bold editing feature.\n *\n * It registers the `'bold'` command and introduces the `bold` attribute in the model which renders to the view\n * as a `<strong>` element.\n */\nexport class BoldEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'BoldEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        // Allow bold attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: BOLD });\n        editor.model.schema.setAttributeProperties(BOLD, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        // Build converter from model to view for data and editing pipelines.\n        editor.conversion.attributeToElement({\n            model: BOLD,\n            view: 'strong',\n            upcastAlso: [\n                'b',\n                viewElement => {\n                    const fontWeight = viewElement.getStyle('font-weight');\n                    if (!fontWeight) {\n                        return null;\n                    }\n                    // Value of the `font-weight` attribute can be defined as a string or a number.\n                    if (fontWeight == 'bold' || Number(fontWeight) >= 600) {\n                        return {\n                            name: true,\n                            styles: ['font-weight']\n                        };\n                    }\n                    return null;\n                }\n            ]\n        });\n        // Create bold command.\n        editor.commands.add(BOLD, new AttributeCommand(editor, BOLD));\n        // Set the Ctrl+B keystroke.\n        editor.keystrokes.set('CTRL+B', BOLD);\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Bold text'),\n                    keystroke: 'CTRL+B'\n                }\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\n/**\n * Returns a function that creates a (toolbar or menu bar) button for a basic style feature.\n *\n * @internal\n */\nexport function getButtonCreator({ editor, commandName, plugin, icon, label, keystroke }) {\n    return (ButtonClass) => {\n        const command = editor.commands.get(commandName);\n        const view = new ButtonClass(editor.locale);\n        view.set({\n            label,\n            icon,\n            keystroke,\n            isToggleable: true\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        view.bind('isOn').to(command, 'value');\n        if (view instanceof MenuBarMenuListItemButtonView) {\n            view.set({\n                role: 'menuitemcheckbox'\n            });\n        }\n        else {\n            view.set({\n                tooltip: true\n            });\n        }\n        // Execute the command.\n        plugin.listenTo(view, 'execute', () => {\n            editor.execute(commandName);\n            editor.editing.view.focus();\n        });\n        return view;\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/bold/boldui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconBold } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nconst BOLD = 'bold';\n/**\n * The bold UI feature. It introduces the Bold button.\n */\nexport class BoldUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'BoldUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: BOLD,\n            plugin: this,\n            icon: IconBold,\n            label: t('Bold'),\n            keystroke: 'CTRL+B'\n        });\n        // Add bold button to feature components.\n        editor.ui.componentFactory.add(BOLD, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + BOLD, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/italic/italicediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst ITALIC = 'italic';\n/**\n * The italic editing feature.\n *\n * It registers the `'italic'` command, the <kbd>Ctrl+I</kbd> keystroke and introduces the `italic` attribute in the model\n * which renders to the view as an `<i>` element.\n */\nexport class ItalicEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ItalicEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        // Allow italic attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: ITALIC });\n        editor.model.schema.setAttributeProperties(ITALIC, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        editor.conversion.attributeToElement({\n            model: ITALIC,\n            view: 'i',\n            upcastAlso: [\n                'em',\n                {\n                    styles: {\n                        'font-style': 'italic'\n                    }\n                }\n            ]\n        });\n        // Create italic command.\n        editor.commands.add(ITALIC, new AttributeCommand(editor, ITALIC));\n        // Set the Ctrl+I keystroke.\n        editor.keystrokes.set('CTRL+I', ITALIC);\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Italic text'),\n                    keystroke: 'CTRL+I'\n                }\n            ]\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m9.586 14.633.021.004q-.054.502.393.962.123.125.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15q.711-.106 1.005-.334.235-.182.404-.597l2.416-9.55a1.05 1.05 0 0 0-.281-.823 1.1 1.1 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195q-.564.084-.823.296-.323.263-.623.79z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/italic/italicui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconItalic } from 'ckeditor5/src/icons.js';\nimport { MenuBarMenuListItemButtonView, ButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nconst ITALIC = 'italic';\n/**\n * The italic UI feature. It introduces the Italic button.\n */\nexport class ItalicUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ItalicUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: ITALIC,\n            plugin: this,\n            icon: IconItalic,\n            keystroke: 'CTRL+I',\n            label: t('Italic')\n        });\n        // Add bold button to feature components.\n        editor.ui.componentFactory.add(ITALIC, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + ITALIC, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/underline/underlineediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst UNDERLINE = 'underline';\n/**\n * The underline editing feature.\n *\n * It registers the `'underline'` command, the <kbd>Ctrl+U</kbd> keystroke\n * and introduces the `underline` attribute in the model which renders to the view as an `<u>` element.\n */\nexport class UnderlineEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'UnderlineEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        // Allow strikethrough attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: UNDERLINE });\n        editor.model.schema.setAttributeProperties(UNDERLINE, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        editor.conversion.attributeToElement({\n            model: UNDERLINE,\n            view: 'u',\n            upcastAlso: {\n                styles: {\n                    'text-decoration': 'underline'\n                }\n            }\n        });\n        // Create underline command.\n        editor.commands.add(UNDERLINE, new AttributeCommand(editor, UNDERLINE));\n        // Set the Ctrl+U keystroke.\n        editor.keystrokes.set('CTRL+U', 'underline');\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Underline text'),\n                    keystroke: 'CTRL+U'\n                }\n            ]\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8s3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/underline/underlineui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconUnderline } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nconst UNDERLINE = 'underline';\n/**\n * The underline UI feature. It introduces the Underline button.\n */\nexport class UnderlineUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'UnderlineUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: UNDERLINE,\n            plugin: this,\n            icon: IconUnderline,\n            label: t('Underline'),\n            keystroke: 'CTRL+U'\n        });\n        // Add bold button to feature components.\n        editor.ui.componentFactory.add(UNDERLINE, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + UNDERLINE, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/strikethrough/strikethroughediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst STRIKETHROUGH = 'strikethrough';\n/**\n * The strikethrough editing feature.\n *\n * It registers the `'strikethrough'` command, the <kbd>Ctrl+Shift+X</kbd> keystroke and introduces the\n * `strikethroughsthrough` attribute in the model which renders to the view\n * as a `<s>` element.\n */\nexport class StrikethroughEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'StrikethroughEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        // Allow strikethrough attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: STRIKETHROUGH });\n        editor.model.schema.setAttributeProperties(STRIKETHROUGH, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        editor.conversion.attributeToElement({\n            model: STRIKETHROUGH,\n            view: 's',\n            upcastAlso: [\n                'del',\n                'strike',\n                {\n                    styles: {\n                        'text-decoration': 'line-through'\n                    }\n                }\n            ]\n        });\n        // Create strikethrough command.\n        editor.commands.add(STRIKETHROUGH, new AttributeCommand(editor, STRIKETHROUGH));\n        // Set the Ctrl+Shift+X keystroke.\n        editor.keystrokes.set('CTRL+SHIFT+X', 'strikethrough');\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Strikethrough text'),\n                    keystroke: 'CTRL+SHIFT+X'\n                }\n            ]\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6M6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z\\\"/><path d=\\\"M3 10.5V9h14v1.5z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/strikethrough/strikethroughui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconStrikethrough } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nconst STRIKETHROUGH = 'strikethrough';\n/**\n * The strikethrough UI feature. It introduces the Strikethrough button.\n */\nexport class StrikethroughUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'StrikethroughUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: STRIKETHROUGH,\n            plugin: this,\n            icon: IconStrikethrough,\n            keystroke: 'CTRL+SHIFT+X',\n            label: t('Strikethrough')\n        });\n        // Add strikethrough button to feature components.\n        editor.ui.componentFactory.add(STRIKETHROUGH, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + STRIKETHROUGH, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/code/codeediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TwoStepCaretMovement, inlineHighlight } from 'ckeditor5/src/typing.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst CODE = 'code';\nconst HIGHLIGHT_CLASS = 'ck-code_selected';\n/**\n * The code editing feature.\n *\n * It registers the `'code'` command and introduces the `code` attribute in the model which renders to the view\n * as a `<code>` element.\n */\nexport class CodeEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CodeEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TwoStepCaretMovement];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        // Allow code attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: CODE });\n        editor.model.schema.setAttributeProperties(CODE, {\n            isFormatting: true,\n            copyOnEnter: false\n        });\n        editor.conversion.attributeToElement({\n            model: CODE,\n            view: 'code'\n        });\n        // Create code command.\n        editor.commands.add(CODE, new AttributeCommand(editor, CODE));\n        // Enable two-step caret movement for `code` attribute.\n        editor.plugins.get(TwoStepCaretMovement).registerAttribute(CODE);\n        // Setup highlight over selected element.\n        inlineHighlight(editor, CODE, 'code', HIGHLIGHT_CLASS);\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Move out of an inline code style'),\n                    keystroke: [\n                        ['arrowleft', 'arrowleft'],\n                        ['arrowright', 'arrowright']\n                    ]\n                }\n            ]\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1m-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/code/codeui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconCode } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nimport '../../theme/code.css';\nconst CODE = 'code';\n/**\n * The code UI feature. It introduces the Code button.\n */\nexport class CodeUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CodeUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: CODE,\n            plugin: this,\n            icon: IconCode,\n            label: t('Code')\n        });\n        // Add code button to feature components.\n        editor.ui.componentFactory.add(CODE, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + CODE, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/subscript/subscriptediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst SUBSCRIPT = 'subscript';\n/**\n * The subscript editing feature.\n *\n * It registers the `sub` command and introduces the `sub` attribute in the model which renders to the view\n * as a `<sub>` element.\n */\nexport class SubscriptEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SubscriptEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Allow sub attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: SUBSCRIPT });\n        editor.model.schema.setAttributeProperties(SUBSCRIPT, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        // Build converter from model to view for data and editing pipelines.\n        editor.conversion.attributeToElement({\n            model: SUBSCRIPT,\n            view: 'sub',\n            upcastAlso: [\n                {\n                    styles: {\n                        'vertical-align': 'sub'\n                    }\n                }\n            ]\n        });\n        // Create sub command.\n        editor.commands.add(SUBSCRIPT, new AttributeCommand(editor, SUBSCRIPT));\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53zm8.147 7.829h2.549q.38 0 .58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197a.62.62 0 0 1-.205-.463q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553t.405-.57.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646c.3-.289.454-.349.762-.467a3 3 0 0 1 1.081-.178q.747 0 1.274.228a1.92 1.92 0 0 1 1.004 1.032 1.98 1.98 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.584-1.008.906a3 3 0 0 0-.24.309z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/subscript/subscriptui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconSubscript } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nconst SUBSCRIPT = 'subscript';\n/**\n * The subscript UI feature. It introduces the Subscript button.\n */\nexport class SubscriptUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SubscriptUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: SUBSCRIPT,\n            plugin: this,\n            icon: IconSubscript,\n            label: t('Subscript')\n        });\n        // Add subscript button to feature components.\n        editor.ui.componentFactory.add(SUBSCRIPT, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + SUBSCRIPT, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/superscript/superscriptediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AttributeCommand } from '../attributecommand.js';\nconst SUPERSCRIPT = 'superscript';\n/**\n * The superscript editing feature.\n *\n * It registers the `super` command and introduces the `super` attribute in the model which renders to the view\n * as a `<super>` element.\n */\nexport class SuperscriptEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SuperscriptEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Allow super attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: SUPERSCRIPT });\n        editor.model.schema.setAttributeProperties(SUPERSCRIPT, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        // Build converter from model to view for data and editing pipelines.\n        editor.conversion.attributeToElement({\n            model: SUPERSCRIPT,\n            view: 'sup',\n            upcastAlso: [\n                {\n                    styles: {\n                        'vertical-align': 'super'\n                    }\n                }\n            ]\n        });\n        // Create super command.\n        editor.commands.add(SUPERSCRIPT, new AttributeCommand(editor, SUPERSCRIPT));\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"20\\\" height=\\\"20\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m7.184 10.353 3.818-3.819a.8.8 0 0 1 1.132 1.132l-3.82 3.818 3.82 3.818a.802.802 0 0 1-.873 1.306.8.8 0 0 1-.26-.174l-3.817-3.82-3.818 3.82a.8.8 0 0 1-1.305-.26.8.8 0 0 1 .173-.872l3.82-3.818-3.82-3.818a.8.8 0 0 1 1.132-1.132l3.818 3.82M15.68 6.88h2.549q.38 0 .58.153a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197A.62.62 0 0 1 14 7.34q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553.266-.277.405-.57.14-.291.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646t.762-.467A3 3 0 0 1 16.466 1q.747 0 1.274.228c.456.2.816.57 1.004 1.032a1.99 1.99 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.583-1.008.906-.131.146-.24.309z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/superscript/superscriptui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconSuperscript } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { getButtonCreator } from '../utils.js';\nconst SUPERSCRIPT = 'superscript';\n/**\n * The superscript UI feature. It introduces the Superscript button.\n */\nexport class SuperscriptUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SuperscriptUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const createButton = getButtonCreator({\n            editor,\n            commandName: SUPERSCRIPT,\n            plugin: this,\n            icon: IconSuperscript,\n            label: t('Superscript')\n        });\n        // Add superscript button to feature components.\n        editor.ui.componentFactory.add(SUPERSCRIPT, () => createButton(ButtonView));\n        editor.ui.componentFactory.add('menuBar:' + SUPERSCRIPT, () => createButton(MenuBarMenuListItemButtonView));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module block-quote/blockquotecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * The block quote command plugin.\n *\n * @extends module:core/command~Command\n */\nexport class BlockQuoteCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.value = this._getValue();\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Executes the command. When the command {@link #value is on}, all top-most block quotes within\n     * the selection will be removed. If it is off, all selected blocks will be wrapped with\n     * a block quote.\n     *\n     * @fires execute\n     * @param options Command options.\n     * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a block quote,\n     * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selection = model.document.selection;\n        const blocks = Array.from(selection.getSelectedBlocks());\n        const value = (options.forceValue === undefined) ? !this.value : options.forceValue;\n        model.change(writer => {\n            if (!value) {\n                this._removeQuote(writer, blocks.filter(findQuote));\n            }\n            else {\n                const blocksToQuote = blocks.filter(block => {\n                    // Already quoted blocks needs to be considered while quoting too\n                    // in order to reuse their <bQ> elements.\n                    return findQuote(block) || checkCanBeQuoted(schema, block);\n                });\n                this._applyQuote(writer, blocksToQuote);\n            }\n        });\n    }\n    /**\n     * Checks the command's {@link #value}.\n     */\n    _getValue() {\n        const selection = this.editor.model.document.selection;\n        const firstBlock = first(selection.getSelectedBlocks());\n        // In the current implementation, the block quote must be an immediate parent of a block element.\n        return !!(firstBlock && findQuote(firstBlock));\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        if (this.value) {\n            return true;\n        }\n        const selection = this.editor.model.document.selection;\n        const schema = this.editor.model.schema;\n        const firstBlock = first(selection.getSelectedBlocks());\n        if (!firstBlock) {\n            return false;\n        }\n        return checkCanBeQuoted(schema, firstBlock);\n    }\n    /**\n     * Removes the quote from given blocks.\n     *\n     * If blocks which are supposed to be \"unquoted\" are in the middle of a quote,\n     * start it or end it, then the quote will be split (if needed) and the blocks\n     * will be moved out of it, so other quoted blocks remained quoted.\n     */\n    _removeQuote(writer, blocks) {\n        // Unquote all groups of block. Iterate in the reverse order to not break following ranges.\n        getRangesOfBlockGroups(writer, blocks).reverse().forEach(groupRange => {\n            if (groupRange.start.isAtStart && groupRange.end.isAtEnd) {\n                writer.unwrap(groupRange.start.parent);\n                return;\n            }\n            // The group of blocks are at the beginning of an <bQ> so let's move them left (out of the <bQ>).\n            if (groupRange.start.isAtStart) {\n                const positionBefore = writer.createPositionBefore(groupRange.start.parent);\n                writer.move(groupRange, positionBefore);\n                return;\n            }\n            // The blocks are in the middle of an <bQ> so we need to split the <bQ> after the last block\n            // so we move the items there.\n            if (!groupRange.end.isAtEnd) {\n                writer.split(groupRange.end);\n            }\n            // Now we are sure that groupRange.end.isAtEnd is true, so let's move the blocks right.\n            const positionAfter = writer.createPositionAfter(groupRange.end.parent);\n            writer.move(groupRange, positionAfter);\n        });\n    }\n    /**\n     * Applies the quote to given blocks.\n     */\n    _applyQuote(writer, blocks) {\n        const quotesToMerge = [];\n        // Quote all groups of block. Iterate in the reverse order to not break following ranges.\n        getRangesOfBlockGroups(writer, blocks).reverse().forEach(groupRange => {\n            let quote = findQuote(groupRange.start);\n            if (!quote) {\n                quote = writer.createElement('blockQuote');\n                writer.wrap(groupRange, quote);\n            }\n            quotesToMerge.push(quote);\n        });\n        // Merge subsequent <bQ> elements. Reverse the order again because this time we want to go through\n        // the <bQ> elements in the source order (due to how merge works – it moves the right element's content\n        // to the first element and removes the right one. Since we may need to merge a couple of subsequent `<bQ>` elements\n        // we want to keep the reference to the first (furthest left) one.\n        quotesToMerge.reverse().reduce((currentQuote, nextQuote) => {\n            if (currentQuote.nextSibling == nextQuote) {\n                writer.merge(writer.createPositionAfter(currentQuote));\n                return currentQuote;\n            }\n            return nextQuote;\n        });\n    }\n}\nfunction findQuote(elementOrPosition) {\n    return elementOrPosition.parent.name == 'blockQuote' ? elementOrPosition.parent : null;\n}\n/**\n * Returns a minimal array of ranges containing groups of subsequent blocks.\n *\n * content:         abcdefgh\n * blocks:          [ a, b, d, f, g, h ]\n * output ranges:   [ab]c[d]e[fgh]\n */\nfunction getRangesOfBlockGroups(writer, blocks) {\n    let startPosition;\n    let i = 0;\n    const ranges = [];\n    while (i < blocks.length) {\n        const block = blocks[i];\n        const nextBlock = blocks[i + 1];\n        if (!startPosition) {\n            startPosition = writer.createPositionBefore(block);\n        }\n        if (!nextBlock || block.nextSibling != nextBlock) {\n            ranges.push(writer.createRange(startPosition, writer.createPositionAfter(block)));\n            startPosition = null;\n        }\n        i++;\n    }\n    return ranges;\n}\n/**\n * Checks whether <bQ> can wrap the block.\n */\nfunction checkCanBeQuoted(schema, block) {\n    // TMP will be replaced with schema.checkWrap().\n    const isBQAllowed = schema.checkChild(block.parent, 'blockQuote');\n    const isBlockAllowedInBQ = schema.checkChild(['$root', 'blockQuote'], block);\n    return isBQAllowed && isBlockAllowedInBQ;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module block-quote/blockquoteediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Enter } from 'ckeditor5/src/enter.js';\nimport { Delete } from 'ckeditor5/src/typing.js';\nimport { BlockQuoteCommand } from './blockquotecommand.js';\n/**\n * The block quote editing.\n *\n * Introduces the `'blockQuote'` command and the `'blockQuote'` model element.\n *\n * @extends module:core/plugin~Plugin\n */\nexport class BlockQuoteEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'BlockQuoteEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Enter, Delete];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        editor.commands.add('blockQuote', new BlockQuoteCommand(editor));\n        schema.register('blockQuote', {\n            inheritAllFrom: '$container'\n        });\n        editor.conversion.elementToElement({ model: 'blockQuote', view: 'blockquote' });\n        // Postfixer which cleans incorrect model states connected with block quotes.\n        editor.model.document.registerPostFixer(writer => {\n            const changes = editor.model.document.differ.getChanges();\n            for (const entry of changes) {\n                if (entry.type == 'insert') {\n                    const element = entry.position.nodeAfter;\n                    if (!element) {\n                        // We are inside a text node.\n                        continue;\n                    }\n                    if (element.is('element', 'blockQuote') && element.isEmpty) {\n                        // Added an empty blockQuote - remove it.\n                        writer.remove(element);\n                        return true;\n                    }\n                    else if (element.is('element', 'blockQuote') && !schema.checkChild(entry.position, element)) {\n                        // Added a blockQuote in incorrect place. Unwrap it so the content inside is not lost.\n                        writer.unwrap(element);\n                        return true;\n                    }\n                    else if (element.is('element')) {\n                        // Just added an element. Check that all children meet the scheme rules.\n                        const range = writer.createRangeIn(element);\n                        for (const child of range.getItems()) {\n                            if (child.is('element', 'blockQuote') &&\n                                !schema.checkChild(writer.createPositionBefore(child), child)) {\n                                writer.unwrap(child);\n                                return true;\n                            }\n                        }\n                    }\n                }\n                else if (entry.type == 'remove') {\n                    const parent = entry.position.parent;\n                    if (parent.is('element', 'blockQuote') && parent.isEmpty) {\n                        // Something got removed and now blockQuote is empty. Remove the blockQuote as well.\n                        writer.remove(parent);\n                        return true;\n                    }\n                }\n            }\n            return false;\n        });\n        const viewDocument = this.editor.editing.view.document;\n        const selection = editor.model.document.selection;\n        const blockQuoteCommand = editor.commands.get('blockQuote');\n        // Overwrite default Enter key behavior.\n        // If Enter key is pressed with selection collapsed in empty block inside a quote, break the quote.\n        this.listenTo(viewDocument, 'enter', (evt, data) => {\n            if (!selection.isCollapsed || !blockQuoteCommand.value) {\n                return;\n            }\n            const positionParent = selection.getLastPosition().parent;\n            if (positionParent.isEmpty) {\n                editor.execute('blockQuote');\n                editor.editing.view.scrollToTheSelection();\n                data.preventDefault();\n                evt.stop();\n            }\n        }, { context: 'blockquote' });\n        // Overwrite default Backspace key behavior.\n        // If Backspace key is pressed with selection collapsed in first empty block inside a quote, break the quote.\n        this.listenTo(viewDocument, 'delete', (evt, data) => {\n            if (data.direction != 'backward' || !selection.isCollapsed || !blockQuoteCommand.value) {\n                return;\n            }\n            const positionParent = selection.getLastPosition().parent;\n            if (positionParent.isEmpty && !positionParent.previousSibling) {\n                editor.execute('blockQuote');\n                editor.editing.view.scrollToTheSelection();\n                data.preventDefault();\n                evt.stop();\n            }\n        }, { context: 'blockquote' });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module block-quote/blockquoteui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconQuote } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport '../theme/blockquote.css';\n/**\n * The block quote UI plugin.\n *\n * It introduces the `'blockQuote'` button.\n *\n * @extends module:core/plugin~Plugin\n */\nexport class BlockQuoteUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'BlockQuoteUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('blockQuote', () => {\n            const buttonView = this._createButton(ButtonView);\n            buttonView.set({\n                tooltip: true\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:blockQuote', () => {\n            const buttonView = this._createButton(MenuBarMenuListItemButtonView);\n            buttonView.set({\n                role: 'menuitemcheckbox'\n            });\n            return buttonView;\n        });\n    }\n    /**\n     * Creates a button for block quote command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('blockQuote');\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            label: t('Block quote'),\n            icon: IconQuote,\n            isToggleable: true\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        view.bind('isOn').to(command, 'value');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute('blockQuote');\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paragraph/paragraphcommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\nimport { first } from '@ckeditor/ckeditor5-utils';\n/**\n * The paragraph command.\n */\nexport class ParagraphCommand extends Command {\n    constructor(editor) {\n        super(editor);\n        // Since this command may pass selection in execution block, it should be checked directly.\n        this._isEnabledBasedOnSelection = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const document = model.document;\n        const block = first(document.selection.getSelectedBlocks());\n        this.value = !!block && block.is('element', 'paragraph');\n        this.isEnabled = !!block && checkCanBecomeParagraph(block, model.schema);\n    }\n    /**\n     * Executes the command. All the blocks (see {@link module:engine/model/schema~ModelSchema}) in the selection\n     * will be turned to paragraphs.\n     *\n     * @fires execute\n     * @param options Options for the executed command.\n     * @param options.selection The selection that the command should be applied to. By default,\n     * if not provided, the command is applied to the {@link module:engine/model/document~ModelDocument#selection}.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        const selection = options.selection || document.selection;\n        // Don't execute command if selection is in non-editable place.\n        if (!model.canEditAt(selection)) {\n            return;\n        }\n        model.change(writer => {\n            const blocks = selection.getSelectedBlocks();\n            for (const block of blocks) {\n                if (!block.is('element', 'paragraph') && checkCanBecomeParagraph(block, model.schema)) {\n                    writer.rename(block, 'paragraph');\n                }\n            }\n        });\n    }\n}\n/**\n * Checks whether the given block can be replaced by a paragraph.\n *\n * @param block A block to be tested.\n * @param schema The schema of the document.\n */\nfunction checkCanBecomeParagraph(block, schema) {\n    return schema.checkChild(block.parent, 'paragraph') && !schema.isObject(block);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paragraph/insertparagraphcommand\n */\nimport { Command } from '@ckeditor/ckeditor5-core';\n/**\n * The insert paragraph command. It inserts a new paragraph at a specific\n * {@link module:engine/model/position~ModelPosition document position}.\n *\n * ```ts\n * // Insert a new paragraph before an element in the document.\n * editor.execute( 'insertParagraph', {\n *   position: editor.model.createPositionBefore( element )\n * } );\n * ```\n *\n * If a paragraph is disallowed in the context of the specific position, the command\n * will attempt to split position ancestors to find a place where it is possible\n * to insert a paragraph.\n *\n * **Note**: This command moves the selection to the inserted paragraph.\n */\nexport class InsertParagraphCommand extends Command {\n    constructor(editor) {\n        super(editor);\n        // Since this command passes position in execution block instead of selection, it should be checked directly.\n        this._isEnabledBasedOnSelection = false;\n    }\n    /**\n     * Executes the command.\n     *\n     * @param options Options for the executed command.\n     * @param options.position The model position at which the new paragraph will be inserted.\n     * @param options.attributes Attributes keys and values to set on a inserted paragraph.\n     * @fires execute\n     */\n    execute(options) {\n        const model = this.editor.model;\n        const attributes = options.attributes;\n        let position = options.position;\n        // Don't execute command if position is in non-editable place.\n        if (!model.canEditAt(position)) {\n            return null;\n        }\n        return model.change(writer => {\n            position = this._findPositionToInsertParagraph(position, writer);\n            if (!position) {\n                return null;\n            }\n            const paragraph = writer.createElement('paragraph');\n            if (attributes) {\n                model.schema.setAllowedAttributes(paragraph, attributes, writer);\n            }\n            model.insertContent(paragraph, position);\n            writer.setSelection(paragraph, 'in');\n            return writer.createPositionAt(paragraph, 0);\n        });\n    }\n    /**\n     * Returns the best position to insert a new paragraph.\n     */\n    _findPositionToInsertParagraph(position, writer) {\n        const model = this.editor.model;\n        if (model.schema.checkChild(position, 'paragraph')) {\n            return position;\n        }\n        const allowedParent = model.schema.findAllowedParent(position, 'paragraph');\n        // It could be there's no ancestor limit that would allow paragraph.\n        // In theory, \"paragraph\" could be disallowed even in the \"$root\".\n        if (!allowedParent) {\n            return null;\n        }\n        const positionParent = position.parent;\n        const isTextAllowed = model.schema.checkChild(positionParent, '$text');\n        // At empty $block or at the end of $block.\n        // <paragraph>[]</paragraph> ---> <paragraph></paragraph><paragraph>[]</paragraph>\n        // <paragraph>foo[]</paragraph> ---> <paragraph>foo</paragraph><paragraph>[]</paragraph>\n        if (positionParent.isEmpty || isTextAllowed && position.isAtEnd) {\n            return model.createPositionAfter(positionParent);\n        }\n        // At the start of $block with text.\n        // <paragraph>[]foo</paragraph> ---> <paragraph>[]</paragraph><paragraph>foo</paragraph>\n        if (!positionParent.isEmpty && isTextAllowed && position.isAtStart) {\n            return model.createPositionBefore(positionParent);\n        }\n        return writer.split(position, allowedParent).position;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paragraph/paragraph\n */\nimport { ParagraphCommand } from './paragraphcommand.js';\nimport { InsertParagraphCommand } from './insertparagraphcommand.js';\nimport { Plugin } from '@ckeditor/ckeditor5-core';\n/**\n * The paragraph feature for the editor.\n *\n * It introduces the `<paragraph>` element in the model which renders as a `<p>` element in the DOM and data.\n *\n * It also brings two editors commands:\n *\n * * The {@link module:paragraph/paragraphcommand~ParagraphCommand `'paragraph'`} command that converts all\n * blocks in the model selection into paragraphs.\n * * The {@link module:paragraph/insertparagraphcommand~InsertParagraphCommand `'insertParagraph'`} command\n * that inserts a new paragraph at a specified location in the model.\n */\nexport class Paragraph extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Paragraph';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        editor.commands.add('paragraph', new ParagraphCommand(editor));\n        editor.commands.add('insertParagraph', new InsertParagraphCommand(editor));\n        // Schema.\n        model.schema.register('paragraph', { inheritAllFrom: '$block' });\n        editor.conversion.elementToElement({ model: 'paragraph', view: 'p' });\n        // Conversion for paragraph-like elements which has not been converted by any plugin.\n        editor.conversion.for('upcast').elementToElement({\n            model: (viewElement, { writer }) => {\n                if (!Paragraph.paragraphLikeElements.has(viewElement.name)) {\n                    return null;\n                }\n                // Do not auto-paragraph empty elements.\n                if (viewElement.isEmpty) {\n                    return null;\n                }\n                return writer.createElement('paragraph');\n            },\n            view: /.+/,\n            converterPriority: 'low'\n        });\n    }\n    /**\n     * A list of element names which should be treated by the autoparagraphing algorithms as\n     * paragraph-like. This means that e.g. the following content:\n     *\n     * ```html\n     * <h1>Foo</h1>\n     * <table>\n     *   <tr>\n     *     <td>X</td>\n     *     <td>\n     *       <ul>\n     *         <li>Y</li>\n     *         <li>Z</li>\n     *       </ul>\n     *     </td>\n     *   </tr>\n     * </table>\n     * ```\n     *\n     * contains five paragraph-like elements: `<h1>`, two `<td>`s and two `<li>`s.\n     * Hence, if none of the features is going to convert those elements the above content will be automatically handled\n     * by the paragraph feature and converted to:\n     *\n     * ```html\n     * <p>Foo</p>\n     * <p>X</p>\n     * <p>Y</p>\n     * <p>Z</p>\n     * ```\n     *\n     * Note: The `<td>` containing two `<li>` elements was ignored as the innermost paragraph-like elements\n     * have a priority upon conversion.\n     */\n    static paragraphLikeElements = new Set([\n        'blockquote',\n        'dd',\n        'div',\n        'dt',\n        'h1',\n        'h2',\n        'h3',\n        'h4',\n        'h5',\n        'h6',\n        'li',\n        'p',\n        'td',\n        'th'\n    ]);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module heading/headingcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * The heading command. It is used by the {@link module:heading/heading~Heading heading feature} to apply headings.\n */\nexport class HeadingCommand extends Command {\n    /**\n     * Set of defined model's elements names that this command support.\n     * See {@link module:heading/headingconfig~HeadingOption}.\n     */\n    modelElements;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor Editor instance.\n     * @param modelElements Names of the element which this command can apply in the model.\n     */\n    constructor(editor, modelElements) {\n        super(editor);\n        this.modelElements = modelElements;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const block = first(this.editor.model.document.selection.getSelectedBlocks());\n        this.value = !!block && this.modelElements.includes(block.name) && block.name;\n        this.isEnabled = !!block && this.modelElements.some(heading => checkCanBecomeHeading(block, heading, this.editor.model.schema));\n    }\n    /**\n     * Executes the command. Applies the heading to the selected blocks or, if the first selected\n     * block is a heading already, turns selected headings (of this level only) to paragraphs.\n     *\n     * @param options.value Name of the element which this command will apply in the model.\n     * @fires execute\n     */\n    execute(options) {\n        const model = this.editor.model;\n        const document = model.document;\n        const modelElement = options.value;\n        model.change(writer => {\n            const blocks = Array.from(document.selection.getSelectedBlocks())\n                .filter(block => {\n                return checkCanBecomeHeading(block, modelElement, model.schema);\n            });\n            for (const block of blocks) {\n                if (!block.is('element', modelElement)) {\n                    writer.rename(block, modelElement);\n                }\n            }\n        });\n    }\n}\n/**\n * Checks whether the given block can be replaced by a specific heading.\n *\n * @param block A block to be tested.\n * @param heading Command element name in the model.\n * @param schema The schema of the document.\n */\nfunction checkCanBecomeHeading(block, heading, schema) {\n    return schema.checkChild(block.parent, heading) && !schema.isObject(block);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module heading/headingediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Paragraph } from 'ckeditor5/src/paragraph.js';\nimport { priorities } from 'ckeditor5/src/utils.js';\nimport { HeadingCommand } from './headingcommand.js';\nconst defaultModelElement = 'paragraph';\n/**\n * The headings engine feature. It handles switching between block formats &ndash; headings and paragraph.\n * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.\n * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.\n */\nexport class HeadingEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HeadingEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('heading', {\n            options: [\n                { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },\n                { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },\n                { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },\n                { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Paragraph];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const options = editor.config.get('heading.options');\n        const modelElements = [];\n        for (const option of options) {\n            // Skip paragraph - it is defined in required Paragraph feature.\n            if (option.model === 'paragraph') {\n                continue;\n            }\n            // Schema.\n            editor.model.schema.register(option.model, {\n                inheritAllFrom: '$block'\n            });\n            editor.conversion.elementToElement(option);\n            modelElements.push(option.model);\n        }\n        this._addDefaultH1Conversion(editor);\n        // Register the heading command for this option.\n        editor.commands.add('heading', new HeadingCommand(editor, modelElements));\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        // If the enter command is added to the editor, alter its behavior.\n        // Enter at the end of a heading element should create a paragraph.\n        const editor = this.editor;\n        const enterCommand = editor.commands.get('enter');\n        const options = editor.config.get('heading.options');\n        if (enterCommand) {\n            this.listenTo(enterCommand, 'afterExecute', (evt, data) => {\n                const positionParent = editor.model.document.selection.getFirstPosition().parent;\n                const isHeading = options.some(option => positionParent.is('element', option.model));\n                if (isHeading && !positionParent.is('element', defaultModelElement) && positionParent.childCount === 0) {\n                    data.writer.rename(positionParent, defaultModelElement);\n                }\n            });\n        }\n    }\n    /**\n     * Adds default conversion for `h1` -> `heading1` with a low priority.\n     *\n     * @param editor Editor instance on which to add the `h1` conversion.\n     */\n    _addDefaultH1Conversion(editor) {\n        editor.conversion.for('upcast').elementToElement({\n            model: 'heading1',\n            view: 'h1',\n            // With a `low` priority, `paragraph` plugin autoparagraphing mechanism is executed. Make sure\n            // this listener is called before it. If not, `h1` will be transformed into a paragraph.\n            converterPriority: priorities.low + 1\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/model\n */\nimport { ObservableMixin } from '@ckeditor/ckeditor5-utils';\nimport { extend } from 'es-toolkit/compat';\n/**\n * The base MVC model class.\n */\nexport class UIModel extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Creates a new Model instance.\n     *\n     * @param attributes The model state attributes to be defined during the instance creation.\n     * @param properties The (out of state) properties to be appended to the instance during creation.\n     */\n    constructor(attributes, properties) {\n        super();\n        // Extend this instance with the additional (out of state) properties.\n        if (properties) {\n            extend(this, properties);\n        }\n        // Initialize the attributes.\n        if (attributes) {\n            this.set(attributes);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module heading/headingui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { UIModel, createDropdown, addListToDropdown, MenuBarMenuListItemView, MenuBarMenuListView, MenuBarMenuView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { getLocalizedOptions } from './utils.js';\nimport '../theme/heading.css';\n/**\n * The headings UI feature. It introduces the `headings` dropdown.\n */\nexport class HeadingUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HeadingUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const options = getLocalizedOptions(editor);\n        const defaultTitle = t('Choose heading');\n        const accessibleLabel = t('Heading');\n        // Register UI component.\n        editor.ui.componentFactory.add('heading', locale => {\n            const titles = {};\n            const itemDefinitions = new Collection();\n            const headingCommand = editor.commands.get('heading');\n            const paragraphCommand = editor.commands.get('paragraph');\n            const commands = [headingCommand];\n            for (const option of options) {\n                const def = {\n                    type: 'button',\n                    model: new UIModel({\n                        label: option.title,\n                        class: option.class,\n                        role: 'menuitemradio',\n                        withText: true\n                    })\n                };\n                if (option.model === 'paragraph') {\n                    def.model.bind('isOn').to(paragraphCommand, 'value');\n                    def.model.set('commandName', 'paragraph');\n                    commands.push(paragraphCommand);\n                }\n                else {\n                    def.model.bind('isOn').to(headingCommand, 'value', value => value === option.model);\n                    def.model.set({\n                        commandName: 'heading',\n                        commandValue: option.model\n                    });\n                }\n                // Add the option to the collection.\n                itemDefinitions.add(def);\n                titles[option.model] = option.title;\n            }\n            const dropdownView = createDropdown(locale);\n            addListToDropdown(dropdownView, itemDefinitions, {\n                ariaLabel: accessibleLabel,\n                role: 'menu'\n            });\n            dropdownView.buttonView.set({\n                ariaLabel: accessibleLabel,\n                ariaLabelledBy: undefined,\n                isOn: false,\n                withText: true,\n                tooltip: accessibleLabel\n            });\n            dropdownView.extendTemplate({\n                attributes: {\n                    class: [\n                        'ck-heading-dropdown'\n                    ]\n                }\n            });\n            dropdownView.bind('isEnabled').toMany(commands, 'isEnabled', (...areEnabled) => {\n                return areEnabled.some(isEnabled => isEnabled);\n            });\n            dropdownView.buttonView.bind('label').to(headingCommand, 'value', paragraphCommand, 'value', (heading, paragraph) => {\n                const whichModel = paragraph ? 'paragraph' : heading;\n                if (typeof whichModel === 'boolean') {\n                    return defaultTitle;\n                }\n                // If none of the commands is active, display default title.\n                if (!titles[whichModel]) {\n                    return defaultTitle;\n                }\n                return titles[whichModel];\n            });\n            dropdownView.buttonView.bind('ariaLabel').to(headingCommand, 'value', paragraphCommand, 'value', (heading, paragraph) => {\n                const whichModel = paragraph ? 'paragraph' : heading;\n                if (typeof whichModel === 'boolean') {\n                    return accessibleLabel;\n                }\n                // If none of the commands is active, display default title.\n                if (!titles[whichModel]) {\n                    return accessibleLabel;\n                }\n                return `${titles[whichModel]}, ${accessibleLabel}`;\n            });\n            // Execute command when an item from the dropdown is selected.\n            this.listenTo(dropdownView, 'execute', evt => {\n                const { commandName, commandValue } = evt.source;\n                editor.execute(commandName, commandValue ? { value: commandValue } : undefined);\n                editor.editing.view.focus();\n            });\n            return dropdownView;\n        });\n        editor.ui.componentFactory.add('menuBar:heading', locale => {\n            const menuView = new MenuBarMenuView(locale);\n            const headingCommand = editor.commands.get('heading');\n            const paragraphCommand = editor.commands.get('paragraph');\n            const commands = [headingCommand];\n            const listView = new MenuBarMenuListView(locale);\n            menuView.set({\n                class: 'ck-heading-dropdown'\n            });\n            listView.set({\n                ariaLabel: t('Heading'),\n                role: 'menu'\n            });\n            menuView.buttonView.set({\n                label: t('Heading')\n            });\n            menuView.panelView.children.add(listView);\n            for (const option of options) {\n                const listItemView = new MenuBarMenuListItemView(locale, menuView);\n                const buttonView = new MenuBarMenuListItemButtonView(locale);\n                listItemView.children.add(buttonView);\n                listView.items.add(listItemView);\n                buttonView.set({\n                    isToggleable: true,\n                    label: option.title,\n                    role: 'menuitemradio',\n                    class: option.class\n                });\n                buttonView.delegate('execute').to(menuView);\n                buttonView.on('execute', () => {\n                    const commandName = option.model === 'paragraph' ? 'paragraph' : 'heading';\n                    editor.execute(commandName, { value: option.model });\n                    editor.editing.view.focus();\n                });\n                if (option.model === 'paragraph') {\n                    buttonView.bind('isOn').to(paragraphCommand, 'value');\n                    commands.push(paragraphCommand);\n                }\n                else {\n                    buttonView.bind('isOn').to(headingCommand, 'value', value => value === option.model);\n                }\n            }\n            menuView.bind('isEnabled').toMany(commands, 'isEnabled', (...areEnabled) => {\n                return areEnabled.some(isEnabled => isEnabled);\n            });\n            return menuView;\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns heading options as defined in `config.heading.options` but processed to consider\n * the editor localization, i.e. to display {@link module:heading/headingconfig~HeadingOption}\n * in the correct language.\n *\n * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}\n * when the user configuration is defined because the editor does not exist yet.\n *\n * @internal\n */\nexport function getLocalizedOptions(editor) {\n    const t = editor.t;\n    const localizedTitles = {\n        'Paragraph': t('Paragraph'),\n        'Heading 1': t('Heading 1'),\n        'Heading 2': t('Heading 2'),\n        'Heading 3': t('Heading 3'),\n        'Heading 4': t('Heading 4'),\n        'Heading 5': t('Heading 5'),\n        'Heading 6': t('Heading 6')\n    };\n    return editor.config.get('heading.options').map(option => {\n        const title = localizedTitles[option.title];\n        if (title && title != option.title) {\n            option.title = title;\n        }\n        return option;\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagetextalternative/imagetextalternativecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The image text alternative command. It is used to change the `alt` attribute of `<imageBlock>` and `<imageInline>` model elements.\n */\nexport class ImageTextAlternativeCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const element = imageUtils.getClosestSelectedImageElement(this.editor.model.document.selection);\n        this.isEnabled = !!element;\n        if (this.isEnabled && element.hasAttribute('alt')) {\n            this.value = element.getAttribute('alt');\n        }\n        else {\n            this.value = false;\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options\n     * @param options.newValue The new value of the `alt` attribute to set.\n     */\n    execute(options) {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const model = editor.model;\n        const imageElement = imageUtils.getClosestSelectedImageElement(model.document.selection);\n        model.change(writer => {\n            writer.setAttribute('alt', options.newValue, imageElement);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * Creates a view element representing the inline image.\n *\n * ```html\n * <span class=\"image-inline\"><img></img></span>\n * ```\n *\n * Note that `alt` and `src` attributes are converted separately, so they are not included.\n *\n * @internal\n */\nexport function createInlineImageViewElement(writer) {\n    return writer.createContainerElement('span', { class: 'image-inline' }, writer.createEmptyElement('img'));\n}\n/**\n * Creates a view element representing the block image.\n *\n * ```html\n * <figure class=\"image\"><img></img></figure>\n * ```\n *\n * Note that `alt` and `src` attributes are converted separately, so they are not included.\n *\n * @internal\n */\nexport function createBlockImageViewElement(writer) {\n    return writer.createContainerElement('figure', { class: 'image' }, [\n        writer.createEmptyElement('img'),\n        writer.createSlot('children')\n    ]);\n}\n/**\n * A function returning a `MatcherPattern` for a particular type of View images.\n *\n * @internal\n * @param matchImageType The type of created image.\n */\nexport function getImgViewElementMatcher(editor, matchImageType) {\n    const imageUtils = editor.plugins.get('ImageUtils');\n    const areBothImagePluginsLoaded = editor.plugins.has('ImageInlineEditing') && editor.plugins.has('ImageBlockEditing');\n    return element => {\n        // Check if the matched view element is an <img>.\n        if (!imageUtils.isInlineImageView(element)) {\n            return null;\n        }\n        // If just one of the plugins is loaded (block or inline), it will match all kinds of images.\n        if (!areBothImagePluginsLoaded) {\n            return getPositiveMatchPattern(element);\n        }\n        // The <img> can be standalone, wrapped in <figure>...</figure> (ImageBlock plugin) or\n        // wrapped in <figure><a>...</a></figure> (LinkImage plugin).\n        const imageType = element.getStyle('display') == 'block' || element.findAncestor(imageUtils.isBlockImageView) ?\n            'imageBlock' :\n            'imageInline';\n        if (imageType !== matchImageType) {\n            return null;\n        }\n        return getPositiveMatchPattern(element);\n    };\n    function getPositiveMatchPattern(element) {\n        const pattern = {\n            name: true\n        };\n        // This will trigger src consumption (See https://github.com/ckeditor/ckeditor5/issues/11530).\n        if (element.hasAttribute('src')) {\n            pattern.attributes = ['src'];\n        }\n        return pattern;\n    }\n}\n/**\n * Considering the current model selection, it returns the name of the model image element\n * (`'imageBlock'` or `'imageInline'`) that will make most sense from the UX perspective if a new\n * image was inserted (also: uploaded, dropped, pasted) at that selection.\n *\n * The assumption is that inserting images into empty blocks or on other block widgets should\n * produce block images. Inline images should be inserted in other cases, e.g. in paragraphs\n * that already contain some text.\n *\n * @internal\n */\nexport function determineImageTypeForInsertionAtSelection(schema, selection) {\n    const firstBlock = first(selection.getSelectedBlocks());\n    // Insert a block image if the selection is not in/on block elements or it's on a block widget.\n    if (!firstBlock || schema.isObject(firstBlock)) {\n        return 'imageBlock';\n    }\n    // A block image should also be inserted into an empty block element\n    // (that is not an empty list item so the list won't get split).\n    if (firstBlock.isEmpty && firstBlock.name != 'listItem') {\n        return 'imageBlock';\n    }\n    // Otherwise insert an inline image.\n    return 'imageInline';\n}\n/**\n * Returns parsed value of the size, but only if it contains unit: px.\n *\n * @internal\n */\nexport function getSizeValueIfInPx(size) {\n    if (size && size.endsWith('px')) {\n        return parseInt(size);\n    }\n    return null;\n}\n/**\n * Returns true if both styles (width and height) are set.\n *\n * If both image styles: width & height are set, they will override the image width & height attributes in the\n * browser. In this case, the image looks the same as if these styles were applied to attributes instead of styles.\n * That's why we can upcast these styles to width & height attributes instead of resizedWidth and resizedHeight.\n *\n * @internal\n */\nexport function widthAndHeightStylesAreBothSet(viewElement) {\n    const widthStyle = getSizeValueIfInPx(viewElement.getStyle('width'));\n    const heightStyle = getSizeValueIfInPx(viewElement.getStyle('height'));\n    return !!(widthStyle && heightStyle);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { findOptimalInsertionRange, isWidget, toWidget } from 'ckeditor5/src/widget.js';\nimport { determineImageTypeForInsertionAtSelection } from './image/utils.js';\nimport { DomEmitterMixin, global } from 'ckeditor5/src/utils.js';\nconst IMAGE_WIDGETS_CLASSES_MATCH_REGEXP = /^(image|image-inline)$/;\n/**\n * A set of helpers related to images.\n */\nexport class ImageUtils extends Plugin {\n    /**\n     * DOM Emitter.\n     */\n    _domEmitter = new (DomEmitterMixin())();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Checks if the provided model element is an `image` or `imageInline`.\n     */\n    isImage(modelElement) {\n        return this.isInlineImage(modelElement) || this.isBlockImage(modelElement);\n    }\n    /**\n     * Checks if the provided view element represents an inline image.\n     *\n     * Also, see {@link module:image/imageutils~ImageUtils#isImageWidget}.\n     */\n    isInlineImageView(element) {\n        return !!element && element.is('element', 'img');\n    }\n    /**\n     * Checks if the provided view element represents a block image.\n     *\n     * Also, see {@link module:image/imageutils~ImageUtils#isImageWidget}.\n     */\n    isBlockImageView(element) {\n        return !!element && element.is('element', 'figure') && element.hasClass('image');\n    }\n    /**\n     * Handles inserting single file. This method unifies image insertion using {@link module:widget/utils~findOptimalInsertionRange}\n     * method.\n     *\n     * ```ts\n     * const imageUtils = editor.plugins.get( 'ImageUtils' );\n     *\n     * imageUtils.insertImage( { src: 'path/to/image.jpg' } );\n     * ```\n     *\n     * @param attributes Attributes of the inserted image.\n     * This method filters out the attributes which are disallowed by the {@link module:engine/model/schema~ModelSchema}.\n     * @param selectable Place to insert the image. If not specified,\n     * the {@link module:widget/utils~findOptimalInsertionRange} logic will be applied for the block images\n     * and `model.document.selection` for the inline images.\n     *\n     * **Note**: If `selectable` is passed, this helper will not be able to set selection attributes (such as `linkHref`)\n     * and apply them to the new image. In this case, make sure all selection attributes are passed in `attributes`.\n     *\n     * @param imageType Image type of inserted image. If not specified,\n     * it will be determined automatically depending of editor config or place of the insertion.\n     * @param options.setImageSizes Specifies whether the image `width` and `height` attributes should be set automatically.\n     * The default is `true`.\n     * @return The inserted model image element.\n     */\n    insertImage(attributes = {}, selectable = null, imageType = null, options = {}) {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const determinedImageType = determineImageTypeForInsertion(editor, selectable || selection, imageType);\n        // Mix declarative attributes with selection attributes because the new image should \"inherit\"\n        // the latter for best UX. For instance, inline images inserted into existing links\n        // should not split them. To do that, they need to have \"linkHref\" inherited from the selection.\n        attributes = {\n            ...Object.fromEntries(selection.getAttributes()),\n            ...attributes\n        };\n        for (const attributeName in attributes) {\n            if (!model.schema.checkAttribute(determinedImageType, attributeName)) {\n                delete attributes[attributeName];\n            }\n        }\n        return model.change(writer => {\n            const { setImageSizes = true } = options;\n            const imageElement = writer.createElement(determinedImageType, attributes);\n            model.insertObject(imageElement, selectable, null, {\n                setSelection: 'on',\n                // If we want to insert a block image (for whatever reason) then we don't want to split text blocks.\n                // This applies only when we don't have the selectable specified (i.e., we insert multiple block images at once).\n                findOptimalPosition: !selectable && determinedImageType != 'imageInline' ? 'auto' : undefined\n            });\n            // Inserting an image might've failed due to schema regulations.\n            if (imageElement.parent) {\n                if (setImageSizes) {\n                    this.setImageNaturalSizeAttributes(imageElement);\n                }\n                return imageElement;\n            }\n            return null;\n        });\n    }\n    /**\n     * Reads original image sizes and sets them as `width` and `height`.\n     *\n     * The `src` attribute may not be available if the user is using an upload adapter. In such a case,\n     * this method is called again after the upload process is complete and the `src` attribute is available.\n     */\n    setImageNaturalSizeAttributes(imageElement) {\n        const src = imageElement.getAttribute('src');\n        if (!src) {\n            return;\n        }\n        if (imageElement.getAttribute('width') || imageElement.getAttribute('height')) {\n            return;\n        }\n        this.editor.model.change(writer => {\n            const img = new global.window.Image();\n            this._domEmitter.listenTo(img, 'load', () => {\n                if (!imageElement.getAttribute('width') && !imageElement.getAttribute('height')) {\n                    // We use writer.batch to be able to undo (in a single step) width and height setting\n                    // along with any change that triggered this action (e.g. image resize or image style change).\n                    this.editor.model.enqueueChange(writer.batch, writer => {\n                        writer.setAttribute('width', img.naturalWidth, imageElement);\n                        writer.setAttribute('height', img.naturalHeight, imageElement);\n                    });\n                }\n                this._domEmitter.stopListening(img, 'load');\n            });\n            img.src = src;\n        });\n    }\n    /**\n     * Returns an image widget editing view element if one is selected or is among the selection's ancestors.\n     */\n    getClosestSelectedImageWidget(selection) {\n        const selectionPosition = selection.getFirstPosition();\n        if (!selectionPosition) {\n            return null;\n        }\n        const viewElement = selection.getSelectedElement();\n        if (viewElement && this.isImageWidget(viewElement)) {\n            return viewElement;\n        }\n        let parent = selectionPosition.parent;\n        while (parent) {\n            if (parent.is('element') && this.isImageWidget(parent)) {\n                return parent;\n            }\n            parent = parent.parent;\n        }\n        return null;\n    }\n    /**\n     * Returns a image model element if one is selected or is among the selection's ancestors.\n     */\n    getClosestSelectedImageElement(selection) {\n        const selectedElement = selection.getSelectedElement();\n        return this.isImage(selectedElement) ? selectedElement : selection.getFirstPosition().findAncestor('imageBlock');\n    }\n    /**\n     * Returns an image widget editing view based on the passed image view.\n     */\n    getImageWidgetFromImageView(imageView) {\n        return imageView.findAncestor({ classes: IMAGE_WIDGETS_CLASSES_MATCH_REGEXP });\n    }\n    /**\n     * Checks if image can be inserted at current model selection.\n     *\n     * @internal\n     */\n    isImageAllowed() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        return isImageAllowedInParent(this.editor, selection) && isNotInsideImage(selection);\n    }\n    /**\n     * Converts a given {@link module:engine/view/element~ViewElement} to an image widget:\n     * * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property} allowing to recognize the image widget\n     * element.\n     * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.\n     *\n     * @param writer An instance of the view writer.\n     * @param label The element's label. It will be concatenated with the image `alt` attribute if one is present.\n     */\n    toImageWidget(viewElement, writer, label) {\n        writer.setCustomProperty('image', true, viewElement);\n        const labelCreator = () => {\n            const imgElement = this.findViewImgElement(viewElement);\n            const altText = imgElement.getAttribute('alt');\n            return altText ? `${altText} ${label}` : label;\n        };\n        return toWidget(viewElement, writer, { label: labelCreator });\n    }\n    /**\n     * Checks if a given view element is an image widget.\n     */\n    isImageWidget(viewElement) {\n        return !!viewElement.getCustomProperty('image') && isWidget(viewElement);\n    }\n    /**\n     * Checks if the provided model element is an `image`.\n     */\n    isBlockImage(modelElement) {\n        return !!modelElement && modelElement.is('element', 'imageBlock');\n    }\n    /**\n     * Checks if the provided model element is an `imageInline`.\n     */\n    isInlineImage(modelElement) {\n        return !!modelElement && modelElement.is('element', 'imageInline');\n    }\n    /**\n     * Get the view `<img>` from another view element, e.g. a widget (`<figure class=\"image\">`), a link (`<a>`).\n     *\n     * The `<img>` can be located deep in other elements, so this helper performs a deep tree search.\n     */\n    findViewImgElement(figureView) {\n        if (this.isInlineImageView(figureView)) {\n            return figureView;\n        }\n        const editingView = this.editor.editing.view;\n        for (const { item } of editingView.createRangeIn(figureView)) {\n            if (this.isInlineImageView(item)) {\n                return item;\n            }\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        this._domEmitter.stopListening();\n        return super.destroy();\n    }\n}\n/**\n * Checks if image is allowed by schema in optimal insertion parent.\n */\nfunction isImageAllowedInParent(editor, selection) {\n    const imageType = determineImageTypeForInsertion(editor, selection, null);\n    if (imageType == 'imageBlock') {\n        const parent = getInsertImageParent(selection, editor.model);\n        if (editor.model.schema.checkChild(parent, 'imageBlock')) {\n            return true;\n        }\n    }\n    else if (editor.model.schema.checkChild(selection.focus, 'imageInline')) {\n        return true;\n    }\n    return false;\n}\n/**\n * Checks if selection is not placed inside an image (e.g. its caption).\n */\nfunction isNotInsideImage(selection) {\n    return [...selection.focus.getAncestors()].every(ancestor => !ancestor.is('element', 'imageBlock'));\n}\n/**\n * Returns a node that will be used to insert image with `model.insertContent`.\n */\nfunction getInsertImageParent(selection, model) {\n    const insertionRange = findOptimalInsertionRange(selection, model);\n    const parent = insertionRange.start.parent;\n    if (parent.isEmpty && !parent.is('element', '$root')) {\n        return parent.parent;\n    }\n    return parent;\n}\n/**\n * Determine image element type name depending on editor config or place of insertion.\n *\n * @param imageType Image element type name. Used to force return of provided element name,\n * but only if there is proper plugin enabled.\n */\nfunction determineImageTypeForInsertion(editor, selectable, imageType) {\n    const schema = editor.model.schema;\n    const configImageInsertType = editor.config.get('image.insert.type');\n    if (!editor.plugins.has('ImageBlockEditing')) {\n        return 'imageInline';\n    }\n    if (!editor.plugins.has('ImageInlineEditing')) {\n        return 'imageBlock';\n    }\n    if (imageType) {\n        return imageType;\n    }\n    if (configImageInsertType === 'inline') {\n        return 'imageInline';\n    }\n    if (configImageInsertType !== 'auto') {\n        return 'imageBlock';\n    }\n    // Try to replace the selected widget (e.g. another image).\n    if (selectable.is('selection')) {\n        return determineImageTypeForInsertionAtSelection(schema, selectable);\n    }\n    return schema.checkChild(selectable, 'imageInline') ? 'imageInline' : 'imageBlock';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagetextalternative/imagetextalternativeediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageTextAlternativeCommand } from './imagetextalternativecommand.js';\nimport { ImageUtils } from '../imageutils.js';\n/**\n * The image text alternative editing plugin.\n *\n * Registers the `'imageTextAlternative'` command.\n */\nexport class ImageTextAlternativeEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageTextAlternativeEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this.editor.commands.add('imageTextAlternative', new ImageTextAlternativeCommand(this.editor));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * A mixin that brings the possibility to temporarily disable CSS transitions using\n * {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen\n * when the view is first displayed but they should work normal in other cases.\n *\n * The methods to control the CSS transitions are:\n * * `disableCssTransitions()` – Adds the `.ck-transitions-disabled` class to the\n * {@link module:ui/view~View#element view element}.\n * * `enableCssTransitions()` – Removes the `.ck-transitions-disabled` class from the\n * {@link module:ui/view~View#element view element}.\n *\n * The usage comes down to:\n *\n * ```ts\n * const MyViewWithCssTransitionDisabler = CssTransitionDisablerMixin( MyView );\n * const view = new MyViewWithCssTransitionDisabler();\n *\n * // ...\n *\n * view.disableCssTransitions();\n * view.show();\n * view.enableCssTransitions();\n * ```\n *\n * @param view View instance that should get this functionality.\n */\nexport function CssTransitionDisablerMixin(view) {\n    class Mixin extends view {\n        disableCssTransitions() {\n            this._isCssTransitionsDisabled = true;\n        }\n        enableCssTransitions() {\n            this._isCssTransitionsDisabled = false;\n        }\n        constructor(...args) {\n            super(...args);\n            this.set('_isCssTransitionsDisabled', false);\n            this.initializeCssTransitionDisablerMixin();\n        }\n        initializeCssTransitionDisablerMixin() {\n            if (this.template) {\n                this.extendTemplate({\n                    attributes: {\n                        class: [\n                            this.bindTemplate.if('_isCssTransitionsDisabled', 'ck-transitions-disabled')\n                        ]\n                    }\n                });\n            }\n        }\n    }\n    return Mixin;\n}\n;\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/formrow/formrowview\n */\nimport { View } from '../view.js';\nimport { toArray } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/formrow/formrow.css';\n/**\n * The class representing a single row in a form,\n */\nexport class FormRowView extends View {\n    /**\n     * A collection of row items (buttons, dropdowns, etc.).\n     */\n    children;\n    /**\n     * Creates an instance of the form row class.\n     *\n     * @param locale The locale instance.\n     * @param options.labelView When passed, the row gets the `group` and `aria-labelledby`\n     * DOM attributes and gets described by the label.\n     */\n    constructor(locale, options = {}) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('class', [\n            'ck',\n            'ck-form__row',\n            ...toArray(options.class || [])\n        ]);\n        this.children = this.createCollection();\n        if (options.children) {\n            options.children.forEach(child => this.children.add(child));\n        }\n        this.set('_role', null);\n        this.set('_ariaLabelledBy', null);\n        if (options.labelView) {\n            this.set({\n                _role: 'group',\n                _ariaLabelledBy: options.labelView.id\n            });\n        }\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: bind.to('class', classes => classes.join(' ')),\n                role: bind.to('_role'),\n                'aria-labelledby': bind.to('_ariaLabelledBy')\n            },\n            children: this.children\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * A handler useful for {@link module:ui/view~View views} working as HTML forms. It intercepts a native DOM\n * `submit` event, prevents the default web browser behavior (navigation and page reload) and\n * fires the `submit` event on a view instead. Such a custom event can be then used by any\n * {@link module:utils/dom/emittermixin~DomEmitter emitter}, e.g. to serialize the form data.\n *\n * ```ts\n * import { submitHandler } from '@ckeditor/ckeditor5-ui/src/bindings/submithandler';\n *\n * // ...\n *\n * class AnyFormView extends View {\n * \tconstructor() {\n * \t\tsuper();\n *\n * \t\t// ...\n *\n * \t\tsubmitHandler( {\n * \t\t\tview: this\n * \t\t} );\n * \t}\n * }\n *\n * // ...\n *\n * const view = new AnyFormView();\n *\n * // A sample listener attached by an emitter working with the view.\n * this.listenTo( view, 'submit', () => {\n * \tsaveTheFormData();\n * \thideTheForm();\n * } );\n * ```\n *\n * @param options Configuration options.\n * @param options.view The view which DOM `submit` events should be handled.\n */\nexport function submitHandler({ view }) {\n    view.listenTo(view.element, 'submit', (evt, domEvt) => {\n        domEvt.preventDefault();\n        view.fire('submit');\n    }, { useCapture: true });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/labeledfield/labeledfieldview\n */\nimport { View } from '../view.js';\nimport { LabelView } from '../label/labelview.js';\nimport { uid } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/labeledfield/labeledfieldview.css';\n/**\n * The labeled field view class. It can be used to enhance any view with the following features:\n *\n * * a label,\n * * (optional) an error message,\n * * (optional) an info (status) text,\n *\n * all bound logically by proper DOM attributes for UX and accessibility.  It also provides an interface\n * (e.g. observable properties) that allows controlling those additional features.\n *\n * The constructor of this class requires a callback that returns a view to be labeled. The callback\n * is called with unique ids that allow binding of DOM properties:\n *\n * ```ts\n * const labeledInputView = new LabeledFieldView( locale, ( labeledFieldView, viewUid, statusUid ) => {\n * \tconst inputView = new InputTextView( labeledFieldView.locale );\n *\n * \tinputView.set( {\n * \t\tid: viewUid,\n * \t\tariaDescribedById: statusUid\n * \t} );\n *\n * \tinputView.bind( 'isReadOnly' ).to( labeledFieldView, 'isEnabled', value => !value );\n * \tinputView.bind( 'hasError' ).to( labeledFieldView, 'errorText', value => !!value );\n *\n * \treturn inputView;\n * } );\n *\n * labeledInputView.label = 'User name';\n * labeledInputView.infoText = 'Full name like for instance, John Doe.';\n * labeledInputView.render();\n *\n * document.body.append( labeledInputView.element );\n * ```\n *\n * See {@link module:ui/labeledfield/utils} to discover ready–to–use labeled input helpers for common\n * UI components.\n */\nexport class LabeledFieldView extends View {\n    /**\n     * The field view that gets labeled.\n     */\n    fieldView;\n    /**\n     * The label view instance that describes the entire view.\n     */\n    labelView;\n    /**\n     * The status view for the {@link #fieldView}. It displays {@link #errorText} and\n     * {@link #infoText}.\n     */\n    statusView;\n    /**\n     * A collection of children of the internal wrapper element. Allows inserting additional DOM elements (views) next to\n     * the {@link #fieldView} for easy styling (e.g. positioning).\n     *\n     * By default, the collection contains {@link #fieldView} and {@link #labelView}.\n     */\n    fieldWrapperChildren;\n    /**\n     * Creates an instance of the labeled field view class using a provided creator function\n     * that provides the view to be labeled.\n     *\n     * @param locale The locale instance.\n     * @param viewCreator A function that returns a {@link module:ui/view~View}\n     * that will be labeled. The following arguments are passed to the creator function:\n     *\n     * * an instance of the `LabeledFieldView` to allow binding observable properties,\n     * * an UID string that connects the {@link #labelView label} and the labeled field view in DOM,\n     * * an UID string that connects the {@link #statusView status} and the labeled field view in DOM.\n     */\n    constructor(locale, viewCreator) {\n        super(locale);\n        const viewUid = `ck-labeled-field-view-${uid()}`;\n        const statusUid = `ck-labeled-field-view-status-${uid()}`;\n        this.fieldView = viewCreator(this, viewUid, statusUid);\n        this.set('label', undefined);\n        this.set('isEnabled', true);\n        this.set('isEmpty', true);\n        this.set('isFocused', false);\n        this.set('errorText', null);\n        this.set('infoText', null);\n        this.set('class', undefined);\n        this.set('placeholder', undefined);\n        this.labelView = this._createLabelView(viewUid);\n        this.statusView = this._createStatusView(statusUid);\n        this.fieldWrapperChildren = this.createCollection([this.fieldView, this.labelView]);\n        this.bind('_statusText').to(this, 'errorText', this, 'infoText', (errorText, infoText) => errorText || infoText);\n        const bind = this.bindTemplate;\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-labeled-field-view',\n                    bind.to('class'),\n                    bind.if('isEnabled', 'ck-disabled', value => !value),\n                    bind.if('isEmpty', 'ck-labeled-field-view_empty'),\n                    bind.if('isFocused', 'ck-labeled-field-view_focused'),\n                    bind.if('placeholder', 'ck-labeled-field-view_placeholder'),\n                    bind.if('errorText', 'ck-error')\n                ]\n            },\n            children: [\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-labeled-field-view__input-wrapper'\n                        ]\n                    },\n                    children: this.fieldWrapperChildren\n                },\n                this.statusView\n            ]\n        });\n    }\n    /**\n     * Creates label view class instance and bind with view.\n     *\n     * @param id Unique id to set as labelView#for attribute.\n     */\n    _createLabelView(id) {\n        const labelView = new LabelView(this.locale);\n        labelView.for = id;\n        labelView.bind('text').to(this, 'label');\n        return labelView;\n    }\n    /**\n     * Creates the status view instance. It displays {@link #errorText} and {@link #infoText}\n     * next to the {@link #fieldView}. See {@link #_statusText}.\n     *\n     * @param statusUid Unique id of the status, shared with the {@link #fieldView view's}\n     * `aria-describedby` attribute.\n     */\n    _createStatusView(statusUid) {\n        const statusView = new View(this.locale);\n        const bind = this.bindTemplate;\n        statusView.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-labeled-field-view__status',\n                    bind.if('errorText', 'ck-labeled-field-view__status_error'),\n                    bind.if('_statusText', 'ck-hidden', value => !value)\n                ],\n                id: statusUid,\n                role: bind.if('errorText', 'alert')\n            },\n            children: [\n                {\n                    text: bind.to('_statusText')\n                }\n            ]\n        });\n        return statusView;\n    }\n    /**\n     * Focuses the {@link #fieldView}.\n     */\n    focus(direction) {\n        this.fieldView.focus(direction);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/input/inputbase\n */\nimport { View } from '../view.js';\nimport { FocusTracker } from '@ckeditor/ckeditor5-utils';\n/**\n * The base input view class.\n */\nexport class InputBase extends View {\n    /**\n     * Stores information about the editor UI focus and propagates it so various plugins and components\n     * are unified as a focus group.\n     */\n    focusTracker;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.set('value', undefined);\n        this.set('id', undefined);\n        this.set('placeholder', undefined);\n        this.set('tabIndex', undefined);\n        this.set('isReadOnly', false);\n        this.set('hasError', false);\n        this.set('ariaDescribedById', undefined);\n        this.set('ariaLabel', undefined);\n        this.focusTracker = new FocusTracker();\n        this.bind('isFocused').to(this.focusTracker);\n        this.set('isEmpty', true);\n        const bind = this.bindTemplate;\n        this.setTemplate({\n            tag: 'input',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-input',\n                    bind.if('isFocused', 'ck-input_focused'),\n                    bind.if('isEmpty', 'ck-input-text_empty'),\n                    bind.if('hasError', 'ck-error')\n                ],\n                id: bind.to('id'),\n                placeholder: bind.to('placeholder'),\n                tabindex: bind.to('tabIndex'),\n                readonly: bind.to('isReadOnly'),\n                'aria-invalid': bind.if('hasError', true),\n                'aria-describedby': bind.to('ariaDescribedById'),\n                'aria-label': bind.to('ariaLabel')\n            },\n            on: {\n                input: bind.to((...args) => {\n                    this.fire('input', ...args);\n                    this._updateIsEmpty();\n                }),\n                change: bind.to(this._updateIsEmpty.bind(this))\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.focusTracker.add(this.element);\n        this._setDomElementValue(this.value);\n        this._updateIsEmpty();\n        // Bind `this.value` to the DOM element's value.\n        // We cannot use `value` DOM attribute because removing it on Edge does not clear the DOM element's value property.\n        this.on('change:value', (evt, name, value) => {\n            this._setDomElementValue(value);\n            this._updateIsEmpty();\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n    }\n    /**\n     * Moves the focus to the input and selects the value.\n     */\n    select() {\n        this.element.select();\n    }\n    /**\n     * Focuses the input.\n     */\n    focus() {\n        this.element.focus();\n    }\n    /**\n     * Resets the value of the input\n     */\n    reset() {\n        this.value = this.element.value = '';\n        this._updateIsEmpty();\n    }\n    /**\n     * Updates the {@link #isEmpty} property value on demand.\n     */\n    _updateIsEmpty() {\n        this.isEmpty = isInputElementEmpty(this.element);\n    }\n    /**\n     * Sets the `value` property of the {@link #element DOM element} on demand.\n     */\n    _setDomElementValue(value) {\n        this.element.value = (!value && value !== 0) ? '' : value;\n    }\n}\nfunction isInputElementEmpty(domElement) {\n    return !domElement.value;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { InputBase } from './inputbase.js';\nimport '../../theme/components/input/input.css';\n/**\n * The input view class.\n */\nexport class InputView extends InputBase {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.set('inputMode', 'text');\n        const bind = this.bindTemplate;\n        this.extendTemplate({\n            attributes: {\n                inputmode: bind.to('inputMode')\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/inputtext/inputtextview\n */\nimport { InputView } from '../input/inputview.js';\n/**\n * The text input view class.\n */\nexport class InputTextView extends InputView {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.extendTemplate({\n            attributes: {\n                type: 'text',\n                class: [\n                    'ck-input-text'\n                ]\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/inputnumber/inputnumberview\n */\nimport { InputView } from '../input/inputview.js';\n/**\n * The number input view class.\n */\nexport class InputNumberView extends InputView {\n    /**\n     * Creates an instance of the input number view.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param options The options of the input.\n     * @param options.min The value of the `min` DOM attribute (the lowest accepted value).\n     * @param options.max The value of the `max` DOM attribute (the highest accepted value).\n     * @param options.step The value of the `step` DOM attribute.\n     */\n    constructor(locale, { min, max, step } = {}) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('min', min);\n        this.set('max', max);\n        this.set('step', step);\n        this.extendTemplate({\n            attributes: {\n                type: 'number',\n                class: [\n                    'ck-input-number'\n                ],\n                min: bind.to('min'),\n                max: bind.to('max'),\n                step: bind.to('step')\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/labeledfield/utils\n */\nimport { InputTextView } from '../inputtext/inputtextview.js';\nimport { InputNumberView } from '../inputnumber/inputnumberview.js';\nimport { TextareaView } from '../textarea/textareaview.js';\nimport { createDropdown } from '../dropdown/utils.js';\n/**\n * A helper for creating labeled inputs.\n *\n * It creates an instance of a {@link module:ui/inputtext/inputtextview~InputTextView input text} that is\n * logically related to a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled view} in DOM.\n *\n * The helper does the following:\n *\n * * It sets input's `id` and `ariaDescribedById` attributes.\n * * It binds input's `isReadOnly` to the labeled view.\n * * It binds input's `hasError` to the labeled view.\n * * It enables a logic that cleans up the error when user starts typing in the input.\n *\n * Usage:\n *\n * ```ts\n * const labeledInputView = new LabeledFieldView( locale, createLabeledInputText );\n * console.log( labeledInputView.fieldView ); // A text input instance.\n * ```\n *\n * @param labeledFieldView The instance of the labeled field view.\n * @param viewUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#labelView labeled view's label} and the input.\n * @param statusUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#statusView labeled view's status} and the input.\n * @returns The input text view instance.\n */\nconst createLabeledInputText = (labeledFieldView, viewUid, statusUid) => {\n    const inputView = new InputTextView(labeledFieldView.locale);\n    inputView.set({\n        id: viewUid,\n        ariaDescribedById: statusUid\n    });\n    inputView.bind('isReadOnly').to(labeledFieldView, 'isEnabled', value => !value);\n    inputView.bind('hasError').to(labeledFieldView, 'errorText', value => !!value);\n    inputView.on('input', () => {\n        // UX: Make the error text disappear and disable the error indicator as the user\n        // starts fixing the errors.\n        labeledFieldView.errorText = null;\n    });\n    labeledFieldView.bind('isEmpty', 'isFocused', 'placeholder').to(inputView);\n    return inputView;\n};\n/**\n * A helper for creating labeled number inputs.\n *\n * It creates an instance of a {@link module:ui/inputnumber/inputnumberview~InputNumberView input number} that is\n * logically related to a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled view} in DOM.\n *\n * The helper does the following:\n *\n * * It sets input's `id` and `ariaDescribedById` attributes.\n * * It binds input's `isReadOnly` to the labeled view.\n * * It binds input's `hasError` to the labeled view.\n * * It enables a logic that cleans up the error when user starts typing in the input.\n *\n * Usage:\n *\n * ```ts\n * const labeledInputView = new LabeledFieldView( locale, createLabeledInputNumber );\n * console.log( labeledInputView.fieldView ); // A number input instance.\n * ```\n *\n * @param labeledFieldView The instance of the labeled field view.\n * @param viewUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#labelView labeled view's label} and the input.\n * @param statusUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#statusView labeled view's status} and the input.\n * @returns The input number view instance.\n */\nconst createLabeledInputNumber = (labeledFieldView, viewUid, statusUid) => {\n    const inputView = new InputNumberView(labeledFieldView.locale);\n    inputView.set({\n        id: viewUid,\n        ariaDescribedById: statusUid,\n        inputMode: 'numeric'\n    });\n    inputView.bind('isReadOnly').to(labeledFieldView, 'isEnabled', value => !value);\n    inputView.bind('hasError').to(labeledFieldView, 'errorText', value => !!value);\n    inputView.on('input', () => {\n        // UX: Make the error text disappear and disable the error indicator as the user\n        // starts fixing the errors.\n        labeledFieldView.errorText = null;\n    });\n    labeledFieldView.bind('isEmpty', 'isFocused', 'placeholder').to(inputView);\n    return inputView;\n};\n/**\n * A helper for creating labeled textarea.\n *\n * It creates an instance of a {@link module:ui/textarea/textareaview~TextareaView textarea} that is\n * logically related to a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled view} in DOM.\n *\n * The helper does the following:\n *\n * * It sets textarea's `id` and `ariaDescribedById` attributes.\n * * It binds textarea's `isReadOnly` to the labeled view.\n * * It binds textarea's `hasError` to the labeled view.\n * * It enables a logic that cleans up the error when user starts typing in the textarea.\n *\n * Usage:\n *\n * ```ts\n * const labeledTextarea = new LabeledFieldView( locale, createLabeledTextarea );\n * console.log( labeledTextarea.fieldView ); // A textarea instance.\n * ```\n *\n * @param labeledFieldView The instance of the labeled field view.\n * @param viewUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#labelView labeled view's label} and the textarea.\n * @param statusUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#statusView labeled view's status} and the textarea.\n * @returns The textarea view instance.\n */\nconst createLabeledTextarea = (labeledFieldView, viewUid, statusUid) => {\n    const textareaView = new TextareaView(labeledFieldView.locale);\n    textareaView.set({\n        id: viewUid,\n        ariaDescribedById: statusUid\n    });\n    textareaView.bind('isReadOnly').to(labeledFieldView, 'isEnabled', value => !value);\n    textareaView.bind('hasError').to(labeledFieldView, 'errorText', value => !!value);\n    textareaView.on('input', () => {\n        // UX: Make the error text disappear and disable the error indicator as the user\n        // starts fixing the errors.\n        labeledFieldView.errorText = null;\n    });\n    labeledFieldView.bind('isEmpty', 'isFocused', 'placeholder').to(textareaView);\n    return textareaView;\n};\n/**\n * A helper for creating labeled dropdowns.\n *\n * It creates an instance of a {@link module:ui/dropdown/dropdownview~DropdownView dropdown} that is\n * logically related to a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled field view}.\n *\n * The helper does the following:\n *\n * * It sets dropdown's `id` and `ariaDescribedById` attributes.\n * * It binds input's `isEnabled` to the labeled view.\n *\n * Usage:\n *\n * ```ts\n * const labeledInputView = new LabeledFieldView( locale, createLabeledDropdown );\n * console.log( labeledInputView.fieldView ); // A dropdown instance.\n * ```\n *\n * @param labeledFieldView The instance of the labeled field view.\n * @param viewUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#labelView labeled view label} and the dropdown.\n * @param statusUid A UID string that allows DOM logical connection between the\n * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#statusView labeled view status} and the dropdown.\n * @returns The dropdown view instance.\n */\nconst createLabeledDropdown = (labeledFieldView, viewUid, statusUid) => {\n    const dropdownView = createDropdown(labeledFieldView.locale);\n    dropdownView.set({\n        id: viewUid,\n        ariaDescribedById: statusUid\n    });\n    dropdownView.bind('isEnabled').to(labeledFieldView);\n    return dropdownView;\n};\nexport { createLabeledInputNumber, createLabeledInputText, createLabeledTextarea, createLabeledDropdown };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagetextalternative/ui/textalternativeformview\n */\nimport { ButtonView, FocusCycler, FormRowView, FormHeaderView, LabeledFieldView, View, ViewCollection, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { IconPreviousArrow } from 'ckeditor5/src/icons.js';\nimport '../../../theme/textalternativeform.css';\n// See: #8833.\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/form/form.css';\n/**\n * The TextAlternativeFormView class.\n *\n * @internal\n */\nexport class TextAlternativeFormView extends View {\n    /**\n     * Tracks information about the DOM focus in the form.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * An input with a label.\n     */\n    labeledInput;\n    /**\n     * The Back button view displayed in the header.\n     */\n    backButtonView;\n    /**\n     * A button used to submit the form.\n     */\n    saveButtonView;\n    /**\n     * A collection of child views.\n     */\n    children;\n    /**\n     * A collection of views which can be focused in the form.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        // Create buttons.\n        this.backButtonView = this._createBackButton();\n        this.saveButtonView = this._createSaveButton();\n        // Create input fields.\n        this.labeledInput = this._createLabeledInputView();\n        this.children = this.createCollection([\n            this._createHeaderView()\n        ]);\n        this.children.add(new FormRowView(locale, {\n            children: [\n                this.labeledInput,\n                this.saveButtonView\n            ],\n            class: [\n                'ck-form__row_with-submit',\n                'ck-form__row_large-top-padding'\n            ]\n        }));\n        this._focusables = new ViewCollection();\n        // Close the panel on esc key press when the **form has focus**.\n        this.keystrokes.set('Esc', (data, cancel) => {\n            this.fire('cancel');\n            cancel();\n        });\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form',\n                    'ck-text-alternative-form',\n                    'ck-responsive-form'\n                ],\n                // https://github.com/ckeditor/ckeditor5-image/issues/40\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({\n            view: this\n        });\n        const childViews = [\n            this.backButtonView,\n            this.labeledInput,\n            this.saveButtonView\n        ];\n        childViews.forEach(v => {\n            // Register the view as focusable.\n            this._focusables.add(v);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(v.element);\n        });\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Creates a back button view that cancels the form.\n     */\n    _createBackButton() {\n        const t = this.locale.t;\n        const backButton = new ButtonView(this.locale);\n        backButton.set({\n            class: 'ck-button-back',\n            label: t('Back'),\n            icon: IconPreviousArrow,\n            tooltip: true\n        });\n        backButton.delegate('execute').to(this, 'cancel');\n        return backButton;\n    }\n    /**\n     * Creates a save button view that text alternative the image.\n     */\n    _createSaveButton() {\n        const t = this.locale.t;\n        const saveButton = new ButtonView(this.locale);\n        saveButton.set({\n            label: t('Save'),\n            withText: true,\n            type: 'submit',\n            class: 'ck-button-action ck-button-bold'\n        });\n        return saveButton;\n    }\n    /**\n     * Creates a header view for the form.\n     */\n    _createHeaderView() {\n        const t = this.locale.t;\n        const header = new FormHeaderView(this.locale, {\n            label: t('Text Alternative')\n        });\n        header.children.add(this.backButtonView, 0);\n        return header;\n    }\n    /**\n     * Creates an input with a label.\n     *\n     * @returns Labeled field view instance.\n     */\n    _createLabeledInputView() {\n        const t = this.locale.t;\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);\n        labeledInput.label = t('Text alternative');\n        labeledInput.class = 'ck-labeled-field-view_full-width';\n        return labeledInput;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { BalloonPanelView } from 'ckeditor5/src/ui.js';\n/**\n * A helper utility that positions the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} instance\n * with respect to the image in the editor content, if one is selected.\n *\n * @param editor The editor instance.\n * @internal\n */\nexport function repositionContextualBalloon(editor) {\n    const balloon = editor.plugins.get('ContextualBalloon');\n    const imageUtils = editor.plugins.get('ImageUtils');\n    if (imageUtils.getClosestSelectedImageWidget(editor.editing.view.document.selection)) {\n        const position = getBalloonPositionData(editor);\n        balloon.updatePosition(position);\n    }\n}\n/**\n * Returns the positioning options that control the geometry of the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} with respect\n * to the selected element in the editor content.\n *\n * @param editor The editor instance.\n * @internal\n */\nexport function getBalloonPositionData(editor) {\n    const editingView = editor.editing.view;\n    const defaultPositions = BalloonPanelView.defaultPositions;\n    const imageUtils = editor.plugins.get('ImageUtils');\n    return {\n        target: editingView.domConverter.mapViewToDom(imageUtils.getClosestSelectedImageWidget(editingView.document.selection)),\n        positions: [\n            defaultPositions.northArrowSouth,\n            defaultPositions.northArrowSouthWest,\n            defaultPositions.northArrowSouthEast,\n            defaultPositions.southArrowNorth,\n            defaultPositions.southArrowNorthWest,\n            defaultPositions.southArrowNorthEast,\n            defaultPositions.viewportStickyNorth\n        ]\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagetextalternative/imagetextalternativeui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView, ContextualBalloon, clickOutsideHandler, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';\nimport { IconTextAlternative } from 'ckeditor5/src/icons.js';\nimport { TextAlternativeFormView } from './ui/textalternativeformview.js';\nimport { repositionContextualBalloon, getBalloonPositionData } from '../image/ui/utils.js';\n/**\n * The image text alternative UI plugin.\n *\n * The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.\n */\nexport class ImageTextAlternativeUI extends Plugin {\n    /**\n     * The contextual balloon plugin instance.\n     */\n    _balloon;\n    /**\n     * A form containing a textarea and buttons, used to change the `alt` text value.\n     */\n    _form;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageTextAlternativeUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this._createButton();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        // Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).\n        if (this._form) {\n            this._form.destroy();\n        }\n    }\n    /**\n     * Creates a button showing the balloon panel for changing the image text alternative and\n     * registers it in the editor {@link module:ui/componentfactory~ComponentFactory ComponentFactory}.\n     */\n    _createButton() {\n        const editor = this.editor;\n        const t = editor.t;\n        editor.ui.componentFactory.add('imageTextAlternative', locale => {\n            const command = editor.commands.get('imageTextAlternative');\n            const view = new ButtonView(locale);\n            view.set({\n                label: t('Change image text alternative'),\n                icon: IconTextAlternative,\n                tooltip: true\n            });\n            view.bind('isEnabled').to(command, 'isEnabled');\n            view.bind('isOn').to(command, 'value', value => !!value);\n            this.listenTo(view, 'execute', () => {\n                this._showForm();\n            });\n            return view;\n        });\n    }\n    /**\n     * Creates the {@link module:image/imagetextalternative/ui/textalternativeformview~TextAlternativeFormView}\n     * form.\n     */\n    _createForm() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        this._balloon = this.editor.plugins.get('ContextualBalloon');\n        this._form = new (CssTransitionDisablerMixin(TextAlternativeFormView))(editor.locale);\n        // Render the form so its #element is available for clickOutsideHandler.\n        this._form.render();\n        this.listenTo(this._form, 'submit', () => {\n            editor.execute('imageTextAlternative', {\n                newValue: this._form.labeledInput.fieldView.element.value\n            });\n            this._hideForm(true);\n        });\n        this.listenTo(this._form, 'cancel', () => {\n            this._hideForm(true);\n        });\n        // Reposition the balloon or hide the form if an image widget is no longer selected.\n        this.listenTo(editor.ui, 'update', () => {\n            if (!imageUtils.getClosestSelectedImageWidget(viewDocument.selection)) {\n                this._hideForm(true);\n            }\n            else if (this._isVisible) {\n                repositionContextualBalloon(editor);\n            }\n        });\n        // Close on click outside of balloon panel element.\n        clickOutsideHandler({\n            emitter: this._form,\n            activator: () => this._isVisible,\n            contextElements: () => [this._balloon.view.element],\n            callback: () => this._hideForm()\n        });\n    }\n    /**\n     * Shows the {@link #_form} in the {@link #_balloon}.\n     */\n    _showForm() {\n        if (this._isVisible) {\n            return;\n        }\n        if (!this._form) {\n            this._createForm();\n        }\n        const editor = this.editor;\n        const command = editor.commands.get('imageTextAlternative');\n        const labeledInput = this._form.labeledInput;\n        this._form.disableCssTransitions();\n        if (!this._isInBalloon) {\n            this._balloon.add({\n                view: this._form,\n                position: getBalloonPositionData(editor)\n            });\n        }\n        // Make sure that each time the panel shows up, the field remains in sync with the value of\n        // the command. If the user typed in the input, then canceled the balloon (`labeledInput#value`\n        // stays unaltered) and re-opened it without changing the value of the command, they would see the\n        // old value instead of the actual value of the command.\n        // https://github.com/ckeditor/ckeditor5-image/issues/114\n        labeledInput.fieldView.value = labeledInput.fieldView.element.value = command.value || '';\n        this._form.labeledInput.fieldView.select();\n        this._form.enableCssTransitions();\n    }\n    /**\n     * Removes the {@link #_form} from the {@link #_balloon}.\n     *\n     * @param focusEditable Controls whether the editing view is focused afterwards.\n     */\n    _hideForm(focusEditable = false) {\n        if (!this._isInBalloon) {\n            return;\n        }\n        // Blur the input element before removing it from DOM to prevent issues in some browsers.\n        // See https://github.com/ckeditor/ckeditor5/issues/1501.\n        if (this._form.focusTracker.isFocused) {\n            this._form.saveButtonView.focus();\n        }\n        this._balloon.remove(this._form);\n        if (focusEditable) {\n            this.editor.editing.view.focus();\n        }\n    }\n    /**\n     * Returns `true` when the {@link #_form} is the visible view in the {@link #_balloon}.\n     */\n    get _isVisible() {\n        return !!this._balloon && this._balloon.visibleView === this._form;\n    }\n    /**\n     * Returns `true` when the {@link #_form} is in the {@link #_balloon}.\n     */\n    get _isInBalloon() {\n        return !!this._balloon && this._balloon.hasView(this._form);\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1zm10.453 2.61a1.89 1.89 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.9 1.9 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598M7.463 8.163a.6.6 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.63.63 0 0 0-.417-.185m6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.62.62 0 0 0-.42-.165M.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.91.91 0 0 0-.912-.912zM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516zm4.947 0h1.801v4.3h2.7v1.4h-4.5zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9zm-8.517 1.457-.614 2.059h1.262z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagetextalternative\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageTextAlternativeEditing } from './imagetextalternative/imagetextalternativeediting.js';\nimport { ImageTextAlternativeUI } from './imagetextalternative/imagetextalternativeui.js';\n/**\n * The image text alternative plugin.\n *\n * For a detailed overview, check the {@glink features/images/images-styles image styles} documentation.\n *\n * This is a \"glue\" plugin which loads the\n *  {@link module:image/imagetextalternative/imagetextalternativeediting~ImageTextAlternativeEditing}\n * and {@link module:image/imagetextalternative/imagetextalternativeui~ImageTextAlternativeUI} plugins.\n */\nexport class ImageTextAlternative extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageTextAlternativeEditing, ImageTextAlternativeUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageTextAlternative';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * Returns a function that converts the image view representation:\n *\n * ```html\n * <figure class=\"image\"><img src=\"...\" alt=\"...\"></img></figure>\n * ```\n *\n * to the model representation:\n *\n * ```html\n * <imageBlock src=\"...\" alt=\"...\"></imageBlock>\n * ```\n *\n * The entire content of the `<figure>` element except the first `<img>` is being converted as children\n * of the `<imageBlock>` model element.\n *\n * @internal\n */\nexport function upcastImageFigure(imageUtils) {\n    const converter = (evt, data, conversionApi) => {\n        // Do not convert if this is not an \"image figure\".\n        if (!conversionApi.consumable.test(data.viewItem, { name: true, classes: 'image' })) {\n            return;\n        }\n        // Find an image element inside the figure element.\n        const viewImage = imageUtils.findViewImgElement(data.viewItem);\n        // Do not convert if image element is absent or was already converted.\n        if (!viewImage || !conversionApi.consumable.test(viewImage, { name: true })) {\n            return;\n        }\n        // Consume the figure to prevent other converters from processing it again.\n        conversionApi.consumable.consume(data.viewItem, { name: true, classes: 'image' });\n        // Convert view image to model image.\n        const conversionResult = conversionApi.convertItem(viewImage, data.modelCursor);\n        // Get image element from conversion result.\n        const modelImage = first(conversionResult.modelRange.getItems());\n        // When image wasn't successfully converted then finish conversion.\n        if (!modelImage) {\n            // Revert consumed figure so other features can convert it.\n            conversionApi.consumable.revert(data.viewItem, { name: true, classes: 'image' });\n            return;\n        }\n        // Convert rest of the figure element's children as an image children.\n        conversionApi.convertChildren(data.viewItem, modelImage);\n        conversionApi.updateConversionResult(modelImage, data);\n    };\n    return dispatcher => {\n        dispatcher.on('element:figure', converter);\n    };\n}\n/**\n * Returns a function that converts the image view representation:\n *\n * ```html\n * <picture><source ... /><source ... />...<img ... /></picture>\n * ```\n *\n * to the model representation as the `sources` attribute:\n *\n * ```html\n * <image[Block|Inline] ... sources=\"...\"></image[Block|Inline]>\n * ```\n *\n * @internal\n */\nexport function upcastPicture(imageUtils) {\n    const sourceAttributeNames = ['srcset', 'media', 'type', 'sizes'];\n    const converter = (evt, data, conversionApi) => {\n        const pictureViewElement = data.viewItem;\n        // Do not convert <picture> if already consumed.\n        if (!conversionApi.consumable.test(pictureViewElement, { name: true })) {\n            return;\n        }\n        const sources = new Map();\n        // Collect all <source /> elements attribute values.\n        for (const childSourceElement of pictureViewElement.getChildren()) {\n            if (childSourceElement.is('element', 'source')) {\n                const attributes = {};\n                for (const name of sourceAttributeNames) {\n                    if (childSourceElement.hasAttribute(name)) {\n                        // Don't collect <source /> attribute if already consumed somewhere else.\n                        if (conversionApi.consumable.test(childSourceElement, { attributes: name })) {\n                            attributes[name] = childSourceElement.getAttribute(name);\n                        }\n                    }\n                }\n                if (Object.keys(attributes).length) {\n                    sources.set(childSourceElement, attributes);\n                }\n            }\n        }\n        const imgViewElement = imageUtils.findViewImgElement(pictureViewElement);\n        // Don't convert when a picture has no <img/> inside (it is broken).\n        if (!imgViewElement) {\n            return;\n        }\n        let modelImage = data.modelCursor.parent;\n        // - In case of an inline image (cursor parent in a <paragraph>), the <img/> must be converted right away\n        // because no converter handled it yet and otherwise there would be no model element to set the sources attribute on.\n        // - In case of a block image, the <figure class=\"image\"> converter (in ImageBlockEditing) converts the\n        // <img/> right away on its own and the modelCursor is already inside an imageBlock and there's nothing special\n        // to do here.\n        if (!modelImage.is('element', 'imageBlock')) {\n            const conversionResult = conversionApi.convertItem(imgViewElement, data.modelCursor);\n            // Set image range as conversion result.\n            data.modelRange = conversionResult.modelRange;\n            // Continue conversion where image conversion ends.\n            data.modelCursor = conversionResult.modelCursor;\n            modelImage = first(conversionResult.modelRange.getItems());\n        }\n        conversionApi.consumable.consume(pictureViewElement, { name: true });\n        // Consume only these <source/> attributes that were actually collected and will be passed on\n        // to the image model element.\n        for (const [sourceElement, attributes] of sources) {\n            conversionApi.consumable.consume(sourceElement, { attributes: Object.keys(attributes) });\n        }\n        if (sources.size) {\n            conversionApi.writer.setAttribute('sources', Array.from(sources.values()), modelImage);\n        }\n        // Convert rest of the <picture> children as an image children. Other converters may want to consume them.\n        conversionApi.convertChildren(pictureViewElement, modelImage);\n    };\n    return dispatcher => {\n        dispatcher.on('element:picture', converter);\n    };\n}\n/**\n * Converter used to convert the `srcset` model image attribute to the `srcset` and `sizes` attributes in the view.\n *\n * @internal\n * @param imageType The type of the image.\n */\nexport function downcastSrcsetAttribute(imageUtils, imageType) {\n    const converter = (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const writer = conversionApi.writer;\n        const element = conversionApi.mapper.toViewElement(data.item);\n        const img = imageUtils.findViewImgElement(element);\n        if (data.attributeNewValue === null) {\n            writer.removeAttribute('srcset', img);\n            writer.removeAttribute('sizes', img);\n        }\n        else {\n            if (data.attributeNewValue) {\n                writer.setAttribute('srcset', data.attributeNewValue, img);\n                // Always outputting `100vw`. See https://github.com/ckeditor/ckeditor5-image/issues/2.\n                writer.setAttribute('sizes', '100vw', img);\n            }\n        }\n    };\n    return dispatcher => {\n        dispatcher.on(`attribute:srcset:${imageType}`, converter);\n    };\n}\n/**\n * Converts the `source` model attribute to the `<picture><source /><source />...<img /></picture>`\n * view structure.\n *\n * @internal\n */\nexport function downcastSourcesAttribute(imageUtils) {\n    const converter = (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const viewWriter = conversionApi.writer;\n        const element = conversionApi.mapper.toViewElement(data.item);\n        const imgElement = imageUtils.findViewImgElement(element);\n        const attributeNewValue = data.attributeNewValue;\n        if (attributeNewValue && attributeNewValue.length) {\n            // Collect all wrapping attribute elements.\n            const attributeElements = [];\n            let viewElement = imgElement.parent;\n            while (viewElement && viewElement.is('attributeElement')) {\n                const parentElement = viewElement.parent;\n                viewWriter.unwrap(viewWriter.createRangeOn(imgElement), viewElement);\n                attributeElements.unshift(viewElement);\n                viewElement = parentElement;\n            }\n            const hasPictureElement = imgElement.parent.is('element', 'picture');\n            // Reuse existing <picture> element (ckeditor5#17192) or create a new one.\n            const pictureElement = hasPictureElement ? imgElement.parent : viewWriter.createContainerElement('picture', null);\n            if (!hasPictureElement) {\n                viewWriter.insert(viewWriter.createPositionBefore(imgElement), pictureElement);\n            }\n            viewWriter.remove(viewWriter.createRangeIn(pictureElement));\n            viewWriter.insert(viewWriter.createPositionAt(pictureElement, 'end'), attributeNewValue.map(sourceAttributes => {\n                return viewWriter.createEmptyElement('source', sourceAttributes);\n            }));\n            viewWriter.move(viewWriter.createRangeOn(imgElement), viewWriter.createPositionAt(pictureElement, 'end'));\n            // Apply collected attribute elements over the new picture element.\n            for (const attributeElement of attributeElements) {\n                viewWriter.wrap(viewWriter.createRangeOn(pictureElement), attributeElement);\n            }\n        }\n        // Both setting \"sources\" to an empty array and removing the attribute should unwrap the <img />.\n        // Unwrap once if the latter followed the former, though.\n        else if (imgElement.parent.is('element', 'picture')) {\n            const pictureElement = imgElement.parent;\n            viewWriter.move(viewWriter.createRangeOn(imgElement), viewWriter.createPositionBefore(pictureElement));\n            viewWriter.remove(pictureElement);\n        }\n    };\n    return dispatcher => {\n        dispatcher.on('attribute:sources:imageBlock', converter);\n        dispatcher.on('attribute:sources:imageInline', converter);\n    };\n}\n/**\n * Converter used to convert a given image attribute from the model to the view.\n *\n * @internal\n * @param imageType The type of the image.\n * @param attributeKey The name of the attribute to convert.\n */\nexport function downcastImageAttribute(imageUtils, imageType, attributeKey) {\n    const converter = (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const viewWriter = conversionApi.writer;\n        const element = conversionApi.mapper.toViewElement(data.item);\n        const img = imageUtils.findViewImgElement(element);\n        viewWriter.setAttribute(data.attributeKey, data.attributeNewValue || '', img);\n    };\n    return dispatcher => {\n        dispatcher.on(`attribute:${attributeKey}:${imageType}`, converter);\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image/imageloadobserver\n */\nimport { Observer } from 'ckeditor5/src/engine.js';\n/**\n * Observes all new images added to the {@link module:engine/view/document~ViewDocument},\n * fires {@link module:engine/view/document~ViewDocument#event:imageLoaded} and\n * {@link module:engine/view/document~ViewDocument#event:layoutChanged} event every time when the new image\n * has been loaded.\n *\n * **Note:** This event is not fired for images that has been added to the document and rendered as `complete` (already loaded).\n */\nexport class ImageLoadObserver extends Observer {\n    /**\n     * @inheritDoc\n     */\n    observe(domRoot) {\n        this.listenTo(domRoot, 'load', (event, domEvent) => {\n            const domElement = domEvent.target;\n            if (this.checkShouldIgnoreEventFromTarget(domElement)) {\n                return;\n            }\n            if (domElement.tagName == 'IMG') {\n                this._fireEvents(domEvent);\n            }\n            // Use capture phase for better performance (#4504).\n        }, { useCapture: true });\n    }\n    /**\n     * @inheritDoc\n     */\n    stopObserving(domRoot) {\n        this.stopListening(domRoot);\n    }\n    /**\n     * Fires {@link module:engine/view/document~ViewDocument#event:layoutChanged} and\n     * {@link module:engine/view/document~ViewDocument#event:imageLoaded}\n     * if observer {@link #isEnabled is enabled}.\n     *\n     * @param domEvent The DOM event.\n     */\n    _fireEvents(domEvent) {\n        if (this.isEnabled) {\n            this.document.fire('layoutChanged');\n            this.document.fire('imageLoaded', domEvent);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image/insertimagecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { logWarning, toArray } from 'ckeditor5/src/utils.js';\n/**\n * Insert image command.\n *\n * The command is registered by the {@link module:image/image/imageediting~ImageEditing} plugin as `insertImage`\n * and it is also available via aliased `imageInsert` name.\n *\n * In order to insert an image at the current selection position\n * (according to the {@link module:widget/utils~findOptimalInsertionRange} algorithm),\n * execute the command and specify the image source:\n *\n * ```ts\n * editor.execute( 'insertImage', { source: 'http://url.to.the/image' } );\n * ```\n *\n * It is also possible to insert multiple images at once:\n *\n * ```ts\n * editor.execute( 'insertImage', {\n * \tsource:  [\n * \t\t'path/to/image.jpg',\n * \t\t'path/to/other-image.jpg'\n * \t]\n * } );\n * ```\n *\n * If you want to take the full control over the process, you can specify individual model attributes:\n *\n * ```ts\n * editor.execute( 'insertImage', {\n * \tsource:  [\n * \t\t{ src: 'path/to/image.jpg', alt: 'First alt text' },\n * \t\t{ src: 'path/to/other-image.jpg', alt: 'Second alt text', customAttribute: 'My attribute value' }\n * \t]\n * } );\n * ```\n */\nexport class InsertImageCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        const configImageInsertType = editor.config.get('image.insert.type');\n        if (!editor.plugins.has('ImageBlockEditing')) {\n            if (configImageInsertType === 'block') {\n                /**\n                 * The {@link module:image/imageblock~ImageBlock} plugin must be enabled to allow inserting block images. See\n                 * {@link module:image/imageconfig~ImageInsertConfig#type} to learn more.\n                 *\n                 * @error image-block-plugin-required\n                 */\n                logWarning('image-block-plugin-required');\n            }\n        }\n        if (!editor.plugins.has('ImageInlineEditing')) {\n            if (configImageInsertType === 'inline') {\n                /**\n                 * The {@link module:image/imageinline~ImageInline} plugin must be enabled to allow inserting inline images. See\n                 * {@link module:image/imageconfig~ImageInsertConfig#type} to learn more.\n                 *\n                 * @error image-inline-plugin-required\n                 */\n                logWarning('image-inline-plugin-required');\n            }\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        this.isEnabled = imageUtils.isImageAllowed();\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options Options for the executed command.\n     * @param options.imageType The type of the image to insert. If not specified, the type will be determined automatically.\n     * @param options.source The image source or an array of image sources to insert.\n     * @param options.breakBlock If set to `true`, the block at the selection start will be broken before inserting the image.\n     * See the documentation of the command to learn more about accepted formats.\n     */\n    execute(options) {\n        const sourceDefinitions = toArray(options.source);\n        const selection = this.editor.model.document.selection;\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        // In case of multiple images, each image (starting from the 2nd) will be inserted at a position that\n        // follows the previous one. That will move the selection and, to stay on the safe side and make sure\n        // all images inherit the same selection attributes, they are collected beforehand.\n        //\n        // Applying these attributes ensures, for instance, that inserting an (inline) image into a link does\n        // not split that link but preserves its continuity.\n        //\n        // Note: Selection attributes that do not make sense for images will be filtered out by insertImage() anyway.\n        const selectionAttributes = Object.fromEntries(selection.getAttributes());\n        sourceDefinitions.forEach((sourceDefinition, index) => {\n            const selectedElement = selection.getSelectedElement();\n            if (typeof sourceDefinition === 'string') {\n                sourceDefinition = { src: sourceDefinition };\n            }\n            // Inserting of an inline image replace the selected element and make a selection on the inserted image.\n            // Therefore inserting multiple inline images requires creating position after each element.\n            if (index && selectedElement && imageUtils.isImage(selectedElement)) {\n                const position = this.editor.model.createPositionAfter(selectedElement);\n                imageUtils.insertImage({ ...sourceDefinition, ...selectionAttributes }, position, options.imageType);\n            }\n            else if (options.breakBlock) {\n                imageUtils.insertImage({ ...sourceDefinition, ...selectionAttributes }, selection.getFirstPosition(), options.imageType);\n            }\n            else {\n                imageUtils.insertImage({ ...sourceDefinition, ...selectionAttributes }, null, options.imageType);\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * @module image/image/replaceimagesourcecommand\n */\n/**\n * Replace image source command.\n *\n * Changes image source to the one provided. Can be executed as follows:\n *\n * ```ts\n * editor.execute( 'replaceImageSource', { source: 'http://url.to.the/image' } );\n * ```\n */\nexport class ReplaceImageSourceCommand extends Command {\n    constructor(editor) {\n        super(editor);\n        this.decorate('cleanupImage');\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const element = this.editor.model.document.selection.getSelectedElement();\n        this.isEnabled = imageUtils.isImage(element);\n        this.value = this.isEnabled ? element.getAttribute('src') : null;\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options Options for the executed command.\n     * @param options.source The image source to replace.\n     */\n    execute(options) {\n        const image = this.editor.model.document.selection.getSelectedElement();\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        this.editor.model.change(writer => {\n            writer.setAttribute('src', options.source, image);\n            this.cleanupImage(writer, image);\n            imageUtils.setImageNaturalSizeAttributes(image);\n        });\n    }\n    /**\n     * Cleanup image attributes that are not relevant to the new source.\n     *\n     * Removed attributes are: 'srcset', 'sizes', 'sources', 'width', 'height', 'alt'.\n     *\n     * This method is decorated, to allow custom cleanup logic.\n     * For example, to remove 'myImageId' attribute after 'src' has changed:\n     *\n     * ```ts\n     * replaceImageSourceCommand.on( 'cleanupImage', ( eventInfo, [ writer, image ] ) => {\n     * \twriter.removeAttribute( 'myImageId', image );\n     * } );\n     * ```\n     */\n    cleanupImage(writer, image) {\n        writer.removeAttribute('srcset', image);\n        writer.removeAttribute('sizes', image);\n        /**\n         * In case responsive images some attributes should be cleaned up.\n         * Check: https://github.com/ckeditor/ckeditor5/issues/15093\n         */\n        writer.removeAttribute('sources', image);\n        writer.removeAttribute('width', image);\n        writer.removeAttribute('height', image);\n        writer.removeAttribute('alt', image);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image/imageediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageLoadObserver } from './imageloadobserver.js';\nimport { InsertImageCommand } from './insertimagecommand.js';\nimport { ReplaceImageSourceCommand } from './replaceimagesourcecommand.js';\nimport { ImageUtils } from '../imageutils.js';\n/**\n * The image engine plugin. This module loads common code shared between\n * {@link module:image/image/imageinlineediting~ImageInlineEditing} and\n * {@link module:image/image/imageblockediting~ImageBlockEditing} plugins.\n *\n * This plugin registers the {@link module:image/image/insertimagecommand~InsertImageCommand 'insertImage'} command.\n */\nexport class ImageEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const conversion = editor.conversion;\n        // See https://github.com/ckeditor/ckeditor5-image/issues/142.\n        editor.editing.view.addObserver(ImageLoadObserver);\n        conversion.for('upcast')\n            .attributeToAttribute({\n            view: {\n                name: 'img',\n                key: 'alt'\n            },\n            model: 'alt'\n        })\n            .attributeToAttribute({\n            view: {\n                name: 'img',\n                key: 'srcset'\n            },\n            model: 'srcset'\n        });\n        const insertImageCommand = new InsertImageCommand(editor);\n        const replaceImageSourceCommand = new ReplaceImageSourceCommand(editor);\n        editor.commands.add('insertImage', insertImageCommand);\n        editor.commands.add('replaceImageSource', replaceImageSourceCommand);\n        // `imageInsert` is an alias for backward compatibility.\n        editor.commands.add('imageInsert', insertImageCommand);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagesizeattributes\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageUtils } from './imageutils.js';\nimport { widthAndHeightStylesAreBothSet, getSizeValueIfInPx } from './image/utils.js';\n/**\n * This plugin enables `width` and `height` attributes in inline and block image elements.\n */\nexport class ImageSizeAttributes extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageSizeAttributes';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        this._registerSchema();\n        this._registerConverters('imageBlock');\n        this._registerConverters('imageInline');\n    }\n    /**\n     * Registers the `width` and `height` attributes for inline and block images.\n     */\n    _registerSchema() {\n        const schema = this.editor.model.schema;\n        if (this.editor.plugins.has('ImageBlockEditing')) {\n            schema.extend('imageBlock', { allowAttributes: ['width', 'height'] });\n        }\n        if (this.editor.plugins.has('ImageInlineEditing')) {\n            schema.extend('imageInline', { allowAttributes: ['width', 'height'] });\n        }\n    }\n    /**\n     * Registers converters for `width` and `height` attributes.\n     */\n    _registerConverters(imageType) {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const viewElementName = imageType === 'imageBlock' ? 'figure' : 'img';\n        editor.conversion.for('upcast')\n            .attributeToAttribute({\n            view: {\n                name: viewElementName,\n                styles: {\n                    width: /.+/\n                }\n            },\n            model: {\n                key: 'width',\n                value: (viewElement) => {\n                    if (widthAndHeightStylesAreBothSet(viewElement)) {\n                        return getSizeValueIfInPx(viewElement.getStyle('width'));\n                    }\n                    return null;\n                }\n            }\n        })\n            .attributeToAttribute({\n            view: {\n                name: viewElementName,\n                key: 'width'\n            },\n            model: 'width'\n        })\n            .attributeToAttribute({\n            view: {\n                name: viewElementName,\n                styles: {\n                    height: /.+/\n                }\n            },\n            model: {\n                key: 'height',\n                value: (viewElement) => {\n                    if (widthAndHeightStylesAreBothSet(viewElement)) {\n                        return getSizeValueIfInPx(viewElement.getStyle('height'));\n                    }\n                    return null;\n                }\n            }\n        })\n            .attributeToAttribute({\n            view: {\n                name: viewElementName,\n                key: 'height'\n            },\n            model: 'height'\n        });\n        // Dedicated converters to propagate attributes to the <img> element.\n        editor.conversion.for('editingDowncast').add(dispatcher => {\n            attachDowncastConverter(dispatcher, 'width', 'width', true, true);\n            attachDowncastConverter(dispatcher, 'height', 'height', true, true);\n        });\n        editor.conversion.for('dataDowncast').add(dispatcher => {\n            attachDowncastConverter(dispatcher, 'width', 'width', false);\n            attachDowncastConverter(dispatcher, 'height', 'height', false);\n        });\n        // Consume `aspect-ratio` style if `width` and `height` attributes are set on the image.\n        editor.conversion.for('upcast').add(dispatcher => {\n            dispatcher.on('element:img', (evt, data, conversionApi) => {\n                const width = data.viewItem.getAttribute('width');\n                const height = data.viewItem.getAttribute('height');\n                if (width && height) {\n                    conversionApi.consumable.consume(data.viewItem, { styles: ['aspect-ratio'] });\n                }\n            });\n        });\n        function attachDowncastConverter(dispatcher, modelAttributeName, viewAttributeName, setRatioForInlineImage, isEditingDowncast = false) {\n            dispatcher.on(`attribute:${modelAttributeName}:${imageType}`, (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                    return;\n                }\n                const viewWriter = conversionApi.writer;\n                const viewElement = conversionApi.mapper.toViewElement(data.item);\n                const img = imageUtils.findViewImgElement(viewElement);\n                if (data.attributeNewValue !== null) {\n                    viewWriter.setAttribute(viewAttributeName, data.attributeNewValue, img);\n                }\n                else {\n                    viewWriter.removeAttribute(viewAttributeName, img);\n                }\n                const width = data.item.getAttribute('width');\n                const height = data.item.getAttribute('height');\n                const hasSizes = width && height;\n                if (hasSizes && isEditingDowncast) {\n                    viewWriter.setAttribute('loading', 'lazy', img);\n                }\n                // Do not set aspect-ratio for pictures. See https://github.com/ckeditor/ckeditor5/issues/14579.\n                if (data.item.hasAttribute('sources')) {\n                    return;\n                }\n                const isResized = data.item.hasAttribute('resizedWidth');\n                // Do not set aspect ratio for inline images which are not resized (data pipeline).\n                if (imageType === 'imageInline' && !isResized && !setRatioForInlineImage) {\n                    return;\n                }\n                if (hasSizes) {\n                    viewWriter.setStyle('aspect-ratio', `${width}/${height}`, img);\n                }\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The image type command. It changes the type of a selected image, depending on the configuration.\n */\nexport class ImageTypeCommand extends Command {\n    /**\n     * Model element name the command converts to.\n     */\n    _modelElementName;\n    /**\n     * @inheritDoc\n     *\n     * @param modelElementName Model element name the command converts to.\n     */\n    constructor(editor, modelElementName) {\n        super(editor);\n        this._modelElementName = modelElementName;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const element = imageUtils.getClosestSelectedImageElement(this.editor.model.document.selection);\n        if (this._modelElementName === 'imageBlock') {\n            this.isEnabled = imageUtils.isInlineImage(element);\n        }\n        else {\n            this.isEnabled = imageUtils.isBlockImage(element);\n        }\n    }\n    /**\n     * Executes the command and changes the type of a selected image.\n     *\n     * @fires execute\n     * @param options.setImageSizes Specifies whether the image `width` and `height` attributes should be set automatically.\n     * The default is `true`.\n     * @returns An object containing references to old and new model image elements\n     * (for before and after the change) so external integrations can hook into the decorated\n     * `execute` event and handle this change. `null` if the type change failed.\n     */\n    execute(options = {}) {\n        const editor = this.editor;\n        const model = this.editor.model;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const oldElement = imageUtils.getClosestSelectedImageElement(model.document.selection);\n        const attributes = Object.fromEntries(oldElement.getAttributes());\n        // Don't change image type if \"src\" is missing (a broken image), unless there's \"uploadId\" set.\n        // This state may happen during image upload (before it finishes) and it should be possible to change type\n        // of the image in the meantime.\n        if (!attributes.src && !attributes.uploadId) {\n            return null;\n        }\n        return model.change(writer => {\n            const { setImageSizes = true } = options;\n            // Get all markers that contain the old image element.\n            const markers = Array.from(model.markers)\n                .filter(marker => marker.getRange().containsItem(oldElement));\n            const newElement = imageUtils.insertImage(attributes, model.createSelection(oldElement, 'on'), this._modelElementName, { setImageSizes });\n            if (!newElement) {\n                return null;\n            }\n            const newElementRange = writer.createRangeOn(newElement);\n            // Expand the previously intersecting markers' ranges to include the new image element.\n            for (const marker of markers) {\n                const markerRange = marker.getRange();\n                // Join the survived part of the old marker range with the new element range\n                // (loosely because there could be some new paragraph or the existing one might got split).\n                const range = markerRange.root.rootName != '$graveyard' ?\n                    markerRange.getJoined(newElementRange, true) : newElementRange;\n                writer.updateMarker(marker, { range });\n            }\n            return {\n                oldElement,\n                newElement\n            };\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image/imageplaceholder\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { ImageLoadObserver } from './imageloadobserver.js';\nimport '../../theme/imageplaceholder.css';\n/**\n * Adds support for image placeholder that is automatically removed when the image is loaded.\n */\nexport class ImagePlaceholder extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImagePlaceholder';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        this._setupSchema();\n        this._setupConversion();\n        this._setupLoadListener();\n    }\n    /**\n     * Extends model schema.\n     */\n    _setupSchema() {\n        const schema = this.editor.model.schema;\n        // Wait for ImageBlockEditing or ImageInlineEditing to register their elements first,\n        // that's why doing this in afterInit() instead of init().\n        if (schema.isRegistered('imageBlock')) {\n            schema.extend('imageBlock', {\n                allowAttributes: ['placeholder']\n            });\n        }\n        if (schema.isRegistered('imageInline')) {\n            schema.extend('imageInline', {\n                allowAttributes: ['placeholder']\n            });\n        }\n    }\n    /**\n     * Registers converters.\n     */\n    _setupConversion() {\n        const editor = this.editor;\n        const conversion = editor.conversion;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        conversion.for('editingDowncast').add(dispatcher => {\n            dispatcher.on('attribute:placeholder', (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.test(data.item, evt.name)) {\n                    return;\n                }\n                if (!data.item.is('element', 'imageBlock') && !data.item.is('element', 'imageInline')) {\n                    return;\n                }\n                conversionApi.consumable.consume(data.item, evt.name);\n                const viewWriter = conversionApi.writer;\n                const element = conversionApi.mapper.toViewElement(data.item);\n                const img = imageUtils.findViewImgElement(element);\n                if (data.attributeNewValue) {\n                    viewWriter.addClass('image_placeholder', img);\n                    viewWriter.setStyle('background-image', `url(${data.attributeNewValue})`, img);\n                    viewWriter.setCustomProperty('editingPipeline:doNotReuseOnce', true, img);\n                }\n                else {\n                    viewWriter.removeClass('image_placeholder', img);\n                    viewWriter.removeStyle('background-image', img);\n                }\n            });\n        });\n    }\n    /**\n     * Prepares listener for image load.\n     */\n    _setupLoadListener() {\n        const editor = this.editor;\n        const model = editor.model;\n        const editing = editor.editing;\n        const editingView = editing.view;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        editingView.addObserver(ImageLoadObserver);\n        this.listenTo(editingView.document, 'imageLoaded', (evt, domEvent) => {\n            const imgViewElement = editingView.domConverter.mapDomToView(domEvent.target);\n            if (!imgViewElement) {\n                return;\n            }\n            const viewElement = imageUtils.getImageWidgetFromImageView(imgViewElement);\n            if (!viewElement) {\n                return;\n            }\n            const modelElement = editing.mapper.toModelElement(viewElement);\n            if (!modelElement || !modelElement.hasAttribute('placeholder')) {\n                return;\n            }\n            model.enqueueChange({ isUndoable: false }, writer => {\n                writer.removeAttribute('placeholder', modelElement);\n            });\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image/imageblockediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { downcastImageAttribute, downcastSrcsetAttribute, upcastImageFigure } from './converters.js';\nimport { ImageEditing } from './imageediting.js';\nimport { ImageSizeAttributes } from '../imagesizeattributes.js';\nimport { ImageTypeCommand } from './imagetypecommand.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { getImgViewElementMatcher, createBlockImageViewElement, determineImageTypeForInsertionAtSelection } from './utils.js';\nimport { ImagePlaceholder } from './imageplaceholder.js';\n/**\n * The image block plugin.\n *\n * It registers:\n *\n * * `<imageBlock>` as a block element in the document schema, and allows `alt`, `src` and `srcset` attributes.\n * * converters for editing and data pipelines.,\n * * {@link module:image/image/imagetypecommand~ImageTypeCommand `'imageTypeBlock'`} command that converts inline images into\n * block images.\n */\nexport class ImageBlockEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageEditing, ImageSizeAttributes, ImageUtils, ImagePlaceholder, ClipboardPipeline];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageBlockEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        // Converters 'alt' and 'srcset' are added in 'ImageEditing' plugin.\n        schema.register('imageBlock', {\n            inheritAllFrom: '$blockObject',\n            allowAttributes: ['alt', 'src', 'srcset']\n        });\n        this._setupConversion();\n        if (editor.plugins.has('ImageInlineEditing')) {\n            editor.commands.add('imageTypeBlock', new ImageTypeCommand(this.editor, 'imageBlock'));\n            this._setupClipboardIntegration();\n        }\n    }\n    /**\n     * Configures conversion pipelines to support upcasting and downcasting\n     * block images (block image widgets) and their attributes.\n     */\n    _setupConversion() {\n        const editor = this.editor;\n        const t = editor.t;\n        const conversion = editor.conversion;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        conversion.for('dataDowncast')\n            .elementToStructure({\n            model: 'imageBlock',\n            view: (modelElement, { writer }) => createBlockImageViewElement(writer)\n        });\n        conversion.for('editingDowncast')\n            .elementToStructure({\n            model: 'imageBlock',\n            view: (modelElement, { writer }) => imageUtils.toImageWidget(createBlockImageViewElement(writer), writer, t('image widget'))\n        });\n        conversion.for('downcast')\n            .add(downcastImageAttribute(imageUtils, 'imageBlock', 'src'))\n            .add(downcastImageAttribute(imageUtils, 'imageBlock', 'alt'))\n            .add(downcastSrcsetAttribute(imageUtils, 'imageBlock'));\n        // More image related upcasts are in 'ImageEditing' plugin.\n        conversion.for('upcast')\n            .elementToElement({\n            view: getImgViewElementMatcher(editor, 'imageBlock'),\n            model: (viewImage, { writer }) => writer.createElement('imageBlock', viewImage.hasAttribute('src') ? { src: viewImage.getAttribute('src') } : undefined)\n        })\n            .add(upcastImageFigure(imageUtils));\n    }\n    /**\n     * Integrates the plugin with the clipboard pipeline.\n     *\n     * Idea is that the feature should recognize the user's intent when an **inline** image is\n     * pasted or dropped. If such an image is pasted/dropped:\n     *\n     * * into an empty block (e.g. an empty paragraph),\n     * * on another object (e.g. some block widget).\n     *\n     * it gets converted into a block image on the fly. We assume this is the user's intent\n     * if they decided to put their image there.\n     *\n     * See the `ImageInlineEditing` for the similar integration that works in the opposite direction.\n     *\n     * The feature also sets image `width` and `height` attributes on paste.\n     */\n    _setupClipboardIntegration() {\n        const editor = this.editor;\n        const model = editor.model;\n        const editingView = editor.editing.view;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const clipboardPipeline = editor.plugins.get('ClipboardPipeline');\n        this.listenTo(clipboardPipeline, 'inputTransformation', (evt, data) => {\n            const docFragmentChildren = Array.from(data.content.getChildren());\n            let modelRange;\n            // Make sure only <img> elements are dropped or pasted. Otherwise, if there some other HTML\n            // mixed up, this should be handled as a regular paste.\n            if (!docFragmentChildren.every(imageUtils.isInlineImageView)) {\n                return;\n            }\n            // When drag and dropping, data.targetRanges specifies where to drop because\n            // this is usually a different place than the current model selection (the user\n            // uses a drop marker to specify the drop location).\n            if (data.targetRanges) {\n                modelRange = editor.editing.mapper.toModelRange(data.targetRanges[0]);\n            }\n            // Pasting, however, always occurs at the current model selection.\n            else {\n                modelRange = model.document.selection.getFirstRange();\n            }\n            const selection = model.createSelection(modelRange);\n            // Convert inline images into block images only when the currently selected block is empty\n            // (e.g. an empty paragraph) or some object is selected (to replace it).\n            if (determineImageTypeForInsertionAtSelection(model.schema, selection) === 'imageBlock') {\n                const writer = new ViewUpcastWriter(editingView.document);\n                // Wrap <img ... /> -> <figure class=\"image\"><img .../></figure>\n                const blockViewImages = docFragmentChildren.map(inlineViewImage => writer.createElement('figure', { class: 'image' }, inlineViewImage));\n                data.content = writer.createDocumentFragment(blockViewImages);\n            }\n        });\n        this.listenTo(clipboardPipeline, 'contentInsertion', (evt, data) => {\n            if (data.method !== 'paste') {\n                return;\n            }\n            model.change(writer => {\n                const range = writer.createRangeIn(data.content);\n                for (const item of range.getItems()) {\n                    if (item.is('element', 'imageBlock')) {\n                        imageUtils.setImageNaturalSizeAttributes(item);\n                    }\n                }\n            });\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/collapsible/collapsibleview\n */\nimport { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';\nimport { View } from '../view.js';\nimport { ButtonView } from '../button/buttonview.js';\nimport '../../theme/components/collapsible/collapsible.css';\n/**\n * A collapsible UI component. Consists of a labeled button and a container which can be collapsed\n * by clicking the button. The collapsible container can be a host to other UI views.\n *\n * @internal\n */\nexport class CollapsibleView extends View {\n    /**\n     * The main button that, when clicked, collapses or expands the container with {@link #children}.\n     */\n    buttonView;\n    /**\n     * A collection of the child views that can be collapsed by clicking the {@link #buttonView}.\n     */\n    children;\n    /**\n     * Creates an instance of the collapsible view.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param childViews An optional array of initial child views to be inserted into the collapsible.\n     */\n    constructor(locale, childViews) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('isCollapsed', false);\n        this.set('label', '');\n        this.buttonView = this._createButtonView();\n        this.children = this.createCollection();\n        this.set('_collapsibleAriaLabelUid', undefined);\n        if (childViews) {\n            this.children.addMany(childViews);\n        }\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-collapsible',\n                    bind.if('isCollapsed', 'ck-collapsible_collapsed')\n                ]\n            },\n            children: [\n                this.buttonView,\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-collapsible__children'\n                        ],\n                        role: 'region',\n                        hidden: bind.if('isCollapsed', 'hidden'),\n                        'aria-labelledby': bind.to('_collapsibleAriaLabelUid')\n                    },\n                    children: this.children\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this._collapsibleAriaLabelUid = this.buttonView.labelView.element.id;\n    }\n    /**\n     * Focuses the first focusable.\n     */\n    focus() {\n        this.buttonView.focus();\n    }\n    /**\n     * Creates the main {@link #buttonView} of the collapsible.\n     */\n    _createButtonView() {\n        const buttonView = new ButtonView(this.locale);\n        const bind = buttonView.bindTemplate;\n        buttonView.set({\n            withText: true,\n            icon: IconDropdownArrow\n        });\n        buttonView.extendTemplate({\n            attributes: {\n                'aria-expanded': bind.to('isOn', value => String(value))\n            }\n        });\n        buttonView.bind('label').to(this);\n        buttonView.bind('isOn').to(this, 'isCollapsed', isCollapsed => !isCollapsed);\n        buttonView.on('execute', () => {\n            this.isCollapsed = !this.isCollapsed;\n        });\n        return buttonView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinsert/ui/imageinsertformview\n */\nimport { View, ViewCollection, submitHandler, FocusCycler, CollapsibleView } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport '../../../theme/imageinsert.css';\n/**\n * The view displayed in the insert image dropdown.\n *\n * See {@link module:image/imageinsert/imageinsertui~ImageInsertUI}.\n *\n * @internal\n */\nexport class ImageInsertFormView extends View {\n    /**\n     * Tracks information about DOM focus in the form.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * A collection of the defined integrations for inserting the images.\n     */\n    children;\n    /**\n     * Creates a view for the dropdown panel of {@link module:image/imageinsert/imageinsertui~ImageInsertUI}.\n     *\n     * @param locale The localization services instance.\n     * @param integrations An integrations object that contains components (or tokens for components) to be shown in the panel view.\n     */\n    constructor(locale, integrations = []) {\n        super(locale);\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this._focusables = new ViewCollection();\n        this.children = this.createCollection();\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        for (const view of integrations) {\n            this.children.add(view);\n            this._focusables.add(view);\n            if (view instanceof CollapsibleView) {\n                this._focusables.addMany(view.children);\n            }\n        }\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-image-insert-form'\n                ],\n                tabindex: -1\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({\n            view: this\n        });\n        for (const view of this._focusables) {\n            this.focusTracker.add(view.element);\n        }\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n        const stopPropagation = (data) => data.stopPropagation();\n        // Since the form is in the dropdown panel which is a child of the toolbar, the toolbar's\n        // keystroke handler would take over the key management in the URL input. We need to prevent\n        // this ASAP. Otherwise, the basic caret movement using the arrow keys will be impossible.\n        this.keystrokes.set('arrowright', stopPropagation);\n        this.keystrokes.set('arrowleft', stopPropagation);\n        this.keystrokes.set('arrowup', stopPropagation);\n        this.keystrokes.set('arrowdown', stopPropagation);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the first {@link #_focusables focusable} in the form.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinsert/imageinsertui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { logWarning } from 'ckeditor5/src/utils.js';\nimport { createDropdown, MenuBarMenuListItemView, MenuBarMenuListView, MenuBarMenuView, SplitButtonView } from 'ckeditor5/src/ui.js';\nimport { IconImage } from 'ckeditor5/src/icons.js';\nimport { ImageInsertFormView } from './ui/imageinsertformview.js';\nimport { ImageUtils } from '../imageutils.js';\n/**\n * The image insert dropdown plugin.\n *\n * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}\n * and {@glink features/images/images-inserting Insert images via source URL} documentation.\n *\n * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}\n * and also the `imageInsert` dropdown as an alias for backward compatibility.\n *\n * Adds the `'menuBar:insertImage'` sub-menu to the {@link module:ui/componentfactory~ComponentFactory UI component factory}, which is\n * by default added to the `'Insert'` menu.\n */\nexport class ImageInsertUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageInsertUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * The dropdown view responsible for displaying the image insert UI.\n     */\n    dropdownView;\n    /**\n     * Registered integrations map.\n     */\n    _integrations = new Map();\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('image.insert.integrations', [\n            'upload',\n            'assetManager',\n            'url'\n        ]);\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        this.set('isImageSelected', false);\n        this.listenTo(editor.model.document, 'change', () => {\n            this.isImageSelected = imageUtils.isImage(selection.getSelectedElement());\n        });\n        const componentCreator = (locale) => this._createToolbarComponent(locale);\n        const menuBarComponentCreator = (locale) => this._createMenuBarComponent(locale);\n        // Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility.\n        editor.ui.componentFactory.add('insertImage', componentCreator);\n        editor.ui.componentFactory.add('imageInsert', componentCreator);\n        editor.ui.componentFactory.add('menuBar:insertImage', menuBarComponentCreator);\n    }\n    /**\n     * Registers the insert image dropdown integration.\n     */\n    registerIntegration({ name, observable, buttonViewCreator, formViewCreator, menuBarButtonViewCreator, requiresForm = false, override = false }) {\n        if (this._integrations.has(name) && !override) {\n            /**\n             * There are two insert-image integrations registered with the same name.\n             *\n             * Make sure that you do not load multiple asset manager plugins.\n             *\n             * @error image-insert-integration-exists\n             */\n            logWarning('image-insert-integration-exists', { name });\n        }\n        this._integrations.set(name, {\n            observable,\n            buttonViewCreator,\n            menuBarButtonViewCreator,\n            formViewCreator,\n            requiresForm\n        });\n    }\n    /**\n     * Creates the toolbar component.\n     */\n    _createToolbarComponent(locale) {\n        const editor = this.editor;\n        const t = locale.t;\n        const integrations = this._prepareIntegrations();\n        if (!integrations.length) {\n            return null;\n        }\n        let dropdownButton;\n        const firstIntegration = integrations[0];\n        if (integrations.length == 1) {\n            // Do not use dropdown for a single integration button (integration that does not require form view).\n            if (!firstIntegration.requiresForm) {\n                return firstIntegration.buttonViewCreator(true);\n            }\n            dropdownButton = firstIntegration.buttonViewCreator(true);\n        }\n        else {\n            const actionButton = firstIntegration.buttonViewCreator(false);\n            dropdownButton = new SplitButtonView(locale, actionButton);\n            dropdownButton.tooltip = true;\n            dropdownButton.bind('label').to(this, 'isImageSelected', isImageSelected => isImageSelected ?\n                t('Replace image') :\n                t('Insert image'));\n        }\n        const dropdownView = this.dropdownView = createDropdown(locale, dropdownButton);\n        const observables = integrations.map(({ observable }) => typeof observable == 'function' ? observable() : observable);\n        dropdownView.bind('isEnabled').toMany(observables, 'isEnabled', (...isEnabled) => (isEnabled.some(isEnabled => isEnabled)));\n        dropdownView.once('change:isOpen', () => {\n            const integrationViews = integrations.flatMap(({ formViewCreator }) => formViewCreator(integrations.length == 1));\n            const imageInsertFormView = new ImageInsertFormView(editor.locale, integrationViews);\n            dropdownView.panelView.children.add(imageInsertFormView);\n        });\n        return dropdownView;\n    }\n    /**\n     * Creates the menu bar component.\n     */\n    _createMenuBarComponent(locale) {\n        const t = locale.t;\n        const integrations = this._prepareIntegrations();\n        if (!integrations.length) {\n            return null;\n        }\n        const integrationViews = integrations.flatMap(({ menuBarButtonViewCreator }) => menuBarButtonViewCreator(integrations.length == 1));\n        const resultView = new MenuBarMenuView(locale);\n        const listView = new MenuBarMenuListView(locale);\n        resultView.panelView.children.add(listView);\n        resultView.buttonView.set({\n            icon: IconImage,\n            label: t('Image')\n        });\n        for (const integrationView of integrationViews) {\n            const listItemView = new MenuBarMenuListItemView(locale, resultView);\n            listItemView.children.add(integrationView);\n            listView.items.add(listItemView);\n            integrationView.delegate('execute').to(resultView);\n        }\n        return resultView;\n    }\n    /**\n     * Validates the integrations list.\n     */\n    _prepareIntegrations() {\n        const editor = this.editor;\n        const items = editor.config.get('image.insert.integrations');\n        const result = [];\n        if (!items.length) {\n            /**\n             * The insert image feature requires a list of integrations to be provided in the editor configuration.\n             *\n             * The default list of integrations is `upload`, `assetManager`, `url`. Those integrations are included\n             * in the insert image dropdown if the given feature plugin is loaded. You should omit the `integrations`\n             * configuration key to use the default set or provide a selected list of integrations that should be used.\n             *\n             * @error image-insert-integrations-not-specified\n             */\n            logWarning('image-insert-integrations-not-specified');\n            return result;\n        }\n        for (const item of items) {\n            if (!this._integrations.has(item)) {\n                if (!['upload', 'assetManager', 'url'].includes(item)) {\n                    /**\n                     * The specified insert image integration name is unknown or the providing plugin is not loaded in the editor.\n                     *\n                     * @error image-insert-unknown-integration\n                     */\n                    logWarning('image-insert-unknown-integration', { item });\n                }\n                continue;\n            }\n            result.push(this._integrations.get(item));\n        }\n        if (!result.length) {\n            /**\n             * The image insert feature requires integrations to be registered by separate features.\n             *\n             * The `insertImage` toolbar button requires integrations to be registered by other features.\n             * For example {@link module:image/imageupload~ImageUpload ImageUpload},\n             * {@link module:image/imageinsert~ImageInsert ImageInsert},\n             * {@link module:image/imageinsertviaurl~ImageInsertViaUrl ImageInsertViaUrl},\n             * {@link module:ckbox/ckbox~CKBox CKBox}\n             *\n             * @error image-insert-integrations-not-registered\n             */\n            logWarning('image-insert-integrations-not-registered');\n        }\n        return result;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1zM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1zm-5.655 6a2.13 2.13 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageblock\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { ImageTextAlternative } from './imagetextalternative.js';\nimport { ImageBlockEditing } from './image/imageblockediting.js';\nimport { ImageInsertUI } from './imageinsert/imageinsertui.js';\nimport '../theme/image.css';\n/**\n * The image block plugin.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n *\n * * {@link module:image/image/imageblockediting~ImageBlockEditing},\n * * {@link module:image/imagetextalternative~ImageTextAlternative}.\n *\n * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}\n * for more information.\n */\nexport class ImageBlock extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageBlockEditing, Widget, ImageTextAlternative, ImageInsertUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageBlock';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image/imageinlineediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { downcastImageAttribute, downcastSrcsetAttribute } from './converters.js';\nimport { ImageEditing } from './imageediting.js';\nimport { ImageSizeAttributes } from '../imagesizeattributes.js';\nimport { ImageTypeCommand } from './imagetypecommand.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { getImgViewElementMatcher, createInlineImageViewElement, determineImageTypeForInsertionAtSelection } from './utils.js';\nimport { ImagePlaceholder } from './imageplaceholder.js';\n/**\n * The image inline plugin.\n *\n * It registers:\n *\n * * `<imageInline>` as an inline element in the document schema, and allows `alt`, `src` and `srcset` attributes.\n * * converters for editing and data pipelines.\n * * {@link module:image/image/imagetypecommand~ImageTypeCommand `'imageTypeInline'`} command that converts block images into\n * inline images.\n */\nexport class ImageInlineEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageEditing, ImageSizeAttributes, ImageUtils, ImagePlaceholder, ClipboardPipeline];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageInlineEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        // Converters 'alt' and 'srcset' are added in 'ImageEditing' plugin.\n        schema.register('imageInline', {\n            inheritAllFrom: '$inlineObject',\n            allowAttributes: ['alt', 'src', 'srcset'],\n            // Disallow inline images in captions (at least for now).\n            // This is the best spot to do that because independent packages can introduce captions (ImageCaption, TableCaption, etc.).\n            disallowIn: ['caption']\n        });\n        this._setupConversion();\n        if (editor.plugins.has('ImageBlockEditing')) {\n            editor.commands.add('imageTypeInline', new ImageTypeCommand(this.editor, 'imageInline'));\n            this._setupClipboardIntegration();\n        }\n    }\n    /**\n     * Configures conversion pipelines to support upcasting and downcasting\n     * inline images (inline image widgets) and their attributes.\n     */\n    _setupConversion() {\n        const editor = this.editor;\n        const t = editor.t;\n        const conversion = editor.conversion;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        conversion.for('dataDowncast')\n            .elementToElement({\n            model: 'imageInline',\n            view: (modelElement, { writer }) => writer.createEmptyElement('img')\n        });\n        conversion.for('editingDowncast')\n            .elementToStructure({\n            model: 'imageInline',\n            view: (modelElement, { writer }) => imageUtils.toImageWidget(createInlineImageViewElement(writer), writer, t('image widget'))\n        });\n        conversion.for('downcast')\n            .add(downcastImageAttribute(imageUtils, 'imageInline', 'src'))\n            .add(downcastImageAttribute(imageUtils, 'imageInline', 'alt'))\n            .add(downcastSrcsetAttribute(imageUtils, 'imageInline'));\n        // More image related upcasts are in 'ImageEditing' plugin.\n        conversion.for('upcast')\n            .elementToElement({\n            view: getImgViewElementMatcher(editor, 'imageInline'),\n            model: (viewImage, { writer }) => writer.createElement('imageInline', viewImage.hasAttribute('src') ? { src: viewImage.getAttribute('src') } : undefined)\n        });\n    }\n    /**\n     * Integrates the plugin with the clipboard pipeline.\n     *\n     * Idea is that the feature should recognize the user's intent when an **block** image is\n     * pasted or dropped. If such an image is pasted/dropped into a non-empty block\n     * (e.g. a paragraph with some text) it gets converted into an inline image on the fly.\n     *\n     * We assume this is the user's intent if they decided to put their image there.\n     *\n     * **Note**: If a block image has a caption, it will not be converted to an inline image\n     * to avoid the confusion. Captions are added on purpose and they should never be lost\n     * in the clipboard pipeline.\n     *\n     * See the `ImageBlockEditing` for the similar integration that works in the opposite direction.\n     *\n     * The feature also sets image `width` and `height` attributes when pasting.\n     */\n    _setupClipboardIntegration() {\n        const editor = this.editor;\n        const model = editor.model;\n        const editingView = editor.editing.view;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const clipboardPipeline = editor.plugins.get('ClipboardPipeline');\n        this.listenTo(clipboardPipeline, 'inputTransformation', (evt, data) => {\n            const docFragmentChildren = Array.from(data.content.getChildren());\n            let modelRange;\n            // Make sure only <figure class=\"image\"></figure> elements are dropped or pasted. Otherwise, if there some other HTML\n            // mixed up, this should be handled as a regular paste.\n            if (!docFragmentChildren.every(imageUtils.isBlockImageView)) {\n                return;\n            }\n            // When drag and dropping, data.targetRanges specifies where to drop because\n            // this is usually a different place than the current model selection (the user\n            // uses a drop marker to specify the drop location).\n            if (data.targetRanges) {\n                modelRange = editor.editing.mapper.toModelRange(data.targetRanges[0]);\n            }\n            // Pasting, however, always occurs at the current model selection.\n            else {\n                modelRange = model.document.selection.getFirstRange();\n            }\n            const selection = model.createSelection(modelRange);\n            // Convert block images into inline images only when pasting or dropping into non-empty blocks\n            // and when the block is not an object (e.g. pasting to replace another widget).\n            if (determineImageTypeForInsertionAtSelection(model.schema, selection) === 'imageInline') {\n                const writer = new ViewUpcastWriter(editingView.document);\n                // Unwrap <figure class=\"image\"><img .../></figure> -> <img ... />\n                // but <figure class=\"image\"><img .../><figcaption>...</figcaption></figure> -> stays the same\n                const inlineViewImages = docFragmentChildren.map(blockViewImage => {\n                    // If there's just one child, it can be either <img /> or <a><img></a>.\n                    // If there are other children than <img>, this means that the block image\n                    // has a caption or some other features and this kind of image should be\n                    // pasted/dropped without modifications.\n                    if (blockViewImage.childCount === 1) {\n                        // Pass the attributes which are present only in the <figure> to the <img>\n                        // (e.g. the style=\"width:10%\" attribute applied by the ImageResize plugin).\n                        Array.from(blockViewImage.getAttributes())\n                            .forEach(attribute => writer.setAttribute(...attribute, imageUtils.findViewImgElement(blockViewImage)));\n                        return blockViewImage.getChild(0);\n                    }\n                    else {\n                        return blockViewImage;\n                    }\n                });\n                data.content = writer.createDocumentFragment(inlineViewImages);\n            }\n        });\n        this.listenTo(clipboardPipeline, 'contentInsertion', (evt, data) => {\n            if (data.method !== 'paste') {\n                return;\n            }\n            model.change(writer => {\n                const range = writer.createRangeIn(data.content);\n                for (const item of range.getItems()) {\n                    if (item.is('element', 'imageInline')) {\n                        imageUtils.setImageNaturalSizeAttributes(item);\n                    }\n                }\n            });\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinline\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { ImageTextAlternative } from './imagetextalternative.js';\nimport { ImageInlineEditing } from './image/imageinlineediting.js';\nimport { ImageInsertUI } from './imageinsert/imageinsertui.js';\nimport '../theme/image.css';\n/**\n * The image inline plugin.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n *\n * * {@link module:image/image/imageinlineediting~ImageInlineEditing},\n * * {@link module:image/imagetextalternative~ImageTextAlternative}.\n *\n * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}\n * for more information.\n */\nexport class ImageInline extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageInlineEditing, Widget, ImageTextAlternative, ImageInsertUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageInline';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { ImageBlockEditing } from '../image/imageblockediting.js';\n/**\n * The toggle image caption command.\n *\n * This command is registered by {@link module:image/imagecaption/imagecaptionediting~ImageCaptionEditing} as the\n * `'toggleImageCaption'` editor command.\n *\n * Executing this command:\n *\n * * either adds or removes the image caption of a selected image (depending on whether the caption is present or not),\n * * removes the image caption if the selection is anchored in one.\n *\n * ```ts\n * // Toggle the presence of the caption.\n * editor.execute( 'toggleImageCaption' );\n * ```\n *\n * **Note**: Upon executing this command, the selection will be set on the image if previously anchored in the caption element.\n *\n * **Note**: You can move the selection to the caption right away as it shows up upon executing this command by using\n * the `focusCaptionOnShow` option:\n *\n * ```ts\n * editor.execute( 'toggleImageCaption', { focusCaptionOnShow: true } );\n * ```\n */\nexport class ToggleImageCaptionCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageCaptionUtils = editor.plugins.get('ImageCaptionUtils');\n        const imageUtils = editor.plugins.get('ImageUtils');\n        // Only block images can get captions.\n        if (!editor.plugins.has(ImageBlockEditing)) {\n            this.isEnabled = false;\n            this.value = false;\n            return;\n        }\n        const selection = editor.model.document.selection;\n        const selectedElement = selection.getSelectedElement();\n        if (!selectedElement) {\n            const ancestorCaptionElement = imageCaptionUtils.getCaptionFromModelSelection(selection);\n            this.isEnabled = !!ancestorCaptionElement;\n            this.value = !!ancestorCaptionElement;\n            return;\n        }\n        // Block images support captions by default but the command should also be enabled for inline\n        // images because toggling the caption when one is selected should convert it into a block image.\n        this.isEnabled = imageUtils.isImage(selectedElement);\n        if (!this.isEnabled) {\n            this.value = false;\n        }\n        else {\n            this.value = !!imageCaptionUtils.getCaptionFromImageModelElement(selectedElement);\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * ```ts\n     * editor.execute( 'toggleImageCaption' );\n     * ```\n     *\n     * @param options Options for the executed command.\n     * @param options.focusCaptionOnShow When true and the caption shows up, the selection will be moved into it straight away.\n     * @fires execute\n     */\n    execute(options = {}) {\n        const { focusCaptionOnShow } = options;\n        this.editor.model.change(writer => {\n            if (this.value) {\n                this._hideImageCaption(writer);\n            }\n            else {\n                this._showImageCaption(writer, focusCaptionOnShow);\n            }\n        });\n    }\n    /**\n     * Shows the caption of the `<imageBlock>` or `<imageInline>`. Also:\n     *\n     * * it converts `<imageInline>` to `<imageBlock>` to show the caption,\n     * * it attempts to restore the caption content from the `ImageCaptionEditing` caption registry,\n     * * it moves the selection to the caption right away, it the `focusCaptionOnShow` option was set.\n     */\n    _showImageCaption(writer, focusCaptionOnShow) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const imageCaptionEditing = this.editor.plugins.get('ImageCaptionEditing');\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        let selectedImage = selection.getSelectedElement();\n        const savedCaption = imageCaptionEditing._getSavedCaption(selectedImage);\n        // Convert imageInline -> image first.\n        if (imageUtils.isInlineImage(selectedImage)) {\n            this.editor.execute('imageTypeBlock');\n            // Executing the command created a new model element. Let's pick it again.\n            selectedImage = selection.getSelectedElement();\n        }\n        // Try restoring the caption from the ImageCaptionEditing plugin storage.\n        const newCaptionElement = savedCaption || writer.createElement('caption');\n        writer.append(newCaptionElement, selectedImage);\n        if (focusCaptionOnShow) {\n            writer.setSelection(newCaptionElement, 'in');\n        }\n    }\n    /**\n     * Hides the caption of a selected image (or an image caption the selection is anchored to).\n     *\n     * The content of the caption is stored in the `ImageCaptionEditing` caption registry to make this\n     * a reversible action.\n     */\n    _hideImageCaption(writer) {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const imageCaptionEditing = editor.plugins.get('ImageCaptionEditing');\n        const imageCaptionUtils = editor.plugins.get('ImageCaptionUtils');\n        let selectedImage = selection.getSelectedElement();\n        let captionElement;\n        if (selectedImage) {\n            captionElement = imageCaptionUtils.getCaptionFromImageModelElement(selectedImage);\n        }\n        else {\n            captionElement = imageCaptionUtils.getCaptionFromModelSelection(selection);\n            selectedImage = captionElement.parent;\n        }\n        // Store the caption content so it can be restored quickly if the user changes their mind even if they toggle image<->imageInline.\n        imageCaptionEditing._saveCaption(selectedImage, captionElement);\n        writer.setSelection(selectedImage, 'on');\n        writer.remove(captionElement);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageUtils } from '../imageutils.js';\n/**\n * The image caption utilities plugin.\n */\nexport class ImageCaptionUtils extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageCaptionUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * Returns the caption model element from a given image element. Returns `null` if no caption is found.\n     */\n    getCaptionFromImageModelElement(imageModelElement) {\n        for (const node of imageModelElement.getChildren()) {\n            if (!!node && node.is('element', 'caption')) {\n                return node;\n            }\n        }\n        return null;\n    }\n    /**\n     * Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.\n     */\n    getCaptionFromModelSelection(selection) {\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        const captionElement = selection.getFirstPosition().findAncestor('caption');\n        if (!captionElement) {\n            return null;\n        }\n        if (imageUtils.isBlockImage(captionElement.parent)) {\n            return captionElement;\n        }\n        return null;\n    }\n    /**\n     * {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a `<figcaption>` element that is placed\n     * inside the image `<figure>` element.\n     * @returns Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element\n     * cannot be matched.\n     */\n    matchImageCaptionViewElement(element) {\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        // Convert only captions for images.\n        if (element.name == 'figcaption' && imageUtils.isBlockImageView(element.parent)) {\n            return { name: true };\n        }\n        return null;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagecaption/imagecaptionediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ModelElement, enableViewPlaceholder } from 'ckeditor5/src/engine.js';\nimport { toWidgetEditable } from 'ckeditor5/src/widget.js';\nimport { ToggleImageCaptionCommand } from './toggleimagecaptioncommand.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { ImageCaptionUtils } from './imagecaptionutils.js';\n/**\n * The image caption engine plugin. It is responsible for:\n *\n * * registering converters for the caption element,\n * * registering converters for the caption model attribute,\n * * registering the {@link module:image/imagecaption/toggleimagecaptioncommand~ToggleImageCaptionCommand `toggleImageCaption`} command.\n */\nexport class ImageCaptionEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils, ImageCaptionUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageCaptionEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * A map that keeps saved JSONified image captions and image model elements they are\n     * associated with.\n     *\n     * To learn more about this system, see {@link #_saveCaption}.\n     */\n    _savedCaptionsMap;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this._savedCaptionsMap = new WeakMap();\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        // Schema configuration.\n        if (!schema.isRegistered('caption')) {\n            schema.register('caption', {\n                allowIn: 'imageBlock',\n                allowContentOf: '$block',\n                isLimit: true\n            });\n        }\n        else {\n            schema.extend('caption', {\n                allowIn: 'imageBlock'\n            });\n        }\n        editor.commands.add('toggleImageCaption', new ToggleImageCaptionCommand(this.editor));\n        this._setupConversion();\n        this._setupImageTypeCommandsIntegration();\n        this._registerCaptionReconversion();\n    }\n    /**\n     * Configures conversion pipelines to support upcasting and downcasting\n     * image captions.\n     */\n    _setupConversion() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const imageCaptionUtils = editor.plugins.get('ImageCaptionUtils');\n        const t = editor.t;\n        // View -> model converter for the data pipeline.\n        editor.conversion.for('upcast').elementToElement({\n            view: element => imageCaptionUtils.matchImageCaptionViewElement(element),\n            model: 'caption'\n        });\n        // Model -> view converter for the data pipeline.\n        editor.conversion.for('dataDowncast').elementToElement({\n            model: 'caption',\n            view: (modelElement, { writer }) => {\n                if (!imageUtils.isBlockImage(modelElement.parent)) {\n                    return null;\n                }\n                return writer.createContainerElement('figcaption');\n            }\n        });\n        // Model -> view converter for the editing pipeline.\n        editor.conversion.for('editingDowncast').elementToElement({\n            model: 'caption',\n            view: (modelElement, { writer }) => {\n                if (!imageUtils.isBlockImage(modelElement.parent)) {\n                    return null;\n                }\n                const figcaptionElement = writer.createEditableElement('figcaption');\n                writer.setCustomProperty('imageCaption', true, figcaptionElement);\n                figcaptionElement.placeholder = t('Enter image caption');\n                enableViewPlaceholder({\n                    view,\n                    element: figcaptionElement,\n                    keepOnFocus: true\n                });\n                const imageAlt = modelElement.parent.getAttribute('alt');\n                const label = imageAlt ? t('Caption for image: %0', [imageAlt]) : t('Caption for the image');\n                return toWidgetEditable(figcaptionElement, writer, { label });\n            }\n        });\n    }\n    /**\n     * Integrates with {@link module:image/image/imagetypecommand~ImageTypeCommand image type commands}\n     * to make sure the caption is preserved when the type of an image changes so it can be restored\n     * in the future if the user decides they want their caption back.\n     */\n    _setupImageTypeCommandsIntegration() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const imageCaptionUtils = editor.plugins.get('ImageCaptionUtils');\n        const imageTypeInlineCommand = editor.commands.get('imageTypeInline');\n        const imageTypeBlockCommand = editor.commands.get('imageTypeBlock');\n        const handleImageTypeChange = evt => {\n            // The image type command execution can be unsuccessful.\n            if (!evt.return) {\n                return;\n            }\n            const { oldElement, newElement } = evt.return;\n            /* istanbul ignore if: paranoid check -- @preserve */\n            if (!oldElement) {\n                return;\n            }\n            if (imageUtils.isBlockImage(oldElement)) {\n                const oldCaptionElement = imageCaptionUtils.getCaptionFromImageModelElement(oldElement);\n                // If the old element was a captioned block image (the caption was visible),\n                // simply save it so it can be restored.\n                if (oldCaptionElement) {\n                    this._saveCaption(newElement, oldCaptionElement);\n                    return;\n                }\n            }\n            const savedOldElementCaption = this._getSavedCaption(oldElement);\n            // If either:\n            //\n            // * the block image didn't have a visible caption,\n            // * the block image caption was hidden (and already saved),\n            // * the inline image was passed\n            //\n            // just try to \"pass\" the saved caption from the old image to the new image\n            // so it can be retrieved in the future if the user wants it back.\n            if (savedOldElementCaption) {\n                // Note: Since we're writing to a WeakMap, we don't bother with removing the\n                // [ oldElement, savedOldElementCaption ] pair from it.\n                this._saveCaption(newElement, savedOldElementCaption);\n            }\n        };\n        // Presence of the commands depends on the Image(Inline|Block)Editing plugins loaded in the editor.\n        if (imageTypeInlineCommand) {\n            this.listenTo(imageTypeInlineCommand, 'execute', handleImageTypeChange, { priority: 'low' });\n        }\n        if (imageTypeBlockCommand) {\n            this.listenTo(imageTypeBlockCommand, 'execute', handleImageTypeChange, { priority: 'low' });\n        }\n    }\n    /**\n     * Returns the saved {@link module:engine/model/element~ModelElement#toJSON JSONified} caption\n     * of an image model element.\n     *\n     * See {@link #_saveCaption}.\n     *\n     * @internal\n     * @param imageModelElement The model element the caption should be returned for.\n     * @returns The model caption element or `null` if there is none.\n     */\n    _getSavedCaption(imageModelElement) {\n        const jsonObject = this._savedCaptionsMap.get(imageModelElement);\n        return jsonObject ? ModelElement.fromJSON(jsonObject) : null;\n    }\n    /**\n     * Saves a {@link module:engine/model/element~ModelElement#toJSON JSONified} caption for\n     * an image element to allow restoring it in the future.\n     *\n     * A caption is saved every time it gets hidden and/or the type of an image changes. The\n     * user should be able to restore it on demand.\n     *\n     * **Note**: The caption cannot be stored in the image model element attribute because,\n     * for instance, when the model state propagates to collaborators, the attribute would get\n     * lost (mainly because it does not convert to anything when the caption is hidden) and\n     * the states of collaborators' models would de-synchronize causing numerous issues.\n     *\n     * See {@link #_getSavedCaption}.\n     *\n     * @internal\n     * @param imageModelElement The model element the caption is saved for.\n     * @param caption The caption model element to be saved.\n     */\n    _saveCaption(imageModelElement, caption) {\n        this._savedCaptionsMap.set(imageModelElement, caption.toJSON());\n    }\n    /**\n     * Reconverts image caption when image alt attribute changes.\n     * The change of alt attribute is reflected in caption's aria-label attribute.\n     */\n    _registerCaptionReconversion() {\n        const editor = this.editor;\n        const model = editor.model;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const imageCaptionUtils = editor.plugins.get('ImageCaptionUtils');\n        model.document.on('change:data', () => {\n            const changes = model.document.differ.getChanges();\n            for (const change of changes) {\n                if (change.attributeKey !== 'alt') {\n                    continue;\n                }\n                const image = change.range.start.nodeAfter;\n                if (imageUtils.isBlockImage(image)) {\n                    const caption = imageCaptionUtils.getCaptionFromImageModelElement(image);\n                    if (!caption) {\n                        return;\n                    }\n                    editor.editing.reconvertItem(caption);\n                }\n            }\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2\\\"/><path fill-opacity=\\\".6\\\" d=\\\"M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagecaption/imagecaptionui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView } from 'ckeditor5/src/ui.js';\nimport { IconCaption } from 'ckeditor5/src/icons.js';\nimport { ImageCaptionUtils } from './imagecaptionutils.js';\n/**\n * The image caption UI plugin. It introduces the `'toggleImageCaption'` UI button.\n */\nexport class ImageCaptionUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageCaptionUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageCaptionUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const imageCaptionUtils = editor.plugins.get('ImageCaptionUtils');\n        const t = editor.t;\n        editor.ui.componentFactory.add('toggleImageCaption', locale => {\n            const command = editor.commands.get('toggleImageCaption');\n            const view = new ButtonView(locale);\n            view.set({\n                icon: IconCaption,\n                tooltip: true,\n                isToggleable: true\n            });\n            view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');\n            view.bind('label').to(command, 'value', value => value ? t('Toggle caption off') : t('Toggle caption on'));\n            this.listenTo(view, 'execute', () => {\n                editor.execute('toggleImageCaption', { focusCaptionOnShow: true });\n                // Scroll to the selection and highlight the caption if the caption showed up.\n                const modelCaptionElement = imageCaptionUtils.getCaptionFromModelSelection(editor.model.document.selection);\n                if (modelCaptionElement) {\n                    const figcaptionElement = editor.editing.mapper.toViewElement(modelCaptionElement);\n                    editingView.scrollToTheSelection();\n                    editingView.change(writer => {\n                        writer.addClass('image__caption_highlighted', figcaptionElement);\n                    });\n                }\n                editor.editing.view.focus();\n            });\n            return view;\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The image style command. It is used to apply {@link module:image/imageconfig~ImageStyleConfig#options image style option}\n * to a selected image.\n *\n * **Note**: Executing this command may change the image model element if the desired style requires an image of a different\n * type. See {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand#execute} to learn more.\n */\nexport class ImageStyleCommand extends Command {\n    /**\n     * An object containing names of default style options for the inline and block images.\n     * If there is no default style option for the given image type in the configuration,\n     * the name will be `false`.\n     */\n    _defaultStyles;\n    /**\n     * The styles handled by this command.\n     */\n    _styles;\n    /**\n     * Creates an instance of the image style command. When executed, the command applies one of\n     * {@link module:image/imageconfig~ImageStyleConfig#options style options} to the currently selected image.\n     *\n     * @param editor The editor instance.\n     * @param styles The style options that this command supports.\n     */\n    constructor(editor, styles) {\n        super(editor);\n        this._defaultStyles = {\n            imageBlock: false,\n            imageInline: false\n        };\n        this._styles = new Map(styles.map(style => {\n            if (style.isDefault) {\n                for (const modelElementName of style.modelElements) {\n                    this._defaultStyles[modelElementName] = style.name;\n                }\n            }\n            return [style.name, style];\n        }));\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const element = imageUtils.getClosestSelectedImageElement(this.editor.model.document.selection);\n        this.isEnabled = !!element;\n        if (!this.isEnabled) {\n            this.value = false;\n        }\n        else if (element.hasAttribute('imageStyle')) {\n            this.value = element.getAttribute('imageStyle');\n        }\n        else {\n            this.value = this._defaultStyles[element.name];\n        }\n    }\n    /**\n     * Executes the command and applies the style to the currently selected image:\n     *\n     * ```ts\n     * editor.execute( 'imageStyle', { value: 'side' } );\n     * ```\n     *\n     * **Note**: Executing this command may change the image model element if the desired style requires an image\n     * of a different type. Learn more about {@link module:image/imageconfig~ImageStyleOptionDefinition#modelElements model element}\n     * configuration for the style option.\n     *\n     * @param options.value The name of the style (as configured in {@link module:image/imageconfig~ImageStyleConfig#options}).\n     * @param options.setImageSizes Specifies whether the image `width` and `height` attributes should be set automatically.\n     * The default is `true`.\n     * @fires execute\n     */\n    execute(options = {}) {\n        const editor = this.editor;\n        const model = editor.model;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        model.change(writer => {\n            const requestedStyle = options.value;\n            const { setImageSizes = true } = options;\n            let imageElement = imageUtils.getClosestSelectedImageElement(model.document.selection);\n            // Change the image type if a style requires it.\n            if (requestedStyle && this.shouldConvertImageType(requestedStyle, imageElement)) {\n                this.editor.execute(imageUtils.isBlockImage(imageElement) ? 'imageTypeInline' : 'imageTypeBlock', { setImageSizes });\n                // Update the imageElement to the newly created image.\n                imageElement = imageUtils.getClosestSelectedImageElement(model.document.selection);\n            }\n            // Default style means that there is no `imageStyle` attribute in the model.\n            // https://github.com/ckeditor/ckeditor5-image/issues/147\n            if (!requestedStyle || this._styles.get(requestedStyle).isDefault) {\n                writer.removeAttribute('imageStyle', imageElement);\n            }\n            else {\n                writer.setAttribute('imageStyle', requestedStyle, imageElement);\n            }\n            if (setImageSizes) {\n                imageUtils.setImageNaturalSizeAttributes(imageElement);\n            }\n        });\n    }\n    /**\n     * Returns `true` if requested style change would trigger the image type change.\n     *\n     * @param requestedStyle The name of the style (as configured in {@link module:image/imageconfig~ImageStyleConfig#options}).\n     * @param imageElement The image model element.\n     */\n    shouldConvertImageType(requestedStyle, imageElement) {\n        const supportedTypes = this._styles.get(requestedStyle).modelElements;\n        return !supportedTypes.includes(imageElement.name);\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H3.5V12h6.997z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H3.5V12h6.997z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm0 12h16v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H3.5V12h6.997z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm0 12h16v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H6.5V12h6.997z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H9.5V12h6.997z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm0 12h16v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H9.5V12h6.997z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagestyle/utils\n */\nimport { logWarning } from 'ckeditor5/src/utils.js';\nimport { IconObjectCenter, IconObjectFullWidth, IconObjectInline, IconObjectInlineLeft, IconObjectInlineRight, IconObjectLeft, IconObjectRight } from 'ckeditor5/src/icons.js';\n/**\n * Default image style options provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#styles}\n * configuration.\n *\n * There are available 5 styles focused on formatting:\n *\n * * **`'alignLeft'`** aligns the inline or block image to the left and wraps it with the text using the `image-style-align-left` class,\n * * **`'alignRight'`** aligns the inline or block image to the right and wraps it with the text using the `image-style-align-right` class,\n * * **`'alignCenter'`** centers the block image using the `image-style-align-center` class,\n * * **`'alignBlockLeft'`** aligns the block image to the left using the `image-style-block-align-left` class,\n * * **`'alignBlockRight'`** aligns the block image to the right using the `image-style-block-align-right` class,\n *\n * and 3 semantic styles:\n *\n * * **`'inline'`** is an inline image without any CSS class,\n * * **`'block'`** is a block image without any CSS class,\n * * **`'side'`** is a block image styled with the `image-style-side` CSS class.\n *\n * @internal\n */\nexport const DEFAULT_OPTIONS = {\n    // This style represents an image placed in the line of text.\n    get inline() {\n        return {\n            name: 'inline',\n            title: 'In line',\n            icon: IconObjectInline,\n            modelElements: ['imageInline'],\n            isDefault: true\n        };\n    },\n    // This style represents an image aligned to the left and wrapped with text.\n    get alignLeft() {\n        return {\n            name: 'alignLeft',\n            title: 'Left aligned image',\n            icon: IconObjectInlineLeft,\n            modelElements: ['imageBlock', 'imageInline'],\n            className: 'image-style-align-left'\n        };\n    },\n    // This style represents an image aligned to the left.\n    get alignBlockLeft() {\n        return {\n            name: 'alignBlockLeft',\n            title: 'Left aligned image',\n            icon: IconObjectLeft,\n            modelElements: ['imageBlock'],\n            className: 'image-style-block-align-left'\n        };\n    },\n    // This style represents a centered image.\n    get alignCenter() {\n        return {\n            name: 'alignCenter',\n            title: 'Centered image',\n            icon: IconObjectCenter,\n            modelElements: ['imageBlock'],\n            className: 'image-style-align-center'\n        };\n    },\n    // This style represents an image aligned to the right and wrapped with text.\n    get alignRight() {\n        return {\n            name: 'alignRight',\n            title: 'Right aligned image',\n            icon: IconObjectInlineRight,\n            modelElements: ['imageBlock', 'imageInline'],\n            className: 'image-style-align-right'\n        };\n    },\n    // This style represents an image aligned to the right.\n    get alignBlockRight() {\n        return {\n            name: 'alignBlockRight',\n            title: 'Right aligned image',\n            icon: IconObjectRight,\n            modelElements: ['imageBlock'],\n            className: 'image-style-block-align-right'\n        };\n    },\n    // This option is equal to the situation when no style is applied.\n    get block() {\n        return {\n            name: 'block',\n            title: 'Centered image',\n            icon: IconObjectCenter,\n            modelElements: ['imageBlock'],\n            isDefault: true\n        };\n    },\n    // This represents a side image.\n    get side() {\n        return {\n            name: 'side',\n            title: 'Side image',\n            icon: IconObjectInlineRight,\n            modelElements: ['imageBlock'],\n            className: 'image-style-side'\n        };\n    }\n};\n/**\n * Default image style icons provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#styles}\n * configuration.\n *\n * See {@link module:image/imageconfig~ImageStyleOptionDefinition#icon} to learn more.\n *\n * There are 7 default icons available: `'full'`, `'left'`, `'inlineLeft'`, `'center'`, `'right'`, `'inlineRight'`, and `'inline'`.\n *\n * @internal\n */\nexport const DEFAULT_ICONS = /* #__PURE__ */ (() => ({\n    full: IconObjectFullWidth,\n    left: IconObjectLeft,\n    right: IconObjectRight,\n    center: IconObjectCenter,\n    inlineLeft: IconObjectInlineLeft,\n    inlineRight: IconObjectInlineRight,\n    inline: IconObjectInline\n}))();\n/**\n * Default drop-downs provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#toolbar}\n * configuration. The drop-downs are containers for the {@link module:image/imageconfig~ImageStyleConfig#options image style options}.\n *\n * If both of the `ImageEditing` plugins are loaded, there are 2 predefined drop-downs available:\n *\n * * **`'imageStyle:wrapText'`**, which contains the `alignLeft` and `alignRight` options, that is,\n * those that wraps the text around the image,\n * * **`'imageStyle:breakText'`**, which contains the `alignBlockLeft`, `alignCenter` and `alignBlockRight` options, that is,\n * those that breaks the text around the image.\n *\n * @internal\n */\nexport const DEFAULT_DROPDOWN_DEFINITIONS = [{\n        name: 'imageStyle:wrapText',\n        title: 'Wrap text',\n        defaultItem: 'imageStyle:alignLeft',\n        items: ['imageStyle:alignLeft', 'imageStyle:alignRight']\n    }, {\n        name: 'imageStyle:breakText',\n        title: 'Break text',\n        defaultItem: 'imageStyle:block',\n        items: ['imageStyle:alignBlockLeft', 'imageStyle:block', 'imageStyle:alignBlockRight']\n    }];\n/**\n * Returns a list of the normalized and validated image style options.\n *\n * @param config\n * @param config.isInlinePluginLoaded\n * Determines whether the {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugin has been loaded.\n * @param config.isBlockPluginLoaded\n * Determines whether the {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugin has been loaded.\n * @param config.configuredStyles\n * The image styles configuration provided in the image styles {@link module:image/imageconfig~ImageConfig#styles configuration}\n * as a default or custom value.\n * @returns\n * * Each of options contains a complete icon markup.\n * * The image style options not supported by any of the loaded plugins are filtered out.\n */\nfunction normalizeStyles(config) {\n    const configuredStyles = config.configuredStyles.options || [];\n    const styles = configuredStyles\n        .map(arrangement => normalizeDefinition(arrangement))\n        .filter(arrangement => isValidOption(arrangement, config));\n    return styles;\n}\n/**\n * Returns the default image styles configuration depending on the loaded image editing plugins.\n *\n * @param isInlinePluginLoaded\n * Determines whether the {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugin has been loaded.\n *\n * @param isBlockPluginLoaded\n * Determines whether the {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugin has been loaded.\n *\n * @returns\n * It returns an object with the lists of the image style options and groups defined as strings related to the\n * {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default options}\n */\nfunction getDefaultStylesConfiguration(isBlockPluginLoaded, isInlinePluginLoaded) {\n    if (isBlockPluginLoaded && isInlinePluginLoaded) {\n        return {\n            options: [\n                'inline', 'alignLeft', 'alignRight',\n                'alignCenter', 'alignBlockLeft', 'alignBlockRight',\n                'block', 'side'\n            ]\n        };\n    }\n    else if (isBlockPluginLoaded) {\n        return {\n            options: ['block', 'side']\n        };\n    }\n    else if (isInlinePluginLoaded) {\n        return {\n            options: ['inline', 'alignLeft', 'alignRight']\n        };\n    }\n    return {};\n}\n/**\n * Returns a list of the available predefined drop-downs' definitions depending on the loaded image editing plugins.\n */\nfunction getDefaultDropdownDefinitions(pluginCollection) {\n    if (pluginCollection.has('ImageBlockEditing') && pluginCollection.has('ImageInlineEditing')) {\n        return [...DEFAULT_DROPDOWN_DEFINITIONS];\n    }\n    else {\n        return [];\n    }\n}\n/**\n * Normalizes an image style option or group provided in the {@link module:image/imageconfig~ImageConfig#styles}\n * and returns it in a {@link module:image/imageconfig~ImageStyleOptionDefinition}/\n */\nfunction normalizeDefinition(definition) {\n    if (typeof definition === 'string') {\n        // Just the name of the style has been passed, but none of the defaults.\n        if (!DEFAULT_OPTIONS[definition]) {\n            // Normalize the style anyway to prevent errors.\n            definition = { name: definition };\n        }\n        // Just the name of the style has been passed and it's one of the defaults, just use it.\n        // Clone the style to avoid overriding defaults.\n        else {\n            definition = { ...DEFAULT_OPTIONS[definition] };\n        }\n    }\n    else {\n        // If an object style has been passed and if the name matches one of the defaults,\n        // extend it with defaults – the user wants to customize a default style.\n        // Note: Don't override the user–defined style object, clone it instead.\n        definition = extendStyle(DEFAULT_OPTIONS[definition.name], definition);\n    }\n    // If an icon is defined as a string and correspond with a name\n    // in default icons, use the default icon provided by the plugin.\n    if (typeof definition.icon === 'string') {\n        definition.icon = DEFAULT_ICONS[definition.icon] || definition.icon;\n    }\n    return definition;\n}\n/**\n * Checks if the image style option is valid:\n * * if it has the modelElements fields defined and filled,\n * * if the defined modelElements are supported by any of the loaded image editing plugins.\n * It also displays a console warning these conditions are not met.\n *\n * @param option image style option\n */\nfunction isValidOption(option, { isBlockPluginLoaded, isInlinePluginLoaded }) {\n    const { modelElements, name } = option;\n    if (!modelElements || !modelElements.length || !name) {\n        warnInvalidStyle({ style: option });\n        return false;\n    }\n    else {\n        const supportedElements = [isBlockPluginLoaded ? 'imageBlock' : null, isInlinePluginLoaded ? 'imageInline' : null];\n        // Check if the option is supported by any of the loaded plugins.\n        if (!modelElements.some(elementName => supportedElements.includes(elementName))) {\n            /**\n             * In order to work correctly, each image style {@link module:image/imageconfig~ImageStyleOptionDefinition option}\n             * requires specific model elements (also: types of images) to be supported by the editor.\n             *\n             * Model element names to which the image style option can be applied are defined in the\n             * {@link module:image/imageconfig~ImageStyleOptionDefinition#modelElements} property of the style option\n             * definition.\n             *\n             * Explore the warning in the console to find out precisely which option is not supported and which editor plugins\n             * are missing. Make sure these plugins are loaded in your editor to get this image style option working.\n             *\n             * @error image-style-missing-dependency\n             * @param {string} style The name of the unsupported option.\n             * @param {Array.<string>} missingPlugins The names of the plugins one of which has to be loaded for the particular option.\n             */\n            logWarning('image-style-missing-dependency', {\n                style: option,\n                missingPlugins: modelElements.map(name => name === 'imageBlock' ? 'ImageBlockEditing' : 'ImageInlineEditing')\n            });\n            return false;\n        }\n    }\n    return true;\n}\n/**\n * Extends the default style with a style provided by the developer.\n * Note: Don't override the custom–defined style object, clone it instead.\n */\nfunction extendStyle(source, style) {\n    const extendedStyle = { ...style };\n    for (const prop in source) {\n        if (!Object.prototype.hasOwnProperty.call(style, prop)) {\n            extendedStyle[prop] = source[prop];\n        }\n    }\n    return extendedStyle;\n}\n/**\n * Displays a console warning with the 'image-style-configuration-definition-invalid' error.\n */\nfunction warnInvalidStyle(info) {\n    /**\n     * The image style definition provided in the configuration is invalid.\n     *\n     * Please make sure the definition implements properly one of the following:\n     *\n     * * {@link module:image/imageconfig~ImageStyleOptionDefinition image style option definition},\n     * * {@link module:image/imageconfig~ImageStyleDropdownDefinition image style dropdown definition}\n     *\n     * @error image-style-configuration-definition-invalid\n     * @param {object} info The information about the invalid definition.\n     */\n    logWarning('image-style-configuration-definition-invalid', info);\n}\n/**\n * @internal\n */\nexport const utils = {\n    normalizeStyles,\n    getDefaultStylesConfiguration,\n    getDefaultDropdownDefinitions,\n    warnInvalidStyle\n};\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3h16v1.5H2zm0 12h16v1.5H2z\\\" opacity=\\\".5\\\"/><path d=\\\"M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1m-1.505.5H3.504V12h12.991z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * @module image/imagestyle/converters\n */\n/**\n * Returns a converter for the `imageStyle` attribute. It can be used for adding, changing and removing the attribute.\n *\n * @param styles An array containing available image style options.\n * @returns A model-to-view attribute converter.\n * @internal\n */\nexport function modelToViewStyleAttribute(styles) {\n    return (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        // Check if there is class name associated with given value.\n        const newStyle = getStyleDefinitionByName(data.attributeNewValue, styles);\n        const oldStyle = getStyleDefinitionByName(data.attributeOldValue, styles);\n        const viewElement = conversionApi.mapper.toViewElement(data.item);\n        const viewWriter = conversionApi.writer;\n        if (oldStyle) {\n            viewWriter.removeClass(oldStyle.className, viewElement);\n        }\n        if (newStyle) {\n            viewWriter.addClass(newStyle.className, viewElement);\n        }\n    };\n}\n/**\n * Returns a view-to-model converter converting image CSS classes to a proper value in the model.\n *\n * @param styles Image style options for which the converter is created.\n * @returns A view-to-model converter.\n * @internal\n */\nexport function viewToModelStyleAttribute(styles) {\n    // Convert only non–default styles.\n    const nonDefaultStyles = {\n        imageInline: styles.filter(style => !style.isDefault && style.modelElements.includes('imageInline')),\n        imageBlock: styles.filter(style => !style.isDefault && style.modelElements.includes('imageBlock'))\n    };\n    return (evt, data, conversionApi) => {\n        if (!data.modelRange) {\n            return;\n        }\n        const viewElement = data.viewItem;\n        const modelImageElement = first(data.modelRange.getItems());\n        // Run this converter only if an image has been found in the model.\n        // In some cases it may not be found (for example if we run this on a figure with different type than image).\n        if (!modelImageElement) {\n            return;\n        }\n        // ...and the `imageStyle` attribute is allowed for that element, otherwise stop conversion early.\n        if (!conversionApi.schema.checkAttribute(modelImageElement, 'imageStyle')) {\n            return;\n        }\n        // Convert styles one by one.\n        for (const style of nonDefaultStyles[modelImageElement.name]) {\n            // Try to consume class corresponding with the style.\n            if (conversionApi.consumable.consume(viewElement, { classes: style.className })) {\n                // And convert this style to model attribute.\n                conversionApi.writer.setAttribute('imageStyle', style.name, modelImageElement);\n            }\n        }\n    };\n}\n/**\n * Returns the style with a given `name` from an array of styles.\n */\nfunction getStyleDefinitionByName(name, styles) {\n    for (const style of styles) {\n        if (style.name === name) {\n            return style;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagestyle/imagestyleediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageStyleCommand } from './imagestylecommand.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { utils } from './utils.js';\nimport { viewToModelStyleAttribute, modelToViewStyleAttribute } from './converters.js';\n/**\n * The image style engine plugin. It sets the default configuration, creates converters and registers\n * {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand ImageStyleCommand}.\n */\nexport class ImageStyleEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageStyleEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * It contains a list of the normalized and validated style options.\n     *\n     * * Each option contains a complete icon markup.\n     * * The style options not supported by any of the loaded image editing plugins (\n     * {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} or\n     * {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`}) are filtered out.\n     *\n     * @internal\n     * @readonly\n     */\n    normalizedStyles;\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const isBlockPluginLoaded = editor.plugins.has('ImageBlockEditing');\n        const isInlinePluginLoaded = editor.plugins.has('ImageInlineEditing');\n        editor.config.define('image.styles', utils.getDefaultStylesConfiguration(isBlockPluginLoaded, isInlinePluginLoaded));\n        this.normalizedStyles = utils.normalizeStyles({\n            configuredStyles: editor.config.get('image.styles'),\n            isBlockPluginLoaded,\n            isInlinePluginLoaded\n        });\n        this._setupConversion(isBlockPluginLoaded, isInlinePluginLoaded);\n        this._setupPostFixer();\n        // Register imageStyle command.\n        editor.commands.add('imageStyle', new ImageStyleCommand(editor, this.normalizedStyles));\n    }\n    /**\n     * Sets the editor conversion taking the presence of\n     * {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`}\n     * and {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugins into consideration.\n     */\n    _setupConversion(isBlockPluginLoaded, isInlinePluginLoaded) {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const modelToViewConverter = modelToViewStyleAttribute(this.normalizedStyles);\n        const viewToModelConverter = viewToModelStyleAttribute(this.normalizedStyles);\n        editor.editing.downcastDispatcher.on('attribute:imageStyle', modelToViewConverter);\n        editor.data.downcastDispatcher.on('attribute:imageStyle', modelToViewConverter);\n        // Allow imageStyle attribute in image and imageInline.\n        // We could call it 'style' but https://github.com/ckeditor/ckeditor5-engine/issues/559.\n        if (isBlockPluginLoaded) {\n            schema.extend('imageBlock', { allowAttributes: 'imageStyle' });\n            schema.setAttributeProperties('imageStyle', { isFormatting: true });\n            // Converter for figure element from view to model.\n            editor.data.upcastDispatcher.on('element:figure', viewToModelConverter, { priority: 'low' });\n        }\n        if (isInlinePluginLoaded) {\n            schema.extend('imageInline', { allowAttributes: 'imageStyle' });\n            schema.setAttributeProperties('imageStyle', { isFormatting: true });\n            // Converter for the img element from view to model.\n            editor.data.upcastDispatcher.on('element:img', viewToModelConverter, { priority: 'low' });\n        }\n    }\n    /**\n     * Registers a post-fixer that will make sure that the style attribute value is correct for a specific image type (block vs inline).\n     */\n    _setupPostFixer() {\n        const editor = this.editor;\n        const document = editor.model.document;\n        const imageUtils = editor.plugins.get(ImageUtils);\n        const stylesMap = new Map(this.normalizedStyles.map(style => [style.name, style]));\n        // Make sure that style attribute is valid for the image type.\n        document.registerPostFixer(writer => {\n            let changed = false;\n            for (const change of document.differ.getChanges()) {\n                if (change.type == 'insert' || change.type == 'attribute' && change.attributeKey == 'imageStyle') {\n                    let element = change.type == 'insert' ? change.position.nodeAfter : change.range.start.nodeAfter;\n                    if (element && element.is('element', 'paragraph') && element.childCount > 0) {\n                        element = element.getChild(0);\n                    }\n                    if (!imageUtils.isImage(element)) {\n                        continue;\n                    }\n                    const imageStyle = element.getAttribute('imageStyle');\n                    if (!imageStyle) {\n                        continue;\n                    }\n                    const imageStyleDefinition = stylesMap.get(imageStyle);\n                    if (!imageStyleDefinition || !imageStyleDefinition.modelElements.includes(element.name)) {\n                        writer.removeAttribute('imageStyle', element);\n                        changed = true;\n                    }\n                }\n            }\n            return changed;\n        });\n    }\n}\n","function identity(x) {\n    return x;\n}\n\nexport { identity };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagestyle/imagestyleui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView, createDropdown, addToolbarToDropdown, SplitButtonView } from 'ckeditor5/src/ui.js';\nimport { isObject, identity } from 'es-toolkit/compat';\nimport { ImageStyleEditing } from './imagestyleediting.js';\nimport { utils } from './utils.js';\nimport '../../theme/imagestyle.css';\n/**\n * The image style UI plugin.\n *\n * It registers buttons corresponding to the {@link module:image/imageconfig~ImageConfig#styles} configuration.\n * It also registers the {@link module:image/imagestyle/utils#DEFAULT_DROPDOWN_DEFINITIONS default drop-downs} and the\n * custom drop-downs defined by the developer in the {@link module:image/imageconfig~ImageConfig#toolbar} configuration.\n */\nexport class ImageStyleUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageStyleEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageStyleUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Returns the default localized style titles provided by the plugin.\n     *\n     * The following localized titles corresponding with\n     * {@link module:image/imagestyle/utils#DEFAULT_OPTIONS} are available:\n     *\n     * * `'Wrap text'`,\n     * * `'Break text'`,\n     * * `'In line'`,\n     * * `'Full size image'`,\n     * * `'Side image'`,\n     * * `'Left aligned image'`,\n     * * `'Centered image'`,\n     * * `'Right aligned image'`\n     */\n    get localizedDefaultStylesTitles() {\n        const t = this.editor.t;\n        return {\n            'Wrap text': t('Wrap text'),\n            'Break text': t('Break text'),\n            'In line': t('In line'),\n            'Full size image': t('Full size image'),\n            'Side image': t('Side image'),\n            'Left aligned image': t('Left aligned image'),\n            'Centered image': t('Centered image'),\n            'Right aligned image': t('Right aligned image')\n        };\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const plugins = this.editor.plugins;\n        const toolbarConfig = this.editor.config.get('image.toolbar') || [];\n        const imageStyleEditing = plugins.get('ImageStyleEditing');\n        const definedStyles = translateStyles(imageStyleEditing.normalizedStyles, this.localizedDefaultStylesTitles);\n        for (const styleConfig of definedStyles) {\n            this._createButton(styleConfig);\n        }\n        const definedDropdowns = translateStyles([\n            ...toolbarConfig.filter(isObject),\n            ...utils.getDefaultDropdownDefinitions(plugins)\n        ], this.localizedDefaultStylesTitles);\n        for (const dropdownConfig of definedDropdowns) {\n            this._createDropdown(dropdownConfig, definedStyles);\n        }\n    }\n    /**\n     * Creates a dropdown and stores it in the editor {@link module:ui/componentfactory~ComponentFactory}.\n     */\n    _createDropdown(dropdownConfig, definedStyles) {\n        const factory = this.editor.ui.componentFactory;\n        factory.add(dropdownConfig.name, locale => {\n            let defaultButton;\n            const { defaultItem, items, title } = dropdownConfig;\n            const buttonViews = items\n                .filter(itemName => definedStyles.find(({ name }) => getUIComponentName(name) === itemName))\n                .map(buttonName => {\n                const button = factory.create(buttonName);\n                if (buttonName === defaultItem) {\n                    defaultButton = button;\n                }\n                return button;\n            });\n            if (items.length !== buttonViews.length) {\n                utils.warnInvalidStyle({ dropdown: dropdownConfig });\n            }\n            const dropdownView = createDropdown(locale, SplitButtonView);\n            const splitButtonView = dropdownView.buttonView;\n            const splitButtonViewArrow = splitButtonView.arrowView;\n            addToolbarToDropdown(dropdownView, buttonViews, { enableActiveItemFocusOnDropdownOpen: true });\n            splitButtonView.set({\n                label: getDropdownButtonTitle(title, defaultButton.label),\n                class: null,\n                tooltip: true\n            });\n            splitButtonViewArrow.unbind('label');\n            splitButtonViewArrow.set({\n                label: title\n            });\n            splitButtonView.bind('icon').toMany(buttonViews, 'isOn', (...areOn) => {\n                const index = areOn.findIndex(identity);\n                return (index < 0) ? defaultButton.icon : buttonViews[index].icon;\n            });\n            splitButtonView.bind('label').toMany(buttonViews, 'isOn', (...areOn) => {\n                const index = areOn.findIndex(identity);\n                return getDropdownButtonTitle(title, (index < 0) ? defaultButton.label : buttonViews[index].label);\n            });\n            splitButtonView.bind('isOn').toMany(buttonViews, 'isOn', (...areOn) => areOn.some(identity));\n            splitButtonView.bind('class')\n                .toMany(buttonViews, 'isOn', (...areOn) => areOn.some(identity) ? 'ck-splitbutton_flatten' : undefined);\n            splitButtonView.on('execute', () => {\n                if (!buttonViews.some(({ isOn }) => isOn)) {\n                    defaultButton.fire('execute');\n                }\n                else {\n                    dropdownView.isOpen = !dropdownView.isOpen;\n                }\n            });\n            dropdownView.bind('isEnabled')\n                .toMany(buttonViews, 'isEnabled', (...areEnabled) => areEnabled.some(identity));\n            // Focus the editable after executing the command.\n            // Overrides a default behaviour where the focus is moved to the dropdown button (#12125).\n            this.listenTo(dropdownView, 'execute', () => {\n                this.editor.editing.view.focus();\n            });\n            return dropdownView;\n        });\n    }\n    /**\n     * Creates a button and stores it in the editor {@link module:ui/componentfactory~ComponentFactory}.\n     */\n    _createButton(buttonConfig) {\n        const buttonName = buttonConfig.name;\n        this.editor.ui.componentFactory.add(getUIComponentName(buttonName), locale => {\n            const command = this.editor.commands.get('imageStyle');\n            const view = new ButtonView(locale);\n            view.set({\n                label: buttonConfig.title,\n                icon: buttonConfig.icon,\n                tooltip: true,\n                isToggleable: true\n            });\n            view.bind('isEnabled').to(command, 'isEnabled');\n            view.bind('isOn').to(command, 'value', value => value === buttonName);\n            view.on('execute', this._executeCommand.bind(this, buttonName));\n            return view;\n        });\n    }\n    _executeCommand(name) {\n        this.editor.execute('imageStyle', { value: name });\n        this.editor.editing.view.focus();\n    }\n}\n/**\n * Returns the translated `title` from the passed styles array.\n */\nfunction translateStyles(styles, titles) {\n    for (const style of styles) {\n        // Localize the titles of the styles, if a title corresponds with\n        // a localized default provided by the plugin.\n        if (titles[style.title]) {\n            style.title = titles[style.title];\n        }\n    }\n    return styles;\n}\n/**\n * Returns the image style component name with the \"imageStyle:\" prefix.\n */\nfunction getUIComponentName(name) {\n    return `imageStyle:${name}`;\n}\n/**\n * Returns title for the splitbutton containing the dropdown title and default action item title.\n */\nfunction getDropdownButtonTitle(dropdownTitle, buttonTitle) {\n    return (dropdownTitle ? dropdownTitle + ': ' : '') + buttonTitle;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/utils/automaticdecorators\n */\nimport { toMap } from 'ckeditor5/src/utils.js';\n/**\n * Helper class that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition} and provides\n * the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement downcast dispatchers} for them.\n */\nexport class AutomaticLinkDecorators {\n    /**\n     * Stores the definition of {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}.\n     * This data is used as a source for a downcast dispatcher to create a proper conversion to output data.\n     */\n    _definitions = new Set();\n    /**\n     * Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~AutomaticLinkDecorators}\n     * instance.\n     */\n    get length() {\n        return this._definitions.size;\n    }\n    /**\n     * Adds automatic decorator objects or an array with them to be used during downcasting.\n     *\n     * @param item A configuration object of automatic rules for decorating links. It might also be an array of such objects.\n     */\n    add(item) {\n        if (Array.isArray(item)) {\n            item.forEach(item => this._definitions.add(item));\n        }\n        else {\n            this._definitions.add(item);\n        }\n    }\n    /**\n     * Provides the conversion helper used in the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add} method.\n     *\n     * @returns A dispatcher function used as conversion helper in {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add}.\n     */\n    getDispatcher() {\n        return dispatcher => {\n            dispatcher.on('attribute:linkHref', (evt, data, conversionApi) => {\n                // There is only test as this behavior decorates links and\n                // it is run before dispatcher which actually consumes this node.\n                // This allows on writing own dispatcher with highest priority,\n                // which blocks both native converter and this additional decoration.\n                if (!conversionApi.consumable.test(data.item, 'attribute:linkHref')) {\n                    return;\n                }\n                // Automatic decorators for block links are handled e.g. in LinkImageEditing.\n                if (!(data.item.is('selection') || conversionApi.schema.isInline(data.item))) {\n                    return;\n                }\n                const viewWriter = conversionApi.writer;\n                const viewSelection = viewWriter.document.selection;\n                for (const item of this._definitions) {\n                    const viewElement = viewWriter.createAttributeElement('a', item.attributes, {\n                        priority: 5\n                    });\n                    if (item.classes) {\n                        viewWriter.addClass(item.classes, viewElement);\n                    }\n                    for (const key in item.styles) {\n                        viewWriter.setStyle(key, item.styles[key], viewElement);\n                    }\n                    viewWriter.setCustomProperty('link', true, viewElement);\n                    if (item.callback(data.attributeNewValue)) {\n                        if (data.item.is('selection')) {\n                            viewWriter.wrap(viewSelection.getFirstRange(), viewElement);\n                        }\n                        else {\n                            viewWriter.wrap(conversionApi.mapper.toViewRange(data.range), viewElement);\n                        }\n                    }\n                    else {\n                        viewWriter.unwrap(conversionApi.mapper.toViewRange(data.range), viewElement);\n                    }\n                }\n            }, { priority: 'high' });\n        };\n    }\n    /**\n     * Provides the conversion helper used in the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add} method\n     * when linking images.\n     *\n     * @returns A dispatcher function used as conversion helper in {@link module:engine/conversion/downcasthelpers~DowncastHelpers#add}.\n     */\n    getDispatcherForLinkedImage() {\n        return dispatcher => {\n            dispatcher.on('attribute:linkHref:imageBlock', (evt, data, { writer, mapper }) => {\n                const viewFigure = mapper.toViewElement(data.item);\n                const linkInImage = Array.from(viewFigure.getChildren())\n                    .find((child) => child.is('element', 'a'));\n                // It's not guaranteed that the anchor is present in the image block during execution of this dispatcher.\n                // It might have been removed during the execution of unlink command that runs the image link downcast dispatcher\n                // that is executed before this one and removes the anchor from the image block.\n                if (!linkInImage) {\n                    return;\n                }\n                for (const item of this._definitions) {\n                    const attributes = toMap(item.attributes);\n                    if (item.callback(data.attributeNewValue)) {\n                        for (const [key, val] of attributes) {\n                            // Left for backward compatibility. Since v30 decorator should\n                            // accept `classes` and `styles` separately from `attributes`.\n                            if (key === 'class') {\n                                writer.addClass(val, linkInImage);\n                            }\n                            else {\n                                writer.setAttribute(key, val, linkInImage);\n                            }\n                        }\n                        if (item.classes) {\n                            writer.addClass(item.classes, linkInImage);\n                        }\n                        for (const key in item.styles) {\n                            writer.setStyle(key, item.styles[key], linkInImage);\n                        }\n                    }\n                    else {\n                        for (const [key, val] of attributes) {\n                            if (key === 'class') {\n                                writer.removeClass(val, linkInImage);\n                            }\n                            else {\n                                writer.removeAttribute(key, linkInImage);\n                            }\n                        }\n                        if (item.classes) {\n                            writer.removeClass(item.classes, linkInImage);\n                        }\n                        for (const key in item.styles) {\n                            writer.removeStyle(key, linkInImage);\n                        }\n                    }\n                }\n            });\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { upperFirst } from 'es-toolkit/compat';\nconst ATTRIBUTE_WHITESPACES = /[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205f\\u3000]/g; // eslint-disable-line no-control-regex\nconst SAFE_URL_TEMPLATE = '^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))';\n// Simplified email test - should be run over previously found URL.\nconst EMAIL_REG_EXP = /^[\\S]+@((?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.))+(?:[a-z\\u00a1-\\uffff]{2,})$/i;\n// The regex checks for the protocol syntax ('xxxx://' or 'xxxx:')\n// or non-word characters at the beginning of the link ('/', '#' etc.).\nconst PROTOCOL_REG_EXP = /^((\\w+:(\\/{2,})?)|(\\W))/i;\nconst DEFAULT_LINK_PROTOCOLS = [\n    'https?',\n    'ftps?',\n    'mailto'\n];\n/**\n * A keystroke used by the {@link module:link/linkui~LinkUI link UI feature}.\n */\nexport const LINK_KEYSTROKE = 'Ctrl+K';\n/**\n * Returns `true` if a given view node is the link element.\n */\nexport function isLinkElement(node) {\n    return node.is('attributeElement') && !!node.getCustomProperty('link');\n}\n/**\n * Creates a link {@link module:engine/view/attributeelement~ViewAttributeElement} with the provided `href` attribute.\n */\nexport function createLinkElement(href, { writer }) {\n    // Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121.\n    const linkElement = writer.createAttributeElement('a', { href }, { priority: 5 });\n    writer.setCustomProperty('link', true, linkElement);\n    return linkElement;\n}\n/**\n * Returns a safe URL based on a given value.\n *\n * A URL is considered safe if it is safe for the user (does not contain any malicious code).\n *\n * If a URL is considered unsafe, a simple `\"#\"` is returned.\n *\n * @internal\n */\nexport function ensureSafeUrl(url, allowedProtocols = DEFAULT_LINK_PROTOCOLS) {\n    const urlString = String(url);\n    const protocolsList = allowedProtocols.join('|');\n    const customSafeRegex = new RegExp(`${SAFE_URL_TEMPLATE.replace('<protocols>', protocolsList)}`, 'i');\n    return isSafeUrl(urlString, customSafeRegex) ? urlString : '#';\n}\n/**\n * Checks whether the given URL is safe for the user (does not contain any malicious code).\n */\nfunction isSafeUrl(url, customRegexp) {\n    const normalizedUrl = url.replace(ATTRIBUTE_WHITESPACES, '');\n    return !!normalizedUrl.match(customRegexp);\n}\n/**\n * Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed\n * to respect the locale of the editor, i.e. to display the {@link module:link/linkconfig~LinkDecoratorManualDefinition label}\n * in the correct language.\n *\n * **Note**: Only the few most commonly used labels are translated automatically. Other labels should be manually\n * translated in the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration.\n *\n * @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.\n * @param decorators The decorator reference where the label values should be localized.\n * @internal\n */\nexport function getLocalizedDecorators(t, decorators) {\n    const localizedDecoratorsLabels = {\n        'Open in a new tab': t('Open in a new tab'),\n        'Downloadable': t('Downloadable')\n    };\n    decorators.forEach(decorator => {\n        if ('label' in decorator && localizedDecoratorsLabels[decorator.label]) {\n            decorator.label = localizedDecoratorsLabels[decorator.label];\n        }\n        return decorator;\n    });\n    return decorators;\n}\n/**\n * Converts an object with defined decorators to a normalized array of decorators. The `id` key is added for each decorator and\n * is used as the attribute's name in the model.\n *\n * @internal\n */\nexport function normalizeDecorators(decorators) {\n    const retArray = [];\n    if (decorators) {\n        for (const [key, value] of Object.entries(decorators)) {\n            const decorator = Object.assign({}, value, { id: `link${upperFirst(key)}` });\n            retArray.push(decorator);\n        }\n    }\n    return retArray;\n}\n/**\n * Returns `true` if the specified `element` can be linked (the element allows the `linkHref` attribute).\n */\nexport function isLinkableElement(element, schema) {\n    if (!element) {\n        return false;\n    }\n    return schema.checkAttribute(element.name, 'linkHref');\n}\n/**\n * Returns `true` if the specified `value` is an email.\n *\n * @internal\n */\nexport function isEmail(value) {\n    return EMAIL_REG_EXP.test(value);\n}\n/**\n * Adds the protocol prefix to the specified `link` when:\n *\n * * it does not contain it already, and there is a {@link module:link/linkconfig~LinkConfig#defaultProtocol `defaultProtocol` }\n * configuration value provided,\n * * or the link is an email address.\n */\nexport function addLinkProtocolIfApplicable(link, defaultProtocol) {\n    const protocol = isEmail(link) ? 'mailto:' : defaultProtocol;\n    const isProtocolNeeded = !!protocol && !linkHasProtocol(link);\n    return link && isProtocolNeeded ? protocol + link : link;\n}\n/**\n * Checks if protocol is already included in the link.\n *\n * @internal\n */\nexport function linkHasProtocol(link) {\n    return PROTOCOL_REG_EXP.test(link);\n}\n/**\n * Opens the link in a new browser tab.\n */\nexport function openLink(link) {\n    window.open(link, '_blank', 'noopener');\n}\n/**\n * Returns a text of a link range.\n *\n * If the returned value is `undefined`, the range contains elements other than text nodes.\n */\nexport function extractTextFromLinkRange(range) {\n    let text = '';\n    for (const item of range.getItems()) {\n        if (!item.is('$text') && !item.is('$textProxy')) {\n            return;\n        }\n        text += item.data;\n    }\n    return text;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/linkcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { findAttributeRange } from 'ckeditor5/src/typing.js';\nimport { Collection, diff, first, toMap } from 'ckeditor5/src/utils.js';\nimport { ModelLivePosition } from 'ckeditor5/src/engine.js';\nimport { AutomaticLinkDecorators } from './utils/automaticdecorators.js';\nimport { extractTextFromLinkRange, isLinkableElement } from './utils.js';\n/**\n * The link command. It is used by the {@link module:link/link~Link link feature}.\n */\nexport class LinkCommand extends Command {\n    /**\n     * A collection of {@link module:link/utils/manualdecorator~LinkManualDecorator manual decorators}\n     * corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.\n     *\n     * You can consider it a model with states of manual decorators added to the currently selected link.\n     */\n    manualDecorators = new Collection();\n    /**\n     * An instance of the helper that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}\n     * that are used by the {@glink features/link link} and the {@glink features/images/images-linking linking images} features.\n     */\n    automaticDecorators = new AutomaticLinkDecorators();\n    /**\n     * Synchronizes the state of {@link #manualDecorators} with the currently present elements in the model.\n     */\n    restoreManualDecoratorStates() {\n        for (const manualDecorator of this.manualDecorators) {\n            manualDecorator.value = this._getDecoratorStateFromModel(manualDecorator.id);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const selectedElement = selection.getSelectedElement() || first(selection.getSelectedBlocks());\n        // A check for any integration that allows linking elements (e.g. `LinkImage`).\n        // Currently the selection reads attributes from text nodes only. See #7429 and #7465.\n        if (isLinkableElement(selectedElement, model.schema)) {\n            this.value = selectedElement.getAttribute('linkHref');\n            this.isEnabled = model.schema.checkAttribute(selectedElement, 'linkHref');\n        }\n        else {\n            this.value = selection.getAttribute('linkHref');\n            this.isEnabled = model.schema.checkAttributeInSelection(selection, 'linkHref');\n        }\n        for (const manualDecorator of this.manualDecorators) {\n            manualDecorator.value = this._getDecoratorStateFromModel(manualDecorator.id);\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * When the selection is non-collapsed, the `linkHref` attribute will be applied to nodes inside the selection, but only to\n     * those nodes where the `linkHref` attribute is allowed (disallowed nodes will be omitted).\n     *\n     * When the selection is collapsed and is not inside the text with the `linkHref` attribute, a\n     * new {@link module:engine/model/text~ModelText text node} with the `linkHref` attribute will be inserted in place of the caret, but\n     * only if such element is allowed in this place. The `_data` of the inserted text will equal the `href` parameter.\n     * The selection will be updated to wrap the just inserted text node.\n     *\n     * When the selection is collapsed and inside the text with the `linkHref` attribute, the attribute value will be updated.\n     *\n     * # Decorators and model attribute management\n     *\n     * There is an optional argument to this command that applies or removes model\n     * {@glink framework/architecture/editing-engine#text-attributes text attributes} brought by\n     * {@link module:link/utils/manualdecorator~LinkManualDecorator manual link decorators}.\n     *\n     * Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators\n     * configuration}.\n     * For every decorator configured, a model text attribute exists with the \"link\" prefix. For example, a `'linkMyDecorator'` attribute\n     * corresponds to `'myDecorator'` in the configuration.\n     *\n     * To learn more about link decorators, check out the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`}\n     * documentation.\n     *\n     * Here is how to manage decorator attributes with the link command:\n     *\n     * ```ts\n     * const linkCommand = editor.commands.get( 'link' );\n     *\n     * // Adding a new decorator attribute.\n     * linkCommand.execute( 'http://example.com', {\n     * \tlinkIsExternal: true\n     * } );\n     *\n     * // Removing a decorator attribute from the selection.\n     * linkCommand.execute( 'http://example.com', {\n     * \tlinkIsExternal: false\n     * } );\n     *\n     * // Adding multiple decorator attributes at the same time.\n     * linkCommand.execute( 'http://example.com', {\n     * \tlinkIsExternal: true,\n     * \tlinkIsDownloadable: true,\n     * } );\n     *\n     * // Removing and adding decorator attributes at the same time.\n     * linkCommand.execute( 'http://example.com', {\n     * \tlinkIsExternal: false,\n     * \tlinkFoo: true,\n     * \tlinkIsDownloadable: false,\n     * } );\n     * ```\n     *\n     * **Note**: If the decorator attribute name is not specified, its state remains untouched.\n     *\n     * **Note**: {@link module:link/unlinkcommand~UnlinkCommand#execute `UnlinkCommand#execute()`} removes all\n     * decorator attributes.\n     *\n     * An optional parameter called `displayedText` is to add or update text of the link that represents the `href`. For example:\n     *\n     * ```ts\n     * const linkCommand = editor.commands.get( 'link' );\n     *\n     * // Adding a new link with `displayedText` attribute.\n     * linkCommand.execute( 'http://example.com', {}, 'Example' );\n     * ```\n     *\n     * The above code will create an anchor like this:\n     *\n     * ```html\n     * <a href=\"http://example.com\">Example</a>\n     * ```\n     *\n     * @fires execute\n     * @param href Link destination.\n     * @param manualDecoratorIds The information about manual decorator attributes to be applied or removed upon execution.\n     * @param displayedText Text of the link.\n     */\n    execute(href, manualDecoratorIds = {}, displayedText) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        // Stores information about manual decorators to turn them on/off when command is applied.\n        const truthyManualDecorators = [];\n        const falsyManualDecorators = [];\n        for (const name in manualDecoratorIds) {\n            if (manualDecoratorIds[name]) {\n                truthyManualDecorators.push(name);\n            }\n            else {\n                falsyManualDecorators.push(name);\n            }\n        }\n        model.change(writer => {\n            const updateLinkAttributes = (itemOrRange) => {\n                writer.setAttribute('linkHref', href, itemOrRange);\n                truthyManualDecorators.forEach(item => writer.setAttribute(item, true, itemOrRange));\n                falsyManualDecorators.forEach(item => writer.removeAttribute(item, itemOrRange));\n            };\n            const updateLinkTextIfNeeded = (range, linkHref) => {\n                const linkText = extractTextFromLinkRange(range);\n                if (!linkText) {\n                    return range;\n                }\n                // Make a copy not to override the command param value.\n                let newText = displayedText;\n                if (!newText) {\n                    // Replace the link text with the new href if previously href was equal to text.\n                    // For example: `<a href=\"http://ckeditor.com/\">http://ckeditor.com/</a>`.\n                    newText = linkHref && linkHref == linkText ? href : linkText;\n                }\n                // Only if needed.\n                if (newText != linkText) {\n                    const fragment = writer.createDocumentFragment();\n                    for (const item of range.getItems()) {\n                        // `extractTextFromLinkRange()` called above guarantees that we operate only on text proxies here.\n                        const text = item;\n                        writer.append(writer.createText(text.data, text.getAttributes()), fragment);\n                    }\n                    const fragRange = writer.createRangeIn(fragment);\n                    const changes = findChanges(linkText, newText);\n                    let insertsLength = 0;\n                    for (const { offset, actual, expected } of changes) {\n                        const updatedOffset = offset + insertsLength;\n                        const subRange = writer.createRange(fragRange.start.getShiftedBy(updatedOffset), fragRange.start.getShiftedBy(updatedOffset + actual.length));\n                        // Collect formatting attributes from replaced text.\n                        const textNode = getLinkPartTextNode(subRange, fragRange);\n                        const attributes = textNode.getAttributes();\n                        const formattingAttributes = Array\n                            .from(attributes)\n                            .filter(([key]) => model.schema.getAttributeProperties(key).isFormatting);\n                        // Create a new text node.\n                        const newTextNode = writer.createText(expected, formattingAttributes);\n                        // Set link attributes before inserting to document to avoid Differ attributes edge case.\n                        updateLinkAttributes(newTextNode);\n                        // Replace text with formatting.\n                        writer.remove(subRange);\n                        writer.insert(newTextNode, subRange.start);\n                        // Sum of all previous inserts.\n                        insertsLength += expected.length;\n                    }\n                    model.insertContent(fragment, range);\n                    return writer.createRange(range.start, range.start.getShiftedBy(newText.length));\n                }\n            };\n            const collapseSelectionAtLinkEnd = (linkRange) => {\n                const { plugins } = this.editor;\n                writer.setSelection(linkRange.end);\n                if (plugins.has('TwoStepCaretMovement')) {\n                    // After replacing the text of the link, we need to move the caret to the end of the link,\n                    // override it's gravity to forward to prevent keeping e.g. bold attribute on the caret\n                    // which was previously inside the link.\n                    //\n                    // If the plugin is not available, the caret will be placed at the end of the link and the\n                    // bold attribute will be kept even if command moved caret outside the link.\n                    plugins.get('TwoStepCaretMovement')._handleForwardMovement();\n                }\n                else {\n                    // Remove the `linkHref` attribute and all link decorators from the selection.\n                    // It stops adding a new content into the link element.\n                    for (const key of ['linkHref', ...truthyManualDecorators, ...falsyManualDecorators]) {\n                        writer.removeSelectionAttribute(key);\n                    }\n                }\n            };\n            // If selection is collapsed then update selected link or insert new one at the place of caret.\n            if (selection.isCollapsed) {\n                const position = selection.getFirstPosition();\n                // When selection is inside text with `linkHref` attribute.\n                if (selection.hasAttribute('linkHref')) {\n                    const linkHref = selection.getAttribute('linkHref');\n                    const linkRange = findAttributeRange(position, 'linkHref', linkHref, model);\n                    const newLinkRange = updateLinkTextIfNeeded(linkRange, linkHref);\n                    updateLinkAttributes(newLinkRange || linkRange);\n                    // Put the selection at the end of the updated link only when text was changed.\n                    // When text was not altered we keep the original selection.\n                    if (newLinkRange) {\n                        collapseSelectionAtLinkEnd(newLinkRange);\n                    }\n                }\n                // If not then insert text node with `linkHref` attribute in place of caret.\n                // However, since selection is collapsed, attribute value will be used as data for text node.\n                // So, if `href` is empty, do not create text node.\n                else if (href !== '') {\n                    const attributes = toMap(selection.getAttributes());\n                    attributes.set('linkHref', href);\n                    truthyManualDecorators.forEach(item => {\n                        attributes.set(item, true);\n                    });\n                    const newLinkRange = model.insertContent(writer.createText(displayedText || href, attributes), position);\n                    // Put the selection at the end of the inserted link.\n                    // Using end of range returned from insertContent in case nodes with the same attributes got merged.\n                    collapseSelectionAtLinkEnd(newLinkRange);\n                }\n            }\n            else {\n                // Non-collapsed selection.\n                // If selection has non-collapsed ranges, we change attribute on nodes inside those ranges\n                // omitting nodes where the `linkHref` attribute is disallowed.\n                const selectionRanges = Array.from(selection.getRanges());\n                const ranges = model.schema.getValidRanges(selectionRanges, 'linkHref');\n                // But for the first, check whether the `linkHref` attribute is allowed on selected blocks (e.g. the \"image\" element).\n                const allowedRanges = [];\n                for (const element of selection.getSelectedBlocks()) {\n                    if (model.schema.checkAttribute(element, 'linkHref')) {\n                        allowedRanges.push(writer.createRangeOn(element));\n                    }\n                }\n                // Ranges that accept the `linkHref` attribute. Since we will iterate over `allowedRanges`, let's clone it.\n                const rangesToUpdate = allowedRanges.slice();\n                // For all selection ranges we want to check whether given range is inside an element that accepts the `linkHref` attribute.\n                // If so, we don't want to propagate applying the attribute to its children.\n                for (const range of ranges) {\n                    if (this._isRangeToUpdate(range, allowedRanges)) {\n                        rangesToUpdate.push(range);\n                    }\n                }\n                // Store the selection ranges in a pseudo live range array (stickiness to the outside of the range).\n                const stickyPseudoRanges = selectionRanges.map(range => ({\n                    start: ModelLivePosition.fromPosition(range.start, 'toPrevious'),\n                    end: ModelLivePosition.fromPosition(range.end, 'toNext')\n                }));\n                // Update or set links (including text update if needed).\n                for (let range of rangesToUpdate) {\n                    const linkHref = (range.start.textNode || range.start.nodeAfter).getAttribute('linkHref');\n                    range = updateLinkTextIfNeeded(range, linkHref) || range;\n                    updateLinkAttributes(range);\n                }\n                // The original selection got trimmed by replacing content so we need to restore it.\n                writer.setSelection(stickyPseudoRanges.map(pseudoRange => {\n                    const start = pseudoRange.start.toPosition();\n                    const end = pseudoRange.end.toPosition();\n                    pseudoRange.start.detach();\n                    pseudoRange.end.detach();\n                    return model.createRange(start, end);\n                }));\n            }\n        });\n    }\n    /**\n     * Provides information whether a decorator with a given name is present in the currently processed selection.\n     *\n     * @param decoratorName The name of the manual decorator used in the model\n     * @returns The information whether a given decorator is currently present in the selection.\n     */\n    _getDecoratorStateFromModel(decoratorName) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const selectedElement = selection.getSelectedElement();\n        // A check for the `LinkImage` plugin. If the selection contains an element, get values from the element.\n        // Currently the selection reads attributes from text nodes only. See #7429 and #7465.\n        if (isLinkableElement(selectedElement, model.schema)) {\n            return selectedElement.getAttribute(decoratorName);\n        }\n        return selection.getAttribute(decoratorName);\n    }\n    /**\n     * Checks whether specified `range` is inside an element that accepts the `linkHref` attribute.\n     *\n     * @param range A range to check.\n     * @param allowedRanges An array of ranges created on elements where the attribute is accepted.\n     */\n    _isRangeToUpdate(range, allowedRanges) {\n        for (const allowedRange of allowedRanges) {\n            // A range is inside an element that will have the `linkHref` attribute. Do not modify its nodes.\n            if (allowedRange.containsRange(range)) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n/**\n * Compares two strings and returns an array of changes needed to transform one into another.\n * Uses the diff utility to find the differences and groups them into chunks containing information\n * about the offset and actual/expected content.\n *\n * @param oldText The original text to compare.\n * @param newText The new text to compare against.\n * @returns Array of change objects containing offset and actual/expected content.\n *\n * @example\n * findChanges( 'hello world', 'hi there' );\n *\n * Returns:\n * [\n * \t{\n * \t\t\"offset\": 1,\n * \t\t\"actual\": \"ello\",\n * \t\t\"expected\": \"i\"\n * \t},\n * \t{\n * \t\t\"offset\": 2,\n * \t\t\"actual\": \"wo\",\n * \t\t\"expected\": \"the\"\n * \t},\n * \t{\n * \t\t\"offset\": 3,\n * \t\t\"actual\": \"ld\",\n * \t\t\"expected\": \"e\"\n * \t}\n * ]\n */\nfunction findChanges(oldText, newText) {\n    // Get array of operations (insert/delete/equal) needed to transform oldText into newText.\n    // Example: diff('abc', 'abxc') returns ['equal', 'equal', 'insert', 'equal']\n    const changes = diff(oldText, newText);\n    // Track position in both strings based on operation type.\n    const counter = { equal: 0, insert: 0, delete: 0 };\n    const result = [];\n    // Accumulate consecutive changes into slices before creating change objects.\n    let actualSlice = '';\n    let expectedSlice = '';\n    // Adding null as sentinel value to handle final accumulated changes.\n    for (const action of [...changes, null]) {\n        if (action == 'insert') {\n            // Example: for 'abc' -> 'abxc', at insert position, adds 'x' to expectedSlice.\n            expectedSlice += newText[counter.equal + counter.insert];\n        }\n        else if (action == 'delete') {\n            // Example: for 'abc' -> 'ac', at delete position, adds 'b' to actualSlice.\n            actualSlice += oldText[counter.equal + counter.delete];\n        }\n        else if (actualSlice.length || expectedSlice.length) {\n            // On 'equal' or end: bundle accumulated changes into a single change object.\n            // Example: { offset: 2, actual: \"\", expected: \"x\" }\n            result.push({\n                offset: counter.equal,\n                actual: actualSlice,\n                expected: expectedSlice\n            });\n            actualSlice = '';\n            expectedSlice = '';\n        }\n        // Increment appropriate counter for the current operation.\n        if (action) {\n            counter[action]++;\n        }\n    }\n    return result;\n}\n/**\n * Returns text node withing the link range that should be updated.\n *\n * @param range Partial link range.\n * @param linkRange Range of the entire link.\n * @returns Text node.\n */\nfunction getLinkPartTextNode(range, linkRange) {\n    if (!range.isCollapsed) {\n        return first(range.getItems());\n    }\n    const position = range.start;\n    if (position.textNode) {\n        return position.textNode;\n    }\n    // If the range is at the start of a link range then prefer node inside a link range.\n    if (!position.nodeBefore || position.isEqual(linkRange.start)) {\n        return position.nodeAfter;\n    }\n    else {\n        return position.nodeBefore;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/unlinkcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { findAttributeRange } from 'ckeditor5/src/typing.js';\nimport { isLinkableElement } from './utils.js';\n/**\n * The unlink command. It is used by the {@link module:link/link~Link link plugin}.\n */\nexport class UnlinkCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const selectedElement = selection.getSelectedElement();\n        // A check for any integration that allows linking elements (e.g. `LinkImage`).\n        // Currently the selection reads attributes from text nodes only. See #7429 and #7465.\n        if (isLinkableElement(selectedElement, model.schema)) {\n            this.isEnabled = model.schema.checkAttribute(selectedElement, 'linkHref');\n        }\n        else {\n            this.isEnabled = model.schema.checkAttributeInSelection(selection, 'linkHref');\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * When the selection is collapsed, it removes the `linkHref` attribute from each node with the same `linkHref` attribute value.\n     * When the selection is non-collapsed, it removes the `linkHref` attribute from each node in selected ranges.\n     *\n     * # Decorators\n     *\n     * If {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} is specified,\n     * all configured decorators are removed together with the `linkHref` attribute.\n     *\n     * @fires execute\n     */\n    execute() {\n        const editor = this.editor;\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const linkCommand = editor.commands.get('link');\n        model.change(writer => {\n            // Get ranges to unlink.\n            const rangesToUnlink = selection.isCollapsed ?\n                [findAttributeRange(selection.getFirstPosition(), 'linkHref', selection.getAttribute('linkHref'), model)] :\n                model.schema.getValidRanges(selection.getRanges(), 'linkHref');\n            // Remove `linkHref` attribute from specified ranges.\n            for (const range of rangesToUnlink) {\n                writer.removeAttribute('linkHref', range);\n                // If there are registered custom attributes, then remove them during unlink.\n                if (linkCommand) {\n                    for (const manualDecorator of linkCommand.manualDecorators) {\n                        writer.removeAttribute(manualDecorator.id, range);\n                    }\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/utils/manualdecorator\n */\nimport { ObservableMixin } from 'ckeditor5/src/utils.js';\n/**\n * Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~LinkManualDecorator#value}\n * to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.\n * These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.\n */\nexport class LinkManualDecorator extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * An ID of a manual decorator which is the name of the attribute in the model, for example: 'linkManualDecorator0'.\n     */\n    id;\n    /**\n     * The default value of manual decorator.\n     */\n    defaultValue;\n    /**\n     * The label used in the user interface to toggle the manual decorator.\n     */\n    label;\n    /**\n     * A set of attributes added to downcasted data when the decorator is activated for a specific link.\n     * Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.\n     */\n    attributes;\n    /**\n     * A set of classes added to downcasted data when the decorator is activated for a specific link.\n     * Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.\n     */\n    classes;\n    /**\n     * A set of styles added to downcasted data when the decorator is activated for a specific link.\n     * Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.\n     */\n    styles;\n    /**\n     * Creates a new instance of {@link module:link/utils/manualdecorator~LinkManualDecorator}.\n     *\n     * @param options The configuration object.\n     */\n    constructor({ id, label, attributes, classes, styles, defaultValue }) {\n        super();\n        this.id = id;\n        this.set('value', undefined);\n        this.defaultValue = defaultValue;\n        this.label = label;\n        this.attributes = attributes;\n        this.classes = classes;\n        this.styles = styles;\n    }\n    /**\n     * Returns {@link module:engine/view/matcher~MatcherPattern} with decorator attributes.\n     *\n     * @internal\n     */\n    _createPattern() {\n        return {\n            attributes: this.attributes,\n            classes: this.classes,\n            styles: this.styles\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/linkediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Input, TwoStepCaretMovement, inlineHighlight } from 'ckeditor5/src/typing.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport { keyCodes, env } from 'ckeditor5/src/utils.js';\nimport { LinkCommand } from './linkcommand.js';\nimport { UnlinkCommand } from './unlinkcommand.js';\nimport { LinkManualDecorator } from './utils/manualdecorator.js';\nimport { createLinkElement, ensureSafeUrl, getLocalizedDecorators, normalizeDecorators, addLinkProtocolIfApplicable, openLink } from './utils.js';\nimport '../theme/link.css';\nconst HIGHLIGHT_CLASS = 'ck-link_selected';\nconst DECORATOR_AUTOMATIC = 'automatic';\nconst DECORATOR_MANUAL = 'manual';\nconst EXTERNAL_LINKS_REGEXP = /^(https?:)?\\/\\//;\n/**\n * The link engine feature.\n *\n * It introduces the `linkHref=\"url\"` attribute in the model which renders to the view as a `<a href=\"url\">` element\n * as well as `'link'` and `'unlink'` commands.\n */\nexport class LinkEditing extends Plugin {\n    /**\n     * A list of functions that handles opening links. If any of them returns `true`, the link is considered to be opened.\n     */\n    _linkOpeners = [];\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'LinkEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        // Clipboard is required for handling cut and paste events while typing over the link.\n        return [TwoStepCaretMovement, Input, ClipboardPipeline];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('link', {\n            allowCreatingEmptyLinks: false,\n            addTargetToExternalLinks: false,\n            toolbar: ['linkPreview', '|', 'editLink', 'linkProperties', 'unlink']\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const allowedProtocols = this.editor.config.get('link.allowedProtocols');\n        // Allow link attribute on all inline nodes.\n        editor.model.schema.extend('$text', { allowAttributes: 'linkHref' });\n        editor.conversion.for('dataDowncast')\n            .attributeToElement({ model: 'linkHref', view: createLinkElement });\n        editor.conversion.for('editingDowncast')\n            .attributeToElement({ model: 'linkHref', view: (href, conversionApi) => {\n                return createLinkElement(ensureSafeUrl(href, allowedProtocols), conversionApi);\n            } });\n        editor.conversion.for('upcast')\n            .elementToAttribute({\n            view: {\n                name: 'a',\n                attributes: {\n                    href: true\n                }\n            },\n            model: {\n                key: 'linkHref',\n                value: (viewElement) => viewElement.getAttribute('href')\n            }\n        });\n        // Create linking commands.\n        editor.commands.add('link', new LinkCommand(editor));\n        editor.commands.add('unlink', new UnlinkCommand(editor));\n        const linkDecorators = getLocalizedDecorators(editor.t, normalizeDecorators(editor.config.get('link.decorators')));\n        this._enableAutomaticDecorators(linkDecorators\n            .filter((item) => item.mode === DECORATOR_AUTOMATIC));\n        this._enableManualDecorators(linkDecorators\n            .filter((item) => item.mode === DECORATOR_MANUAL));\n        // Enable two-step caret movement for `linkHref` attribute.\n        const twoStepCaretMovementPlugin = editor.plugins.get(TwoStepCaretMovement);\n        twoStepCaretMovementPlugin.registerAttribute('linkHref');\n        // Setup highlight over selected link.\n        inlineHighlight(editor, 'linkHref', 'a', HIGHLIGHT_CLASS);\n        // Handle link following by CTRL+click or ALT+ENTER\n        this._enableLinkOpen();\n        // Clears the ModelDocumentSelection decorator attributes if the selection is no longer in a link (for example while using 2-SCM).\n        this._enableSelectionAttributesFixer();\n        // Handle adding default protocol to pasted links.\n        this._enableClipboardIntegration();\n    }\n    /**\n     * Registers a function that opens links in a new browser tab.\n     *\n     * @param linkOpener The function that opens a link in a new browser tab.\n     * @internal\n     */\n    _registerLinkOpener(linkOpener) {\n        this._linkOpeners.push(linkOpener);\n    }\n    /**\n     * Processes an array of configured {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}\n     * and registers a {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast dispatcher}\n     * for each one of them. Downcast dispatchers are obtained using the\n     * {@link module:link/utils/automaticdecorators~AutomaticLinkDecorators#getDispatcher} method.\n     *\n     * **Note**: This method also activates the automatic external link decorator if enabled with\n     * {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}.\n     */\n    _enableAutomaticDecorators(automaticDecoratorDefinitions) {\n        const editor = this.editor;\n        // Store automatic decorators in the command instance as we do the same with manual decorators.\n        // Thanks to that, `LinkImageEditing` plugin can re-use the same definitions.\n        const command = editor.commands.get('link');\n        const automaticDecorators = command.automaticDecorators;\n        // Adds a default decorator for external links.\n        if (editor.config.get('link.addTargetToExternalLinks')) {\n            automaticDecorators.add({\n                id: 'linkIsExternal',\n                mode: DECORATOR_AUTOMATIC,\n                callback: url => !!url && EXTERNAL_LINKS_REGEXP.test(url),\n                attributes: {\n                    target: '_blank',\n                    rel: 'noopener noreferrer'\n                }\n            });\n        }\n        automaticDecorators.add(automaticDecoratorDefinitions);\n        if (automaticDecorators.length) {\n            editor.conversion.for('downcast').add(automaticDecorators.getDispatcher());\n        }\n    }\n    /**\n     * Processes an array of configured {@link module:link/linkconfig~LinkDecoratorManualDefinition manual decorators},\n     * transforms them into {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and stores them in the\n     * {@link module:link/linkcommand~LinkCommand#manualDecorators} collection (a model for manual decorators state).\n     *\n     * Also registers an {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attribute-to-element}\n     * converter for each manual decorator and extends the {@link module:engine/model/schema~ModelSchema model's schema}\n     * with adequate model attributes.\n     */\n    _enableManualDecorators(manualDecoratorDefinitions) {\n        if (!manualDecoratorDefinitions.length) {\n            return;\n        }\n        const editor = this.editor;\n        const command = editor.commands.get('link');\n        const manualDecorators = command.manualDecorators;\n        manualDecoratorDefinitions.forEach(decoratorDefinition => {\n            editor.model.schema.extend('$text', { allowAttributes: decoratorDefinition.id });\n            // Keeps reference to manual decorator to decode its name to attributes during downcast.\n            const decorator = new LinkManualDecorator(decoratorDefinition);\n            manualDecorators.add(decorator);\n            editor.conversion.for('downcast').attributeToElement({\n                model: decorator.id,\n                view: (manualDecoratorValue, { writer, schema }, { item }) => {\n                    // Manual decorators for block links are handled e.g. in LinkImageEditing.\n                    if (!(item.is('selection') || schema.isInline(item))) {\n                        return;\n                    }\n                    if (manualDecoratorValue) {\n                        const element = writer.createAttributeElement('a', decorator.attributes, { priority: 5 });\n                        if (decorator.classes) {\n                            writer.addClass(decorator.classes, element);\n                        }\n                        for (const key in decorator.styles) {\n                            writer.setStyle(key, decorator.styles[key], element);\n                        }\n                        writer.setCustomProperty('link', true, element);\n                        return element;\n                    }\n                }\n            });\n            editor.conversion.for('upcast').elementToAttribute({\n                view: {\n                    name: 'a',\n                    ...decorator._createPattern()\n                },\n                model: {\n                    key: decorator.id\n                }\n            });\n        });\n    }\n    /**\n     * Attaches handlers for {@link module:engine/view/document~ViewDocument#event:enter} and\n     * {@link module:engine/view/document~ViewDocument#event:click} to enable link following.\n     */\n    _enableLinkOpen() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const handleLinkOpening = (url) => {\n            if (!this._linkOpeners.some(opener => opener(url))) {\n                openLink(url);\n            }\n        };\n        this.listenTo(viewDocument, 'click', (evt, data) => {\n            const shouldOpen = env.isMac ? data.domEvent.metaKey : data.domEvent.ctrlKey;\n            if (!shouldOpen) {\n                return;\n            }\n            let clickedElement = data.domTarget;\n            if (clickedElement.tagName.toLowerCase() != 'a') {\n                clickedElement = clickedElement.closest('a');\n            }\n            if (!clickedElement) {\n                return;\n            }\n            const url = clickedElement.getAttribute('href');\n            if (!url) {\n                return;\n            }\n            evt.stop();\n            data.preventDefault();\n            handleLinkOpening(url);\n        }, { context: '$capture' });\n        // Open link on Alt+Enter.\n        this.listenTo(viewDocument, 'keydown', (evt, data) => {\n            const linkCommand = editor.commands.get('link');\n            const url = linkCommand.value;\n            const shouldOpen = !!url && data.keyCode === keyCodes.enter && data.altKey;\n            if (!shouldOpen) {\n                return;\n            }\n            evt.stop();\n            handleLinkOpening(url);\n        });\n    }\n    /**\n     * Watches the ModelDocumentSelection attribute changes and removes link decorator attributes when the linkHref attribute is removed.\n     *\n     * This is to ensure that there is no left-over link decorator attributes on the document selection that is no longer in a link.\n     */\n    _enableSelectionAttributesFixer() {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        this.listenTo(selection, 'change:attribute', (evt, { attributeKeys }) => {\n            if (!attributeKeys.includes('linkHref') || selection.hasAttribute('linkHref')) {\n                return;\n            }\n            model.change(writer => {\n                removeLinkAttributesFromSelection(writer, getLinkAttributesAllowedOnText(model.schema));\n            });\n        });\n    }\n    /**\n     * Enables URL fixing on pasting.\n     */\n    _enableClipboardIntegration() {\n        const editor = this.editor;\n        const model = editor.model;\n        const defaultProtocol = this.editor.config.get('link.defaultProtocol');\n        if (!defaultProtocol) {\n            return;\n        }\n        this.listenTo(editor.plugins.get('ClipboardPipeline'), 'contentInsertion', (evt, data) => {\n            model.change(writer => {\n                const range = writer.createRangeIn(data.content);\n                for (const item of range.getItems()) {\n                    if (item.hasAttribute('linkHref')) {\n                        const newLink = addLinkProtocolIfApplicable(item.getAttribute('linkHref'), defaultProtocol);\n                        writer.setAttribute('linkHref', newLink, item);\n                    }\n                }\n            });\n        });\n    }\n}\n/**\n * Make the selection free of link-related model attributes.\n * All link-related model attributes start with \"link\". That includes not only \"linkHref\"\n * but also all decorator attributes (they have dynamic names), or even custom plugins.\n */\nfunction removeLinkAttributesFromSelection(writer, linkAttributes) {\n    writer.removeSelectionAttribute('linkHref');\n    for (const attribute of linkAttributes) {\n        writer.removeSelectionAttribute(attribute);\n    }\n}\n/**\n * Returns an array containing names of the attributes allowed on `$text` that describes the link item.\n */\nfunction getLinkAttributesAllowedOnText(schema) {\n    const textAttributes = schema.getDefinition('$text').allowAttributes;\n    return textAttributes.filter(attribute => attribute.startsWith('link'));\n}\n","import { upperFirst as upperFirst$1 } from '../../string/upperFirst.mjs';\nimport { toString } from '../util/toString.mjs';\n\nfunction upperFirst(str) {\n    return upperFirst$1(toString(str));\n}\n\nexport { upperFirst };\n","function upperFirst(str) {\n    return str.substring(0, 1).toUpperCase() + str.substring(1);\n}\n\nexport { upperFirst };\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294zm5.494-5.335a.8.8 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184m4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m7.3 17.37-.061.088a1.52 1.52 0 0 1-.934.535l-4.178.663-.806-4.153a1.5 1.5 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346zM6.07 16.512l-3.276-2.295.53 2.73zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328M8 18.5 9.375 17H19v1.5z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294zm5.494-5.335a.8.8 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/ui/linkpreviewbuttonview\n */\nimport { ButtonView } from 'ckeditor5/src/ui.js';\n/**\n * The link button class. Rendered as an `<a>` tag with link opening in a new tab.\n *\n * Provides a custom `navigate` cancelable event.\n */\nexport class LinkPreviewButtonView extends ButtonView {\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set({\n            href: undefined,\n            withText: true\n        });\n        this.extendTemplate({\n            attributes: {\n                class: ['ck-link-toolbar__preview'],\n                href: bind.to('href'),\n                target: '_blank',\n                rel: 'noopener noreferrer'\n            },\n            on: {\n                click: bind.to(evt => {\n                    if (this.href) {\n                        const cancel = () => evt.preventDefault();\n                        this.fire('navigate', this.href, cancel);\n                    }\n                })\n            }\n        });\n        this.template.tag = 'a';\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/ui/linkformview\n */\nimport { ButtonView, ListView, ListItemView, FocusCycler, LabeledFieldView, FormHeaderView, FormRowView, View, ViewCollection, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { IconPreviousArrow } from 'ckeditor5/src/icons.js';\n// See: #8833.\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/form/form.css';\nimport '../../theme/linkform.css';\n/**\n * The link form view.\n */\nexport class LinkFormView extends View {\n    /**\n     * Tracks information about DOM focus in the form.\n     */\n    focusTracker = new FocusTracker();\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes = new KeystrokeHandler();\n    /**\n     * The Back button view displayed in the header.\n     */\n    backButtonView;\n    /**\n     * The Save button view.\n     */\n    saveButtonView;\n    /**\n     * The \"Displayed text\" input view.\n     */\n    displayedTextInputView;\n    /**\n     * The URL input view.\n     */\n    urlInputView;\n    /**\n     * A collection of child views.\n     */\n    children;\n    /**\n     * A collection of child views in the providers list.\n     */\n    providersListChildren;\n    /**\n     * An array of form validators used by {@link #isValid}.\n     */\n    _validators;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables = new ViewCollection();\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * Creates an instance of the {@link module:link/ui/linkformview~LinkFormView} class.\n     *\n     * Also see {@link #render}.\n     *\n     * @param locale The localization services instance.\n     * @param validators  Form validators used by {@link #isValid}.\n     */\n    constructor(locale, validators) {\n        super(locale);\n        this._validators = validators;\n        // Create buttons.\n        this.backButtonView = this._createBackButton();\n        this.saveButtonView = this._createSaveButton();\n        // Create input fields.\n        this.displayedTextInputView = this._createDisplayedTextInput();\n        this.urlInputView = this._createUrlInput();\n        this.providersListChildren = this.createCollection();\n        this.children = this.createCollection([\n            this._createHeaderView()\n        ]);\n        this._createFormChildren();\n        // Add providers list view to the children when the first item is added to the list.\n        // This is to avoid adding the list view when the form is empty.\n        this.listenTo(this.providersListChildren, 'add', () => {\n            this.stopListening(this.providersListChildren, 'add');\n            this.children.add(this._createProvidersListView());\n        });\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form',\n                    'ck-link-form',\n                    'ck-responsive-form'\n                ],\n                // https://github.com/ckeditor/ckeditor5-link/issues/90\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({\n            view: this\n        });\n        const childViews = [\n            this.urlInputView,\n            this.saveButtonView,\n            ...this.providersListChildren,\n            this.backButtonView,\n            this.displayedTextInputView\n        ];\n        childViews.forEach(v => {\n            // Register the view as focusable.\n            this._focusables.add(v);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(v.element);\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the fist {@link #_focusables} in the form.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Validates the form and returns `false` when some fields are invalid.\n     */\n    isValid() {\n        this.resetFormStatus();\n        for (const validator of this._validators) {\n            const errorText = validator(this);\n            // One error per field is enough.\n            if (errorText) {\n                // Apply updated error.\n                this.urlInputView.errorText = errorText;\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Cleans up the supplementary error and information text of the {@link #urlInputView}\n     * bringing them back to the state when the form has been displayed for the first time.\n     *\n     * See {@link #isValid}.\n     */\n    resetFormStatus() {\n        this.urlInputView.errorText = null;\n    }\n    /**\n     * Creates a back button view that cancels the form.\n     */\n    _createBackButton() {\n        const t = this.locale.t;\n        const backButton = new ButtonView(this.locale);\n        backButton.set({\n            class: 'ck-button-back',\n            label: t('Back'),\n            icon: IconPreviousArrow,\n            tooltip: true\n        });\n        backButton.delegate('execute').to(this, 'cancel');\n        return backButton;\n    }\n    /**\n     * Creates a save button view that inserts the link.\n     */\n    _createSaveButton() {\n        const t = this.locale.t;\n        const saveButton = new ButtonView(this.locale);\n        saveButton.set({\n            label: t('Insert'),\n            tooltip: false,\n            withText: true,\n            type: 'submit',\n            class: 'ck-button-action ck-button-bold'\n        });\n        return saveButton;\n    }\n    /**\n     * Creates a header view for the form.\n     */\n    _createHeaderView() {\n        const t = this.locale.t;\n        const header = new FormHeaderView(this.locale, {\n            label: t('Link')\n        });\n        header.children.add(this.backButtonView, 0);\n        return header;\n    }\n    /**\n     * Creates a view for the providers list.\n     */\n    _createProvidersListView() {\n        const providersListView = new ListView(this.locale);\n        providersListView.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-link-form__providers-list'\n                ]\n            }\n        });\n        providersListView.items.bindTo(this.providersListChildren).using(def => {\n            const listItemView = new ListItemView(this.locale);\n            listItemView.children.add(def);\n            return listItemView;\n        });\n        return providersListView;\n    }\n    /**\n     * Creates a labeled input view for the \"Displayed text\" field.\n     */\n    _createDisplayedTextInput() {\n        const t = this.locale.t;\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);\n        labeledInput.label = t('Displayed text');\n        labeledInput.class = 'ck-labeled-field-view_full-width';\n        return labeledInput;\n    }\n    /**\n     * Creates a labeled input view for the URL field.\n     *\n     * @returns Labeled field view instance.\n     */\n    _createUrlInput() {\n        const t = this.locale.t;\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);\n        labeledInput.fieldView.inputMode = 'url';\n        labeledInput.label = t('Link URL');\n        labeledInput.class = 'ck-labeled-field-view_full-width';\n        return labeledInput;\n    }\n    /**\n     * Populates the {@link #children} collection of the form.\n     */\n    _createFormChildren() {\n        this.children.add(new FormRowView(this.locale, {\n            children: [\n                this.displayedTextInputView\n            ],\n            class: [\n                'ck-form__row_large-top-padding'\n            ]\n        }));\n        this.children.add(new FormRowView(this.locale, {\n            children: [\n                this.urlInputView,\n                this.saveButtonView\n            ],\n            class: [\n                'ck-form__row_with-submit',\n                'ck-form__row_large-top-padding',\n                'ck-form__row_large-bottom-padding'\n            ]\n        }));\n    }\n    /**\n     * The native DOM `value` of the {@link #urlInputView} element.\n     *\n     * **Note**: Do not confuse it with the {@link module:ui/inputtext/inputtextview~InputTextView#value}\n     * which works one way only and may not represent the actual state of the component in the DOM.\n     */\n    get url() {\n        const { element } = this.urlInputView.fieldView;\n        if (!element) {\n            return null;\n        }\n        return element.value.trim();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/ui/linkprovideritemsview\n */\nimport { ButtonView, FocusCycler, FormHeaderView, View, ListView, ListItemView, ViewCollection } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { IconPreviousArrow } from '@ckeditor/ckeditor5-icons';\nimport '../../theme/linkprovideritems.css';\n/**\n * The link provider items view.\n */\nexport class LinkProviderItemsView extends View {\n    /**\n     * Tracks information about DOM focus in the form.\n     */\n    focusTracker = new FocusTracker();\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes = new KeystrokeHandler();\n    /**\n     * The Back button view displayed in the header.\n     */\n    backButtonView;\n    /**\n     * The List view of links buttons.\n     */\n    listView;\n    /**\n     * The collection of child views, which is bind with the `listView`.\n     */\n    listChildren;\n    /**\n     * The view displayed when the list is empty.\n     */\n    emptyListInformation;\n    /**\n     * A collection of child views.\n     */\n    children;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables = new ViewCollection();\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * Creates an instance of the {@link module:link/ui/linkprovideritemsview~LinkProviderItemsView} class.\n     *\n     * Also see {@link #render}.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.listChildren = this.createCollection();\n        this.backButtonView = this._createBackButton();\n        this.listView = this._createListView();\n        this.emptyListInformation = this._createEmptyLinksListItemView();\n        this.children = this.createCollection([\n            this._createHeaderView(),\n            this.emptyListInformation\n        ]);\n        this.set('title', '');\n        this.set('emptyListPlaceholder', '');\n        this.set('hasItems', false);\n        this.listenTo(this.listChildren, 'change', () => {\n            this.hasItems = this.listChildren.length > 0;\n        });\n        this.on('change:hasItems', (evt, propName, hasItems) => {\n            if (hasItems) {\n                this.children.remove(this.emptyListInformation);\n                this.children.add(this.listView);\n            }\n            else {\n                this.children.remove(this.listView);\n                this.children.add(this.emptyListInformation);\n            }\n        });\n        // Close the panel on esc key press when the **form has focus**.\n        this.keystrokes.set('Esc', (data, cancel) => {\n            this.fire('cancel');\n            cancel();\n        });\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-link-providers'\n                ],\n                // https://github.com/ckeditor/ckeditor5-link/issues/90\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        const childViews = [\n            this.listView,\n            this.backButtonView\n        ];\n        childViews.forEach(v => {\n            // Register the view as focusable.\n            this._focusables.add(v);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(v.element);\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the fist {@link #_focusables} in the form.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Creates a view for the list at the bottom.\n     */\n    _createListView() {\n        const listView = new ListView(this.locale);\n        listView.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-link-providers__list'\n                ]\n            }\n        });\n        listView.items.bindTo(this.listChildren).using(button => {\n            const listItemView = new ListItemView(this.locale);\n            listItemView.children.add(button);\n            return listItemView;\n        });\n        return listView;\n    }\n    /**\n     * Creates a back button view that cancels the form.\n     */\n    _createBackButton() {\n        const t = this.locale.t;\n        const backButton = new ButtonView(this.locale);\n        backButton.set({\n            class: 'ck-button-back',\n            label: t('Back'),\n            icon: IconPreviousArrow,\n            tooltip: true\n        });\n        backButton.delegate('execute').to(this, 'cancel');\n        return backButton;\n    }\n    /**\n     * Creates a header view for the form.\n     */\n    _createHeaderView() {\n        const header = new FormHeaderView(this.locale);\n        header.bind('label').to(this, 'title');\n        header.children.add(this.backButtonView, 0);\n        return header;\n    }\n    /**\n     * Creates an info view for an empty list.\n     */\n    _createEmptyLinksListItemView() {\n        const view = new View(this.locale);\n        view.setTemplate({\n            tag: 'p',\n            attributes: {\n                class: ['ck', 'ck-link__empty-list-info']\n            },\n            children: [\n                {\n                    text: this.bindTemplate.to('emptyListPlaceholder')\n                }\n            ]\n        });\n        return view;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/ui/linkpropertiesview\n */\nimport { ButtonView, FocusCycler, FormHeaderView, View, ViewCollection, ListView, ListItemView } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { IconPreviousArrow } from '@ckeditor/ckeditor5-icons';\nimport '../../theme/linkproperties.css';\n/**\n * The link properties view controller class.\n *\n * See {@link module:link/ui/linkpropertiesview~LinkPropertiesView}.\n */\nexport class LinkPropertiesView extends View {\n    /**\n     * Tracks information about DOM focus in the form.\n     */\n    focusTracker = new FocusTracker();\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes = new KeystrokeHandler();\n    /**\n     * The Back button view displayed in the header.\n     */\n    backButtonView;\n    /**\n     * A collection of child views.\n     */\n    children;\n    /**\n     * A collection of {@link module:ui/button/switchbuttonview~SwitchButtonView},\n     * which corresponds to {@link module:link/linkcommand~LinkCommand#manualDecorators manual decorators}\n     * configured in the editor.\n     */\n    listChildren;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables = new ViewCollection();\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * Creates an instance of the {@link module:link/ui/linkpropertiesview~LinkPropertiesView} class.\n     *\n     * Also see {@link #render}.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.backButtonView = this._createBackButton();\n        this.listChildren = this.createCollection();\n        this.children = this.createCollection([\n            this._createHeaderView(),\n            this._createListView()\n        ]);\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-link-properties'\n                ],\n                // https://github.com/ckeditor/ckeditor5-link/issues/90\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n        // Close the panel on esc key press when the **form has focus**.\n        this.keystrokes.set('Esc', (data, cancel) => {\n            this.fire('back');\n            cancel();\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        const childViews = [\n            ...this.listChildren,\n            this.backButtonView\n        ];\n        childViews.forEach(v => {\n            // Register the view as focusable.\n            this._focusables.add(v);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(v.element);\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the fist {@link #_focusables} in the form.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Creates a back button view.\n     */\n    _createBackButton() {\n        const t = this.locale.t;\n        const backButton = new ButtonView(this.locale);\n        // TODO: maybe we should have a dedicated BackButtonView in the UI library.\n        backButton.set({\n            class: 'ck-button-back',\n            label: t('Back'),\n            icon: IconPreviousArrow,\n            tooltip: true\n        });\n        backButton.delegate('execute').to(this, 'back');\n        return backButton;\n    }\n    /**\n     * Creates a header view for the form.\n     */\n    _createHeaderView() {\n        const t = this.locale.t;\n        const header = new FormHeaderView(this.locale, {\n            label: t('Link properties')\n        });\n        header.children.add(this.backButtonView, 0);\n        return header;\n    }\n    /**\n     * Creates a form view that displays the {@link #listChildren} collection.\n     */\n    _createListView() {\n        const listView = new ListView(this.locale);\n        listView.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-link__list'\n                ]\n            }\n        });\n        listView.items.bindTo(this.listChildren).using(item => {\n            const listItemView = new ListItemView(this.locale);\n            listItemView.children.add(item);\n            return listItemView;\n        });\n        return listView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/ui/linkbuttonview\n */\nimport { IconNextArrow } from '@ckeditor/ckeditor5-icons';\nimport { ButtonView, IconView } from 'ckeditor5/src/ui.js';\n/**\n * Represents a view for a dropdown menu button.\n */\nexport class LinkButtonView extends ButtonView {\n    /**\n     * An icon that displays an arrow to indicate a direction of the menu.\n     */\n    arrowView;\n    /**\n     * Creates an instance of the dropdown menu button view.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.set({\n            withText: true\n        });\n        this.arrowView = this._createArrowView();\n        this.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-link__button'\n                ]\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.children.add(this.arrowView);\n    }\n    /**\n     * Creates the arrow view instance.\n     *\n     * @private\n     */\n    _createArrowView() {\n        const arrowView = new IconView();\n        arrowView.content = IconNextArrow;\n        return arrowView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/linkui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconLink, IconPencil, IconUnlink, IconSettings } from 'ckeditor5/src/icons.js';\nimport { ClickObserver } from 'ckeditor5/src/engine.js';\nimport { ButtonView, SwitchButtonView, ContextualBalloon, clickOutsideHandler, CssTransitionDisablerMixin, MenuBarMenuListItemButtonView, ToolbarView } from 'ckeditor5/src/ui.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { isWidget } from 'ckeditor5/src/widget.js';\nimport { LinkEditing } from './linkediting.js';\nimport { LinkPreviewButtonView } from './ui/linkpreviewbuttonview.js';\nimport { LinkFormView } from './ui/linkformview.js';\nimport { LinkProviderItemsView } from './ui/linkprovideritemsview.js';\nimport { LinkPropertiesView } from './ui/linkpropertiesview.js';\nimport { LinkButtonView } from './ui/linkbuttonview.js';\nimport { addLinkProtocolIfApplicable, ensureSafeUrl, isLinkElement, extractTextFromLinkRange, LINK_KEYSTROKE } from './utils.js';\nimport '../theme/linktoolbar.css';\nconst VISUAL_SELECTION_MARKER_NAME = 'link-ui';\n/**\n * The link UI plugin. It introduces the `'link'` and `'unlink'` buttons and support for the <kbd>Ctrl+K</kbd> keystroke.\n *\n * It uses the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.\n */\nexport class LinkUI extends Plugin {\n    /**\n     * The toolbar view displayed inside of the balloon.\n     */\n    toolbarView = null;\n    /**\n     * The form view displayed inside the balloon.\n     */\n    formView = null;\n    /**\n     * The view displaying links list.\n     */\n    linkProviderItemsView = null;\n    /**\n     * The form view displaying properties link settings.\n     */\n    propertiesView = null;\n    /**\n     * The contextual balloon plugin instance.\n     */\n    _balloon;\n    /**\n     * The collection of the link providers.\n     */\n    _linksProviders = new Collection();\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon, LinkEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'LinkUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        this.set('selectedLinkableText', undefined);\n        editor.editing.view.addObserver(ClickObserver);\n        this._balloon = editor.plugins.get(ContextualBalloon);\n        // Create toolbar buttons.\n        this._registerComponents();\n        this._registerEditingOpeners();\n        this._enableBalloonActivators();\n        // Renders a fake visual selection marker on an expanded selection.\n        editor.conversion.for('editingDowncast').markerToHighlight({\n            model: VISUAL_SELECTION_MARKER_NAME,\n            view: {\n                classes: ['ck-fake-link-selection']\n            }\n        });\n        // Renders a fake visual selection marker on a collapsed selection.\n        editor.conversion.for('editingDowncast').markerToElement({\n            model: VISUAL_SELECTION_MARKER_NAME,\n            view: (data, { writer }) => {\n                if (!data.markerRange.isCollapsed) {\n                    return null;\n                }\n                const markerElement = writer.createUIElement('span');\n                writer.addClass(['ck-fake-link-selection', 'ck-fake-link-selection_collapsed'], markerElement);\n                return markerElement;\n            }\n        });\n        // Add the information about the keystrokes to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Create link'),\n                    keystroke: LINK_KEYSTROKE\n                },\n                {\n                    label: t('Move out of a link'),\n                    keystroke: [\n                        ['arrowleft', 'arrowleft'],\n                        ['arrowright', 'arrowright']\n                    ]\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        // Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).\n        if (this.propertiesView) {\n            this.propertiesView.destroy();\n        }\n        if (this.formView) {\n            this.formView.destroy();\n        }\n        if (this.toolbarView) {\n            this.toolbarView.destroy();\n        }\n        if (this.linkProviderItemsView) {\n            this.linkProviderItemsView.destroy();\n        }\n    }\n    /**\n     * Registers list of buttons below the link form view that\n     * open a list of links provided by the clicked provider.\n     */\n    registerLinksListProvider(provider) {\n        const insertIndex = this._linksProviders\n            .filter(existing => (existing.order || 0) <= (provider.order || 0))\n            .length;\n        this._linksProviders.add(provider, insertIndex);\n    }\n    /**\n     * Creates views.\n     */\n    _createViews() {\n        const linkCommand = this.editor.commands.get('link');\n        this.toolbarView = this._createToolbarView();\n        this.formView = this._createFormView();\n        if (linkCommand.manualDecorators.length) {\n            this.propertiesView = this._createPropertiesView();\n        }\n        // Attach lifecycle actions to the the balloon.\n        this._enableUserBalloonInteractions();\n    }\n    /**\n     * Creates the ToolbarView instance.\n     */\n    _createToolbarView() {\n        const editor = this.editor;\n        const toolbarView = new ToolbarView(editor.locale);\n        const linkCommand = editor.commands.get('link');\n        toolbarView.class = 'ck-link-toolbar';\n        // Remove the linkProperties button if there are no manual decorators, as it would be useless.\n        let toolbarItems = editor.config.get('link.toolbar');\n        if (!linkCommand.manualDecorators.length) {\n            toolbarItems = toolbarItems.filter(item => item !== 'linkProperties');\n        }\n        toolbarView.fillFromConfig(toolbarItems, editor.ui.componentFactory);\n        // Close the panel on esc key press when the **link toolbar have focus**.\n        toolbarView.keystrokes.set('Esc', (data, cancel) => {\n            this._hideUI();\n            cancel();\n        });\n        // Open the form view on Ctrl+K when the **link toolbar have focus**..\n        toolbarView.keystrokes.set(LINK_KEYSTROKE, (data, cancel) => {\n            this._addFormView();\n            cancel();\n        });\n        // Register the toolbar, so it becomes available for Alt+F10 and Esc navigation.\n        // TODO this should be registered earlier to be able to open this toolbar without previously opening it by click or Ctrl+K\n        editor.ui.addToolbar(toolbarView, {\n            isContextual: true,\n            beforeFocus: () => {\n                if (this._getSelectedLinkElement() && !this._isToolbarVisible) {\n                    this._showUI(true);\n                }\n            },\n            afterBlur: () => {\n                this._hideUI(false);\n            }\n        });\n        return toolbarView;\n    }\n    /**\n     * Creates the {@link module:link/ui/linkformview~LinkFormView} instance.\n     */\n    _createFormView() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const linkCommand = editor.commands.get('link');\n        const defaultProtocol = editor.config.get('link.defaultProtocol');\n        const formView = new (CssTransitionDisablerMixin(LinkFormView))(editor.locale, getFormValidators(editor));\n        formView.displayedTextInputView.bind('isEnabled').to(this, 'selectedLinkableText', value => value !== undefined);\n        // Form elements should be read-only when corresponding commands are disabled.\n        formView.urlInputView.bind('isEnabled').to(linkCommand, 'isEnabled');\n        // Disable the \"save\" button if the command is disabled.\n        formView.saveButtonView.bind('isEnabled').to(linkCommand, 'isEnabled');\n        // Change the \"Save\" button label depending on the command state.\n        formView.saveButtonView.bind('label').to(linkCommand, 'value', value => value ? t('Update') : t('Insert'));\n        // Execute link command after clicking the \"Save\" button.\n        this.listenTo(formView, 'submit', () => {\n            if (formView.isValid()) {\n                const url = formView.urlInputView.fieldView.element.value;\n                const parsedUrl = addLinkProtocolIfApplicable(url, defaultProtocol);\n                const displayedText = formView.displayedTextInputView.fieldView.element.value;\n                editor.execute('link', parsedUrl, this._getDecoratorSwitchesState(), displayedText !== this.selectedLinkableText ? displayedText : undefined);\n                this._closeFormView();\n            }\n        });\n        // Update balloon position when form error changes.\n        this.listenTo(formView.urlInputView, 'change:errorText', () => {\n            editor.ui.update();\n        });\n        // Hide the panel after clicking the \"Cancel\" button.\n        this.listenTo(formView, 'cancel', () => {\n            this._closeFormView();\n        });\n        // Close the panel on esc key press when the **form has focus**.\n        formView.keystrokes.set('Esc', (data, cancel) => {\n            this._closeFormView();\n            cancel();\n        });\n        // Watch adding new link providers and add them to the buttons list.\n        formView.providersListChildren.bindTo(this._linksProviders).using(provider => this._createLinksListProviderButton(provider));\n        return formView;\n    }\n    /**\n     * Creates a sorted array of buttons with link names.\n     */\n    _createLinkProviderListView(provider) {\n        return provider.getListItems().map(({ href, label, icon }) => {\n            const buttonView = new ButtonView();\n            buttonView.set({\n                label,\n                icon,\n                tooltip: false,\n                withText: true\n            });\n            buttonView.on('execute', () => {\n                this.formView.resetFormStatus();\n                this.formView.urlInputView.fieldView.value = href;\n                // Set focus to the editing view to prevent from losing it while current view is removed.\n                this.editor.editing.view.focus();\n                this._removeLinksProviderView();\n                // Set the focus to the URL input field.\n                this.formView.focus();\n            });\n            return buttonView;\n        });\n    }\n    /**\n     * Creates a view for links provider.\n     */\n    _createLinkProviderItemsView(provider) {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const view = new LinkProviderItemsView(editor.locale);\n        const { emptyListPlaceholder, label } = provider;\n        view.emptyListPlaceholder = emptyListPlaceholder || t('No links available');\n        view.title = label;\n        // Hide the panel after clicking the \"Cancel\" button.\n        this.listenTo(view, 'cancel', () => {\n            // Set focus to the editing view to prevent from losing it while current view is removed.\n            editor.editing.view.focus();\n            this._removeLinksProviderView();\n            // Set the focus to the URL input field.\n            this.formView.focus();\n        });\n        return view;\n    }\n    /**\n     * Creates the {@link module:link/ui/linkpropertiesview~LinkPropertiesView} instance.\n     */\n    _createPropertiesView() {\n        const editor = this.editor;\n        const linkCommand = this.editor.commands.get('link');\n        const view = new (CssTransitionDisablerMixin(LinkPropertiesView))(editor.locale);\n        // Hide the panel after clicking the back button.\n        this.listenTo(view, 'back', () => {\n            // Move focus back to the editing view to prevent from losing it while current view is removed.\n            editor.editing.view.focus();\n            this._removePropertiesView();\n        });\n        view.listChildren.bindTo(linkCommand.manualDecorators).using(manualDecorator => {\n            const button = new SwitchButtonView(editor.locale);\n            button.set({\n                label: manualDecorator.label,\n                withText: true\n            });\n            button.bind('isOn').toMany([manualDecorator, linkCommand], 'value', (decoratorValue, commandValue) => {\n                return commandValue === undefined && decoratorValue === undefined ?\n                    !!manualDecorator.defaultValue :\n                    !!decoratorValue;\n            });\n            button.on('execute', () => {\n                manualDecorator.set('value', !button.isOn);\n                editor.execute('link', linkCommand.value, this._getDecoratorSwitchesState());\n            });\n            return button;\n        });\n        return view;\n    }\n    /**\n     * Obtains the state of the manual decorators.\n     */\n    _getDecoratorSwitchesState() {\n        const linkCommand = this.editor.commands.get('link');\n        return Array\n            .from(linkCommand.manualDecorators)\n            .reduce((accumulator, manualDecorator) => {\n            const value = linkCommand.value === undefined && manualDecorator.value === undefined ?\n                manualDecorator.defaultValue :\n                manualDecorator.value;\n            return {\n                ...accumulator,\n                [manualDecorator.id]: !!value\n            };\n        }, {});\n    }\n    /**\n     * Registers listeners used in editing plugin, used to open links.\n     */\n    _registerEditingOpeners() {\n        const linkEditing = this.editor.plugins.get(LinkEditing);\n        linkEditing._registerLinkOpener(href => {\n            const match = this._getLinkProviderLinkByHref(href);\n            if (!match) {\n                return false;\n            }\n            const { item, provider } = match;\n            if (provider.navigate) {\n                return provider.navigate(item);\n            }\n            return false;\n        });\n    }\n    /**\n     * Registers components in the ComponentFactory.\n     */\n    _registerComponents() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('link', () => {\n            const button = this._createButton(ButtonView);\n            button.set({\n                tooltip: true\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('menuBar:link', () => {\n            const button = this._createButton(MenuBarMenuListItemButtonView);\n            button.set({\n                role: 'menuitemcheckbox'\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('linkPreview', locale => {\n            const button = new LinkPreviewButtonView(locale);\n            const allowedProtocols = editor.config.get('link.allowedProtocols');\n            const linkCommand = editor.commands.get('link');\n            const t = locale.t;\n            button.bind('isEnabled').to(linkCommand, 'value', href => !!href);\n            button.bind('href').to(linkCommand, 'value', href => {\n                return href && ensureSafeUrl(href, allowedProtocols);\n            });\n            const setHref = (href) => {\n                if (!href) {\n                    button.label = undefined;\n                    button.icon = undefined;\n                    button.tooltip = t('Open link in new tab');\n                    return;\n                }\n                const selectedLinksProviderLink = this._getLinkProviderLinkByHref(href);\n                if (selectedLinksProviderLink) {\n                    const { label, tooltip, icon } = selectedLinksProviderLink.item;\n                    button.label = label;\n                    button.tooltip = tooltip || false;\n                    button.icon = icon;\n                }\n                else {\n                    button.label = href;\n                    button.icon = undefined;\n                    button.tooltip = t('Open link in new tab');\n                }\n            };\n            setHref(linkCommand.value);\n            this.listenTo(linkCommand, 'change:value', (evt, name, href) => {\n                setHref(href);\n            });\n            this.listenTo(button, 'navigate', (evt, href, cancel) => {\n                const selectedLinksProviderLink = this._getLinkProviderLinkByHref(href);\n                if (!selectedLinksProviderLink) {\n                    return;\n                }\n                const { provider, item } = selectedLinksProviderLink;\n                const { navigate } = provider;\n                if (navigate && navigate(item)) {\n                    evt.stop();\n                    cancel();\n                }\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('unlink', locale => {\n            const unlinkCommand = editor.commands.get('unlink');\n            const button = new ButtonView(locale);\n            const t = locale.t;\n            button.set({\n                label: t('Unlink'),\n                icon: IconUnlink,\n                tooltip: true\n            });\n            button.bind('isEnabled').to(unlinkCommand);\n            this.listenTo(button, 'execute', () => {\n                editor.execute('unlink');\n                this._hideUI();\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('editLink', locale => {\n            const linkCommand = editor.commands.get('link');\n            const button = new ButtonView(locale);\n            const t = locale.t;\n            button.set({\n                label: t('Edit link'),\n                icon: IconPencil,\n                tooltip: true\n            });\n            button.bind('isEnabled').to(linkCommand);\n            this.listenTo(button, 'execute', () => {\n                this._addFormView();\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('linkProperties', locale => {\n            const linkCommand = editor.commands.get('link');\n            const button = new ButtonView(locale);\n            const t = locale.t;\n            button.set({\n                label: t('Link properties'),\n                icon: IconSettings,\n                tooltip: true\n            });\n            button.bind('isEnabled').to(linkCommand, 'isEnabled', linkCommand, 'value', linkCommand, 'manualDecorators', (isEnabled, href, manualDecorators) => isEnabled && !!href && manualDecorators.length > 0);\n            this.listenTo(button, 'execute', () => {\n                this._addPropertiesView();\n            });\n            return button;\n        });\n    }\n    /**\n     * Creates a links button view.\n     */\n    _createLinksListProviderButton(linkProvider) {\n        const locale = this.editor.locale;\n        const linksButton = new LinkButtonView(locale);\n        linksButton.set({\n            label: linkProvider.label\n        });\n        this.listenTo(linksButton, 'execute', () => {\n            this._showLinksProviderView(linkProvider);\n        });\n        return linksButton;\n    }\n    /**\n     * Creates a button for link command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('link');\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            label: t('Link'),\n            icon: IconLink,\n            keystroke: LINK_KEYSTROKE,\n            isToggleable: true\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        view.bind('isOn').to(command, 'value', value => !!value);\n        // Show the panel on button click.\n        this.listenTo(view, 'execute', () => {\n            editor.editing.view.scrollToTheSelection();\n            this._showUI(true);\n            // Open the form view on-top of the toolbar view if it's already visible.\n            // It should be visible every time the link is selected.\n            if (this._getSelectedLinkElement()) {\n                this._addFormView();\n            }\n        });\n        return view;\n    }\n    /**\n     * Attaches actions that control whether the balloon panel containing the\n     * {@link #formView} should be displayed.\n     */\n    _enableBalloonActivators() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        // Handle click on view document and show panel when selection is placed inside the link element.\n        // Keep panel open until selection will be inside the same link element.\n        this.listenTo(viewDocument, 'click', () => {\n            const parentLink = this._getSelectedLinkElement();\n            if (parentLink) {\n                // Then show panel but keep focus inside editor editable.\n                this._showUI();\n            }\n        });\n        // Handle the `Ctrl+K` keystroke and show the panel.\n        editor.keystrokes.set(LINK_KEYSTROKE, (keyEvtData, cancel) => {\n            // Prevent focusing the search bar in FF, Chrome and Edge. See https://github.com/ckeditor/ckeditor5/issues/4811.\n            cancel();\n            if (editor.commands.get('link').isEnabled) {\n                editor.editing.view.scrollToTheSelection();\n                this._showUI(true);\n            }\n        });\n    }\n    /**\n     * Attaches actions that control whether the balloon panel containing the\n     * {@link #formView} is visible or not.\n     */\n    _enableUserBalloonInteractions() {\n        // Focus the form if the balloon is visible and the Tab key has been pressed.\n        this.editor.keystrokes.set('Tab', (data, cancel) => {\n            if (this._isToolbarVisible && !this.toolbarView.focusTracker.isFocused) {\n                this.toolbarView.focus();\n                cancel();\n            }\n        }, {\n            // Use the high priority because the link UI navigation is more important\n            // than other feature's actions, e.g. list indentation.\n            // https://github.com/ckeditor/ckeditor5-link/issues/146\n            priority: 'high'\n        });\n        // Close the panel on the Esc key press when the editable has focus and the balloon is visible.\n        this.editor.keystrokes.set('Esc', (data, cancel) => {\n            if (this._isUIVisible) {\n                this._hideUI();\n                cancel();\n            }\n        });\n        // Close on click outside of balloon panel element.\n        clickOutsideHandler({\n            emitter: this.formView,\n            activator: () => this._isUIInPanel,\n            contextElements: () => [this._balloon.view.element],\n            callback: () => {\n                // Focusing on the editable during a click outside the balloon panel might\n                // cause the selection to move to the beginning of the editable, so we avoid\n                // focusing on it during this action.\n                // See: https://github.com/ckeditor/ckeditor5/issues/18253\n                this._hideUI(false);\n            }\n        });\n    }\n    /**\n     * Adds the {@link #toolbarView} to the {@link #_balloon}.\n     *\n     * @internal\n     */\n    _addToolbarView() {\n        if (!this.toolbarView) {\n            this._createViews();\n        }\n        if (this._isToolbarInPanel) {\n            return;\n        }\n        this._balloon.add({\n            view: this.toolbarView,\n            position: this._getBalloonPositionData(),\n            balloonClassName: 'ck-toolbar-container'\n        });\n    }\n    /**\n     * Adds the {@link #formView} to the {@link #_balloon}.\n     */\n    _addFormView() {\n        if (!this.formView) {\n            this._createViews();\n        }\n        if (this._isFormInPanel) {\n            return;\n        }\n        const linkCommand = this.editor.commands.get('link');\n        this.formView.disableCssTransitions();\n        this.formView.resetFormStatus();\n        this.formView.backButtonView.isVisible = linkCommand.isEnabled && !!linkCommand.value;\n        this._balloon.add({\n            view: this.formView,\n            position: this._getBalloonPositionData()\n        });\n        // Make sure that each time the panel shows up, the fields remains in sync with the value of\n        // the command. If the user typed in the input, then canceled the balloon (`urlInputView.fieldView#value` stays\n        // unaltered) and re-opened it without changing the value of the link command (e.g. because they\n        // clicked the same link), they would see the old value instead of the actual value of the command.\n        // https://github.com/ckeditor/ckeditor5-link/issues/78\n        // https://github.com/ckeditor/ckeditor5-link/issues/123\n        this.selectedLinkableText = this._getSelectedLinkableText();\n        this.formView.displayedTextInputView.fieldView.value = this.selectedLinkableText || '';\n        this.formView.urlInputView.fieldView.value = linkCommand.value || '';\n        // Select input when form view is currently visible.\n        if (this._balloon.visibleView === this.formView) {\n            this.formView.urlInputView.fieldView.select();\n        }\n        this.formView.enableCssTransitions();\n    }\n    /**\n     * Adds the {@link #propertiesView} to the {@link #_balloon}.\n     */\n    _addPropertiesView() {\n        if (!this.propertiesView) {\n            this._createViews();\n        }\n        if (this._arePropertiesInPanel) {\n            return;\n        }\n        this.propertiesView.disableCssTransitions();\n        this._balloon.add({\n            view: this.propertiesView,\n            position: this._getBalloonPositionData()\n        });\n        this.propertiesView.enableCssTransitions();\n        this.propertiesView.focus();\n    }\n    /**\n     * Shows the view with links provided by the given provider.\n     */\n    _showLinksProviderView(provider) {\n        if (this.linkProviderItemsView) {\n            this._removeLinksProviderView();\n        }\n        this.linkProviderItemsView = this._createLinkProviderItemsView(provider);\n        this._addLinkProviderItemsView(provider);\n    }\n    /**\n     * Adds the {@link #linkProviderItemsView} to the {@link #_balloon}.\n     */\n    _addLinkProviderItemsView(provider) {\n        // Clear the collection of links.\n        this.linkProviderItemsView.listChildren.clear();\n        // Add links to the collection.\n        this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(provider));\n        this._balloon.add({\n            view: this.linkProviderItemsView,\n            position: this._getBalloonPositionData()\n        });\n        this.linkProviderItemsView.focus();\n    }\n    /**\n     * Closes the form view. Decides whether the balloon should be hidden completely or if the action view should be shown. This is\n     * decided upon the link command value (which has a value if the document selection is in the link).\n     */\n    _closeFormView() {\n        const linkCommand = this.editor.commands.get('link');\n        this.selectedLinkableText = undefined;\n        if (linkCommand.value !== undefined) {\n            this._removeFormView();\n        }\n        else {\n            this._hideUI();\n        }\n    }\n    /**\n     * Removes the {@link #propertiesView} from the {@link #_balloon}.\n     */\n    _removePropertiesView() {\n        if (this._arePropertiesInPanel) {\n            this._balloon.remove(this.propertiesView);\n        }\n    }\n    /**\n     * Removes the {@link #linkProviderItemsView} from the {@link #_balloon}.\n     */\n    _removeLinksProviderView() {\n        if (this._isLinksListInPanel) {\n            this._balloon.remove(this.linkProviderItemsView);\n        }\n    }\n    /**\n     * Removes the {@link #formView} from the {@link #_balloon}.\n     */\n    _removeFormView(updateFocus = true) {\n        if (this._isFormInPanel) {\n            // Blur the input element before removing it from DOM to prevent issues in some browsers.\n            // See https://github.com/ckeditor/ckeditor5/issues/1501.\n            this.formView.saveButtonView.focus();\n            // Reset fields to update the state of the submit button.\n            this.formView.displayedTextInputView.fieldView.reset();\n            this.formView.urlInputView.fieldView.reset();\n            this._balloon.remove(this.formView);\n            // Because the form has an input which has focus, the focus must be brought back\n            // to the editor. Otherwise, it would be lost.\n            if (updateFocus) {\n                this.editor.editing.view.focus();\n            }\n            this._hideFakeVisualSelection();\n        }\n    }\n    /**\n     * Shows the correct UI type. It is either {@link #formView} or {@link #toolbarView}.\n     *\n     * @internal\n     */\n    _showUI(forceVisible = false) {\n        if (!this.formView) {\n            this._createViews();\n        }\n        // When there's no link under the selection, go straight to the editing UI.\n        if (!this._getSelectedLinkElement()) {\n            // Show visual selection on a text without a link when the contextual balloon is displayed.\n            // See https://github.com/ckeditor/ckeditor5/issues/4721.\n            this._showFakeVisualSelection();\n            this._addToolbarView();\n            // Be sure panel with link is visible.\n            if (forceVisible) {\n                this._balloon.showStack('main');\n            }\n            this._addFormView();\n        }\n        // If there's a link under the selection...\n        else {\n            // Go to the editing UI if toolbar is already visible.\n            if (this._isToolbarVisible) {\n                this._addFormView();\n            }\n            // Otherwise display just the toolbar.\n            else {\n                this._addToolbarView();\n            }\n            // Be sure panel with link is visible.\n            if (forceVisible) {\n                this._balloon.showStack('main');\n            }\n        }\n        // Begin responding to ui#update once the UI is added.\n        this._startUpdatingUI();\n    }\n    /**\n     * Removes the {@link #formView} from the {@link #_balloon}.\n     *\n     * See {@link #_addFormView}, {@link #_addToolbarView}.\n     */\n    _hideUI(updateFocus = true) {\n        const editor = this.editor;\n        if (!this._isUIInPanel) {\n            return;\n        }\n        this.stopListening(editor.ui, 'update');\n        this.stopListening(this._balloon, 'change:visibleView');\n        // Make sure the focus always gets back to the editable _before_ removing the focused form view.\n        // Doing otherwise causes issues in some browsers. See https://github.com/ckeditor/ckeditor5-link/issues/193.\n        if (updateFocus) {\n            editor.editing.view.focus();\n        }\n        // If the links view is visible, remove it because it can be on top of the stack.\n        this._removeLinksProviderView();\n        // If the properties form view is visible, remove it because it can be on top of the stack.\n        this._removePropertiesView();\n        // Then remove the form view because it's beneath the properties form.\n        this._removeFormView(updateFocus);\n        // Finally, remove the link toolbar view because it's last in the stack.\n        if (this._isToolbarInPanel) {\n            this._balloon.remove(this.toolbarView);\n        }\n        this._hideFakeVisualSelection();\n    }\n    /**\n     * Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to\n     * reposition itself when the editor UI should be refreshed.\n     *\n     * See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.\n     */\n    _startUpdatingUI() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        let prevSelectedLink = this._getSelectedLinkElement();\n        let prevSelectionParent = getSelectionParent();\n        const update = () => {\n            const selectedLink = this._getSelectedLinkElement();\n            const selectionParent = getSelectionParent();\n            // Hide the panel if:\n            //\n            // * the selection went out of the EXISTING link element. E.g. user moved the caret out\n            //   of the link,\n            // * the selection went to a different parent when creating a NEW link. E.g. someone\n            //   else modified the document.\n            // * the selection has expanded (e.g. displaying link toolbar then pressing SHIFT+Right arrow).\n            //\n            // Note: #_getSelectedLinkElement will return a link for a non-collapsed selection only\n            // when fully selected.\n            if ((prevSelectedLink && !selectedLink) ||\n                (!prevSelectedLink && selectionParent !== prevSelectionParent)) {\n                this._hideUI();\n            }\n            // Update the position of the panel when:\n            //  * link panel is in the visible stack\n            //  * the selection remains in the original link element,\n            //  * there was no link element in the first place, i.e. creating a new link\n            else if (this._isUIVisible) {\n                // If still in a link element, simply update the position of the balloon.\n                // If there was no link (e.g. inserting one), the balloon must be moved\n                // to the new position in the editing view (a new native DOM range).\n                this._balloon.updatePosition(this._getBalloonPositionData());\n            }\n            prevSelectedLink = selectedLink;\n            prevSelectionParent = selectionParent;\n        };\n        function getSelectionParent() {\n            return viewDocument.selection.focus.getAncestors()\n                .reverse()\n                .find((node) => node.is('element'));\n        }\n        this.listenTo(editor.ui, 'update', update);\n        this.listenTo(this._balloon, 'change:visibleView', update);\n    }\n    /**\n     * Returns `true` when {@link #propertiesView} is in the {@link #_balloon}.\n     */\n    get _arePropertiesInPanel() {\n        return !!this.propertiesView && this._balloon.hasView(this.propertiesView);\n    }\n    /**\n     * Returns `true` when {@link #linkProviderItemsView} is in the {@link #_balloon}.\n     */\n    get _isLinksListInPanel() {\n        return !!this.linkProviderItemsView && this._balloon.hasView(this.linkProviderItemsView);\n    }\n    /**\n     * Returns `true` when {@link #formView} is in the {@link #_balloon}.\n     */\n    get _isFormInPanel() {\n        return !!this.formView && this._balloon.hasView(this.formView);\n    }\n    /**\n     * Returns `true` when {@link #toolbarView} is in the {@link #_balloon}.\n     */\n    get _isToolbarInPanel() {\n        return !!this.toolbarView && this._balloon.hasView(this.toolbarView);\n    }\n    /**\n     * Returns `true` when {@link #propertiesView} is in the {@link #_balloon} and it is\n     * currently visible.\n     */\n    get _isPropertiesVisible() {\n        return !!this.propertiesView && this._balloon.visibleView === this.propertiesView;\n    }\n    /**\n     * Returns `true` when {@link #formView} is in the {@link #_balloon} and it is\n     * currently visible.\n     */\n    get _isFormVisible() {\n        return !!this.formView && this._balloon.visibleView == this.formView;\n    }\n    /**\n     * Returns `true` when {@link #toolbarView} is in the {@link #_balloon} and it is\n     * currently visible.\n     */\n    get _isToolbarVisible() {\n        return !!this.toolbarView && this._balloon.visibleView === this.toolbarView;\n    }\n    /**\n     * Returns `true` when {@link #propertiesView}, {@link #toolbarView}, {@link #linkProviderItemsView}\n     * or {@link #formView} is in the {@link #_balloon}.\n     */\n    get _isUIInPanel() {\n        return this._arePropertiesInPanel || this._isLinksListInPanel || this._isFormInPanel || this._isToolbarInPanel;\n    }\n    /**\n     * Returns `true` when {@link #propertiesView}, {@link #linkProviderItemsView}, {@link #toolbarView}\n     * or {@link #formView} is in the {@link #_balloon} and it is currently visible.\n     */\n    get _isUIVisible() {\n        return this._isPropertiesVisible || this._isLinksListInPanel || this._isFormVisible || this._isToolbarVisible;\n    }\n    /**\n     * Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached\n     * to the target element or selection.\n     *\n     * If the selection is collapsed and inside a link element, the panel will be attached to the\n     * entire link element. Otherwise, it will be attached to the selection.\n     */\n    _getBalloonPositionData() {\n        const view = this.editor.editing.view;\n        const viewDocument = view.document;\n        const model = this.editor.model;\n        if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {\n            // There are cases when we highlight selection using a marker (#7705, #4721).\n            const markerViewElements = this.editor.editing.mapper.markerNameToElements(VISUAL_SELECTION_MARKER_NAME);\n            // Marker could be removed by link text override and end up in the graveyard.\n            if (markerViewElements) {\n                const markerViewElementsArray = Array.from(markerViewElements);\n                const newRange = view.createRange(view.createPositionBefore(markerViewElementsArray[0]), view.createPositionAfter(markerViewElementsArray[markerViewElementsArray.length - 1]));\n                return {\n                    target: view.domConverter.viewRangeToDom(newRange)\n                };\n            }\n        }\n        // Make sure the target is calculated on demand at the last moment because a cached DOM range\n        // (which is very fragile) can desynchronize with the state of the editing view if there was\n        // any rendering done in the meantime. This can happen, for instance, when an inline widget\n        // gets unlinked.\n        return {\n            target: () => {\n                const targetLink = this._getSelectedLinkElement();\n                return targetLink ?\n                    // When selection is inside link element, then attach panel to this element.\n                    view.domConverter.mapViewToDom(targetLink) :\n                    // Otherwise attach panel to the selection.\n                    view.domConverter.viewRangeToDom(viewDocument.selection.getFirstRange());\n            }\n        };\n    }\n    /**\n     * Returns the link {@link module:engine/view/attributeelement~ViewAttributeElement} under\n     * the {@link module:engine/view/document~ViewDocument editing view's} selection or `null`\n     * if there is none.\n     *\n     * **Note**: For a non–collapsed selection, the link element is returned when **fully**\n     * selected and the **only** element within the selection boundaries, or when\n     * a linked widget is selected.\n     */\n    _getSelectedLinkElement() {\n        const view = this.editor.editing.view;\n        const selection = view.document.selection;\n        const selectedElement = selection.getSelectedElement();\n        // The selection is collapsed or some widget is selected (especially inline widget).\n        if (selection.isCollapsed || selectedElement && isWidget(selectedElement)) {\n            return findLinkElementAncestor(selection.getFirstPosition());\n        }\n        else {\n            // The range for fully selected link is usually anchored in adjacent text nodes.\n            // Trim it to get closer to the actual link element.\n            const range = selection.getFirstRange().getTrimmed();\n            const startLink = findLinkElementAncestor(range.start);\n            const endLink = findLinkElementAncestor(range.end);\n            if (!startLink || startLink != endLink) {\n                return null;\n            }\n            // Check if the link element is fully selected.\n            if (view.createRangeIn(startLink).getTrimmed().isEqual(range)) {\n                return startLink;\n            }\n            else {\n                return null;\n            }\n        }\n    }\n    /**\n     * Returns selected link text content.\n     * If link is not selected it returns the selected text.\n     * If selection or link includes non text node (inline object or block) then returns undefined.\n     */\n    _getSelectedLinkableText() {\n        const model = this.editor.model;\n        const editing = this.editor.editing;\n        const selectedLink = this._getSelectedLinkElement();\n        if (!selectedLink) {\n            return extractTextFromLinkRange(model.document.selection.getFirstRange());\n        }\n        const viewLinkRange = editing.view.createRangeOn(selectedLink);\n        const linkRange = editing.mapper.toModelRange(viewLinkRange);\n        return extractTextFromLinkRange(linkRange);\n    }\n    /**\n     * Returns a provider by its URL.\n     *\n     * @param href URL of the link.\n     * @returns Link provider and item or `null` if not found.\n     */\n    _getLinkProviderLinkByHref(href) {\n        if (!href) {\n            return null;\n        }\n        for (const provider of this._linksProviders) {\n            const item = provider.getItem ?\n                provider.getItem(href) :\n                provider.getListItems().find(item => item.href === href);\n            if (item) {\n                return { provider, item };\n            }\n        }\n        return null;\n    }\n    /**\n     * Displays a fake visual selection when the contextual balloon is displayed.\n     *\n     * This adds a 'link-ui' marker into the document that is rendered as a highlight on selected text fragment.\n     */\n    _showFakeVisualSelection() {\n        const model = this.editor.model;\n        model.change(writer => {\n            const range = model.document.selection.getFirstRange();\n            if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {\n                writer.updateMarker(VISUAL_SELECTION_MARKER_NAME, { range });\n            }\n            else {\n                if (range.start.isAtEnd) {\n                    const startPosition = range.start.getLastMatchingPosition(({ item }) => !model.schema.isContent(item), { boundaries: range });\n                    writer.addMarker(VISUAL_SELECTION_MARKER_NAME, {\n                        usingOperation: false,\n                        affectsData: false,\n                        range: writer.createRange(startPosition, range.end)\n                    });\n                }\n                else {\n                    writer.addMarker(VISUAL_SELECTION_MARKER_NAME, {\n                        usingOperation: false,\n                        affectsData: false,\n                        range\n                    });\n                }\n            }\n        });\n    }\n    /**\n     * Hides the fake visual selection created in {@link #_showFakeVisualSelection}.\n     */\n    _hideFakeVisualSelection() {\n        const model = this.editor.model;\n        if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {\n            model.change(writer => {\n                writer.removeMarker(VISUAL_SELECTION_MARKER_NAME);\n            });\n        }\n    }\n}\n/**\n * Returns a link element if there's one among the ancestors of the provided `Position`.\n *\n * @param View position to analyze.\n * @returns Link element at the position or null.\n */\nfunction findLinkElementAncestor(position) {\n    return position.getAncestors().find((ancestor) => isLinkElement(ancestor)) || null;\n}\n/**\n * Returns link form validation callbacks.\n *\n * @param editor Editor instance.\n */\nfunction getFormValidators(editor) {\n    const t = editor.t;\n    const allowCreatingEmptyLinks = editor.config.get('link.allowCreatingEmptyLinks');\n    return [\n        form => {\n            if (!allowCreatingEmptyLinks && !form.url.length) {\n                return t('Link URL must not be empty.');\n            }\n        }\n    ];\n}\n","export default \"<svg viewBox=\\\"0 0 20 20\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><path fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\" d=\\\"M3.734 6.375H1.75a.75.75 0 0 1 0-1.5h1.984a2.626 2.626 0 0 1 5.032 0h9.48a.75.75 0 0 1 0 1.5h-9.48a2.626 2.626 0 0 1-5.032 0Zm1.141-.75a1.375 1.375 0 1 1 2.75 0 1.375 1.375 0 0 1-2.75 0ZM16.263 14.625h1.983a.75.75 0 0 1 0 1.5h-1.983a2.626 2.626 0 0 1-5.033 0H1.75a.75.75 0 0 1 0-1.5h9.48a2.626 2.626 0 0 1 5.033 0Zm-1.142.75a1.375 1.375 0 1 1-2.75 0 1.375 1.375 0 0 1 2.75 0Z\\\"/></svg>\\n\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/autolink\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Delete, TextWatcher, getLastTextLine, findAttributeRange } from 'ckeditor5/src/typing.js';\nimport { addLinkProtocolIfApplicable, linkHasProtocol } from './utils.js';\nimport { LinkEditing } from './linkediting.js';\nconst MIN_LINK_LENGTH_WITH_SPACE_AT_END = 4; // Ie: \"t.co \" (length 5).\n// This was a tweak from https://gist.github.com/dperini/729294.\nconst URL_REG_EXP = new RegExp(\n// Group 1: Line start or after a space.\n'(^|\\\\s)' +\n    // Group 2: Detected URL (or e-mail).\n    '(' +\n    // Protocol identifier or short syntax \"//\"\n    // a. Full form http://user@foo.bar.baz:8080/foo/bar.html#baz?foo=bar\n    '(' +\n    '(?:(?:(?:https?|ftp):)?\\\\/\\\\/)' +\n    // BasicAuth using user:pass (optional)\n    '(?:\\\\S+(?::\\\\S*)?@)?' +\n    '(?:' +\n    // IP address dotted notation octets\n    // excludes loopback network 0.0.0.0\n    // excludes reserved space >= 224.0.0.0\n    // excludes network & broadcast addresses\n    // (first & last IP address of each class)\n    '(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])' +\n    '(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}' +\n    '(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))' +\n    '|' +\n    '(' +\n    // Do not allow `www.foo` - see https://github.com/ckeditor/ckeditor5/issues/8050.\n    '((?!www\\\\.)|(www\\\\.))' +\n    // Host & domain names.\n    '(?![-_])(?:[-_a-z0-9\\\\u00a1-\\\\uffff]{1,63}\\\\.)+' +\n    // TLD identifier name.\n    '(?:[a-z\\\\u00a1-\\\\uffff]{2,63})' +\n    ')' +\n    '|' +\n    // Allow localhost as a valid hostname\n    'localhost' +\n    ')' +\n    // port number (optional)\n    '(?::\\\\d{2,5})?' +\n    // resource path (optional)\n    '(?:[/?#]\\\\S*)?' +\n    ')' +\n    '|' +\n    // b. Short form (either www.example.com or example@example.com)\n    '(' +\n    '(www.|(\\\\S+@))' +\n    // Host & domain names.\n    '((?![-_])(?:[-_a-z0-9\\\\u00a1-\\\\uffff]{1,63}\\\\.))+' +\n    // TLD identifier name.\n    '(?:[a-z\\\\u00a1-\\\\uffff]{2,63})' +\n    ')' +\n    ')$', 'i');\nconst URL_GROUP_IN_MATCH = 2;\n/**\n * The autolink plugin.\n */\nexport class AutoLink extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Delete, LinkEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'AutoLink';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        selection.on('change:range', () => {\n            // Disable plugin when selection is inside a code block.\n            this.isEnabled = !selection.anchor.parent.is('element', 'codeBlock');\n        });\n        this._enableTypingHandling();\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        this._enableEnterHandling();\n        this._enableShiftEnterHandling();\n        this._enablePasteLinking();\n    }\n    /**\n     * For given position, returns a range that includes the whole link that contains the position.\n     *\n     * If position is not inside a link, returns `null`.\n     */\n    _expandLinkRange(model, position) {\n        if (position.textNode && position.textNode.hasAttribute('linkHref')) {\n            return findAttributeRange(position, 'linkHref', position.textNode.getAttribute('linkHref'), model);\n        }\n        else {\n            return null;\n        }\n    }\n    /**\n     * Extends the document selection to includes all links that intersects with given `selectedRange`.\n     */\n    _selectEntireLinks(writer, selectedRange) {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const selStart = selection.getFirstPosition();\n        const selEnd = selection.getLastPosition();\n        let updatedSelection = selectedRange.getJoined(this._expandLinkRange(model, selStart) || selectedRange);\n        if (updatedSelection) {\n            updatedSelection = updatedSelection.getJoined(this._expandLinkRange(model, selEnd) || selectedRange);\n        }\n        if (updatedSelection && (updatedSelection.start.isBefore(selStart) || updatedSelection.end.isAfter(selEnd))) {\n            // Only update the selection if it changed.\n            writer.setSelection(updatedSelection);\n        }\n    }\n    /**\n     * Enables autolinking on pasting a URL when some content is selected.\n     */\n    _enablePasteLinking() {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const clipboardPipeline = editor.plugins.get('ClipboardPipeline');\n        const linkCommand = editor.commands.get('link');\n        clipboardPipeline.on('inputTransformation', (evt, data) => {\n            if (!this.isEnabled || !linkCommand.isEnabled || selection.isCollapsed || data.method !== 'paste') {\n                // Abort if we are disabled or the selection is collapsed.\n                return;\n            }\n            if (selection.rangeCount > 1) {\n                // Abort if there are multiple selection ranges.\n                return;\n            }\n            const selectedRange = selection.getFirstRange();\n            const newLink = data.dataTransfer.getData('text/plain');\n            if (!newLink) {\n                // Abort if there is no plain text on the clipboard.\n                return;\n            }\n            const matches = newLink.match(URL_REG_EXP);\n            // If the text in the clipboard has a URL, and that URL is the whole clipboard.\n            if (matches && matches[2] === newLink) {\n                model.change(writer => {\n                    this._selectEntireLinks(writer, selectedRange);\n                    linkCommand.execute(newLink);\n                });\n                evt.stop();\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * Enables autolinking on typing.\n     */\n    _enableTypingHandling() {\n        const editor = this.editor;\n        const watcher = new TextWatcher(editor.model, text => {\n            let mappedText = text;\n            // 1. Detect <kbd>Space</kbd> after a text with a potential link.\n            if (!isSingleSpaceAtTheEnd(mappedText)) {\n                return;\n            }\n            // 2. Remove the last space character.\n            mappedText = mappedText.slice(0, -1);\n            // 3. Remove punctuation at the end of the URL if it exists.\n            if ('!.:,;?'.includes(mappedText[mappedText.length - 1])) {\n                mappedText = mappedText.slice(0, -1);\n            }\n            // 4. Check text before last typed <kbd>Space</kbd> or punctuation.\n            const url = getUrlAtTextEnd(mappedText);\n            if (url) {\n                return {\n                    url,\n                    removedTrailingCharacters: text.length - mappedText.length\n                };\n            }\n        });\n        watcher.on('matched:data', (evt, data) => {\n            const { batch, range, url, removedTrailingCharacters } = data;\n            if (!batch.isTyping) {\n                return;\n            }\n            const linkEnd = range.end.getShiftedBy(-removedTrailingCharacters); // Executed after a space character or punctuation.\n            const linkStart = linkEnd.getShiftedBy(-url.length);\n            const linkRange = editor.model.createRange(linkStart, linkEnd);\n            this._applyAutoLink(url, linkRange);\n        });\n        watcher.bind('isEnabled').to(this);\n    }\n    /**\n     * Enables autolinking on the <kbd>Enter</kbd> key.\n     */\n    _enableEnterHandling() {\n        const editor = this.editor;\n        const model = editor.model;\n        const enterCommand = editor.commands.get('enter');\n        if (!enterCommand) {\n            return;\n        }\n        enterCommand.on('execute', () => {\n            const position = model.document.selection.getFirstPosition();\n            let rangeToCheck;\n            // Previous sibling might not be an element if enter was blocked due to be triggered in a limit element.\n            if (position.parent.previousSibling?.is('element')) {\n                rangeToCheck = model.createRangeIn(position.parent.previousSibling);\n            }\n            else {\n                rangeToCheck = model.createRange(model.createPositionAt(position.parent, 0), position);\n            }\n            this._checkAndApplyAutoLinkOnRange(rangeToCheck);\n        });\n    }\n    /**\n     * Enables autolinking on the <kbd>Shift</kbd>+<kbd>Enter</kbd> keyboard shortcut.\n     */\n    _enableShiftEnterHandling() {\n        const editor = this.editor;\n        const model = editor.model;\n        const shiftEnterCommand = editor.commands.get('shiftEnter');\n        if (!shiftEnterCommand) {\n            return;\n        }\n        shiftEnterCommand.on('execute', () => {\n            const position = model.document.selection.getFirstPosition();\n            const rangeToCheck = model.createRange(model.createPositionAt(position.parent, 0), position.getShiftedBy(-1));\n            this._checkAndApplyAutoLinkOnRange(rangeToCheck);\n        });\n    }\n    /**\n     * Checks if the passed range contains a linkable text.\n     */\n    _checkAndApplyAutoLinkOnRange(rangeToCheck) {\n        const model = this.editor.model;\n        const { text, range } = getLastTextLine(rangeToCheck, model);\n        const url = getUrlAtTextEnd(text);\n        if (url) {\n            const linkRange = model.createRange(range.end.getShiftedBy(-url.length), range.end);\n            this._applyAutoLink(url, linkRange);\n        }\n    }\n    /**\n     * Applies a link on a given range if the link should be applied.\n     *\n     * @param url The URL to link.\n     * @param range The text range to apply the link attribute to.\n     */\n    _applyAutoLink(url, range) {\n        const model = this.editor.model;\n        const defaultProtocol = this.editor.config.get('link.defaultProtocol');\n        const fullUrl = addLinkProtocolIfApplicable(url, defaultProtocol);\n        if (!this.isEnabled || !isLinkAllowedOnRange(range, model) || !linkHasProtocol(fullUrl) || linkIsAlreadySet(range)) {\n            return;\n        }\n        this._persistAutoLink(fullUrl, range);\n    }\n    /**\n     * Enqueues autolink changes in the model.\n     *\n     * @param url The URL to link.\n     * @param range The text range to apply the link attribute to.\n     */\n    _persistAutoLink(url, range) {\n        const model = this.editor.model;\n        const deletePlugin = this.editor.plugins.get('Delete');\n        // Enqueue change to make undo step.\n        model.enqueueChange(writer => {\n            writer.setAttribute('linkHref', url, range);\n            model.enqueueChange(() => {\n                deletePlugin.requestUndoOnBackspace();\n            });\n        });\n    }\n}\n// Check if text should be evaluated by the plugin in order to reduce number of RegExp checks on whole text.\nfunction isSingleSpaceAtTheEnd(text) {\n    return text.length > MIN_LINK_LENGTH_WITH_SPACE_AT_END && text[text.length - 1] === ' ' && text[text.length - 2] !== ' ';\n}\nfunction getUrlAtTextEnd(text) {\n    const match = URL_REG_EXP.exec(text);\n    return match ? match[URL_GROUP_IN_MATCH] : null;\n}\nfunction isLinkAllowedOnRange(range, model) {\n    return model.schema.checkAttributeInSelection(model.createSelection(range), 'linkHref');\n}\nfunction linkIsAlreadySet(range) {\n    const item = range.start.nodeAfter;\n    return !!item && item.hasAttribute('linkHref');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/list/utils/listwalker\n */\nimport { first, toArray } from 'ckeditor5/src/utils.js';\nimport { isListItemBlock } from './model.js';\n/**\n * Document list blocks iterator.\n *\n * @internal\n */\nexport class ListWalker {\n    /**\n     * The start list item block element.\n     */\n    _startElement;\n    /**\n     * The reference indent. Initialized by the indent of the start block.\n     */\n    _referenceIndent;\n    /**\n     * The iterating direction.\n     */\n    _isForward;\n    /**\n     * Whether start block should be included in the result (if it's matching other criteria).\n     */\n    _includeSelf;\n    /**\n     * Additional attributes that must be the same for each block.\n     */\n    _sameAttributes;\n    /**\n     * Whether blocks with the same indent level as the start block should be included in the result.\n     */\n    _sameIndent;\n    /**\n     * Whether blocks with a lower indent level than the start block should be included in the result.\n     */\n    _lowerIndent;\n    /**\n     * Whether blocks with a higher indent level than the start block should be included in the result.\n     */\n    _higherIndent;\n    /**\n     * Creates a document list iterator.\n     *\n     * @param startElement The start list item block element.\n     * @param options.direction The iterating direction.\n     * @param options.includeSelf Whether start block should be included in the result (if it's matching other criteria).\n     * @param options.sameAttributes Additional attributes that must be the same for each block.\n     * @param options.sameIndent Whether blocks with the same indent level as the start block should be included\n     * in the result.\n     * @param options.lowerIndent Whether blocks with a lower indent level than the start block should be included\n     * in the result.\n     * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included\n     * in the result.\n     */\n    constructor(startElement, options) {\n        this._startElement = startElement;\n        this._referenceIndent = startElement.getAttribute('listIndent');\n        this._isForward = options.direction == 'forward';\n        this._includeSelf = !!options.includeSelf;\n        this._sameAttributes = toArray(options.sameAttributes || []);\n        this._sameIndent = !!options.sameIndent;\n        this._lowerIndent = !!options.lowerIndent;\n        this._higherIndent = !!options.higherIndent;\n    }\n    /**\n     * Performs only first step of iteration and returns the result.\n     *\n     * @param startElement The start list item block element.\n     * @param options.direction The iterating direction.\n     * @param options.includeSelf Whether start block should be included in the result (if it's matching other criteria).\n     * @param options.sameAttributes Additional attributes that must be the same for each block.\n     * @param options.sameIndent Whether blocks with the same indent level as the start block should be included\n     * in the result.\n     * @param options.lowerIndent Whether blocks with a lower indent level than the start block should be included\n     * in the result.\n     * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included\n     * in the result.\n     */\n    static first(startElement, options) {\n        const walker = new this(startElement, options);\n        const iterator = walker[Symbol.iterator]();\n        return first(iterator);\n    }\n    /**\n     * Iterable interface.\n     */\n    *[Symbol.iterator]() {\n        const nestedItems = [];\n        for (const { node } of new SiblingListBlocksIterator(this._getStartNode(), this._isForward ? 'forward' : 'backward')) {\n            const indent = node.getAttribute('listIndent');\n            // Leaving a nested list.\n            if (indent < this._referenceIndent) {\n                // Abort searching blocks.\n                if (!this._lowerIndent) {\n                    break;\n                }\n                // While searching for lower indents, update the reference indent to find another parent in the next step.\n                this._referenceIndent = indent;\n            }\n            // Entering a nested list.\n            else if (indent > this._referenceIndent) {\n                // Ignore nested blocks.\n                if (!this._higherIndent) {\n                    continue;\n                }\n                // Collect nested blocks to verify if they are really nested, or it's a different item.\n                if (!this._isForward) {\n                    nestedItems.push(node);\n                    continue;\n                }\n            }\n            // Same indent level block.\n            else {\n                // Ignore same indent block.\n                if (!this._sameIndent) {\n                    // While looking for nested blocks, stop iterating while encountering first same indent block.\n                    if (this._higherIndent) {\n                        // No more nested blocks so yield nested items.\n                        if (nestedItems.length) {\n                            yield* nestedItems;\n                            nestedItems.length = 0;\n                        }\n                        break;\n                    }\n                    continue;\n                }\n                // Abort if item has any additionally specified attribute different.\n                if (this._sameAttributes.some(attr => node.getAttribute(attr) !== this._startElement.getAttribute(attr))) {\n                    break;\n                }\n            }\n            // There is another block for the same list item so the nested items were in the same list item.\n            if (nestedItems.length) {\n                yield* nestedItems;\n                nestedItems.length = 0;\n            }\n            yield node;\n        }\n    }\n    /**\n     * Returns the model element to start iterating.\n     */\n    _getStartNode() {\n        if (this._includeSelf) {\n            return this._startElement;\n        }\n        return this._isForward ?\n            this._startElement.nextSibling :\n            this._startElement.previousSibling;\n    }\n}\n/**\n * Iterates sibling list blocks starting from the given node.\n *\n * @internal\n */\nexport class SiblingListBlocksIterator {\n    _node;\n    _isForward;\n    _previousNodesByIndent = [];\n    _previous = null;\n    _previousNodeIndent = null;\n    /**\n     * @param node The model node.\n     * @param direction Iteration direction.\n     */\n    constructor(node, direction = 'forward') {\n        this._node = node;\n        this._isForward = direction === 'forward';\n    }\n    [Symbol.iterator]() {\n        return this;\n    }\n    next() {\n        if (!isListItemBlock(this._node)) {\n            return { done: true, value: undefined };\n        }\n        const nodeIndent = this._node.getAttribute('listIndent');\n        let previousNodeInList = null;\n        if (this._previous) {\n            const previousNodeIndent = this._previousNodeIndent;\n            // Let's find previous node for the same indent.\n            // We're going to need that when we get back to previous indent.\n            if (nodeIndent > previousNodeIndent) {\n                this._previousNodesByIndent[previousNodeIndent] = this._previous;\n            }\n            // Restore the one for given indent.\n            else if (nodeIndent < previousNodeIndent) {\n                previousNodeInList = this._previousNodesByIndent[nodeIndent] || null;\n                this._previousNodesByIndent.length = nodeIndent;\n            }\n            // Same indent.\n            else {\n                previousNodeInList = this._previous;\n            }\n        }\n        const value = {\n            node: this._node,\n            previous: this._previous,\n            previousNodeInList\n        };\n        this._previous = this._node;\n        this._previousNodeIndent = nodeIndent;\n        this._node = this._isForward ? this._node.nextSibling : this._node.previousSibling;\n        return { value, done: false };\n    }\n}\n/**\n * The iterable protocol over the list elements.\n *\n * @internal\n */\nexport class ListBlocksIterable {\n    _listHead;\n    /**\n     * @param listHead The head element of a list.\n     */\n    constructor(listHead) {\n        this._listHead = listHead;\n    }\n    /**\n     * List blocks iterator.\n     *\n     * Iterates over all blocks of a list.\n     */\n    [Symbol.iterator]() {\n        return new SiblingListBlocksIterator(this._listHead);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { uid, toArray } from 'ckeditor5/src/utils.js';\nimport { ListWalker, SiblingListBlocksIterator } from './listwalker.js';\n/**\n * The list item ID generator.\n *\n * @internal\n */\nexport class ListItemUid {\n    /**\n     * Returns the next ID.\n     *\n     * @internal\n     */\n    /* istanbul ignore next: static function definition -- @preserve */\n    static next() {\n        return uid();\n    }\n}\n/**\n * Returns true if the given model node is a list item block.\n *\n * @internal\n */\nexport function isListItemBlock(node) {\n    return !!node && node.is('element') && node.hasAttribute('listItemId');\n}\n/**\n * Returns an array with all elements that represents the same list item.\n *\n * It means that values for `listIndent`, and `listItemId` for all items are equal.\n *\n * @internal\n * @param listItem Starting list item element.\n * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included\n * in the result.\n */\nexport function getAllListItemBlocks(listItem, options = {}) {\n    return [\n        ...getListItemBlocks(listItem, { ...options, direction: 'backward' }),\n        ...getListItemBlocks(listItem, { ...options, direction: 'forward' })\n    ];\n}\n/**\n * Returns an array with elements that represents the same list item in the specified direction.\n *\n * It means that values for `listIndent` and `listItemId` for all items are equal.\n *\n * **Note**: For backward search the provided item is not included, but for forward search it is included in the result.\n *\n * @internal\n * @param listItem Starting list item element.\n * @param options.direction Walking direction.\n * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included in the result.\n */\nexport function getListItemBlocks(listItem, options = {}) {\n    const isForward = options.direction == 'forward';\n    const items = Array.from(new ListWalker(listItem, {\n        ...options,\n        includeSelf: isForward,\n        sameIndent: true,\n        sameAttributes: 'listItemId'\n    }));\n    return isForward ? items : items.reverse();\n}\n/**\n * Returns a list items nested inside the given list item.\n *\n * @internal\n */\nexport function getNestedListBlocks(listItem) {\n    return Array.from(new ListWalker(listItem, {\n        direction: 'forward',\n        higherIndent: true\n    }));\n}\n/**\n * Returns array of all blocks/items of the same list as given block (same indent, same type and properties).\n *\n * @internal\n * @param listItem Starting list item element.\n * @param options Additional list walker options to modify the range of returned list items.\n */\nexport function getListItems(listItem, options) {\n    const backwardBlocks = new ListWalker(listItem, {\n        sameIndent: true,\n        sameAttributes: 'listType',\n        ...options\n    });\n    const forwardBlocks = new ListWalker(listItem, {\n        sameIndent: true,\n        sameAttributes: 'listType',\n        includeSelf: true,\n        direction: 'forward',\n        ...options\n    });\n    return [\n        ...Array.from(backwardBlocks).reverse(),\n        ...forwardBlocks\n    ];\n}\n/**\n * Check if the given block is the first in the list item.\n *\n * @internal\n * @param listBlock The list block element.\n */\nexport function isFirstBlockOfListItem(listBlock) {\n    const previousSibling = ListWalker.first(listBlock, {\n        sameIndent: true,\n        sameAttributes: 'listItemId'\n    });\n    if (!previousSibling) {\n        return true;\n    }\n    return false;\n}\n/**\n * Check if the given block is the last in the list item.\n *\n * @internal\n */\nexport function isLastBlockOfListItem(listBlock) {\n    const nextSibling = ListWalker.first(listBlock, {\n        direction: 'forward',\n        sameIndent: true,\n        sameAttributes: 'listItemId'\n    });\n    if (!nextSibling) {\n        return true;\n    }\n    return false;\n}\n/**\n * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.\n *\n * @internal\n * @param blocks The list of selected blocks.\n * @param options.withNested Whether should include nested list items.\n */\nexport function expandListBlocksToCompleteItems(blocks, options = {}) {\n    blocks = toArray(blocks);\n    const higherIndent = options.withNested !== false;\n    const allBlocks = new Set();\n    for (const block of blocks) {\n        for (const itemBlock of getAllListItemBlocks(block, { higherIndent })) {\n            allBlocks.add(itemBlock);\n        }\n    }\n    return sortBlocks(allBlocks);\n}\n/**\n * Expands the given list of selected blocks to include all the items of the lists they're in.\n *\n * @internal\n * @param blocks The list of selected blocks.\n */\nexport function expandListBlocksToCompleteList(blocks) {\n    blocks = toArray(blocks);\n    const allBlocks = new Set();\n    for (const block of blocks) {\n        for (const itemBlock of getListItems(block)) {\n            allBlocks.add(itemBlock);\n        }\n    }\n    return sortBlocks(allBlocks);\n}\n/**\n * Splits the list item just before the provided list block.\n *\n * @internal\n * @param listBlock The list block element.\n * @param writer The model writer.\n * @returns The array of updated blocks.\n */\nexport function splitListItemBefore(listBlock, writer) {\n    const blocks = getListItemBlocks(listBlock, { direction: 'forward' });\n    const id = ListItemUid.next();\n    for (const block of blocks) {\n        writer.setAttribute('listItemId', id, block);\n    }\n    return blocks;\n}\n/**\n * Merges the list item with the parent list item.\n *\n * @internal\n * @param listBlock The list block element.\n * @param parentBlock The list block element to merge with.\n * @param writer The model writer.\n * @returns The array of updated blocks.\n */\nexport function mergeListItemBefore(listBlock, parentBlock, writer) {\n    const attributes = {};\n    for (const [key, value] of parentBlock.getAttributes()) {\n        if (key.startsWith('list')) {\n            attributes[key] = value;\n        }\n    }\n    const blocks = getListItemBlocks(listBlock, { direction: 'forward' });\n    for (const block of blocks) {\n        writer.setAttributes(attributes, block);\n    }\n    return blocks;\n}\n/**\n * Increases indentation of given list blocks.\n *\n * @internal\n * @param blocks The block or iterable of blocks.\n * @param writer The model writer.\n * @param options Additional options.\n * @param options.expand Whether should expand the list of blocks to include complete list items.\n * @param options.indentBy The number of levels the indentation should change (could be negative).\n */\nexport function indentBlocks(blocks, writer, { expand, indentBy = 1 } = {}) {\n    blocks = toArray(blocks);\n    // Expand the selected blocks to contain the whole list items.\n    const allBlocks = expand ? expandListBlocksToCompleteItems(blocks) : blocks;\n    for (const block of allBlocks) {\n        const blockIndent = block.getAttribute('listIndent') + indentBy;\n        if (blockIndent < 0) {\n            removeListAttributes(block, writer);\n        }\n        else {\n            writer.setAttribute('listIndent', blockIndent, block);\n        }\n    }\n    return allBlocks;\n}\n/**\n * Decreases indentation of given list of blocks. If the indentation of some blocks matches the indentation\n * of surrounding blocks, they get merged together.\n *\n * @internal\n * @param blocks The block or iterable of blocks.\n * @param writer The model writer.\n */\nexport function outdentBlocksWithMerge(blocks, writer) {\n    blocks = toArray(blocks);\n    // Expand the selected blocks to contain the whole list items.\n    const allBlocks = expandListBlocksToCompleteItems(blocks);\n    const visited = new Set();\n    const referenceIndent = Math.min(...allBlocks.map(block => block.getAttribute('listIndent')));\n    const parentBlocks = new Map();\n    // Collect parent blocks before the list structure gets altered.\n    for (const block of allBlocks) {\n        parentBlocks.set(block, ListWalker.first(block, { lowerIndent: true }));\n    }\n    for (const block of allBlocks) {\n        if (visited.has(block)) {\n            continue;\n        }\n        visited.add(block);\n        const blockIndent = block.getAttribute('listIndent') - 1;\n        if (blockIndent < 0) {\n            removeListAttributes(block, writer);\n            continue;\n        }\n        // Merge with parent list item while outdenting and indent matches reference indent.\n        if (block.getAttribute('listIndent') == referenceIndent) {\n            const mergedBlocks = mergeListItemIfNotLast(block, parentBlocks.get(block), writer);\n            // All list item blocks are updated while merging so add those to visited set.\n            for (const mergedBlock of mergedBlocks) {\n                visited.add(mergedBlock);\n            }\n            // The indent level was updated while merging so continue to next block.\n            if (mergedBlocks.length) {\n                continue;\n            }\n        }\n        writer.setAttribute('listIndent', blockIndent, block);\n    }\n    return sortBlocks(visited);\n}\n/**\n * Removes all list attributes from the given blocks.\n *\n * @internal\n * @param blocks The block or iterable of blocks.\n * @param writer The model writer.\n * @returns Array of altered blocks.\n */\nexport function removeListAttributes(blocks, writer) {\n    blocks = toArray(blocks);\n    // Convert simple list items to plain paragraphs.\n    for (const block of blocks) {\n        if (block.is('element', 'listItem')) {\n            writer.rename(block, 'paragraph');\n        }\n    }\n    // Remove list attributes.\n    for (const block of blocks) {\n        for (const attributeKey of block.getAttributeKeys()) {\n            if (attributeKey.startsWith('list')) {\n                writer.removeAttribute(attributeKey, block);\n            }\n        }\n    }\n    return blocks;\n}\n/**\n * Checks whether the given blocks are related to a single list item.\n *\n * @internal\n * @param blocks The list block elements.\n */\nexport function isSingleListItem(blocks) {\n    if (!blocks.length) {\n        return false;\n    }\n    const firstItemId = blocks[0].getAttribute('listItemId');\n    if (!firstItemId) {\n        return false;\n    }\n    return !blocks.some(item => item.getAttribute('listItemId') != firstItemId);\n}\n/**\n * Modifies the indents of list blocks following the given list block so the indentation is valid after\n * the given block is no longer a list item.\n *\n * @internal\n * @param lastBlock The last list block that has become a non-list element.\n * @param writer The model writer.\n * @returns Array of altered blocks.\n */\nexport function outdentFollowingItems(lastBlock, writer) {\n    const changedBlocks = [];\n    // Start from the model item that is just after the last turned-off item.\n    let currentIndent = Number.POSITIVE_INFINITY;\n    // Correct indent of all items after the last turned off item.\n    // Rules that should be followed:\n    // 1. All direct sub-items of turned-off item should become indent 0, because the first item after it\n    //    will be the first item of a new list. Other items are at the same level, so should have same 0 index.\n    // 2. All items with indent lower than indent of turned-off item should become indent 0, because they\n    //    should not end up as a child of any of list items that they were not children of before.\n    // 3. All other items should have their indent changed relatively to it's parent.\n    //\n    // For example:\n    // 1  * --------\n    // 2     * --------\n    // 3        * --------\t\t\t<-- this is turned off.\n    // 4           * --------\t\t<-- this has to become indent = 0, because it will be first item on a new list.\n    // 5              * --------\t<-- this should be still be a child of item above, so indent = 1.\n    // 6        * --------\t\t\t<-- this has to become indent = 0, because it should not be a child of any of items above.\n    // 7           * --------\t\t<-- this should be still be a child of item above, so indent = 1.\n    // 8     * --------\t\t\t\t<-- this has to become indent = 0.\n    // 9        * --------\t\t\t<-- this should still be a child of item above, so indent = 1.\n    // 10          * --------\t\t<-- this should still be a child of item above, so indent = 2.\n    // 11          * --------\t\t<-- this should still be at the same level as item above, so indent = 2.\n    // 12 * --------\t\t\t\t<-- this and all below are left unchanged.\n    // 13    * --------\n    // 14       * --------\n    //\n    // After turning off 3 the list becomes:\n    //\n    // 1  * --------\n    // 2     * --------\n    //\n    // 3  --------\n    //\n    // 4  * --------\n    // 5     * --------\n    // 6  * --------\n    // 7     * --------\n    // 8  * --------\n    // 9     * --------\n    // 10       * --------\n    // 11       * --------\n    // 12 * --------\n    // 13    * --------\n    // 14       * --------\n    //\n    // Thanks to this algorithm no lists are mismatched and no items get unexpected children/parent, while\n    // those parent-child connection which are possible to maintain are still maintained. It's worth noting\n    // that this is the same effect that we would be get by multiple use of outdent command. However doing\n    // it like this is much more efficient because it's less operation (less memory usage, easier OT) and\n    // less conversion (faster).\n    for (const { node } of new SiblingListBlocksIterator(lastBlock.nextSibling)) {\n        // Check each next list item, as long as its indent is higher than 0.\n        const indent = node.getAttribute('listIndent');\n        // If the indent is 0 we are not going to change anything anyway.\n        if (indent == 0) {\n            break;\n        }\n        // We check if that's item indent is lower than current relative indent.\n        if (indent < currentIndent) {\n            // If it is, current relative indent becomes that indent.\n            currentIndent = indent;\n        }\n        // Fix indent relatively to current relative indent.\n        // Note, that if we just changed the current relative indent, the newIndent will be equal to 0.\n        const newIndent = indent - currentIndent;\n        writer.setAttribute('listIndent', newIndent, node);\n        changedBlocks.push(node);\n    }\n    return changedBlocks;\n}\n/**\n * Returns the array of given blocks sorted by model indexes (document order).\n *\n * @internal\n */\nexport function sortBlocks(blocks) {\n    return Array.from(blocks)\n        .filter(block => block.root.rootName !== '$graveyard')\n        .sort((a, b) => a.index - b.index);\n}\n/**\n * Returns a selected block object. If a selected object is inline or when there is no selected\n * object, `null` is returned.\n *\n * @internal\n * @param model The instance of editor model.\n * @returns Selected block object or `null`.\n */\nexport function getSelectedBlockObject(model) {\n    const selectedElement = model.document.selection.getSelectedElement();\n    if (!selectedElement) {\n        return null;\n    }\n    if (model.schema.isObject(selectedElement) && model.schema.isBlock(selectedElement)) {\n        return selectedElement;\n    }\n    return null;\n}\n/**\n * Checks whether the given block can be replaced by a listItem.\n *\n * Note that this is possible only when multiBlock = false option is set in feature config.\n *\n * @param block A block to be tested.\n * @param schema The schema of the document.\n * @internal\n */\nexport function canBecomeSimpleListItem(block, schema) {\n    return schema.checkChild(block.parent, 'listItem') &&\n        schema.checkChild(block, '$text') &&\n        !schema.isObject(block);\n}\n/**\n * Returns true if listType is of type `numbered` or `customNumbered`.\n *\n * @internal\n */\nexport function isNumberedListType(listType) {\n    return listType == 'numbered' || listType == 'customNumbered';\n}\n/**\n * Merges a given block to the given parent block if parent is a list item and there is no more blocks in the same item.\n */\nfunction mergeListItemIfNotLast(block, parentBlock, writer) {\n    const parentItemBlocks = getListItemBlocks(parentBlock, { direction: 'forward' });\n    // Merge with parent only if outdented item wasn't the last one in its parent.\n    // Merge:\n    // * a\t\t\t->\t\t* a\n    //   * [b]\t\t->\t\t  b\n    //   c\t\t\t->\t\t  c\n    // Don't merge:\n    // * a\t\t\t->\t\t* a\n    //   * [b]\t\t-> \t\t* b\n    // * c\t\t\t->\t\t* c\n    if (parentItemBlocks.pop().index > block.index) {\n        return mergeListItemBefore(block, parentBlock, writer);\n    }\n    return [];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/list/listindentcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { expandListBlocksToCompleteItems, indentBlocks, isFirstBlockOfListItem, isListItemBlock, isSingleListItem, outdentBlocksWithMerge, sortBlocks, splitListItemBefore } from './utils/model.js';\nimport { ListWalker } from './utils/listwalker.js';\n/**\n * The document list indent command. It is used by the {@link module:list/list~List list feature}.\n */\nexport class ListIndentCommand extends Command {\n    /**\n     * Determines by how much the command will change the list item's indent attribute.\n     */\n    _direction;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor The editor instance.\n     * @param indentDirection The direction of indent. If it is equal to `backward`, the command\n     * will outdent a list item.\n     */\n    constructor(editor, indentDirection) {\n        super(editor);\n        this._direction = indentDirection;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.\n     *\n     * @fires execute\n     * @fires afterExecute\n     */\n    execute() {\n        const model = this.editor.model;\n        const blocks = getSelectedListBlocks(model.document.selection);\n        model.change(writer => {\n            const changedBlocks = [];\n            // Handle selection contained in the single list item and starting in the following blocks.\n            if (isSingleListItem(blocks) && !isFirstBlockOfListItem(blocks[0])) {\n                // Allow increasing indent of following list item blocks.\n                if (this._direction == 'forward') {\n                    changedBlocks.push(...indentBlocks(blocks, writer));\n                }\n                // For indent make sure that indented blocks have a new ID.\n                // For outdent just split blocks from the list item (give them a new IDs).\n                changedBlocks.push(...splitListItemBefore(blocks[0], writer));\n            }\n            // More than a single list item is selected, or the first block of list item is selected.\n            else {\n                // Now just update the attributes of blocks.\n                if (this._direction == 'forward') {\n                    changedBlocks.push(...indentBlocks(blocks, writer, { expand: true }));\n                }\n                else {\n                    changedBlocks.push(...outdentBlocksWithMerge(blocks, writer));\n                }\n            }\n            // Align the list item type to match the previous list item (from the same list).\n            for (const block of changedBlocks) {\n                // This block become a plain block (for example a paragraph).\n                if (!block.hasAttribute('listType')) {\n                    continue;\n                }\n                const previousItemBlock = ListWalker.first(block, { sameIndent: true });\n                if (previousItemBlock) {\n                    writer.setAttribute('listType', previousItemBlock.getAttribute('listType'), block);\n                }\n            }\n            this._fireAfterExecute(changedBlocks);\n        });\n    }\n    /**\n     * Fires the `afterExecute` event.\n     *\n     * @param changedBlocks The changed list elements.\n     */\n    _fireAfterExecute(changedBlocks) {\n        this.fire('afterExecute', sortBlocks(new Set(changedBlocks)));\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        // Check whether any of position's ancestor is a list item.\n        let blocks = getSelectedListBlocks(this.editor.model.document.selection);\n        let firstBlock = blocks[0];\n        // If selection is not in a list item, the command is disabled.\n        if (!firstBlock) {\n            return false;\n        }\n        // If we are outdenting it is enough to be in list item. Every list item can always be outdented.\n        if (this._direction == 'backward') {\n            return true;\n        }\n        // A single block of a list item is selected, so it could be indented as a sublist.\n        if (isSingleListItem(blocks) && !isFirstBlockOfListItem(blocks[0])) {\n            return true;\n        }\n        blocks = expandListBlocksToCompleteItems(blocks);\n        firstBlock = blocks[0];\n        // Check if there is any list item before selected items that could become a parent of selected items.\n        const siblingItem = ListWalker.first(firstBlock, { sameIndent: true });\n        if (!siblingItem) {\n            return false;\n        }\n        if (siblingItem.getAttribute('listType') == firstBlock.getAttribute('listType')) {\n            return true;\n        }\n        return false;\n    }\n}\n/**\n * Returns an array of selected blocks truncated to the first non list block element.\n */\nfunction getSelectedListBlocks(selection) {\n    const blocks = Array.from(selection.getSelectedBlocks());\n    const firstNonListBlockIndex = blocks.findIndex(block => !isListItemBlock(block));\n    if (firstNonListBlockIndex != -1) {\n        blocks.length = firstNonListBlockIndex;\n    }\n    return blocks;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { splitListItemBefore, expandListBlocksToCompleteItems, getListItemBlocks, getListItems, removeListAttributes, outdentFollowingItems, ListItemUid, sortBlocks, getSelectedBlockObject, isListItemBlock, canBecomeSimpleListItem } from './utils/model.js';\n/**\n * The list command. It is used by the {@link module:list/list~List list feature}.\n */\nexport class ListCommand extends Command {\n    /**\n     * The type of the list created by the command.\n     */\n    type;\n    /**\n     * List Walker options that change the range of the list items to be changed when the selection is collapsed within a list item.\n     *\n     * In a multi-level list, when the selection is collapsed within a list item, instead of changing only the list items of the same list\n     * type and current indent level, the entire list structure is changed (all list items at all indent levels of any list type).\n     */\n    _listWalkerOptions;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor The editor instance.\n     * @param type List type that will be handled by this command.\n     */\n    constructor(editor, type, options = {}) {\n        super(editor);\n        this.type = type;\n        this._listWalkerOptions = options.multiLevel ? {\n            higherIndent: true,\n            lowerIndent: true,\n            sameAttributes: []\n        } : undefined;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.value = this._getValue();\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Executes the list command.\n     *\n     * @fires execute\n     * @fires afterExecute\n     * @param options Command options.\n     * @param options.forceValue If set, it will force the command behavior. If `true`, the command will try to convert the\n     * selected items and potentially the neighbor elements to the proper list items. If set to `false` it will convert selected elements\n     * to paragraphs. If not set, the command will toggle selected elements to list items or paragraphs, depending on the selection.\n     * @param options.additionalAttributes Additional attributes that are set for list items when the command is executed.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        const selectedBlockObject = getSelectedBlockObject(model);\n        const blocks = Array.from(document.selection.getSelectedBlocks())\n            .filter(block => model.schema.checkAttribute(block, 'listType') || canBecomeSimpleListItem(block, model.schema));\n        // Whether we are turning off some items.\n        const turnOff = options.forceValue !== undefined ? !options.forceValue : this.value;\n        model.change(writer => {\n            if (turnOff) {\n                const lastBlock = blocks[blocks.length - 1];\n                // Split the first block from the list item.\n                const itemBlocks = getListItemBlocks(lastBlock, { direction: 'forward' });\n                const changedBlocks = [];\n                if (itemBlocks.length > 1) {\n                    changedBlocks.push(...splitListItemBefore(itemBlocks[1], writer));\n                }\n                // Strip list attributes.\n                changedBlocks.push(...removeListAttributes(blocks, writer));\n                // Outdent items following the selected list item.\n                changedBlocks.push(...outdentFollowingItems(lastBlock, writer));\n                this._fireAfterExecute(changedBlocks);\n            }\n            // Changing type of list items for a collapsed selection inside a list item.\n            else if ((selectedBlockObject || document.selection.isCollapsed) && isListItemBlock(blocks[0])) {\n                const changedBlocks = getListItems(selectedBlockObject || blocks[0], this._listWalkerOptions);\n                for (const block of changedBlocks) {\n                    writer.setAttributes({\n                        ...options.additionalAttributes,\n                        listType: this.type\n                    }, block);\n                }\n                this._fireAfterExecute(changedBlocks);\n            }\n            // Turning on the list items for a non-collapsed selection.\n            else {\n                const changedBlocks = [];\n                for (const block of blocks) {\n                    // Promote the given block to the list item.\n                    if (!block.hasAttribute('listType')) {\n                        // Rename block to a simple list item if this option is enabled.\n                        if (!block.is('element', 'listItem') && canBecomeSimpleListItem(block, model.schema)) {\n                            writer.rename(block, 'listItem');\n                        }\n                        writer.setAttributes({\n                            ...options.additionalAttributes,\n                            listIndent: 0,\n                            listItemId: ListItemUid.next(),\n                            listType: this.type\n                        }, block);\n                        changedBlocks.push(block);\n                    }\n                    // Change the type of list item.\n                    else {\n                        for (const node of expandListBlocksToCompleteItems(block, { withNested: false })) {\n                            if (node.getAttribute('listType') != this.type) {\n                                writer.setAttributes({\n                                    ...options.additionalAttributes,\n                                    listType: this.type\n                                }, node);\n                                changedBlocks.push(node);\n                            }\n                        }\n                    }\n                }\n                this._fireAfterExecute(changedBlocks);\n            }\n        });\n    }\n    /**\n     * Fires the `afterExecute` event.\n     *\n     * @param changedBlocks The changed list elements.\n     */\n    _fireAfterExecute(changedBlocks) {\n        this.fire('afterExecute', sortBlocks(new Set(changedBlocks)));\n    }\n    /**\n     * Checks the command's {@link #value}.\n     *\n     * @returns The current value.\n     */\n    _getValue() {\n        const selection = this.editor.model.document.selection;\n        const blocks = Array.from(selection.getSelectedBlocks());\n        if (!blocks.length) {\n            return false;\n        }\n        for (const block of blocks) {\n            if (block.getAttribute('listType') != this.type) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selection = model.document.selection;\n        const blocks = Array.from(selection.getSelectedBlocks());\n        if (!blocks.length) {\n            return false;\n        }\n        // If command value is true it means that we are in list item, so the command should be enabled.\n        if (this.value) {\n            return true;\n        }\n        for (const block of blocks) {\n            if (schema.checkAttribute(block, 'listType') || canBecomeSimpleListItem(block, schema)) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/list/listmergecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getNestedListBlocks, indentBlocks, sortBlocks, isFirstBlockOfListItem, mergeListItemBefore, isSingleListItem, getSelectedBlockObject, isListItemBlock } from './utils/model.js';\nimport { ListWalker } from './utils/listwalker.js';\n/**\n * The document list merge command. It is used by the {@link module:list/list~List list feature}.\n */\nexport class ListMergeCommand extends Command {\n    /**\n     * Whether list item should be merged before or after the selected block.\n     */\n    _direction;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor The editor instance.\n     * @param direction Whether list item should be merged before or after the selected block.\n     */\n    constructor(editor, direction) {\n        super(editor);\n        this._direction = direction;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Merges list blocks together (depending on the {@link #constructor}'s `direction` parameter).\n     *\n     * @fires execute\n     * @fires afterExecute\n     * @param options Command options.\n     * @param options.shouldMergeOnBlocksContentLevel When set `true`, merging will be performed together\n     * with {@link module:engine/model/model~Model#deleteContent} to get rid of the inline content in the selection or take advantage\n     * of the heuristics in `deleteContent()` that helps convert lists into paragraphs in certain cases.\n     */\n    execute({ shouldMergeOnBlocksContentLevel = false } = {}) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const changedBlocks = [];\n        model.change(writer => {\n            const { firstElement, lastElement } = this._getMergeSubjectElements(selection, shouldMergeOnBlocksContentLevel);\n            const firstIndent = firstElement.getAttribute('listIndent') || 0;\n            const lastIndent = lastElement.getAttribute('listIndent');\n            const lastElementId = lastElement.getAttribute('listItemId');\n            if (firstIndent != lastIndent) {\n                const nestedLastElementBlocks = getNestedListBlocks(lastElement);\n                changedBlocks.push(...indentBlocks([lastElement, ...nestedLastElementBlocks], writer, {\n                    indentBy: firstIndent - lastIndent,\n                    // If outdenting, the entire sub-tree that follows must be included.\n                    expand: firstIndent < lastIndent\n                }));\n            }\n            if (shouldMergeOnBlocksContentLevel) {\n                let sel = selection;\n                if (selection.isCollapsed) {\n                    sel = writer.createSelection(writer.createRange(writer.createPositionAt(firstElement, 'end'), writer.createPositionAt(lastElement, 0)));\n                }\n                // Delete selected content. Replace entire content only for non-collapsed selection.\n                model.deleteContent(sel, { doNotResetEntireContent: selection.isCollapsed });\n                // Get the last \"touched\" element after deleteContent call (can't use the lastElement because\n                // it could get merged into the firstElement while deleting content).\n                const lastElementAfterDelete = sel.getLastPosition().parent;\n                // Check if the element after it was in the same list item and adjust it if needed.\n                const nextSibling = lastElementAfterDelete.nextSibling;\n                changedBlocks.push(lastElementAfterDelete);\n                if (nextSibling && nextSibling !== lastElement && nextSibling.getAttribute('listItemId') == lastElementId) {\n                    changedBlocks.push(...mergeListItemBefore(nextSibling, lastElementAfterDelete, writer));\n                }\n            }\n            else {\n                changedBlocks.push(...mergeListItemBefore(lastElement, firstElement, writer));\n            }\n            this._fireAfterExecute(changedBlocks);\n        });\n    }\n    /**\n     * Fires the `afterExecute` event.\n     *\n     * @param changedBlocks The changed list elements.\n     */\n    _fireAfterExecute(changedBlocks) {\n        this.fire('afterExecute', sortBlocks(new Set(changedBlocks)));\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const selectedBlockObject = getSelectedBlockObject(model);\n        if (selection.isCollapsed || selectedBlockObject) {\n            const positionParent = selectedBlockObject || selection.getFirstPosition().parent;\n            if (!isListItemBlock(positionParent)) {\n                return false;\n            }\n            const siblingNode = this._direction == 'backward' ?\n                positionParent.previousSibling :\n                positionParent.nextSibling;\n            if (!siblingNode) {\n                return false;\n            }\n            if (isSingleListItem([positionParent, siblingNode])) {\n                return false;\n            }\n        }\n        else {\n            const lastPosition = selection.getLastPosition();\n            const firstPosition = selection.getFirstPosition();\n            // If deleting within a single block of a list item, there's no need to merge anything.\n            // The default delete should be executed instead.\n            if (lastPosition.parent === firstPosition.parent) {\n                return false;\n            }\n            if (!isListItemBlock(lastPosition.parent)) {\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Returns the boundary elements the merge should be executed for. These are not necessarily selection's first\n     * and last position parents but sometimes sibling or even further blocks depending on the context.\n     *\n     * @param selection The selection the merge is executed for.\n     * @param shouldMergeOnBlocksContentLevel When `true`, merge is performed together with\n     * {@link module:engine/model/model~Model#deleteContent} to remove the inline content within the selection.\n     */\n    _getMergeSubjectElements(selection, shouldMergeOnBlocksContentLevel) {\n        const model = this.editor.model;\n        const selectedBlockObject = getSelectedBlockObject(model);\n        let firstElement, lastElement;\n        if (selection.isCollapsed || selectedBlockObject) {\n            const positionParent = selectedBlockObject || selection.getFirstPosition().parent;\n            const isFirstBlock = isFirstBlockOfListItem(positionParent);\n            if (this._direction == 'backward') {\n                lastElement = positionParent;\n                if (isFirstBlock && !shouldMergeOnBlocksContentLevel) {\n                    // For the \"c\" as an anchorElement:\n                    //  * a\n                    //    * b\n                    //  * [c]  <-- this block should be merged with \"a\"\n                    // It should find \"a\" element to merge with:\n                    //  * a\n                    //    * b\n                    //    c\n                    firstElement = ListWalker.first(positionParent, { sameIndent: true, lowerIndent: true });\n                }\n                else {\n                    firstElement = positionParent.previousSibling;\n                }\n            }\n            else {\n                // In case of the forward merge there is no case as above, just merge with next sibling.\n                firstElement = positionParent;\n                lastElement = positionParent.nextSibling;\n            }\n        }\n        else {\n            firstElement = selection.getFirstPosition().parent;\n            lastElement = selection.getLastPosition().parent;\n        }\n        return {\n            firstElement: firstElement,\n            lastElement: lastElement\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { isFirstBlockOfListItem, isListItemBlock, sortBlocks, splitListItemBefore } from './utils/model.js';\n/**\n * The document list split command that splits the list item at the selection.\n *\n * It is used by the {@link module:list/list~List list feature}.\n */\nexport class ListSplitCommand extends Command {\n    /**\n     * Whether list item should be split before or after the selected block.\n     */\n    _direction;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor The editor instance.\n     * @param direction Whether list item should be split before or after the selected block.\n     */\n    constructor(editor, direction) {\n        super(editor);\n        this._direction = direction;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Splits the list item at the selection.\n     *\n     * @fires execute\n     * @fires afterExecute\n     */\n    execute() {\n        const editor = this.editor;\n        editor.model.change(writer => {\n            const changedBlocks = splitListItemBefore(this._getStartBlock(), writer);\n            this._fireAfterExecute(changedBlocks);\n        });\n    }\n    /**\n     * Fires the `afterExecute` event.\n     *\n     * @param changedBlocks The changed list elements.\n     */\n    _fireAfterExecute(changedBlocks) {\n        this.fire('afterExecute', sortBlocks(new Set(changedBlocks)));\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        const selection = this.editor.model.document.selection;\n        const block = this._getStartBlock();\n        return selection.isCollapsed &&\n            isListItemBlock(block) &&\n            !isFirstBlockOfListItem(block);\n    }\n    /**\n     * Returns the model element that is the main focus of the command (according to the current selection and command direction).\n     */\n    _getStartBlock() {\n        const doc = this.editor.model.document;\n        const positionParent = doc.selection.getFirstPosition().parent;\n        return (this._direction == 'before' ? positionParent : positionParent.nextSibling);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listformatting/listitemboldintegration\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { env } from 'ckeditor5/src/utils.js';\nimport { ListEditing } from '../list/listediting.js';\n/**\n * The list item bold integration plugin.\n */\nexport class ListItemBoldIntegration extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListItemBoldIntegration';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const ListFormatting = editor.plugins.get('ListFormatting');\n        const listEditing = editor.plugins.get(ListEditing);\n        if (!editor.plugins.has('BoldEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        ListFormatting.registerFormatAttribute('bold', 'listItemBold');\n        // Register the downcast strategy in init() so that the attribute name is registered before the list editing\n        // registers its converters.\n        // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.\n        listEditing.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'listItemBold',\n            setAttributeOnDowncast(writer, value, viewElement, options) {\n                if (value) {\n                    writer.addClass('ck-list-marker-bold', viewElement);\n                    // See: https://github.com/ckeditor/ckeditor5/issues/18790.\n                    if (env.isSafari && !(options && options.dataPipeline)) {\n                        writer.setStyle('--ck-content-list-marker-dummy-bold', '0', viewElement);\n                    }\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const model = editor.model;\n        if (!editor.plugins.has('BoldEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        model.schema.extend('$listItem', { allowAttributes: 'listItemBold' });\n        model.schema.setAttributeProperties('listItemBold', {\n            isFormatting: true\n        });\n        model.schema.addAttributeCheck(context => {\n            const item = context.last;\n            if (!item.getAttribute('listItemId')) {\n                return false;\n            }\n        }, 'listItemBold');\n        editor.conversion.for('upcast').attributeToAttribute({\n            model: 'listItemBold',\n            view: {\n                name: 'li',\n                classes: 'ck-list-marker-bold'\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listformatting/listitemitalicintegration\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { env } from 'ckeditor5/src/utils.js';\nimport { ListEditing } from '../list/listediting.js';\n/**\n * The list item italic integration plugin.\n */\nexport class ListItemItalicIntegration extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListItemItalicIntegration';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const ListFormatting = editor.plugins.get('ListFormatting');\n        const listEditing = editor.plugins.get(ListEditing);\n        if (!editor.plugins.has('ItalicEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        ListFormatting.registerFormatAttribute('italic', 'listItemItalic');\n        // Register the downcast strategy in init() so that the attribute name is registered before the list editing\n        // registers its converters.\n        // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.\n        listEditing.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'listItemItalic',\n            setAttributeOnDowncast(writer, value, viewElement, options) {\n                if (value) {\n                    writer.addClass('ck-list-marker-italic', viewElement);\n                    // See: https://github.com/ckeditor/ckeditor5/issues/18790.\n                    if (env.isSafari && !(options && options.dataPipeline)) {\n                        writer.setStyle('--ck-content-list-marker-dummy-italic', '0', viewElement);\n                    }\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const model = editor.model;\n        if (!editor.plugins.has('ItalicEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        model.schema.extend('$listItem', { allowAttributes: 'listItemItalic' });\n        model.schema.setAttributeProperties('listItemItalic', {\n            isFormatting: true\n        });\n        model.schema.addAttributeCheck(context => {\n            const item = context.last;\n            if (!item.getAttribute('listItemId')) {\n                return false;\n            }\n        }, 'listItemItalic');\n        editor.conversion.for('upcast').attributeToAttribute({\n            model: 'listItemItalic',\n            view: {\n                name: 'li',\n                classes: 'ck-list-marker-italic'\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The base font command.\n */\nexport class FontCommand extends Command {\n    /**\n     * A model attribute on which this command operates.\n     */\n    attributeKey;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor Editor instance.\n     * @param attributeKey The name of a model attribute on which this command operates.\n     */\n    constructor(editor, attributeKey) {\n        super(editor);\n        this.attributeKey = attributeKey;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const doc = model.document;\n        this.value = doc.selection.getAttribute(this.attributeKey);\n        this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, this.attributeKey);\n    }\n    /**\n     * Executes the command. Applies the `value` of the {@link #attributeKey} to the selection.\n     * If no `value` is passed, it removes the attribute from the selection.\n     *\n     * @param options Options for the executed command.\n     * @param options.value The value to apply.\n     * @fires execute\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        const selection = document.selection;\n        const value = options.value;\n        const batch = options.batch;\n        const updateAttribute = (writer) => {\n            if (selection.isCollapsed) {\n                if (value) {\n                    writer.setSelectionAttribute(this.attributeKey, value);\n                }\n                else {\n                    writer.removeSelectionAttribute(this.attributeKey);\n                }\n            }\n            else {\n                const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey);\n                for (const range of ranges) {\n                    if (value) {\n                        writer.setAttribute(this.attributeKey, value, range);\n                    }\n                    else {\n                        writer.removeAttribute(this.attributeKey, range);\n                    }\n                }\n            }\n        };\n        // In some scenarios, you may want to use a single undo step for multiple changes (e.g. in color picker).\n        if (batch) {\n            model.enqueueChange(batch, writer => {\n                updateAttribute(writer);\n            });\n        }\n        else {\n            model.change(writer => {\n                updateAttribute(writer);\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorgrid/colortileview\n */\nimport { IconColorTileCheck } from '@ckeditor/ckeditor5-icons';\nimport { env } from '@ckeditor/ckeditor5-utils';\nimport { ButtonView } from '../button/buttonview.js';\n/**\n * This class represents a single color tile in the {@link module:ui/colorgrid/colorgridview~ColorGridView}.\n */\nexport class ColorTileView extends ButtonView {\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('color', undefined);\n        this.set('hasBorder', false);\n        this.icon = IconColorTileCheck;\n        this.extendTemplate({\n            attributes: {\n                style: {\n                    // https://github.com/ckeditor/ckeditor5/issues/14907\n                    backgroundColor: bind.to('color', color => env.isMediaForcedColors ? null : color)\n                },\n                class: [\n                    'ck',\n                    'ck-color-grid__tile',\n                    bind.if('hasBorder', 'ck-color-selector__color-tile_bordered')\n                ]\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.iconView.fillColor = 'hsl(0, 0%, 100%)';\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0\\\" class=\\\"ck-icon__fill\\\"/><path d=\\\"M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * A helper that adds a keyboard navigation support (arrow up/down/left/right) for grids.\n *\n * @param options Configuration options.\n * @param options.keystrokeHandler Keystroke handler to register navigation with arrow keys.\n * @param options.focusTracker A focus tracker for grid elements.\n * @param options.gridItems A collection of grid items.\n * @param options.numberOfColumns Number of columns in the grid. Can be specified as a function that returns\n * the number (e.g. for responsive grids).\n * @param options.uiLanguageDirection String of ui language direction.\n */\nexport function addKeyboardHandlingForGrid({ keystrokeHandler, focusTracker, gridItems, numberOfColumns, uiLanguageDirection }) {\n    const getNumberOfColumns = typeof numberOfColumns === 'number' ? () => numberOfColumns : numberOfColumns;\n    keystrokeHandler.set('arrowright', getGridItemFocuser((focusedElementIndex, gridItems) => {\n        return uiLanguageDirection === 'rtl' ?\n            getLeftElementIndex(focusedElementIndex, gridItems.length) :\n            getRightElementIndex(focusedElementIndex, gridItems.length);\n    }));\n    keystrokeHandler.set('arrowleft', getGridItemFocuser((focusedElementIndex, gridItems) => {\n        return uiLanguageDirection === 'rtl' ?\n            getRightElementIndex(focusedElementIndex, gridItems.length) :\n            getLeftElementIndex(focusedElementIndex, gridItems.length);\n    }));\n    keystrokeHandler.set('arrowup', getGridItemFocuser((focusedElementIndex, gridItems) => {\n        let nextIndex = focusedElementIndex - getNumberOfColumns();\n        if (nextIndex < 0) {\n            nextIndex = focusedElementIndex + getNumberOfColumns() * Math.floor(gridItems.length / getNumberOfColumns());\n            if (nextIndex > gridItems.length - 1) {\n                nextIndex -= getNumberOfColumns();\n            }\n        }\n        return nextIndex;\n    }));\n    keystrokeHandler.set('arrowdown', getGridItemFocuser((focusedElementIndex, gridItems) => {\n        let nextIndex = focusedElementIndex + getNumberOfColumns();\n        if (nextIndex > gridItems.length - 1) {\n            nextIndex = focusedElementIndex % getNumberOfColumns();\n        }\n        return nextIndex;\n    }));\n    function getGridItemFocuser(getIndexToFocus) {\n        return (evt) => {\n            const focusedElement = gridItems.find(item => item.element === focusTracker.focusedElement);\n            const focusedElementIndex = gridItems.getIndex(focusedElement);\n            const nextIndexToFocus = getIndexToFocus(focusedElementIndex, gridItems);\n            gridItems.get(nextIndexToFocus).focus();\n            evt.stopPropagation();\n            evt.preventDefault();\n        };\n    }\n    /**\n     * Function returning the next index.\n     *\n     * ```\n     * before: [ ][x][ ]\tafter: [ ][ ][x]\n     * index = 1            index = 2\n     * ```\n     *\n     * If current index is last, function returns first index.\n     *\n     * ```\n     * before: [ ][ ][x]\tafter: [x][ ][ ]\n     * index = 2            index = 0\n     * ```\n     *\n     * @param elementIndex Number of current index.\n     * @param collectionLength A count of collection items.\n     */\n    function getRightElementIndex(elementIndex, collectionLength) {\n        if (elementIndex === collectionLength - 1) {\n            return 0;\n        }\n        else {\n            return elementIndex + 1;\n        }\n    }\n    /**\n     * Function returning the previous index.\n     *\n     * ```\n     * before: [ ][x][ ]\tafter: [x][ ][ ]\n     * index = 1            index = 0\n     * ```\n     *\n     * If current index is first, function returns last index.\n     *\n     * ```\n     * before: [x][ ][ ]\tafter: [ ][ ][x]\n     * index = 0            index = 2\n     * ```\n     *\n     * @param elementIndex Number of current index.\n     * @param collectionLength A count of collection items.\n     */\n    function getLeftElementIndex(elementIndex, collectionLength) {\n        if (elementIndex === 0) {\n            return collectionLength - 1;\n        }\n        else {\n            return elementIndex - 1;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorgrid/colorgridview\n */\nimport { View } from '../view.js';\nimport { ColorTileView } from './colortileview.js';\nimport { addKeyboardHandlingForGrid } from '../bindings/addkeyboardhandlingforgrid.js';\nimport { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';\nimport '../../theme/components/colorgrid/colorgrid.css';\n/**\n * A grid of {@link module:ui/colorgrid/colortileview~ColorTileView color tiles}.\n */\nexport class ColorGridView extends View {\n    /**\n     * A number of columns for the tiles grid.\n     */\n    columns;\n    /**\n     * Collection of the child tile views.\n     */\n    items;\n    /**\n     * Tracks information about DOM focus in the grid.\n     */\n    focusTracker;\n    /**\n     * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * Creates an instance of a color grid containing {@link module:ui/colorgrid/colortileview~ColorTileView tiles}.\n     *\n     * @fires execute\n     * @param locale The localization services instance.\n     * @param options Component configuration\n     * @param options.colorDefinitions Array with definitions\n     * required to create the {@link module:ui/colorgrid/colortileview~ColorTileView tiles}.\n     * @param options.columns A number of columns to display the tiles.\n     */\n    constructor(locale, options) {\n        super(locale);\n        const colorDefinitions = options && options.colorDefinitions ? options.colorDefinitions : [];\n        this.columns = options?.columns || 5;\n        const viewStyleAttribute = {\n            gridTemplateColumns: `repeat( ${this.columns}, 1fr)`\n        };\n        this.set('selectedColor', undefined);\n        this.items = this.createCollection();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.items.on('add', (evt, colorTile) => {\n            colorTile.isOn = colorTile.color === this.selectedColor;\n        });\n        colorDefinitions.forEach(color => {\n            const colorTile = new ColorTileView();\n            colorTile.set({\n                color: color.color,\n                label: color.label,\n                tooltip: true,\n                hasBorder: color.options.hasBorder\n            });\n            colorTile.on('execute', () => {\n                this.fire('execute', {\n                    value: color.color,\n                    hasBorder: color.options.hasBorder,\n                    label: color.label\n                });\n            });\n            this.items.add(colorTile);\n        });\n        this.setTemplate({\n            tag: 'div',\n            children: this.items,\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-color-grid'\n                ],\n                style: viewStyleAttribute\n            }\n        });\n        this.on('change:selectedColor', (evt, name, selectedColor) => {\n            for (const item of this.items) {\n                item.isOn = item.color === selectedColor;\n            }\n        });\n    }\n    /**\n     * Focuses the first focusable in {@link #items}.\n     */\n    focus() {\n        if (this.items.length) {\n            this.items.first.focus();\n        }\n    }\n    /**\n     * Focuses the last focusable in {@link #items}.\n     */\n    focusLast() {\n        if (this.items.length) {\n            this.items.last.focus();\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Items added before rendering should be known to the #focusTracker.\n        for (const item of this.items) {\n            this.focusTracker.add(item.element);\n        }\n        this.items.on('add', (evt, item) => {\n            this.focusTracker.add(item.element);\n        });\n        this.items.on('remove', (evt, item) => {\n            this.focusTracker.remove(item.element);\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n        addKeyboardHandlingForGrid({\n            keystrokeHandler: this.keystrokes,\n            focusTracker: this.focusTracker,\n            gridItems: this.items,\n            numberOfColumns: this.columns,\n            uiLanguageDirection: this.locale?.uiLanguageDirection\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Collection, ObservableMixin } from '@ckeditor/ckeditor5-utils';\n/**\n * A collection to store document colors. It enforces colors to be unique.\n */\nexport class DocumentColorCollection extends /* #__PURE__ */ ObservableMixin((Collection)) {\n    constructor(options) {\n        super(options);\n        this.set('isEmpty', true);\n        this.on('change', () => {\n            this.set('isEmpty', this.length === 0);\n        });\n    }\n    /**\n     * Adds a color to the document color collection.\n     *\n     * This method ensures that no color duplicates are inserted (compared using\n     * the color value of the {@link module:ui/colorgrid/colorgridview~ColorDefinition}).\n     *\n     * If the item does not have an ID, it will be automatically generated and set on the item.\n     *\n     * @param index The position of the item in the collection. The item is pushed to the collection when `index` is not specified.\n     * @fires add\n     * @fires change\n     */\n    add(item, index) {\n        if (this.find(element => element.color === item.color)) {\n            // No duplicates are allowed.\n            return this;\n        }\n        return super.add(item, index);\n    }\n    /**\n     * Checks if an object with given colors is present in the document color collection.\n     */\n    hasColor(color) {\n        return !!this.find(item => item.color === color);\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 9 9 0 0 1-.372.008m-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414M9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415m4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053z\\\"/><path d=\\\"M4 18h5.523v-1H4zm-2 0h1v-1H2z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorselector/colorgridsfragmentview\n */\nimport { View } from '../view.js';\nimport { ButtonView } from '../button/buttonview.js';\nimport { ColorGridView } from '../colorgrid/colorgridview.js';\nimport { ColorTileView } from '../colorgrid/colortileview.js';\nimport { Template } from '../template.js';\nimport { DocumentColorCollection } from './documentcolorcollection.js';\nimport { IconEraser, IconColorPalette } from '@ckeditor/ckeditor5-icons';\n/**\n * One of the fragments of {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.\n *\n * It provides a UI that allows users to select colors from the a predefined set and from existing document colors.\n *\n * It consists of the following sub–components:\n *\n * * A \"Remove color\" button,\n * * A static {@link module:ui/colorgrid/colorgridview~ColorGridView} of colors defined in the configuration,\n * * A dynamic {@link module:ui/colorgrid/colorgridview~ColorGridView} of colors used in the document.\n * * If color picker is configured, the \"Color Picker\" button is visible too.\n */\nexport class ColorGridsFragmentView extends View {\n    /**\n     * A collection of the children of the table.\n     */\n    items;\n    /**\n     * An array with objects representing colors to be displayed in the grid.\n     */\n    colorDefinitions;\n    /**\n     * Tracks information about the DOM focus in the list.\n     */\n    focusTracker;\n    /**\n     * The number of columns in the color grid.\n     */\n    columns;\n    /**\n     * Preserves the reference to {@link module:ui/colorselector/documentcolorcollection~DocumentColorCollection} used to collect\n     * definitions that store the document colors.\n     *\n     * @readonly\n     */\n    documentColors;\n    /**\n     * The maximum number of colors in the document colors section.\n     * If it equals 0, the document colors section is not added.\n     *\n     * @readonly\n     */\n    documentColorsCount;\n    /**\n     * Preserves the reference to {@link module:ui/colorgrid/colorgridview~ColorGridView} used to create\n     * the default (static) color set.\n     *\n     * The property is loaded once the the parent dropdown is opened the first time.\n     *\n     * @readonly\n     */\n    staticColorsGrid;\n    /**\n     * Preserves the reference to {@link module:ui/colorgrid/colorgridview~ColorGridView} used to create\n     * the document colors. It remains undefined if the document colors feature is disabled.\n     *\n     * The property is loaded once the the parent dropdown is opened the first time.\n     *\n     * @readonly\n     */\n    documentColorsGrid;\n    /**\n     * The \"Color picker\" button view.\n     */\n    colorPickerButtonView;\n    /**\n     * The \"Remove color\" button view.\n     */\n    removeColorButtonView;\n    /**\n     * A collection of views that can be focused in the view.\n     *\n     * @readonly\n     */\n    _focusables;\n    /**\n     * Document color section's label.\n     *\n     * @readonly\n     */\n    _documentColorsLabel;\n    /**\n     * The label of the button responsible for removing color attributes.\n     */\n    _removeButtonLabel;\n    /**\n     * The label of the button responsible for switching to the color picker component.\n     */\n    _colorPickerLabel;\n    /**\n     * Creates an instance of the view.\n     *\n     * @param locale The localization services instance.\n     * @param options Constructor options.\n     * @param options.colors An array with definitions of colors to be displayed in the table.\n     * @param options.columns The number of columns in the color grid.\n     * @param options.removeButtonLabel The label of the button responsible for removing the color.\n     * @param options.colorPickerLabel The label of the button responsible for color picker appearing.\n     * @param options.documentColorsLabel The label for the section with the document colors.\n     * @param options.documentColorsCount The number of colors in the document colors section inside the color dropdown.\n     * @param options.focusTracker Tracks information about the DOM focus in the list.\n     * @param options.focusables A collection of views that can be focused in the view.\n     */\n    constructor(locale, { colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount, colorPickerLabel, focusTracker, focusables }) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('isVisible', true);\n        this.focusTracker = focusTracker;\n        this.items = this.createCollection();\n        this.colorDefinitions = colors;\n        this.columns = columns;\n        this.documentColors = new DocumentColorCollection();\n        this.documentColorsCount = documentColorsCount;\n        this._focusables = focusables;\n        this._removeButtonLabel = removeButtonLabel;\n        this._colorPickerLabel = colorPickerLabel;\n        this._documentColorsLabel = documentColorsLabel;\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck-color-grids-fragment',\n                    bind.if('isVisible', 'ck-hidden', value => !value)\n                ]\n            },\n            children: this.items\n        });\n        this.removeColorButtonView = this._createRemoveColorButton();\n        this.items.add(this.removeColorButtonView);\n    }\n    /**\n     * Scans through the editor model and searches for text node attributes with the given attribute name.\n     * Found entries are set as document colors.\n     *\n     * All the previously stored document colors will be lost in the process.\n     *\n     * @param model The model used as a source to obtain the document colors.\n     * @param attributeName Determines the name of the related model's attribute for a given dropdown.\n     */\n    updateDocumentColors(model, attributeName) {\n        const document = model.document;\n        const maxCount = this.documentColorsCount;\n        this.documentColors.clear();\n        for (const root of document.getRoots()) {\n            const range = model.createRangeIn(root);\n            for (const node of range.getItems()) {\n                if (node.is('$textProxy') && node.hasAttribute(attributeName)) {\n                    this._addColorToDocumentColors(node.getAttribute(attributeName));\n                    if (this.documentColors.length >= maxCount) {\n                        return;\n                    }\n                }\n            }\n        }\n    }\n    /**\n     * Refreshes the state of the selected color in one or both {@link module:ui/colorgrid/colorgridview~ColorGridView}s\n     * available in the {@link module:ui/colorselector/colorselectorview~ColorSelectorView}. It guarantees that the selection will\n     * occur only in one of them.\n     */\n    updateSelectedColors() {\n        const documentColorsGrid = this.documentColorsGrid;\n        const staticColorsGrid = this.staticColorsGrid;\n        const selectedColor = this.selectedColor;\n        staticColorsGrid.selectedColor = selectedColor;\n        if (documentColorsGrid) {\n            documentColorsGrid.selectedColor = selectedColor;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.staticColorsGrid = this._createStaticColorsGrid();\n        this.items.add(this.staticColorsGrid);\n        if (this.documentColorsCount) {\n            // Create a label for document colors.\n            const bind = Template.bind(this.documentColors, this.documentColors);\n            const label = new View(this.locale);\n            label.setTemplate({\n                tag: 'span',\n                attributes: {\n                    class: [\n                        'ck',\n                        'ck-color-grid__label',\n                        bind.if('isEmpty', 'ck-hidden')\n                    ]\n                },\n                children: [\n                    {\n                        text: this._documentColorsLabel\n                    }\n                ]\n            });\n            this.items.add(label);\n            this.documentColorsGrid = this._createDocumentColorsGrid();\n            this.items.add(this.documentColorsGrid);\n        }\n        this._createColorPickerButton();\n        this._addColorSelectorElementsToFocusTracker();\n    }\n    /**\n     * Focuses the component.\n     */\n    focus() {\n        this.removeColorButtonView.focus();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n    }\n    /**\n     * Handles displaying the color picker button (if it was previously created) and making it focusable.\n     */\n    addColorPickerButton() {\n        if (this.colorPickerButtonView) {\n            this.items.add(this.colorPickerButtonView);\n            this.focusTracker.add(this.colorPickerButtonView.element);\n            this._focusables.add(this.colorPickerButtonView);\n        }\n    }\n    /**\n     * Adds color selector elements to focus tracker.\n     */\n    _addColorSelectorElementsToFocusTracker() {\n        this.focusTracker.add(this.removeColorButtonView.element);\n        this._focusables.add(this.removeColorButtonView);\n        if (this.staticColorsGrid) {\n            this.focusTracker.add(this.staticColorsGrid.element);\n            this._focusables.add(this.staticColorsGrid);\n        }\n        if (this.documentColorsGrid) {\n            this.focusTracker.add(this.documentColorsGrid.element);\n            this._focusables.add(this.documentColorsGrid);\n        }\n    }\n    /**\n     * Creates the button responsible for displaying the color picker component.\n     */\n    _createColorPickerButton() {\n        this.colorPickerButtonView = new ButtonView();\n        this.colorPickerButtonView.set({\n            label: this._colorPickerLabel,\n            withText: true,\n            icon: IconColorPalette,\n            class: 'ck-color-selector__color-picker'\n        });\n        this.colorPickerButtonView.on('execute', () => {\n            this.fire('colorPicker:show');\n        });\n    }\n    /**\n     * Adds the remove color button as a child of the current view.\n     */\n    _createRemoveColorButton() {\n        const buttonView = new ButtonView();\n        buttonView.set({\n            withText: true,\n            icon: IconEraser,\n            label: this._removeButtonLabel\n        });\n        buttonView.class = 'ck-color-selector__remove-color';\n        buttonView.on('execute', () => {\n            this.fire('execute', {\n                value: null,\n                source: 'removeColorButton'\n            });\n        });\n        buttonView.render();\n        return buttonView;\n    }\n    /**\n     * Creates a static color grid based on the editor configuration.\n     */\n    _createStaticColorsGrid() {\n        const colorGrid = new ColorGridView(this.locale, {\n            colorDefinitions: this.colorDefinitions,\n            columns: this.columns\n        });\n        colorGrid.on('execute', (evt, data) => {\n            this.fire('execute', {\n                value: data.value,\n                source: 'staticColorsGrid'\n            });\n        });\n        return colorGrid;\n    }\n    /**\n     * Creates the document colors section view and binds it to {@link #documentColors}.\n     */\n    _createDocumentColorsGrid() {\n        const bind = Template.bind(this.documentColors, this.documentColors);\n        const documentColorsGrid = new ColorGridView(this.locale, {\n            columns: this.columns\n        });\n        documentColorsGrid.extendTemplate({\n            attributes: {\n                class: bind.if('isEmpty', 'ck-hidden')\n            }\n        });\n        documentColorsGrid.items.bindTo(this.documentColors).using(colorObj => {\n            const colorTile = new ColorTileView();\n            colorTile.set({\n                color: colorObj.color,\n                hasBorder: colorObj.options?.hasBorder\n            });\n            if (colorObj.label) {\n                colorTile.set({\n                    label: colorObj.label,\n                    tooltip: true\n                });\n            }\n            colorTile.on('execute', () => {\n                this.fire('execute', {\n                    value: colorObj.color,\n                    source: 'documentColorsGrid'\n                });\n            });\n            return colorTile;\n        });\n        // Selected color should be cleared when document colors became empty.\n        this.documentColors.on('change:isEmpty', (evt, name, val) => {\n            if (val) {\n                documentColorsGrid.selectedColor = null;\n            }\n        });\n        return documentColorsGrid;\n    }\n    /**\n     * Adds a given color to the document colors list. If possible, the method will attempt to use\n     * data from the {@link #colorDefinitions} (label, color options).\n     *\n     * @param color A string that stores the value of the recently applied color.\n     */\n    _addColorToDocumentColors(color) {\n        const predefinedColor = this.colorDefinitions\n            .find(definition => definition.color === color);\n        if (!predefinedColor) {\n            this.documentColors.add({\n                color,\n                label: color,\n                options: {\n                    hasBorder: false\n                }\n            });\n        }\n        else {\n            this.documentColors.add(Object.assign({}, predefinedColor));\n        }\n    }\n}\n","const colors = {\n\taliceblue: [240, 248, 255],\n\tantiquewhite: [250, 235, 215],\n\taqua: [0, 255, 255],\n\taquamarine: [127, 255, 212],\n\tazure: [240, 255, 255],\n\tbeige: [245, 245, 220],\n\tbisque: [255, 228, 196],\n\tblack: [0, 0, 0],\n\tblanchedalmond: [255, 235, 205],\n\tblue: [0, 0, 255],\n\tblueviolet: [138, 43, 226],\n\tbrown: [165, 42, 42],\n\tburlywood: [222, 184, 135],\n\tcadetblue: [95, 158, 160],\n\tchartreuse: [127, 255, 0],\n\tchocolate: [210, 105, 30],\n\tcoral: [255, 127, 80],\n\tcornflowerblue: [100, 149, 237],\n\tcornsilk: [255, 248, 220],\n\tcrimson: [220, 20, 60],\n\tcyan: [0, 255, 255],\n\tdarkblue: [0, 0, 139],\n\tdarkcyan: [0, 139, 139],\n\tdarkgoldenrod: [184, 134, 11],\n\tdarkgray: [169, 169, 169],\n\tdarkgreen: [0, 100, 0],\n\tdarkgrey: [169, 169, 169],\n\tdarkkhaki: [189, 183, 107],\n\tdarkmagenta: [139, 0, 139],\n\tdarkolivegreen: [85, 107, 47],\n\tdarkorange: [255, 140, 0],\n\tdarkorchid: [153, 50, 204],\n\tdarkred: [139, 0, 0],\n\tdarksalmon: [233, 150, 122],\n\tdarkseagreen: [143, 188, 143],\n\tdarkslateblue: [72, 61, 139],\n\tdarkslategray: [47, 79, 79],\n\tdarkslategrey: [47, 79, 79],\n\tdarkturquoise: [0, 206, 209],\n\tdarkviolet: [148, 0, 211],\n\tdeeppink: [255, 20, 147],\n\tdeepskyblue: [0, 191, 255],\n\tdimgray: [105, 105, 105],\n\tdimgrey: [105, 105, 105],\n\tdodgerblue: [30, 144, 255],\n\tfirebrick: [178, 34, 34],\n\tfloralwhite: [255, 250, 240],\n\tforestgreen: [34, 139, 34],\n\tfuchsia: [255, 0, 255],\n\tgainsboro: [220, 220, 220],\n\tghostwhite: [248, 248, 255],\n\tgold: [255, 215, 0],\n\tgoldenrod: [218, 165, 32],\n\tgray: [128, 128, 128],\n\tgreen: [0, 128, 0],\n\tgreenyellow: [173, 255, 47],\n\tgrey: [128, 128, 128],\n\thoneydew: [240, 255, 240],\n\thotpink: [255, 105, 180],\n\tindianred: [205, 92, 92],\n\tindigo: [75, 0, 130],\n\tivory: [255, 255, 240],\n\tkhaki: [240, 230, 140],\n\tlavender: [230, 230, 250],\n\tlavenderblush: [255, 240, 245],\n\tlawngreen: [124, 252, 0],\n\tlemonchiffon: [255, 250, 205],\n\tlightblue: [173, 216, 230],\n\tlightcoral: [240, 128, 128],\n\tlightcyan: [224, 255, 255],\n\tlightgoldenrodyellow: [250, 250, 210],\n\tlightgray: [211, 211, 211],\n\tlightgreen: [144, 238, 144],\n\tlightgrey: [211, 211, 211],\n\tlightpink: [255, 182, 193],\n\tlightsalmon: [255, 160, 122],\n\tlightseagreen: [32, 178, 170],\n\tlightskyblue: [135, 206, 250],\n\tlightslategray: [119, 136, 153],\n\tlightslategrey: [119, 136, 153],\n\tlightsteelblue: [176, 196, 222],\n\tlightyellow: [255, 255, 224],\n\tlime: [0, 255, 0],\n\tlimegreen: [50, 205, 50],\n\tlinen: [250, 240, 230],\n\tmagenta: [255, 0, 255],\n\tmaroon: [128, 0, 0],\n\tmediumaquamarine: [102, 205, 170],\n\tmediumblue: [0, 0, 205],\n\tmediumorchid: [186, 85, 211],\n\tmediumpurple: [147, 112, 219],\n\tmediumseagreen: [60, 179, 113],\n\tmediumslateblue: [123, 104, 238],\n\tmediumspringgreen: [0, 250, 154],\n\tmediumturquoise: [72, 209, 204],\n\tmediumvioletred: [199, 21, 133],\n\tmidnightblue: [25, 25, 112],\n\tmintcream: [245, 255, 250],\n\tmistyrose: [255, 228, 225],\n\tmoccasin: [255, 228, 181],\n\tnavajowhite: [255, 222, 173],\n\tnavy: [0, 0, 128],\n\toldlace: [253, 245, 230],\n\tolive: [128, 128, 0],\n\tolivedrab: [107, 142, 35],\n\torange: [255, 165, 0],\n\torangered: [255, 69, 0],\n\torchid: [218, 112, 214],\n\tpalegoldenrod: [238, 232, 170],\n\tpalegreen: [152, 251, 152],\n\tpaleturquoise: [175, 238, 238],\n\tpalevioletred: [219, 112, 147],\n\tpapayawhip: [255, 239, 213],\n\tpeachpuff: [255, 218, 185],\n\tperu: [205, 133, 63],\n\tpink: [255, 192, 203],\n\tplum: [221, 160, 221],\n\tpowderblue: [176, 224, 230],\n\tpurple: [128, 0, 128],\n\trebeccapurple: [102, 51, 153],\n\tred: [255, 0, 0],\n\trosybrown: [188, 143, 143],\n\troyalblue: [65, 105, 225],\n\tsaddlebrown: [139, 69, 19],\n\tsalmon: [250, 128, 114],\n\tsandybrown: [244, 164, 96],\n\tseagreen: [46, 139, 87],\n\tseashell: [255, 245, 238],\n\tsienna: [160, 82, 45],\n\tsilver: [192, 192, 192],\n\tskyblue: [135, 206, 235],\n\tslateblue: [106, 90, 205],\n\tslategray: [112, 128, 144],\n\tslategrey: [112, 128, 144],\n\tsnow: [255, 250, 250],\n\tspringgreen: [0, 255, 127],\n\tsteelblue: [70, 130, 180],\n\ttan: [210, 180, 140],\n\tteal: [0, 128, 128],\n\tthistle: [216, 191, 216],\n\ttomato: [255, 99, 71],\n\tturquoise: [64, 224, 208],\n\tviolet: [238, 130, 238],\n\twheat: [245, 222, 179],\n\twhite: [255, 255, 255],\n\twhitesmoke: [245, 245, 245],\n\tyellow: [255, 255, 0],\n\tyellowgreen: [154, 205, 50],\n}\n\nfor (const key in colors) Object.freeze(colors[key]);\nexport default Object.freeze(colors);","/**\n * @module color-parse\n */\nimport names from 'color-name'\n\nexport default parse\n\n/**\n * Base hues\n * http://dev.w3.org/csswg/css-color/#typedef-named-hue\n */\n//FIXME: use external hue detector\nvar baseHues = {\n\tred: 0,\n\torange: 60,\n\tyellow: 120,\n\tgreen: 180,\n\tblue: 240,\n\tpurple: 300\n}\n\n/**\n * Parse color from the string passed\n *\n * @return {Object} A space indicator `space`, an array `values` and `alpha`\n */\nfunction parse(cstr) {\n\tvar m, parts = [], alpha = 1, space\n\n\t//numeric case\n\tif (typeof cstr === 'number') {\n\t\treturn { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }\n\t}\n\tif (typeof cstr === 'number') return { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }\n\n\tcstr = String(cstr).toLowerCase();\n\n\t//keyword\n\tif (names[cstr]) {\n\t\tparts = names[cstr].slice()\n\t\tspace = 'rgb'\n\t}\n\n\t//reserved words\n\telse if (cstr === 'transparent') {\n\t\talpha = 0\n\t\tspace = 'rgb'\n\t\tparts = [0, 0, 0]\n\t}\n\n\t//hex\n\telse if (cstr[0] === '#') {\n\t\tvar base = cstr.slice(1)\n\t\tvar size = base.length\n\t\tvar isShort = size <= 4\n\t\talpha = 1\n\n\t\tif (isShort) {\n\t\t\tparts = [\n\t\t\t\tparseInt(base[0] + base[0], 16),\n\t\t\t\tparseInt(base[1] + base[1], 16),\n\t\t\t\tparseInt(base[2] + base[2], 16)\n\t\t\t]\n\t\t\tif (size === 4) {\n\t\t\t\talpha = parseInt(base[3] + base[3], 16) / 255\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tparts = [\n\t\t\t\tparseInt(base[0] + base[1], 16),\n\t\t\t\tparseInt(base[2] + base[3], 16),\n\t\t\t\tparseInt(base[4] + base[5], 16)\n\t\t\t]\n\t\t\tif (size === 8) {\n\t\t\t\talpha = parseInt(base[6] + base[7], 16) / 255\n\t\t\t}\n\t\t}\n\n\t\tif (!parts[0]) parts[0] = 0\n\t\tif (!parts[1]) parts[1] = 0\n\t\tif (!parts[2]) parts[2] = 0\n\n\t\tspace = 'rgb'\n\t}\n\n\t// color space\n\telse if (m = /^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n\t\tvar name = m[1]\n\t\tspace = name.replace(/a$/, '')\n\t\tvar dims = space === 'cmyk' ? 4 : space === 'gray' ? 1 : 3\n\t\tparts = m[2].trim().split(/\\s*[,\\/]\\s*|\\s+/)\n\n\t\t// color(srgb-linear x x x) -> srgb-linear(x x x)\n\t\tif (space === 'color') space = parts.shift()\n\n\t\tparts = parts.map(function (x, i) {\n\t\t\t//<percentage>\n\t\t\tif (x[x.length - 1] === '%') {\n\t\t\t\tx = parseFloat(x) / 100\n\t\t\t\t// alpha -> 0..1\n\t\t\t\tif (i === 3) return x\n\t\t\t\t// rgb -> 0..255\n\t\t\t\tif (space === 'rgb') return x * 255\n\t\t\t\t// hsl, hwb H -> 0..100\n\t\t\t\tif (space[0] === 'h') return x * 100\n\t\t\t\t// lch, lab L -> 0..100\n\t\t\t\tif (space[0] === 'l' && !i) return x * 100\n\t\t\t\t// lab A B -> -125..125\n\t\t\t\tif (space === 'lab') return x * 125\n\t\t\t\t// lch C -> 0..150, H -> 0..360\n\t\t\t\tif (space === 'lch') return i < 2 ? x * 150 : x * 360\n\t\t\t\t// oklch/oklab L -> 0..1\n\t\t\t\tif (space[0] === 'o' && !i) return x\n\t\t\t\t// oklab A B -> -0.4..0.4\n\t\t\t\tif (space === 'oklab') return x * 0.4\n\t\t\t\t// oklch C -> 0..0.4, H -> 0..360\n\t\t\t\tif (space === 'oklch') return i < 2 ? x * 0.4 : x * 360\n\t\t\t\t// color(xxx) -> 0..1\n\t\t\t\treturn x\n\t\t\t}\n\n\t\t\t//hue\n\t\t\tif (space[i] === 'h' || (i === 2 && space[space.length - 1] === 'h')) {\n\t\t\t\t//<base-hue>\n\t\t\t\tif (baseHues[x] !== undefined) return baseHues[x]\n\t\t\t\t//<deg>\n\t\t\t\tif (x.endsWith('deg')) return parseFloat(x)\n\t\t\t\t//<turn>\n\t\t\t\tif (x.endsWith('turn')) return parseFloat(x) * 360\n\t\t\t\tif (x.endsWith('grad')) return parseFloat(x) * 360 / 400\n\t\t\t\tif (x.endsWith('rad')) return parseFloat(x) * 180 / Math.PI\n\t\t\t}\n\t\t\tif (x === 'none') return 0\n\t\t\treturn parseFloat(x)\n\t\t});\n\n\t\talpha = parts.length > dims ? parts.pop() : 1\n\t}\n\n\t//named channels case\n\telse if (/[0-9](?:\\s|\\/|,)/.test(cstr)) {\n\t\tparts = cstr.match(/([0-9]+)/g).map(function (value) {\n\t\t\treturn parseFloat(value)\n\t\t})\n\n\t\tspace = cstr.match(/([a-z])/ig)?.join('')?.toLowerCase() || 'rgb'\n\t}\n\n\treturn {\n\t\tspace,\n\t\tvalues: parts,\n\t\talpha\n\t}\n}\n","/* MIT license */\n/* eslint-disable no-mixed-operators */\nimport cssKeywords from 'color-name';\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n//       values that give correct `typeof` results).\n//       do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\toklab: {channels: 3, labels: ['okl', 'oka', 'okb']},\n\tlch: {channels: 3, labels: 'lch'},\n\toklch: {channels: 3, labels: ['okl', 'okc', 'okh']},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']},\n};\n\nexport default convert;\n\n// LAB f(t) constant\nconst LAB_FT = (6 / 29) ** 3;\n\n// SRGB non-linear transform functions\nfunction srgbNonlinearTransform(c) {\n\tconst cc = c > 0.003_130_8\n\t\t? ((1.055 * (c ** (1 / 2.4))) - 0.055)\n\t\t: c * 12.92;\n\treturn Math.min(Math.max(0, cc), 1);\n}\n\nfunction srgbNonlinearTransformInv(c) {\n\treturn c > 0.040_45 ? (((c + 0.055) / 1.055) ** 2.4) : (c / 12.92);\n}\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tswitch (max) {\n\t\tcase min: {\n\t\t\th = 0;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase r: {\n\t\t\th = (g - b) / delta;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase g: {\n\t\t\th = 2 + (b - r) / delta;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase b: {\n\t\t\th = 4 + (r - g) / delta;\n\n\t\t\tbreak;\n\t\t}\n\t// No default\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tswitch (v) {\n\t\t\tcase r: {\n\t\t\t\th = bdif - gdif;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase g: {\n\t\t\t\th = (1 / 3) + rdif - bdif;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase b: {\n\t\t\t\th = (2 / 3) + gdif - rdif;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t// No default\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100,\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.oklab = function (rgb) {\n\t// Assume sRGB\n\tconst r = srgbNonlinearTransformInv(rgb[0] / 255);\n\tconst g = srgbNonlinearTransformInv(rgb[1] / 255);\n\tconst b = srgbNonlinearTransformInv(rgb[2] / 255);\n\n\tconst lp = Math.cbrt(0.412_221_470_8 * r + 0.536_332_536_3 * g + 0.051_445_992_9 * b);\n\tconst mp = Math.cbrt(0.211_903_498_2 * r + 0.680_699_545_1 * g + 0.107_396_956_6 * b);\n\tconst sp = Math.cbrt(0.088_302_461_9 * r + 0.281_718_837_6 * g + 0.629_978_700_5 * b);\n\n\tconst l = 0.210_454_255_3 * lp + 0.793_617_785 * mp - 0.004_072_046_8 * sp;\n\tconst aa = 1.977_998_495_1 * lp - 2.428_592_205 * mp + 0.450_593_709_9 * sp;\n\tconst bb = 0.025_904_037_1 * lp + 0.782_771_766_2 * mp - 0.808_675_766 * sp;\n\n\treturn [l * 100, aa * 100, bb * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Number.POSITIVE_INFINITY;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\t// Assume sRGB\n\tconst r = srgbNonlinearTransformInv(rgb[0] / 255);\n\tconst g = srgbNonlinearTransformInv(rgb[1] / 255);\n\tconst b = srgbNonlinearTransformInv(rgb[2] / 255);\n\n\tconst x = (r * 0.412_456_4) + (g * 0.357_576_1) + (b * 0.180_437_5);\n\tconst y = (r * 0.212_672_9) + (g * 0.715_152_2) + (b * 0.072_175);\n\tconst z = (r * 0.019_333_9) + (g * 0.119_192) + (b * 0.950_304_1);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > LAB_FT ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > LAB_FT ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > LAB_FT ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t3;\n\tlet value;\n\n\tif (s === 0) {\n\t\tvalue = l * 255;\n\t\treturn [value, value, value];\n\t}\n\n\tconst t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tvalue = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tvalue = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tvalue = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tvalue = t1;\n\t\t}\n\n\t\trgb[i] = value * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0: {\n\t\t\treturn [v, t, p];\n\t\t}\n\n\t\tcase 1: {\n\t\t\treturn [q, v, p];\n\t\t}\n\n\t\tcase 2: {\n\t\t\treturn [p, v, t];\n\t\t}\n\n\t\tcase 3: {\n\t\t\treturn [p, q, v];\n\t\t}\n\n\t\tcase 4: {\n\t\t\treturn [t, p, v];\n\t\t}\n\n\t\tcase 5: {\n\t\t\treturn [v, p, q];\n\t\t}\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\t// eslint-disable-next-line no-bitwise\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces, default-case-last */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: { r = v;  g = n;  b = wh; break;\n\t\t}\n\n\t\tcase 1: { r = n;  g = v;  b = wh; break;\n\t\t}\n\n\t\tcase 2: { r = wh; g = v;  b = n; break;\n\t\t}\n\n\t\tcase 3: { r = wh; g = n;  b = v; break;\n\t\t}\n\n\t\tcase 4: { r = n;  g = wh; b = v; break;\n\t\t}\n\n\t\tcase 5: { r = v;  g = wh; b = n; break;\n\t\t}\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces, default-case-last */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.240_454_2) + (y * -1.537_138_5) + (z * -0.498_531_4);\n\tg = (x * -0.969_266) + (y * 1.876_010_8) + (z * 0.041_556);\n\tb = (x * 0.055_643_4) + (y * -0.204_025_9) + (z * 1.057_225_2);\n\n\t// Assume sRGB\n\tr = srgbNonlinearTransform(r);\n\tg = srgbNonlinearTransform(g);\n\tb = srgbNonlinearTransform(b);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > LAB_FT ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > LAB_FT ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > LAB_FT ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.xyz.oklab = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\n\tconst lp = Math.cbrt(0.818_933_010_1 * x + 0.361_866_742_4 * y - 0.128_859_713_7 * z);\n\tconst mp = Math.cbrt(0.032_984_543_6 * x + 0.929_311_871_5 * y + 0.036_145_638_7 * z);\n\tconst sp = Math.cbrt(0.048_200_301_8 * x + 0.264_366_269_1 * y + 0.633_851_707 * z);\n\n\tconst l = 0.210_454_255_3 * lp + 0.793_617_785 * mp - 0.004_072_046_8 * sp;\n\tconst a = 1.977_998_495_1 * lp - 2.428_592_205 * mp + 0.450_593_709_9 * sp;\n\tconst b = 0.025_904_037_1 * lp + 0.782_771_766_2 * mp - 0.808_675_766 * sp;\n\n\treturn [l * 100, a * 100, b * 100];\n};\n\nconvert.oklab.oklch = function (oklab) {\n\treturn convert.lab.lch(oklab);\n};\n\nconvert.oklab.xyz = function (oklab) {\n\tconst ll = oklab[0] / 100;\n\tconst a = oklab[1] / 100;\n\tconst b = oklab[2] / 100;\n\n\tconst l = (0.999_999_998 * ll + 0.396_337_792 * a + 0.215_803_758 * b) ** 3;\n\tconst m = (1.000_000_008 * ll - 0.105_561_342 * a - 0.063_854_175 * b) ** 3;\n\tconst s = (1.000_000_055 * ll - 0.089_484_182 * a - 1.291_485_538 * b) ** 3;\n\n\tconst x = 1.227_013_851 * l - 0.557_799_98 * m + 0.281_256_149 * s;\n\tconst y = -0.040_580_178 * l + 1.112_256_87 * m - 0.071_676_679 * s;\n\tconst z = -0.076_381_285 * l - 0.421_481_978 * m + 1.586_163_22 * s;\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.oklab.rgb = function (oklab) {\n\tconst ll = oklab[0] / 100;\n\tconst aa = oklab[1] / 100;\n\tconst bb = oklab[2] / 100;\n\n\tconst l = (ll + 0.396_337_777_4 * aa + 0.215_803_757_3 * bb) ** 3;\n\tconst m = (ll - 0.105_561_345_8 * aa - 0.063_854_172_8 * bb) ** 3;\n\tconst s = (ll - 0.089_484_177_5 * aa - 1.291_485_548 * bb) ** 3;\n\n\t// Assume sRGB\n\tconst r = srgbNonlinearTransform(4.076_741_662_1 * l - 3.307_711_591_3 * m + 0.230_969_929_2 * s);\n\tconst g = srgbNonlinearTransform(-1.268_438_004_6 * l + 2.609_757_401_1 * m - 0.341_319_396_5 * s);\n\tconst b = srgbNonlinearTransform(-0.004_196_086_3 * l - 0.703_418_614_7 * m + 1.707_614_701 * s);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.oklch.oklab = function (oklch) {\n\treturn convert.lch.lab(oklch);\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > LAB_FT ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > LAB_FT ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > LAB_FT ? z2 : (z - 16 / 116) / 7.787;\n\n\t// Illuminant D65 XYZ Tristrimulus Values\n\t// https://en.wikipedia.org/wiki/CIE_1931_color_space\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t/* eslint-disable no-bitwise */\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\t\t/* eslint-enable no-bitwise */\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\t// eslint-disable-next-line no-bitwise\n\tif (r >> 4 === g >> 4 && g >> 4 === b >> 4) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\targs = args[0];\n\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (Math.trunc(args > 50) + 1) * 0.5;\n\t/* eslint-disable no-bitwise */\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\t/* eslint-enable no-bitwise */\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\targs = args[0];\n\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\t/* eslint-disable no-bitwise */\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\t/* eslint-enable no-bitwise */\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.slice(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f\\d]{6}|[a-f\\d]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = [...colorString].map(char => char + char).join('');\n\t}\n\n\tconst integer = Number.parseInt(colorString, 16);\n\t/* eslint-disable no-bitwise */\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\t/* eslint-enable no-bitwise */\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet hue;\n\n\tconst grayscale = chroma < 1 ? min / (1 - chroma) : 0;\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else if (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else if (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2 * s * l) : (2 * s * (1 - l));\n\n\tlet f = 0;\n\tif (c < 1) {\n\t\tf = (l - 0.5 * c) / (1 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0: {\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\t}\n\n\t\tcase 1: {\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\t}\n\n\t\tcase 2: {\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\t}\n\n\t\tcase 3: {\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\t}\n\n\t\tcase 4: {\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\t}\n\n\t\tdefault: {\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t\t}\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255,\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1 - c);\n\tlet f = 0;\n\n\tif (v > 0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else if (l >= 0.5 && l < 1) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65_535) * 255, (apple[1] / 65_535) * 255, (apple[2] / 65_535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65_535, (rgb[1] / 255) * 65_535, (rgb[2] / 255) * 65_535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\t/* eslint-disable no-bitwise */\n\tconst value = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (value << 16) + (value << 8) + value;\n\t/* eslint-enable no-bitwise */\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.slice(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst value = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [value / 255 * 100];\n};\n","import conversions from './conversions.js';\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let {length} = models, i = 0; i < length; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null,\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length > 0) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let {length} = adjacents, i = 0; i < length; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nfunction route(fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let {length} = models, i = 0; i < length; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n}\n\nexport default route;\n","import conversions from './conversions.js';\nimport route from './route.js';\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let {length} = result, i = 0; i < length; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfor (const fromModel of models) {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\tfor (const toModel of routeModels) {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t}\n}\n\nexport default convert;\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorpicker/utils\n */\nimport { default as parse } from 'color-parse';\nimport convert from 'color-convert';\n/**\n * Parses and converts the color string to requested format. Handles variety of color spaces\n * like `hsl`, `hex` or `rgb`.\n *\n * @param color\n * @returns A color string.\n * @internal\n */\nexport function convertColor(color, outputFormat) {\n    if (!color) {\n        return '';\n    }\n    const colorObject = parseColorString(color);\n    if (!colorObject) {\n        return '';\n    }\n    if (colorObject.space === outputFormat) {\n        return color;\n    }\n    if (!canConvertParsedColor(colorObject)) {\n        return '';\n    }\n    const fromColorSpace = convert[colorObject.space];\n    const toColorSpace = fromColorSpace[outputFormat];\n    if (!toColorSpace) {\n        return '';\n    }\n    const convertedColorChannels = toColorSpace(colorObject.space === 'hex' ? colorObject.hexValue : colorObject.values);\n    return formatColorOutput(convertedColorChannels, outputFormat);\n}\n/**\n * Converts a color string to hex format.\n *\n * @param color\n * @returns A color string.\n * @internal\n */\nexport function convertToHex(color) {\n    if (!color) {\n        return '';\n    }\n    const colorObject = parseColorString(color);\n    if (!colorObject) {\n        return '#000';\n    }\n    if (colorObject.space === 'hex') {\n        return colorObject.hexValue;\n    }\n    return convertColor(color, 'hex');\n}\n/**\n * Registers the custom element in the\n * [CustomElementsRegistry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry).\n * @internal\n */\nexport function registerCustomElement(elementName, constructor) {\n    if (customElements.get(elementName) === undefined) {\n        customElements.define(elementName, constructor);\n    }\n}\n/**\n * Formats the passed color channels according to the requested format.\n *\n * @param values\n * @param format\n * @returns A color string.\n */\nfunction formatColorOutput(values, format) {\n    switch (format) {\n        case 'hex': return `#${values}`;\n        case 'rgb': return `rgb(${values[0]}, ${values[1]}, ${values[2]})`;\n        case 'hsl': return `hsl(${values[0]}, ${values[1]}%, ${values[2]}%)`;\n        case 'hwb': return `hwb(${values[0]}, ${values[1]}, ${values[2]})`;\n        case 'lab': return `lab(${values[0]}% ${values[1]} ${values[2]})`;\n        case 'lch': return `lch(${values[0]}% ${values[1]} ${values[2]})`;\n        default: return '';\n    }\n}\nfunction parseColorString(colorString) {\n    // Parser library treats `hex` format as belonging to `rgb` space | which messes up further conversion.\n    // Let's parse such strings on our own.\n    if (colorString.startsWith('#')) {\n        const parsedHex = parse(colorString);\n        return {\n            space: 'hex',\n            values: parsedHex.values,\n            hexValue: colorString,\n            alpha: parsedHex.alpha\n        };\n    }\n    const parsed = parse(colorString);\n    if (!parsed.space) {\n        return null;\n    }\n    return parsed;\n}\nfunction canConvertParsedColor(parsedColor) {\n    return Object.keys(convert).includes(parsedColor.space);\n}\n","// Clamps a value between an upper and lower bound.\n// We use ternary operators because it makes the minified code\n// 2 times shorter then `Math.min(Math.max(a,b),c)`\nexport const clamp = (number, min = 0, max = 1) => {\n    return number > max ? max : number < min ? min : number;\n};\nexport const round = (number, digits = 0, base = Math.pow(10, digits)) => {\n    return Math.round(base * number) / base;\n};\n//# sourceMappingURL=math.js.map","import { round } from './math.js';\n/**\n * Valid CSS <angle> units.\n * https://developer.mozilla.org/en-US/docs/Web/CSS/angle\n */\nconst angleUnits = {\n    grad: 360 / 400,\n    turn: 360,\n    rad: 360 / (Math.PI * 2)\n};\nexport const hexToHsva = (hex) => rgbaToHsva(hexToRgba(hex));\nexport const hexToRgba = (hex) => {\n    if (hex[0] === '#')\n        hex = hex.substring(1);\n    if (hex.length < 6) {\n        return {\n            r: parseInt(hex[0] + hex[0], 16),\n            g: parseInt(hex[1] + hex[1], 16),\n            b: parseInt(hex[2] + hex[2], 16),\n            a: hex.length === 4 ? round(parseInt(hex[3] + hex[3], 16) / 255, 2) : 1\n        };\n    }\n    return {\n        r: parseInt(hex.substring(0, 2), 16),\n        g: parseInt(hex.substring(2, 4), 16),\n        b: parseInt(hex.substring(4, 6), 16),\n        a: hex.length === 8 ? round(parseInt(hex.substring(6, 8), 16) / 255, 2) : 1\n    };\n};\nexport const parseHue = (value, unit = 'deg') => {\n    return Number(value) * (angleUnits[unit] || 1);\n};\nexport const hslaStringToHsva = (hslString) => {\n    const matcher = /hsla?\\(?\\s*(-?\\d*\\.?\\d+)(deg|rad|grad|turn)?[,\\s]+(-?\\d*\\.?\\d+)%?[,\\s]+(-?\\d*\\.?\\d+)%?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n    const match = matcher.exec(hslString);\n    if (!match)\n        return { h: 0, s: 0, v: 0, a: 1 };\n    return hslaToHsva({\n        h: parseHue(match[1], match[2]),\n        s: Number(match[3]),\n        l: Number(match[4]),\n        a: match[5] === undefined ? 1 : Number(match[5]) / (match[6] ? 100 : 1)\n    });\n};\nexport const hslStringToHsva = hslaStringToHsva;\nexport const hslaToHsva = ({ h, s, l, a }) => {\n    s *= (l < 50 ? l : 100 - l) / 100;\n    return {\n        h: h,\n        s: s > 0 ? ((2 * s) / (l + s)) * 100 : 0,\n        v: l + s,\n        a\n    };\n};\nexport const hsvaToHex = (hsva) => rgbaToHex(hsvaToRgba(hsva));\nexport const hsvaToHsla = ({ h, s, v, a }) => {\n    const hh = ((200 - s) * v) / 100;\n    return {\n        h: round(h),\n        s: round(hh > 0 && hh < 200 ? ((s * v) / 100 / (hh <= 100 ? hh : 200 - hh)) * 100 : 0),\n        l: round(hh / 2),\n        a: round(a, 2)\n    };\n};\nexport const hsvaToHsvString = (hsva) => {\n    const { h, s, v } = roundHsva(hsva);\n    return `hsv(${h}, ${s}%, ${v}%)`;\n};\nexport const hsvaToHsvaString = (hsva) => {\n    const { h, s, v, a } = roundHsva(hsva);\n    return `hsva(${h}, ${s}%, ${v}%, ${a})`;\n};\nexport const hsvaToHslString = (hsva) => {\n    const { h, s, l } = hsvaToHsla(hsva);\n    return `hsl(${h}, ${s}%, ${l}%)`;\n};\nexport const hsvaToHslaString = (hsva) => {\n    const { h, s, l, a } = hsvaToHsla(hsva);\n    return `hsla(${h}, ${s}%, ${l}%, ${a})`;\n};\nexport const hsvaToRgba = ({ h, s, v, a }) => {\n    h = (h / 360) * 6;\n    s = s / 100;\n    v = v / 100;\n    const hh = Math.floor(h), b = v * (1 - s), c = v * (1 - (h - hh) * s), d = v * (1 - (1 - h + hh) * s), module = hh % 6;\n    return {\n        r: round([v, c, b, b, d, v][module] * 255),\n        g: round([d, v, v, c, b, b][module] * 255),\n        b: round([b, b, d, v, v, c][module] * 255),\n        a: round(a, 2)\n    };\n};\nexport const hsvaToRgbString = (hsva) => {\n    const { r, g, b } = hsvaToRgba(hsva);\n    return `rgb(${r}, ${g}, ${b})`;\n};\nexport const hsvaToRgbaString = (hsva) => {\n    const { r, g, b, a } = hsvaToRgba(hsva);\n    return `rgba(${r}, ${g}, ${b}, ${a})`;\n};\nexport const hsvaStringToHsva = (hsvString) => {\n    const matcher = /hsva?\\(?\\s*(-?\\d*\\.?\\d+)(deg|rad|grad|turn)?[,\\s]+(-?\\d*\\.?\\d+)%?[,\\s]+(-?\\d*\\.?\\d+)%?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n    const match = matcher.exec(hsvString);\n    if (!match)\n        return { h: 0, s: 0, v: 0, a: 1 };\n    return roundHsva({\n        h: parseHue(match[1], match[2]),\n        s: Number(match[3]),\n        v: Number(match[4]),\n        a: match[5] === undefined ? 1 : Number(match[5]) / (match[6] ? 100 : 1)\n    });\n};\nexport const hsvStringToHsva = hsvaStringToHsva;\nexport const rgbaStringToHsva = (rgbaString) => {\n    const matcher = /rgba?\\(?\\s*(-?\\d*\\.?\\d+)(%)?[,\\s]+(-?\\d*\\.?\\d+)(%)?[,\\s]+(-?\\d*\\.?\\d+)(%)?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n    const match = matcher.exec(rgbaString);\n    if (!match)\n        return { h: 0, s: 0, v: 0, a: 1 };\n    return rgbaToHsva({\n        r: Number(match[1]) / (match[2] ? 100 / 255 : 1),\n        g: Number(match[3]) / (match[4] ? 100 / 255 : 1),\n        b: Number(match[5]) / (match[6] ? 100 / 255 : 1),\n        a: match[7] === undefined ? 1 : Number(match[7]) / (match[8] ? 100 : 1)\n    });\n};\nexport const rgbStringToHsva = rgbaStringToHsva;\nconst format = (number) => {\n    const hex = number.toString(16);\n    return hex.length < 2 ? '0' + hex : hex;\n};\nexport const rgbaToHex = ({ r, g, b, a }) => {\n    const alphaHex = a < 1 ? format(round(a * 255)) : '';\n    return '#' + format(r) + format(g) + format(b) + alphaHex;\n};\nexport const rgbaToHsva = ({ r, g, b, a }) => {\n    const max = Math.max(r, g, b);\n    const delta = max - Math.min(r, g, b);\n    // prettier-ignore\n    const hh = delta\n        ? max === r\n            ? (g - b) / delta\n            : max === g\n                ? 2 + (b - r) / delta\n                : 4 + (r - g) / delta\n        : 0;\n    return {\n        h: round(60 * (hh < 0 ? hh + 6 : hh)),\n        s: round(max ? (delta / max) * 100 : 0),\n        v: round((max / 255) * 100),\n        a\n    };\n};\nexport const roundHsva = (hsva) => ({\n    h: round(hsva.h),\n    s: round(hsva.s),\n    v: round(hsva.v),\n    a: round(hsva.a, 2)\n});\nexport const rgbaToRgb = ({ r, g, b }) => ({ r, g, b });\nexport const hslaToHsl = ({ h, s, l }) => ({ h, s, l });\nexport const hsvaToHsv = (hsva) => {\n    const { h, s, v } = roundHsva(hsva);\n    return { h, s, v };\n};\n//# sourceMappingURL=convert.js.map","import { hexToRgba } from './convert.js';\nexport const equalColorObjects = (first, second) => {\n    if (first === second)\n        return true;\n    for (const prop in first) {\n        // The following allows for a type-safe calling of this function (first & second have to be HSL, HSV, or RGB)\n        // with type-unsafe iterating over object keys. TS does not allow this without an index (`[key: string]: number`)\n        // on an object to define how iteration is normally done. To ensure extra keys are not allowed on our types,\n        // we must cast our object to unknown (as RGB demands `r` be a key, while `Record<string, x>` does not care if\n        // there is or not), and then as a type TS can iterate over.\n        if (first[prop] !==\n            second[prop])\n            return false;\n    }\n    return true;\n};\nexport const equalColorString = (first, second) => {\n    return first.replace(/\\s/g, '') === second.replace(/\\s/g, '');\n};\nexport const equalHex = (first, second) => {\n    if (first.toLowerCase() === second.toLowerCase())\n        return true;\n    // To compare colors like `#FFF` and `ffffff` we convert them into RGB objects\n    return equalColorObjects(hexToRgba(first), hexToRgba(second));\n};\n//# sourceMappingURL=compare.js.map","const cache = {};\nexport const tpl = (html) => {\n    let template = cache[html];\n    if (!template) {\n        template = document.createElement('template');\n        template.innerHTML = html;\n        cache[html] = template;\n    }\n    return template;\n};\nexport const fire = (target, type, detail) => {\n    target.dispatchEvent(new CustomEvent(type, {\n        bubbles: true,\n        detail\n    }));\n};\n//# sourceMappingURL=dom.js.map","import { fire, tpl } from '../utils/dom.js';\nimport { clamp } from '../utils/math.js';\nlet hasTouched = false;\n// Check if an event was triggered by touch\nconst isTouch = (e) => 'touches' in e;\n// Prevent mobile browsers from handling mouse events (conflicting with touch ones).\n// If we detected a touch interaction before, we prefer reacting to touch events only.\nconst isValid = (event) => {\n    if (hasTouched && !isTouch(event))\n        return false;\n    if (!hasTouched)\n        hasTouched = isTouch(event);\n    return true;\n};\nconst pointerMove = (target, event) => {\n    const pointer = isTouch(event) ? event.touches[0] : event;\n    const rect = target.el.getBoundingClientRect();\n    fire(target.el, 'move', target.getMove({\n        x: clamp((pointer.pageX - (rect.left + window.pageXOffset)) / rect.width),\n        y: clamp((pointer.pageY - (rect.top + window.pageYOffset)) / rect.height)\n    }));\n};\nconst keyMove = (target, event) => {\n    // We use `keyCode` instead of `key` to reduce the size of the library.\n    const keyCode = event.keyCode;\n    // Ignore all keys except arrow ones, Page Up, Page Down, Home and End.\n    if (keyCode > 40 || (target.xy && keyCode < 37) || keyCode < 33)\n        return;\n    // Do not scroll page by keys when color picker element has focus.\n    event.preventDefault();\n    // Send relative offset to the parent component.\n    fire(target.el, 'move', target.getMove({\n        x: keyCode === 39 // Arrow Right\n            ? 0.01\n            : keyCode === 37 // Arrow Left\n                ? -0.01\n                : keyCode === 34 // Page Down\n                    ? 0.05\n                    : keyCode === 33 // Page Up\n                        ? -0.05\n                        : keyCode === 35 // End\n                            ? 1\n                            : keyCode === 36 // Home\n                                ? -1\n                                : 0,\n        y: keyCode === 40 // Arrow down\n            ? 0.01\n            : keyCode === 38 // Arrow Up\n                ? -0.01\n                : 0\n    }, true));\n};\nexport class Slider {\n    constructor(root, part, aria, xy) {\n        const template = tpl(`<div role=\"slider\" tabindex=\"0\" part=\"${part}\" ${aria}><div part=\"${part}-pointer\"></div></div>`);\n        root.appendChild(template.content.cloneNode(true));\n        const el = root.querySelector(`[part=${part}]`);\n        el.addEventListener('mousedown', this);\n        el.addEventListener('touchstart', this);\n        el.addEventListener('keydown', this);\n        this.el = el;\n        this.xy = xy;\n        this.nodes = [el.firstChild, el];\n    }\n    set dragging(state) {\n        const toggleEvent = state ? document.addEventListener : document.removeEventListener;\n        toggleEvent(hasTouched ? 'touchmove' : 'mousemove', this);\n        toggleEvent(hasTouched ? 'touchend' : 'mouseup', this);\n    }\n    handleEvent(event) {\n        switch (event.type) {\n            case 'mousedown':\n            case 'touchstart':\n                event.preventDefault();\n                // event.button is 0 in mousedown for left button activation\n                if (!isValid(event) || (!hasTouched && event.button != 0))\n                    return;\n                this.el.focus();\n                pointerMove(this, event);\n                this.dragging = true;\n                break;\n            case 'mousemove':\n            case 'touchmove':\n                event.preventDefault();\n                pointerMove(this, event);\n                break;\n            case 'mouseup':\n            case 'touchend':\n                this.dragging = false;\n                break;\n            case 'keydown':\n                keyMove(this, event);\n                break;\n        }\n    }\n    style(styles) {\n        styles.forEach((style, i) => {\n            for (const p in style) {\n                this.nodes[i].style.setProperty(p, style[p]);\n            }\n        });\n    }\n}\n//# sourceMappingURL=slider.js.map","import { Slider } from './slider.js';\nimport { hsvaToHslString } from '../utils/convert.js';\nimport { clamp, round } from '../utils/math.js';\nexport class Hue extends Slider {\n    constructor(root) {\n        super(root, 'hue', 'aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"', false);\n    }\n    update({ h }) {\n        this.h = h;\n        this.style([\n            {\n                left: `${(h / 360) * 100}%`,\n                color: hsvaToHslString({ h, s: 100, v: 100, a: 1 })\n            }\n        ]);\n        this.el.setAttribute('aria-valuenow', `${round(h)}`);\n    }\n    getMove(offset, key) {\n        // Hue measured in degrees of the color circle ranging from 0 to 360\n        return { h: key ? clamp(this.h + offset.x * 360, 0, 360) : 360 * offset.x };\n    }\n}\n//# sourceMappingURL=hue.js.map","import { Slider } from './slider.js';\nimport { hsvaToHslString } from '../utils/convert.js';\nimport { clamp, round } from '../utils/math.js';\nexport class Saturation extends Slider {\n    constructor(root) {\n        super(root, 'saturation', 'aria-label=\"Color\"', true);\n    }\n    update(hsva) {\n        this.hsva = hsva;\n        this.style([\n            {\n                top: `${100 - hsva.v}%`,\n                left: `${hsva.s}%`,\n                color: hsvaToHslString(hsva)\n            },\n            {\n                'background-color': hsvaToHslString({ h: hsva.h, s: 100, v: 100, a: 1 })\n            }\n        ]);\n        this.el.setAttribute('aria-valuetext', `Saturation ${round(hsva.s)}%, Brightness ${round(hsva.v)}%`);\n    }\n    getMove(offset, key) {\n        // Saturation and brightness always fit into [0, 100] range\n        return {\n            s: key ? clamp(this.hsva.s + offset.x * 100, 0, 100) : offset.x * 100,\n            v: key ? clamp(this.hsva.v - offset.y * 100, 0, 100) : Math.round(100 - offset.y * 100)\n        };\n    }\n}\n//# sourceMappingURL=saturation.js.map","export default `:host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:\"\";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}`;\n//# sourceMappingURL=color-picker.js.map","import { equalColorObjects } from '../utils/compare.js';\nimport { fire, tpl } from '../utils/dom.js';\nimport { Hue } from './hue.js';\nimport { Saturation } from './saturation.js';\nimport css from '../styles/color-picker.js';\nimport hueCss from '../styles/hue.js';\nimport saturationCss from '../styles/saturation.js';\nconst $isSame = Symbol('same');\nconst $color = Symbol('color');\nconst $hsva = Symbol('hsva');\nconst $update = Symbol('update');\nconst $parts = Symbol('parts');\nexport const $css = Symbol('css');\nexport const $sliders = Symbol('sliders');\nexport class ColorPicker extends HTMLElement {\n    static get observedAttributes() {\n        return ['color'];\n    }\n    get [$css]() {\n        return [css, hueCss, saturationCss];\n    }\n    get [$sliders]() {\n        return [Saturation, Hue];\n    }\n    get color() {\n        return this[$color];\n    }\n    set color(newColor) {\n        if (!this[$isSame](newColor)) {\n            const newHsva = this.colorModel.toHsva(newColor);\n            this[$update](newHsva);\n            this[$color] = newColor;\n        }\n    }\n    constructor() {\n        super();\n        const template = tpl(`<style>${this[$css].join('')}</style>`);\n        const root = this.attachShadow({ mode: 'open' });\n        root.appendChild(template.content.cloneNode(true));\n        root.addEventListener('move', this);\n        this[$parts] = this[$sliders].map((slider) => new slider(root));\n    }\n    connectedCallback() {\n        // A user may set a property on an _instance_ of an element,\n        // before its prototype has been connected to this class.\n        // If so, we need to run it through the proper class setter.\n        if (this.hasOwnProperty('color')) {\n            const value = this.color;\n            delete this['color'];\n            this.color = value;\n        }\n        else if (!this.color) {\n            this.color = this.colorModel.defaultColor;\n        }\n    }\n    attributeChangedCallback(_attr, _oldVal, newVal) {\n        const color = this.colorModel.fromAttr(newVal);\n        if (!this[$isSame](color)) {\n            this.color = color;\n        }\n    }\n    handleEvent(event) {\n        // Merge the current HSV color object with updated params.\n        const oldHsva = this[$hsva];\n        const newHsva = { ...oldHsva, ...event.detail };\n        this[$update](newHsva);\n        let newColor;\n        if (!equalColorObjects(newHsva, oldHsva) &&\n            !this[$isSame]((newColor = this.colorModel.fromHsva(newHsva)))) {\n            this[$color] = newColor;\n            fire(this, 'color-changed', { value: newColor });\n        }\n    }\n    [$isSame](color) {\n        return this.color && this.colorModel.equal(color, this.color);\n    }\n    [$update](hsva) {\n        this[$hsva] = hsva;\n        this[$parts].forEach((part) => part.update(hsva));\n    }\n}\n//# sourceMappingURL=color-picker.js.map","export default `[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}`;\n//# sourceMappingURL=hue.js.map","export default `[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}`;\n//# sourceMappingURL=saturation.js.map","import { ColorPicker } from '../components/color-picker.js';\nimport { hexToHsva, hsvaToHex } from '../utils/convert.js';\nimport { equalHex } from '../utils/compare.js';\nconst colorModel = {\n    defaultColor: '#000',\n    toHsva: hexToHsva,\n    fromHsva: ({ h, s, v }) => hsvaToHex({ h, s, v, a: 1 }),\n    equal: equalHex,\n    fromAttr: (color) => color\n};\nexport class HexBase extends ColorPicker {\n    get colorModel() {\n        return colorModel;\n    }\n}\n//# sourceMappingURL=hex.js.map","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorpicker/colorpickerview\n */\nimport { convertColor, convertToHex, registerCustomElement } from './utils.js';\nimport { global, env } from '@ckeditor/ckeditor5-utils';\nimport { debounce } from 'es-toolkit/compat';\nimport { View } from '../view.js';\nimport { LabeledFieldView } from '../labeledfield/labeledfieldview.js';\nimport { createLabeledInputText } from '../labeledfield/utils.js';\n// Custom export due to https://github.com/ckeditor/ckeditor5/issues/15698.\nimport { HexBase } from 'vanilla-colorful/lib/entrypoints/hex';\nimport '../../theme/components/colorpicker/colorpicker.css';\nconst waitingTime = 150;\n/**\n * A class which represents a color picker with an input field for defining custom colors.\n */\nexport class ColorPickerView extends View {\n    /**\n     * Container for a `#` sign prefix and an input for displaying and defining custom colors\n     * in HEX format.\n     */\n    hexInputRow;\n    /**\n     * Debounced function updating the `color` property in the component\n     * and firing the `ColorPickerColorSelectedEvent`. Executed whenever color in component\n     * is changed by the user interaction (through the palette or input).\n     *\n     * @private\n     */\n    _debounceColorPickerEvent;\n    /**\n     * A reference to the configuration of the color picker specified in the constructor.\n     *\n     * @private\n     */\n    _config;\n    /**\n     * Creates a view of color picker.\n     *\n     * @param locale\n     * @param config\n     */\n    constructor(locale, config = {}) {\n        super(locale);\n        this.set({\n            color: '',\n            _hexColor: ''\n        });\n        this.hexInputRow = this._createInputRow();\n        const children = this.createCollection();\n        if (!config.hideInput) {\n            children.add(this.hexInputRow);\n        }\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-color-picker'],\n                tabindex: -1\n            },\n            children\n        });\n        this._config = config;\n        this._debounceColorPickerEvent = debounce((color) => {\n            // At first, set the color internally in the component. It's converted to the configured output format.\n            this.set('color', color);\n            // Then let the outside world know that the user changed the color.\n            this.fire('colorSelected', { color: this.color });\n        }, waitingTime, {\n            leading: true\n        });\n        // The `color` property holds the color in the configured output format.\n        // Ensure it before actually setting the value.\n        this.on('set:color', (evt, propertyName, newValue) => {\n            evt.return = convertColor(newValue, this._config.format || 'hsl');\n        });\n        // The `_hexColor` property is bound to the `color` one, but requires conversion.\n        this.on('change:color', () => {\n            this._hexColor = convertColorToCommonHexFormat(this.color);\n        });\n        this.on('change:_hexColor', () => {\n            // Update the selected color in the color picker palette when it's not focused.\n            // It means the user typed the color in the input.\n            if (document.activeElement !== this.picker) {\n                this.picker.setAttribute('color', this._hexColor);\n            }\n            // There has to be two way binding between properties.\n            // Extra precaution has to be taken to trigger change back only when the color really changes.\n            if (convertColorToCommonHexFormat(this.color) != convertColorToCommonHexFormat(this._hexColor)) {\n                this.color = this._hexColor;\n            }\n        });\n    }\n    /**\n     * Renders color picker in the view.\n     */\n    render() {\n        super.render();\n        // Extracted to the helper to make it testable.\n        registerCustomElement('hex-color-picker', HexBase);\n        this.picker = global.document.createElement('hex-color-picker');\n        this.picker.setAttribute('class', 'hex-color-picker');\n        this.picker.setAttribute('tabindex', '-1');\n        this._createSlidersView();\n        if (this.element) {\n            if (this.hexInputRow.element) {\n                this.element.insertBefore(this.picker, this.hexInputRow.element);\n            }\n            else {\n                this.element.appendChild(this.picker);\n            }\n            // Create custom stylesheet with a look of focused pointer in color picker and append it into the color picker shadowDom\n            const styleSheetForFocusedColorPicker = document.createElement('style');\n            styleSheetForFocusedColorPicker.textContent = '[role=\"slider\"]:focus [part$=\"pointer\"] {' +\n                'border: 1px solid #fff;' +\n                'outline: 1px solid var(--ck-color-focus-border);' +\n                'box-shadow: 0 0 0 2px #fff;' +\n                '}';\n            this.picker.shadowRoot.appendChild(styleSheetForFocusedColorPicker);\n        }\n        this.picker.addEventListener('color-changed', event => {\n            const color = event.detail.value;\n            this._debounceColorPickerEvent(color);\n        });\n    }\n    /**\n     * Focuses the first pointer in color picker.\n     *\n     */\n    focus() {\n        // In some browsers we need to move the focus to the input first.\n        // Otherwise, the color picker doesn't behave as expected.\n        // In Chrome, after selecting the color via slider the first time,\n        // the editor collapses the selection and doesn't apply the color change.\n        // In FF, after selecting the color via slider, it instantly moves back to the previous color.\n        // In all iOS browsers and desktop Safari, once the saturation slider is moved for the first time,\n        // editor collapses the selection and doesn't apply the color change.\n        // See: https://github.com/ckeditor/ckeditor5-internal/issues/3245, https://github.com/ckeditor/ckeditor5/issues/14119,\n        // https://github.com/ckeditor/ckeditor5-internal/issues/3268.\n        /* istanbul ignore next -- @preserve */\n        if (!this._config.hideInput && (env.isGecko || env.isiOS || env.isSafari || env.isBlink)) {\n            const input = this.hexInputRow.children.get(1);\n            input.focus();\n        }\n        const firstSlider = this.slidersView.first;\n        firstSlider.focus();\n    }\n    /**\n     * Creates collection of sliders in color picker.\n     *\n     * @private\n     */\n    _createSlidersView() {\n        const colorPickersChildren = [...this.picker.shadowRoot.children];\n        const sliders = colorPickersChildren.filter(item => item.getAttribute('role') === 'slider');\n        const slidersView = sliders.map(slider => {\n            const view = new SliderView(slider);\n            return view;\n        });\n        this.slidersView = this.createCollection();\n        slidersView.forEach(item => {\n            this.slidersView.add(item);\n        });\n    }\n    /**\n     * Creates input row for defining custom colors in color picker.\n     *\n     * @private\n     */\n    _createInputRow() {\n        const colorInput = this._createColorInput();\n        return new ColorPickerInputRowView(this.locale, colorInput);\n    }\n    /**\n     * Creates the input where user can type or paste the color in hex format.\n     *\n     * @private\n     */\n    _createColorInput() {\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);\n        const { t } = this.locale;\n        labeledInput.set({\n            label: t('HEX'),\n            class: 'color-picker-hex-input'\n        });\n        labeledInput.fieldView.bind('value').to(this, '_hexColor', pickerColor => {\n            if (labeledInput.isFocused) {\n                // Text field shouldn't be updated with color change if the text field is focused.\n                // Imagine user typing hex code and getting the value of field changed.\n                return labeledInput.fieldView.value;\n            }\n            else {\n                return pickerColor.startsWith('#') ? pickerColor.substring(1) : pickerColor;\n            }\n        });\n        // Only accept valid hex colors as input.\n        labeledInput.fieldView.on('input', () => {\n            const inputValue = labeledInput.fieldView.element.value;\n            if (inputValue) {\n                const maybeHexColor = tryParseHexColor(inputValue);\n                if (maybeHexColor) {\n                    // If so, set the color.\n                    // Otherwise, do nothing.\n                    this._debounceColorPickerEvent(maybeHexColor);\n                }\n            }\n        });\n        return labeledInput;\n    }\n    /**\n     * Validates the view and returns `false` when some fields are invalid.\n     */\n    isValid() {\n        const { t } = this.locale;\n        // If the input is hidden, it's always valid, because there is no way to select\n        // invalid color value using diagram color picker.\n        if (this._config.hideInput) {\n            return true;\n        }\n        this.resetValidationStatus();\n        // One error per field is enough.\n        if (!this.hexInputRow.getParsedColor()) {\n            // Apply updated error.\n            this.hexInputRow.inputView.errorText = t('Please enter a valid color (e.g. \"ff0000\").');\n            return false;\n        }\n        return true;\n    }\n    /**\n     * Cleans up the supplementary error and information text of input inside the {@link #hexInputRow}\n     * bringing them back to the state when the form has been displayed for the first time.\n     *\n     * See {@link #isValid}.\n     */\n    resetValidationStatus() {\n        this.hexInputRow.inputView.errorText = null;\n    }\n}\n// Converts any color format to a unified hex format.\n//\n// @param inputColor\n// @returns An unified hex string.\nfunction convertColorToCommonHexFormat(inputColor) {\n    let ret = convertToHex(inputColor);\n    if (!ret) {\n        ret = '#000';\n    }\n    if (ret.length === 4) {\n        // Unfold shortcut format.\n        ret = '#' + [ret[1], ret[1], ret[2], ret[2], ret[3], ret[3]].join('');\n    }\n    return ret.toLowerCase();\n}\n// View abstraction over pointer in color picker.\nexport class SliderView extends View {\n    /**\n     * @param element HTML element of slider in color picker.\n     */\n    constructor(element) {\n        super();\n        this.element = element;\n    }\n    /**\n     * Focuses element.\n     */\n    focus() {\n        this.element.focus();\n    }\n}\n// View abstraction over the `#` character before color input.\nclass HashView extends View {\n    constructor(locale) {\n        super(locale);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-color-picker__hash-view'\n                ]\n            },\n            children: '#'\n        });\n    }\n}\n// The class representing a row containing hex color input field.\n// **Note**: For now this class is private. When more use cases appear (beyond `ckeditor5-table` and `ckeditor5-image`),\n// it will become a component in `ckeditor5-ui`.\n//\n// @private\nexport class ColorPickerInputRowView extends View {\n    /**\n     * A collection of row items (buttons, dropdowns, etc.).\n     */\n    children;\n    /**\n     * Hex input view element.\n     */\n    inputView;\n    /**\n     * Creates an instance of the form row class.\n     *\n     * @param locale The locale instance.\n     * @param inputView Hex color input element.\n     */\n    constructor(locale, inputView) {\n        super(locale);\n        this.inputView = inputView;\n        this.children = this.createCollection([\n            new HashView(),\n            this.inputView\n        ]);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-color-picker__row'\n                ]\n            },\n            children: this.children\n        });\n    }\n    /**\n     * Returns false if color input value is not in hex format.\n     */\n    getParsedColor() {\n        return tryParseHexColor(this.inputView.fieldView.element.value);\n    }\n}\n/**\n * Trim spaces from provided color and check if hex is valid.\n *\n * @param color Unsafe color string.\n * @returns Null if provided color is not hex value.\n * @export\n * @internal\n */\nexport function tryParseHexColor(color) {\n    if (!color) {\n        return null;\n    }\n    const hashLessColor = color.trim().replace(/^#/, '');\n    // Incorrect length.\n    if (![3, 4, 6, 8].includes(hashLessColor.length)) {\n        return null;\n    }\n    // Incorrect characters.\n    if (!/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(hashLessColor)) {\n        return null;\n    }\n    return `#${hashLessColor}`;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorselector/colorpickerfragmentview\n */\nimport { View } from '../view.js';\nimport { ButtonView } from '../button/buttonview.js';\nimport { ColorPickerView } from '../colorpicker/colorpickerview.js';\nimport { IconCancel, IconCheck } from '@ckeditor/ckeditor5-icons';\n/**\n * One of the fragments of {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.\n *\n * It allows users to select a color from a color picker.\n *\n * It consists of the following sub–components:\n *\n * * A color picker saturation and hue sliders,\n * * A text input accepting colors in HEX format,\n * * \"Save\" and \"Cancel\" action buttons.\n */\nexport class ColorPickerFragmentView extends View {\n    /**\n     * A collection of component's children.\n     */\n    items;\n    /**\n     * A view with saturation and hue sliders and color input.\n     */\n    colorPickerView;\n    /**\n     * The \"Save\" button view.\n     */\n    saveButtonView;\n    /**\n     * The \"Cancel\" button view.\n     */\n    cancelButtonView;\n    /**\n     * The action bar where are \"Save\" button and \"Cancel\" button.\n     */\n    actionBarView;\n    /**\n     * Tracks information about the DOM focus in the list.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of views that can be focused in the view.\n     *\n     * @readonly\n     */\n    _focusables;\n    /**\n     * A reference to the configuration of {@link #colorPickerView}. `false` when the view was\n     * configured without a color picker.\n     *\n     * @readonly\n     */\n    _colorPickerViewConfig;\n    /**\n     * Creates an instance of the view.\n     *\n     * @param locale The localization services instance.\n     * @param options Constructor options.\n     * @param options.focusTracker Tracks information about the DOM focus in the list.\n     * @param options.focusables A collection of views that can be focused in the view.\n     * @param options.keystrokes An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     * @param options.colorPickerViewConfig The configuration of color picker feature. If set to `false`, the color picker\n     * will not be rendered.\n     */\n    constructor(locale, { focusTracker, focusables, keystrokes, colorPickerViewConfig }) {\n        super(locale);\n        this.items = this.createCollection();\n        this.focusTracker = focusTracker;\n        this.keystrokes = keystrokes;\n        this.set('isVisible', false);\n        this.set('selectedColor', undefined);\n        this._focusables = focusables;\n        this._colorPickerViewConfig = colorPickerViewConfig;\n        const bind = this.bindTemplate;\n        const { saveButtonView, cancelButtonView } = this._createActionButtons();\n        this.saveButtonView = saveButtonView;\n        this.cancelButtonView = cancelButtonView;\n        this.actionBarView = this._createActionBarView({ saveButtonView, cancelButtonView });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck-color-picker-fragment',\n                    bind.if('isVisible', 'ck-hidden', value => !value)\n                ]\n            },\n            children: this.items\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        const colorPickerView = new ColorPickerView(this.locale, {\n            ...this._colorPickerViewConfig\n        });\n        this.colorPickerView = colorPickerView;\n        this.colorPickerView.render();\n        if (this.selectedColor) {\n            colorPickerView.color = this.selectedColor;\n        }\n        this.listenTo(this, 'change:selectedColor', (evt, name, value) => {\n            colorPickerView.color = value;\n        });\n        this.items.add(this.colorPickerView);\n        this.items.add(this.actionBarView);\n        this._addColorPickersElementsToFocusTracker();\n        this._stopPropagationOnArrowsKeys();\n        this._executeOnEnterPress();\n        this._executeUponColorChange();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n    }\n    /**\n     * Focuses the color picker.\n     */\n    focus() {\n        this.colorPickerView.focus();\n    }\n    /**\n     * Reset validation messages.\n     */\n    resetValidationStatus() {\n        this.colorPickerView.resetValidationStatus();\n    }\n    /**\n     * When color picker is focused and \"enter\" is pressed it executes command.\n     */\n    _executeOnEnterPress() {\n        this.keystrokes.set('enter', evt => {\n            if (this.isVisible && this.focusTracker.focusedElement !== this.cancelButtonView.element && this.colorPickerView.isValid()) {\n                this.fire('execute', {\n                    value: this.selectedColor\n                });\n                evt.stopPropagation();\n                evt.preventDefault();\n            }\n        });\n    }\n    /**\n     * Removes default behavior of arrow keys in dropdown.\n     */\n    _stopPropagationOnArrowsKeys() {\n        const stopPropagation = (data) => data.stopPropagation();\n        this.keystrokes.set('arrowright', stopPropagation);\n        this.keystrokes.set('arrowleft', stopPropagation);\n        this.keystrokes.set('arrowup', stopPropagation);\n        this.keystrokes.set('arrowdown', stopPropagation);\n    }\n    /**\n     * Adds color picker elements to focus tracker.\n     */\n    _addColorPickersElementsToFocusTracker() {\n        for (const slider of this.colorPickerView.slidersView) {\n            this.focusTracker.add(slider.element);\n            this._focusables.add(slider);\n        }\n        const input = this.colorPickerView.hexInputRow.children.get(1);\n        if (input.element) {\n            this.focusTracker.add(input.element);\n            this._focusables.add(input);\n        }\n        this.focusTracker.add(this.saveButtonView.element);\n        this._focusables.add(this.saveButtonView);\n        this.focusTracker.add(this.cancelButtonView.element);\n        this._focusables.add(this.cancelButtonView);\n    }\n    /**\n     * Creates bar containing \"Save\" and \"Cancel\" buttons.\n     */\n    _createActionBarView({ saveButtonView, cancelButtonView }) {\n        const actionBarRow = new View();\n        const children = this.createCollection();\n        children.add(saveButtonView);\n        children.add(cancelButtonView);\n        actionBarRow.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-color-selector_action-bar'\n                ]\n            },\n            children\n        });\n        return actionBarRow;\n    }\n    /**\n     * Creates \"Save\" and \"Cancel\" buttons.\n     */\n    _createActionButtons() {\n        const locale = this.locale;\n        const t = locale.t;\n        const saveButtonView = new ButtonView(locale);\n        const cancelButtonView = new ButtonView(locale);\n        saveButtonView.set({\n            icon: IconCheck,\n            class: 'ck-button-save',\n            type: 'button',\n            withText: false,\n            label: t('Accept')\n        });\n        cancelButtonView.set({\n            icon: IconCancel,\n            class: 'ck-button-cancel',\n            type: 'button',\n            withText: false,\n            label: t('Cancel')\n        });\n        saveButtonView.on('execute', () => {\n            if (this.colorPickerView.isValid()) {\n                this.fire('execute', {\n                    source: 'colorPickerSaveButton',\n                    value: this.selectedColor\n                });\n            }\n        });\n        cancelButtonView.on('execute', () => {\n            this.fire('colorPicker:cancel');\n        });\n        return {\n            saveButtonView, cancelButtonView\n        };\n    }\n    /**\n     * Fires the `execute` event if color in color picker has been changed\n     * by the user.\n     */\n    _executeUponColorChange() {\n        this.colorPickerView.on('colorSelected', (evt, data) => {\n            this.fire('execute', {\n                value: data.color,\n                source: 'colorPicker'\n            });\n            this.set('selectedColor', data.color);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/colorselector/colorselectorview\n */\nimport { FocusCycler } from '../focuscycler.js';\nimport { View } from '../view.js';\nimport { ViewCollection } from '../viewcollection.js';\nimport { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';\nimport { ColorGridsFragmentView } from './colorgridsfragmentview.js';\nimport { ColorPickerFragmentView } from './colorpickerfragmentview.js';\nimport '../../theme/components/colorselector/colorselector.css';\n/**\n * The configurable color selector view class. It allows users to select colors from a predefined set of colors as well as from\n * a color picker.\n *\n * This meta-view is is made of two components (fragments):\n *\n * * {@link module:ui/colorselector/colorselectorview~ColorSelectorView#colorGridsFragmentView},\n * * {@link module:ui/colorselector/colorselectorview~ColorSelectorView#colorPickerFragmentView}.\n *\n * ```ts\n * const colorDefinitions = [\n * \t{ color: '#000', label: 'Black', options: { hasBorder: false } },\n * \t{ color: 'rgb(255, 255, 255)', label: 'White', options: { hasBorder: true } },\n * \t{ color: 'red', label: 'Red', options: { hasBorder: false } }\n * ];\n *\n * const selectorView = new ColorSelectorView( locale, {\n * \tcolors: colorDefinitions,\n * \tcolumns: 5,\n * \tremoveButtonLabel: 'Remove color',\n * \tdocumentColorsLabel: 'Document colors',\n * \tdocumentColorsCount: 4,\n * \tcolorPickerViewConfig: {\n * \t\tformat: 'hsl'\n * \t}\n * } );\n *\n * selectorView.appendUI();\n * selectorView.selectedColor = 'red';\n * selectorView.updateSelectedColors();\n *\n * selectorView.on<ColorSelectorExecuteEvent>( 'execute', ( evt, data ) => {\n * \tconsole.log( 'Color changed', data.value, data.source );\n * } );\n *\n * selectorView.on<ColorSelectorColorPickerShowEvent>( 'colorPicker:show', ( evt ) => {\n * \tconsole.log( 'Color picker showed up', evt );\n * } );\n *\n * selectorView.on<ColorSelectorColorPickerCancelEvent>( 'colorPicker:cancel', ( evt ) => {\n * \tconsole.log( 'Color picker cancel', evt );\n * } );\n *\n * selectorView.render();\n *\n * document.body.appendChild( selectorView.element );\n * ```\n */\nexport class ColorSelectorView extends View {\n    /**\n     * Tracks information about the DOM focus in the list.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of components.\n     */\n    items;\n    /**\n     * A fragment that allows users to select colors from the a predefined set and from existing document colors.\n     */\n    colorGridsFragmentView;\n    /**\n     * A fragment that allows users to select a color from a color picker.\n     */\n    colorPickerFragmentView;\n    /**\n     * Helps cycling over focusable {@link #items} in the list.\n     *\n     * @readonly\n     */\n    _focusCycler;\n    /**\n     * A collection of views that can be focused in the view.\n     *\n     * @readonly\n     */\n    _focusables;\n    /**\n     * The configuration of color picker sub-component.\n     */\n    _colorPickerViewConfig;\n    /**\n     * Creates a view to be inserted as a child of {@link module:ui/dropdown/dropdownview~DropdownView}.\n     *\n     * @param locale The localization services instance.\n     * @param options Constructor options.\n     * @param options.colors An array with definitions of colors to be displayed in the table.\n     * @param options.columns The number of columns in the color grid.\n     * @param options.removeButtonLabel The label of the button responsible for removing the color.\n     * @param options.colorPickerLabel The label of the button responsible for color picker appearing.\n     * @param options.documentColorsLabel The label for the section with the document colors.\n     * @param options.documentColorsCount The number of colors in the document colors section inside the color dropdown.\n     * @param options.colorPickerViewConfig The configuration of color picker feature. If set to `false`, the color picker will be hidden.\n     */\n    constructor(locale, { colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount, colorPickerLabel, colorPickerViewConfig }) {\n        super(locale);\n        this.items = this.createCollection();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this._focusables = new ViewCollection();\n        this._colorPickerViewConfig = colorPickerViewConfig;\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate list items backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate list items forwards using the <kbd>Tab</kbd> key.\n                focusNext: 'tab'\n            }\n        });\n        this.colorGridsFragmentView = new ColorGridsFragmentView(locale, {\n            colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount, colorPickerLabel,\n            focusTracker: this.focusTracker,\n            focusables: this._focusables\n        });\n        this.colorPickerFragmentView = new ColorPickerFragmentView(locale, {\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokes: this.keystrokes,\n            colorPickerViewConfig\n        });\n        this.set('_isColorGridsFragmentVisible', true);\n        this.set('_isColorPickerFragmentVisible', false);\n        this.set('selectedColor', undefined);\n        this.colorGridsFragmentView.bind('isVisible').to(this, '_isColorGridsFragmentVisible');\n        this.colorPickerFragmentView.bind('isVisible').to(this, '_isColorPickerFragmentVisible');\n        /**\n         * This is kind of bindings. Unfortunately we could not use this.bind() method because the same property\n         * cannot be bound twice. So this is work around how to bind 'selectedColor' property between components.\n         */\n        this.on('change:selectedColor', (evt, evtName, data) => {\n            this.colorGridsFragmentView.set('selectedColor', data);\n            this.colorPickerFragmentView.set('selectedColor', data);\n        });\n        this.colorGridsFragmentView.on('change:selectedColor', (evt, evtName, data) => {\n            this.set('selectedColor', data);\n        });\n        this.colorPickerFragmentView.on('change:selectedColor', (evt, evtName, data) => {\n            this.set('selectedColor', data);\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-color-selector'\n                ]\n            },\n            children: this.items\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Renders the internals of the component on demand:\n     * * {@link #colorPickerFragmentView},\n     * * {@link #colorGridsFragmentView}.\n     *\n     * It allows for deferring component initialization to improve the performance.\n     *\n     * See {@link #showColorPickerFragment}, {@link #showColorGridsFragment}.\n     */\n    appendUI() {\n        this._appendColorGridsFragment();\n        if (this._colorPickerViewConfig) {\n            this._appendColorPickerFragment();\n        }\n    }\n    /**\n     * Shows the {@link #colorPickerFragmentView} and hides the {@link #colorGridsFragmentView}.\n     *\n     * **Note**: It requires {@link #appendUI} to be called first.\n     *\n     * See {@link #showColorGridsFragment}, {@link ~ColorSelectorView#event:colorPicker:show}.\n     */\n    showColorPickerFragment() {\n        if (!this.colorPickerFragmentView.colorPickerView || this._isColorPickerFragmentVisible) {\n            return;\n        }\n        this._isColorPickerFragmentVisible = true;\n        this.colorPickerFragmentView.focus();\n        this.colorPickerFragmentView.resetValidationStatus();\n        this._isColorGridsFragmentVisible = false;\n    }\n    /**\n     * Shows the {@link #colorGridsFragmentView} and hides the {@link #colorPickerFragmentView}.\n     *\n     * See {@link #showColorPickerFragment}.\n     *\n     * **Note**: It requires {@link #appendUI} to be called first.\n     */\n    showColorGridsFragment() {\n        if (this._isColorGridsFragmentVisible) {\n            return;\n        }\n        this._isColorGridsFragmentVisible = true;\n        this.colorGridsFragmentView.focus();\n        this._isColorPickerFragmentVisible = false;\n    }\n    /**\n     * Focuses the first focusable element in {@link #items}.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Focuses the last focusable element in {@link #items}.\n     */\n    focusLast() {\n        this._focusCycler.focusLast();\n    }\n    /**\n     * Scans through the editor model and searches for text node attributes with the given `attributeName`.\n     * Found entries are set as document colors in {@link #colorGridsFragmentView}.\n     *\n     * All the previously stored document colors will be lost in the process.\n     *\n     * @param model The model used as a source to obtain the document colors.\n     * @param attributeName Determines the name of the related model's attribute for a given dropdown.\n     */\n    updateDocumentColors(model, attributeName) {\n        this.colorGridsFragmentView.updateDocumentColors(model, attributeName);\n    }\n    /**\n     * Refreshes the state of the selected color in one or both grids located in {@link #colorGridsFragmentView}.\n     *\n     * It guarantees that the selection will occur only in one of them.\n     */\n    updateSelectedColors() {\n        this.colorGridsFragmentView.updateSelectedColors();\n    }\n    /**\n     * Appends the view containing static and document color grid views.\n     */\n    _appendColorGridsFragment() {\n        if (this.items.length) {\n            return;\n        }\n        this.items.add(this.colorGridsFragmentView);\n        this.colorGridsFragmentView.delegate('execute').to(this);\n        this.colorGridsFragmentView.delegate('colorPicker:show').to(this);\n    }\n    /**\n     * Appends the view with the color picker.\n     */\n    _appendColorPickerFragment() {\n        if (this.items.length === 2) {\n            return;\n        }\n        this.items.add(this.colorPickerFragmentView);\n        if (this.colorGridsFragmentView.colorPickerButtonView) {\n            this.colorGridsFragmentView.colorPickerButtonView.on('execute', () => {\n                this.showColorPickerFragment();\n            });\n        }\n        this.colorGridsFragmentView.addColorPickerButton();\n        this.colorPickerFragmentView.delegate('execute').to(this);\n        this.colorPickerFragmentView.delegate('colorPicker:cancel').to(this);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ColorSelectorView } from 'ckeditor5/src/ui.js';\n/**\n * The name of the font size plugin.\n */\nexport const FONT_SIZE = 'fontSize';\n/**\n * The name of the font family plugin.\n */\nexport const FONT_FAMILY = 'fontFamily';\n/**\n * The name of the font color plugin.\n */\nexport const FONT_COLOR = 'fontColor';\n/**\n * The name of the font background color plugin.\n */\nexport const FONT_BACKGROUND_COLOR = 'fontBackgroundColor';\n/**\n * Builds a proper converter definition out of input data.\n *\n * @internal\n */\nexport function buildDefinition(modelAttributeKey, options) {\n    const definition = {\n        model: {\n            key: modelAttributeKey,\n            values: []\n        },\n        view: {},\n        upcastAlso: {}\n    };\n    for (const option of options) {\n        definition.model.values.push(option.model);\n        definition.view[option.model] = option.view;\n        if (option.upcastAlso) {\n            definition.upcastAlso[option.model] = option.upcastAlso;\n        }\n    }\n    return definition;\n}\n/**\n * A {@link module:font/fontcolor~FontColor font color} and\n * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper\n * responsible for upcasting data to the model.\n *\n * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.\n *\n * @internal\n */\nexport function renderUpcastAttribute(styleAttr) {\n    return (viewElement) => normalizeColorCode(viewElement.getStyle(styleAttr));\n}\n/**\n * A {@link module:font/fontcolor~FontColor font color} and\n * {@link module:font/fontbackgroundcolor~FontBackgroundColor font background color} helper\n * responsible for downcasting a color attribute to a `<span>` element.\n *\n * **Note**: The `styleAttr` parameter should be either `'color'` or `'background-color'`.\n *\n * @internal\n */\nexport function renderDowncastElement(styleAttr) {\n    return (modelAttributeValue, { writer }) => writer.createAttributeElement('span', {\n        style: `${styleAttr}:${modelAttributeValue}`\n    }, { priority: 7 });\n}\n/**\n * A helper that adds {@link module:ui/colorselector/colorselectorview~ColorSelectorView} to the color dropdown with proper initial values.\n *\n * @param options Configuration options\n * @param options.dropdownView The dropdown view to which a {@link module:ui/colorselector/colorselectorview~ColorSelectorView}\n * will be added.\n * @param options.colors An array with definitions representing colors to be displayed in the color selector.\n * @param options.columns The number of columns in the color grid.\n * @param options.removeButtonLabel The label for the button responsible for removing the color.\n * @param options.colorPickerLabel The label for the color picker button.\n * @param options.documentColorsLabel The label for the section with document colors.\n * @param options.documentColorsCount The number of document colors inside the dropdown.\n * @param options.colorPickerViewConfig Configuration of the color picker view.\n * @returns The new color selector view.\n * @internal\n */\nexport function addColorSelectorToDropdown({ dropdownView, colors, columns, removeButtonLabel, colorPickerLabel, documentColorsLabel, documentColorsCount, colorPickerViewConfig }) {\n    const locale = dropdownView.locale;\n    const colorSelectorView = new ColorSelectorView(locale, {\n        colors,\n        columns,\n        removeButtonLabel,\n        colorPickerLabel,\n        documentColorsLabel,\n        documentColorsCount,\n        colorPickerViewConfig\n    });\n    dropdownView.colorSelectorView = colorSelectorView;\n    dropdownView.panelView.children.add(colorSelectorView);\n    return colorSelectorView;\n}\n/**\n * Fixes the color value string.\n */\nfunction normalizeColorCode(value) {\n    return value.replace(/\\s/g, '');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { FontCommand } from '../fontcommand.js';\nimport { FONT_FAMILY } from '../utils.js';\n/**\n * The font family command. It is used by {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing}\n * to apply the font family.\n *\n * ```ts\n * editor.execute( 'fontFamily', { value: 'Arial' } );\n * ```\n *\n * **Note**: Executing the command without the value removes the attribute from the model.\n */\nexport class FontFamilyCommand extends FontCommand {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor, FONT_FAMILY);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontfamily/utils\n */\n/**\n * Normalizes the {@link module:font/fontconfig~FontFamilyConfig#options configuration options}\n * to the {@link module:font/fontconfig~FontFamilyOption} format.\n *\n * @param configuredOptions An array of options taken from the configuration.\n * @internal\n */\nexport function normalizeOptions(configuredOptions) {\n    // Convert options to objects.\n    return configuredOptions\n        .map(getOptionDefinition)\n        // Filter out undefined values that `getOptionDefinition` might return.\n        .filter(option => option !== undefined);\n}\n/**\n * Normalizes the CSS `font-family` property value to an array of unquoted and trimmed font faces.\n *\n * @internal\n */\nexport function normalizeFontFamilies(fontDefinition) {\n    return fontDefinition\n        .replace(/[\"']/g, '').split(',')\n        .map(name => name.trim());\n}\n/**\n * Returns an option definition either created from string shortcut.\n * If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.\n *\n */\nfunction getOptionDefinition(option) {\n    // Treat any object as full item definition provided by user in configuration.\n    if (typeof option === 'object') {\n        return option;\n    }\n    // Handle 'default' string as a special case. It will be used to remove the fontFamily attribute.\n    if (option === 'default') {\n        return {\n            title: 'Default',\n            model: undefined\n        };\n    }\n    // Ignore values that we cannot parse to a definition.\n    if (typeof option !== 'string') {\n        return undefined;\n    }\n    // Return font family definition from font string.\n    return generateFontPreset(option);\n}\n/**\n * Creates a predefined preset for pixel size. It deconstructs font-family like string into full configuration option.\n * A font definition is passed as coma delimited set of font family names. Font names might be quoted.\n *\n * @param fontDefinition A font definition form configuration.\n */\nfunction generateFontPreset(fontDefinition) {\n    // Remove quotes from font names. They will be normalized later.\n    const fontNames = normalizeFontFamilies(fontDefinition);\n    // The first matched font name will be used as dropdown list item title and as model value.\n    const firstFontName = fontNames[0];\n    // CSS-compatible font names.\n    const cssFontNames = fontNames.map(normalizeFontNameForCSS).join(', ');\n    return {\n        title: firstFontName,\n        model: cssFontNames,\n        view: {\n            name: 'span',\n            styles: {\n                'font-family': cssFontNames\n            },\n            priority: 7\n        }\n    };\n}\n/**\n * Normalizes font name for the style attribute. It adds braces (') if font name contains spaces.\n */\nfunction normalizeFontNameForCSS(fontName) {\n    fontName = fontName.trim();\n    // Compound font names should be quoted.\n    if (fontName.indexOf(' ') > 0) {\n        fontName = `'${fontName}'`;\n    }\n    return fontName;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontfamily/fontfamilyediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontFamilyCommand } from './fontfamilycommand.js';\nimport { normalizeOptions } from './utils.js';\nimport { buildDefinition, FONT_FAMILY } from '../utils.js';\n/**\n * The font family editing feature.\n *\n * It introduces the {@link module:font/fontfamily/fontfamilycommand~FontFamilyCommand command} and\n * the `fontFamily` attribute in the {@link module:engine/model/model~Model model} which renders\n * in the {@link module:engine/view/view view} as an inline `<span>` element (`<span style=\"font-family: Arial\">`),\n * depending on the {@link module:font/fontconfig~FontFamilyConfig configuration}.\n */\nexport class FontFamilyEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontFamilyEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // Define default configuration using font families shortcuts.\n        editor.config.define(FONT_FAMILY, {\n            options: [\n                'default',\n                'Arial, Helvetica, sans-serif',\n                'Courier New, Courier, monospace',\n                'Georgia, serif',\n                'Lucida Sans Unicode, Lucida Grande, sans-serif',\n                'Tahoma, Geneva, sans-serif',\n                'Times New Roman, Times, serif',\n                'Trebuchet MS, Helvetica, sans-serif',\n                'Verdana, Geneva, sans-serif'\n            ],\n            supportAllValues: false\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Allow fontFamily attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: FONT_FAMILY });\n        editor.model.schema.setAttributeProperties(FONT_FAMILY, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        // Get configured font family options without \"default\" option.\n        const options = normalizeOptions(editor.config.get('fontFamily.options')).filter(item => item.model);\n        const definition = buildDefinition(FONT_FAMILY, options);\n        // Set-up the two-way conversion.\n        if (editor.config.get('fontFamily.supportAllValues')) {\n            this._prepareAnyValueConverters();\n            this._prepareCompatibilityConverter();\n        }\n        else {\n            editor.conversion.attributeToElement(definition);\n        }\n        editor.commands.add(FONT_FAMILY, new FontFamilyCommand(editor));\n    }\n    /**\n     * These converters enable keeping any value found as `style=\"font-family: *\"` as a value of an attribute on a text even\n     * if it is not defined in the plugin configuration.\n     */\n    _prepareAnyValueConverters() {\n        const editor = this.editor;\n        editor.conversion.for('downcast').attributeToElement({\n            model: FONT_FAMILY,\n            view: (attributeValue, { writer }) => {\n                return writer.createAttributeElement('span', { style: 'font-family:' + attributeValue }, { priority: 7 });\n            }\n        });\n        editor.conversion.for('upcast').elementToAttribute({\n            model: {\n                key: FONT_FAMILY,\n                value: (viewElement) => viewElement.getStyle('font-family')\n            },\n            view: {\n                name: 'span',\n                styles: {\n                    'font-family': /.*/\n                }\n            }\n        });\n    }\n    /**\n     * Adds support for legacy `<font face=\"..\">` formatting.\n     */\n    _prepareCompatibilityConverter() {\n        const editor = this.editor;\n        editor.conversion.for('upcast').elementToAttribute({\n            view: {\n                name: 'font',\n                attributes: {\n                    'face': /.*/\n                }\n            },\n            model: {\n                key: FONT_FAMILY,\n                value: (viewElement) => viewElement.getAttribute('face')\n            }\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973zm-2.754 2.5L8.038 4.785 5.261 11.5zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontfamily/fontfamilyui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { IconFontFamily } from 'ckeditor5/src/icons.js';\nimport { UIModel, createDropdown, addListToDropdown, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { normalizeFontFamilies, normalizeOptions } from './utils.js';\nimport { FONT_FAMILY } from '../utils.js';\n/**\n * The font family UI plugin. It introduces the `'fontFamily'` dropdown.\n */\nexport class FontFamilyUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontFamilyUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const options = this._getLocalizedOptions();\n        const command = editor.commands.get(FONT_FAMILY);\n        const accessibleLabel = t('Font Family');\n        const listOptions = _prepareListOptions(options, command);\n        // Register UI component.\n        editor.ui.componentFactory.add(FONT_FAMILY, locale => {\n            const dropdownView = createDropdown(locale);\n            addListToDropdown(dropdownView, listOptions, {\n                role: 'menu',\n                ariaLabel: accessibleLabel\n            });\n            dropdownView.buttonView.set({\n                label: accessibleLabel,\n                icon: IconFontFamily,\n                tooltip: true\n            });\n            dropdownView.extendTemplate({\n                attributes: {\n                    class: 'ck-font-family-dropdown'\n                }\n            });\n            dropdownView.bind('isEnabled').to(command);\n            // Execute command when an item from the dropdown is selected.\n            this.listenTo(dropdownView, 'execute', evt => {\n                editor.execute(evt.source.commandName, { value: evt.source.commandParam });\n                editor.editing.view.focus();\n            });\n            return dropdownView;\n        });\n        editor.ui.componentFactory.add(`menuBar:${FONT_FAMILY}`, locale => {\n            const menuView = new MenuBarMenuView(locale);\n            menuView.buttonView.set({\n                label: accessibleLabel,\n                icon: IconFontFamily\n            });\n            menuView.bind('isEnabled').to(command);\n            const listView = new MenuBarMenuListView(locale);\n            for (const definition of listOptions) {\n                const listItemView = new MenuBarMenuListItemView(locale, menuView);\n                const buttonView = new MenuBarMenuListItemButtonView(locale);\n                buttonView.set({\n                    role: 'menuitemradio',\n                    isToggleable: true\n                });\n                buttonView.bind(...Object.keys(definition.model)).to(definition.model);\n                buttonView.delegate('execute').to(menuView);\n                buttonView.on('execute', () => {\n                    editor.execute(definition.model.commandName, {\n                        value: definition.model.commandParam\n                    });\n                    editor.editing.view.focus();\n                });\n                listItemView.children.add(buttonView);\n                listView.items.add(listItemView);\n            }\n            menuView.panelView.children.add(listView);\n            return menuView;\n        });\n    }\n    /**\n     * Returns options as defined in `config.fontFamily.options` but processed to account for\n     * editor localization, i.e. to display {@link module:font/fontconfig~FontFamilyOption}\n     * in the correct language.\n     *\n     * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}\n     * when the user configuration is defined because the editor does not exist yet.\n     */\n    _getLocalizedOptions() {\n        const editor = this.editor;\n        const t = editor.t;\n        const options = normalizeOptions((editor.config.get(FONT_FAMILY)).options);\n        return options.map(option => {\n            // The only title to localize is \"Default\" others are font names.\n            if (option.title === 'Default') {\n                option.title = t('Default');\n            }\n            return option;\n        });\n    }\n}\n/**\n * Prepares FontFamily dropdown items.\n */\nfunction _prepareListOptions(options, command) {\n    const itemDefinitions = new Collection();\n    // Create dropdown items.\n    for (const option of options) {\n        const def = {\n            type: 'button',\n            model: new UIModel({\n                commandName: FONT_FAMILY,\n                commandParam: option.model,\n                label: option.title,\n                role: 'menuitemradio',\n                withText: true\n            })\n        };\n        def.model.bind('isOn').to(command, 'value', value => {\n            // \"Default\" or check in strict font-family converters mode.\n            if (value === option.model) {\n                return true;\n            }\n            if (!value || !option.model) {\n                return false;\n            }\n            const valueNormalized = normalizeFontFamilies(value)[0].toLowerCase();\n            const optionNormalized = normalizeFontFamilies(option.model)[0].toLowerCase();\n            return valueNormalized === optionNormalized;\n        });\n        // Try to set a dropdown list item style.\n        if (option.view && typeof option.view !== 'string' && option.view.styles) {\n            def.model.set('labelStyle', `font-family: ${option.view.styles['font-family']}`);\n        }\n        itemDefinitions.add(def);\n    }\n    return itemDefinitions;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontfamily\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontFamilyEditing } from './fontfamily/fontfamilyediting.js';\nimport { FontFamilyUI } from './fontfamily/fontfamilyui.js';\n/**\n * The font family plugin.\n *\n * For a detailed overview, check the {@glink features/font font feature} documentatiom\n * and the {@glink api/font package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:font/fontfamily/fontfamilyediting~FontFamilyEditing} and\n * {@link module:font/fontfamily/fontfamilyui~FontFamilyUI} features in the editor.\n */\nexport class FontFamily extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FontFamilyEditing, FontFamilyUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontFamily';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { FontCommand } from '../fontcommand.js';\nimport { FONT_SIZE } from '../utils.js';\n/**\n * The font size command. It is used by {@link module:font/fontsize/fontsizeediting~FontSizeEditing}\n * to apply the font size.\n *\n * ```ts\n * editor.execute( 'fontSize', { value: 'small' } );\n * ```\n *\n * **Note**: Executing the command without the value removes the attribute from the model.\n */\nexport class FontSizeCommand extends FontCommand {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor, FONT_SIZE);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontsize/utils\n */\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\n/**\n * Normalizes and translates the {@link module:font/fontconfig~FontSizeConfig#options configuration options}\n * to the {@link module:font/fontconfig~FontSizeOption} format.\n *\n * @param configuredOptions An array of options taken from the configuration.\n * @internal\n */\nexport function normalizeOptions(configuredOptions) {\n    // Convert options to objects.\n    return configuredOptions\n        .map(item => getOptionDefinition(item))\n        // Filter out undefined values that `getOptionDefinition` might return.\n        .filter((option) => option !== undefined);\n}\n// Default named presets map. Always create a new instance of the preset object in order to avoid modifying references.\nconst namedPresets = {\n    get tiny() {\n        return {\n            title: 'Tiny',\n            model: 'tiny',\n            view: {\n                name: 'span',\n                classes: 'text-tiny',\n                priority: 7\n            }\n        };\n    },\n    get small() {\n        return {\n            title: 'Small',\n            model: 'small',\n            view: {\n                name: 'span',\n                classes: 'text-small',\n                priority: 7\n            }\n        };\n    },\n    get big() {\n        return {\n            title: 'Big',\n            model: 'big',\n            view: {\n                name: 'span',\n                classes: 'text-big',\n                priority: 7\n            }\n        };\n    },\n    get huge() {\n        return {\n            title: 'Huge',\n            model: 'huge',\n            view: {\n                name: 'span',\n                classes: 'text-huge',\n                priority: 7\n            }\n        };\n    }\n};\n/**\n * Returns an option definition either from preset or creates one from number shortcut.\n * If object is passed then this method will return it without alternating it. Returns undefined for item than cannot be parsed.\n */\nfunction getOptionDefinition(option) {\n    if (typeof option === 'number') {\n        option = String(option);\n    }\n    // Check whether passed option is a full item definition provided by user in configuration.\n    if (typeof option === 'object' && isFullItemDefinition(option)) {\n        return attachPriority(option);\n    }\n    const preset = findPreset(option);\n    // Item is a named preset.\n    if (preset) {\n        return attachPriority(preset);\n    }\n    // 'Default' font size. It will be used to remove the fontSize attribute.\n    if (option === 'default') {\n        return {\n            model: undefined,\n            title: 'Default'\n        };\n    }\n    // At this stage we probably have numerical value to generate a preset so parse it's value.\n    // Discard any faulty values.\n    if (isNumericalDefinition(option)) {\n        return undefined;\n    }\n    // Return font size definition from size value.\n    return generatePixelPreset(option);\n}\n/**\n * Creates a predefined preset for pixel size.\n * @param definition Font size in pixels.\n * @returns\n */\nfunction generatePixelPreset(definition) {\n    // Extend a short (numeric value) definition.\n    if (typeof definition === 'string') {\n        definition = {\n            title: definition,\n            model: `${parseFloat(definition)}px`\n        };\n    }\n    definition.view = {\n        name: 'span',\n        styles: {\n            'font-size': definition.model\n        }\n    };\n    return attachPriority(definition);\n}\n/**\n * Adds the priority to the view element definition if missing. It's required due to ckeditor/ckeditor5#2291\n */\nfunction attachPriority(definition) {\n    if (definition.view && typeof definition.view !== 'string' && !definition.view.priority) {\n        definition.view.priority = 7;\n    }\n    return definition;\n}\n/**\n * Returns a prepared preset definition. If passed an object, a name of preset should be defined as `model` value.\n *\n * @param definition.model A preset name.\n */\nfunction findPreset(definition) {\n    return typeof definition === 'string' ? namedPresets[definition] : namedPresets[definition.model];\n}\n/**\n * We treat `definition` as completed if it is an object that contains `title`, `model` and `view` values.\n */\nfunction isFullItemDefinition(definition) {\n    return definition.title && definition.model && definition.view;\n}\nfunction isNumericalDefinition(definition) {\n    let numberValue;\n    if (typeof definition === 'object') {\n        if (!definition.model) {\n            /**\n             * Provided value as an option for {@link module:font/fontsize~FontSize} seems to invalid.\n             *\n             * See valid examples described in the {@link module:font/fontconfig~FontSizeConfig#options plugin configuration}.\n             *\n             * @error font-size-invalid-definition\n             */\n            throw new CKEditorError('font-size-invalid-definition', null, definition);\n        }\n        else {\n            numberValue = parseFloat(definition.model);\n        }\n    }\n    else {\n        numberValue = parseFloat(definition);\n    }\n    return isNaN(numberValue);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontsize/fontsizeediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\nimport { isLengthStyleValue, isPercentageStyleValue } from 'ckeditor5/src/engine.js';\nimport { FontSizeCommand } from './fontsizecommand.js';\nimport { normalizeOptions } from './utils.js';\nimport { buildDefinition, FONT_SIZE } from '../utils.js';\n// Mapping of `<font size=\"..\">` styling to CSS's `font-size` values.\nconst styleFontSize = [\n    'x-small', // Size \"0\" equal to \"1\".\n    'x-small',\n    'small',\n    'medium',\n    'large',\n    'x-large',\n    'xx-large',\n    'xxx-large'\n];\n/**\n * The font size editing feature.\n *\n * It introduces the {@link module:font/fontsize/fontsizecommand~FontSizeCommand command} and the `fontSize`\n * attribute in the {@link module:engine/model/model~Model model} which renders in the {@link module:engine/view/view view}\n * as a `<span>` element with either:\n * * a style attribute (`<span style=\"font-size:12px\">...</span>`),\n * * or a class attribute (`<span class=\"text-small\">...</span>`)\n *\n * depending on the {@link module:font/fontconfig~FontSizeConfig configuration}.\n */\nexport class FontSizeEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontSizeEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // Define default configuration using named presets.\n        editor.config.define(FONT_SIZE, {\n            options: [\n                'tiny',\n                'small',\n                'default',\n                'big',\n                'huge'\n            ],\n            supportAllValues: false\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Allow fontSize attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: FONT_SIZE });\n        editor.model.schema.setAttributeProperties(FONT_SIZE, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n        const supportAllValues = editor.config.get('fontSize.supportAllValues');\n        // Define view to model conversion.\n        const options = normalizeOptions(this.editor.config.get('fontSize.options'))\n            .filter(item => item.model);\n        const definition = buildDefinition(FONT_SIZE, options);\n        // Set-up the two-way conversion.\n        if (supportAllValues) {\n            this._prepareAnyValueConverters(definition);\n            this._prepareCompatibilityConverter();\n        }\n        else {\n            editor.conversion.attributeToElement(definition);\n        }\n        // Add FontSize command.\n        editor.commands.add(FONT_SIZE, new FontSizeCommand(editor));\n    }\n    /**\n     * These converters enable keeping any value found as `style=\"font-size: *\"` as a value of an attribute on a text even\n     * if it is not defined in the plugin configuration.\n     *\n     * @param definition Converter definition out of input data.\n     */\n    _prepareAnyValueConverters(definition) {\n        const editor = this.editor;\n        // If `fontSize.supportAllValues=true`, we do not allow to use named presets in the plugin's configuration.\n        const presets = definition.model.values.filter((value) => {\n            return !isLengthStyleValue(String(value)) && !isPercentageStyleValue(String(value));\n        });\n        if (presets.length) {\n            /**\n             * If {@link module:font/fontconfig~FontSizeConfig#supportAllValues `config.fontSize.supportAllValues`} is `true`,\n             * you need to use numerical values as font size options.\n             *\n             * See valid examples described in the {@link module:font/fontconfig~FontSizeConfig#options plugin configuration}.\n             *\n             * @error font-size-invalid-use-of-named-presets\n             * @param {Array.<string>} presets Invalid values.\n             */\n            throw new CKEditorError('font-size-invalid-use-of-named-presets', null, { presets });\n        }\n        editor.conversion.for('downcast').attributeToElement({\n            model: FONT_SIZE,\n            view: (attributeValue, { writer }) => {\n                if (!attributeValue) {\n                    return;\n                }\n                return writer.createAttributeElement('span', { style: 'font-size:' + attributeValue }, { priority: 7 });\n            }\n        });\n        editor.conversion.for('upcast').elementToAttribute({\n            model: {\n                key: FONT_SIZE,\n                value: (viewElement) => viewElement.getStyle('font-size')\n            },\n            view: {\n                name: 'span',\n                styles: {\n                    'font-size': /.*/\n                }\n            }\n        });\n    }\n    /**\n     * Adds support for legacy `<font size=\"..\">` formatting.\n     */\n    _prepareCompatibilityConverter() {\n        const editor = this.editor;\n        editor.conversion.for('upcast').elementToAttribute({\n            view: {\n                name: 'font',\n                attributes: {\n                    // Documentation mentions sizes from 1 to 7. To handle old content we support all values\n                    // up to 999 but clamp it to the valid range. Why 999? It should cover accidental values\n                    // similar to percentage, e.g. 100%, 200% which could be the usual mistake for font size.\n                    'size': /^[+-]?\\d{1,3}$/\n                }\n            },\n            model: {\n                key: FONT_SIZE,\n                value: (viewElement) => {\n                    const value = viewElement.getAttribute('size');\n                    const isRelative = value[0] === '-' || value[0] === '+';\n                    let size = parseInt(value, 10);\n                    if (isRelative) {\n                        // Add relative size (which can be negative) to the default size = 3.\n                        size = 3 + size;\n                    }\n                    const maxSize = styleFontSize.length - 1;\n                    const clampedSize = Math.min(Math.max(size, 0), maxSize);\n                    return styleFontSize[clampedSize];\n                }\n            }\n        });\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825q0-.063.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782q.003.065.003.135z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontsize/fontsizeui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconFontSize } from 'ckeditor5/src/icons.js';\nimport { UIModel, createDropdown, addListToDropdown, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { normalizeOptions } from './utils.js';\nimport { FONT_SIZE } from '../utils.js';\nimport '../../theme/fontsize.css';\n/**\n * The font size UI plugin. It introduces the `'fontSize'` dropdown.\n */\nexport class FontSizeUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontSizeUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const options = this._getLocalizedOptions();\n        const command = editor.commands.get(FONT_SIZE);\n        const accessibleLabel = t('Font Size');\n        const listOptions = _prepareListOptions(options, command);\n        // Register UI component.\n        editor.ui.componentFactory.add(FONT_SIZE, locale => {\n            const dropdownView = createDropdown(locale);\n            addListToDropdown(dropdownView, listOptions, {\n                role: 'menu',\n                ariaLabel: accessibleLabel\n            });\n            // Create dropdown model.\n            dropdownView.buttonView.set({\n                label: accessibleLabel,\n                icon: IconFontSize,\n                tooltip: true\n            });\n            dropdownView.extendTemplate({\n                attributes: {\n                    class: [\n                        'ck-font-size-dropdown'\n                    ]\n                }\n            });\n            dropdownView.bind('isEnabled').to(command);\n            // Execute command when an item from the dropdown is selected.\n            this.listenTo(dropdownView, 'execute', evt => {\n                editor.execute(evt.source.commandName, { value: evt.source.commandParam });\n                editor.editing.view.focus();\n            });\n            return dropdownView;\n        });\n        editor.ui.componentFactory.add(`menuBar:${FONT_SIZE}`, locale => {\n            const menuView = new MenuBarMenuView(locale);\n            menuView.buttonView.set({\n                label: accessibleLabel,\n                icon: IconFontSize\n            });\n            menuView.bind('isEnabled').to(command);\n            const listView = new MenuBarMenuListView(locale);\n            for (const definition of listOptions) {\n                const listItemView = new MenuBarMenuListItemView(locale, menuView);\n                const buttonView = new MenuBarMenuListItemButtonView(locale);\n                buttonView.set({\n                    role: 'menuitemradio',\n                    isToggleable: true\n                });\n                buttonView.bind(...Object.keys(definition.model)).to(definition.model);\n                buttonView.delegate('execute').to(menuView);\n                buttonView.on('execute', () => {\n                    editor.execute(definition.model.commandName, {\n                        value: definition.model.commandParam\n                    });\n                    editor.editing.view.focus();\n                });\n                listItemView.children.add(buttonView);\n                listView.items.add(listItemView);\n            }\n            menuView.panelView.children.add(listView);\n            return menuView;\n        });\n    }\n    /**\n     * Returns options as defined in `config.fontSize.options` but processed to account for\n     * editor localization, i.e. to display {@link module:font/fontconfig~FontSizeOption}\n     * in the correct language.\n     *\n     * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}\n     * when the user configuration is defined because the editor does not exist yet.\n     */\n    _getLocalizedOptions() {\n        const editor = this.editor;\n        const t = editor.t;\n        const localizedTitles = {\n            Default: t('Default'),\n            Tiny: t('Tiny'),\n            Small: t('Small'),\n            Big: t('Big'),\n            Huge: t('Huge')\n        };\n        const options = normalizeOptions((editor.config.get(FONT_SIZE)).options);\n        return options.map(option => {\n            const title = localizedTitles[option.title];\n            if (title && title != option.title) {\n                // Clone the option to avoid altering the original `namedPresets` from `./utils.js`.\n                option = Object.assign({}, option, { title });\n            }\n            return option;\n        });\n    }\n}\n/**\n * Prepares FontSize dropdown items.\n */\nfunction _prepareListOptions(options, command) {\n    const itemDefinitions = new Collection();\n    for (const option of options) {\n        const def = {\n            type: 'button',\n            model: new UIModel({\n                commandName: FONT_SIZE,\n                commandParam: option.model,\n                label: option.title,\n                class: 'ck-fontsize-option',\n                role: 'menuitemradio',\n                withText: true\n            })\n        };\n        if (option.view && typeof option.view !== 'string') {\n            if (option.view.styles) {\n                def.model.set('labelStyle', `font-size:${option.view.styles['font-size']}`);\n            }\n            if (option.view.classes) {\n                def.model.set('class', `${def.model.class} ${option.view.classes}`);\n            }\n        }\n        def.model.bind('isOn').to(command, 'value', value => value === option.model);\n        // Add the option to the collection.\n        itemDefinitions.add(def);\n    }\n    return itemDefinitions;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontsize\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontSizeEditing } from './fontsize/fontsizeediting.js';\nimport { FontSizeUI } from './fontsize/fontsizeui.js';\nimport { normalizeOptions } from './fontsize/utils.js';\n/**\n * The font size plugin.\n *\n * For a detailed overview, check the {@glink features/font font feature} documentation\n * and the {@glink api/font package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:font/fontsize/fontsizeediting~FontSizeEditing} and\n * {@link module:font/fontsize/fontsizeui~FontSizeUI} features in the editor.\n */\nexport class FontSize extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FontSizeEditing, FontSizeUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontSize';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Normalizes and translates the {@link module:font/fontconfig~FontSizeConfig#options configuration options}\n     * to the {@link module:font/fontconfig~FontSizeOption} format.\n     *\n     * @param options An array of options taken from the configuration.\n     */\n    normalizeSizeOptions(options) {\n        return normalizeOptions(options);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { FontCommand } from '../fontcommand.js';\nimport { FONT_COLOR } from '../utils.js';\n/**\n * The font color command. It is used by {@link module:font/fontcolor/fontcolorediting~FontColorEditing}\n * to apply the font color.\n *\n * ```ts\n * editor.execute( 'fontColor', { value: 'rgb(250, 20, 20)' } );\n * ```\n *\n * **Note**: Executing the command with the `null` value removes the attribute from the model.\n */\nexport class FontColorCommand extends FontCommand {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor, FONT_COLOR);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontcolor/fontcolorediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontColorCommand } from './fontcolorcommand.js';\nimport { FONT_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils.js';\n/**\n * The font color editing feature.\n *\n * It introduces the {@link module:font/fontcolor/fontcolorcommand~FontColorCommand command} and\n * the `fontColor` attribute in the {@link module:engine/model/model~Model model} which renders\n * in the {@link module:engine/view/view view} as a `<span>` element (`<span style=\"color: ...\">`),\n * depending on the {@link module:font/fontconfig~FontColorConfig configuration}.\n */\nexport class FontColorEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontColorEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define(FONT_COLOR, {\n            colors: [\n                {\n                    color: 'hsl(0, 0%, 0%)',\n                    label: 'Black'\n                },\n                {\n                    color: 'hsl(0, 0%, 30%)',\n                    label: 'Dim grey'\n                },\n                {\n                    color: 'hsl(0, 0%, 60%)',\n                    label: 'Grey'\n                },\n                {\n                    color: 'hsl(0, 0%, 90%)',\n                    label: 'Light grey'\n                },\n                {\n                    color: 'hsl(0, 0%, 100%)',\n                    label: 'White',\n                    hasBorder: true\n                },\n                {\n                    color: 'hsl(0, 75%, 60%)',\n                    label: 'Red'\n                },\n                {\n                    color: 'hsl(30, 75%, 60%)',\n                    label: 'Orange'\n                },\n                {\n                    color: 'hsl(60, 75%, 60%)',\n                    label: 'Yellow'\n                },\n                {\n                    color: 'hsl(90, 75%, 60%)',\n                    label: 'Light green'\n                },\n                {\n                    color: 'hsl(120, 75%, 60%)',\n                    label: 'Green'\n                },\n                {\n                    color: 'hsl(150, 75%, 60%)',\n                    label: 'Aquamarine'\n                },\n                {\n                    color: 'hsl(180, 75%, 60%)',\n                    label: 'Turquoise'\n                },\n                {\n                    color: 'hsl(210, 75%, 60%)',\n                    label: 'Light blue'\n                },\n                {\n                    color: 'hsl(240, 75%, 60%)',\n                    label: 'Blue'\n                },\n                {\n                    color: 'hsl(270, 75%, 60%)',\n                    label: 'Purple'\n                }\n            ],\n            columns: 5\n        });\n        editor.conversion.for('upcast').elementToAttribute({\n            view: {\n                name: 'span',\n                styles: {\n                    'color': /[\\s\\S]+/\n                }\n            },\n            model: {\n                key: FONT_COLOR,\n                value: renderUpcastAttribute('color')\n            }\n        });\n        // Support legacy `<font color=\"..\">` formatting.\n        editor.conversion.for('upcast').elementToAttribute({\n            view: {\n                name: 'font',\n                attributes: {\n                    'color': /^#?\\w+$/\n                }\n            },\n            model: {\n                key: FONT_COLOR,\n                value: (viewElement) => viewElement.getAttribute('color')\n            }\n        });\n        editor.conversion.for('downcast').attributeToElement({\n            model: FONT_COLOR,\n            view: renderDowncastElement('color')\n        });\n        editor.commands.add(FONT_COLOR, new FontColorCommand(editor));\n        // Allow the font color attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: FONT_COLOR });\n        editor.model.schema.setAttributeProperties(FONT_COLOR, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns color configuration options as defined in `editor.config.(fontColor|fontBackgroundColor).colors` or\n * `editor.config.table.(tableProperties|tableCellProperties).(background|border).colors\n * but processed to account for editor localization in the correct language.\n *\n * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}\n * when the user configuration is defined because the editor does not exist yet.\n *\n * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n */\nexport function getLocalizedColorOptions(locale, options) {\n    const t = locale.t;\n    const localizedColorNames = {\n        Black: t('Black'),\n        'Dim grey': t('Dim grey'),\n        Grey: t('Grey'),\n        'Light grey': t('Light grey'),\n        White: t('White'),\n        Red: t('Red'),\n        Orange: t('Orange'),\n        Yellow: t('Yellow'),\n        'Light green': t('Light green'),\n        Green: t('Green'),\n        Aquamarine: t('Aquamarine'),\n        Turquoise: t('Turquoise'),\n        'Light blue': t('Light blue'),\n        Blue: t('Blue'),\n        Purple: t('Purple')\n    };\n    return options.map(colorOption => {\n        const label = localizedColorNames[colorOption.label];\n        if (label && label != colorOption.label) {\n            colorOption.label = label;\n        }\n        return colorOption;\n    });\n}\n/**\n * Creates a unified color definition object from color configuration options.\n * The object contains the information necessary to both render the UI and initialize the conversion.\n */\nexport function normalizeColorOptions(options) {\n    return options\n        .map(normalizeSingleColorDefinition)\n        .filter(option => !!option);\n}\n/**\n * Creates a normalized color definition from the user-defined configuration.\n * The \"normalization\" means it will create full\n * {@link module:ui/colorgrid/colorgridview~ColorDefinition `ColorDefinition-like`}\n * object for string values, and add a `view` property, for each definition.\n */\nexport function normalizeSingleColorDefinition(color) {\n    if (typeof color === 'string') {\n        return {\n            model: color,\n            label: color,\n            hasBorder: false,\n            view: {\n                name: 'span',\n                styles: {\n                    color\n                }\n            }\n        };\n    }\n    else {\n        return {\n            model: color.color,\n            label: color.label || color.color,\n            hasBorder: color.hasBorder === undefined ? false : color.hasBorder,\n            view: {\n                name: 'span',\n                styles: {\n                    color: `${color.color}`\n                }\n            }\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/ui/colorui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { createDropdown, normalizeColorOptions, getLocalizedColorOptions, focusChildOnDropdownOpen, MenuBarMenuView, ColorSelectorView } from 'ckeditor5/src/ui.js';\nimport { addColorSelectorToDropdown } from '../utils.js';\n/**\n * The color UI plugin which isolates the common logic responsible for displaying dropdowns with color grids.\n *\n * It is used to create the `'fontBackgroundColor'` and `'fontColor'` dropdowns, each hosting\n * a {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.\n */\nexport class FontColorUIBase extends Plugin {\n    /**\n     * The name of the command which will be executed when a color tile is clicked.\n     */\n    commandName;\n    /**\n     * The name of this component in the {@link module:ui/componentfactory~ComponentFactory}.\n     * Also the configuration scope name in `editor.config`.\n     */\n    componentName;\n    /**\n     * The SVG icon used by the dropdown.\n     */\n    icon;\n    /**\n     * The label used by the dropdown.\n     */\n    dropdownLabel;\n    /**\n     * The number of columns in the color grid.\n     */\n    columns;\n    /**\n     * Creates a plugin which introduces a dropdown with a pre–configured\n     * {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.\n     *\n     * @param editor An editor instance.\n     * @param config The configuration object.\n     * @param config.commandName The name of the command which will be executed when a color tile is clicked.\n     * @param config.componentName The name of the dropdown in the {@link module:ui/componentfactory~ComponentFactory}\n     * and the configuration scope name in `editor.config`.\n     * @param config.icon The SVG icon used by the dropdown.\n     * @param config.dropdownLabel The label used by the dropdown.\n     */\n    constructor(editor, { commandName, componentName, icon, dropdownLabel }) {\n        super(editor);\n        this.commandName = commandName;\n        this.componentName = componentName;\n        this.icon = icon;\n        this.dropdownLabel = dropdownLabel;\n        this.columns = editor.config.get(`${this.componentName}.columns`);\n    }\n    /**\n    * @inheritDoc\n    */\n    init() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const t = locale.t;\n        const command = editor.commands.get(this.commandName);\n        const componentConfig = editor.config.get(this.componentName);\n        const colorsConfig = normalizeColorOptions(componentConfig.colors);\n        const localizedColors = getLocalizedColorOptions(locale, colorsConfig);\n        const documentColorsCount = componentConfig.documentColors;\n        const hasColorPicker = componentConfig.colorPicker !== false;\n        // Register the UI component.\n        editor.ui.componentFactory.add(this.componentName, locale => {\n            const dropdownView = createDropdown(locale);\n            // Font color dropdown rendering is deferred once it gets open to improve performance (#6192).\n            let dropdownContentRendered = false;\n            const colorSelectorView = addColorSelectorToDropdown({\n                dropdownView,\n                colors: localizedColors.map(option => ({\n                    label: option.label,\n                    color: option.model,\n                    options: {\n                        hasBorder: option.hasBorder\n                    }\n                })),\n                columns: this.columns,\n                removeButtonLabel: t('Remove color'),\n                colorPickerLabel: t('Color picker'),\n                documentColorsLabel: documentColorsCount !== 0 ? t('Document colors') : '',\n                documentColorsCount: documentColorsCount === undefined ? this.columns : documentColorsCount,\n                colorPickerViewConfig: hasColorPicker ? (componentConfig.colorPicker || {}) : false\n            });\n            colorSelectorView.bind('selectedColor').to(command, 'value');\n            dropdownView.buttonView.set({\n                label: this.dropdownLabel,\n                icon: this.icon,\n                tooltip: true\n            });\n            dropdownView.extendTemplate({\n                attributes: {\n                    class: 'ck-color-ui-dropdown'\n                }\n            });\n            dropdownView.bind('isEnabled').to(command);\n            colorSelectorView.on('execute', (evt, data) => {\n                if (dropdownView.isOpen) {\n                    editor.execute(this.commandName, {\n                        value: data.value,\n                        batch: this._undoStepBatch\n                    });\n                }\n                if (data.source !== 'colorPicker') {\n                    editor.editing.view.focus();\n                }\n                if (data.source === 'colorPickerSaveButton') {\n                    dropdownView.isOpen = false;\n                }\n            });\n            colorSelectorView.on('colorPicker:show', () => {\n                this._undoStepBatch = editor.model.createBatch();\n            });\n            colorSelectorView.on('colorPicker:cancel', () => {\n                if (this._undoStepBatch.operations.length) {\n                    // We need to close the dropdown before the undo batch.\n                    // Otherwise, FontColorUIBase treats undo as a selected color change,\n                    // propagating the update to the whole selection.\n                    // That's an issue if spans with various colors were selected.\n                    dropdownView.isOpen = false;\n                    editor.execute('undo', this._undoStepBatch);\n                }\n                editor.editing.view.focus();\n            });\n            dropdownView.on('change:isOpen', (evt, name, isVisible) => {\n                if (!dropdownContentRendered) {\n                    dropdownContentRendered = true;\n                    dropdownView.colorSelectorView.appendUI();\n                }\n                if (isVisible) {\n                    if (documentColorsCount !== 0) {\n                        colorSelectorView.updateDocumentColors(editor.model, this.componentName);\n                    }\n                    colorSelectorView.updateSelectedColors();\n                    colorSelectorView.showColorGridsFragment();\n                }\n            });\n            // Accessibility: focus the first active color when opening the dropdown.\n            focusChildOnDropdownOpen(dropdownView, () => dropdownView.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((item) => item.isOn));\n            return dropdownView;\n        });\n        // Register menu bar button..\n        editor.ui.componentFactory.add(`menuBar:${this.componentName}`, locale => {\n            const menuView = new MenuBarMenuView(locale);\n            menuView.buttonView.set({\n                label: this.dropdownLabel,\n                icon: this.icon\n            });\n            menuView.bind('isEnabled').to(command);\n            // Font color sub-menu rendering is deferred once it gets open to improve performance (#6192).\n            let contentRendered = false;\n            const colorSelectorView = new ColorSelectorView(locale, {\n                colors: localizedColors.map(option => ({\n                    label: option.label,\n                    color: option.model,\n                    options: {\n                        hasBorder: option.hasBorder\n                    }\n                })),\n                columns: this.columns,\n                removeButtonLabel: t('Remove color'),\n                colorPickerLabel: t('Color picker'),\n                documentColorsLabel: documentColorsCount !== 0 ? t('Document colors') : '',\n                documentColorsCount: documentColorsCount === undefined ? this.columns : documentColorsCount,\n                colorPickerViewConfig: false\n            });\n            colorSelectorView.bind('selectedColor').to(command, 'value');\n            colorSelectorView.delegate('execute').to(menuView);\n            colorSelectorView.on('execute', (evt, data) => {\n                editor.execute(this.commandName, {\n                    value: data.value,\n                    batch: this._undoStepBatch\n                });\n                editor.editing.view.focus();\n            });\n            menuView.on('change:isOpen', (evt, name, isVisible) => {\n                if (!contentRendered) {\n                    contentRendered = true;\n                    colorSelectorView.appendUI();\n                }\n                if (isVisible) {\n                    if (documentColorsCount !== 0) {\n                        colorSelectorView.updateDocumentColors(editor.model, this.componentName);\n                    }\n                    colorSelectorView.updateSelectedColors();\n                    colorSelectorView.showColorGridsFragment();\n                }\n            });\n            menuView.panelView.children.add(colorSelectorView);\n            return menuView;\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontcolor/fontcolorui\n */\nimport { IconFontColor } from 'ckeditor5/src/icons.js';\nimport { FontColorUIBase } from '../ui/colorui.js';\nimport { FONT_COLOR } from '../utils.js';\n/**\n * The font color UI plugin. It introduces the `'fontColor'` dropdown.\n */\nexport class FontColorUI extends FontColorUIBase {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        const t = editor.locale.t;\n        super(editor, {\n            commandName: FONT_COLOR,\n            componentName: FONT_COLOR,\n            icon: IconFontColor,\n            dropdownLabel: t('Font Color')\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontColorUI';\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M12.4 10.3 10 4.5l-2.4 5.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontcolor\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontColorEditing } from './fontcolor/fontcolorediting.js';\nimport { FontColorUI } from './fontcolor/fontcolorui.js';\n/**\n * The font color plugin.\n *\n * For a detailed overview, check the {@glink features/font font feature} documentation\n * and the {@glink api/font package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:font/fontcolor/fontcolorediting~FontColorEditing} and\n * {@link module:font/fontcolor/fontcolorui~FontColorUI} features in the editor.\n */\nexport class FontColor extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FontColorEditing, FontColorUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontColor';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { FontCommand } from '../fontcommand.js';\nimport { FONT_BACKGROUND_COLOR } from '../utils.js';\n/**\n * The font background color command. It is used by\n * {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing}\n * to apply the font background color.\n *\n * ```ts\n * editor.execute( 'fontBackgroundColor', { value: 'rgb(250, 20, 20)' } );\n * ```\n *\n * **Note**: Executing the command with the `null` value removes the attribute from the model.\n */\nexport class FontBackgroundColorCommand extends FontCommand {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor, FONT_BACKGROUND_COLOR);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontbackgroundcolor/fontbackgroundcolorediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { addBackgroundStylesRules } from 'ckeditor5/src/engine.js';\nimport { FontBackgroundColorCommand } from './fontbackgroundcolorcommand.js';\nimport { FONT_BACKGROUND_COLOR, renderDowncastElement, renderUpcastAttribute } from '../utils.js';\n/**\n * The font background color editing feature.\n *\n * It introduces the {@link module:font/fontbackgroundcolor/fontbackgroundcolorcommand~FontBackgroundColorCommand command} and\n * the `fontBackgroundColor` attribute in the {@link module:engine/model/model~Model model} which renders\n * in the {@link module:engine/view/view view} as a `<span>` element (`<span style=\"background-color: ...\">`),\n * depending on the {@link module:font/fontconfig~FontColorConfig configuration}.\n */\nexport class FontBackgroundColorEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontBackgroundColorEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define(FONT_BACKGROUND_COLOR, {\n            colors: [\n                {\n                    color: 'hsl(0, 0%, 0%)',\n                    label: 'Black'\n                },\n                {\n                    color: 'hsl(0, 0%, 30%)',\n                    label: 'Dim grey'\n                },\n                {\n                    color: 'hsl(0, 0%, 60%)',\n                    label: 'Grey'\n                },\n                {\n                    color: 'hsl(0, 0%, 90%)',\n                    label: 'Light grey'\n                },\n                {\n                    color: 'hsl(0, 0%, 100%)',\n                    label: 'White',\n                    hasBorder: true\n                },\n                {\n                    color: 'hsl(0, 75%, 60%)',\n                    label: 'Red'\n                },\n                {\n                    color: 'hsl(30, 75%, 60%)',\n                    label: 'Orange'\n                },\n                {\n                    color: 'hsl(60, 75%, 60%)',\n                    label: 'Yellow'\n                },\n                {\n                    color: 'hsl(90, 75%, 60%)',\n                    label: 'Light green'\n                },\n                {\n                    color: 'hsl(120, 75%, 60%)',\n                    label: 'Green'\n                },\n                {\n                    color: 'hsl(150, 75%, 60%)',\n                    label: 'Aquamarine'\n                },\n                {\n                    color: 'hsl(180, 75%, 60%)',\n                    label: 'Turquoise'\n                },\n                {\n                    color: 'hsl(210, 75%, 60%)',\n                    label: 'Light blue'\n                },\n                {\n                    color: 'hsl(240, 75%, 60%)',\n                    label: 'Blue'\n                },\n                {\n                    color: 'hsl(270, 75%, 60%)',\n                    label: 'Purple'\n                }\n            ],\n            columns: 5\n        });\n        editor.data.addStyleProcessorRules(addBackgroundStylesRules);\n        editor.conversion.for('upcast').elementToAttribute({\n            view: {\n                name: 'span',\n                styles: {\n                    'background-color': /[\\s\\S]+/\n                }\n            },\n            model: {\n                key: FONT_BACKGROUND_COLOR,\n                value: renderUpcastAttribute('background-color')\n            }\n        });\n        editor.conversion.for('downcast').attributeToElement({\n            model: FONT_BACKGROUND_COLOR,\n            view: renderDowncastElement('background-color')\n        });\n        editor.commands.add(FONT_BACKGROUND_COLOR, new FontBackgroundColorCommand(editor));\n        // Allow the font backgroundColor attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: FONT_BACKGROUND_COLOR });\n        editor.model.schema.setAttributeProperties(FONT_BACKGROUND_COLOR, {\n            isFormatting: true,\n            copyOnEnter: true\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontbackgroundcolor/fontbackgroundcolorui\n */\nimport { IconFontBackground } from 'ckeditor5/src/icons.js';\nimport { FontColorUIBase } from '../ui/colorui.js';\nimport { FONT_BACKGROUND_COLOR } from '../utils.js';\n/**\n * The font background color UI plugin. It introduces the `'fontBackgroundColor'` dropdown.\n */\nexport class FontBackgroundColorUI extends FontColorUIBase {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        const t = editor.locale.t;\n        super(editor, {\n            commandName: FONT_BACKGROUND_COLOR,\n            componentName: FONT_BACKGROUND_COLOR,\n            icon: IconFontBackground,\n            dropdownLabel: t('Font Background Color')\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontBackgroundColorUI';\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m8.38 9.262H7.62L10 5.506zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/fontbackgroundcolor\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontBackgroundColorEditing } from './fontbackgroundcolor/fontbackgroundcolorediting.js';\nimport { FontBackgroundColorUI } from './fontbackgroundcolor/fontbackgroundcolorui.js';\n/**\n * The font background color plugin.\n *\n * For a detailed overview, check the {@glink features/font font feature} documentation\n * and the {@glink api/font package page}.\n *\n * This is a \"glue\" plugin which loads\n * the {@link module:font/fontbackgroundcolor/fontbackgroundcolorediting~FontBackgroundColorEditing} and\n * {@link module:font/fontbackgroundcolor/fontbackgroundcolorui~FontBackgroundColorUI} features in the editor.\n */\nexport class FontBackgroundColor extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FontBackgroundColorEditing, FontBackgroundColorUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FontBackgroundColor';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listformatting/listitemfontsizeintegration\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { env } from 'ckeditor5/src/utils.js';\nimport { _normalizeFontSizeOptions } from '@ckeditor/ckeditor5-font';\nimport { ListEditing } from '../list/listediting.js';\n/**\n * The list item font size integration plugin.\n */\nexport class ListItemFontSizeIntegration extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListItemFontSizeIntegration';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const ListFormatting = editor.plugins.get('ListFormatting');\n        const listEditing = editor.plugins.get(ListEditing);\n        if (!editor.plugins.has('FontSizeEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        const normalizedFontSizeOptions = _normalizeFontSizeOptions(editor.config.get('fontSize.options'));\n        ListFormatting.registerFormatAttribute('fontSize', 'listItemFontSize');\n        // Register the downcast strategy in init() so that the attribute name is registered before the list editing\n        // registers its converters.\n        // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.\n        listEditing.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'listItemFontSize',\n            setAttributeOnDowncast(writer, value, viewElement, options) {\n                if (value) {\n                    const fontSizeOption = normalizedFontSizeOptions.find(option => option.model == value);\n                    if (fontSizeOption && fontSizeOption.view && typeof fontSizeOption.view != 'string') {\n                        if (fontSizeOption.view.styles) {\n                            writer.addClass('ck-list-marker-font-size', viewElement);\n                            writer.setStyle('--ck-content-list-marker-font-size', fontSizeOption.view.styles['font-size'], viewElement);\n                        }\n                        else if (fontSizeOption.view.classes) {\n                            writer.addClass(`ck-list-marker-font-size-${value}`, viewElement);\n                            // See: https://github.com/ckeditor/ckeditor5/issues/18790.\n                            if (env.isSafari && !(options && options.dataPipeline)) {\n                                writer.setStyle('--ck-content-list-marker-dummy-font-size', '0', viewElement);\n                            }\n                        }\n                    }\n                    else {\n                        writer.addClass('ck-list-marker-font-size', viewElement);\n                        writer.setStyle('--ck-content-list-marker-font-size', value, viewElement);\n                    }\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const model = editor.model;\n        if (!editor.plugins.has('FontSizeEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        model.schema.extend('$listItem', { allowAttributes: 'listItemFontSize' });\n        model.schema.setAttributeProperties('listItemFontSize', {\n            isFormatting: true\n        });\n        model.schema.addAttributeCheck(context => {\n            const item = context.last;\n            if (!item.getAttribute('listItemId')) {\n                return false;\n            }\n        }, 'listItemFontSize');\n        editor.conversion.for('upcast').elementToAttribute({\n            model: {\n                key: 'listItemFontSize',\n                value: (viewElement) => viewElement.getStyle('--ck-content-list-marker-font-size')\n            },\n            view: {\n                name: 'li',\n                classes: 'ck-list-marker-font-size',\n                styles: {\n                    '--ck-content-list-marker-font-size': /.*/\n                }\n            }\n        });\n        const fontSizeOptions = _normalizeFontSizeOptions(editor.config.get('fontSize.options'));\n        for (const option of fontSizeOptions) {\n            if (option.model && option.view) {\n                editor.conversion.for('upcast').elementToAttribute({\n                    model: {\n                        key: 'listItemFontSize',\n                        value: option.model\n                    },\n                    view: {\n                        name: 'li',\n                        classes: `ck-list-marker-font-size-${option.model}`\n                    }\n                });\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listformatting/listitemfontcolorintegration\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ListEditing } from '../list/listediting.js';\n/**\n * The list item font color integration plugin.\n */\nexport class ListItemFontColorIntegration extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListItemFontColorIntegration';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const ListFormatting = editor.plugins.get('ListFormatting');\n        const listEditing = editor.plugins.get(ListEditing);\n        if (!editor.plugins.has('FontColorEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        ListFormatting.registerFormatAttribute('fontColor', 'listItemFontColor');\n        // Register the downcast strategy in init() so that the attribute name is registered before the list editing\n        // registers its converters.\n        // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.\n        listEditing.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'listItemFontColor',\n            setAttributeOnDowncast(writer, value, viewElement) {\n                if (value) {\n                    writer.addClass('ck-list-marker-color', viewElement);\n                    writer.setStyle('--ck-content-list-marker-color', value, viewElement);\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const model = editor.model;\n        if (!editor.plugins.has('FontColorEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        model.schema.extend('$listItem', { allowAttributes: 'listItemFontColor' });\n        model.schema.setAttributeProperties('listItemFontColor', {\n            isFormatting: true\n        });\n        model.schema.addAttributeCheck(context => {\n            const item = context.last;\n            if (!item.getAttribute('listItemId')) {\n                return false;\n            }\n        }, 'listItemFontColor');\n        editor.conversion.for('upcast').attributeToAttribute({\n            model: {\n                key: 'listItemFontColor',\n                value: (viewElement) => {\n                    return viewElement.getStyle('--ck-content-list-marker-color');\n                }\n            },\n            view: {\n                name: 'li',\n                classes: 'ck-list-marker-color',\n                styles: {\n                    '--ck-content-list-marker-color': /.*/\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listformatting/listitemfontfamilyintegration\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ListEditing } from '../list/listediting.js';\n/**\n * The list item font family integration plugin.\n */\nexport class ListItemFontFamilyIntegration extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListItemFontFamilyIntegration';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const ListFormatting = editor.plugins.get('ListFormatting');\n        const listEditing = editor.plugins.get(ListEditing);\n        if (!editor.plugins.has('FontFamilyEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        ListFormatting.registerFormatAttribute('fontFamily', 'listItemFontFamily');\n        // Register the downcast strategy in init() so that the attribute name is registered before the list editing\n        // registers its converters.\n        // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.\n        listEditing.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'listItemFontFamily',\n            setAttributeOnDowncast(writer, value, viewElement) {\n                // There is no need of removing the style because downcast strategies handles it automatically.\n                if (value) {\n                    writer.addClass('ck-list-marker-font-family', viewElement);\n                    writer.setStyle('--ck-content-list-marker-font-family', value, viewElement);\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const model = editor.model;\n        if (!editor.plugins.has('FontFamilyEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        model.schema.extend('$listItem', { allowAttributes: 'listItemFontFamily' });\n        model.schema.setAttributeProperties('listItemFontFamily', {\n            isFormatting: true\n        });\n        model.schema.addAttributeCheck(context => {\n            const item = context.last;\n            if (!item.getAttribute('listItemId')) {\n                return false;\n            }\n        }, 'listItemFontFamily');\n        editor.conversion.for('upcast').attributeToAttribute({\n            model: {\n                key: 'listItemFontFamily',\n                value: (viewElement) => {\n                    return viewElement.getStyle('--ck-content-list-marker-font-family');\n                }\n            },\n            view: {\n                name: 'li',\n                classes: 'ck-list-marker-font-family',\n                styles: {\n                    '--ck-content-list-marker-font-family': /.*/\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listformatting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ListItemBoldIntegration } from './listformatting/listitemboldintegration.js';\nimport { ListItemItalicIntegration } from './listformatting/listitemitalicintegration.js';\nimport { ListItemFontSizeIntegration } from './listformatting/listitemfontsizeintegration.js';\nimport { ListItemFontColorIntegration } from './listformatting/listitemfontcolorintegration.js';\nimport { ListItemFontFamilyIntegration } from './listformatting/listitemfontfamilyintegration.js';\nimport { isListItemBlock, getAllListItemBlocks, isFirstBlockOfListItem } from './list/utils/model.js';\nimport '../theme/listformatting.css';\n/**\n * The list formatting plugin.\n *\n * It enables integration with formatting plugins to style the list marker.\n * The list marker is styled based on the consistent formatting applied to the content of the list item.\n *\n * The list of supported formatting plugins includes:\n * * Font color.\n * * Font size.\n * * Font family.\n * * Bold.\n * * Italic.\n */\nexport class ListFormatting extends Plugin {\n    /**\n     * The list of loaded formatting.\n     */\n    _loadedFormatting = {};\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListFormatting';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [\n            ListItemBoldIntegration,\n            ListItemItalicIntegration,\n            ListItemFontSizeIntegration,\n            ListItemFontColorIntegration,\n            ListItemFontFamilyIntegration\n        ];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('list.enableListItemMarkerFormatting', true);\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        if (!this.editor.config.get('list.enableListItemMarkerFormatting')) {\n            return;\n        }\n        this._registerPostfixerForListItemFormatting();\n    }\n    /**\n     * Registers a postfixer that ensures that the list item formatting attribute is consistent with the formatting\n     * applied to the content of the list item.\n     */\n    _registerPostfixerForListItemFormatting() {\n        const model = this.editor.model;\n        model.document.registerPostFixer(writer => {\n            const changes = model.document.differ.getChanges();\n            const modifiedListItems = new Set();\n            let returnValue = false;\n            for (const entry of changes) {\n                if (entry.type === 'attribute') {\n                    if (entry.attributeKey == 'listItemId' ||\n                        entry.attributeKey == 'listType' ||\n                        this._isInlineOrSelectionFormatting(entry.attributeKey) ||\n                        Object.values(this._loadedFormatting).includes(entry.attributeKey)) {\n                        if (isListItemBlock(entry.range.start.nodeAfter)) {\n                            modifiedListItems.add(entry.range.start.nodeAfter);\n                        }\n                        else if (isListItemBlock(entry.range.start.parent)) {\n                            modifiedListItems.add(entry.range.start.parent);\n                        }\n                    }\n                }\n                else {\n                    if (isListItemBlock(entry.position.nodeAfter)) {\n                        modifiedListItems.add(entry.position.nodeAfter);\n                    }\n                    if (isListItemBlock(entry.position.nodeBefore)) {\n                        modifiedListItems.add(entry.position.nodeBefore);\n                    }\n                    if (isListItemBlock(entry.position.parent)) {\n                        modifiedListItems.add(entry.position.parent);\n                    }\n                    if (entry.type == 'insert' && entry.name != '$text') {\n                        const range = writer.createRangeIn(entry.position.nodeAfter);\n                        for (const item of range.getItems()) {\n                            if (isListItemBlock(item)) {\n                                modifiedListItems.add(item);\n                            }\n                        }\n                    }\n                }\n            }\n            for (const listItem of modifiedListItems) {\n                const formats = getListItemConsistentFormat(model, listItem, Object.keys(this._loadedFormatting));\n                for (const [formatAttributeName, formatValue] of Object.entries(formats)) {\n                    const listItemFormatAttributeName = this._loadedFormatting[formatAttributeName];\n                    if (formatValue && setFormattingToListItem(writer, listItem, listItemFormatAttributeName, formatValue)) {\n                        returnValue = true;\n                    }\n                    else if (!formatValue && removeFormattingFromListItem(writer, listItem, listItemFormatAttributeName)) {\n                        returnValue = true;\n                    }\n                }\n            }\n            return returnValue;\n        });\n    }\n    /**\n     * Registers an integration between a default attribute (e.g., `fontFamily`) and a new attribute\n     * intended specifically for list item elements (e.g., `listItemFontFamily`).\n     *\n     * These attributes are later used by the postfixer logic to determine whether to add the new attribute\n     * to the list item element, based on whether there is a consistent default formatting attribute\n     * applied within its content.\n     */\n    registerFormatAttribute(formatAttribute, listItemFormatAttribute) {\n        this._loadedFormatting[formatAttribute] = listItemFormatAttribute;\n    }\n    /**\n     * Returns true if the given model attribute name is a supported inline formatting attribute.\n     */\n    _isInlineOrSelectionFormatting(attributeKey) {\n        return attributeKey.replace(/^selection:/, '') in this._loadedFormatting;\n    }\n}\n/**\n * Returns the consistent format of the list item element.\n * If the list item contains multiple blocks, it checks only the first block.\n */\nfunction getListItemConsistentFormat(model, listItem, attributeKeys) {\n    if (isFirstBlockOfListItem(listItem)) {\n        return getSingleListItemConsistentFormat(model, listItem, attributeKeys);\n    }\n    // Always the first block of the list item should be checked for consistent formatting.\n    const listItemBlocks = getAllListItemBlocks(listItem);\n    return getSingleListItemConsistentFormat(model, listItemBlocks[0], attributeKeys);\n}\n/**\n * Returns the consistent format of a single list item element.\n */\nfunction getSingleListItemConsistentFormat(model, listItem, attributeKeys) {\n    // Only bulleted and numbered lists can have formatting (to-do lists are not supported).\n    // Do not check internals of limit elements (for example, do not check table cells).\n    if (!isNumberedOrBulletedList(listItem) || model.schema.isLimit(listItem)) {\n        return Object.fromEntries(attributeKeys.map(attributeKey => [attributeKey]));\n    }\n    if (listItem.isEmpty) {\n        return Object.fromEntries(attributeKeys.map(attributeKey => ([attributeKey, listItem.getAttribute(`selection:${attributeKey}`)])));\n    }\n    const attributesToCheck = new Set(attributeKeys);\n    const valuesMap = {};\n    const range = model.createRangeIn(listItem);\n    const walker = range.getWalker({ ignoreElementEnd: true });\n    for (const { item } of walker) {\n        for (const attributeKey of attributesToCheck) {\n            if (model.schema.checkAttribute(item, attributeKey)) {\n                const formatAttribute = item.getAttribute(attributeKey);\n                if (formatAttribute === undefined) {\n                    attributesToCheck.delete(attributeKey);\n                    valuesMap[attributeKey] = undefined;\n                }\n                else if (valuesMap[attributeKey] === undefined) {\n                    // First item inside a list item block.\n                    valuesMap[attributeKey] = formatAttribute;\n                }\n                else if (valuesMap[attributeKey] !== formatAttribute) {\n                    // Following items in the same block of a list item.\n                    attributesToCheck.delete(attributeKey);\n                    valuesMap[attributeKey] = undefined;\n                }\n            }\n            else if (!(attributeKey in valuesMap)) {\n                // Store it so a format would be removed when all items in the given list item does not allow that formatting.\n                valuesMap[attributeKey] = undefined;\n            }\n        }\n        // End early if all attributes have been checked and are inconsistent.\n        if (!attributesToCheck.size) {\n            break;\n        }\n        // Jump over inline limit elements as we expect only outside them to be the same formatting.\n        if (model.schema.isLimit(item)) {\n            walker.jumpTo(model.createPositionAfter(item));\n        }\n    }\n    return valuesMap;\n}\n/**\n * Adds the specified formatting attribute to the list item element.\n */\nfunction setFormattingToListItem(writer, listItem, attributeKey, attributeValue) {\n    // Multi-block items should have consistent formatting.\n    const listItemBlocks = getAllListItemBlocks(listItem);\n    let wasChanged = false;\n    for (const listItem of listItemBlocks) {\n        if (!listItem.hasAttribute(attributeKey) || listItem.getAttribute(attributeKey) !== attributeValue) {\n            writer.setAttribute(attributeKey, attributeValue, listItem);\n            wasChanged = true;\n        }\n    }\n    return wasChanged;\n}\n/**\n * Removes the specified formatting attribute from the list item element.\n */\nfunction removeFormattingFromListItem(writer, listItem, attributeKey) {\n    // Multi-block items should have consistent formatting.\n    const listItemBlocks = getAllListItemBlocks(listItem);\n    let wasChanged = false;\n    for (const listItem of listItemBlocks) {\n        if (listItem.hasAttribute(attributeKey)) {\n            writer.removeAttribute(attributeKey, listItem);\n            wasChanged = true;\n        }\n    }\n    return wasChanged;\n}\n/**\n * Checks if the given list type is a numbered or bulleted list.\n */\nfunction isNumberedOrBulletedList(listItem) {\n    return ['numbered', 'bulleted', 'customNumbered', 'customBulleted'].includes(listItem.getAttribute('listType'));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { expandListBlocksToCompleteItems, expandListBlocksToCompleteList, isFirstBlockOfListItem, isListItemBlock, isNumberedListType } from './utils/model.js';\n/**\n * A set of helpers related to document lists.\n */\nexport class ListUtils extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Expands the given list of selected blocks to include all the items of the lists they're in.\n     *\n     * @param blocks The list of selected blocks.\n     */\n    expandListBlocksToCompleteList(blocks) {\n        return expandListBlocksToCompleteList(blocks);\n    }\n    /**\n     * Check if the given block is the first in the list item.\n     *\n     * @param listBlock The list block element.\n     */\n    isFirstBlockOfListItem(listBlock) {\n        return isFirstBlockOfListItem(listBlock);\n    }\n    /**\n     * Returns true if the given model node is a list item block.\n     *\n     * @param node A model node.\n     */\n    isListItemBlock(node) {\n        return isListItemBlock(node);\n    }\n    /**\n     * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.\n     *\n     * @param blocks The list of selected blocks.\n     * @param options.withNested Whether should include nested list items.\n     */\n    expandListBlocksToCompleteItems(blocks, options = {}) {\n        return expandListBlocksToCompleteItems(blocks, options);\n    }\n    /**\n     * Returns true if listType is of type `numbered` or `customNumbered`.\n     */\n    isNumberedListType(listType) {\n        return isNumberedListType(listType);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Checks if view element is a list type (ul or ol).\n *\n * @internal\n */\nexport function isListView(viewElement) {\n    return viewElement.is('element', 'ol') || viewElement.is('element', 'ul');\n}\n/**\n * Checks if view element is a list item (li).\n *\n * @internal\n */\nexport function isListItemView(viewElement) {\n    return viewElement.is('element', 'li');\n}\n/**\n * Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.\n *\n * Also, fixes non HTML compliant lists indents:\n *\n * ```\n * before:                                     fixed list:\n * OL                                          OL\n * |-> LI (parent LIs: 0)                      |-> LI     (indent: 0)\n *     |-> OL                                  |-> OL\n *         |-> OL                                  |\n *         |   |-> OL                              |\n *         |       |-> OL                          |\n *         |           |-> LI (parent LIs: 1)      |-> LI (indent: 1)\n *         |-> LI (parent LIs: 1)                  |-> LI (indent: 1)\n *\n * before:                                     fixed list:\n * OL                                          OL\n * |-> OL                                      |\n *     |-> OL                                  |\n *          |-> OL                             |\n *              |-> LI (parent LIs: 0)         |-> LI        (indent: 0)\n *\n * before:                                     fixed list:\n * OL                                          OL\n * |-> LI (parent LIs: 0)                      |-> LI         (indent: 0)\n * |-> OL                                          |-> OL\n *     |-> LI (parent LIs: 0)                          |-> LI (indent: 1)\n * ```\n *\n * @internal\n */\nexport function getIndent(listItem) {\n    let indent = 0;\n    let parent = listItem.parent;\n    while (parent) {\n        // Each LI in the tree will result in an increased indent for HTML compliant lists.\n        if (isListItemView(parent)) {\n            indent++;\n        }\n        else {\n            // If however the list is nested in other list we should check previous sibling of any of the list elements...\n            const previousSibling = parent.previousSibling;\n            // ...because the we might need increase its indent:\n            //\t\tbefore:                           fixed list:\n            //\t\tOL                                OL\n            //\t\t|-> LI (parent LIs: 0)            |-> LI         (indent: 0)\n            //\t\t|-> OL                                |-> OL\n            //\t\t    |-> LI (parent LIs: 0)                |-> LI (indent: 1)\n            if (previousSibling && isListItemView(previousSibling)) {\n                indent++;\n            }\n        }\n        parent = parent.parent;\n    }\n    return indent;\n}\n/**\n * Creates a list attribute element (ol or ul).\n *\n * @internal\n */\nexport function createListElement(writer, indent, type, id = getViewElementIdForListType(type, indent)) {\n    // Negative priorities so that restricted editing attribute won't wrap lists.\n    return writer.createAttributeElement(getViewElementNameForListType(type), null, {\n        priority: 2 * indent / 100 - 100,\n        id\n    });\n}\n/**\n * Creates a list item attribute element (li).\n *\n * @internal\n */\nexport function createListItemElement(writer, indent, id) {\n    // Negative priorities so that restricted editing attribute won't wrap list items.\n    return writer.createAttributeElement('li', null, {\n        priority: (2 * indent + 1) / 100 - 100,\n        id\n    });\n}\n/**\n * Returns a view element name for the given list type.\n *\n * @internal\n */\nexport function getViewElementNameForListType(type) {\n    return type == 'numbered' || type == 'customNumbered' ? 'ol' : 'ul';\n}\n/**\n * Returns a view element ID for the given list type and indent.\n *\n * @internal\n */\nexport function getViewElementIdForListType(type, indent) {\n    return `list-${type}-${indent}`;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { SiblingListBlocksIterator } from './listwalker.js';\nimport { getListItemBlocks, isListItemBlock, ListItemUid } from './model.js';\n/**\n * Based on the provided positions looks for the list head and stores it in the provided map.\n *\n * @internal\n * @param position The search starting position.\n * @param itemToListHead The map from list item element to the list head element.\n * @param visited A set of elements that were already visited.\n */\nexport function findAndAddListHeadToMap(position, itemToListHead, visited) {\n    const previousNode = position.nodeBefore;\n    if (!isListItemBlock(previousNode)) {\n        const item = position.nodeAfter;\n        if (isListItemBlock(item)) {\n            itemToListHead.add(item);\n        }\n    }\n    else {\n        let listHead = previousNode;\n        // Previously, the loop below was defined like this:\n        //\n        // \t\tfor ( { node: listHead } of new SiblingListBlocksIterator( listHead, 'backward' ) )\n        //\n        // Unfortunately, such a destructuring is incorrectly transpiled by Babel and the loop never ends.\n        // See: https://github.com/ckeditor/ckeditor5-react/issues/345.\n        for (const { node } of new SiblingListBlocksIterator(listHead, 'backward')) {\n            listHead = node;\n            if (visited.has(listHead)) {\n                return;\n            }\n            visited.add(listHead);\n            if (itemToListHead.has(previousNode)) {\n                return;\n            }\n        }\n        itemToListHead.add(listHead);\n    }\n}\n/**\n * Scans the list starting from the given list head element and fixes items' indentation.\n *\n * @internal\n * @param listNodes The iterable of list nodes.\n * @param writer The model writer.\n * @returns Whether the model was modified.\n */\nexport function fixListIndents(listNodes, writer) {\n    let maxIndent = 0; // Guards local sublist max indents that need fixing.\n    let prevIndent = -1; // Previous item indent.\n    let fixBy = null;\n    let applied = false;\n    for (const { node } of listNodes) {\n        const itemIndent = node.getAttribute('listIndent');\n        if (itemIndent > maxIndent) {\n            let newIndent;\n            if (fixBy === null) {\n                fixBy = itemIndent - maxIndent;\n                newIndent = maxIndent;\n            }\n            else {\n                if (fixBy > itemIndent) {\n                    fixBy = itemIndent;\n                }\n                newIndent = itemIndent - fixBy;\n            }\n            if (newIndent > prevIndent + 1) {\n                newIndent = prevIndent + 1;\n            }\n            writer.setAttribute('listIndent', newIndent, node);\n            applied = true;\n            prevIndent = newIndent;\n        }\n        else {\n            fixBy = null;\n            maxIndent = itemIndent + 1;\n            prevIndent = itemIndent;\n        }\n    }\n    return applied;\n}\n/**\n * Scans the list starting from the given list head element and fixes items' types.\n *\n * @internal\n * @param listNodes The iterable of list nodes.\n * @param seenIds The set of already known IDs.\n * @param writer The model writer.\n * @returns Whether the model was modified.\n */\nexport function fixListItemIds(listNodes, seenIds, writer) {\n    const visited = new Set();\n    let applied = false;\n    for (const { node } of listNodes) {\n        if (visited.has(node)) {\n            continue;\n        }\n        let listType = node.getAttribute('listType');\n        let listItemId = node.getAttribute('listItemId');\n        // Use a new ID if this one was spot earlier (even in other list).\n        if (seenIds.has(listItemId)) {\n            listItemId = ListItemUid.next();\n        }\n        seenIds.add(listItemId);\n        // Make sure that all items in a simple list have unique IDs.\n        if (node.is('element', 'listItem')) {\n            if (node.getAttribute('listItemId') != listItemId) {\n                writer.setAttribute('listItemId', listItemId, node);\n                applied = true;\n            }\n            continue;\n        }\n        for (const block of getListItemBlocks(node, { direction: 'forward' })) {\n            visited.add(block);\n            // Use a new ID if a block of a bigger list item has different type.\n            if (block.getAttribute('listType') != listType) {\n                listItemId = ListItemUid.next();\n                listType = block.getAttribute('listType');\n            }\n            if (block.getAttribute('listItemId') != listItemId) {\n                writer.setAttribute('listItemId', listItemId, block);\n                applied = true;\n            }\n        }\n    }\n    return applied;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getAllListItemBlocks, getListItemBlocks, isListItemBlock, isFirstBlockOfListItem, ListItemUid } from './utils/model.js';\nimport { createListElement, createListItemElement, getIndent, isListView, isListItemView } from './utils/view.js';\nimport { ListWalker, SiblingListBlocksIterator } from './utils/listwalker.js';\nimport { findAndAddListHeadToMap } from './utils/postfixers.js';\n/**\n * Returns the upcast converter for list items. It's supposed to work after the block converters (content inside list items) are converted.\n *\n * @internal\n */\nexport function listItemUpcastConverter() {\n    return (evt, data, conversionApi) => {\n        const { writer, schema } = conversionApi;\n        if (!data.modelRange) {\n            return;\n        }\n        const items = Array.from(data.modelRange.getItems({ shallow: true }))\n            .filter((item) => schema.checkAttribute(item, 'listItemId'));\n        if (!items.length) {\n            return;\n        }\n        const listItemId = data.viewItem.getAttribute('data-list-item-id') || ListItemUid.next();\n        conversionApi.consumable.consume(data.viewItem, { attributes: 'data-list-item-id' });\n        const listIndent = getIndent(data.viewItem);\n        let listType = data.viewItem.parent && data.viewItem.parent.is('element', 'ol') ? 'numbered' : 'bulleted';\n        // Preserve list type if was already set (for example by to-do list feature).\n        const firstItemListType = items[0].getAttribute('listType');\n        if (firstItemListType) {\n            listType = firstItemListType;\n        }\n        const attributes = {\n            listItemId,\n            listIndent,\n            listType\n        };\n        for (const item of items) {\n            // Set list attributes only on same level items, those nested deeper are already handled by the recursive conversion.\n            if (!item.hasAttribute('listItemId')) {\n                writer.setAttributes(attributes, item);\n            }\n        }\n        if (items.length > 1) {\n            // Make sure that list item that contain only nested list will preserve paragraph for itself:\n            //\t<ul>\n            //\t\t<li>\n            //\t\t\t<p></p>  <-- this one must be kept\n            //\t\t\t<ul>\n            //\t\t\t\t<li></li>\n            //\t\t\t</ul>\n            //\t\t</li>\n            //\t</ul>\n            if (items[1].getAttribute('listItemId') != attributes.listItemId) {\n                conversionApi.keepEmptyElement(items[0]);\n            }\n        }\n    };\n}\n/**\n * Returns a model document change:data event listener that triggers conversion of related items if needed.\n *\n * @internal\n * @param model The editor model.\n * @param editing The editing controller.\n * @param attributeNames The list of all model list attributes (including registered strategies).\n * @param listEditing The document list editing plugin.\n */\nexport function reconvertItemsOnDataChange(model, editing, attributeNames, listEditing) {\n    return () => {\n        const changes = model.document.differ.getChanges();\n        const itemsToRefresh = [];\n        const itemToListHead = new Set();\n        const changedItems = new Set();\n        const visited = new Set();\n        for (const entry of changes) {\n            if (entry.type == 'insert' && entry.name != '$text') {\n                findAndAddListHeadToMap(entry.position, itemToListHead, visited);\n                // Insert of a non-list item.\n                if (!entry.attributes.has('listItemId')) {\n                    findAndAddListHeadToMap(entry.position.getShiftedBy(entry.length), itemToListHead, visited);\n                }\n                else {\n                    changedItems.add(entry.position.nodeAfter);\n                }\n            }\n            // Removed list item.\n            else if (entry.type == 'remove' && entry.attributes.has('listItemId')) {\n                findAndAddListHeadToMap(entry.position, itemToListHead, visited);\n            }\n            // Changed list attribute.\n            else if (entry.type == 'attribute') {\n                const item = entry.range.start.nodeAfter;\n                if (attributeNames.includes(entry.attributeKey)) {\n                    findAndAddListHeadToMap(entry.range.start, itemToListHead, visited);\n                    if (entry.attributeNewValue === null) {\n                        findAndAddListHeadToMap(entry.range.start.getShiftedBy(1), itemToListHead, visited);\n                        // Check if paragraph should be converted from bogus to plain paragraph.\n                        if (doesItemBlockRequiresRefresh(item)) {\n                            itemsToRefresh.push(item);\n                        }\n                    }\n                    else {\n                        changedItems.add(item);\n                    }\n                }\n                else if (isListItemBlock(item)) {\n                    // Some other attribute was changed on the list item,\n                    // check if paragraph does not need to be converted to bogus or back.\n                    if (doesItemBlockRequiresRefresh(item)) {\n                        itemsToRefresh.push(item);\n                    }\n                }\n            }\n        }\n        for (const listHead of itemToListHead.values()) {\n            itemsToRefresh.push(...collectListItemsToRefresh(listHead, changedItems));\n        }\n        for (const item of new Set(itemsToRefresh)) {\n            editing.reconvertItem(item);\n        }\n    };\n    function collectListItemsToRefresh(listHead, changedItems) {\n        const itemsToRefresh = [];\n        const visited = new Set();\n        const stack = [];\n        for (const { node, previous } of new SiblingListBlocksIterator(listHead)) {\n            if (visited.has(node)) {\n                continue;\n            }\n            const itemIndent = node.getAttribute('listIndent');\n            // Current node is at the lower indent so trim the stack.\n            if (previous && itemIndent < previous.getAttribute('listIndent')) {\n                stack.length = itemIndent + 1;\n            }\n            // Update the stack for the current indent level.\n            stack[itemIndent] = {\n                modelAttributes: Object.fromEntries(Array.from(node.getAttributes())\n                    .filter(([key]) => attributeNames.includes(key))),\n                modelElement: node\n            };\n            // Find all blocks of the current node.\n            const blocks = getListItemBlocks(node, { direction: 'forward' });\n            for (const block of blocks) {\n                visited.add(block);\n                // Check if bogus vs plain paragraph needs refresh.\n                if (doesItemBlockRequiresRefresh(block, blocks)) {\n                    itemsToRefresh.push(block);\n                }\n                // Check if wrapping with UL, OL, LIs needs refresh.\n                else if (doesItemWrappingRequiresRefresh(block, stack, changedItems)) {\n                    itemsToRefresh.push(block);\n                }\n            }\n        }\n        return itemsToRefresh;\n    }\n    function doesItemBlockRequiresRefresh(item, blocks) {\n        const viewElement = editing.mapper.toViewElement(item);\n        if (!viewElement) {\n            return false;\n        }\n        if (isItemBlockInsideStructureSlot(viewElement)) {\n            return true;\n        }\n        const needsRefresh = listEditing.fire('checkElement', {\n            modelElement: item,\n            viewElement\n        });\n        if (needsRefresh) {\n            return true;\n        }\n        if (!item.is('element', 'paragraph') && !item.is('element', 'listItem')) {\n            return false;\n        }\n        const useBogus = shouldUseBogusParagraph(item, attributeNames, blocks);\n        if (useBogus && viewElement.is('element', 'p')) {\n            return true;\n        }\n        else if (!useBogus && viewElement.is('element', 'span')) {\n            return true;\n        }\n        return false;\n    }\n    function isItemBlockInsideStructureSlot(viewElement) {\n        viewElement = viewElement.parent;\n        while (viewElement.is('attributeElement') && ['ol', 'ul', 'li'].includes(viewElement.name)) {\n            viewElement = viewElement.parent;\n        }\n        // List item inside elementToStructure slot parent without mapping then it requires refresh for correct positions\n        // as structure child elements does not have mapping from model and position would land in wrong place.\n        if (viewElement.getCustomProperty('$structureSlotParent') &&\n            !editing.mapper.toModelElement(viewElement)) {\n            return true;\n        }\n        return false;\n    }\n    function doesItemWrappingRequiresRefresh(item, stack, changedItems) {\n        // Items directly affected by some \"change\" don't need a refresh, they will be converted by their own changes.\n        if (changedItems.has(item)) {\n            return false;\n        }\n        const viewElement = editing.mapper.toViewElement(item);\n        let indent = stack.length - 1;\n        // Traverse down the stack to the root to verify if all ULs, OLs, and LIs are as expected.\n        for (let element = viewElement.parent; !element.is('editableElement'); element = element.parent) {\n            const isListItemElement = isListItemView(element);\n            const isListElement = isListView(element);\n            if (!isListElement && !isListItemElement) {\n                continue;\n            }\n            const eventName = `checkAttributes:${isListItemElement ? 'item' : 'list'}`;\n            const needsRefresh = listEditing.fire(eventName, {\n                viewElement: element,\n                modelAttributes: stack[indent].modelAttributes,\n                modelReferenceElement: stack[indent].modelElement\n            });\n            if (needsRefresh) {\n                break;\n            }\n            if (isListElement) {\n                indent--;\n                // Don't need to iterate further if we already know that the item is wrapped appropriately.\n                if (indent < 0) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n}\n/**\n * Returns the list item downcast converter.\n *\n * @internal\n * @param attributeNames A list of attribute names that should be converted if they are set.\n * @param strategies The strategies.\n * @param model The model.\n */\nexport function listItemDowncastConverter(attributeNames, strategies, model, { dataPipeline } = {}) {\n    const consumer = createAttributesConsumer(attributeNames, strategies);\n    return (evt, data, conversionApi) => {\n        const { writer, mapper, consumable } = conversionApi;\n        const listItem = data.item;\n        if (!attributeNames.includes(data.attributeKey)) {\n            return;\n        }\n        // Test if attributes on the converted items are not consumed.\n        if (!consumer(listItem, consumable)) {\n            return;\n        }\n        const options = {\n            ...conversionApi.options,\n            dataPipeline\n        };\n        // Use positions mapping instead of mapper.toViewElement( listItem ) to find outermost view element.\n        // This is for cases when mapping is using inner view element like in the code blocks (pre > code).\n        const viewElement = findMappedViewElement(listItem, mapper, model, writer);\n        // Remove custom item marker.\n        removeCustomMarkerElements(viewElement, writer, mapper);\n        // Unwrap element from current list wrappers.\n        unwrapListItemBlock(viewElement, writer);\n        // Insert custom item marker.\n        const viewRange = insertCustomMarkerElements(listItem, viewElement, strategies, writer, options);\n        // Then wrap them with the new list wrappers (UL, OL, LI).\n        wrapListItemBlock(listItem, viewRange, strategies, writer, options);\n    };\n}\n/**\n * The 'remove' downcast converter for custom markers.\n *\n * @internal\n */\nexport function listItemDowncastRemoveConverter(schema) {\n    return (evt, data, conversionApi) => {\n        const { writer, mapper } = conversionApi;\n        const elementName = evt.name.split(':')[1];\n        // Do not remove marker if the deleted element is some inline object inside paragraph.\n        // See https://github.com/ckeditor/ckeditor5-internal/issues/3680.\n        if (!schema.checkAttribute(elementName, 'listItemId')) {\n            return;\n        }\n        // Find the view range start position by mapping the model position at which the remove happened.\n        const viewStart = mapper.toViewPosition(data.position);\n        const modelEnd = data.position.getShiftedBy(data.length);\n        const viewEnd = mapper.toViewPosition(modelEnd, { isPhantom: true });\n        // Trim the range to remove in case some UI elements are on the view range boundaries.\n        const viewRange = writer.createRange(viewStart, viewEnd).getTrimmed();\n        // Use positions mapping instead of mapper.toViewElement( listItem ) to find outermost view element.\n        // This is for cases when mapping is using inner view element like in the code blocks (pre > code).\n        const viewElement = viewRange.end.nodeBefore;\n        /* istanbul ignore next -- @preserve */\n        if (!viewElement) {\n            return;\n        }\n        // Remove custom item marker.\n        removeCustomMarkerElements(viewElement, writer, mapper);\n    };\n}\n/**\n * Returns the bogus paragraph view element creator. A bogus paragraph is used if a list item contains only a single block or nested list.\n *\n * @internal\n * @param attributeNames The list of all model list attributes (including registered strategies).\n */\nexport function bogusParagraphCreator(attributeNames, { dataPipeline } = {}) {\n    return (modelElement, { writer }) => {\n        // Convert only if a bogus paragraph should be used.\n        if (!shouldUseBogusParagraph(modelElement, attributeNames)) {\n            return null;\n        }\n        if (!dataPipeline) {\n            return writer.createContainerElement('span', { class: 'ck-list-bogus-paragraph' });\n        }\n        // Using `<p>` in case there are some markers on it and transparentRendering will render it anyway.\n        const viewElement = writer.createContainerElement('p');\n        writer.setCustomProperty('dataPipeline:transparentRendering', true, viewElement);\n        return viewElement;\n    };\n}\n/**\n * Helper for mapping mode to view elements. It's using positions mapping instead of mapper.toViewElement( element )\n * to find outermost view element. This is for cases when mapping is using inner view element like in the code blocks (pre > code).\n *\n * @internal\n * @param element The model element.\n * @param mapper The mapper instance.\n * @param model The model.\n * @param writer The view downcast writer.\n */\nexport function findMappedViewElement(element, mapper, model, writer) {\n    const modelRange = model.createRangeOn(element);\n    const viewRange = mapper.toViewRange(modelRange).getTrimmed();\n    const viewWalker = viewRange.getWalker();\n    for (const { item } of viewWalker) {\n        if (item.is('element') && item.getCustomProperty('listItemMarker')) {\n            viewWalker.jumpTo(writer.createPositionAfter(item));\n        }\n        else if (item.is('element') && !item.getCustomProperty('listItemWrapper')) {\n            return item;\n        }\n    }\n}\n/**\n * The model to view custom position mapping for cases when marker is injected at the beginning of a block.\n *\n * @internal\n */\nexport function createModelToViewPositionMapper(strategies, view) {\n    return (evt, data) => {\n        if (data.modelPosition.offset > 0) {\n            return;\n        }\n        const positionParent = data.modelPosition.parent;\n        if (!isListItemBlock(positionParent)) {\n            return;\n        }\n        if (!strategies.some(strategy => (strategy.scope == 'itemMarker' &&\n            strategy.canInjectMarkerIntoElement &&\n            strategy.canInjectMarkerIntoElement(positionParent)))) {\n            return;\n        }\n        const viewElement = data.mapper.toViewElement(positionParent);\n        const viewRange = view.createRangeIn(viewElement);\n        const viewWalker = viewRange.getWalker();\n        let positionAfterLastMarker = viewRange.start;\n        for (const { item } of viewWalker) {\n            // Walk only over the non-mapped elements (UIElements, ViewAttributeElements, $text, or any other element without mapping).\n            if (item.is('element') && data.mapper.toModelElement(item) || item.is('$textProxy')) {\n                break;\n            }\n            if (item.is('element') && item.getCustomProperty('listItemMarker')) {\n                positionAfterLastMarker = view.createPositionAfter(item);\n                // Jump over the content of the marker (this is not needed for UIElement but required for other element types).\n                viewWalker.skip(({ previousPosition }) => !previousPosition.isEqual(positionAfterLastMarker));\n            }\n        }\n        data.viewPosition = positionAfterLastMarker;\n    };\n}\n/**\n * Removes a custom marker elements and item wrappers related to that marker.\n */\nfunction removeCustomMarkerElements(viewElement, viewWriter, mapper) {\n    // Remove item wrapper.\n    while (viewElement.parent.is('attributeElement') && viewElement.parent.getCustomProperty('listItemWrapper')) {\n        viewWriter.unwrap(viewWriter.createRangeOn(viewElement), viewElement.parent);\n    }\n    // Remove custom item markers.\n    const markersToRemove = [];\n    // Markers before a block.\n    collectMarkersToRemove(viewWriter.createPositionBefore(viewElement).getWalker({ direction: 'backward' }));\n    // Markers inside a block.\n    collectMarkersToRemove(viewWriter.createRangeIn(viewElement).getWalker());\n    for (const marker of markersToRemove) {\n        viewWriter.remove(marker);\n    }\n    function collectMarkersToRemove(viewWalker) {\n        for (const { item } of viewWalker) {\n            // Walk only over the non-mapped elements (UIElements, ViewAttributeElements, $text, or any other element without mapping).\n            if (item.is('element') && mapper.toModelElement(item)) {\n                break;\n            }\n            if (item.is('element') && item.getCustomProperty('listItemMarker')) {\n                markersToRemove.push(item);\n            }\n        }\n    }\n}\n/**\n * Inserts a custom marker elements and wraps first block of a list item if marker requires it.\n */\nfunction insertCustomMarkerElements(listItem, viewElement, strategies, writer, { dataPipeline }) {\n    let viewRange = writer.createRangeOn(viewElement);\n    // Marker can be inserted only before the first block of a list item.\n    if (!isFirstBlockOfListItem(listItem)) {\n        return viewRange;\n    }\n    for (const strategy of strategies) {\n        if (strategy.scope != 'itemMarker') {\n            continue;\n        }\n        // Create the custom marker element and inject it before the first block of the list item.\n        const markerElement = strategy.createElement(writer, listItem, { dataPipeline });\n        if (!markerElement) {\n            continue;\n        }\n        writer.setCustomProperty('listItemMarker', true, markerElement);\n        if (strategy.canInjectMarkerIntoElement && strategy.canInjectMarkerIntoElement(listItem)) {\n            writer.insert(writer.createPositionAt(viewElement, 0), markerElement);\n        }\n        else {\n            writer.insert(viewRange.start, markerElement);\n            viewRange = writer.createRange(writer.createPositionBefore(markerElement), writer.createPositionAfter(viewElement));\n        }\n        // Wrap the marker and optionally the first block with an attribute element (label for to-do lists).\n        if (!strategy.createWrapperElement || !strategy.canWrapElement) {\n            continue;\n        }\n        const wrapper = strategy.createWrapperElement(writer, listItem, { dataPipeline });\n        writer.setCustomProperty('listItemWrapper', true, wrapper);\n        // The whole block can be wrapped...\n        if (strategy.canWrapElement(listItem)) {\n            viewRange = writer.wrap(viewRange, wrapper);\n        }\n        else {\n            // ... or only the marker element (if the block is downcasted to heading or block widget).\n            viewRange = writer.wrap(writer.createRangeOn(markerElement), wrapper);\n            viewRange = writer.createRange(viewRange.start, writer.createPositionAfter(viewElement));\n        }\n    }\n    return viewRange;\n}\n/**\n * Unwraps all ol, ul, and li attribute elements that are wrapping the provided view element.\n */\nfunction unwrapListItemBlock(viewElement, viewWriter) {\n    let attributeElement = viewElement.parent;\n    while (attributeElement.is('attributeElement') && ['ul', 'ol', 'li'].includes(attributeElement.name)) {\n        const parentElement = attributeElement.parent;\n        viewWriter.unwrap(viewWriter.createRangeOn(viewElement), attributeElement);\n        attributeElement = parentElement;\n    }\n}\n/**\n * Wraps the given list item with appropriate attribute elements for ul, ol, and li.\n */\nfunction wrapListItemBlock(listItem, viewRange, strategies, writer, options) {\n    if (!listItem.hasAttribute('listIndent')) {\n        return;\n    }\n    const listItemIndent = listItem.getAttribute('listIndent');\n    let currentListItem = listItem;\n    for (let indent = listItemIndent; indent >= 0; indent--) {\n        const listItemViewElement = createListItemElement(writer, indent, currentListItem.getAttribute('listItemId'));\n        const listViewElement = createListElement(writer, indent, currentListItem.getAttribute('listType'));\n        for (const strategy of strategies) {\n            if ((strategy.scope == 'list' || strategy.scope == 'item') &&\n                currentListItem.hasAttribute(strategy.attributeName)) {\n                strategy.setAttributeOnDowncast(writer, currentListItem.getAttribute(strategy.attributeName), strategy.scope == 'list' ? listViewElement : listItemViewElement, options, currentListItem);\n            }\n        }\n        viewRange = writer.wrap(viewRange, listItemViewElement);\n        viewRange = writer.wrap(viewRange, listViewElement);\n        if (indent == 0) {\n            break;\n        }\n        currentListItem = ListWalker.first(currentListItem, { lowerIndent: true });\n        // There is no list item with lower indent, this means this is a document fragment containing\n        // only a part of nested list (like copy to clipboard) so we don't need to try to wrap it further.\n        if (!currentListItem) {\n            break;\n        }\n    }\n}\n// Returns the function that is responsible for consuming attributes that are set on the model node.\nfunction createAttributesConsumer(attributeNames, strategies) {\n    const nonConsumingAttributes = strategies\n        .filter(strategy => strategy.consume === false)\n        .map(strategy => strategy.attributeName);\n    return (node, consumable) => {\n        const events = [];\n        // Collect all set attributes that are triggering conversion.\n        for (const attributeName of attributeNames) {\n            if (node.hasAttribute(attributeName) && !nonConsumingAttributes.includes(attributeName)) {\n                events.push(`attribute:${attributeName}`);\n            }\n        }\n        if (!events.every(event => consumable.test(node, event) !== false)) {\n            return false;\n        }\n        events.forEach(event => consumable.consume(node, event));\n        return true;\n    };\n}\n// Whether the given item should be rendered as a bogus paragraph.\nfunction shouldUseBogusParagraph(item, attributeNames, blocks = getAllListItemBlocks(item)) {\n    if (!isListItemBlock(item)) {\n        return false;\n    }\n    for (const attributeKey of item.getAttributeKeys()) {\n        // Ignore selection attributes stored on block elements.\n        if (attributeKey.startsWith('selection:') || attributeKey == 'htmlEmptyBlock') {\n            continue;\n        }\n        // Don't use bogus paragraph if there are attributes from other features.\n        if (!attributeNames.includes(attributeKey)) {\n            return false;\n        }\n    }\n    return blocks.length < 2;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/list/listediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Delete } from 'ckeditor5/src/typing.js';\nimport { Enter } from 'ckeditor5/src/enter.js';\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\nimport { ListIndentCommand } from './listindentcommand.js';\nimport { ListCommand } from './listcommand.js';\nimport { ListMergeCommand } from './listmergecommand.js';\nimport { ListSplitCommand } from './listsplitcommand.js';\nimport { ListFormatting } from '../listformatting.js';\nimport { ListUtils } from './listutils.js';\nimport { bogusParagraphCreator, createModelToViewPositionMapper, listItemDowncastConverter, listItemDowncastRemoveConverter, listItemUpcastConverter, reconvertItemsOnDataChange } from './converters.js';\nimport { findAndAddListHeadToMap, fixListIndents, fixListItemIds } from './utils/postfixers.js';\nimport { getAllListItemBlocks, isFirstBlockOfListItem, isLastBlockOfListItem, isSingleListItem, getSelectedBlockObject, isListItemBlock, removeListAttributes, ListItemUid } from './utils/model.js';\nimport { getViewElementIdForListType, getViewElementNameForListType } from './utils/view.js';\nimport { ListWalker, ListBlocksIterable } from './utils/listwalker.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport '../../theme/documentlist.css';\nimport '../../theme/list.css';\n/**\n * A list of base list model attributes.\n */\nconst LIST_BASE_ATTRIBUTES = ['listType', 'listIndent', 'listItemId'];\n/**\n * The editing part of the document-list feature. It handles creating, editing and removing lists and list items.\n */\nexport class ListEditing extends Plugin {\n    /**\n     * The list of registered downcast strategies.\n     */\n    _downcastStrategies = [];\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Enter, Delete, ListUtils, ClipboardPipeline, ListFormatting];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('list.multiBlock', true);\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const multiBlock = editor.config.get('list.multiBlock');\n        if (editor.plugins.has('LegacyListEditing')) {\n            /**\n             * The `List` feature cannot be loaded together with the `LegacyList` plugin.\n             *\n             * @error list-feature-conflict\n             * @param {string} conflictPlugin Name of the plugin.\n             */\n            throw new CKEditorError('list-feature-conflict', this, { conflictPlugin: 'LegacyListEditing' });\n        }\n        model.schema.register('$listItem', { allowAttributes: LIST_BASE_ATTRIBUTES });\n        if (multiBlock) {\n            model.schema.extend('$container', { allowAttributesOf: '$listItem' });\n            model.schema.extend('$block', { allowAttributesOf: '$listItem' });\n            model.schema.extend('$blockObject', { allowAttributesOf: '$listItem' });\n        }\n        else {\n            model.schema.register('listItem', {\n                inheritAllFrom: '$block',\n                allowAttributesOf: '$listItem'\n            });\n        }\n        for (const attribute of LIST_BASE_ATTRIBUTES) {\n            model.schema.setAttributeProperties(attribute, {\n                copyOnReplace: true\n            });\n        }\n        // Register commands.\n        editor.commands.add('numberedList', new ListCommand(editor, 'numbered'));\n        editor.commands.add('bulletedList', new ListCommand(editor, 'bulleted'));\n        editor.commands.add('customNumberedList', new ListCommand(editor, 'customNumbered', { multiLevel: true }));\n        editor.commands.add('customBulletedList', new ListCommand(editor, 'customBulleted', { multiLevel: true }));\n        editor.commands.add('indentList', new ListIndentCommand(editor, 'forward'));\n        editor.commands.add('outdentList', new ListIndentCommand(editor, 'backward'));\n        editor.commands.add('splitListItemBefore', new ListSplitCommand(editor, 'before'));\n        editor.commands.add('splitListItemAfter', new ListSplitCommand(editor, 'after'));\n        if (multiBlock) {\n            editor.commands.add('mergeListItemBackward', new ListMergeCommand(editor, 'backward'));\n            editor.commands.add('mergeListItemForward', new ListMergeCommand(editor, 'forward'));\n        }\n        this._setupDeleteIntegration();\n        this._setupEnterIntegration();\n        this._setupTabIntegration();\n        this._setupClipboardIntegration();\n        this._setupAccessibilityIntegration();\n        this._setupListItemIdConversionStrategy();\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const commands = editor.commands;\n        const indent = commands.get('indent');\n        const outdent = commands.get('outdent');\n        if (indent) {\n            // Priority is high due to integration with `IndentBlock` plugin. We want to indent list first and if it's not possible\n            // user can indent content with `IndentBlock` plugin.\n            indent.registerChildCommand(commands.get('indentList'), { priority: 'high' });\n        }\n        if (outdent) {\n            // Priority is lowest due to integration with `IndentBlock` and `IndentCode` plugins.\n            // First we want to allow user to outdent all indendations from other features then he can oudent list item.\n            outdent.registerChildCommand(commands.get('outdentList'), { priority: 'lowest' });\n        }\n        // Register conversion and model post-fixer after other plugins had a chance to register their attribute strategies.\n        this._setupModelPostFixing();\n        this._setupConversion();\n    }\n    /**\n     * Registers a downcast strategy.\n     *\n     * **Note**: Strategies must be registered in the `Plugin#init()` phase so that it can be applied\n     * in the `ListEditing#afterInit()`.\n     *\n     * @param strategy The downcast strategy to register.\n     */\n    registerDowncastStrategy(strategy) {\n        this._downcastStrategies.push(strategy);\n    }\n    /**\n     * Returns list of model attribute names that should affect downcast conversion.\n     */\n    getListAttributeNames() {\n        return [\n            ...LIST_BASE_ATTRIBUTES,\n            ...this._downcastStrategies.map(strategy => strategy.attributeName)\n        ];\n    }\n    /**\n     * Attaches the listener to the {@link module:engine/view/document~ViewDocument#event:delete} event and handles backspace/delete\n     * keys in and around document lists.\n     */\n    _setupDeleteIntegration() {\n        const editor = this.editor;\n        const mergeBackwardCommand = editor.commands.get('mergeListItemBackward');\n        const mergeForwardCommand = editor.commands.get('mergeListItemForward');\n        this.listenTo(editor.editing.view.document, 'delete', (evt, data) => {\n            const selection = editor.model.document.selection;\n            // Let the Widget plugin take care of block widgets while deleting (https://github.com/ckeditor/ckeditor5/issues/11346).\n            if (getSelectedBlockObject(editor.model)) {\n                return;\n            }\n            editor.model.change(() => {\n                const firstPosition = selection.getFirstPosition();\n                if (selection.isCollapsed && data.direction == 'backward') {\n                    if (!firstPosition.isAtStart) {\n                        return;\n                    }\n                    const positionParent = firstPosition.parent;\n                    if (!isListItemBlock(positionParent)) {\n                        return;\n                    }\n                    const previousBlock = ListWalker.first(positionParent, {\n                        sameAttributes: 'listType',\n                        sameIndent: true\n                    });\n                    // Outdent the first block of a first list item.\n                    if (!previousBlock && positionParent.getAttribute('listIndent') === 0) {\n                        if (!isLastBlockOfListItem(positionParent)) {\n                            editor.execute('splitListItemAfter');\n                        }\n                        editor.execute('outdentList');\n                    }\n                    // Merge block with previous one (on the block level or on the content level).\n                    else {\n                        if (!mergeBackwardCommand || !mergeBackwardCommand.isEnabled) {\n                            return;\n                        }\n                        mergeBackwardCommand.execute({\n                            shouldMergeOnBlocksContentLevel: shouldMergeOnBlocksContentLevel(editor.model, 'backward')\n                        });\n                    }\n                    data.preventDefault();\n                    evt.stop();\n                }\n                // Non-collapsed selection or forward delete.\n                else {\n                    // Collapsed selection should trigger forward merging only if at the end of a block.\n                    if (selection.isCollapsed && !selection.getLastPosition().isAtEnd) {\n                        return;\n                    }\n                    if (!mergeForwardCommand || !mergeForwardCommand.isEnabled) {\n                        return;\n                    }\n                    mergeForwardCommand.execute({\n                        shouldMergeOnBlocksContentLevel: shouldMergeOnBlocksContentLevel(editor.model, 'forward')\n                    });\n                    data.preventDefault();\n                    evt.stop();\n                }\n            });\n        }, { context: 'li' });\n    }\n    /**\n     * Attaches a listener to the {@link module:engine/view/document~ViewDocument#event:enter} event and handles enter key press\n     * in document lists.\n     */\n    _setupEnterIntegration() {\n        const editor = this.editor;\n        const model = editor.model;\n        const commands = editor.commands;\n        const enterCommand = commands.get('enter');\n        // Overwrite the default Enter key behavior: outdent or split the list in certain cases.\n        this.listenTo(editor.editing.view.document, 'enter', (evt, data) => {\n            const doc = model.document;\n            const positionParent = doc.selection.getFirstPosition().parent;\n            if (doc.selection.isCollapsed &&\n                isListItemBlock(positionParent) &&\n                positionParent.isEmpty &&\n                !data.isSoft) {\n                const isFirstBlock = isFirstBlockOfListItem(positionParent);\n                const isLastBlock = isLastBlockOfListItem(positionParent);\n                // * a      →      * a\n                // * []     →      []\n                if (isFirstBlock && isLastBlock) {\n                    editor.execute('outdentList');\n                    data.preventDefault();\n                    evt.stop();\n                }\n                // * []     →      * []\n                //   a      →      * a\n                else if (isFirstBlock && !isLastBlock) {\n                    editor.execute('splitListItemAfter');\n                    data.preventDefault();\n                    evt.stop();\n                }\n                // * a      →      * a\n                //   []     →      * []\n                else if (isLastBlock) {\n                    editor.execute('splitListItemBefore');\n                    data.preventDefault();\n                    evt.stop();\n                }\n            }\n        }, { context: 'li' });\n        // In some cases, after the default block splitting, we want to modify the new block to become a new list item\n        // instead of an additional block in the same list item.\n        this.listenTo(enterCommand, 'afterExecute', () => {\n            const splitCommand = commands.get('splitListItemBefore');\n            // The command has not refreshed because the change block related to EnterCommand#execute() is not over yet.\n            // Let's keep it up to date and take advantage of ListSplitCommand#isEnabled.\n            splitCommand.refresh();\n            if (!splitCommand.isEnabled) {\n                return;\n            }\n            const doc = editor.model.document;\n            const positionParent = doc.selection.getLastPosition().parent;\n            const listItemBlocks = getAllListItemBlocks(positionParent);\n            // Keep in mind this split happens after the default enter handler was executed. For instance:\n            //\n            // │       Initial state       │    After default enter    │   Here in #afterExecute   │\n            // ├───────────────────────────┼───────────────────────────┼───────────────────────────┤\n            // │          * a[]            │           * a             │           * a             │\n            // │                           │             []            │           * []            │\n            if (listItemBlocks.length === 2) {\n                splitCommand.execute();\n            }\n        });\n    }\n    /**\n     * Attaches a listener to the {@link module:engine/view/document~ViewDocument#event:tab} event and handles tab key and tab+shift keys\n     * presses in document lists.\n     */\n    _setupTabIntegration() {\n        const editor = this.editor;\n        this.listenTo(editor.editing.view.document, 'tab', (evt, data) => {\n            const commandName = data.shiftKey ? 'outdentList' : 'indentList';\n            const command = this.editor.commands.get(commandName);\n            if (command.isEnabled) {\n                editor.execute(commandName);\n                data.stopPropagation();\n                data.preventDefault();\n                evt.stop();\n            }\n        }, { context: 'li' });\n    }\n    /**\n     * Registers the conversion helpers for the document-list feature.\n     */\n    _setupConversion() {\n        const editor = this.editor;\n        const model = editor.model;\n        const attributeNames = this.getListAttributeNames();\n        const multiBlock = editor.config.get('list.multiBlock');\n        const elementName = multiBlock ? 'paragraph' : 'listItem';\n        editor.conversion.for('upcast')\n            // Convert <li> to a generic paragraph (or listItem element) so the content of <li> is always inside a block.\n            // Setting the listType attribute to let other features (to-do list) know that this is part of a list item.\n            // This is also important to properly handle simple lists so that paragraphs inside a list item won't break the list item.\n            // <li>  <-- converted to listItem\n            //   <p></p> <-- should be also converted to listItem, so it won't split and replace the listItem generated from the above li.\n            .elementToElement({\n            view: 'li',\n            model: (viewElement, { writer }) => writer.createElement(elementName, { listType: '' })\n        })\n            // Convert paragraph to the list block (without list type defined yet).\n            // This is important to properly handle bogus paragraph and to-do lists.\n            // Most of the time the bogus paragraph should not appear in the data of to-do list,\n            // but if there is any marker or an attribute on the paragraph then the bogus paragraph\n            // is preserved in the data, and we need to be able to detect this case.\n            .elementToElement({\n            view: 'p',\n            model: (viewElement, { writer }) => {\n                if (viewElement.parent && viewElement.parent.is('element', 'li')) {\n                    return writer.createElement(elementName, { listType: '' });\n                }\n                return null;\n            },\n            converterPriority: 'high'\n        })\n            .add(dispatcher => {\n            dispatcher.on('element:li', listItemUpcastConverter());\n        });\n        if (!multiBlock) {\n            editor.conversion.for('downcast')\n                .elementToElement({\n                model: 'listItem',\n                view: 'p'\n            });\n        }\n        editor.conversion.for('editingDowncast')\n            .elementToElement({\n            model: elementName,\n            view: bogusParagraphCreator(attributeNames),\n            converterPriority: 'high'\n        })\n            .add(dispatcher => {\n            dispatcher.on('attribute', listItemDowncastConverter(attributeNames, this._downcastStrategies, model));\n            dispatcher.on('remove', listItemDowncastRemoveConverter(model.schema));\n        });\n        editor.conversion.for('dataDowncast')\n            .elementToElement({\n            model: elementName,\n            view: bogusParagraphCreator(attributeNames, { dataPipeline: true }),\n            converterPriority: 'high'\n        })\n            .add(dispatcher => {\n            dispatcher.on('attribute', listItemDowncastConverter(attributeNames, this._downcastStrategies, model, { dataPipeline: true }));\n        });\n        const modelToViewPositionMapper = createModelToViewPositionMapper(this._downcastStrategies, editor.editing.view);\n        editor.editing.mapper.on('modelToViewPosition', modelToViewPositionMapper);\n        editor.data.mapper.on('modelToViewPosition', modelToViewPositionMapper);\n        this.listenTo(model.document, 'change:data', reconvertItemsOnDataChange(model, editor.editing, attributeNames, this), { priority: 'high' });\n        // For LI verify if an ID of the attribute element is correct.\n        this.on('checkAttributes:item', (evt, { viewElement, modelAttributes }) => {\n            if (viewElement.id != modelAttributes.listItemId) {\n                evt.return = true;\n                evt.stop();\n            }\n        });\n        // For UL and OL check if the name and ID of element is correct.\n        this.on('checkAttributes:list', (evt, { viewElement, modelAttributes }) => {\n            if (viewElement.name != getViewElementNameForListType(modelAttributes.listType) ||\n                viewElement.id != getViewElementIdForListType(modelAttributes.listType, modelAttributes.listIndent)) {\n                evt.return = true;\n                evt.stop();\n            }\n        });\n    }\n    /**\n     * Registers model post-fixers.\n     */\n    _setupModelPostFixing() {\n        const model = this.editor.model;\n        const attributeNames = this.getListAttributeNames();\n        // Register list fixing.\n        // First the low level handler.\n        model.document.registerPostFixer(writer => modelChangePostFixer(model, writer, attributeNames, this));\n        // Then the callbacks for the specific lists.\n        // The indentation fixing must be the first one...\n        this.on('postFixer', (evt, { listNodes, writer }) => {\n            evt.return = fixListIndents(listNodes, writer) || evt.return;\n        }, { priority: 'high' });\n        // ...then the item ids... and after that other fixers that rely on the correct indentation and ids.\n        this.on('postFixer', (evt, { listNodes, writer, seenIds }) => {\n            evt.return = fixListItemIds(listNodes, seenIds, writer) || evt.return;\n        }, { priority: 'high' });\n    }\n    /**\n     * Integrates the feature with the clipboard via {@link module:engine/model/model~Model#insertContent} and\n     * {@link module:engine/model/model~Model#getSelectedContent}.\n     */\n    _setupClipboardIntegration() {\n        const model = this.editor.model;\n        const clipboardPipeline = this.editor.plugins.get('ClipboardPipeline');\n        this.listenTo(model, 'insertContent', createModelIndentPasteFixer(model), { priority: 'high' });\n        // To enhance the UX, the editor should not copy list attributes to the clipboard if the selection\n        // started and ended in the same list item.\n        //\n        // If the selection was enclosed in a single list item, there is a good chance the user did not want it\n        // copied as a list item but plain blocks.\n        //\n        // This avoids pasting orphaned list items instead of paragraphs, for instance, straight into the root.\n        //\n        //\t                       ┌─────────────────────┬───────────────────┐\n        //\t                       │ Selection           │ Clipboard content │\n        //\t                       ├─────────────────────┼───────────────────┤\n        //\t                       │ [* <Widget />]      │ <Widget />        │\n        //\t                       ├─────────────────────┼───────────────────┤\n        //\t                       │ [* Foo]             │ Foo               │\n        //\t                       ├─────────────────────┼───────────────────┤\n        //\t                       │ * Foo [bar] baz     │ bar               │\n        //\t                       ├─────────────────────┼───────────────────┤\n        //\t                       │ * Fo[o              │ o                 │\n        //\t                       │   ba]r              │ ba                │\n        //\t                       ├─────────────────────┼───────────────────┤\n        //\t                       │ * Fo[o              │ * o               │\n        //\t                       │ * ba]r              │ * ba              │\n        //\t                       ├─────────────────────┼───────────────────┤\n        //\t                       │ [* Foo              │ * Foo             │\n        //\t                       │  * bar]             │ * bar             │\n        //\t                       └─────────────────────┴───────────────────┘\n        //\n        // See https://github.com/ckeditor/ckeditor5/issues/11608, https://github.com/ckeditor/ckeditor5/issues/14969\n        this.listenTo(clipboardPipeline, 'outputTransformation', (evt, data) => {\n            model.change(writer => {\n                // Remove last block if it's empty.\n                const allContentChildren = Array.from(data.content.getChildren());\n                const lastItem = allContentChildren[allContentChildren.length - 1];\n                if (allContentChildren.length > 1 && lastItem.is('element') && lastItem.isEmpty) {\n                    const contentChildrenExceptLastItem = allContentChildren.slice(0, -1);\n                    if (contentChildrenExceptLastItem.every(isListItemBlock)) {\n                        writer.remove(lastItem);\n                    }\n                }\n                // Copy/cut only content of a list item (for drag-drop move the whole list item).\n                if (data.method == 'copy' || data.method == 'cut') {\n                    const allChildren = Array.from(data.content.getChildren());\n                    const isSingleListItemSelected = isSingleListItem(allChildren);\n                    if (isSingleListItemSelected) {\n                        removeListAttributes(allChildren, writer);\n                    }\n                }\n            });\n        });\n    }\n    /**\n     * Informs editor accessibility features about keystrokes brought by the plugin.\n     */\n    _setupAccessibilityIntegration() {\n        const editor = this.editor;\n        const t = editor.t;\n        editor.accessibility.addKeystrokeInfoGroup({\n            id: 'list',\n            label: t('Keystrokes that can be used in a list'),\n            keystrokes: [\n                {\n                    label: t('Increase list item indent'),\n                    keystroke: 'Tab'\n                },\n                {\n                    label: t('Decrease list item indent'),\n                    keystroke: 'Shift+Tab'\n                }\n            ]\n        });\n    }\n    /**\n     * Convert `listItemId` attribute to `data-list-item-id` attribute on the view element in both downcast pipelines.\n     */\n    _setupListItemIdConversionStrategy() {\n        this.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'listItemId',\n            setAttributeOnDowncast(writer, attributeValue, viewElement, options) {\n                if (options && (options.skipListItemIds || options.isClipboardPipeline)) {\n                    return;\n                }\n                writer.setAttribute('data-list-item-id', attributeValue, viewElement);\n            }\n        });\n    }\n}\n/**\n * Post-fixer that reacts to changes on document and fixes incorrect model states (invalid `listItemId` and `listIndent` values).\n *\n * In the example below, there is a correct list structure.\n * Then the middle element is removed so the list structure will become incorrect:\n *\n * ```xml\n * <paragraph listType=\"bulleted\" listItemId=\"a\" listIndent=0>Item 1</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"b\" listIndent=1>Item 2</paragraph>   <--- this is removed.\n * <paragraph listType=\"bulleted\" listItemId=\"c\" listIndent=2>Item 3</paragraph>\n * ```\n *\n * The list structure after the middle element is removed:\n *\n * ```xml\n * <paragraph listType=\"bulleted\" listItemId=\"a\" listIndent=0>Item 1</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"c\" listIndent=2>Item 3</paragraph>\n * ```\n *\n * Should become:\n *\n * ```xml\n * <paragraph listType=\"bulleted\" listItemId=\"a\" listIndent=0>Item 1</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"c\" listIndent=1>Item 3</paragraph>   <--- note that indent got post-fixed.\n * ```\n *\n * @param model The data model.\n * @param writer The writer to do changes with.\n * @param attributeNames The list of all model list attributes (including registered strategies).\n * @param ListEditing The document list editing plugin.\n * @returns `true` if any change has been applied, `false` otherwise.\n */\nfunction modelChangePostFixer(model, writer, attributeNames, listEditing) {\n    const changes = model.document.differ.getChanges();\n    const visited = new Set();\n    const itemToListHead = new Set();\n    const multiBlock = listEditing.editor.config.get('list.multiBlock');\n    let applied = false;\n    for (const entry of changes) {\n        if (entry.type == 'insert' && entry.name != '$text') {\n            const item = entry.position.nodeAfter;\n            // Remove attributes in case of renamed element.\n            if (!model.schema.checkAttribute(item, 'listItemId')) {\n                for (const attributeName of Array.from(item.getAttributeKeys())) {\n                    if (attributeNames.includes(attributeName)) {\n                        writer.removeAttribute(attributeName, item);\n                        applied = true;\n                    }\n                }\n            }\n            findAndAddListHeadToMap(entry.position, itemToListHead, visited);\n            // Insert of a non-list item - check if there is a list after it.\n            if (!entry.attributes.has('listItemId')) {\n                findAndAddListHeadToMap(entry.position.getShiftedBy(entry.length), itemToListHead, visited);\n            }\n            // Check if there is no nested list.\n            for (const { item: innerItem, previousPosition } of model.createRangeIn(item)) {\n                if (isListItemBlock(innerItem)) {\n                    findAndAddListHeadToMap(previousPosition, itemToListHead, visited);\n                }\n            }\n        }\n        // Removed list item or block adjacent to a list.\n        else if (entry.type == 'remove') {\n            findAndAddListHeadToMap(entry.position, itemToListHead, visited);\n        }\n        // Changed list item indent or type.\n        else if (entry.type == 'attribute' && attributeNames.includes(entry.attributeKey)) {\n            findAndAddListHeadToMap(entry.range.start, itemToListHead, visited);\n            if (entry.attributeNewValue === null) {\n                findAndAddListHeadToMap(entry.range.start.getShiftedBy(1), itemToListHead, visited);\n            }\n        }\n        // Make sure that there is no left over listItem element without attributes or a block with list attributes that is not a listItem.\n        if (!multiBlock && entry.type == 'attribute' && LIST_BASE_ATTRIBUTES.includes(entry.attributeKey)) {\n            const element = entry.range.start.nodeAfter;\n            if (entry.attributeNewValue === null && element && element.is('element', 'listItem')) {\n                writer.rename(element, 'paragraph');\n                applied = true;\n            }\n            else if (entry.attributeOldValue === null && element && element.is('element') && element.name != 'listItem') {\n                writer.rename(element, 'listItem');\n                applied = true;\n            }\n        }\n    }\n    // Make sure that IDs are not shared by split list.\n    const seenIds = new Set();\n    for (const listHead of itemToListHead.values()) {\n        applied = listEditing.fire('postFixer', {\n            listNodes: new ListBlocksIterable(listHead),\n            listHead,\n            writer,\n            seenIds\n        }) || applied;\n    }\n    return applied;\n}\n/**\n * A fixer for pasted content that includes list items.\n *\n * It fixes indentation of pasted list items so the pasted items match correctly to the context they are pasted into.\n *\n * Example:\n *\n * ```xml\n * <paragraph listType=\"bulleted\" listItemId=\"a\" listIndent=\"0\">A</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"b\" listIndent=\"1\">B^</paragraph>\n * // At ^ paste:  <paragraph listType=\"numbered\" listItemId=\"x\" listIndent=\"0\">X</paragraph>\n * //              <paragraph listType=\"numbered\" listItemId=\"y\" listIndent=\"1\">Y</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"c\" listIndent=\"2\">C</paragraph>\n * ```\n *\n * Should become:\n *\n * ```xml\n * <paragraph listType=\"bulleted\" listItemId=\"a\" listIndent=\"0\">A</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"b\" listIndent=\"1\">BX</paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"y\" listIndent=\"2\">Y/paragraph>\n * <paragraph listType=\"bulleted\" listItemId=\"c\" listIndent=\"2\">C</paragraph>\n * ```\n */\nfunction createModelIndentPasteFixer(model) {\n    return (evt, [content, selectable]) => {\n        const items = content.is('documentFragment') ?\n            Array.from(content.getChildren()) :\n            [content];\n        if (!items.length) {\n            return;\n        }\n        const selection = selectable ?\n            model.createSelection(selectable) :\n            model.document.selection;\n        const position = selection.getFirstPosition();\n        // Get a reference list item. Attributes of the inserted list items will be fixed according to that item.\n        let refItem;\n        if (isListItemBlock(position.parent)) {\n            refItem = position.parent;\n        }\n        else if (isListItemBlock(position.nodeBefore) && isListItemBlock(position.nodeAfter)) {\n            refItem = position.nodeBefore;\n        }\n        else {\n            return; // Content is not copied into a list.\n        }\n        model.change(writer => {\n            const refType = refItem.getAttribute('listType');\n            const refIndent = refItem.getAttribute('listIndent');\n            const firstElementIndent = items[0].getAttribute('listIndent') || 0;\n            const indentDiff = Math.max(refIndent - firstElementIndent, 0);\n            for (const item of items) {\n                const isListItem = isListItemBlock(item);\n                if (refItem.is('element', 'listItem') && item.is('element', 'paragraph')) {\n                    /**\n                     * When paragraphs or a plain text list is pasted into a simple list, convert\n                     * the `<paragraphs>' to `<listItem>' to avoid breaking the target list.\n                     *\n                     * See https://github.com/ckeditor/ckeditor5/issues/13826.\n                     */\n                    writer.rename(item, 'listItem');\n                }\n                writer.setAttributes({\n                    listIndent: (isListItem ? item.getAttribute('listIndent') : 0) + indentDiff,\n                    listItemId: isListItem ? item.getAttribute('listItemId') : ListItemUid.next(),\n                    listType: refType\n                }, item);\n            }\n        });\n    };\n}\n/**\n * Decides whether the merge should be accompanied by the model's `deleteContent()`, for instance, to get rid of the inline\n * content in the selection or take advantage of the heuristics in `deleteContent()` that helps convert lists into paragraphs\n * in certain cases.\n */\nfunction shouldMergeOnBlocksContentLevel(model, direction) {\n    const selection = model.document.selection;\n    if (!selection.isCollapsed) {\n        return !getSelectedBlockObject(model);\n    }\n    if (direction === 'forward') {\n        return true;\n    }\n    const firstPosition = selection.getFirstPosition();\n    const positionParent = firstPosition.parent;\n    const previousSibling = positionParent.previousSibling;\n    if (model.schema.isObject(previousSibling)) {\n        return false;\n    }\n    if (previousSibling.isEmpty) {\n        return true;\n    }\n    return isSingleListItem([positionParent, previousSibling]);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\n/**\n * Helper method for creating toolbar and menu buttons and linking them with an appropriate command.\n *\n * @internal\n * @param editor The editor instance to which the UI component will be added.\n * @param commandName The name of the command.\n * @param label The button label.\n * @param icon The source of the icon.\n */\nexport function createUIComponents(editor, commandName, label, icon) {\n    editor.ui.componentFactory.add(commandName, () => {\n        const buttonView = _createButton(ButtonView, editor, commandName, label, icon);\n        buttonView.set({\n            tooltip: true,\n            isToggleable: true\n        });\n        return buttonView;\n    });\n    editor.ui.componentFactory.add(`menuBar:${commandName}`, () => {\n        const buttonView = _createButton(MenuBarMenuListItemButtonView, editor, commandName, label, icon);\n        buttonView.set({\n            role: 'menuitemcheckbox',\n            isToggleable: true\n        });\n        return buttonView;\n    });\n}\n/**\n * Creates a button to use either in toolbar or in menu bar.\n */\nfunction _createButton(ButtonClass, editor, commandName, label, icon) {\n    const command = editor.commands.get(commandName);\n    const view = new ButtonClass(editor.locale);\n    view.set({\n        label,\n        icon\n    });\n    // Bind button model to command.\n    view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');\n    // Execute the command.\n    view.on('execute', () => {\n        editor.execute(commandName);\n        editor.editing.view.focus();\n    });\n    return view;\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M3.5 3v5H2V3.7H1v-1h2.5zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001q-.073.607-.333.988-.263.381-1.244 1.312H4.3v1h-4zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75m6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/list/listui\n */\nimport { createUIComponents } from './utils.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconBulletedList, IconNumberedList } from 'ckeditor5/src/icons.js';\n/**\n * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that\n * allow to convert paragraphs to and from list items and indent or outdent them.\n */\nexport class ListUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const t = this.editor.t;\n        // Create button numberedList.\n        if (!this.editor.ui.componentFactory.has('numberedList')) {\n            createUIComponents(this.editor, 'numberedList', t('Numbered List'), IconNumberedList);\n        }\n        // Create button bulletedList.\n        if (!this.editor.ui.componentFactory.has('bulletedList')) {\n            createUIComponents(this.editor, 'bulletedList', t('Bulleted List'), IconBulletedList);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize/resizeimagecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The resize image command. Currently, it only supports the width attribute.\n */\nexport class ResizeImageCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const element = imageUtils.getClosestSelectedImageElement(editor.model.document.selection);\n        this.isEnabled = !!element;\n        if (!element || !element.hasAttribute('resizedWidth')) {\n            this.value = null;\n        }\n        else {\n            this.value = {\n                width: element.getAttribute('resizedWidth'),\n                height: null\n            };\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * ```ts\n     * // Sets the width to 50%:\n     * editor.execute( 'resizeImage', { width: '50%' } );\n     *\n     * // Removes the width attribute:\n     * editor.execute( 'resizeImage', { width: null } );\n     * ```\n     *\n     * @param options\n     * @param options.width The new width of the image.\n     * @fires execute\n     */\n    execute(options) {\n        const editor = this.editor;\n        const model = editor.model;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const imageElement = imageUtils.getClosestSelectedImageElement(model.document.selection);\n        this.value = {\n            width: options.width,\n            height: null\n        };\n        if (imageElement) {\n            model.change(writer => {\n                writer.setAttribute('resizedWidth', options.width, imageElement);\n                writer.removeAttribute('resizedHeight', imageElement);\n                imageUtils.setImageNaturalSizeAttributes(imageElement);\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { ResizeImageCommand } from './resizeimagecommand.js';\nimport { widthAndHeightStylesAreBothSet } from '../image/utils.js';\n/**\n * The image resize editing feature.\n *\n * It adds the ability to resize each image using handles or manually by\n * {@link module:image/imageresize/imageresizebuttons~ImageResizeButtons} buttons.\n */\nexport class ImageResizeEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageResizeEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'IR';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('image', {\n            resizeUnit: '%',\n            resizeOptions: [\n                {\n                    name: 'resizeImage:original',\n                    value: null,\n                    icon: 'original'\n                },\n                {\n                    name: 'resizeImage:custom',\n                    value: 'custom',\n                    icon: 'custom'\n                },\n                {\n                    name: 'resizeImage:25',\n                    value: '25',\n                    icon: 'small'\n                },\n                {\n                    name: 'resizeImage:50',\n                    value: '50',\n                    icon: 'medium'\n                },\n                {\n                    name: 'resizeImage:75',\n                    value: '75',\n                    icon: 'large'\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const resizeImageCommand = new ResizeImageCommand(editor);\n        this._registerConverters('imageBlock');\n        this._registerConverters('imageInline');\n        // Register `resizeImage` command and add `imageResize` command as an alias for backward compatibility.\n        editor.commands.add('resizeImage', resizeImageCommand);\n        editor.commands.add('imageResize', resizeImageCommand);\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        this._registerSchema();\n    }\n    _registerSchema() {\n        const schema = this.editor.model.schema;\n        if (this.editor.plugins.has('ImageBlockEditing')) {\n            schema.extend('imageBlock', { allowAttributes: ['resizedWidth', 'resizedHeight'] });\n            schema.setAttributeProperties('resizedWidth', { isFormatting: true });\n            schema.setAttributeProperties('resizedHeight', { isFormatting: true });\n        }\n        if (this.editor.plugins.has('ImageInlineEditing')) {\n            schema.extend('imageInline', { allowAttributes: ['resizedWidth', 'resizedHeight'] });\n            schema.setAttributeProperties('resizedWidth', { isFormatting: true });\n            schema.setAttributeProperties('resizedHeight', { isFormatting: true });\n        }\n    }\n    /**\n     * Registers image resize converters.\n     *\n     * @param imageType The type of the image.\n     */\n    _registerConverters(imageType) {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        // Dedicated converter to propagate image's attribute to the img tag.\n        editor.conversion.for('downcast').add(dispatcher => dispatcher.on(`attribute:resizedWidth:${imageType}`, (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                return;\n            }\n            const viewWriter = conversionApi.writer;\n            const viewImg = conversionApi.mapper.toViewElement(data.item);\n            if (data.attributeNewValue !== null) {\n                viewWriter.setStyle('width', data.attributeNewValue, viewImg);\n                viewWriter.addClass('image_resized', viewImg);\n            }\n            else {\n                viewWriter.removeStyle('width', viewImg);\n                viewWriter.removeClass('image_resized', viewImg);\n            }\n        }));\n        editor.conversion.for('dataDowncast').attributeToAttribute({\n            model: {\n                name: imageType,\n                key: 'resizedHeight'\n            },\n            view: modelAttributeValue => ({\n                key: 'style',\n                value: {\n                    'height': modelAttributeValue\n                }\n            })\n        });\n        editor.conversion.for('editingDowncast').add(dispatcher => dispatcher.on(`attribute:resizedHeight:${imageType}`, (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                return;\n            }\n            const viewWriter = conversionApi.writer;\n            const viewImg = conversionApi.mapper.toViewElement(data.item);\n            const target = imageType === 'imageInline' ? imageUtils.findViewImgElement(viewImg) : viewImg;\n            if (data.attributeNewValue !== null) {\n                viewWriter.setStyle('height', data.attributeNewValue, target);\n            }\n            else {\n                viewWriter.removeStyle('height', target);\n            }\n        }));\n        editor.conversion.for('upcast')\n            .attributeToAttribute({\n            view: {\n                name: imageType === 'imageBlock' ? 'figure' : 'img',\n                styles: {\n                    width: /.+/\n                }\n            },\n            model: {\n                key: 'resizedWidth',\n                value: (viewElement) => {\n                    if (widthAndHeightStylesAreBothSet(viewElement)) {\n                        return null;\n                    }\n                    return viewElement.getStyle('width');\n                }\n            }\n        });\n        editor.conversion.for('upcast')\n            .attributeToAttribute({\n            view: {\n                name: imageType === 'imageBlock' ? 'figure' : 'img',\n                styles: {\n                    height: /.+/\n                }\n            },\n            model: {\n                key: 'resizedHeight',\n                value: (viewElement) => {\n                    if (widthAndHeightStylesAreBothSet(viewElement)) {\n                        return null;\n                    }\n                    return viewElement.getStyle('height');\n                }\n            }\n        });\n        editor.conversion.for('upcast').add(dispatcher => {\n            dispatcher.on(`element:${imageType === 'imageBlock' ? 'figure' : 'img'}`, (evt, data, conversionApi) => {\n                conversionApi.consumable.consume(data.viewItem, { classes: ['image_resized'] });\n            });\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize/imageresizebuttons\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView, DropdownButtonView, UIModel, createDropdown, addListToDropdown } from 'ckeditor5/src/ui.js';\nimport { CKEditorError, Collection } from 'ckeditor5/src/utils.js';\nimport { IconObjectSizeCustom, IconObjectSizeFull, IconObjectSizeLarge, IconObjectSizeMedium, IconObjectSizeSmall } from 'ckeditor5/src/icons.js';\nimport { ImageResizeEditing } from './imageresizeediting.js';\nconst RESIZE_ICONS = /* #__PURE__ */ (() => ({\n    small: IconObjectSizeSmall,\n    medium: IconObjectSizeMedium,\n    large: IconObjectSizeLarge,\n    custom: IconObjectSizeCustom,\n    original: IconObjectSizeFull\n}))();\n/**\n * The image resize buttons plugin.\n *\n * It adds a possibility to resize images using the toolbar dropdown or individual buttons, depending on the plugin configuration.\n */\nexport class ImageResizeButtons extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageResizeEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageResizeButtons';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * The resize unit.\n     * @default '%'\n     */\n    _resizeUnit;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this._resizeUnit = editor.config.get('image.resizeUnit');\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const options = editor.config.get('image.resizeOptions');\n        const command = editor.commands.get('resizeImage');\n        this.bind('isEnabled').to(command);\n        for (const option of options) {\n            this._registerImageResizeButton(option);\n        }\n        this._registerImageResizeDropdown(options);\n    }\n    /**\n     * A helper function that creates a standalone button component for the plugin.\n     *\n     * @param option A model of the resize option.\n     */\n    _registerImageResizeButton(option) {\n        const editor = this.editor;\n        const { name, value, icon } = option;\n        editor.ui.componentFactory.add(name, locale => {\n            const button = new ButtonView(locale);\n            const command = editor.commands.get('resizeImage');\n            const labelText = this._getOptionLabelValue(option, true);\n            if (!RESIZE_ICONS[icon]) {\n                /**\n                 * When configuring {@link module:image/imageconfig~ImageConfig#resizeOptions `config.image.resizeOptions`} for standalone\n                 * buttons, a valid `icon` token must be set for each option.\n                 *\n                 * See all valid options described in the\n                 * {@link module:image/imageconfig~ImageResizeOption plugin configuration}.\n                 *\n                 * @error imageresizebuttons-missing-icon\n                 * @param {module:image/imageconfig~ImageResizeOption} option Invalid image resize option.\n                */\n                throw new CKEditorError('imageresizebuttons-missing-icon', editor, option);\n            }\n            button.set({\n                // Use the `label` property for a verbose description (because of ARIA).\n                label: labelText,\n                icon: RESIZE_ICONS[icon],\n                tooltip: labelText,\n                isToggleable: true\n            });\n            // Bind button to the command.\n            button.bind('isEnabled').to(this);\n            if (editor.plugins.has('ImageCustomResizeUI') && isCustomImageResizeOption(option)) {\n                const customResizeUI = editor.plugins.get('ImageCustomResizeUI');\n                this.listenTo(button, 'execute', () => {\n                    customResizeUI._showForm(this._resizeUnit);\n                });\n            }\n            else {\n                const optionValueWithUnit = value ? value + this._resizeUnit : null;\n                button.bind('isOn').to(command, 'value', command, 'isEnabled', getIsOnButtonCallback(optionValueWithUnit));\n                this.listenTo(button, 'execute', () => {\n                    editor.execute('resizeImage', { width: optionValueWithUnit });\n                });\n            }\n            return button;\n        });\n    }\n    /**\n     * A helper function that creates a dropdown component for the plugin containing all the resize options defined in\n     * the editor configuration.\n     *\n     * @param options An array of configured options.\n     */\n    _registerImageResizeDropdown(options) {\n        const editor = this.editor;\n        const t = editor.t;\n        const originalSizeOption = options.find(option => !option.value);\n        const componentCreator = (locale) => {\n            const command = editor.commands.get('resizeImage');\n            const dropdownView = createDropdown(locale, DropdownButtonView);\n            const dropdownButton = dropdownView.buttonView;\n            const accessibleLabel = t('Resize image');\n            dropdownButton.set({\n                tooltip: accessibleLabel,\n                commandValue: originalSizeOption.value,\n                icon: RESIZE_ICONS.medium,\n                isToggleable: true,\n                label: this._getOptionLabelValue(originalSizeOption),\n                withText: true,\n                class: 'ck-resize-image-button',\n                ariaLabel: accessibleLabel,\n                ariaLabelledBy: undefined\n            });\n            dropdownButton.bind('label').to(command, 'value', commandValue => {\n                if (commandValue && commandValue.width) {\n                    return commandValue.width;\n                }\n                else {\n                    return this._getOptionLabelValue(originalSizeOption);\n                }\n            });\n            dropdownView.bind('isEnabled').to(this);\n            addListToDropdown(dropdownView, () => this._getResizeDropdownListItemDefinitions(options, command), {\n                ariaLabel: t('Image resize list'),\n                role: 'menu'\n            });\n            // Execute command when an item from the dropdown is selected.\n            this.listenTo(dropdownView, 'execute', evt => {\n                if ('onClick' in evt.source) {\n                    evt.source.onClick();\n                }\n                else {\n                    editor.execute(evt.source.commandName, { width: evt.source.commandValue });\n                    editor.editing.view.focus();\n                }\n            });\n            return dropdownView;\n        };\n        // Register `resizeImage` dropdown and add `imageResize` dropdown as an alias for backward compatibility.\n        editor.ui.componentFactory.add('resizeImage', componentCreator);\n        editor.ui.componentFactory.add('imageResize', componentCreator);\n    }\n    /**\n     * A helper function for creating an option label value string.\n     *\n     * @param option A resize option object.\n     * @param forTooltip An optional flag for creating a tooltip label.\n     * @returns A user-defined label combined from the numeric value and the resize unit or the default label\n     * for reset options (`Original`).\n     */\n    _getOptionLabelValue(option, forTooltip = false) {\n        const t = this.editor.t;\n        if (option.label) {\n            return option.label;\n        }\n        else if (forTooltip) {\n            if (isCustomImageResizeOption(option)) {\n                return t('Custom image size');\n            }\n            else if (option.value) {\n                return t('Resize image to %0', option.value + this._resizeUnit);\n            }\n            else {\n                return t('Resize image to the original size');\n            }\n        }\n        else {\n            if (isCustomImageResizeOption(option)) {\n                return t('Custom');\n            }\n            else if (option.value) {\n                return option.value + this._resizeUnit;\n            }\n            else {\n                return t('Original');\n            }\n        }\n    }\n    /**\n     * A helper function that parses the resize options and returns list item definitions ready for use in the dropdown.\n     *\n     * @param options The resize options.\n     * @param command The resize image command.\n     * @returns Dropdown item definitions.\n     */\n    _getResizeDropdownListItemDefinitions(options, command) {\n        const { editor } = this;\n        const itemDefinitions = new Collection();\n        const optionsWithSerializedValues = options.map(option => {\n            if (isCustomImageResizeOption(option)) {\n                return {\n                    ...option,\n                    valueWithUnits: 'custom'\n                };\n            }\n            if (!option.value) {\n                return {\n                    ...option,\n                    valueWithUnits: null\n                };\n            }\n            return {\n                ...option,\n                valueWithUnits: `${option.value}${this._resizeUnit}`\n            };\n        });\n        for (const option of optionsWithSerializedValues) {\n            let definition = null;\n            if (editor.plugins.has('ImageCustomResizeUI') && isCustomImageResizeOption(option)) {\n                const customResizeUI = editor.plugins.get('ImageCustomResizeUI');\n                definition = {\n                    type: 'button',\n                    model: new UIModel({\n                        label: this._getOptionLabelValue(option),\n                        role: 'menuitemradio',\n                        withText: true,\n                        icon: null,\n                        onClick: () => {\n                            customResizeUI._showForm(this._resizeUnit);\n                        }\n                    })\n                };\n                const allDropdownValues = Object.values(optionsWithSerializedValues).map(option => option.valueWithUnits);\n                definition.model.bind('isOn').to(command, 'value', command, 'isEnabled', getIsOnCustomButtonCallback(allDropdownValues));\n            }\n            else {\n                definition = {\n                    type: 'button',\n                    model: new UIModel({\n                        commandName: 'resizeImage',\n                        commandValue: option.valueWithUnits,\n                        label: this._getOptionLabelValue(option),\n                        role: 'menuitemradio',\n                        withText: true,\n                        icon: null\n                    })\n                };\n                definition.model.bind('isOn').to(command, 'value', command, 'isEnabled', getIsOnButtonCallback(option.valueWithUnits));\n            }\n            definition.model.bind('isEnabled').to(command, 'isEnabled');\n            itemDefinitions.add(definition);\n        }\n        return itemDefinitions;\n    }\n}\n/**\n * A helper that checks if provided option triggers custom resize balloon.\n */\nfunction isCustomImageResizeOption(option) {\n    return option.value === 'custom';\n}\n/**\n * A helper function for setting the `isOn` state of buttons in value bindings.\n */\nfunction getIsOnButtonCallback(value) {\n    return (commandValue, isEnabled) => {\n        const objectCommandValue = commandValue;\n        if (objectCommandValue === undefined || !isEnabled) {\n            return false;\n        }\n        if (value === null && objectCommandValue === value) {\n            return true;\n        }\n        return objectCommandValue !== null && objectCommandValue.width === value;\n    };\n}\n/**\n * A helper function for setting the `isOn` state of custom size button in value bindings.\n */\nfunction getIsOnCustomButtonCallback(allDropdownValues) {\n    return (commandValue, isEnabled) => !allDropdownValues.some(dropdownValue => getIsOnButtonCallback(dropdownValue)(commandValue, isEnabled));\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0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.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z\\\"/><path d=\\\"M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2M13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M.95 1.43a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h.75v6.3H.95a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-.65h1.932l1.539-1.5H5v-.95a.95.95 0 0 0-.95-.95H3.2v-6.3h.85A.95.95 0 0 0 5 5.48v-.55h10v.55a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-3.1a.95.95 0 0 0-.95-.95h-3.1a.95.95 0 0 0-.95.95v1.05H5V2.38a.95.95 0 0 0-.95-.95zm.55 3.5v-2h2v2zm0 9.3v2h2v-2zm15-11.3v2h2v-2zM8.139 20.004v-2.388l7.045-7.048 2.391 2.391-7.046 7.046zm11.421-9.101a.6.6 0 0 1-.138.206l-1.165 1.168-2.391-2.391 1.167-1.163a.6.6 0 0 1 .206-.138.6.6 0 0 1 .243-.049.63.63 0 0 1 .449.187l1.491 1.488c.059.059.108.129.138.206s.049.16.049.243a.6.6 0 0 1-.049.243\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2.5 17v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15.5v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm0-2v1h-1v-1zm-19 0v1H0v-1zM14.5 2v1h-1V2zm2 0v1h-1V2zm2 0v1h-1V2zm-8 0v1h-1V2zm-2 0v1h-1V2zm-2 0v1h-1V2zm-2 0v1h-1V2zm8 0v1h-1V2zm-10 0v1h-1V2z\\\"/><path d=\\\"M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2m0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.49.49 0 0 1-.476-.5V4c0-.276.213-.5.476-.5z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { WidgetResize } from 'ckeditor5/src/widget.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { ImageLoadObserver } from '../image/imageloadobserver.js';\nconst RESIZABLE_IMAGES_CSS_SELECTOR = 'figure.image.ck-widget > img,' +\n    'figure.image.ck-widget > picture > img,' +\n    'figure.image.ck-widget > a > img,' +\n    'figure.image.ck-widget > a > picture > img,' +\n    'span.image-inline.ck-widget > img,' +\n    'span.image-inline.ck-widget > picture > img';\nconst RESIZED_IMAGE_CLASS = 'image_resized';\n/**\n * The image resize by handles feature.\n *\n * It adds the ability to resize each image using handles or manually by\n * {@link module:image/imageresize/imageresizebuttons~ImageResizeButtons} buttons.\n */\nexport class ImageResizeHandles extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [WidgetResize, ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageResizeHandles';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const command = this.editor.commands.get('resizeImage');\n        this.bind('isEnabled').to(command);\n        this._setupResizerCreator();\n    }\n    /**\n     * Attaches the listeners responsible for creating a resizer for each image, except for images inside the HTML embed preview.\n     */\n    _setupResizerCreator() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        editingView.addObserver(ImageLoadObserver);\n        this.listenTo(editingView.document, 'imageLoaded', (evt, domEvent) => {\n            // The resizer must be attached only to images loaded by the `ImageInsert`, `ImageUpload` or `LinkImage` plugins.\n            if (!domEvent.target.matches(RESIZABLE_IMAGES_CSS_SELECTOR)) {\n                return;\n            }\n            const domConverter = editor.editing.view.domConverter;\n            const imageView = domConverter.domToView(domEvent.target);\n            const widgetView = imageUtils.getImageWidgetFromImageView(imageView);\n            let resizer = this.editor.plugins.get(WidgetResize).getResizerByViewElement(widgetView);\n            if (resizer) {\n                // There are rare cases when the image will be triggered multiple times for the same widget, e.g. when\n                // the image's source was changed after upload (https://github.com/ckeditor/ckeditor5/pull/8108#issuecomment-708302992).\n                resizer.redraw();\n                return;\n            }\n            const mapper = editor.editing.mapper;\n            const imageModel = mapper.toModelElement(widgetView);\n            resizer = editor.plugins\n                .get(WidgetResize)\n                .attachTo({\n                unit: editor.config.get('image.resizeUnit'),\n                modelElement: imageModel,\n                viewElement: widgetView,\n                editor,\n                getHandleHost(domWidgetElement) {\n                    return domWidgetElement.querySelector('img');\n                },\n                getResizeHost() {\n                    return domConverter.mapViewToDom(mapper.toViewElement(imageModel));\n                },\n                isCentered() {\n                    const imageStyle = imageModel.getAttribute('imageStyle');\n                    return imageStyle == 'alignCenter';\n                },\n                onCommit(newValue) {\n                    // Get rid of the CSS class in case the command execution that follows is unsuccessful\n                    // (e.g. Track Changes can override it and the new dimensions will not apply). Otherwise,\n                    // the presence of the class and the absence of the width style will cause it to take 100%\n                    // of the horizontal space.\n                    editingView.change(writer => {\n                        writer.removeClass(RESIZED_IMAGE_CLASS, widgetView);\n                    });\n                    editor.execute('resizeImage', { width: newValue });\n                }\n            });\n            resizer.on('updateSize', () => {\n                if (!widgetView.hasClass(RESIZED_IMAGE_CLASS)) {\n                    editingView.change(writer => {\n                        writer.addClass(RESIZED_IMAGE_CLASS, widgetView);\n                    });\n                }\n                const target = imageModel.name === 'imageInline' ? imageView : widgetView;\n                if (target.getStyle('height')) {\n                    editingView.change(writer => {\n                        writer.removeStyle('height', target);\n                    });\n                }\n            });\n            resizer.bind('isEnabled').to(this);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize/utils/tryparsedimensionwithunit\n */\n/**\n * Parses provided string with dimension value and returns extracted numeric value and unit.\n *\n * \t* If non-string dimension is passed then `null` value is returned.\n * \t* If unit is missing then `null` is returned.\n * \t* If numeric value part of string is not a number then `null` is returned.\n *\n * Example:\n * \t`\"222px\"` => `{ value: 222, unit: \"px\" }`\n *\t`\"99%\"` => `{ value: 99, unit: \"%\" }`\n\n * @param dimension Unsafe string with dimension.\n * @returns Parsed dimension with extracted numeric value and units.\n * @internal\n */\nexport function tryParseDimensionWithUnit(dimension) {\n    if (!dimension) {\n        return null;\n    }\n    const [, rawValue, unit] = dimension.trim().match(/([.,\\d]+)(%|px)$/) || [];\n    const parsedValue = Number.parseFloat(rawValue);\n    if (Number.isNaN(parsedValue)) {\n        return null;\n    }\n    return {\n        value: parsedValue,\n        unit\n    };\n}\n/**\n * Converts dimension between `px` -> `%` and `%` -> `px`.\n *\n * @param parentDimensionPx\tDimension of parent element that contains measured element.\n * @param dimension Measured element dimension.\n * @returns Casted dimension.\n * @internal\n */\nexport function tryCastDimensionsToUnit(parentDimensionPx, dimension, targetUnit) {\n    // \"%\" -> \"px\" conversion\n    if (targetUnit === 'px') {\n        return {\n            value: dimension.value,\n            unit: 'px'\n        };\n    }\n    // \"px\" -> \"%\" conversion\n    return {\n        value: dimension.value / parentDimensionPx * 100,\n        unit: '%'\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Finds model, view and DOM element for selected image element. Returns `null` if there is no image selected.\n *\n * @param editor Editor instance.\n * @internal\n */\nexport function getSelectedImageEditorNodes(editor) {\n    const { editing } = editor;\n    const imageUtils = editor.plugins.get('ImageUtils');\n    const imageModelElement = imageUtils.getClosestSelectedImageElement(editor.model.document.selection);\n    if (!imageModelElement) {\n        return null;\n    }\n    const imageViewElement = editing.mapper.toViewElement(imageModelElement);\n    const imageDOMElement = editing.view.domConverter.mapViewToDom(imageViewElement);\n    return {\n        model: imageModelElement,\n        view: imageViewElement,\n        dom: imageDOMElement\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize/ui/imagecustomresizeformview\n */\nimport { ButtonView, FocusCycler, FormHeaderView, FormRowView, LabeledFieldView, View, ViewCollection, createLabeledInputNumber, submitHandler } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { IconPreviousArrow } from 'ckeditor5/src/icons.js';\nimport '../../../theme/imagecustomresizeform.css';\n// See: #8833.\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/form/form.css';\n/**\n * The ImageCustomResizeFormView class.\n *\n * @internal\n */\nexport class ImageCustomResizeFormView extends View {\n    /**\n     * Tracks information about the DOM focus in the form.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * Resize unit shortcut.\n     */\n    unit;\n    /**\n     * The Back button view displayed in the header.\n     */\n    backButtonView;\n    /**\n     * A button used to submit the form.\n     */\n    saveButtonView;\n    /**\n     * An input with a label.\n     */\n    labeledInput;\n    /**\n     * A collection of child views.\n     */\n    children;\n    /**\n     * A collection of views which can be focused in the form.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * An array of form validators used by {@link #isValid}.\n     */\n    _validators;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale, unit, validators) {\n        super(locale);\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.unit = unit;\n        // Create buttons.\n        this.backButtonView = this._createBackButton();\n        this.saveButtonView = this._createSaveButton();\n        // Create input fields.\n        this.labeledInput = this._createLabeledInputView();\n        this.children = this.createCollection([this._createHeaderView()]);\n        this.children.add(new FormRowView(locale, {\n            children: [\n                this.labeledInput,\n                this.saveButtonView\n            ],\n            class: [\n                'ck-form__row_with-submit',\n                'ck-form__row_large-top-padding'\n            ]\n        }));\n        this._focusables = new ViewCollection();\n        this._validators = validators;\n        // Close the panel on esc key press when the **form has focus**.\n        this.keystrokes.set('Esc', (data, cancel) => {\n            this.fire('cancel');\n            cancel();\n        });\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form',\n                    'ck-image-custom-resize-form',\n                    'ck-responsive-form'\n                ],\n                // https://github.com/ckeditor/ckeditor5-image/issues/40\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({\n            view: this\n        });\n        const childViews = [\n            this.backButtonView,\n            this.labeledInput,\n            this.saveButtonView\n        ];\n        childViews.forEach(v => {\n            // Register the view as focusable.\n            this._focusables.add(v);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(v.element);\n        });\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Creates a back button view that cancels the form.\n     */\n    _createBackButton() {\n        const t = this.locale.t;\n        const backButton = new ButtonView(this.locale);\n        backButton.set({\n            class: 'ck-button-back',\n            label: t('Back'),\n            icon: IconPreviousArrow,\n            tooltip: true\n        });\n        backButton.delegate('execute').to(this, 'cancel');\n        return backButton;\n    }\n    /**\n     * Creates a save button view that resize the image.\n     */\n    _createSaveButton() {\n        const t = this.locale.t;\n        const saveButton = new ButtonView(this.locale);\n        saveButton.set({\n            label: t('Save'),\n            withText: true,\n            type: 'submit',\n            class: 'ck-button-action ck-button-bold'\n        });\n        return saveButton;\n    }\n    /**\n     * Creates a header view for the form.\n     */\n    _createHeaderView() {\n        const t = this.locale.t;\n        const header = new FormHeaderView(this.locale, {\n            label: t('Image Resize')\n        });\n        header.children.add(this.backButtonView, 0);\n        return header;\n    }\n    /**\n     * Creates an input with a label.\n     *\n     * @returns Labeled field view instance.\n     */\n    _createLabeledInputView() {\n        const t = this.locale.t;\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputNumber);\n        labeledInput.label = t('Resize image (in %0)', this.unit);\n        labeledInput.class = 'ck-labeled-field-view_full-width';\n        labeledInput.fieldView.set({\n            step: 0.1\n        });\n        return labeledInput;\n    }\n    /**\n     * Validates the form and returns `false` when some fields are invalid.\n     */\n    isValid() {\n        this.resetFormStatus();\n        for (const validator of this._validators) {\n            const errorText = validator(this);\n            // One error per field is enough.\n            if (errorText) {\n                // Apply updated error.\n                this.labeledInput.errorText = errorText;\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Cleans up the supplementary error and information text of the {@link #labeledInput}\n     * bringing them back to the state when the form has been displayed for the first time.\n     *\n     * See {@link #isValid}.\n     */\n    resetFormStatus() {\n        this.labeledInput.errorText = null;\n    }\n    /**\n     * The native DOM `value` of the input element of {@link #labeledInput}.\n     */\n    get rawSize() {\n        const { element } = this.labeledInput.fieldView;\n        if (!element) {\n            return null;\n        }\n        return element.value;\n    }\n    /**\n     * Get numeric value of size. Returns `null` if value of size input element in {@link #labeledInput}.is not a number.\n     */\n    get parsedSize() {\n        const { rawSize } = this;\n        if (rawSize === null) {\n            return null;\n        }\n        const parsed = Number.parseFloat(rawSize);\n        if (Number.isNaN(parsed)) {\n            return null;\n        }\n        return parsed;\n    }\n    /**\n     * Returns serialized image input size with unit.\n     * Returns `null` if value of size input element in {@link #labeledInput}.is not a number.\n     */\n    get sizeWithUnits() {\n        const { parsedSize, unit } = this;\n        if (parsedSize === null) {\n            return null;\n        }\n        return `${parsedSize}${unit}`;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize/imagecustomresizeui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ContextualBalloon, clickOutsideHandler, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';\nimport { getBalloonPositionData } from '../image/ui/utils.js';\nimport { getSelectedImageWidthInUnits } from './utils/getselectedimagewidthinunits.js';\nimport { ImageCustomResizeFormView } from './ui/imagecustomresizeformview.js';\nimport { getSelectedImagePossibleResizeRange } from './utils/getselectedimagepossibleresizerange.js';\n/**\n * The custom resize image UI plugin.\n *\n * The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.\n */\nexport class ImageCustomResizeUI extends Plugin {\n    /**\n     * The contextual balloon plugin instance.\n     */\n    _balloon;\n    /**\n     * A form containing a textarea and buttons, used to change the `alt` text value.\n     */\n    _form;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageCustomResizeUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        // Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).\n        if (this._form) {\n            this._form.destroy();\n        }\n    }\n    /**\n     * Creates the {@link module:image/imageresize/ui/imagecustomresizeformview~ImageCustomResizeFormView}\n     * form.\n     */\n    _createForm(unit) {\n        const editor = this.editor;\n        this._balloon = this.editor.plugins.get('ContextualBalloon');\n        this._form = new (CssTransitionDisablerMixin(ImageCustomResizeFormView))(editor.locale, unit, getFormValidators(editor));\n        // Render the form so its #element is available for clickOutsideHandler.\n        this._form.render();\n        this.listenTo(this._form, 'submit', () => {\n            if (this._form.isValid()) {\n                editor.execute('resizeImage', {\n                    width: this._form.sizeWithUnits\n                });\n                this._hideForm(true);\n            }\n        });\n        // Update balloon position when form error label is added .\n        this.listenTo(this._form.labeledInput, 'change:errorText', () => {\n            editor.ui.update();\n        });\n        this.listenTo(this._form, 'cancel', () => {\n            this._hideForm(true);\n        });\n        // Close on click outside of balloon panel element.\n        clickOutsideHandler({\n            emitter: this._form,\n            activator: () => this._isVisible,\n            contextElements: () => [this._balloon.view.element],\n            callback: () => this._hideForm()\n        });\n    }\n    /**\n     * Shows the {@link #_form} in the {@link #_balloon}.\n     *\n     * @internal\n     */\n    _showForm(unit) {\n        if (this._isVisible) {\n            return;\n        }\n        if (!this._form) {\n            this._createForm(unit);\n        }\n        const editor = this.editor;\n        const labeledInput = this._form.labeledInput;\n        this._form.disableCssTransitions();\n        this._form.resetFormStatus();\n        if (!this._isInBalloon) {\n            this._balloon.add({\n                view: this._form,\n                position: getBalloonPositionData(editor)\n            });\n        }\n        // Make sure that each time the panel shows up, the field remains in sync with the value of\n        // the command. If the user typed in the input, then canceled the balloon (`labeledInput#value`\n        // stays unaltered) and re-opened it without changing the value of the command, they would see the\n        // old value instead of the actual value of the command.\n        const currentParsedWidth = getSelectedImageWidthInUnits(editor, unit);\n        const initialInputValue = currentParsedWidth ? currentParsedWidth.value.toFixed(1) : '';\n        const possibleRange = getSelectedImagePossibleResizeRange(editor, unit);\n        labeledInput.fieldView.value = labeledInput.fieldView.element.value = initialInputValue;\n        if (possibleRange) {\n            Object.assign(labeledInput.fieldView, {\n                min: possibleRange.lower.toFixed(1),\n                max: Math.ceil(possibleRange.upper).toFixed(1)\n            });\n        }\n        this._form.labeledInput.fieldView.select();\n        this._form.enableCssTransitions();\n    }\n    /**\n     * Removes the {@link #_form} from the {@link #_balloon}.\n     *\n     * @param focusEditable Controls whether the editing view is focused afterwards.\n     */\n    _hideForm(focusEditable = false) {\n        if (!this._isInBalloon) {\n            return;\n        }\n        // Blur the input element before removing it from DOM to prevent issues in some browsers.\n        // See https://github.com/ckeditor/ckeditor5/issues/1501.\n        if (this._form.focusTracker.isFocused) {\n            this._form.saveButtonView.focus();\n        }\n        this._balloon.remove(this._form);\n        if (focusEditable) {\n            this.editor.editing.view.focus();\n        }\n    }\n    /**\n     * Returns `true` when the {@link #_form} is the visible view in the {@link #_balloon}.\n     */\n    get _isVisible() {\n        return !!this._balloon && this._balloon.visibleView === this._form;\n    }\n    /**\n     * Returns `true` when the {@link #_form} is in the {@link #_balloon}.\n     */\n    get _isInBalloon() {\n        return !!this._balloon && this._balloon.hasView(this._form);\n    }\n}\n/**\n * Returns image resize form validation callbacks.\n *\n * @param editor Editor instance.\n */\nfunction getFormValidators(editor) {\n    const t = editor.t;\n    return [\n        form => {\n            if (form.rawSize.trim() === '') {\n                return t('The value must not be empty.');\n            }\n            if (form.parsedSize === null) {\n                return t('The value should be a plain number.');\n            }\n        }\n    ];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize/utils/getselectedimagewidthinunits\n */\nimport { Rect } from 'ckeditor5/src/utils.js';\nimport { calculateResizeHostAncestorWidth } from 'ckeditor5/src/widget.js';\nimport { tryCastDimensionsToUnit, tryParseDimensionWithUnit } from './tryparsedimensionwithunit.js';\nimport { getSelectedImageEditorNodes } from './getselectedimageeditornodes.js';\n/**\n * Returns image width in specified units. It is width of image after resize.\n *\n * \t* If image is not selected or command is disabled then `null` will be returned.\n * \t* If image is not fully loaded (and it is impossible to determine its natural size) then `null` will be returned.\n *\t* If `targetUnit` percentage is passed then it will return width percentage of image related to its accessors.\n *\n * @param editor Editor instance.\n * @param targetUnit Unit in which dimension will be returned.\n * @returns Parsed image width after resize (with unit).\n * @internal\n */\nexport function getSelectedImageWidthInUnits(editor, targetUnit) {\n    const imageNodes = getSelectedImageEditorNodes(editor);\n    if (!imageNodes) {\n        return null;\n    }\n    const parsedResizedWidth = tryParseDimensionWithUnit(imageNodes.model.getAttribute('resizedWidth') || null);\n    if (!parsedResizedWidth) {\n        return null;\n    }\n    if (parsedResizedWidth.unit === targetUnit) {\n        return parsedResizedWidth;\n    }\n    const imageParentWidthPx = calculateResizeHostAncestorWidth(imageNodes.dom);\n    const imageHolderDimension = {\n        unit: 'px',\n        value: new Rect(imageNodes.dom).width\n    };\n    return tryCastDimensionsToUnit(imageParentWidthPx, imageHolderDimension, targetUnit);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { calculateResizeHostAncestorWidth } from 'ckeditor5/src/widget.js';\nimport { getSelectedImageEditorNodes } from './getselectedimageeditornodes.js';\nimport { tryCastDimensionsToUnit, tryParseDimensionWithUnit } from './tryparsedimensionwithunit.js';\n/**\n * Returns min and max value of resize image in specified unit.\n *\n * @param editor Editor instance.\n * @param targetUnit Unit in which dimension will be returned.\n * @returns Possible resize range in numeric form.\n * @internal\n */\nexport function getSelectedImagePossibleResizeRange(editor, targetUnit) {\n    const imageNodes = getSelectedImageEditorNodes(editor);\n    if (!imageNodes) {\n        return null;\n    }\n    const imageParentWidthPx = calculateResizeHostAncestorWidth(imageNodes.dom);\n    const minimumImageWidth = tryParseDimensionWithUnit(window.getComputedStyle(imageNodes.dom).minWidth) || {\n        value: 1,\n        unit: 'px'\n    };\n    const lower = Math.max(0.1, tryCastDimensionsToUnit(imageParentWidthPx, minimumImageWidth, targetUnit).value);\n    const upper = targetUnit === 'px' ? imageParentWidthPx : 100;\n    return {\n        unit: targetUnit,\n        lower,\n        upper\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { CKEditorError, logWarning } from 'ckeditor5/src/utils.js';\n/**\n * @module alignment/utils\n */\n/**\n * The list of supported alignment options:\n *\n * * `'left'`,\n * * `'right'`,\n * * `'center'`,\n * * `'justify'`\n *\n * @internal\n */\nexport const supportedOptions = ['left', 'right', 'center', 'justify'];\n/**\n * Checks whether the passed option is supported by {@link module:alignment/alignmentediting~AlignmentEditing}.\n *\n * @internal\n * @param option The option value to check.\n */\nexport function isSupported(option) {\n    return supportedOptions.includes(option);\n}\n/**\n * Checks whether alignment is the default one considering the direction\n * of the editor content.\n *\n * @internal\n * @param alignment The name of the alignment to check.\n * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n */\nexport function isDefault(alignment, locale) {\n    // Right now only LTR is supported so the 'left' value is always the default one.\n    if (locale.contentLanguageDirection == 'rtl') {\n        return alignment === 'right';\n    }\n    else {\n        return alignment === 'left';\n    }\n}\n/**\n * Brings the configuration to the common form, an array of objects.\n *\n * @internal\n * @param configuredOptions Alignment plugin configuration.\n * @returns Normalized object holding the configuration.\n */\nexport function normalizeAlignmentOptions(configuredOptions) {\n    const normalizedOptions = configuredOptions\n        .map(option => {\n        let result;\n        if (typeof option == 'string') {\n            result = { name: option };\n        }\n        else {\n            result = option;\n        }\n        return result;\n    })\n        // Remove all unknown options.\n        .filter(option => {\n        const isNameValid = supportedOptions.includes(option.name);\n        if (!isNameValid) {\n            /**\n             * The `name` in one of the `alignment.options` is not recognized.\n             * The available options are: `'left'`, `'right'`, `'center'` and `'justify'`.\n             *\n             * @error alignment-config-name-not-recognized\n             * @param {object} option Options with unknown value of the `name` property.\n             */\n            logWarning('alignment-config-name-not-recognized', { option });\n        }\n        return isNameValid;\n    });\n    const classNameCount = normalizedOptions.filter(option => Boolean(option.className)).length;\n    // We either use classes for all styling options or for none.\n    if (classNameCount && classNameCount < normalizedOptions.length) {\n        /**\n         * The `className` property has to be defined for all options once at least one option declares `className`.\n         *\n         * @error alignment-config-classnames-are-missing\n         * @param {object} configuredOptions Contents of `alignment.options`.\n         */\n        throw new CKEditorError('alignment-config-classnames-are-missing', { configuredOptions });\n    }\n    // Validate resulting config.\n    normalizedOptions.forEach((option, index, allOptions) => {\n        const succeedingOptions = allOptions.slice(index + 1);\n        const nameAlreadyExists = succeedingOptions.some(item => item.name == option.name);\n        if (nameAlreadyExists) {\n            /**\n             * The same `name` in one of the `alignment.options` was already declared.\n             * Each `name` representing one alignment option can be set exactly once.\n             *\n             * @error alignment-config-name-already-defined\n             * @param {object} option First option that declares given `name`.\n             * @param {object} configuredOptions Contents of `alignment.options`.\n             */\n            throw new CKEditorError('alignment-config-name-already-defined', { option, configuredOptions });\n        }\n        // The `className` property is present. Check for duplicates then.\n        if (option.className) {\n            const classNameAlreadyExists = succeedingOptions.some(item => item.className == option.className);\n            if (classNameAlreadyExists) {\n                /**\n                 * The same `className` in one of the `alignment.options` was already declared.\n                 *\n                 * @error alignment-config-classname-already-defined\n                 * @param {object} option First option that declares given `className`.\n                 * @param {object} configuredOptions\n                 * Contents of `alignment.options`.\n                 */\n                throw new CKEditorError('alignment-config-classname-already-defined', { option, configuredOptions });\n            }\n        }\n    });\n    return normalizedOptions;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module alignment/alignmentcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { isDefault } from './utils.js';\nconst ALIGNMENT = 'alignment';\n/**\n * The alignment command plugin.\n */\nexport class AlignmentCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const firstBlock = first(this.editor.model.document.selection.getSelectedBlocks());\n        // As first check whether to enable or disable the command as the value will always be false if the command cannot be enabled.\n        this.isEnabled = Boolean(firstBlock) && this._canBeAligned(firstBlock);\n        if (this.isEnabled && firstBlock.hasAttribute('alignment')) {\n            this.value = firstBlock.getAttribute('alignment');\n        }\n        else {\n            this.value = locale.contentLanguageDirection === 'rtl' ? 'right' : 'left';\n        }\n    }\n    /**\n     * Executes the command. Applies the alignment `value` to the selected blocks.\n     * If no `value` is passed, the `value` is the default one or it is equal to the currently selected block's alignment attribute,\n     * the command will remove the attribute from the selected blocks.\n     *\n     * @param options Options for the executed command.\n     * @param options.value The value to apply.\n     * @fires execute\n     */\n    execute(options = {}) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const model = editor.model;\n        const doc = model.document;\n        const value = options.value;\n        model.change(writer => {\n            // Get only those blocks from selected that can have alignment set\n            const blocks = Array.from(doc.selection.getSelectedBlocks()).filter(block => this._canBeAligned(block));\n            const currentAlignment = blocks[0].getAttribute('alignment');\n            // Remove alignment attribute if current alignment is:\n            // - default (should not be stored in model as it will bloat model data)\n            // - equal to currently set\n            // - or no value is passed - denotes default alignment.\n            const removeAlignment = isDefault(value, locale) || currentAlignment === value || !value;\n            if (removeAlignment) {\n                removeAlignmentFromSelection(blocks, writer);\n            }\n            else {\n                setAlignmentOnSelection(blocks, writer, value);\n            }\n        });\n    }\n    /**\n     * Checks whether a block can have alignment set.\n     *\n     * @param block The block to be checked.\n     */\n    _canBeAligned(block) {\n        return this.editor.model.schema.checkAttribute(block, ALIGNMENT);\n    }\n}\n/**\n * Removes the alignment attribute from blocks.\n */\nfunction removeAlignmentFromSelection(blocks, writer) {\n    for (const block of blocks) {\n        writer.removeAttribute(ALIGNMENT, block);\n    }\n}\n/**\n * Sets the alignment attribute on blocks.\n */\nfunction setAlignmentOnSelection(blocks, writer, alignment) {\n    for (const block of blocks) {\n        writer.setAttribute(ALIGNMENT, alignment, block);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module alignment/alignmentediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AlignmentCommand } from './alignmentcommand.js';\nimport { isDefault, isSupported, normalizeAlignmentOptions, supportedOptions } from './utils.js';\n/**\n * The alignment editing feature. It introduces the {@link module:alignment/alignmentcommand~AlignmentCommand command} and adds\n * the `alignment` attribute for block elements in the {@link module:engine/model/model~Model model}.\n */\nexport class AlignmentEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'AlignmentEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('alignment', {\n            options: supportedOptions.map(option => ({ name: option }))\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const schema = editor.model.schema;\n        const options = normalizeAlignmentOptions(editor.config.get('alignment.options'));\n        // Filter out unsupported options and those that are redundant, e.g. `left` in LTR / `right` in RTL mode.\n        const optionsToConvert = options.filter(option => isSupported(option.name) && !isDefault(option.name, locale));\n        // Once there is at least one `className` defined, we switch to alignment with classes.\n        const shouldUseClasses = optionsToConvert.some(option => !!option.className);\n        // Allow alignment attribute on all blocks.\n        schema.extend('$block', { allowAttributes: 'alignment' });\n        editor.model.schema.setAttributeProperties('alignment', { isFormatting: true });\n        if (shouldUseClasses) {\n            editor.conversion.attributeToAttribute(buildClassDefinition(optionsToConvert));\n        }\n        else {\n            // Downcast inline styles.\n            editor.conversion.for('downcast').attributeToAttribute(buildDowncastInlineDefinition(optionsToConvert));\n        }\n        const upcastInlineDefinitions = buildUpcastInlineDefinitions(optionsToConvert);\n        // Always upcast from inline styles.\n        for (const definition of upcastInlineDefinitions) {\n            editor.conversion.for('upcast').attributeToAttribute(definition);\n        }\n        const upcastCompatibilityDefinitions = buildUpcastCompatibilityDefinitions(optionsToConvert);\n        // Always upcast from deprecated `align` attribute.\n        for (const definition of upcastCompatibilityDefinitions) {\n            editor.conversion.for('upcast').attributeToAttribute(definition);\n        }\n        editor.commands.add('alignment', new AlignmentCommand(editor));\n    }\n}\n/**\n * Prepare downcast conversion definition for inline alignment styling.\n */\nfunction buildDowncastInlineDefinition(options) {\n    const view = {};\n    for (const { name } of options) {\n        view[name] = {\n            key: 'style',\n            value: {\n                'text-align': name\n            }\n        };\n    }\n    const definition = {\n        model: {\n            key: 'alignment',\n            values: options.map(option => option.name)\n        },\n        view\n    };\n    return definition;\n}\n/**\n * Prepare upcast definitions for inline alignment styles.\n */\nfunction buildUpcastInlineDefinitions(options) {\n    const definitions = [];\n    for (const { name } of options) {\n        definitions.push({\n            view: {\n                key: 'style',\n                value: {\n                    'text-align': name\n                }\n            },\n            model: {\n                key: 'alignment',\n                value: name\n            }\n        });\n    }\n    return definitions;\n}\n/**\n * Prepare upcast definitions for deprecated `align` attribute.\n */\nfunction buildUpcastCompatibilityDefinitions(options) {\n    const definitions = [];\n    for (const { name } of options) {\n        definitions.push({\n            view: {\n                key: 'align',\n                value: name\n            },\n            model: {\n                key: 'alignment',\n                value: name\n            }\n        });\n    }\n    return definitions;\n}\n/**\n * Prepare conversion definitions for upcast and downcast alignment with classes.\n */\nfunction buildClassDefinition(options) {\n    const view = {};\n    for (const option of options) {\n        view[option.name] = {\n            key: 'class',\n            value: option.className\n        };\n    }\n    const definition = {\n        model: {\n            key: 'alignment',\n            values: options.map(option => option.name)\n        },\n        view\n    };\n    return definition;\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75m0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75m0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75m0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module alignment/alignmentui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView, createDropdown, addToolbarToDropdown, MenuBarMenuListItemView, MenuBarMenuListItemButtonView, MenuBarMenuView, MenuBarMenuListView } from 'ckeditor5/src/ui.js';\nimport { IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignRight } from 'ckeditor5/src/icons.js';\nimport { isSupported, normalizeAlignmentOptions } from './utils.js';\nconst iconsMap = /* #__PURE__ */ (() => new Map([\n    ['left', IconAlignLeft],\n    ['right', IconAlignRight],\n    ['center', IconAlignCenter],\n    ['justify', IconAlignJustify]\n]))();\n/**\n * The default alignment UI plugin.\n *\n * It introduces the `'alignment:left'`, `'alignment:right'`, `'alignment:center'` and `'alignment:justify'` buttons\n * and the `'alignment'` dropdown.\n */\nexport class AlignmentUI extends Plugin {\n    /**\n     * Returns the localized option titles provided by the plugin.\n     *\n     * The following localized titles corresponding with\n     * {@link module:alignment/alignmentconfig~AlignmentConfig#options} are available:\n     *\n     * * `'left'`,\n     * * `'right'`,\n     * * `'center'`,\n     * * `'justify'`.\n     *\n     * @readonly\n     */\n    get localizedOptionTitles() {\n        const t = this.editor.t;\n        return {\n            'left': t('Align left'),\n            'right': t('Align right'),\n            'center': t('Align center'),\n            'justify': t('Justify')\n        };\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'AlignmentUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const options = normalizeAlignmentOptions(editor.config.get('alignment.options'));\n        options\n            .map(option => option.name)\n            .filter(isSupported)\n            .forEach(option => this._addButton(option));\n        this._addToolbarDropdown(options);\n        this._addMenuBarMenu(options);\n    }\n    /**\n     * Helper method for initializing the button and linking it with an appropriate command.\n     *\n     * @param option The name of the alignment option for which the button is added.\n     */\n    _addButton(option) {\n        const editor = this.editor;\n        editor.ui.componentFactory.add(`alignment:${option}`, locale => this._createButton(locale, option));\n    }\n    /**\n     * Helper method for creating the button view element.\n     *\n     * @param locale Editor locale.\n     * @param option The name of the alignment option for which the button is added.\n     * @param buttonAttrs Optional parameters passed to button view instance.\n     */\n    _createButton(locale, option, buttonAttrs = {}) {\n        const editor = this.editor;\n        const command = editor.commands.get('alignment');\n        const buttonView = new ButtonView(locale);\n        buttonView.set({\n            label: this.localizedOptionTitles[option],\n            icon: iconsMap.get(option),\n            tooltip: true,\n            isToggleable: true,\n            ...buttonAttrs\n        });\n        // Bind button model to command.\n        buttonView.bind('isEnabled').to(command);\n        buttonView.bind('isOn').to(command, 'value', value => value === option);\n        // Execute command.\n        this.listenTo(buttonView, 'execute', () => {\n            editor.execute('alignment', { value: option });\n            editor.editing.view.focus();\n        });\n        return buttonView;\n    }\n    /**\n     * Helper method for initializing the toolnar dropdown and linking it with an appropriate command.\n     *\n     * @param options The name of the alignment option for which the button is added.\n     */\n    _addToolbarDropdown(options) {\n        const editor = this.editor;\n        const factory = editor.ui.componentFactory;\n        factory.add('alignment', locale => {\n            const dropdownView = createDropdown(locale);\n            const tooltipPosition = locale.uiLanguageDirection === 'rtl' ? 'w' : 'e';\n            const t = locale.t;\n            // Add existing alignment buttons to dropdown's toolbar.\n            addToolbarToDropdown(dropdownView, () => options.map(option => this._createButton(locale, option.name, { tooltipPosition })), {\n                enableActiveItemFocusOnDropdownOpen: true,\n                isVertical: true,\n                ariaLabel: t('Text alignment toolbar')\n            });\n            // Configure dropdown properties an behavior.\n            dropdownView.buttonView.set({\n                label: t('Text alignment'),\n                tooltip: true\n            });\n            dropdownView.extendTemplate({\n                attributes: {\n                    class: 'ck-alignment-dropdown'\n                }\n            });\n            // The default icon depends on the direction of the content.\n            const defaultIcon = locale.contentLanguageDirection === 'rtl' ? iconsMap.get('right') : iconsMap.get('left');\n            const command = editor.commands.get('alignment');\n            // Change icon to reflect current selection's alignment.\n            dropdownView.buttonView.bind('icon').to(command, 'value', value => iconsMap.get(value) || defaultIcon);\n            // Enable button if any of the buttons is enabled.\n            dropdownView.bind('isEnabled').to(command, 'isEnabled');\n            // Focus the editable after executing the command.\n            // Overrides a default behaviour where the focus is moved to the dropdown button (#12125).\n            this.listenTo(dropdownView, 'execute', () => {\n                editor.editing.view.focus();\n            });\n            return dropdownView;\n        });\n    }\n    /**\n     * Creates a menu for all alignment options to use either in menu bar.\n     *\n     * @param options Normalized alignment options from config.\n     */\n    _addMenuBarMenu(options) {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('menuBar:alignment', locale => {\n            const command = editor.commands.get('alignment');\n            const t = locale.t;\n            const menuView = new MenuBarMenuView(locale);\n            const listView = new MenuBarMenuListView(locale);\n            menuView.bind('isEnabled').to(command);\n            listView.set({\n                ariaLabel: t('Text alignment'),\n                role: 'menu'\n            });\n            menuView.buttonView.set({\n                label: t('Text alignment')\n            });\n            for (const option of options) {\n                const listItemView = new MenuBarMenuListItemView(locale, menuView);\n                const buttonView = new MenuBarMenuListItemButtonView(locale);\n                buttonView.delegate('execute').to(menuView);\n                buttonView.set({\n                    label: this.localizedOptionTitles[option.name],\n                    icon: iconsMap.get(option.name),\n                    role: 'menuitemcheckbox',\n                    isToggleable: true\n                });\n                buttonView.on('execute', () => {\n                    editor.execute('alignment', { value: option.name });\n                    editor.editing.view.focus();\n                });\n                buttonView.bind('isOn').to(command, 'value', value => value === option.name);\n                buttonView.bind('isEnabled').to(command, 'isEnabled');\n                listItemView.children.add(buttonView);\n                listView.items.add(listItemView);\n            }\n            menuView.panelView.children.add(listView);\n            return menuView;\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/utils\n */\n/**\n * Normalizes CSS length value to 'px'.\n *\n * @internal\n */\nexport function convertCssLengthToPx(value) {\n    const numericValue = parseFloat(value);\n    if (value.endsWith('pt')) {\n        // 1pt = 1in / 72\n        return toPx(numericValue * 96 / 72);\n    }\n    else if (value.endsWith('pc')) {\n        // 1pc = 12pt = 1in / 6.\n        return toPx(numericValue * 12 * 96 / 72);\n    }\n    else if (value.endsWith('in')) {\n        // 1in = 2.54cm = 96px\n        return toPx(numericValue * 96);\n    }\n    else if (value.endsWith('cm')) {\n        // 1cm = 96px / 2.54\n        return toPx(numericValue * 96 / 2.54);\n    }\n    else if (value.endsWith('mm')) {\n        // 1mm = 1cm / 10\n        return toPx(numericValue / 10 * 96 / 2.54);\n    }\n    return value;\n}\n/**\n * Returns true for value with 'px' unit.\n *\n * @internal\n */\nexport function isPx(value) {\n    return value !== undefined && value.endsWith('px');\n}\n/**\n * Returns a rounded 'px' value.\n *\n * @internal\n */\nexport function toPx(value) {\n    return Math.round(value) + 'px';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/list\n */\nimport { Matcher, ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { convertCssLengthToPx, isPx, toPx } from './utils.js';\n/**\n * Transforms Word specific list-like elements to the semantic HTML lists.\n *\n * Lists in Word are represented by block elements with special attributes like:\n *\n * ```xml\n * <p class=MsoListParagraphCxSpFirst style='mso-list:l1 level1 lfo1'>...</p> // Paragraph based list.\n * <h1 style='mso-list:l0 level1 lfo1'>...</h1> // Heading 1 based list.\n * ```\n *\n * @param documentFragment The view structure to be transformed.\n * @param stylesString Styles from which list-like elements styling will be extracted.\n * @internal\n */\nexport function transformListItemLikeElementsIntoLists(documentFragment, stylesString, hasMultiLevelListPlugin) {\n    if (!documentFragment.childCount) {\n        return;\n    }\n    const writer = new ViewUpcastWriter(documentFragment.document);\n    const itemLikeElements = findAllItemLikeElements(documentFragment, writer);\n    if (!itemLikeElements.length) {\n        return;\n    }\n    const encounteredLists = {};\n    const stack = [];\n    for (const itemLikeElement of itemLikeElements) {\n        if (itemLikeElement.indent !== undefined) {\n            if (!isListContinuation(itemLikeElement)) {\n                stack.length = 0;\n            }\n            // Combined list ID for addressing encounter lists counters.\n            const originalListId = `${itemLikeElement.id}:${itemLikeElement.indent}`;\n            // Normalized list item indentation.\n            const indent = Math.min(itemLikeElement.indent - 1, stack.length);\n            // Trimming of the list stack on list ID change.\n            if (indent < stack.length && stack[indent].id !== itemLikeElement.id) {\n                stack.length = indent;\n            }\n            // Trimming of the list stack on lower indent list encountered.\n            if (indent < stack.length - 1) {\n                stack.length = indent + 1;\n            }\n            else {\n                const listStyle = detectListStyle(itemLikeElement, stylesString);\n                // Create a new OL/UL if required (greater indent or different list type).\n                if (indent > stack.length - 1 || stack[indent].listElement.name != listStyle.type) {\n                    // Check if there is some start index to set from a previous list.\n                    if (indent == 0 &&\n                        listStyle.type == 'ol' &&\n                        itemLikeElement.id !== undefined &&\n                        encounteredLists[originalListId]) {\n                        listStyle.startIndex = encounteredLists[originalListId];\n                    }\n                    const listElement = createNewEmptyList(listStyle, writer, hasMultiLevelListPlugin);\n                    // Apply list padding only if we have margins for the item and the parent item.\n                    if (isPx(itemLikeElement.marginLeft) &&\n                        (indent == 0 || isPx(stack[indent - 1].marginLeft))) {\n                        let marginLeft = itemLikeElement.marginLeft;\n                        if (indent > 0) {\n                            // Convert the padding from absolute to relative.\n                            marginLeft = toPx(parseFloat(marginLeft) - parseFloat(stack[indent - 1].marginLeft));\n                        }\n                        writer.setStyle('padding-left', marginLeft, listElement);\n                    }\n                    // Insert the new OL/UL.\n                    if (stack.length == 0) {\n                        const parent = itemLikeElement.element.parent;\n                        const index = parent.getChildIndex(itemLikeElement.element) + 1;\n                        writer.insertChild(index, listElement, parent);\n                    }\n                    else {\n                        const parentListItems = stack[indent - 1].listItemElements;\n                        writer.appendChild(listElement, parentListItems[parentListItems.length - 1]);\n                    }\n                    // Update the list stack for other items to reference.\n                    stack[indent] = {\n                        ...itemLikeElement,\n                        listElement,\n                        listItemElements: []\n                    };\n                    // Prepare list counter for start index.\n                    if (indent == 0 && itemLikeElement.id !== undefined) {\n                        encounteredLists[originalListId] = listStyle.startIndex || 1;\n                    }\n                }\n            }\n            // Use LI if it is already it or create a new LI element.\n            // https://github.com/ckeditor/ckeditor5/issues/15964\n            const listItem = itemLikeElement.element.name == 'li' ? itemLikeElement.element : writer.createElement('li');\n            // Append the LI to OL/UL.\n            writer.appendChild(listItem, stack[indent].listElement);\n            stack[indent].listItemElements.push(listItem);\n            // Increment list counter.\n            if (indent == 0 && itemLikeElement.id !== undefined) {\n                encounteredLists[originalListId]++;\n            }\n            // Append list block to LI.\n            if (itemLikeElement.element != listItem) {\n                writer.appendChild(itemLikeElement.element, listItem);\n            }\n            // Clean list block.\n            removeBulletElement(itemLikeElement.element, writer);\n            writer.removeStyle('text-indent', itemLikeElement.element); // #12361\n            writer.removeStyle('margin-left', itemLikeElement.element);\n        }\n        else {\n            // Other blocks in a list item.\n            const stackItem = stack.find(stackItem => stackItem.marginLeft == itemLikeElement.marginLeft);\n            // This might be a paragraph that has known margin, but it is not a real list block.\n            if (stackItem) {\n                const listItems = stackItem.listItemElements;\n                // Append block to LI.\n                writer.appendChild(itemLikeElement.element, listItems[listItems.length - 1]);\n                writer.removeStyle('margin-left', itemLikeElement.element);\n            }\n            else {\n                stack.length = 0;\n            }\n        }\n    }\n}\n/**\n * Removes paragraph wrapping content inside a list item.\n *\n * @internal\n */\nexport function unwrapParagraphInListItem(documentFragment, writer) {\n    for (const value of writer.createRangeIn(documentFragment)) {\n        const element = value.item;\n        if (element.is('element', 'li')) {\n            // Google Docs allows for single paragraph inside LI.\n            const firstChild = element.getChild(0);\n            if (firstChild && firstChild.is('element', 'p')) {\n                writer.unwrapElement(firstChild);\n            }\n        }\n    }\n}\n/**\n * Finds all list-like elements in a given document fragment.\n *\n * @param documentFragment Document fragment in which to look for list-like nodes.\n * @returns Array of found list-like items. Each item is an object containing\n * @internal\n */\nfunction findAllItemLikeElements(documentFragment, writer) {\n    const range = writer.createRangeIn(documentFragment);\n    const itemLikeElements = [];\n    const foundMargins = new Set();\n    for (const item of range.getItems()) {\n        // https://github.com/ckeditor/ckeditor5/issues/15964\n        if (!item.is('element') || !item.name.match(/^(p|h\\d+|li|div)$/)) {\n            continue;\n        }\n        // Try to rely on margin-left style to find paragraphs visually aligned with previously encountered list item.\n        let marginLeft = getMarginLeftNormalized(item);\n        // Ignore margin-left 0 style if there is no MsoList... class.\n        if (marginLeft !== undefined &&\n            parseFloat(marginLeft) == 0 &&\n            !Array.from(item.getClassNames()).find(className => className.startsWith('MsoList'))) {\n            marginLeft = undefined;\n        }\n        // List item or a following list item block.\n        if ((item.hasStyle('mso-list') && item.getStyle('mso-list') !== 'none') ||\n            (marginLeft !== undefined && foundMargins.has(marginLeft))) {\n            const itemData = getListItemData(item);\n            itemLikeElements.push({\n                element: item,\n                id: itemData.id,\n                order: itemData.order,\n                indent: itemData.indent,\n                marginLeft\n            });\n            if (marginLeft !== undefined) {\n                foundMargins.add(marginLeft);\n            }\n        }\n        // Clear found margins as we found block after a list.\n        else {\n            foundMargins.clear();\n        }\n    }\n    return itemLikeElements;\n}\n/**\n * Whether the given element is possibly a list continuation. Previous element was wrapped into a list\n * or the current element already is inside a list.\n */\nfunction isListContinuation(currentItem) {\n    const previousSibling = currentItem.element.previousSibling;\n    if (!previousSibling) {\n        const parent = currentItem.element.parent;\n        // If it's a li inside ul or ol like in here: https://github.com/ckeditor/ckeditor5/issues/15964.\n        // If the parent has previous sibling, which is not a list, then it is not a continuation.\n        return isList(parent) && (!parent.previousSibling || isList(parent.previousSibling));\n    }\n    // Even with the same id the list does not have to be continuous (#43).\n    return isList(previousSibling);\n}\nfunction isList(element) {\n    return element.is('element', 'ol') || element.is('element', 'ul');\n}\n/**\n * Extracts list item style from the provided CSS.\n *\n * List item style is extracted from the CSS stylesheet. Each list with its specific style attribute\n * value (`mso-list:l1 level1 lfo1`) has its dedicated properties in a CSS stylesheet defined with a selector like:\n *\n * ```css\n * @list l1:level1 { ... }\n * ```\n *\n * It contains `mso-level-number-format` property which defines list numbering/bullet style. If this property\n * is not defined it means default `decimal` numbering.\n *\n * Here CSS string representation is used as `mso-level-number-format` property is an invalid CSS property\n * and will be removed during CSS parsing.\n *\n * @param listLikeItem List-like item for which list style will be searched for. Usually\n * a result of `findAllItemLikeElements()` function.\n * @param stylesString CSS stylesheet.\n * @returns An object with properties:\n *\n * * type - List type, could be `ul` or `ol`.\n * * startIndex - List start index, valid only for ordered lists.\n * * style - List style, for example: `decimal`, `lower-roman`, etc. It is extracted\n *     directly from Word stylesheet and adjusted to represent proper values for the CSS `list-style-type` property.\n *     If it cannot be adjusted, the `null` value is returned.\n */\nfunction detectListStyle(listLikeItem, stylesString) {\n    const listStyleRegexp = new RegExp(`@list l${listLikeItem.id}:level${listLikeItem.indent}\\\\s*({[^}]*)`, 'gi');\n    const listStyleTypeRegex = /mso-level-number-format:([^;]{0,100});/gi;\n    const listStartIndexRegex = /mso-level-start-at:\\s{0,100}([0-9]{0,10})\\s{0,100};/gi;\n    const legalStyleListRegex = new RegExp(`@list\\\\s+l${listLikeItem.id}:level\\\\d\\\\s*{[^{]*mso-level-text:\"%\\\\d\\\\\\\\.`, 'gi');\n    const multiLevelNumberFormatTypeRegex = new RegExp(`@list l${listLikeItem.id}:level\\\\d\\\\s*{[^{]*mso-level-number-format:`, 'gi');\n    const legalStyleListMatch = legalStyleListRegex.exec(stylesString);\n    const multiLevelNumberFormatMatch = multiLevelNumberFormatTypeRegex.exec(stylesString);\n    // Multi level lists in Word have mso-level-number-format attribute except legal lists,\n    // so we used that. If list has legal list match and doesn't has mso-level-number-format\n    // then this is legal-list.\n    const islegalStyleList = legalStyleListMatch && !multiLevelNumberFormatMatch;\n    const listStyleMatch = listStyleRegexp.exec(stylesString);\n    let listStyleType = 'decimal'; // Decimal is default one.\n    let type = 'ol'; // <ol> is default list.\n    let startIndex = null;\n    if (listStyleMatch && listStyleMatch[1]) {\n        const listStyleTypeMatch = listStyleTypeRegex.exec(listStyleMatch[1]);\n        if (listStyleTypeMatch && listStyleTypeMatch[1]) {\n            listStyleType = listStyleTypeMatch[1].trim();\n            type = listStyleType !== 'bullet' && listStyleType !== 'image' ? 'ol' : 'ul';\n        }\n        // Styles for the numbered lists are always defined in the Word CSS stylesheet.\n        // Unordered lists MAY contain a value for the Word CSS definition `mso-level-text` but sometimes\n        // this tag is missing. And because of that, we cannot depend on that. We need to predict the list style value\n        // based on the list style marker element.\n        if (listStyleType === 'bullet') {\n            const bulletedStyle = findBulletedListStyle(listLikeItem.element);\n            if (bulletedStyle) {\n                listStyleType = bulletedStyle;\n            }\n        }\n        else {\n            const listStartIndexMatch = listStartIndexRegex.exec(listStyleMatch[1]);\n            if (listStartIndexMatch && listStartIndexMatch[1]) {\n                startIndex = parseInt(listStartIndexMatch[1]);\n            }\n        }\n        if (islegalStyleList) {\n            type = 'ol';\n        }\n    }\n    return {\n        type,\n        startIndex,\n        style: mapListStyleDefinition(listStyleType),\n        isLegalStyleList: islegalStyleList\n    };\n}\n/**\n * Tries to extract the `list-style-type` value based on the marker element for bulleted list.\n */\nfunction findBulletedListStyle(element) {\n    // https://github.com/ckeditor/ckeditor5/issues/15964\n    if (element.name == 'li' && element.parent.name == 'ul' && element.parent.hasAttribute('type')) {\n        return element.parent.getAttribute('type');\n    }\n    const listMarkerElement = findListMarkerNode(element);\n    if (!listMarkerElement) {\n        return null;\n    }\n    const listMarker = listMarkerElement._data;\n    if (listMarker === 'o') {\n        return 'circle';\n    }\n    else if (listMarker === '·') {\n        return 'disc';\n    }\n    // Word returns '§' instead of '■' for the square list style.\n    else if (listMarker === '§') {\n        return 'square';\n    }\n    return null;\n}\n/**\n * Tries to find a text node that represents the marker element (list-style-type).\n */\nfunction findListMarkerNode(element) {\n    // If the first child is a text node, it is the data for the element.\n    // The list-style marker is not present here.\n    if (element.getChild(0).is('$text')) {\n        return null;\n    }\n    for (const childNode of element.getChildren()) {\n        // The list-style marker will be inside the `<span>` element. Let's ignore all non-span elements.\n        // It may happen that the `<a>` element is added as the first child. Most probably, it's an anchor element.\n        if (!childNode.is('element', 'span')) {\n            continue;\n        }\n        const textNodeOrElement = childNode.getChild(0);\n        if (!textNodeOrElement) {\n            continue;\n        }\n        // If already found the marker element, use it.\n        if (textNodeOrElement.is('$text')) {\n            return textNodeOrElement;\n        }\n        return textNodeOrElement.getChild(0);\n    }\n    /* istanbul ignore next -- @preserve */\n    return null;\n}\n/**\n * Parses the `list-style-type` value extracted directly from the Word CSS stylesheet and returns proper CSS definition.\n */\nfunction mapListStyleDefinition(value) {\n    if (value.startsWith('arabic-leading-zero')) {\n        return 'decimal-leading-zero';\n    }\n    switch (value) {\n        case 'alpha-upper':\n            return 'upper-alpha';\n        case 'alpha-lower':\n            return 'lower-alpha';\n        case 'roman-upper':\n            return 'upper-roman';\n        case 'roman-lower':\n            return 'lower-roman';\n        case 'circle':\n        case 'disc':\n        case 'square':\n            return value;\n        default:\n            return null;\n    }\n}\n/**\n * Creates a new list OL/UL element.\n */\nfunction createNewEmptyList(listStyle, writer, hasMultiLevelListPlugin) {\n    const list = writer.createElement(listStyle.type);\n    // We do not support modifying the marker for a particular list item.\n    // Set the value for the `list-style-type` property directly to the list container.\n    if (listStyle.style) {\n        writer.setStyle('list-style-type', listStyle.style, list);\n    }\n    if (listStyle.startIndex && listStyle.startIndex > 1) {\n        writer.setAttribute('start', listStyle.startIndex, list);\n    }\n    if (listStyle.isLegalStyleList && hasMultiLevelListPlugin) {\n        writer.addClass('legal-list', list);\n    }\n    return list;\n}\n/**\n * Extracts list item information from Word specific list-like element style:\n *\n * ```\n * `style=\"mso-list:l1 level1 lfo1\"`\n * ```\n *\n * where:\n *\n * ```\n * * `l1` is a list id (however it does not mean this is a continuous list - see #43),\n * * `level1` is a list item indentation level,\n * * `lfo1` is a list insertion order in a document.\n * ```\n *\n * @param element Element from which style data is extracted.\n */\nfunction getListItemData(element) {\n    const listStyle = element.getStyle('mso-list');\n    if (listStyle === undefined) {\n        return {};\n    }\n    const idMatch = listStyle.match(/(^|\\s{1,100})l(\\d+)/i);\n    const orderMatch = listStyle.match(/\\s{0,100}lfo(\\d+)/i);\n    const indentMatch = listStyle.match(/\\s{0,100}level(\\d+)/i);\n    if (idMatch && orderMatch && indentMatch) {\n        return {\n            id: idMatch[2],\n            order: orderMatch[1],\n            indent: parseInt(indentMatch[1])\n        };\n    }\n    return {\n        indent: 1 // Handle empty mso-list style as a marked for default list item.\n    };\n}\n/**\n * Removes span with a numbering/bullet from a given element.\n */\nfunction removeBulletElement(element, writer) {\n    // Matcher for finding `span` elements holding lists numbering/bullets.\n    const bulletMatcher = new Matcher({\n        name: 'span',\n        styles: {\n            'mso-list': 'Ignore'\n        }\n    });\n    const range = writer.createRangeIn(element);\n    for (const value of range) {\n        if (value.type === 'elementStart' && bulletMatcher.match(value.item)) {\n            writer.remove(value.item);\n        }\n    }\n}\n/**\n * Returns element left margin normalized to 'px' if possible.\n */\nfunction getMarginLeftNormalized(element) {\n    const value = element.getStyle('margin-left');\n    if (value === undefined || value.endsWith('px')) {\n        return value;\n    }\n    return convertCssLengthToPx(value);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Removes the `width:0px` style from table pasted from Google Sheets and `width=\"0\"` attribute from Word tables.\n *\n * @param documentFragment element `data.content` obtained from clipboard\n * @internal\n */\nexport function removeInvalidTableWidth(documentFragment, writer) {\n    for (const child of writer.createRangeIn(documentFragment).getItems()) {\n        if (child.is('element', 'table')) {\n            // Remove invalid width style (Google Sheets: width:0px).\n            if (child.getStyle('width') === '0px') {\n                writer.removeStyle('width', child);\n            }\n            // Remove invalid width attribute (Word: width=\"0\").\n            if (child.getAttribute('width') === '0') {\n                writer.removeAttribute('width', child);\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Replaces MS Word specific footnotes references and definitions with proper elements.\n *\n * Things to know about MS Word footnotes:\n *\n * * Footnote references in Word are marked with `mso-footnote-id` style.\n * * Word does not support nested footnotes, so references within definitions are ignored.\n * * Word appends extra spaces after footnote references within definitions, which are trimmed.\n * * Footnote definitions list is marked with `mso-element: footnote-list` style it contain `mso-element: footnote` elements.\n * * Footnote definition might contain tables, lists and other elements, not only text. They are placed directly within `li` element,\n * without any wrapper (in opposition to text content of the definition, which is placed within `MsoFootnoteText` element).\n *\n * Example pseudo document showing MS Word footnote structure:\n *\n * ```html\n * <p>Text with footnote<a style='mso-footnote-id:ftn1'>[1]</a> reference.</p>\n *\n * <div style='mso-element:footnote-list'>\n * \t<div style='mso-element:footnote' id=ftn1>\n * \t\t<p class=MsoFootnoteText><a style='mso-footnote-id:ftn1'>[1]</a> Footnote content</p>\n * \t\t<table class=\"MsoTableGrid\">...</table>\n * \t</div>\n * </div>\n * ```\n *\n * Will be transformed into:\n *\n * ```html\n * <p>Text with footnote<sup class=\"footnote\"><a id=\"ref-footnote-ftn1\" href=\"#footnote-ftn1\">1</a></sup> reference.</p>\n *\n * <ol class=\"footnotes\">\n * \t<li class=\"footnote-definition\" id=\"footnote-ftn1\">\n * \t\t<a href=\"#ref-footnote-ftn1\" class=\"footnote-backlink\">^</a>\n * \t\t<div class=\"footnote-content\">\n * \t\t\t<p>Footnote content</p>\n * \t\t\t<table>...</table>\n * \t\t</div>\n * \t</li>\n * </ol>\n * ```\n *\n * @param documentFragment `data.content` obtained from clipboard.\n * @param writer The view writer instance.\n * @internal\n */\nexport function replaceMSFootnotes(documentFragment, writer) {\n    const msFootnotesRefs = new Map();\n    const msFootnotesDefs = new Map();\n    let msFootnotesDefinitionsList = null;\n    // Phase 1: Collect all footnotes references and definitions. Find the footnotes definitions list element.\n    for (const { item } of writer.createRangeIn(documentFragment)) {\n        if (!item.is('element')) {\n            continue;\n        }\n        // If spot a footnotes definitions element, let's store it. It'll be replaced later.\n        // There should be only one such element in the document.\n        if (item.getStyle('mso-element') === 'footnote-list') {\n            msFootnotesDefinitionsList = item;\n            continue;\n        }\n        // If spot a footnote reference or definition, store it in the corresponding map.\n        if (item.hasStyle('mso-footnote-id')) {\n            const msFootnoteDef = item.findAncestor('element', el => el.getStyle('mso-element') === 'footnote');\n            if (msFootnoteDef) {\n                // If it's a reference within a definition, ignore it and track only the definition.\n                // MS Word do not support nested footnotes, so it's safe to assume that all references within\n                // a definition point to the same definition.\n                const msFootnoteDefId = msFootnoteDef.getAttribute('id');\n                msFootnotesDefs.set(msFootnoteDefId, msFootnoteDef);\n            }\n            else {\n                // If it's a reference outside of a definition, track it as a reference.\n                const msFootnoteRefId = item.getStyle('mso-footnote-id');\n                msFootnotesRefs.set(msFootnoteRefId, item);\n            }\n            continue;\n        }\n    }\n    // If there are no footnotes references or definitions, or no definitions list, there's nothing to normalize.\n    if (!msFootnotesRefs.size || !msFootnotesDefinitionsList) {\n        return;\n    }\n    // Phase 2: Replace footnotes definitions list with proper element.\n    const footnotesDefinitionsList = createFootnotesListViewElement(writer);\n    writer.replace(msFootnotesDefinitionsList, footnotesDefinitionsList);\n    // Phase 3: Replace all footnotes references and add matching definitions to the definitions list.\n    for (const [footnoteId, msFootnoteRef] of msFootnotesRefs) {\n        const msFootnoteDef = msFootnotesDefs.get(footnoteId);\n        if (!msFootnoteDef) {\n            continue;\n        }\n        // Replace footnote reference.\n        writer.replace(msFootnoteRef, createFootnoteRefViewElement(writer, footnoteId));\n        // Append found matching definition to the definitions list.\n        // Order doesn't matter here, as it'll be fixed in the post-fixer.\n        const defElements = createFootnoteDefViewElement(writer, footnoteId);\n        removeMSReferences(writer, msFootnoteDef);\n        // Insert content within the `MsoFootnoteText` element. It's usually a definition text content.\n        for (const child of msFootnoteDef.getChildren()) {\n            let clonedChild = child;\n            if (child.is('element')) {\n                clonedChild = writer.clone(child, true);\n            }\n            writer.appendChild(clonedChild, defElements.content);\n        }\n        writer.appendChild(defElements.listItem, footnotesDefinitionsList);\n    }\n}\n/**\n * Removes all MS Office specific references from the given element.\n *\n * It also removes leading space from text nodes following the references, as MS Word adds\n * them to separate the reference from the rest of the text.\n *\n * @param writer The view writer.\n * @param element The element to trim.\n * @returns The trimmed element.\n */\nfunction removeMSReferences(writer, element) {\n    const elementsToRemove = [];\n    const textNodesToTrim = [];\n    for (const { item } of writer.createRangeIn(element)) {\n        if (item.is('element') && item.getStyle('mso-footnote-id')) {\n            elementsToRemove.unshift(item);\n            // MS Word used to add spaces after footnote references within definitions. Let's check if there's a space after\n            // the footnote reference and mark it for trimming.\n            const { nextSibling } = item;\n            if (nextSibling?.is('$text') && nextSibling.data.startsWith(' ')) {\n                textNodesToTrim.unshift(nextSibling);\n            }\n        }\n    }\n    for (const element of elementsToRemove) {\n        writer.remove(element);\n    }\n    // Remove only the leading space from text nodes following reference within definition, preserve the rest of the text.\n    for (const textNode of textNodesToTrim) {\n        const trimmedData = textNode.data.substring(1);\n        if (trimmedData.length > 0) {\n            // Create a new text node and replace the old one.\n            const parent = textNode.parent;\n            const index = parent.getChildIndex(textNode);\n            const newTextNode = writer.createText(trimmedData);\n            writer.remove(textNode);\n            writer.insertChild(index, newTextNode, parent);\n        }\n        else {\n            // If the text node contained only a space, remove it entirely.\n            writer.remove(textNode);\n        }\n    }\n    return element;\n}\n/**\n * Creates a footnotes list view element.\n *\n * @param writer The view writer instance.\n * @returns The footnotes list view element.\n */\nfunction createFootnotesListViewElement(writer) {\n    return writer.createElement('ol', { class: 'footnotes' });\n}\n/**\n * Creates a footnote reference view element.\n *\n * @param writer The view writer instance.\n * @param footnoteId The footnote ID.\n * @returns The footnote reference view element.\n */\nfunction createFootnoteRefViewElement(writer, footnoteId) {\n    const sup = writer.createElement('sup', { class: 'footnote' });\n    const link = writer.createElement('a', {\n        id: `ref-${footnoteId}`,\n        href: `#${footnoteId}`\n    });\n    writer.appendChild(link, sup);\n    return sup;\n}\n/**\n * Creates a footnote definition view element with a backlink and a content container.\n *\n * @param writer The view writer instance.\n * @param footnoteId The footnote ID.\n * @returns An object containing the list item element, backlink and content container.\n */\nfunction createFootnoteDefViewElement(writer, footnoteId) {\n    const listItem = writer.createElement('li', {\n        id: footnoteId,\n        class: 'footnote-definition'\n    });\n    const backLink = writer.createElement('a', {\n        href: `#ref-${footnoteId}`,\n        class: 'footnote-backlink'\n    });\n    const content = writer.createElement('div', {\n        class: 'footnote-content'\n    });\n    writer.appendChild(writer.createText('^'), backLink);\n    writer.appendChild(backLink, listItem);\n    writer.appendChild(content, listItem);\n    return {\n        listItem,\n        content\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/normalizers/mswordnormalizer\n */\nimport { transformBookmarks } from '../filters/bookmark.js';\nimport { transformListItemLikeElementsIntoLists } from '../filters/list.js';\nimport { replaceImagesSourceWithBase64 } from '../filters/image.js';\nimport { removeMSAttributes } from '../filters/removemsattributes.js';\nimport { transformTables } from '../filters/table.js';\nimport { removeInvalidTableWidth } from '../filters/removeinvalidtablewidth.js';\nimport { replaceMSFootnotes } from '../filters/replacemsfootnotes.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nconst msWordMatch1 = /<meta\\s*name=\"?generator\"?\\s*content=\"?microsoft\\s*word\\s*\\d+\"?\\/?>/i;\nconst msWordMatch2 = /xmlns:o=\"urn:schemas-microsoft-com/i;\n/**\n * Normalizer for the content pasted from Microsoft Word.\n */\nexport class PasteFromOfficeMSWordNormalizer {\n    document;\n    hasMultiLevelListPlugin;\n    hasTablePropertiesPlugin;\n    hasExtendedTableBlockAlignment;\n    /**\n     * Creates a new `PasteFromOfficeMSWordNormalizer` instance.\n     *\n     * @param document View document.\n     */\n    constructor(document, hasMultiLevelListPlugin = false, hasTablePropertiesPlugin = false, hasExtendedTableBlockAlignment = false) {\n        this.document = document;\n        this.hasMultiLevelListPlugin = hasMultiLevelListPlugin;\n        this.hasTablePropertiesPlugin = hasTablePropertiesPlugin;\n        this.hasExtendedTableBlockAlignment = hasExtendedTableBlockAlignment;\n    }\n    /**\n     * @inheritDoc\n     */\n    isActive(htmlString) {\n        return msWordMatch1.test(htmlString) || msWordMatch2.test(htmlString);\n    }\n    /**\n     * @inheritDoc\n     */\n    execute(data) {\n        const writer = new ViewUpcastWriter(this.document);\n        const { body: documentFragment, stylesString } = data._parsedData;\n        transformBookmarks(documentFragment, writer);\n        transformListItemLikeElementsIntoLists(documentFragment, stylesString, this.hasMultiLevelListPlugin);\n        replaceImagesSourceWithBase64(documentFragment, data.dataTransfer.getData('text/rtf'));\n        transformTables(documentFragment, writer, this.hasTablePropertiesPlugin, this.hasExtendedTableBlockAlignment);\n        removeInvalidTableWidth(documentFragment, writer);\n        replaceMSFootnotes(documentFragment, writer);\n        removeMSAttributes(documentFragment);\n        data.content = documentFragment;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Transforms `<a>` elements which are bookmarks by moving their children after the element.\n *\n * @internal\n */\nexport function transformBookmarks(documentFragment, writer) {\n    const elementsToChange = [];\n    for (const value of writer.createRangeIn(documentFragment)) {\n        const element = value.item;\n        if (element.is('element', 'a') &&\n            !element.hasAttribute('href') &&\n            (element.hasAttribute('id') || element.hasAttribute('name'))) {\n            elementsToChange.push(element);\n        }\n    }\n    for (const element of elementsToChange) {\n        const index = element.parent.getChildIndex(element) + 1;\n        const children = element.getChildren();\n        writer.insertChild(index, children, element.parent);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/image\n */\nimport { Matcher, ViewUpcastWriter } from 'ckeditor5/src/engine.js';\n/**\n * Replaces source attribute of all `<img>` elements representing regular\n * images (not the Word shapes) with inlined base64 image representation extracted from RTF or Blob data.\n *\n * @param documentFragment Document fragment on which transform images.\n * @param rtfData The RTF data from which images representation will be used.\n * @internal\n */\nexport function replaceImagesSourceWithBase64(documentFragment, rtfData) {\n    if (!documentFragment.childCount) {\n        return;\n    }\n    const upcastWriter = new ViewUpcastWriter(documentFragment.document);\n    const shapesIds = findAllShapesIds(documentFragment, upcastWriter);\n    removeAllImgElementsRepresentingShapes(shapesIds, documentFragment, upcastWriter);\n    insertMissingImgs(shapesIds, documentFragment, upcastWriter);\n    removeAllShapeElements(documentFragment, upcastWriter);\n    const images = findAllImageElementsWithLocalSource(documentFragment, upcastWriter);\n    if (images.length) {\n        replaceImagesFileSourceWithInlineRepresentation(images, extractImageDataFromRtf(rtfData), upcastWriter);\n    }\n}\n/**\n * Converts given HEX string to base64 representation.\n *\n * @internal\n * @param hexString The HEX string to be converted.\n * @returns Base64 representation of a given HEX string.\n */\nexport function _convertHexToBase64(hexString) {\n    return btoa(hexString.match(/\\w{2}/g).map(char => {\n        return String.fromCharCode(parseInt(char, 16));\n    }).join(''));\n}\n/**\n * Finds all shapes (`<v:*>...</v:*>`) ids. Shapes can represent images (canvas)\n * or Word shapes (which does not have RTF or Blob representation).\n *\n * @param documentFragment Document fragment from which to extract shape ids.\n * @returns Array of shape ids.\n */\nfunction findAllShapesIds(documentFragment, writer) {\n    const range = writer.createRangeIn(documentFragment);\n    const shapeElementsMatcher = new Matcher({\n        name: /v:(.+)/\n    });\n    const shapesIds = [];\n    for (const value of range) {\n        if (value.type != 'elementStart') {\n            continue;\n        }\n        const el = value.item;\n        const previousSibling = el.previousSibling;\n        const prevSiblingName = previousSibling && previousSibling.is('element') ? previousSibling.name : null;\n        // List of ids which should not be considered as shapes.\n        // https://github.com/ckeditor/ckeditor5/pull/15847#issuecomment-1941543983\n        const exceptionIds = ['Chart'];\n        const isElementAShape = shapeElementsMatcher.match(el);\n        const hasElementGfxdataAttribute = el.getAttribute('o:gfxdata');\n        const isPreviousSiblingAShapeType = prevSiblingName === 'v:shapetype';\n        const isElementIdInExceptionsArray = hasElementGfxdataAttribute &&\n            exceptionIds.some(item => el.getAttribute('id').includes(item));\n        // If shape element has 'o:gfxdata' attribute and is not directly before\n        // `<v:shapetype>` element it means that it represents a Word shape.\n        if (isElementAShape &&\n            hasElementGfxdataAttribute &&\n            !isPreviousSiblingAShapeType &&\n            !isElementIdInExceptionsArray) {\n            shapesIds.push(value.item.getAttribute('id'));\n        }\n    }\n    return shapesIds;\n}\n/**\n * Removes all `<img>` elements which represents Word shapes and not regular images.\n *\n * @param shapesIds Shape ids which will be checked against `<img>` elements.\n * @param documentFragment Document fragment from which to remove `<img>` elements.\n */\nfunction removeAllImgElementsRepresentingShapes(shapesIds, documentFragment, writer) {\n    const range = writer.createRangeIn(documentFragment);\n    const imageElementsMatcher = new Matcher({\n        name: 'img'\n    });\n    const imgs = [];\n    for (const value of range) {\n        if (value.item.is('element') && imageElementsMatcher.match(value.item)) {\n            const el = value.item;\n            const shapes = el.getAttribute('v:shapes') ? el.getAttribute('v:shapes').split(' ') : [];\n            if (shapes.length && shapes.every(shape => shapesIds.indexOf(shape) > -1)) {\n                imgs.push(el);\n                // Shapes may also have empty source while content is paste in some browsers (Safari).\n            }\n            else if (!el.getAttribute('src')) {\n                imgs.push(el);\n            }\n        }\n    }\n    for (const img of imgs) {\n        writer.remove(img);\n    }\n}\n/**\n * Removes all shape elements (`<v:*>...</v:*>`) so they do not pollute the output structure.\n *\n * @param documentFragment Document fragment from which to remove shape elements.\n */\nfunction removeAllShapeElements(documentFragment, writer) {\n    const range = writer.createRangeIn(documentFragment);\n    const shapeElementsMatcher = new Matcher({\n        name: /v:(.+)/\n    });\n    const shapes = [];\n    for (const value of range) {\n        if (value.type == 'elementStart' && shapeElementsMatcher.match(value.item)) {\n            shapes.push(value.item);\n        }\n    }\n    for (const shape of shapes) {\n        writer.remove(shape);\n    }\n}\n/**\n * Inserts `img` tags if there is none after a shape.\n */\nfunction insertMissingImgs(shapeIds, documentFragment, writer) {\n    const range = writer.createRangeIn(documentFragment);\n    const shapes = [];\n    for (const value of range) {\n        if (value.type == 'elementStart' && value.item.is('element', 'v:shape')) {\n            const id = value.item.getAttribute('id');\n            if (shapeIds.includes(id)) {\n                continue;\n            }\n            if (!containsMatchingImg(value.item.parent.getChildren(), id)) {\n                shapes.push(value.item);\n            }\n        }\n    }\n    for (const shape of shapes) {\n        const attrs = {\n            src: findSrc(shape)\n        };\n        if (shape.hasAttribute('alt')) {\n            attrs.alt = shape.getAttribute('alt');\n        }\n        const img = writer.createElement('img', attrs);\n        writer.insertChild(shape.index + 1, img, shape.parent);\n    }\n    function containsMatchingImg(nodes, id) {\n        for (const node of nodes) {\n            /* istanbul ignore else -- @preserve */\n            if (node.is('element')) {\n                if (node.name == 'img' && node.getAttribute('v:shapes') == id) {\n                    return true;\n                }\n                if (containsMatchingImg(node.getChildren(), id)) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    function findSrc(shape) {\n        for (const child of shape.getChildren()) {\n            /* istanbul ignore else -- @preserve */\n            if (child.is('element') && child.getAttribute('src')) {\n                return child.getAttribute('src');\n            }\n        }\n    }\n}\n/**\n * Finds all `<img>` elements in a given document fragment which have source pointing to local `file://` resource.\n * This function also tracks the index position of each image in the document, which is essential for\n * precise matching with hexadecimal representations in RTF data.\n *\n * @param documentFragment Document fragment in which to look for `<img>` elements.\n * @returns Array of found images along with their position index in the document.\n */\nfunction findAllImageElementsWithLocalSource(documentFragment, writer) {\n    const range = writer.createRangeIn(documentFragment);\n    const imageElementsMatcher = new Matcher({\n        name: 'img'\n    });\n    const imgs = [];\n    let currentImageIndex = 0;\n    for (const value of range) {\n        if (value.item.is('element') && imageElementsMatcher.match(value.item)) {\n            if (value.item.getAttribute('src').startsWith('file://')) {\n                imgs.push({\n                    element: value.item,\n                    imageIndex: currentImageIndex\n                });\n            }\n            currentImageIndex++;\n        }\n    }\n    return imgs;\n}\n/**\n * Extracts all images HEX representations from a given RTF data.\n *\n * @param rtfData The RTF data from which to extract images HEX representation.\n * @returns Array of found HEX representations. Each array item is an object containing:\n *\n * * hex Image representation in HEX format.\n * * type Type of image, `image/png` or `image/jpeg`.\n */\nfunction extractImageDataFromRtf(rtfData) {\n    if (!rtfData) {\n        return [];\n    }\n    const regexPictureHeader = /{\\\\pict[\\s\\S]+?\\\\bliptag-?\\d+(\\\\blipupi-?\\d+)?({\\\\\\*\\\\blipuid\\s?[\\da-fA-F]+)?[\\s}]*?/;\n    const regexPicture = new RegExp('(?:(' + regexPictureHeader.source + '))([\\\\da-fA-F\\\\s]+)\\\\}', 'g');\n    const images = rtfData.match(regexPicture);\n    const result = [];\n    if (images) {\n        for (const image of images) {\n            let imageType = false;\n            if (image.includes('\\\\pngblip')) {\n                imageType = 'image/png';\n            }\n            else if (image.includes('\\\\jpegblip')) {\n                imageType = 'image/jpeg';\n            }\n            if (imageType) {\n                result.push({\n                    hex: image.replace(regexPictureHeader, '').replace(/[^\\da-fA-F]/g, ''),\n                    type: imageType\n                });\n            }\n        }\n    }\n    return result;\n}\n/**\n * Replaces `src` attribute value of all given images with the corresponding base64 image representation.\n * Uses the image index to precisely match with the correct hexadecimal representation from RTF data.\n *\n * @param imageElements Array of image elements along with their indices which will have their sources replaced.\n * @param imagesHexSources Array of images hex sources (usually the result of `extractImageDataFromRtf()` function).\n * Contains hexadecimal representations of ALL images in the document, not just those with `file://` URLs.\n * In XML documents, the same image might be defined both as base64 in HTML and as hexadecimal in RTF data.\n */\nfunction replaceImagesFileSourceWithInlineRepresentation(imageElements, imagesHexSources, writer) {\n    for (let i = 0; i < imageElements.length; i++) {\n        const { element, imageIndex } = imageElements[i];\n        const rtfHexSource = imagesHexSources[imageIndex];\n        if (rtfHexSource) {\n            const newSrc = `data:${rtfHexSource.type};base64,${_convertHexToBase64(rtfHexSource.hex)}`;\n            writer.setAttribute('src', newSrc, element);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { convertCssLengthToPx } from './utils.js';\n/**\n * Applies border none for table and cells without a border specified.\n * Normalizes style length units to px.\n * Handles left block table alignment.\n *\n * @internal\n */\nexport function transformTables(documentFragment, writer, hasTablePropertiesPlugin = false, hasExtendedTableBlockAlignment = false) {\n    for (const item of writer.createRangeIn(documentFragment).getItems()) {\n        if (!item.is('element', 'table') &&\n            !item.is('element', 'td') &&\n            !item.is('element', 'th')) {\n            continue;\n        }\n        // In MS Word, left-aligned tables (default) have no align attribute on the `<table>` and are not wrapped in a `<div>`.\n        // In such cases, we need to set `margin-left: 0` and `margin-right: auto` to indicate to the editor that\n        // the table is block-aligned to the left.\n        //\n        // Center- and right-aligned tables in MS Word are wrapped in a `<div>` with the `align` attribute set to\n        // `center` or `right`, respectively with no align attribute on the `<table>` itself.\n        //\n        // Additionally, the structure may change when pasting content from MS Word.\n        // Some browsers (e.g., Safari) may insert extra elements around the table (e.g., a <span>),\n        // so the surrounding `<div>` with the `align` attribute may end up being the table's grandparent.\n        if (hasTablePropertiesPlugin && hasExtendedTableBlockAlignment && item.is('element', 'table')) {\n            const directParent = item.parent?.is('element', 'div') ? item.parent : null;\n            const grandParent = item.parent?.parent?.is('element', 'div') ? item.parent.parent : null;\n            const divParent = directParent ?? grandParent;\n            // Center block table alignment.\n            if (divParent && divParent.getAttribute('align') === 'center' && !item.getAttribute('align')) {\n                writer.setStyle('margin-left', 'auto', item);\n                writer.setStyle('margin-right', 'auto', item);\n            }\n            // Right block table alignment.\n            else if (divParent && divParent.getAttribute('align') === 'right' && !item.getAttribute('align')) {\n                writer.setStyle('margin-left', 'auto', item);\n                writer.setStyle('margin-right', '0', item);\n            }\n            // Left block table alignment.\n            else if (!divParent && !item.getAttribute('align')) {\n                writer.setStyle('margin-left', '0', item);\n                writer.setStyle('margin-right', 'auto', item);\n            }\n        }\n        const sides = ['left', 'top', 'right', 'bottom'];\n        // As this is a pasted table, we do not want default table styles to apply here\n        // so we set border node for sides that does not have any border style.\n        // It is enough to verify border style as border color and border width properties have default values in DOM.\n        if (sides.every(side => !item.hasStyle(`border-${side}-style`))) {\n            writer.setStyle('border-style', 'none', item);\n        }\n        else {\n            for (const side of sides) {\n                if (!item.hasStyle(`border-${side}-style`)) {\n                    writer.setStyle(`border-${side}-style`, 'none', item);\n                }\n            }\n        }\n        // Translate style length units to px.\n        const props = [\n            'width',\n            'height',\n            ...sides.map(side => `border-${side}-width`),\n            ...sides.map(side => `padding-${side}`)\n        ];\n        for (const prop of props) {\n            if (item.hasStyle(prop)) {\n                writer.setStyle(prop, convertCssLengthToPx(item.getStyle(prop)), item);\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/removemsattributes\n */\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\n/**\n * Cleanup MS attributes like styles, attributes and elements.\n *\n * @param documentFragment element `data.content` obtained from clipboard.\n * @internal\n */\nexport function removeMSAttributes(documentFragment) {\n    const elementsToUnwrap = [];\n    const writer = new ViewUpcastWriter(documentFragment.document);\n    for (const { item } of writer.createRangeIn(documentFragment)) {\n        if (!item.is('element')) {\n            continue;\n        }\n        for (const className of item.getClassNames()) {\n            if (/\\bmso/gi.exec(className)) {\n                writer.removeClass(className, item);\n            }\n        }\n        for (const styleName of item.getStyleNames()) {\n            if (/\\bmso/gi.exec(styleName)) {\n                writer.removeStyle(styleName, item);\n            }\n        }\n        if (item.is('element', 'w:sdt') ||\n            item.is('element', 'w:sdtpr') && item.isEmpty ||\n            item.is('element', 'o:p') && item.isEmpty) {\n            elementsToUnwrap.push(item);\n        }\n    }\n    for (const item of elementsToUnwrap) {\n        const itemParent = item.parent;\n        const childIndex = itemParent.getChildIndex(item);\n        writer.insertChild(childIndex, item.getChildren(), itemParent);\n        writer.remove(item);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/br\n */\nimport { ViewDomConverter, ViewDocument } from 'ckeditor5/src/engine.js';\n/**\n * Transforms `<br>` elements that are siblings to some block element into a paragraphs.\n *\n * @param documentFragment The view structure to be transformed.\n * @internal\n */\nexport function transformBlockBrsToParagraphs(documentFragment, writer) {\n    const viewDocument = new ViewDocument(writer.document.stylesProcessor);\n    const domConverter = new ViewDomConverter(viewDocument, { renderingMode: 'data' });\n    const blockElements = domConverter.blockElements;\n    const inlineObjectElements = domConverter.inlineObjectElements;\n    const elementsToReplace = [];\n    for (const value of writer.createRangeIn(documentFragment)) {\n        const element = value.item;\n        if (element.is('element', 'br')) {\n            const nextSibling = findSibling(element, 'forward', writer, { blockElements, inlineObjectElements });\n            const previousSibling = findSibling(element, 'backward', writer, { blockElements, inlineObjectElements });\n            const nextSiblingIsBlock = isBlockViewElement(nextSibling, blockElements);\n            const previousSiblingIsBlock = isBlockViewElement(previousSibling, blockElements);\n            // If the <br> is surrounded by blocks then convert it to a paragraph:\n            // * <p>foo</p>[<br>]<p>bar</p> -> <p>foo</p>[<p></p>]<p>bar</p>\n            // * <p>foo</p>[<br>] -> <p>foo</p>[<p></p>]\n            // * [<br>]<p>foo</p> -> [<p></p>]<p>foo</p>\n            if (previousSiblingIsBlock || nextSiblingIsBlock) {\n                elementsToReplace.push(element);\n            }\n        }\n    }\n    for (const element of elementsToReplace) {\n        if (element.hasClass('Apple-interchange-newline')) {\n            writer.remove(element);\n        }\n        else {\n            writer.replace(element, writer.createElement('p'));\n        }\n    }\n}\n/**\n * Returns sibling node, threats inline elements as transparent (but should stop on an inline objects).\n */\nfunction findSibling(viewElement, direction, writer, { blockElements, inlineObjectElements }) {\n    let position = writer.createPositionAt(viewElement, direction == 'forward' ? 'after' : 'before');\n    // Find first position that is just before a first:\n    // * text node,\n    // * block element,\n    // * inline object element.\n    // It's ignoring any inline (non-object) elements like span, strong, etc.\n    position = position.getLastMatchingPosition(({ item }) => (item.is('element') &&\n        !blockElements.includes(item.name) &&\n        !inlineObjectElements.includes(item.name)), { direction });\n    return direction == 'forward' ? position.nodeAfter : position.nodeBefore;\n}\n/**\n * Returns true for view elements that are listed as block view elements.\n */\nfunction isBlockViewElement(node, blockElements) {\n    return !!node && node.is('element') && blockElements.includes(node.name);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Replaces tab characters with spaces in text nodes that are inside elements styled with `white-space: pre-wrap`.\n *\n * This is a workaround for incorrect detection of pre-like formatting in the DOM converter for pasted Google Docs documents.\n * When an element uses `white-space: pre-wrap`, the editor reduces tab characters to a single space, causing\n * inconsistent spacing in pasted content. This function replaces tabs with spaces to ensure visual consistency.\n * This is intended as a temporary solution.\n *\n * See: https://github.com/ckeditor/ckeditor5/issues/18995\n *\n * @param documentFragment The `data.content` element obtained from the clipboard.\n * @param writer The upcast writer used to manipulate the view structure.\n * @param tabWidth The number of spaces to replace each tab with. Defaults to 8.\n * @internal\n */\nexport function replaceTabsWithinPreWithSpaces(documentFragment, writer, tabWidth) {\n    // Collect all text nodes with tabs that are inside pre-wrap elements.\n    const textNodesToReplace = new Set();\n    for (const child of writer.createRangeIn(documentFragment).getItems()) {\n        if (!child.is('view:$textProxy') || !child.data.includes('\\t')) {\n            continue;\n        }\n        // Check if any parent has `white-space: pre-wrap`.\n        if (hasPreWrapParent(child.parent)) {\n            textNodesToReplace.add(child.textNode);\n        }\n    }\n    // Replace tabs in each collected text node.\n    for (const textNode of textNodesToReplace) {\n        replaceTabsInTextNode(textNode, writer, tabWidth);\n    }\n}\n/**\n * Checks if element or any of its parents has `white-space: pre-wrap` style.\n */\nfunction hasPreWrapParent(element) {\n    let parent = element;\n    while (parent) {\n        if (parent.is('element')) {\n            const whiteSpace = parent.getStyle?.('white-space');\n            if (whiteSpace === 'pre-wrap') {\n                return true;\n            }\n        }\n        parent = parent.parent;\n    }\n    return false;\n}\n/**\n * Replaces all tabs with spaces in the given text node.\n */\nfunction replaceTabsInTextNode(textNode, writer, tabWidth) {\n    const { parent, data } = textNode;\n    const replacedData = data.replaceAll('\\t', ' '.repeat(tabWidth));\n    const index = parent.getChildIndex(textNode);\n    // Remove old node and insert new one with replaced tabs.\n    writer.remove(textNode);\n    writer.insertChild(index, writer.createText(replacedData), parent);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/normalizers/googledocsnormalizer\n */\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { removeBoldWrapper } from '../filters/removeboldwrapper.js';\nimport { transformBlockBrsToParagraphs } from '../filters/br.js';\nimport { unwrapParagraphInListItem } from '../filters/list.js';\nimport { replaceTabsWithinPreWithSpaces } from '../filters/replacetabswithinprewithspaces.js';\nconst googleDocsMatch = /id=(\"|')docs-internal-guid-[-0-9a-f]+(\"|')/i;\n/**\n * Normalizer for the content pasted from Google Docs.\n *\n * @internal\n */\nexport class GoogleDocsNormalizer {\n    document;\n    /**\n     * Creates a new `GoogleDocsNormalizer` instance.\n     *\n     * @param document View document.\n     */\n    constructor(document) {\n        this.document = document;\n    }\n    /**\n     * @inheritDoc\n     */\n    isActive(htmlString) {\n        return googleDocsMatch.test(htmlString);\n    }\n    /**\n     * @inheritDoc\n     */\n    execute(data) {\n        const writer = new ViewUpcastWriter(this.document);\n        const { body: documentFragment } = data._parsedData;\n        removeBoldWrapper(documentFragment, writer);\n        unwrapParagraphInListItem(documentFragment, writer);\n        transformBlockBrsToParagraphs(documentFragment, writer);\n        replaceTabsWithinPreWithSpaces(documentFragment, writer, 8);\n        data.content = documentFragment;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Removes the `<b>` tag wrapper added by Google Docs to a copied content.\n *\n * @param documentFragment element `data.content` obtained from clipboard\n * @internal\n */\nexport function removeBoldWrapper(documentFragment, writer) {\n    for (const child of documentFragment.getChildren()) {\n        if (child.is('element', 'b') && child.getStyle('font-weight') === 'normal') {\n            const childIndex = documentFragment.getChildIndex(child);\n            writer.remove(child);\n            writer.insertChild(childIndex, child.getChildren(), documentFragment);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/normalizers/googlesheetsnormalizer\n */\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { removeXmlns } from '../filters/removexmlns.js';\nimport { removeGoogleSheetsTag } from '../filters/removegooglesheetstag.js';\nimport { removeInvalidTableWidth } from '../filters/removeinvalidtablewidth.js';\nimport { removeStyleBlock } from '../filters/removestyleblock.js';\nconst googleSheetsMatch = /<google-sheets-html-origin/i;\n/**\n * Normalizer for the content pasted from Google Sheets.\n *\n * @internal\n */\nexport class GoogleSheetsNormalizer {\n    document;\n    /**\n     * Creates a new `GoogleSheetsNormalizer` instance.\n     *\n     * @param document View document.\n     */\n    constructor(document) {\n        this.document = document;\n    }\n    /**\n     * @inheritDoc\n     */\n    isActive(htmlString) {\n        return googleSheetsMatch.test(htmlString);\n    }\n    /**\n     * @inheritDoc\n     */\n    execute(data) {\n        const writer = new ViewUpcastWriter(this.document);\n        const { body: documentFragment } = data._parsedData;\n        removeGoogleSheetsTag(documentFragment, writer);\n        removeXmlns(documentFragment, writer);\n        removeInvalidTableWidth(documentFragment, writer);\n        removeStyleBlock(documentFragment, writer);\n        data.content = documentFragment;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Removes the `<google-sheets-html-origin>` tag wrapper added by Google Sheets to a copied content.\n *\n * @param documentFragment element `data.content` obtained from clipboard\n * @internal\n */\nexport function removeGoogleSheetsTag(documentFragment, writer) {\n    for (const child of documentFragment.getChildren()) {\n        if (child.is('element', 'google-sheets-html-origin')) {\n            const childIndex = documentFragment.getChildIndex(child);\n            writer.remove(child);\n            writer.insertChild(childIndex, child.getChildren(), documentFragment);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Removes the `xmlns` attribute from table pasted from Google Sheets.\n *\n * @param documentFragment element `data.content` obtained from clipboard\n * @internal\n */\nexport function removeXmlns(documentFragment, writer) {\n    for (const child of documentFragment.getChildren()) {\n        if (child.is('element', 'table') && child.hasAttribute('xmlns')) {\n            writer.removeAttribute('xmlns', child);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Removes `<style>` block added by Google Sheets to a copied content.\n *\n * @param documentFragment element `data.content` obtained from clipboard\n * @internal\n */\nexport function removeStyleBlock(documentFragment, writer) {\n    for (const child of Array.from(documentFragment.getChildren())) {\n        if (child.is('element', 'style')) {\n            writer.remove(child);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/space\n */\n/**\n * Replaces last space preceding elements closing tag with `&nbsp;`. Such operation prevents spaces from being removed\n * during further DOM/View processing (see especially {@link module:engine/view/domconverter~ViewDomConverter#_processDomInlineNodes}).\n * This method also takes into account Word specific `<o:p></o:p>` empty tags.\n * Additionally multiline sequences of spaces and new lines between tags are removed (see #39 and #40).\n *\n * @param htmlString HTML string in which spacing should be normalized.\n * @returns Input HTML with spaces normalized.\n * @internal\n */\nexport function normalizeSpacing(htmlString) {\n    // Run normalizeSafariSpaceSpans() two times to cover nested spans.\n    return normalizeSafariSpaceSpans(normalizeSafariSpaceSpans(htmlString))\n        // Remove all \\r\\n from \"spacerun spans\" so the last replace line doesn't strip all whitespaces.\n        .replace(/(<span\\s+style=['\"]mso-spacerun:yes['\"]>[^\\S\\r\\n]*?)[\\r\\n]+([^\\S\\r\\n]*<\\/span>)/g, '$1$2')\n        .replace(/<span\\s+style=['\"]mso-spacerun:yes['\"]><\\/span>/g, '')\n        .replace(/(<span\\s+style=['\"]letter-spacing:[^'\"]+?['\"]>)[\\r\\n]+(<\\/span>)/g, '$1 $2')\n        .replace(/ <\\//g, '\\u00A0</')\n        .replace(/ <o:p><\\/o:p>/g, '\\u00A0<o:p></o:p>')\n        // Remove <o:p> block filler from empty paragraph. Safari uses \\u00A0 instead of &nbsp;.\n        .replace(/<o:p>(&nbsp;|\\u00A0)<\\/o:p>/g, '')\n        // Remove all whitespaces when they contain any \\r or \\n.\n        .replace(/>([^\\S\\r\\n]*[\\r\\n]\\s*)</g, '><');\n}\n/**\n * Normalizes spacing in special Word `spacerun spans` (`<span style='mso-spacerun:yes'>\\s+</span>`) by replacing\n * all spaces with `&nbsp; ` pairs. This prevents spaces from being removed during further DOM/View processing\n * (see especially {@link module:engine/view/domconverter~ViewDomConverter#_processDomInlineNodes}).\n *\n * @param htmlDocument Native `Document` object in which spacing should be normalized.\n * @internal\n */\nexport function normalizeSpacerunSpans(htmlDocument) {\n    htmlDocument.querySelectorAll('span[style*=spacerun]').forEach(el => {\n        const htmlElement = el;\n        const innerTextLength = htmlElement.innerText.length || 0;\n        htmlElement.innerText = Array(innerTextLength + 1).join('\\u00A0 ').substr(0, innerTextLength);\n    });\n}\n/**\n * Normalizes specific spacing generated by Safari when content pasted from Word (`<span class=\"Apple-converted-space\"> </span>`)\n * by replacing all spaces sequences longer than 1 space with `&nbsp; ` pairs. This prevents spaces from being removed during\n * further DOM/View processing (see especially {@link module:engine/view/domconverter~ViewDomConverter#_processDataFromDomText}).\n *\n * This function is similar to {@link module:clipboard/utils/normalizeclipboarddata normalizeClipboardData util} but uses\n * regular spaces / &nbsp; sequence for replacement.\n *\n * @param htmlString HTML string in which spacing should be normalized\n * @returns Input HTML with spaces normalized.\n * @internal\n */\nfunction normalizeSafariSpaceSpans(htmlString) {\n    return htmlString.replace(/<span(?: class=\"Apple-converted-space\"|)>(\\s+)<\\/span>/g, (fullMatch, spaces) => {\n        return spaces.length === 1 ? ' ' : Array(spaces.length + 1).join('\\u00A0 ').substr(0, spaces.length);\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns a function that converts the model \"url\" attribute to the view representation.\n *\n * Depending on the configuration, the view representation can be \"semantic\" (for the data pipeline):\n *\n * ```html\n * <figure class=\"media\">\n * \t<oembed url=\"foo\"></oembed>\n * </figure>\n * ```\n *\n * or \"non-semantic\" (for the editing view pipeline):\n *\n * ```html\n * <figure class=\"media\">\n * \t<div data-oembed-url=\"foo\">[ non-semantic media preview for \"foo\" ]</div>\n * </figure>\n * ```\n *\n * **Note:** Changing the model \"url\" attribute replaces the entire content of the\n * `<figure>` in the view.\n *\n * @param registry The registry providing\n * the media and their content.\n * @param options options object with following properties:\n * - elementName When set, overrides the default element name for semantic media embeds.\n * - renderMediaPreview When `true`, the converter will create the view in the non-semantic form.\n * - renderForEditingView When `true`, the converter will create a view specific for the\n * editing pipeline (e.g. including CSS classes, content placeholders).\n *\n * @internal\n */\nexport function modelToViewUrlAttributeConverter(registry, options) {\n    const converter = (evt, data, conversionApi) => {\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const url = data.attributeNewValue;\n        const viewWriter = conversionApi.writer;\n        const figure = conversionApi.mapper.toViewElement(data.item);\n        const mediaContentElement = [...figure.getChildren()]\n            .find(child => child.getCustomProperty('media-content'));\n        // TODO: removing the wrapper and creating it from scratch is a hack. We can do better than that.\n        viewWriter.remove(mediaContentElement);\n        const mediaViewElement = registry.getMediaViewElement(viewWriter, url, options);\n        viewWriter.insert(viewWriter.createPositionAt(figure, 0), mediaViewElement);\n    };\n    return dispatcher => {\n        dispatcher.on('attribute:url:media', converter);\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { isWidget, toWidget } from 'ckeditor5/src/widget.js';\n/**\n * Converts a given {@link module:engine/view/element~ViewElement} to a media embed widget:\n * * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property}\n * allowing to recognize the media widget element.\n * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.\n *\n * @param writer An instance of the view writer.\n * @param label The element's label.\n * @internal\n */\nexport function toMediaWidget(viewElement, writer, label) {\n    writer.setCustomProperty('media', true, viewElement);\n    return toWidget(viewElement, writer, { label });\n}\n/**\n * Returns a media widget editing view element if one is selected.\n *\n * @internal\n */\nexport function getSelectedMediaViewWidget(selection) {\n    const viewElement = selection.getSelectedElement();\n    if (viewElement && isMediaWidget(viewElement)) {\n        return viewElement;\n    }\n    return null;\n}\n/**\n * Checks if a given view element is a media widget.\n *\n * @internal\n */\nexport function isMediaWidget(viewElement) {\n    return !!viewElement.getCustomProperty('media') && isWidget(viewElement);\n}\n/**\n * Creates a view element representing the media. Either a \"semantic\" one for the data pipeline:\n *\n * ```html\n * <figure class=\"media\">\n * \t<oembed url=\"foo\"></oembed>\n * </figure>\n * ```\n *\n * or a \"non-semantic\" (for the editing view pipeline):\n *\n * ```html\n * <figure class=\"media\">\n * \t<div data-oembed-url=\"foo\">[ non-semantic media preview for \"foo\" ]</div>\n * </figure>\n * ```\n *\n * @internal\n */\nexport function createMediaFigureElement(writer, registry, url, options) {\n    return writer.createContainerElement('figure', { class: 'media' }, [\n        registry.getMediaViewElement(writer, url, options),\n        writer.createSlot()\n    ]);\n}\n/**\n * Returns a selected media element in the model, if any.\n *\n * @internal\n */\nexport function getSelectedMediaModelWidget(selection) {\n    const selectedElement = selection.getSelectedElement();\n    if (selectedElement && selectedElement.is('element', 'media')) {\n        return selectedElement;\n    }\n    return null;\n}\n/**\n * Creates a media element and inserts it into the model.\n *\n * **Note**: This method will use {@link module:engine/model/model~Model#insertContent `model.insertContent()`} logic of inserting content\n * if no `insertPosition` is passed.\n *\n * @param url An URL of an embeddable media.\n * @param findOptimalPosition If true it will try to find optimal position to insert media without breaking content\n * in which a selection is.\n * @internal\n */\nexport function insertMedia(model, url, selectable, findOptimalPosition) {\n    model.change(writer => {\n        const mediaElement = writer.createElement('media', { url });\n        model.insertObject(mediaElement, selectable, null, {\n            setSelection: 'on',\n            findOptimalPosition: findOptimalPosition ? 'auto' : undefined\n        });\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { findOptimalInsertionRange } from 'ckeditor5/src/widget.js';\nimport { getSelectedMediaModelWidget, insertMedia } from './utils.js';\n/**\n * The insert media command.\n *\n * The command is registered by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} as `'mediaEmbed'`.\n *\n * To insert media at the current selection, execute the command and specify the URL:\n *\n * ```ts\n * editor.execute( 'mediaEmbed', 'http://url.to.the/media' );\n * ```\n */\nexport class MediaEmbedCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const selectedMedia = getSelectedMediaModelWidget(selection);\n        this.value = selectedMedia ? selectedMedia.getAttribute('url') : undefined;\n        this.isEnabled = isMediaSelected(selection) || isAllowedInParent(selection, model);\n    }\n    /**\n     * Executes the command, which either:\n     *\n     * * updates the URL of the selected media,\n     * * inserts the new media into the editor and puts the selection around it.\n     *\n     * @fires execute\n     * @param url The URL of the media.\n     */\n    execute(url) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const selectedMedia = getSelectedMediaModelWidget(selection);\n        if (selectedMedia) {\n            model.change(writer => {\n                writer.setAttribute('url', url, selectedMedia);\n            });\n        }\n        else {\n            insertMedia(model, url, selection, true);\n        }\n    }\n}\n/**\n * Checks if the media embed is allowed in the parent.\n */\nfunction isAllowedInParent(selection, model) {\n    const insertionRange = findOptimalInsertionRange(selection, model);\n    let parent = insertionRange.start.parent;\n    // The model.insertContent() will remove empty parent (unless it is a $root or a limit).\n    if (parent.isEmpty && !model.schema.isLimit(parent)) {\n        parent = parent.parent;\n    }\n    return model.schema.checkChild(parent, 'media');\n}\n/**\n * Checks if the media object is selected.\n */\nfunction isMediaSelected(selection) {\n    const element = selection.getSelectedElement();\n    return !!element && element.name === 'media';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module media-embed/mediaregistry\n */\nimport { IconView, Template } from 'ckeditor5/src/ui.js';\nimport { IconMediaPlaceholder } from 'ckeditor5/src/icons.js';\nimport { logWarning, toArray } from 'ckeditor5/src/utils.js';\nconst mediaPlaceholderIconViewBox = '0 0 64 42';\n/**\n * A bridge between the raw media content provider definitions and the editor view content.\n *\n * It helps translating media URLs to corresponding {@link module:engine/view/element~ViewElement view elements}.\n *\n * Mostly used by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} plugin.\n */\nexport class MediaRegistry {\n    /**\n     * The {@link module:utils/locale~Locale} instance.\n     */\n    locale;\n    /**\n     * The media provider definitions available for the registry. Usually corresponding with the\n     * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig media configuration}.\n     */\n    providerDefinitions;\n    /**\n     * Creates an instance of the {@link module:media-embed/mediaregistry~MediaRegistry} class.\n     *\n     * @param locale The localization services instance.\n     * @param config The configuration of the media embed feature.\n     */\n    constructor(locale, config) {\n        const providers = config.providers;\n        const extraProviders = config.extraProviders || [];\n        const removedProviders = new Set(config.removeProviders);\n        const providerDefinitions = providers\n            .concat(extraProviders)\n            .filter(provider => {\n            const name = provider.name;\n            if (!name) {\n                /**\n                 * One of the providers (or extra providers) specified in the media embed configuration\n                 * has no name and will not be used by the editor. In order to get this media\n                 * provider working, double check your editor configuration.\n                 *\n                 * @error media-embed-no-provider-name\n                 */\n                logWarning('media-embed-no-provider-name', { provider });\n                return false;\n            }\n            return !removedProviders.has(name);\n        });\n        this.locale = locale;\n        this.providerDefinitions = providerDefinitions;\n    }\n    /**\n     * Checks whether the passed URL is representing a certain media type allowed in the editor.\n     *\n     * @param url The URL to be checked\n     */\n    hasMedia(url) {\n        return !!this._getMedia(url);\n    }\n    /**\n     * For the given media URL string and options, it returns the {@link module:engine/view/element~ViewElement view element}\n     * representing that media.\n     *\n     * **Note:** If no URL is specified, an empty view element is returned.\n     *\n     * @param writer The view writer used to produce a view element.\n     * @param url The URL to be translated into a view element.\n     */\n    getMediaViewElement(writer, url, options) {\n        return this._getMedia(url).getViewElement(writer, options);\n    }\n    /**\n     * Returns a `Media` instance for the given URL.\n     *\n     * @param url The URL of the media.\n     * @returns The `Media` instance or `null` when there is none.\n     */\n    _getMedia(url) {\n        if (!url) {\n            return new Media(this.locale);\n        }\n        url = url.trim();\n        for (const definition of this.providerDefinitions) {\n            const previewRenderer = definition.html;\n            const pattern = toArray(definition.url);\n            for (const subPattern of pattern) {\n                const match = this._getUrlMatches(url, subPattern);\n                if (match) {\n                    return new Media(this.locale, url, match, previewRenderer);\n                }\n            }\n        }\n        return null;\n    }\n    /**\n     * Tries to match `url` to `pattern`.\n     *\n     * @param url The URL of the media.\n     * @param pattern The pattern that should accept the media URL.\n     */\n    _getUrlMatches(url, pattern) {\n        // 1. Try to match without stripping the protocol and \"www\" subdomain.\n        let match = url.match(pattern);\n        if (match) {\n            return match;\n        }\n        // 2. Try to match after stripping the protocol.\n        let rawUrl = url.replace(/^https?:\\/\\//, '');\n        match = rawUrl.match(pattern);\n        if (match) {\n            return match;\n        }\n        // 3. Try to match after stripping the \"www\" subdomain.\n        rawUrl = rawUrl.replace(/^www\\./, '');\n        match = rawUrl.match(pattern);\n        if (match) {\n            return match;\n        }\n        return null;\n    }\n}\n/**\n * Represents media defined by the provider configuration.\n *\n * It can be rendered to the {@link module:engine/view/element~ViewElement view element} and used in the editing or data pipeline.\n */\nclass Media {\n    /**\n     * The URL this Media instance represents.\n     */\n    url;\n    /**\n     * Shorthand for {@link module:utils/locale~Locale#t}.\n     *\n     * @see module:utils/locale~Locale#t\n     */\n    _locale;\n    /**\n     * The output of the `RegExp.match` which validated the {@link #url} of this media.\n     */\n    _match;\n    /**\n     * The function returning the HTML string preview of this media.\n     */\n    _previewRenderer;\n    constructor(locale, url, match, previewRenderer) {\n        this.url = this._getValidUrl(url);\n        this._locale = locale;\n        this._match = match;\n        this._previewRenderer = previewRenderer;\n    }\n    /**\n     * Returns the view element representation of the media.\n     *\n     * @param writer The view writer used to produce a view element.\n     */\n    getViewElement(writer, options) {\n        const attributes = {};\n        let viewElement;\n        if (options.renderForEditingView || (options.renderMediaPreview && this.url && this._previewRenderer)) {\n            if (this.url) {\n                attributes['data-oembed-url'] = this.url;\n            }\n            if (options.renderForEditingView) {\n                attributes.class = 'ck-media__wrapper';\n            }\n            const mediaHtml = this._getPreviewHtml(options);\n            viewElement = writer.createRawElement('div', attributes, (domElement, domConverter) => {\n                domConverter.setContentOf(domElement, mediaHtml);\n            });\n        }\n        else {\n            if (this.url) {\n                attributes.url = this.url;\n            }\n            viewElement = writer.createEmptyElement(options.elementName, attributes);\n        }\n        writer.setCustomProperty('media-content', true, viewElement);\n        return viewElement;\n    }\n    /**\n     * Returns the HTML string of the media content preview.\n     */\n    _getPreviewHtml(options) {\n        if (this._previewRenderer) {\n            return this._previewRenderer(this._match);\n        }\n        else {\n            // The placeholder only makes sense for editing view and media which have URLs.\n            // Placeholder is never displayed in data and URL-less media have no content.\n            if (this.url && options.renderForEditingView) {\n                return this._getPlaceholderHtml();\n            }\n            return '';\n        }\n    }\n    /**\n     * Returns the placeholder HTML when the media has no content preview.\n     */\n    _getPlaceholderHtml() {\n        const icon = new IconView();\n        const t = this._locale.t;\n        icon.content = IconMediaPlaceholder;\n        icon.viewBox = mediaPlaceholderIconViewBox;\n        const placeholder = new Template({\n            tag: 'div',\n            attributes: {\n                class: 'ck ck-reset_all ck-media__placeholder'\n            },\n            children: [\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: 'ck-media__placeholder__icon'\n                    },\n                    children: [icon]\n                },\n                {\n                    tag: 'a',\n                    attributes: {\n                        class: 'ck-media__placeholder__url',\n                        target: '_blank',\n                        rel: 'noopener noreferrer',\n                        href: this.url,\n                        'data-cke-tooltip-text': t('Open media in new tab')\n                    },\n                    children: [\n                        {\n                            tag: 'span',\n                            attributes: {\n                                class: 'ck-media__placeholder__url__text'\n                            },\n                            children: [this.url]\n                        }\n                    ]\n                }\n            ]\n        }).render();\n        return placeholder.outerHTML;\n    }\n    /**\n     * Returns the full URL to the specified media.\n     *\n     * @param url The URL of the media.\n     */\n    _getValidUrl(url) {\n        if (!url) {\n            return null;\n        }\n        if (url.match(/^https?/)) {\n            return url;\n        }\n        return 'https://' + url;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 64 42\\\"><path d=\\\"M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098s-4.538-.083-4.538-1.678 2.032-3.43 4.538-4.098c.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556L49 17zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.99 1.99 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17m29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155zM20.6 21.375v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616V37.53zm24.233-16.155v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615V37.53zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module media-embed/mediaembedediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { modelToViewUrlAttributeConverter } from './converters.js';\nimport { MediaEmbedCommand } from './mediaembedcommand.js';\nimport { MediaRegistry } from './mediaregistry.js';\nimport { toMediaWidget, createMediaFigureElement } from './utils.js';\nimport '../theme/mediaembedediting.css';\n/**\n * The media embed editing feature.\n */\nexport class MediaEmbedEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'MediaEmbedEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * The media registry managing the media providers in the editor.\n     */\n    registry;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('mediaEmbed', {\n            elementName: 'oembed',\n            providers: [\n                {\n                    name: 'dailymotion',\n                    url: [\n                        /^dailymotion\\.com\\/video\\/(\\w+)/,\n                        /^dai.ly\\/(\\w+)/\n                    ],\n                    html: match => {\n                        const id = match[1];\n                        return ('<div style=\"position: relative; padding-bottom: 100%; height: 0; \">' +\n                            `<iframe src=\"https://www.dailymotion.com/embed/video/${id}\" ` +\n                            'style=\"position: absolute; width: 100%; height: 100%; top: 0; left: 0;\" ' +\n                            'frameborder=\"0\" width=\"480\" height=\"270\" allowfullscreen allow=\"autoplay\">' +\n                            '</iframe>' +\n                            '</div>');\n                    }\n                },\n                {\n                    name: 'spotify',\n                    url: [\n                        /^open\\.spotify\\.com\\/(artist\\/\\w+)/,\n                        /^open\\.spotify\\.com\\/(album\\/\\w+)/,\n                        /^open\\.spotify\\.com\\/(track\\/\\w+)/\n                    ],\n                    html: match => {\n                        const id = match[1];\n                        return ('<div style=\"position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;\">' +\n                            `<iframe src=\"https://open.spotify.com/embed/${id}\" ` +\n                            'style=\"position: absolute; width: 100%; height: 100%; top: 0; left: 0;\" ' +\n                            'frameborder=\"0\" allowtransparency=\"true\" allow=\"encrypted-media\">' +\n                            '</iframe>' +\n                            '</div>');\n                    }\n                },\n                {\n                    name: 'youtube',\n                    url: [\n                        /^(?:m\\.)?youtube\\.com\\/watch\\?v=([\\w-]+)(?:&t=(\\d+))?/,\n                        /^(?:m\\.)?youtube\\.com\\/shorts\\/([\\w-]+)(?:\\?t=(\\d+))?/,\n                        /^(?:m\\.)?youtube\\.com\\/v\\/([\\w-]+)(?:\\?t=(\\d+))?/,\n                        /^youtube\\.com\\/embed\\/([\\w-]+)(?:\\?start=(\\d+))?/,\n                        /^youtu\\.be\\/([\\w-]+)(?:\\?t=(\\d+))?/\n                    ],\n                    html: match => {\n                        const id = match[1];\n                        const time = match[2];\n                        return ('<div style=\"position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;\">' +\n                            `<iframe src=\"https://www.youtube.com/embed/${id}${time ? `?start=${time}` : ''}\" ` +\n                            'style=\"position: absolute; width: 100%; height: 100%; top: 0; left: 0;\" ' +\n                            'frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen>' +\n                            '</iframe>' +\n                            '</div>');\n                    }\n                },\n                {\n                    name: 'vimeo',\n                    url: [\n                        /^vimeo\\.com\\/(\\d+)/,\n                        /^vimeo\\.com\\/[^/]+\\/[^/]+\\/video\\/(\\d+)/,\n                        /^vimeo\\.com\\/album\\/[^/]+\\/video\\/(\\d+)/,\n                        /^vimeo\\.com\\/channels\\/[^/]+\\/(\\d+)/,\n                        /^vimeo\\.com\\/groups\\/[^/]+\\/videos\\/(\\d+)/,\n                        /^vimeo\\.com\\/ondemand\\/[^/]+\\/(\\d+)/,\n                        /^player\\.vimeo\\.com\\/video\\/(\\d+)/\n                    ],\n                    html: match => {\n                        const id = match[1];\n                        return ('<div style=\"position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;\">' +\n                            `<iframe src=\"https://player.vimeo.com/video/${id}\" ` +\n                            'style=\"position: absolute; width: 100%; height: 100%; top: 0; left: 0;\" ' +\n                            'frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen>' +\n                            '</iframe>' +\n                            '</div>');\n                    }\n                },\n                {\n                    name: 'instagram',\n                    url: [\n                        /^instagram\\.com\\/p\\/(\\w+)/,\n                        /^instagram\\.com\\/reel\\/(\\w+)/\n                    ]\n                },\n                {\n                    name: 'twitter',\n                    url: [\n                        /^twitter\\.com/,\n                        /^x\\.com/\n                    ]\n                },\n                {\n                    name: 'googleMaps',\n                    url: [\n                        /^google\\.com\\/maps/,\n                        /^goo\\.gl\\/maps/,\n                        /^maps\\.google\\.com/,\n                        /^maps\\.app\\.goo\\.gl/\n                    ]\n                },\n                {\n                    name: 'flickr',\n                    url: /^flickr\\.com/\n                },\n                {\n                    name: 'facebook',\n                    url: /^facebook\\.com/\n                }\n            ]\n        });\n        this.registry = new MediaRegistry(editor.locale, editor.config.get('mediaEmbed'));\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const t = editor.t;\n        const conversion = editor.conversion;\n        const renderMediaPreview = editor.config.get('mediaEmbed.previewsInData');\n        const elementName = editor.config.get('mediaEmbed.elementName');\n        const registry = this.registry;\n        editor.commands.add('mediaEmbed', new MediaEmbedCommand(editor));\n        // Configure the schema.\n        schema.register('media', {\n            inheritAllFrom: '$blockObject',\n            allowAttributes: ['url']\n        });\n        // Model -> Data\n        conversion.for('dataDowncast').elementToStructure({\n            model: 'media',\n            view: (modelElement, { writer }) => {\n                const url = modelElement.getAttribute('url');\n                return createMediaFigureElement(writer, registry, url, {\n                    elementName,\n                    renderMediaPreview: !!url && renderMediaPreview\n                });\n            }\n        });\n        // Model -> Data (url -> data-oembed-url)\n        conversion.for('dataDowncast').add(modelToViewUrlAttributeConverter(registry, {\n            elementName,\n            renderMediaPreview\n        }));\n        // Model -> View (element)\n        conversion.for('editingDowncast').elementToStructure({\n            model: 'media',\n            view: (modelElement, { writer }) => {\n                const url = modelElement.getAttribute('url');\n                const figure = createMediaFigureElement(writer, registry, url, {\n                    elementName,\n                    renderForEditingView: true\n                });\n                return toMediaWidget(figure, writer, t('media widget'));\n            }\n        });\n        // Model -> View (url -> data-oembed-url)\n        conversion.for('editingDowncast').add(modelToViewUrlAttributeConverter(registry, {\n            elementName,\n            renderForEditingView: true\n        }));\n        // View -> Model (data-oembed-url -> url)\n        conversion.for('upcast')\n            // Upcast semantic media.\n            .elementToElement({\n            view: element => ['oembed', elementName].includes(element.name) && element.getAttribute('url') ?\n                { name: true } :\n                null,\n            model: (viewMedia, { writer }) => {\n                const url = viewMedia.getAttribute('url');\n                if (registry.hasMedia(url)) {\n                    return writer.createElement('media', { url });\n                }\n                return null;\n            }\n        })\n            // Upcast non-semantic media.\n            .elementToElement({\n            view: {\n                name: 'div',\n                attributes: {\n                    'data-oembed-url': true\n                }\n            },\n            model: (viewMedia, { writer }) => {\n                const url = viewMedia.getAttribute('data-oembed-url');\n                if (registry.hasMedia(url)) {\n                    return writer.createElement('media', { url });\n                }\n                return null;\n            }\n        })\n            // Consume `<figure class=\"media\">` elements, that were left after upcast.\n            .add(dispatcher => {\n            const converter = (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.consume(data.viewItem, { name: true, classes: 'media' })) {\n                    return;\n                }\n                const { modelRange, modelCursor } = conversionApi.convertChildren(data.viewItem, data.modelCursor);\n                data.modelRange = modelRange;\n                data.modelCursor = modelCursor;\n                const modelElement = first(modelRange.getItems());\n                if (!modelElement) {\n                    // Revert consumed figure so other features can convert it.\n                    conversionApi.consumable.revert(data.viewItem, { name: true, classes: 'media' });\n                }\n            };\n            dispatcher.on('element:figure', converter);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module media-embed/automediaembed\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ModelLiveRange, ModelLivePosition } from 'ckeditor5/src/engine.js';\nimport { Clipboard } from 'ckeditor5/src/clipboard.js';\nimport { Delete } from 'ckeditor5/src/typing.js';\nimport { Undo } from 'ckeditor5/src/undo.js';\nimport { global } from 'ckeditor5/src/utils.js';\nimport { MediaEmbedEditing } from './mediaembedediting.js';\nimport { insertMedia } from './utils.js';\nconst URL_REGEXP = /^(?:http(s)?:\\/\\/)?[\\w-]+\\.[\\w-.~:/?#[\\]@!$&'()*+,;=%]+$/;\n/**\n * The auto-media embed plugin. It recognizes media links in the pasted content and embeds\n * them shortly after they are injected into the document.\n */\nexport class AutoMediaEmbed extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Clipboard, Delete, Undo];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'AutoMediaEmbed';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * The paste–to–embed `setTimeout` ID. Stored as a property to allow\n     * cleaning of the timeout.\n     */\n    _timeoutId;\n    /**\n     * The position where the `<media>` element will be inserted after the timeout,\n     * determined each time the new content is pasted into the document.\n     */\n    _positionToInsert;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this._timeoutId = null;\n        this._positionToInsert = null;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const modelDocument = editor.model.document;\n        // We need to listen on `Clipboard#inputTransformation` because we need to save positions of selection.\n        // After pasting, the content between those positions will be checked for a URL that could be transformed\n        // into media.\n        const clipboardPipeline = editor.plugins.get('ClipboardPipeline');\n        this.listenTo(clipboardPipeline, 'inputTransformation', () => {\n            const firstRange = modelDocument.selection.getFirstRange();\n            const leftLivePosition = ModelLivePosition.fromPosition(firstRange.start);\n            leftLivePosition.stickiness = 'toPrevious';\n            const rightLivePosition = ModelLivePosition.fromPosition(firstRange.end);\n            rightLivePosition.stickiness = 'toNext';\n            modelDocument.once('change:data', () => {\n                this._embedMediaBetweenPositions(leftLivePosition, rightLivePosition);\n                leftLivePosition.detach();\n                rightLivePosition.detach();\n            }, { priority: 'high' });\n        });\n        const undoCommand = editor.commands.get('undo');\n        undoCommand.on('execute', () => {\n            if (this._timeoutId) {\n                global.window.clearTimeout(this._timeoutId);\n                this._positionToInsert.detach();\n                this._timeoutId = null;\n                this._positionToInsert = null;\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * Analyzes the part of the document between provided positions in search for a URL representing media.\n     * When the URL is found, it is automatically converted into media.\n     *\n     * @param leftPosition Left position of the selection.\n     * @param rightPosition Right position of the selection.\n     */\n    _embedMediaBetweenPositions(leftPosition, rightPosition) {\n        const editor = this.editor;\n        const mediaRegistry = editor.plugins.get(MediaEmbedEditing).registry;\n        // TODO: Use marker instead of ModelLiveRange & LivePositions.\n        const urlRange = new ModelLiveRange(leftPosition, rightPosition);\n        const walker = urlRange.getWalker({ ignoreElementEnd: true });\n        let url = '';\n        for (const node of walker) {\n            if (node.item.is('$textProxy')) {\n                url += node.item.data;\n            }\n        }\n        url = url.trim();\n        // If the URL does not match to universal URL regexp, let's skip that.\n        if (!url.match(URL_REGEXP)) {\n            urlRange.detach();\n            return;\n        }\n        // If the URL represents a media, let's use it.\n        if (!mediaRegistry.hasMedia(url)) {\n            urlRange.detach();\n            return;\n        }\n        const mediaEmbedCommand = editor.commands.get('mediaEmbed');\n        // Do not anything if media element cannot be inserted at the current position (#47).\n        if (!mediaEmbedCommand.isEnabled) {\n            urlRange.detach();\n            return;\n        }\n        // Position won't be available in the `setTimeout` function so let's clone it.\n        this._positionToInsert = ModelLivePosition.fromPosition(leftPosition);\n        // This action mustn't be executed if undo was called between pasting and auto-embedding.\n        this._timeoutId = global.window.setTimeout(() => {\n            editor.model.change(writer => {\n                this._timeoutId = null;\n                writer.remove(urlRange);\n                urlRange.detach();\n                let insertionPosition = null;\n                // Check if position where the media element should be inserted is still valid.\n                // Otherwise leave it as undefined to use document.selection - default behavior of model.insertContent().\n                if (this._positionToInsert.root.rootName !== '$graveyard') {\n                    insertionPosition = this._positionToInsert;\n                }\n                insertMedia(editor.model, url, insertionPosition, false);\n                this._positionToInsert.detach();\n                this._positionToInsert = null;\n            });\n            editor.plugins.get(Delete).requestUndoOnBackspace();\n        }, 100);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module media-embed/ui/mediaformview\n */\nimport { LabeledFieldView, View, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\n// See: #8833.\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';\nimport '../../theme/mediaform.css';\n/**\n * The media form view controller class.\n *\n * See {@link module:media-embed/ui/mediaformview~MediaFormView}.\n */\nexport class MediaFormView extends View {\n    /**\n     * Tracks information about the DOM focus in the form.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * The URL input view.\n     */\n    urlInputView;\n    /**\n     * An array of form validators used by {@link #isValid}.\n     */\n    _validators;\n    /**\n     * The default info text for the {@link #urlInputView}.\n     */\n    _urlInputViewInfoDefault;\n    /**\n     * The info text with an additional tip for the {@link #urlInputView},\n     * displayed when the input has some value.\n     */\n    _urlInputViewInfoTip;\n    /**\n     * @param validators Form validators used by {@link #isValid}.\n     * @param locale The localization services instance.\n     */\n    constructor(validators, locale) {\n        super(locale);\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.set('mediaURLInputValue', '');\n        this.urlInputView = this._createUrlInput();\n        this._validators = validators;\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-media-form',\n                    'ck-responsive-form'\n                ],\n                tabindex: '-1'\n            },\n            children: [\n                this.urlInputView\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({\n            view: this\n        });\n        // Register the view in the focus tracker.\n        this.focusTracker.add(this.urlInputView.element);\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the {@link #urlInputView}.\n     */\n    focus() {\n        this.urlInputView.focus();\n    }\n    /**\n     * The native DOM `value` of the {@link #urlInputView} element.\n     *\n     * **Note**: Do not confuse it with the {@link module:ui/inputtext/inputtextview~InputTextView#value}\n     * which works one way only and may not represent the actual state of the component in the DOM.\n     */\n    get url() {\n        return this.urlInputView.fieldView.element.value.trim();\n    }\n    set url(url) {\n        this.urlInputView.fieldView.value = url.trim();\n    }\n    /**\n     * Validates the form and returns `false` when some fields are invalid.\n     */\n    isValid() {\n        this.resetFormStatus();\n        for (const validator of this._validators) {\n            const errorText = validator(this);\n            // One error per field is enough.\n            if (errorText) {\n                // Apply updated error.\n                this.urlInputView.errorText = errorText;\n                return false;\n            }\n        }\n        return true;\n    }\n    /**\n     * Cleans up the supplementary error and information text of the {@link #urlInputView}\n     * bringing them back to the state when the form has been displayed for the first time.\n     *\n     * See {@link #isValid}.\n     */\n    resetFormStatus() {\n        this.urlInputView.errorText = null;\n        this.urlInputView.infoText = this._urlInputViewInfoDefault;\n    }\n    /**\n     * Creates a labeled input view.\n     *\n     * @returns Labeled input view instance.\n     */\n    _createUrlInput() {\n        const t = this.locale.t;\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);\n        const inputField = labeledInput.fieldView;\n        this._urlInputViewInfoDefault = t('Paste the media URL in the input.');\n        this._urlInputViewInfoTip = t('Tip: Paste the URL into the content to embed faster.');\n        labeledInput.label = t('Media URL');\n        labeledInput.infoText = this._urlInputViewInfoDefault;\n        inputField.inputMode = 'url';\n        inputField.on('input', () => {\n            // Display the tip text only when there is some value. Otherwise fall back to the default info text.\n            labeledInput.infoText = inputField.element.value ? this._urlInputViewInfoTip : this._urlInputViewInfoDefault;\n            this.mediaURLInputValue = inputField.element.value.trim();\n        });\n        return labeledInput;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module media-embed/mediaembedui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconMedia } from 'ckeditor5/src/icons.js';\nimport { ButtonView, CssTransitionDisablerMixin, MenuBarMenuListItemButtonView, Dialog } from 'ckeditor5/src/ui.js';\nimport { MediaFormView } from './ui/mediaformview.js';\nimport { MediaEmbedEditing } from './mediaembedediting.js';\n/**\n * The media embed UI plugin.\n */\nexport class MediaEmbedUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [MediaEmbedEditing, Dialog];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'MediaEmbedUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    _formView;\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('mediaEmbed', () => {\n            const t = this.editor.locale.t;\n            const button = this._createDialogButton(ButtonView);\n            button.tooltip = true;\n            button.label = t('Insert media');\n            return button;\n        });\n        editor.ui.componentFactory.add('menuBar:mediaEmbed', () => {\n            const t = this.editor.locale.t;\n            const button = this._createDialogButton(MenuBarMenuListItemButtonView);\n            button.label = t('Media');\n            return button;\n        });\n    }\n    /**\n     * Creates a button for menu bar that will show media embed dialog.\n     */\n    _createDialogButton(ButtonClass) {\n        const editor = this.editor;\n        const buttonView = new ButtonClass(editor.locale);\n        const command = editor.commands.get('mediaEmbed');\n        const dialogPlugin = this.editor.plugins.get('Dialog');\n        buttonView.icon = IconMedia;\n        buttonView.bind('isEnabled').to(command, 'isEnabled');\n        buttonView.on('execute', () => {\n            if (dialogPlugin.id === 'mediaEmbed') {\n                dialogPlugin.hide();\n            }\n            else {\n                this._showDialog();\n            }\n        });\n        return buttonView;\n    }\n    _showDialog() {\n        const editor = this.editor;\n        const dialog = editor.plugins.get('Dialog');\n        const command = editor.commands.get('mediaEmbed');\n        const t = editor.locale.t;\n        const isMediaSelected = command.value !== undefined;\n        if (!this._formView) {\n            const registry = editor.plugins.get(MediaEmbedEditing).registry;\n            this._formView = new (CssTransitionDisablerMixin(MediaFormView))(getFormValidators(editor.t, registry), editor.locale);\n            this._formView.on('submit', () => this._handleSubmitForm());\n        }\n        dialog.show({\n            id: 'mediaEmbed',\n            title: t('Media embed'),\n            content: this._formView,\n            isModal: true,\n            onShow: () => {\n                this._formView.url = command.value || '';\n                this._formView.resetFormStatus();\n                this._formView.urlInputView.fieldView.select();\n            },\n            actionButtons: [\n                {\n                    label: t('Cancel'),\n                    withText: true,\n                    onExecute: () => dialog.hide()\n                },\n                {\n                    label: isMediaSelected ? t('Save') : t('Insert'),\n                    class: 'ck-button-action',\n                    withText: true,\n                    onExecute: () => this._handleSubmitForm()\n                }\n            ]\n        });\n    }\n    _handleSubmitForm() {\n        const editor = this.editor;\n        const dialog = editor.plugins.get('Dialog');\n        if (this._formView.isValid()) {\n            editor.execute('mediaEmbed', this._formView.url);\n            dialog.hide();\n            editor.editing.view.focus();\n        }\n    }\n}\nfunction getFormValidators(t, registry) {\n    return [\n        form => {\n            if (!form.url.length) {\n                return t('The URL must not be empty.');\n            }\n        },\n        form => {\n            if (!registry.hasMedia(form.url)) {\n                return t('This media URL is not supported.');\n            }\n        }\n    ];\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 22 20\\\"><path d=\\\"M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-14.24 1h13.008v12H4.467zm-2.208 1h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003l-.029 1h-.974zm16.448 0h1.003v1h-1.003zm-16.448 2h.974v1h-.974zm16.448 0h1.003v1h-1.003z\\\"/><path d=\\\"M8.374 6.648a.4.4 0 0 1 .395-.4.4.4 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M8.69 14.915q.08.078.36.093a.366.366 0 0 1 .345.485l-.003.01a.74.74 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.68.68 0 0 1 .644-.458q.295-.018.386-.093a.3.3 0 0 0 .072-.11L9.592 4.5H6.269q-.538-.026-.75.09-.213.117-.442.563c-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486q.002-.426-.167-.54-.168-.114-.766-.091h-3.28l-2.68 10.257q-.009.111.038.158M3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1m11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module remove-format/removeformatui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconRemoveFormat } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nconst REMOVE_FORMAT = 'removeFormat';\n/**\n * The remove format UI plugin. It registers the `'removeFormat'` button which can be\n * used in the toolbar.\n */\nexport class RemoveFormatUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'RemoveFormatUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add(REMOVE_FORMAT, () => {\n            const view = this._createButton(ButtonView);\n            view.set({\n                tooltip: true\n            });\n            return view;\n        });\n        editor.ui.componentFactory.add(`menuBar:${REMOVE_FORMAT}`, () => this._createButton(MenuBarMenuListItemButtonView));\n    }\n    /**\n     * Creates a button for remove format command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get(REMOVE_FORMAT);\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            label: t('Remove Format'),\n            icon: IconRemoveFormat\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute(REMOVE_FORMAT);\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * The remove format command.\n *\n * It is used by the {@link module:remove-format/removeformat~RemoveFormat remove format feature}\n * to clear the formatting in the selection.\n *\n * ```ts\n * editor.execute( 'removeFormat' );\n * ```\n */\nexport class RemoveFormatCommand extends Command {\n    /**\n     * List of all registered custom attribute handlers.\n     */\n    _customAttributesHandlers = [];\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        this.isEnabled = !!first(this._getFormattingItems(model.document.selection));\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const model = this.editor.model;\n        model.change(writer => {\n            for (const item of this._getFormattingItems(model.document.selection)) {\n                if (item.is('selection')) {\n                    for (const attributeName of this._getFormattingAttributes(item)) {\n                        writer.removeSelectionAttribute(attributeName);\n                    }\n                }\n                else {\n                    // Workaround for items with multiple removable attributes. See\n                    // https://github.com/ckeditor/ckeditor5-remove-format/pull/1#pullrequestreview-220515609\n                    const itemRange = writer.createRangeOn(item);\n                    for (const attributeName of this._getFormattingAttributes(item)) {\n                        this._removeFormatting(attributeName, item, itemRange, writer);\n                    }\n                }\n            }\n        });\n    }\n    /**\n     * Registers a custom attribute handler that will be used to determine if an attribute is formatting and how to remove it.\n     *\n     * @internal\n     */\n    registerCustomAttribute(isFormatting, removeFormatting) {\n        this._customAttributesHandlers.push({\n            isFormatting,\n            removeFormatting\n        });\n    }\n    /**\n     * Helper method that removes a formatting attribute from an item either using custom callbacks or writer remove attribute.\n     */\n    _removeFormatting(attributeName, item, itemRange, writer) {\n        let customHandled = false;\n        for (const { isFormatting, removeFormatting } of this._customAttributesHandlers) {\n            if (isFormatting(attributeName, item)) {\n                removeFormatting(attributeName, itemRange, writer);\n                customHandled = true;\n            }\n        }\n        if (!customHandled) {\n            writer.removeAttribute(attributeName, itemRange);\n        }\n    }\n    /**\n     * Returns an iterable of items in a selection (including the selection itself) that have formatting model\n     * attributes to be removed by the feature.\n     */\n    *_getFormattingItems(selection) {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const itemHasRemovableFormatting = (item) => {\n            return !!first(this._getFormattingAttributes(item));\n        };\n        // Check formatting on selected items.\n        for (const curRange of selection.getRanges()) {\n            for (const item of curRange.getItems()) {\n                // Ignore last block if range ends at the beginning of it.\n                if (schema.isBlock(item) && curRange.end.isTouching(model.createPositionAt(item, 0))) {\n                    continue;\n                }\n                if (itemHasRemovableFormatting(item)) {\n                    yield item;\n                }\n            }\n        }\n        // Check formatting from selected blocks (to include partly selected blocks).\n        for (const block of selection.getSelectedBlocks()) {\n            if (itemHasRemovableFormatting(block)) {\n                yield block;\n            }\n        }\n        // Finally the selection might be formatted as well, so make sure to check it.\n        if (itemHasRemovableFormatting(selection)) {\n            yield selection;\n        }\n    }\n    /**\n     * Returns an iterable of formatting attributes of a given model item.\n     *\n     * **Note:** Formatting items have the `isFormatting` property set to `true`.\n     *\n     * @returns The names of formatting attributes found in a given item.\n     */\n    *_getFormattingAttributes(item) {\n        const schema = this.editor.model.schema;\n        for (const [attributeName] of item.getAttributes()) {\n            for (const { isFormatting } of this._customAttributesHandlers) {\n                if (isFormatting(attributeName, item)) {\n                    yield attributeName;\n                }\n            }\n            const attributeProperties = schema.getAttributeProperties(attributeName);\n            if (attributeProperties && attributeProperties.isFormatting) {\n                yield attributeName;\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module remove-format/removeformatediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { RemoveFormatCommand } from './removeformatcommand.js';\n/**\n * The remove format editing plugin.\n *\n * It registers the {@link module:remove-format/removeformatcommand~RemoveFormatCommand removeFormat} command.\n */\nexport class RemoveFormatEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'RemoveFormatEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'RF';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.commands.add('removeFormat', new RemoveFormatCommand(editor));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { first } from 'ckeditor5/src/utils.js';\nconst ALIGN_VALUES_REG_EXP = /^(left|center|right)$/;\nconst FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;\n/**\n * Conversion helper for upcasting attributes using normalized styles.\n *\n * @param options.modelAttribute The attribute to set.\n * @param options.styleName The style name to convert.\n * @param options.attributeName The HTML attribute name to convert.\n * @param options.attributeType The HTML attribute type for value normalization.\n * @param options.viewElement The view element name that should be converted.\n * @param options.defaultValue The default value for the specified `modelAttribute`.\n * @param options.shouldUpcast The function which returns `true` if style should be upcasted from this element.\n * @internal\n */\nexport function upcastStyleToAttribute(conversion, options) {\n    const { modelAttribute, styleName, attributeName, attributeType, viewElement, defaultValue, shouldUpcast = () => true, reduceBoxSides = false } = options;\n    conversion.for('upcast').attributeToAttribute({\n        view: {\n            name: viewElement,\n            styles: {\n                [styleName]: /[\\s\\S]+/\n            }\n        },\n        model: {\n            key: modelAttribute,\n            value: (viewElement, conversionApi, data) => {\n                // Ignore table elements inside figures and figures without the table class.\n                if (!shouldUpcast(viewElement)) {\n                    return;\n                }\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n                const normalized = viewElement.getNormalizedStyle(styleName);\n                const value = reduceBoxSides ? reduceBoxSidesValue(normalized) : normalized;\n                if (localDefaultValue !== value) {\n                    return value;\n                }\n                // Consume the style even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { styles: styleName });\n            }\n        }\n    });\n    if (attributeName) {\n        conversion.for('upcast').attributeToAttribute({\n            view: {\n                name: viewElement,\n                attributes: {\n                    [attributeName]: /.+/\n                }\n            },\n            model: {\n                key: modelAttribute,\n                value: (viewElement, conversionApi, data) => {\n                    // Convert attributes of table and table cell elements, ignore figure.\n                    // Do not convert attribute if related style is set as it has a higher priority.\n                    // Do not convert attribute if the element is a table inside a figure with the related style set.\n                    if (viewElement.name == 'figure' ||\n                        viewElement.hasStyle(styleName) ||\n                        viewElement.name == 'table' && viewElement.parent.name == 'figure' && viewElement.parent.hasStyle(styleName)) {\n                        return;\n                    }\n                    const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n                    let value = viewElement.getAttribute(attributeName);\n                    if (value && attributeType == 'length' && !value.endsWith('px')) {\n                        value += 'px';\n                    }\n                    if (localDefaultValue !== value) {\n                        return value;\n                    }\n                    // Consume the attribute even if not applied to the element so it won't be processed by other converters.\n                    conversionApi.consumable.consume(viewElement, { attributes: attributeName });\n                }\n            }\n        });\n    }\n}\n/**\n * Conversion helper for upcasting border styles for view elements.\n *\n * @param editor The editor instance.\n * @param defaultBorder The default border values.\n * @param defaultBorder.color The default `borderColor` value.\n * @param defaultBorder.style The default `borderStyle` value.\n * @param defaultBorder.width The default `borderWidth` value.\n * @internal\n */\nexport function upcastBorderStyles(editor, viewElementName, modelAttributes, defaultBorder) {\n    const { conversion } = editor;\n    conversion.for('upcast').add(dispatcher => dispatcher.on('element:' + viewElementName, (evt, data, conversionApi) => {\n        // If the element was not converted by element-to-element converter,\n        // we should not try to convert the style. See #8393.\n        if (!data.modelRange) {\n            return;\n        }\n        // Check the most detailed properties. These will be always set directly or\n        // when using the \"group\" properties like: `border-(top|right|bottom|left)` or `border`.\n        const stylesToConsume = [\n            'border-top-width',\n            'border-top-color',\n            'border-top-style',\n            'border-bottom-width',\n            'border-bottom-color',\n            'border-bottom-style',\n            'border-right-width',\n            'border-right-color',\n            'border-right-style',\n            'border-left-width',\n            'border-left-color',\n            'border-left-style'\n        ].filter(styleName => data.viewItem.hasStyle(styleName));\n        if (!stylesToConsume.length) {\n            return;\n        }\n        const matcherPattern = {\n            styles: stylesToConsume\n        };\n        // Try to consume appropriate values from consumable values list.\n        if (!conversionApi.consumable.test(data.viewItem, matcherPattern)) {\n            return;\n        }\n        const modelElement = [...data.modelRange.getItems({ shallow: true })].pop();\n        const tableElement = modelElement.findAncestor('table', { includeSelf: true });\n        let localDefaultBorder = defaultBorder;\n        if (tableElement && tableElement.getAttribute('tableType') == 'layout') {\n            localDefaultBorder = {\n                style: 'none',\n                color: '',\n                width: ''\n            };\n        }\n        conversionApi.consumable.consume(data.viewItem, matcherPattern);\n        const normalizedBorder = {\n            style: data.viewItem.getNormalizedStyle('border-style'),\n            color: data.viewItem.getNormalizedStyle('border-color'),\n            width: data.viewItem.getNormalizedStyle('border-width')\n        };\n        const reducedBorder = {\n            style: reduceBoxSidesValue(normalizedBorder.style),\n            color: reduceBoxSidesValue(normalizedBorder.color),\n            width: reduceBoxSidesValue(normalizedBorder.width)\n        };\n        if (reducedBorder.style !== localDefaultBorder.style) {\n            conversionApi.writer.setAttribute(modelAttributes.style, reducedBorder.style, modelElement);\n        }\n        if (reducedBorder.color !== localDefaultBorder.color) {\n            conversionApi.writer.setAttribute(modelAttributes.color, reducedBorder.color, modelElement);\n        }\n        if (reducedBorder.width !== localDefaultBorder.width) {\n            conversionApi.writer.setAttribute(modelAttributes.width, reducedBorder.width, modelElement);\n        }\n    }));\n    if (editor.config.get('experimentalFlags.upcastTableBorderZeroAttributes')) {\n        // If parent table has `border=\"0\"` attribute then set border style to `none`\n        // all table cells of that table and table itself.\n        conversion.for('upcast').add(dispatcher => {\n            dispatcher.on(`element:${viewElementName}`, (evt, data, conversionApi) => {\n                const { modelRange, viewItem } = data;\n                const viewTable = (viewItem.is('element', 'table') ?\n                    viewItem :\n                    viewItem.findAncestor('table'));\n                // If something already consumed the border attribute on the nearest table element, skip the conversion.\n                if (!conversionApi.consumable.test(viewTable, { attributes: 'border' })) {\n                    return;\n                }\n                // Ignore tables with border different than \"0\".\n                if (viewTable.getAttribute('border') !== '0') {\n                    return;\n                }\n                const modelElement = modelRange?.start?.nodeAfter;\n                // If model element has already border style attribute, skip the conversion.\n                if (!modelElement || modelElement.hasAttribute(modelAttributes.style)) {\n                    return;\n                }\n                conversionApi.writer.setAttribute(modelAttributes.style, 'none', modelElement);\n                if (viewItem.is('element', 'table')) {\n                    conversionApi.consumable.consume(viewItem, { attributes: 'border' });\n                }\n            });\n        });\n    }\n}\n/**\n * Conversion helper for downcasting an attribute to a style.\n *\n * @internal\n */\nexport function downcastAttributeToStyle(conversion, options) {\n    const { modelElement, modelAttribute, styleName } = options;\n    conversion.for('downcast').attributeToAttribute({\n        model: {\n            name: modelElement,\n            key: modelAttribute\n        },\n        view: modelAttributeValue => ({\n            key: 'style',\n            value: {\n                [styleName]: modelAttributeValue\n            }\n        })\n    });\n}\n/**\n * Conversion helper for downcasting attributes from the model table to a view table (not to `<figure>`).\n *\n * @internal\n */\nexport function downcastTableAttribute(conversion, options) {\n    const { modelAttribute, styleName } = options;\n    conversion.for('downcast').add(dispatcher => dispatcher.on(`attribute:${modelAttribute}:table`, (evt, data, conversionApi) => {\n        const { item, attributeNewValue } = data;\n        const { mapper, writer } = conversionApi;\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const table = [...mapper.toViewElement(item).getChildren()].find(child => child.is('element', 'table'));\n        if (attributeNewValue) {\n            writer.setStyle(styleName, attributeNewValue, table);\n        }\n        else {\n            writer.removeStyle(styleName, table);\n        }\n    }));\n}\n/**\n * Returns the default value for table or table cell property adjusted for layout tables.\n *\n * @internal\n */\nexport function getDefaultValueAdjusted(defaultValue, layoutTableDefault, data) {\n    const modelElement = data.modelRange && first(data.modelRange.getItems({ shallow: true }));\n    const tableElement = modelElement && modelElement.is('element') && modelElement.findAncestor('table', { includeSelf: true });\n    if (tableElement && tableElement.getAttribute('tableType') === 'layout') {\n        return layoutTableDefault;\n    }\n    return defaultValue;\n}\n/**\n * Reduces the full top, right, bottom, left object to a single string if all sides are equal.\n * Returns original style otherwise.\n */\nfunction reduceBoxSidesValue(style) {\n    if (!style) {\n        return;\n    }\n    const sides = ['top', 'right', 'bottom', 'left'];\n    const allSidesDefined = sides.every(side => style[side]);\n    if (!allSidesDefined) {\n        return style;\n    }\n    const topSideStyle = style.top;\n    const allSidesEqual = sides.every(side => style[side] === topSideStyle);\n    if (!allSidesEqual) {\n        return style;\n    }\n    return topSideStyle;\n}\n/**\n * Default table alignment options.\n */\nexport const DEFAULT_TABLE_ALIGNMENT_OPTIONS = {\n    left: { className: 'table-style-align-left' },\n    center: { className: 'table-style-align-center' },\n    right: { className: 'table-style-align-right' },\n    blockLeft: { className: 'table-style-block-align-left' },\n    blockRight: { className: 'table-style-block-align-right' }\n};\n/**\n * Configuration for upcasting table alignment from view to model.\n */\nexport const upcastTableAlignmentConfig = [\n    // Support for the `float:*;` CSS definition for the table alignment.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            styles: {\n                float: FLOAT_VALUES_REG_EXP\n            }\n        },\n        getAlign: (viewElement) => {\n            let align = viewElement.getStyle('float');\n            if (align === 'none') {\n                align = 'center';\n            }\n            return align;\n        },\n        getConsumables(viewElement) {\n            const float = viewElement.getStyle('float');\n            const styles = ['float'];\n            if (float === 'left' && viewElement.hasStyle('margin-right')) {\n                styles.push('margin-right');\n            }\n            else if (float === 'right' && viewElement.hasStyle('margin-left')) {\n                styles.push('margin-left');\n            }\n            return { styles };\n        }\n    },\n    // Support for the `margin-left:auto; margin-right:auto;` CSS definition for the table alignment.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            styles: {\n                'margin-left': 'auto',\n                'margin-right': 'auto'\n            }\n        },\n        getAlign: () => 'center',\n        getConsumables: () => {\n            return { styles: ['margin-left', 'margin-right'] };\n        }\n    },\n    // Support for the left alignment using CSS classes.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            key: 'class',\n            value: 'table-style-align-left'\n        },\n        getAlign: () => 'left',\n        getConsumables() {\n            return { classes: DEFAULT_TABLE_ALIGNMENT_OPTIONS.left.className };\n        }\n    },\n    // Support for the right alignment using CSS classes.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            key: 'class',\n            value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.right.className\n        },\n        getAlign: () => 'right',\n        getConsumables() {\n            return { classes: DEFAULT_TABLE_ALIGNMENT_OPTIONS.right.className };\n        }\n    },\n    // Support for the center alignment using CSS classes.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            key: 'class',\n            value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.center.className\n        },\n        getAlign: () => 'center',\n        getConsumables() {\n            return { classes: DEFAULT_TABLE_ALIGNMENT_OPTIONS.center.className };\n        }\n    },\n    // Support for the block alignment left using CSS classes.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            key: 'class',\n            value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockLeft.className\n        },\n        getAlign: () => 'blockLeft',\n        getConsumables() {\n            return { classes: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockLeft.className };\n        }\n    },\n    // Support for the block alignment right using CSS classes.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            key: 'class',\n            value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockRight.className\n        },\n        getAlign: () => 'blockRight',\n        getConsumables() {\n            return { classes: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockRight.className };\n        }\n    },\n    // Support for the block alignment left using margin CSS styles.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            styles: {\n                'margin-left': '0',\n                'margin-right': 'auto'\n            }\n        },\n        getAlign: () => 'blockLeft',\n        getConsumables() {\n            return { styles: ['margin-left', 'margin-right'] };\n        }\n    },\n    // Support for the block alignment right using margin CSS styles.\n    {\n        view: {\n            name: /^(table|figure)$/,\n            styles: {\n                'margin-left': 'auto',\n                'margin-right': '0'\n            }\n        },\n        getAlign: () => 'blockRight',\n        getConsumables() {\n            return { styles: ['margin-left', 'margin-right'] };\n        }\n    },\n    // Support for the `align` attribute as the backward compatibility while pasting from other sources.\n    {\n        view: {\n            name: 'table',\n            attributes: {\n                align: ALIGN_VALUES_REG_EXP\n            }\n        },\n        getAlign: (viewElement) => viewElement.getAttribute('align'),\n        getConsumables() {\n            return { attributes: 'align' };\n        }\n    }\n];\nexport const downcastTableAlignmentConfig = {\n    center: {\n        align: 'center',\n        style: 'margin-left: auto; margin-right: auto;',\n        className: 'table-style-align-center'\n    },\n    left: {\n        align: 'left',\n        style: 'float: left;',\n        className: 'table-style-align-left'\n    },\n    right: {\n        align: 'right',\n        style: 'float: right;',\n        className: 'table-style-align-right'\n    },\n    blockLeft: {\n        align: undefined,\n        style: 'margin-left: 0; margin-right: auto;',\n        className: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockLeft.className\n    },\n    blockRight: {\n        align: undefined,\n        style: 'margin-left: auto; margin-right: 0;',\n        className: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockRight.className\n    }\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { downcastAttributeToStyle, upcastStyleToAttribute } from '../converters/tableproperties.js';\n/**\n * A common method to update the numeric value. If a value is the default one, it will be unset.\n *\n * @internal\n * @param key An attribute key.\n * @param value The new attribute value.\n * @param item A model item on which the attribute will be set.\n * @param defaultValue The default attribute value. If a value is lower or equal, it will be unset.\n */\nexport function updateNumericAttribute(key, value, item, writer, defaultValue = 1) {\n    if (value !== undefined && value !== null && defaultValue !== undefined && defaultValue !== null && value > defaultValue) {\n        writer.setAttribute(key, value, item);\n    }\n    else {\n        writer.removeAttribute(key, item);\n    }\n}\n/**\n * A common method to create an empty table cell. It creates a proper model structure as a table cell must have at least one block inside.\n *\n * @internal\n * @param writer The model writer.\n * @param insertPosition The position at which the table cell should be inserted.\n * @param attributes The element attributes.\n * @returns Created table cell.\n */\nexport function createEmptyTableCell(writer, insertPosition, attributes = {}) {\n    const tableCell = writer.createElement('tableCell', attributes);\n    writer.insertElement('paragraph', tableCell);\n    writer.insert(tableCell, insertPosition);\n    return tableCell;\n}\n/**\n * Checks if a table cell belongs to the heading column section.\n *\n * @internal\n */\nexport function isHeadingColumnCell(tableUtils, tableCell) {\n    const table = tableCell.parent.parent;\n    const headingColumns = parseInt(table.getAttribute('headingColumns') || '0');\n    const { column } = tableUtils.getCellLocation(tableCell);\n    return !!headingColumns && column < headingColumns;\n}\n/**\n * Enables conversion for an attribute for simple view-model mappings.\n *\n * @internal\n * @param options.defaultValue The default value for the specified `modelAttribute`.\n */\nexport function enableProperty(schema, conversion, options) {\n    const { modelAttribute } = options;\n    schema.extend('tableCell', {\n        allowAttributes: [modelAttribute]\n    });\n    schema.setAttributeProperties(modelAttribute, { isFormatting: true });\n    upcastStyleToAttribute(conversion, { viewElement: /^(td|th)$/, ...options });\n    downcastAttributeToStyle(conversion, { modelElement: 'tableCell', ...options });\n}\n/**\n * Depending on the position of the selection we either return the table under cursor or look for the table higher in the hierarchy.\n *\n * @internal\n */\nexport function getSelectionAffectedTable(selection) {\n    const selectedElement = selection.getSelectedElement();\n    // Is the command triggered from the `tableToolbar`?\n    if (selectedElement && selectedElement.is('element', 'table')) {\n        return selectedElement;\n    }\n    return selection.getFirstPosition().findAncestor('table');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * The table iterator class. It allows to iterate over table cells. For each cell the iterator yields\n * {@link module:table/tablewalker~TableSlot} with proper table cell attributes.\n */\nexport class TableWalker {\n    /**\n     * The walker's table element.\n     *\n     * @internal\n     */\n    _table;\n    /**\n     * A row index from which this iterator will start.\n     */\n    _startRow;\n    /**\n     * A row index at which this iterator will end.\n     */\n    _endRow;\n    /**\n     * If set, the table walker will only output cells from a given column and following ones or cells that overlap them.\n     */\n    _startColumn;\n    /**\n     * If set, the table walker will only output cells up to a given column.\n     */\n    _endColumn;\n    /**\n     * Enables output of spanned cells that are normally not yielded.\n     */\n    _includeAllSlots;\n    /**\n     * Row indexes to skip from the iteration.\n     */\n    _skipRows;\n    /**\n     * The current row index.\n     *\n     * @internal\n     */\n    _row;\n    /**\n     * The index of the current row element in the table.\n     *\n     * @internal\n     */\n    _rowIndex;\n    /**\n     * The current column index.\n     *\n     * @internal\n     */\n    _column;\n    /**\n     * The cell index in a parent row. For spanned cells when {@link #_includeAllSlots} is set to `true`,\n     * this represents the index of the next table cell.\n     *\n     * @internal\n     */\n    _cellIndex;\n    /**\n     * Holds a map of spanned cells in a table.\n     */\n    _spannedCells;\n    /**\n     * Index of the next column where a cell is anchored.\n     */\n    _nextCellAtColumn;\n    /**\n     * Indicates whether the iterator jumped to (or close to) the start row, ignoring rows that don't need to be traversed.\n     */\n    _jumpedToStartRow = false;\n    /**\n     * Creates an instance of the table walker.\n     *\n     * The table walker iterates internally by traversing the table from row index = 0 and column index = 0.\n     * It walks row by row and column by column in order to output values defined in the constructor.\n     * By default it will output only the locations that are occupied by a cell. To include also spanned rows and columns,\n     * pass the `includeAllSlots` option to the constructor.\n     *\n     * The most important values of the iterator are column and row indexes of a cell.\n     *\n     * See {@link module:table/tablewalker~TableSlot} what values are returned by the table walker.\n     *\n     * To iterate over a given row:\n     *\n     * ```ts\n     * const tableWalker = new TableWalker( table, { startRow: 1, endRow: 2 } );\n     *\n     * for ( const tableSlot of tableWalker ) {\n     *   console.log( 'A cell at row', tableSlot.row, 'and column', tableSlot.column );\n     * }\n     * ```\n     *\n     * For instance the code above for the following table:\n     *\n     *  +----+----+----+----+----+----+\n     *  | 00      | 02 | 03 | 04 | 05 |\n     *  |         +----+----+----+----+\n     *  |         | 12      | 14 | 15 |\n     *  |         +----+----+----+    +\n     *  |         | 22           |    |\n     *  |----+----+----+----+----+    +\n     *  | 30 | 31 | 32 | 33 | 34 |    |\n     *  +----+----+----+----+----+----+\n     *\n     * will log in the console:\n     *\n     *  'A cell at row 1 and column 2'\n     *  'A cell at row 1 and column 4'\n     *  'A cell at row 1 and column 5'\n     *  'A cell at row 2 and column 2'\n     *\n     * To also iterate over spanned cells:\n     *\n     * ```ts\n     * const tableWalker = new TableWalker( table, { row: 1, includeAllSlots: true } );\n     *\n     * for ( const tableSlot of tableWalker ) {\n     *   console.log( 'Slot at', tableSlot.row, 'x', tableSlot.column, ':', tableSlot.isAnchor ? 'is anchored' : 'is spanned' );\n     * }\n     * ```\n     *\n     * will log in the console for the table from the previous example:\n     *\n     *  'Cell at 1 x 0 : is spanned'\n     *  'Cell at 1 x 1 : is spanned'\n     *  'Cell at 1 x 2 : is anchored'\n     *  'Cell at 1 x 3 : is spanned'\n     *  'Cell at 1 x 4 : is anchored'\n     *  'Cell at 1 x 5 : is anchored'\n     *\n     * **Note**: Option `row` is a shortcut that sets both `startRow` and `endRow` to the same row.\n     * (Use either `row` or `startRow` and `endRow` but never together). Similarly the `column` option sets both `startColumn`\n     * and `endColumn` to the same column (Use either `column` or `startColumn` and `endColumn` but never together).\n     *\n     * @param table A table over which the walker iterates.\n     * @param options An object with configuration.\n     * @param options.row A row index for which this iterator will output cells. Can't be used together with `startRow` and `endRow`.\n     * @param options.startRow A row index from which this iterator should start. Can't be used together with `row`. Default value is 0.\n     * @param options.endRow A row index at which this iterator should end. Can't be used together with `row`.\n     * @param options.column A column index for which this iterator will output cells.\n     * Can't be used together with `startColumn` and `endColumn`.\n     * @param options.startColumn A column index from which this iterator should start.\n     * Can't be used together with `column`. Default value is 0.\n     * @param options.endColumn A column index at which this iterator should end. Can't be used together with `column`.\n     * @param options.includeAllSlots Also return values for spanned cells. Default value is \"false\".\n     */\n    constructor(table, options = {}) {\n        this._table = table;\n        this._startRow = options.row !== undefined ? options.row : options.startRow || 0;\n        this._endRow = options.row !== undefined ? options.row : options.endRow;\n        this._startColumn = options.column !== undefined ? options.column : options.startColumn || 0;\n        this._endColumn = options.column !== undefined ? options.column : options.endColumn;\n        this._includeAllSlots = !!options.includeAllSlots;\n        this._skipRows = new Set();\n        this._row = 0;\n        this._rowIndex = 0;\n        this._column = 0;\n        this._cellIndex = 0;\n        this._spannedCells = new Map();\n        this._nextCellAtColumn = -1;\n    }\n    /**\n     * Iterable interface.\n     */\n    [Symbol.iterator]() {\n        return this;\n    }\n    /**\n     * Gets the next table walker's value.\n     *\n     * @returns The next table walker's value.\n     */\n    next() {\n        if (this._canJumpToStartRow()) {\n            this._jumpToNonSpannedRowClosestToStartRow();\n        }\n        const row = this._table.getChild(this._rowIndex);\n        // Iterator is done when there's no row (table ended) or the row is after `endRow` limit.\n        if (!row || this._isOverEndRow()) {\n            return { done: true, value: undefined };\n        }\n        // We step over current element when it is not a tableRow instance.\n        if (!row.is('element', 'tableRow')) {\n            this._rowIndex++;\n            return this.next();\n        }\n        if (this._isOverEndColumn()) {\n            return this._advanceToNextRow();\n        }\n        let outValue = null;\n        const spanData = this._getSpanned();\n        if (spanData) {\n            if (this._includeAllSlots && !this._shouldSkipSlot()) {\n                outValue = this._formatOutValue(spanData.cell, spanData.row, spanData.column);\n            }\n        }\n        else {\n            const cell = row.getChild(this._cellIndex);\n            if (!cell) {\n                // If there are no more cells left in row advance to the next row.\n                return this._advanceToNextRow();\n            }\n            const colspan = parseInt(cell.getAttribute('colspan') || '1');\n            const rowspan = parseInt(cell.getAttribute('rowspan') || '1');\n            // Record this cell spans if it's not 1x1 cell.\n            if (colspan > 1 || rowspan > 1) {\n                this._recordSpans(cell, rowspan, colspan);\n            }\n            if (!this._shouldSkipSlot()) {\n                outValue = this._formatOutValue(cell);\n            }\n            this._nextCellAtColumn = this._column + colspan;\n        }\n        // Advance to the next column before returning value.\n        this._column++;\n        if (this._column == this._nextCellAtColumn) {\n            this._cellIndex++;\n        }\n        // The current value will be returned only if current row and column are not skipped.\n        return outValue || this.next();\n    }\n    /**\n     * Marks a row to skip in the next iteration. It will also skip cells from the current row if there are any cells from the current row\n     * to output.\n     *\n     * @param row The row index to skip.\n     */\n    skipRow(row) {\n        this._skipRows.add(row);\n    }\n    /**\n     * Advances internal cursor to the next row.\n     */\n    _advanceToNextRow() {\n        this._row++;\n        this._rowIndex++;\n        this._column = 0;\n        this._cellIndex = 0;\n        this._nextCellAtColumn = -1;\n        return this.next();\n    }\n    /**\n     * Checks if the current row is over {@link #_endRow}.\n     */\n    _isOverEndRow() {\n        // If #_endRow is defined skip all rows after it.\n        return this._endRow !== undefined && this._row > this._endRow;\n    }\n    /**\n     * Checks if the current cell is over {@link #_endColumn}\n     */\n    _isOverEndColumn() {\n        // If #_endColumn is defined skip all cells after it.\n        return this._endColumn !== undefined && this._column > this._endColumn;\n    }\n    /**\n     * A common method for formatting the iterator's output value.\n     *\n     * @param cell The table cell to output.\n     * @param anchorRow The row index of a cell anchor slot.\n     * @param anchorColumn The column index of a cell anchor slot.\n     */\n    _formatOutValue(cell, anchorRow = this._row, anchorColumn = this._column) {\n        return {\n            done: false,\n            value: new TableSlot(this, cell, anchorRow, anchorColumn)\n        };\n    }\n    /**\n     * Checks if the current slot should be skipped.\n     */\n    _shouldSkipSlot() {\n        const rowIsMarkedAsSkipped = this._skipRows.has(this._row);\n        const rowIsBeforeStartRow = this._row < this._startRow;\n        const columnIsBeforeStartColumn = this._column < this._startColumn;\n        const columnIsAfterEndColumn = this._endColumn !== undefined && this._column > this._endColumn;\n        return rowIsMarkedAsSkipped || rowIsBeforeStartRow || columnIsBeforeStartColumn || columnIsAfterEndColumn;\n    }\n    /**\n     * Returns the cell element that is spanned over the current cell location.\n     */\n    _getSpanned() {\n        const rowMap = this._spannedCells.get(this._row);\n        // No spans for given row.\n        if (!rowMap) {\n            return null;\n        }\n        // If spans for given rows has entry for column it means that this location if spanned by other cell.\n        return rowMap.get(this._column) || null;\n    }\n    /**\n     * Updates spanned cells map relative to the current cell location and its span dimensions.\n     *\n     * @param cell A cell that is spanned.\n     * @param rowspan Cell height.\n     * @param colspan Cell width.\n     */\n    _recordSpans(cell, rowspan, colspan) {\n        const data = {\n            cell,\n            row: this._row,\n            column: this._column\n        };\n        for (let rowToUpdate = this._row; rowToUpdate < this._row + rowspan; rowToUpdate++) {\n            for (let columnToUpdate = this._column; columnToUpdate < this._column + colspan; columnToUpdate++) {\n                if (rowToUpdate != this._row || columnToUpdate != this._column) {\n                    this._markSpannedCell(rowToUpdate, columnToUpdate, data);\n                }\n            }\n        }\n    }\n    /**\n     * Marks the cell location as spanned by another cell.\n     *\n     * @param row The row index of the cell location.\n     * @param column The column index of the cell location.\n     * @param data A spanned cell details (cell element, anchor row and column).\n     */\n    _markSpannedCell(row, column, data) {\n        if (!this._spannedCells.has(row)) {\n            this._spannedCells.set(row, new Map());\n        }\n        const rowSpans = this._spannedCells.get(row);\n        rowSpans.set(column, data);\n    }\n    /**\n     * Checks if part of the table can be skipped.\n     */\n    _canJumpToStartRow() {\n        return !!this._startRow &&\n            this._startRow > 0 &&\n            !this._jumpedToStartRow;\n    }\n    /**\n     * Sets the current row to `this._startRow` or the first row before it that has the number of cells\n     * equal to the number of columns in the table.\n     *\n     * Example:\n     * \t+----+----+----+\n     *  | 00 | 01 | 02 |\n     *  |----+----+----+\n     *  | 10      | 12 |\n     *  |         +----+\n     *  |         | 22 |\n     *  |         +----+\n     *  |         | 32 | <--- Start row\n     *  +----+----+----+\n     *  | 40 | 41 | 42 |\n     *  +----+----+----+\n     *\n     * If the 4th row is a `this._startRow`, this method will:\n     * 1.) Count the number of columns this table has based on the first row (3 columns in this case).\n     * 2.) Check if the 4th row contains 3 cells. It doesn't, so go to the row before it.\n     * 3.) Check if the 3rd row contains 3 cells. It doesn't, so go to the row before it.\n     * 4.) Check if the 2nd row contains 3 cells. It does, so set the current row to that row.\n     *\n     * Setting the current row this way is necessary to let the `next()`  method loop over the cells\n     * spanning multiple rows or columns and update the `this._spannedCells` property.\n     */\n    _jumpToNonSpannedRowClosestToStartRow() {\n        const firstRowLength = this._getRowLength(0);\n        for (let i = this._startRow; !this._jumpedToStartRow; i--) {\n            if (firstRowLength === this._getRowLength(i)) {\n                this._row = i;\n                this._rowIndex = i;\n                this._jumpedToStartRow = true;\n            }\n        }\n    }\n    /**\n     * Returns a number of columns in a row taking `colspan` into consideration.\n     */\n    _getRowLength(rowIndex) {\n        const row = this._table.getChild(rowIndex);\n        return [...row.getChildren()].reduce((cols, row) => {\n            return cols + parseInt(row.getAttribute('colspan') || '1');\n        }, 0);\n    }\n}\n/**\n * An object returned by {@link module:table/tablewalker~TableWalker} when traversing table cells.\n */\nclass TableSlot {\n    /**\n     * The current table cell.\n     */\n    cell;\n    /**\n     * The row index of a table slot.\n     */\n    row;\n    /**\n     * The column index of a table slot.\n     */\n    column;\n    /**\n     * The row index of a cell anchor slot.\n     */\n    cellAnchorRow;\n    /**\n     * The column index of a cell anchor slot.\n     */\n    cellAnchorColumn;\n    /**\n     * The index of the current cell in the parent row.\n     */\n    _cellIndex;\n    /**\n     * The index of the current row element in the table.\n     */\n    _rowIndex;\n    /**\n     * The table element.\n     */\n    _table;\n    /**\n     * Creates an instance of the table walker value.\n     *\n     * @param tableWalker The table walker instance.\n     * @param cell The current table cell.\n     * @param anchorRow The row index of a cell anchor slot.\n     * @param anchorColumn The column index of a cell anchor slot.\n     */\n    constructor(tableWalker, cell, anchorRow, anchorColumn) {\n        this.cell = cell;\n        this.row = tableWalker._row;\n        this.column = tableWalker._column;\n        this.cellAnchorRow = anchorRow;\n        this.cellAnchorColumn = anchorColumn;\n        this._cellIndex = tableWalker._cellIndex;\n        this._rowIndex = tableWalker._rowIndex;\n        this._table = tableWalker._table;\n    }\n    // @if CK_DEBUG // public get isSpanned(): unknown { return throwMissingGetterError( 'isSpanned' ); }\n    // @if CK_DEBUG // public get colspan(): unknown { return throwMissingGetterError( 'colspan' ); }\n    // @if CK_DEBUG // public get rowspan(): unknown { return throwMissingGetterError( 'rowspan' ); }\n    // @if CK_DEBUG // public get cellIndex(): unknown { return throwMissingGetterError( 'cellIndex' ); }\n    /**\n     * Whether the cell is anchored in the current slot.\n     */\n    get isAnchor() {\n        return this.row === this.cellAnchorRow && this.column === this.cellAnchorColumn;\n    }\n    /**\n     * The width of a cell defined by a `colspan` attribute. If the model attribute is not present, it is set to `1`.\n     */\n    get cellWidth() {\n        return parseInt(this.cell.getAttribute('colspan') || '1');\n    }\n    /**\n     * The height of a cell defined by a `rowspan` attribute. If the model attribute is not present, it is set to `1`.\n     */\n    get cellHeight() {\n        return parseInt(this.cell.getAttribute('rowspan') || '1');\n    }\n    /**\n     * The index of the current row element in the table.\n     */\n    get rowIndex() {\n        return this._rowIndex;\n    }\n    /**\n     * Returns the {@link module:engine/model/position~ModelPosition} before the table slot.\n     */\n    getPositionBefore() {\n        const model = this._table.root.document.model;\n        return model.createPositionAt(this._table.getChild(this.row), this._cellIndex);\n    }\n}\nexport { TableSlot };\n/**\n * This `TableSlot`'s getter (property) was removed in CKEditor 5 v20.0.0.\n *\n * Check out the new `TableWalker`'s API in the documentation.\n *\n * @error tableslot-getter-removed\n * @param getterName\n */\n// @if CK_DEBUG // function throwMissingGetterError( getterName: string ): void {\n// @if CK_DEBUG //\t\tthrow new CKEditorError( 'tableslot-getter-removed', null, {\n// @if CK_DEBUG //\t\t\tgetterName\n// @if CK_DEBUG //\t\t} );\n// @if CK_DEBUG // }\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableWalker } from '../tablewalker.js';\nimport { createEmptyTableCell, updateNumericAttribute } from './common.js';\n/**\n * Returns a cropped table according to given dimensions.\n\n * To return a cropped table that starts at first row and first column and end in third row and column:\n *\n * ```ts\n * const croppedTable = cropTableToDimensions( table, {\n *   startRow: 1,\n *   endRow: 3,\n *   startColumn: 1,\n *   endColumn: 3\n * }, writer );\n * ```\n *\n * Calling the code above for the table below:\n *\n *        0   1   2   3   4                      0   1   2\n *      ┌───┬───┬───┬───┬───┐\n *   0  │ a │ b │ c │ d │ e │\n *      ├───┴───┤   ├───┴───┤                  ┌───┬───┬───┐\n *   1  │ f     │   │ g     │                  │   │   │ g │  0\n *      ├───┬───┴───┼───┬───┤   will return:   ├───┴───┼───┤\n *   2  │ h │ i     │ j │ k │                  │ i     │ j │  1\n *      ├───┤       ├───┤   │                  │       ├───┤\n *   3  │ l │       │ m │   │                  │       │ m │  2\n *      ├───┼───┬───┤   ├───┤                  └───────┴───┘\n *   4  │ n │ o │ p │   │ q │\n *      └───┴───┴───┴───┴───┘\n *\n * @internal\n */\nexport function cropTableToDimensions(sourceTable, cropDimensions, writer) {\n    const { startRow, startColumn, endRow, endColumn } = cropDimensions;\n    // Initialize the cropped table element.\n    const croppedTable = writer.createElement('table');\n    // Copy table type attribute if present.\n    const sourceTableType = sourceTable.getAttribute('tableType');\n    if (sourceTableType) {\n        writer.setAttribute('tableType', sourceTableType, croppedTable);\n    }\n    // Create empty table with empty rows equal to crop height.\n    const cropHeight = endRow - startRow + 1;\n    for (let i = 0; i < cropHeight; i++) {\n        writer.insertElement('tableRow', croppedTable, 'end');\n    }\n    const tableMap = [...new TableWalker(sourceTable, { startRow, endRow, startColumn, endColumn, includeAllSlots: true })];\n    // Iterate over source table slots (including empty - spanned - ones).\n    for (const { row: sourceRow, column: sourceColumn, cell: tableCell, isAnchor, cellAnchorRow, cellAnchorColumn } of tableMap) {\n        // Row index in cropped table.\n        const rowInCroppedTable = sourceRow - startRow;\n        const row = croppedTable.getChild(rowInCroppedTable);\n        // For empty slots: fill the gap with empty table cell.\n        if (!isAnchor) {\n            // But fill the gap only if the spanning cell is anchored outside cropped area.\n            // In the table from method jsdoc those cells are: \"c\" & \"f\".\n            if (cellAnchorRow < startRow || cellAnchorColumn < startColumn) {\n                createEmptyTableCell(writer, writer.createPositionAt(row, 'end'));\n            }\n        }\n        // Otherwise clone the cell with all children and trim if it exceeds cropped area.\n        else {\n            const tableCellCopy = writer.cloneElement(tableCell);\n            writer.append(tableCellCopy, row);\n            // Trim table if it exceeds cropped area.\n            // In the table from method jsdoc those cells are: \"g\" & \"m\".\n            trimTableCellIfNeeded(tableCellCopy, sourceRow, sourceColumn, endRow, endColumn, writer);\n        }\n    }\n    // Adjust heading rows & columns in cropped table if crop selection includes headings parts.\n    addHeadingsToCroppedTable(croppedTable, sourceTable, startRow, startColumn, writer);\n    return croppedTable;\n}\n/**\n * Returns slot info of cells that starts above and overlaps a given row.\n *\n * In a table below, passing `overlapRow = 3`\n *\n *     ┌───┬───┬───┬───┬───┐\n *  0  │ a │ b │ c │ d │ e │\n *     │   ├───┼───┼───┼───┤\n *  1  │   │ f │ g │ h │ i │\n *     ├───┤   ├───┼───┤   │\n *  2  │ j │   │ k │ l │   │\n *     │   │   │   ├───┼───┤\n *  3  │   │   │   │ m │ n │  <- overlap row to check\n *     ├───┼───┤   │   ├───│\n *  4  │ o │ p │   │   │ q │\n *     └───┴───┴───┴───┴───┘\n *\n * will return slot info for cells: \"j\", \"f\", \"k\".\n *\n * @internal\n * @param table The table to check.\n * @param overlapRow The index of the row to check.\n * @param startRow row to start analysis. Use it when it is known that the cells above that row will not overlap. Default value is 0.\n */\nexport function getVerticallyOverlappingCells(table, overlapRow, startRow = 0) {\n    const cells = [];\n    const tableWalker = new TableWalker(table, { startRow, endRow: overlapRow - 1 });\n    for (const slotInfo of tableWalker) {\n        const { row, cellHeight } = slotInfo;\n        const cellEndRow = row + cellHeight - 1;\n        if (row < overlapRow && overlapRow <= cellEndRow) {\n            cells.push(slotInfo);\n        }\n    }\n    return cells;\n}\n/**\n * Splits the table cell horizontally.\n *\n * @internal\n * @returns Created table cell, if any were created.\n */\nexport function splitHorizontally(tableCell, splitRow, writer) {\n    const tableRow = tableCell.parent;\n    const table = tableRow.parent;\n    const rowIndex = tableRow.index;\n    const rowspan = parseInt(tableCell.getAttribute('rowspan'));\n    const newRowspan = splitRow - rowIndex;\n    const newCellAttributes = {};\n    const newCellRowSpan = rowspan - newRowspan;\n    if (newCellRowSpan > 1) {\n        newCellAttributes.rowspan = newCellRowSpan;\n    }\n    const colspan = parseInt(tableCell.getAttribute('colspan') || '1');\n    if (colspan > 1) {\n        newCellAttributes.colspan = colspan;\n    }\n    const startRow = rowIndex;\n    const endRow = startRow + newRowspan;\n    const tableMap = [...new TableWalker(table, { startRow, endRow, includeAllSlots: true })];\n    let newCell = null;\n    let columnIndex;\n    for (const tableSlot of tableMap) {\n        const { row, column, cell } = tableSlot;\n        if (cell === tableCell && columnIndex === undefined) {\n            columnIndex = column;\n        }\n        if (columnIndex !== undefined && columnIndex === column && row === endRow) {\n            newCell = createEmptyTableCell(writer, tableSlot.getPositionBefore(), newCellAttributes);\n        }\n    }\n    // Update the rowspan attribute after updating table.\n    updateNumericAttribute('rowspan', newRowspan, tableCell, writer);\n    return newCell;\n}\n/**\n * Returns slot info of cells that starts before and overlaps a given column.\n *\n * In a table below, passing `overlapColumn = 3`\n *\n *    0   1   2   3   4\n *  ┌───────┬───────┬───┐\n *  │ a     │ b     │ c │\n *  │───┬───┴───────┼───┤\n *  │ d │ e         │ f │\n *  ├───┼───┬───────┴───┤\n *  │ g │ h │ i         │\n *  ├───┼───┼───┬───────┤\n *  │ j │ k │ l │ m     │\n *  ├───┼───┴───┼───┬───┤\n *  │ n │ o     │ p │ q │\n *  └───┴───────┴───┴───┘\n *                ^\n *                Overlap column to check\n *\n * will return slot info for cells: \"b\", \"e\", \"i\".\n *\n * @internal\n * @param table The table to check.\n * @param overlapColumn The index of the column to check.\n */\nexport function getHorizontallyOverlappingCells(table, overlapColumn) {\n    const cellsToSplit = [];\n    const tableWalker = new TableWalker(table);\n    for (const slotInfo of tableWalker) {\n        const { column, cellWidth } = slotInfo;\n        const cellEndColumn = column + cellWidth - 1;\n        if (column < overlapColumn && overlapColumn <= cellEndColumn) {\n            cellsToSplit.push(slotInfo);\n        }\n    }\n    return cellsToSplit;\n}\n/**\n * Splits the table cell vertically.\n *\n * @internal\n * @param columnIndex The table cell column index.\n * @param splitColumn The index of column to split cell on.\n * @returns Created table cell.\n */\nexport function splitVertically(tableCell, columnIndex, splitColumn, writer) {\n    const colspan = parseInt(tableCell.getAttribute('colspan'));\n    const newColspan = splitColumn - columnIndex;\n    const newCellAttributes = {};\n    const newCellColSpan = colspan - newColspan;\n    if (newCellColSpan > 1) {\n        newCellAttributes.colspan = newCellColSpan;\n    }\n    const rowspan = parseInt(tableCell.getAttribute('rowspan') || '1');\n    if (rowspan > 1) {\n        newCellAttributes.rowspan = rowspan;\n    }\n    const newCell = createEmptyTableCell(writer, writer.createPositionAfter(tableCell), newCellAttributes);\n    // Update the colspan attribute after updating table.\n    updateNumericAttribute('colspan', newColspan, tableCell, writer);\n    return newCell;\n}\n/**\n * Adjusts table cell dimensions to not exceed limit row and column.\n *\n * If table cell width (or height) covers a column (or row) that is after a limit column (or row)\n * this method will trim \"colspan\" (or \"rowspan\") attribute so the table cell will fit in a defined limits.\n *\n * @internal\n */\nexport function trimTableCellIfNeeded(tableCell, cellRow, cellColumn, limitRow, limitColumn, writer) {\n    const colspan = parseInt(tableCell.getAttribute('colspan') || '1');\n    const rowspan = parseInt(tableCell.getAttribute('rowspan') || '1');\n    const endColumn = cellColumn + colspan - 1;\n    if (endColumn > limitColumn) {\n        const trimmedSpan = limitColumn - cellColumn + 1;\n        updateNumericAttribute('colspan', trimmedSpan, tableCell, writer, 1);\n    }\n    const endRow = cellRow + rowspan - 1;\n    if (endRow > limitRow) {\n        const trimmedSpan = limitRow - cellRow + 1;\n        updateNumericAttribute('rowspan', trimmedSpan, tableCell, writer, 1);\n    }\n}\n/**\n * Sets proper heading attributes to a cropped table.\n */\nfunction addHeadingsToCroppedTable(croppedTable, sourceTable, startRow, startColumn, writer) {\n    const headingRows = parseInt(sourceTable.getAttribute('headingRows') || '0');\n    if (headingRows > 0) {\n        const headingRowsInCrop = headingRows - startRow;\n        updateNumericAttribute('headingRows', headingRowsInCrop, croppedTable, writer, 0);\n    }\n    const headingColumns = parseInt(sourceTable.getAttribute('headingColumns') || '0');\n    if (headingColumns > 0) {\n        const headingColumnsInCrop = headingColumns - startColumn;\n        updateNumericAttribute('headingColumns', headingColumnsInCrop, croppedTable, writer, 0);\n    }\n}\n/**\n * Removes columns that have no cells anchored.\n *\n * In table below:\n *\n *     +----+----+----+----+----+----+----+\n *     | 00 | 01      | 03 | 04      | 06 |\n *     +----+----+----+----+         +----+\n *     | 10 | 11      | 13 |         | 16 |\n *     +----+----+----+----+----+----+----+\n *     | 20 | 21      | 23 | 24      | 26 |\n *     +----+----+----+----+----+----+----+\n *                  ^--- empty ---^\n *\n * Will remove columns 2 and 5.\n *\n * **Note:** This is a low-level helper method for clearing invalid model state when doing table modifications.\n * To remove a column from a table use {@link module:table/tableutils~TableUtils#removeColumns `TableUtils.removeColumns()`}.\n *\n * @internal\n * @returns True if removed some columns.\n */\nexport function removeEmptyColumns(table, tableUtils) {\n    const width = tableUtils.getColumns(table);\n    const columnsMap = new Array(width).fill(0);\n    for (const { column } of new TableWalker(table)) {\n        columnsMap[column]++;\n    }\n    const emptyColumns = columnsMap.reduce((result, cellsCount, column) => {\n        return cellsCount ? result : [...result, column];\n    }, []);\n    if (emptyColumns.length > 0) {\n        // Remove only last empty column because it will recurrently trigger removing empty rows.\n        const emptyColumn = emptyColumns[emptyColumns.length - 1];\n        // @if CK_DEBUG_TABLE // console.log( `Removing empty column: ${ emptyColumn }.` );\n        tableUtils.removeColumns(table, { at: emptyColumn });\n        return true;\n    }\n    return false;\n}\n/**\n * Removes rows that have no cells anchored.\n *\n * In table below:\n *\n *     +----+----+----+\n *     | 00 | 01 | 02 |\n *     +----+----+----+\n *     | 10 | 11 | 12 |\n *     +    +    +    +\n *     |    |    |    | <-- empty\n *     +----+----+----+\n *     | 30 | 31 | 32 |\n *     +----+----+----+\n *     | 40      | 42 |\n *     +         +    +\n *     |         |    | <-- empty\n *     +----+----+----+\n *     | 60 | 61 | 62 |\n *     +----+----+----+\n *\n * Will remove rows 2 and 5.\n *\n * **Note:** This is a low-level helper method for clearing invalid model state when doing table modifications.\n * To remove a row from a table use {@link module:table/tableutils~TableUtils#removeRows `TableUtils.removeRows()`}.\n *\n * @internal\n * @returns True if removed some rows.\n */\nexport function removeEmptyRows(table, tableUtils) {\n    const emptyRows = [];\n    const tableRowCount = tableUtils.getRows(table);\n    for (let rowIndex = 0; rowIndex < tableRowCount; rowIndex++) {\n        const tableRow = table.getChild(rowIndex);\n        if (tableRow.isEmpty) {\n            emptyRows.push(rowIndex);\n        }\n    }\n    if (emptyRows.length > 0) {\n        // Remove only last empty row because it will recurrently trigger removing empty columns.\n        const emptyRow = emptyRows[emptyRows.length - 1];\n        // @if CK_DEBUG_TABLE // console.log( `Removing empty row: ${ emptyRow }.` );\n        tableUtils.removeRows(table, { at: emptyRow });\n        return true;\n    }\n    return false;\n}\n/**\n * Removes rows and columns that have no cells anchored.\n *\n * In table below:\n *\n *     +----+----+----+----+\n *     | 00      | 02      |\n *     +----+----+         +\n *     | 10      |         |\n *     +----+----+----+----+\n *     | 20      | 22 | 23 |\n *     +         +    +    +\n *     |         |    |    | <-- empty row\n *     +----+----+----+----+\n *             ^--- empty column\n *\n * Will remove row 3 and column 1.\n *\n * **Note:** This is a low-level helper method for clearing invalid model state when doing table modifications.\n * To remove a rows from a table use {@link module:table/tableutils~TableUtils#removeRows `TableUtils.removeRows()`} and\n * {@link module:table/tableutils~TableUtils#removeColumns `TableUtils.removeColumns()`} to remove a column.\n *\n * @internal\n */\nexport function removeEmptyRowsColumns(table, tableUtils) {\n    const removedColumns = removeEmptyColumns(table, tableUtils);\n    // If there was some columns removed then cleaning empty rows was already triggered.\n    if (!removedColumns) {\n        removeEmptyRows(table, tableUtils);\n    }\n}\n/**\n * Returns adjusted last row index if selection covers part of a row with empty slots (spanned by other cells).\n * The `dimensions.lastRow` is equal to last row index but selection might be bigger.\n *\n * This happens *only* on rectangular selection so we analyze a case like this:\n *\n *        +---+---+---+---+\n *      0 | a | b | c | d |\n *        +   +   +---+---+\n *      1 |   | e | f | g |\n *        +   +---+   +---+\n *      2 |   | h |   | i | <- last row, each cell has rowspan = 2,\n *        +   +   +   +   +    so we need to return 3, not 2\n *      3 |   |   |   |   |\n *        +---+---+---+---+\n *\n * @internal\n * @returns Adjusted last row index.\n */\nexport function adjustLastRowIndex(table, dimensions) {\n    const lastRowMap = Array.from(new TableWalker(table, {\n        startColumn: dimensions.firstColumn,\n        endColumn: dimensions.lastColumn,\n        row: dimensions.lastRow\n    }));\n    const everyCellHasSingleRowspan = lastRowMap.every(({ cellHeight }) => cellHeight === 1);\n    // It is a \"flat\" row, so the last row index is OK.\n    if (everyCellHasSingleRowspan) {\n        return dimensions.lastRow;\n    }\n    // Otherwise get any cell's rowspan and adjust the last row index.\n    const rowspanAdjustment = lastRowMap[0].cellHeight - 1;\n    return dimensions.lastRow + rowspanAdjustment;\n}\n/**\n * Returns adjusted last column index if selection covers part of a column with empty slots (spanned by other cells).\n * The `dimensions.lastColumn` is equal to last column index but selection might be bigger.\n *\n * This happens *only* on rectangular selection so we analyze a case like this:\n *\n *       0   1   2   3\n *     +---+---+---+---+\n *     | a             |\n *     +---+---+---+---+\n *     | b | c | d     |\n *     +---+---+---+---+\n *     | e     | f     |\n *     +---+---+---+---+\n *     | g | h         |\n *     +---+---+---+---+\n *               ^\n *              last column, each cell has colspan = 2, so we need to return 3, not 2\n *\n * @internal\n * @returns Adjusted last column index.\n */\nexport function adjustLastColumnIndex(table, dimensions) {\n    const lastColumnMap = Array.from(new TableWalker(table, {\n        startRow: dimensions.firstRow,\n        endRow: dimensions.lastRow,\n        column: dimensions.lastColumn\n    }));\n    const everyCellHasSingleColspan = lastColumnMap.every(({ cellWidth }) => cellWidth === 1);\n    // It is a \"flat\" column, so the last column index is OK.\n    if (everyCellHasSingleColspan) {\n        return dimensions.lastColumn;\n    }\n    // Otherwise get any cell's colspan and adjust the last column index.\n    const colspanAdjustment = lastColumnMap[0].cellWidth - 1;\n    return dimensions.lastColumn + colspanAdjustment;\n}\n/**\n * Get view `<table>` element from the wrapper.\n */\nexport function getViewTableFromWrapper(wrapperView) {\n    for (const wrapperChild of wrapperView.getChildren()) {\n        if (wrapperChild.is('element', 'table')) {\n            return wrapperChild;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { createEmptyTableCell } from '../utils/common.js';\nimport { getViewTableFromWrapper } from '../utils/structure.js';\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * Returns a function that converts the table view representation:\n *\n * ```xml\n * <figure class=\"table\"><table>...</table></figure>\n * ```\n *\n * to the model representation:\n *\n * ```xml\n * <table></table>\n * ```\n *\n * @internal\n */\nexport function upcastTableFigure() {\n    return (dispatcher) => {\n        dispatcher.on('element:figure', (evt, data, conversionApi) => {\n            // Do not convert if this is not a \"table figure\".\n            if (!conversionApi.consumable.test(data.viewItem, { name: true, classes: 'table' })) {\n                return;\n            }\n            // Find a table element inside the figure element.\n            const viewTable = getViewTableFromWrapper(data.viewItem);\n            // Do not convert if table element is absent or was already converted.\n            if (!viewTable || !conversionApi.consumable.test(viewTable, { name: true })) {\n                return;\n            }\n            // Consume the figure to prevent other converters from processing it again.\n            conversionApi.consumable.consume(data.viewItem, { name: true, classes: 'table' });\n            // Convert view table to model table.\n            const conversionResult = conversionApi.convertItem(viewTable, data.modelCursor);\n            // Get table element from conversion result.\n            const modelTable = first(conversionResult.modelRange.getItems());\n            // When table wasn't successfully converted then finish conversion.\n            if (!modelTable || !modelTable.is('element', 'table')) {\n                // Revert consumed figure so other features can convert it.\n                conversionApi.consumable.revert(data.viewItem, { name: true, classes: 'table' });\n                // If anyway some table content was converted, we have to pass the model range and cursor.\n                if (conversionResult.modelRange && !conversionResult.modelRange.isCollapsed) {\n                    data.modelRange = conversionResult.modelRange;\n                    data.modelCursor = conversionResult.modelCursor;\n                }\n                return;\n            }\n            conversionApi.convertChildren(data.viewItem, conversionApi.writer.createPositionAt(modelTable, 'end'));\n            conversionApi.updateConversionResult(modelTable, data);\n        });\n    };\n}\n/**\n * View table element to model table element conversion helper.\n *\n * This conversion helper converts the table element as well as table rows.\n *\n * @returns Conversion helper.\n * @internal\n */\nexport function upcastTable() {\n    return (dispatcher) => {\n        dispatcher.on('element:table', (evt, data, conversionApi) => {\n            const viewTable = data.viewItem;\n            // When element was already consumed then skip it.\n            if (!conversionApi.consumable.test(viewTable, { name: true })) {\n                return;\n            }\n            const { rows, headingRows, headingColumns } = scanTable(viewTable);\n            // Only set attributes if values is greater then 0.\n            const attributes = {};\n            if (headingColumns) {\n                attributes.headingColumns = headingColumns;\n            }\n            if (headingRows) {\n                attributes.headingRows = headingRows;\n            }\n            const table = conversionApi.writer.createElement('table', attributes);\n            if (!conversionApi.safeInsert(table, data.modelCursor)) {\n                return;\n            }\n            conversionApi.consumable.consume(viewTable, { name: true });\n            // Upcast table rows in proper order (heading rows first).\n            rows.forEach(row => conversionApi.convertItem(row, conversionApi.writer.createPositionAt(table, 'end')));\n            // Convert everything else.\n            conversionApi.convertChildren(viewTable, conversionApi.writer.createPositionAt(table, 'end'));\n            // Create one row and one table cell for empty table.\n            if (table.isEmpty) {\n                const row = conversionApi.writer.createElement('tableRow');\n                conversionApi.writer.insert(row, conversionApi.writer.createPositionAt(table, 'end'));\n                createEmptyTableCell(conversionApi.writer, conversionApi.writer.createPositionAt(row, 'end'));\n            }\n            conversionApi.updateConversionResult(table, data);\n        });\n    };\n}\n/**\n * A conversion helper that skips empty <tr> elements from upcasting at the beginning of the table.\n *\n * An empty row is considered a table model error but when handling clipboard data there could be rows that contain only row-spanned cells\n * and empty TR-s are used to maintain the table structure (also {@link module:table/tablewalker~TableWalker} assumes that there are only\n * rows that have related `tableRow` elements).\n *\n * *Note:* Only the first empty rows are removed because they have no meaning and it solves the issue\n * of an improper table with all empty rows.\n *\n * @internal\n * @returns Conversion helper.\n */\nexport function skipEmptyTableRow() {\n    return (dispatcher) => {\n        dispatcher.on('element:tr', (evt, data) => {\n            if (data.viewItem.isEmpty && data.modelCursor.index == 0) {\n                evt.stop();\n            }\n        }, { priority: 'high' });\n    };\n}\n/**\n * A converter that ensures an empty paragraph is inserted in a table cell if no other content was converted.\n *\n * @internal\n * @returns Conversion helper.\n */\nexport function ensureParagraphInTableCell(elementName) {\n    return (dispatcher) => {\n        dispatcher.on(`element:${elementName}`, (evt, data, { writer }) => {\n            // The default converter will create a model range on converted table cell.\n            if (!data.modelRange) {\n                return;\n            }\n            const tableCell = data.modelRange.start.nodeAfter;\n            const modelCursor = writer.createPositionAt(tableCell, 0);\n            // Ensure a paragraph in the model for empty table cells for converted table cells.\n            if (data.viewItem.isEmpty) {\n                writer.insertElement('paragraph', modelCursor);\n                return;\n            }\n            const childNodes = Array.from(tableCell.getChildren());\n            // In case there are only markers inside the table cell then move them to the paragraph.\n            if (childNodes.every(node => node.is('element', '$marker'))) {\n                const paragraph = writer.createElement('paragraph');\n                writer.insert(paragraph, writer.createPositionAt(tableCell, 0));\n                for (const node of childNodes) {\n                    writer.move(writer.createRangeOn(node), writer.createPositionAt(paragraph, 'end'));\n                }\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * Scans table rows and extracts required metadata from the table:\n *\n * headingRows    - The number of rows that go as table headers.\n * headingColumns - The maximum number of row headings.\n * rows           - Sorted `<tr>` elements as they should go into the model - ie. if `<thead>` is inserted after `<tbody>` in the view.\n */\nfunction scanTable(viewTable) {\n    let headingRows = 0;\n    let headingColumns = undefined;\n    // The `<tbody>` and `<thead>` sections in the DOM do not have to be in order `<thead>` -> `<tbody>` and there might be more than one\n    // of them.\n    // As the model does not have these sections, rows from different sections must be sorted.\n    // For example, below is a valid HTML table:\n    //\n    // <table>\n    //   <tbody><tr><td>2</td></tr></tbody>\n    //   <thead><tr><td>1</td></tr></thead>\n    //   <tbody><tr><td>3</td></tr></tbody>\n    // </table>\n    //\n    // But browsers will render rows in order as: 1 as the heading and 2 and 3 as the body.\n    const headRows = [];\n    const bodyRows = [];\n    // Currently the editor does not support more then one <thead> section.\n    // Only the first <thead> from the view will be used as a heading row and the others will be converted to body rows.\n    let firstTheadElement;\n    for (const tableChild of Array.from(viewTable.getChildren())) {\n        // Only `<thead>`, `<tbody>` & `<tfoot>` from allowed table children can have `<tr>`s.\n        // The else is for future purposes (mainly `<caption>`).\n        if (tableChild.name !== 'tbody' && tableChild.name !== 'thead' && tableChild.name !== 'tfoot') {\n            continue;\n        }\n        // Save the first `<thead>` in the table as table header - all other ones will be converted to table body rows.\n        if (tableChild.name === 'thead' && !firstTheadElement) {\n            firstTheadElement = tableChild;\n        }\n        // There might be some extra empty text nodes between the `<tr>`s.\n        // Make sure further code operates on `tr`s only. (#145)\n        const trs = Array.from(tableChild.getChildren()).filter((el) => el.is('element', 'tr'));\n        // Keep tracking of the previous row columns count to improve detection of heading rows.\n        let maxPrevColumns = null;\n        for (const tr of trs) {\n            const trColumns = Array\n                .from(tr.getChildren())\n                .filter(el => el.is('element', 'td') || el.is('element', 'th'));\n            // This <tr> is a child of a first <thead> element.\n            if ((firstTheadElement && tableChild === firstTheadElement) ||\n                (tableChild.name === 'tbody' &&\n                    trColumns.length > 0 &&\n                    // These conditions handles the case when the first column is a <th> element and it's the only column in the row.\n                    // This case is problematic because it's not clear if this row should be a heading row or not, as it may be result\n                    // of the cell span from the previous row.\n                    // Issue: https://github.com/ckeditor/ckeditor5/issues/17556\n                    (maxPrevColumns === null || trColumns.length === maxPrevColumns) &&\n                    trColumns.every(e => e.is('element', 'th')))) {\n                headingRows++;\n                headRows.push(tr);\n            }\n            else {\n                bodyRows.push(tr);\n            }\n            // We use the maximum number of columns to avoid false positives when detecting\n            // multiple rows with single column within `rowspan`. Without it the last row of `rowspan=3`\n            // would be detected as a heading row because it has only one column (identical to the previous row).\n            maxPrevColumns = Math.max(maxPrevColumns || 0, trColumns.length);\n        }\n    }\n    // Generate the cell matrix so we can calculate the heading columns.\n    const bodyMatrix = generateCellMatrix(bodyRows);\n    for (const rowSlots of bodyMatrix) {\n        // Look for the first non-`<th>` entry (either a `<td>` or a missing cell).\n        let index = 0;\n        while (index < rowSlots.length) {\n            if (rowSlots[index]?.name !== 'th') {\n                break;\n            }\n            index += 1;\n        }\n        // Update headingColumns.\n        if (!headingColumns || index < headingColumns) {\n            headingColumns = index;\n        }\n    }\n    return {\n        headingRows,\n        headingColumns: headingColumns || 0,\n        rows: [...headRows, ...bodyRows]\n    };\n}\n/**\n * Takes an array of `<tr>` elements and generates a \"matrix\" (square\n * two-dimensional array) describing which `<th>`s and `<td>`s fill which\n * \"slots\", factoring in `rowspan`s and `colspan`s. For example, given\n *\n * ```xml\n * <table>\n *   <tr> <td>11</td> <td rowspan=\"2\">12-22</td> <td>13</td> </tr>\n *   <tr> <td>21</td> <td>23</td> </tr>\n *   <tr> <td colspan=\"2\">31-32</td> <td>33</rd> </tr>\n * </table>\n * ```\n *\n * The result would be (with cell elements' text content in place of the element\n * objects for readability):\n *\n * ```js\n * [\n *   [ '11', '12-22', '13' ],\n *   [ '21', '12-22', '23' ],\n *   [ '31-32', '31-32', '33' ],\n * ]\n * ```\n *\n * This allows for a computation of heading columns that factors in the case\n * where a cell from a previous rows with a `rowspan` attribute effectively adds\n * an additional header cell to a subsequent row.\n *\n * There are also cases where cells are \"missing\" from a row. A simple one is\n * the case where a row simply has fewer cells than another row in the same\n * table. But another is one where a row has a cell with a `rowspan` that\n * effectively adds a cell to a subsequent row \"off the end\" of the row. In this\n * case, there will be a `null` value instead of an element object in that\n * position. For example,\n *\n * ```xml\n * <table>\n *   <tr> <td>11</td> <td>12</td> <td rowspan=\"2\">13-23</td> </tr>\n *   <tr> <td>21</td> </tr>\n *   <tr> <td>31</td> </tr>\n * </table>\n * ```\n *\n * would result in\n *\n * ```js\n * [\n *   [ '11', '12', '13-23' ],\n *   [ '21', null, '13-23' ],\n *   [ '31', null, null ]\n * ]\n * ```\n *\n * @param trs the array of `<tr>` elements\n * @returns the cell matrix\n */\nfunction generateCellMatrix(trs) {\n    // As we iterate, we keep track of cells with rowspans >1 so later rows can\n    // factor them in. This trackes any such cells from previous rows.\n    let prevRowspans = new Map();\n    // This is the maximum number of columns we've encountered.\n    let maxColumns = 0;\n    const slots = trs.map(tr => {\n        // This will be the slots that are in this row, including cells from\n        // previous rows with a big enough \"rowspan\" to affect this row.\n        const curSlots = [];\n        // Get the cell elements\n        const children = Array.from(tr.getChildren())\n            .filter(child => child.name === 'th' || child.name === 'td');\n        // This will be any cells in this row that have a rowspan >1, so we can\n        // combine it with `prevRowspans` when we're done processing this row.\n        const curRowspans = new Map();\n        // We need to process all the cells in this row, but also previous rows'\n        // cells with rowspans might add additional slots to the end of this row, so\n        // we need to iterate until we've both consumed all the children _and_\n        // filled out slots to the max number of columns we've encountered so far.\n        while (children.length || curSlots.length < maxColumns) {\n            const rowSpan = prevRowspans.get(curSlots.length);\n            if (rowSpan && rowSpan.remaining > 0) {\n                // We have a cell at this index in a previous row whose rowspan extends\n                // it into this row, so we insert a copy of it here.\n                curSlots.push(rowSpan.cell);\n            }\n            else {\n                // See if we have more cells in the row.\n                const cell = children.shift();\n                if (cell) {\n                    // We do, so process it\n                    const colspan = parseInt(cell.getAttribute('colspan') || '1');\n                    const rowspan = parseInt(cell.getAttribute('rowspan') || '1');\n                    // Process this cell as many times as needed according to its colspan.\n                    for (let i = 0; i < colspan; i++) {\n                        // if we have a >1 rowspan, create a record in the rowSpans map for\n                        // this column index keeping track of it.\n                        if (rowspan > 1) {\n                            curRowspans.set(curSlots.length, { cell, remaining: rowspan - 1 });\n                        }\n                        curSlots.push(cell);\n                    }\n                }\n                else {\n                    // No remaining children in this row, so no cell in this slot.\n                    curSlots.push(null);\n                    continue;\n                }\n            }\n        }\n        // Now update the row spans. In weird edge cases where colspan and rowspan\n        // conflict, we can end up with a cell in a column in this row that\n        // \"truncates\" a row-spanning cell from a previous column, so make sure in\n        // those cases, the value in `curRowspans` always \"wins\". We do this by\n        // copying (and decrementing) values from `prevRowspans` into `curRowspans`\n        // as long as there is no conflict, and then re-assigning `prevRowspans`.\n        for (const [index, entry] of prevRowspans.entries()) {\n            entry.remaining -= 1;\n            if (entry.remaining > 0 && !curRowspans.has(index)) {\n                curRowspans.set(index, entry);\n            }\n        }\n        prevRowspans = curRowspans;\n        // Finally, update `maxColumns`.\n        maxColumns = Math.max(maxColumns, curSlots.length);\n        return curSlots;\n    });\n    // Now expand any rows that have fewer than `maxColumns` with nulls so we have\n    // a proper matrix.\n    for (const rowSlots of slots) {\n        while (rowSlots.length < maxColumns) {\n            rowSlots.push(null);\n        }\n    }\n    return slots;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { isObject } from 'es-toolkit/compat';\n/**\n * Returns a string if all four values of box sides are equal.\n *\n * If a string is passed, it is treated as a single value (pass-through).\n *\n * ```ts\n * // Returns 'foo':\n * getSingleValue( { top: 'foo', right: 'foo', bottom: 'foo', left: 'foo' } );\n * getSingleValue( 'foo' );\n *\n * // Returns undefined:\n * getSingleValue( { top: 'foo', right: 'foo', bottom: 'bar', left: 'foo' } );\n * getSingleValue( { top: 'foo', right: 'foo' } );\n * ```\n *\n * @internal\n */\nexport function getSingleValue(objectOrString) {\n    if (!objectOrString || !isObject(objectOrString)) {\n        return objectOrString;\n    }\n    const { top, right, bottom, left } = objectOrString;\n    if (top == right && right == bottom && bottom == left) {\n        return top;\n    }\n}\n/**\n * Adds a unit to a value if the value is a number or a string representing a number.\n *\n * **Note**: It does nothing to non-numeric values.\n *\n * ```ts\n * getSingleValue( 25, 'px' ); // '25px'\n * getSingleValue( 25, 'em' ); // '25em'\n * getSingleValue( '25em', 'px' ); // '25em'\n * getSingleValue( 'foo', 'px' ); // 'foo'\n * ```\n *\n * @internal\n * @param defaultUnit A default unit added to a numeric value.\n */\nexport function addDefaultUnitToNumericValue(value, defaultUnit) {\n    const numericValue = parseFloat(value);\n    if (Number.isNaN(numericValue)) {\n        return value;\n    }\n    if (String(numericValue) !== String(value)) {\n        return value;\n    }\n    return `${numericValue}${defaultUnit}`;\n}\n/**\n * Returns the normalized configuration.\n *\n * @internal\n * @param config The configuration to normalize.\n * @param options Options used to determine which properties should be added.\n */\nexport function getNormalizedDefaultProperties(config, options = {}) {\n    const normalizedConfig = {\n        borderStyle: 'none',\n        borderWidth: '',\n        borderColor: '',\n        backgroundColor: '',\n        width: '',\n        height: '',\n        ...config\n    };\n    if (options.includeAlignmentProperty && !normalizedConfig.alignment) {\n        normalizedConfig.alignment = 'center';\n    }\n    if (options.includePaddingProperty && !normalizedConfig.padding) {\n        normalizedConfig.padding = '';\n    }\n    if (options.includeVerticalAlignmentProperty && !normalizedConfig.verticalAlignment) {\n        normalizedConfig.verticalAlignment = 'middle';\n    }\n    if (options.includeHorizontalAlignmentProperty && !normalizedConfig.horizontalAlignment) {\n        normalizedConfig.horizontalAlignment = options.isRightToLeftContent ? 'right' : 'left';\n    }\n    return normalizedConfig;\n}\n/**\n * Returns the normalized default table properties.\n *\n * @internal\n * @param config The configuration to normalize.\n * @param options Options used to determine which properties should be added.\n */\nexport function getNormalizedDefaultTableProperties(config, options) {\n    return getNormalizedDefaultProperties({\n        // It adds support for border none in the table element, keep it in sync with the content styles\n        // See more: https://github.com/ckeditor/ckeditor5/issues/6841#issuecomment-1959195608\n        borderStyle: 'double',\n        borderColor: 'hsl(0, 0%, 70%)',\n        borderWidth: '1px',\n        ...config\n    }, options);\n}\n/**\n * Returns the normalized default cell properties.\n *\n * @internal\n * @param config The configuration to normalize.\n * @param options Options used to determine which properties should be added.\n */\nexport function getNormalizedDefaultCellProperties(config, options) {\n    return getNormalizedDefaultProperties({\n        // It adds support for border none in the table element, keep it in sync with the content styles\n        // See more: https://github.com/ckeditor/ckeditor5/issues/6841#issuecomment-1959195608\n        borderStyle: 'solid',\n        borderColor: 'hsl(0, 0%, 75%)',\n        borderWidth: '1px',\n        ...config\n    }, options);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { toWidget, toWidgetEditable } from 'ckeditor5/src/widget.js';\nimport { TableWalker } from './../tablewalker.js';\nimport { downcastTableAlignmentConfig } from './tableproperties.js';\nimport { getNormalizedDefaultTableProperties } from '../utils/table-properties.js';\n/**\n * Model table element to view table element conversion helper.\n *\n * @internal\n */\nexport function downcastTable(tableUtils, options) {\n    return (table, { writer }) => {\n        const headingRows = table.getAttribute('headingRows') || 0;\n        const tableElement = writer.createContainerElement('table', null, []);\n        const figureElement = writer.createContainerElement('figure', { class: 'table' }, tableElement);\n        // Table head slot.\n        if (headingRows > 0) {\n            writer.insert(writer.createPositionAt(tableElement, 'end'), writer.createContainerElement('thead', null, writer.createSlot(element => element.is('element', 'tableRow') && element.index < headingRows)));\n        }\n        // Table body slot.\n        if (headingRows < tableUtils.getRows(table)) {\n            writer.insert(writer.createPositionAt(tableElement, 'end'), writer.createContainerElement('tbody', null, writer.createSlot(element => element.is('element', 'tableRow') && element.index >= headingRows)));\n        }\n        // Dynamic slots.\n        for (const { positionOffset, filter } of options.additionalSlots) {\n            writer.insert(writer.createPositionAt(tableElement, positionOffset), writer.createSlot(filter));\n        }\n        // Create a slot with items that don't fit into the table.\n        writer.insert(writer.createPositionAt(tableElement, 'after'), writer.createSlot(element => {\n            if (element.is('element', 'tableRow')) {\n                return false;\n            }\n            return !options.additionalSlots.some(({ filter }) => filter(element));\n        }));\n        return options.asWidget ? toTableWidget(figureElement, writer) : figureElement;\n    };\n}\n/**\n * Model table row element to view `<tr>` element conversion helper.\n *\n * @internal\n * @returns Element creator.\n */\nexport function downcastRow() {\n    return (tableRow, { writer }) => {\n        return tableRow.isEmpty ?\n            writer.createEmptyElement('tr') :\n            writer.createContainerElement('tr');\n    };\n}\n/**\n * Model table cell element to view `<td>` or `<th>` element conversion helper.\n *\n * This conversion helper will create proper `<th>` elements for table cells that are in the heading section (heading row or column)\n * and `<td>` otherwise.\n *\n * @internal\n * @param options.asWidget If set to `true`, the downcast conversion will produce a widget.\n * @returns Element creator.\n */\nexport function downcastCell(options = {}) {\n    return (tableCell, { writer }) => {\n        const tableRow = tableCell.parent;\n        const table = tableRow.parent;\n        const rowIndex = table.getChildIndex(tableRow);\n        const tableWalker = new TableWalker(table, { row: rowIndex });\n        const headingRows = table.getAttribute('headingRows') || 0;\n        const headingColumns = table.getAttribute('headingColumns') || 0;\n        let result = null;\n        // We need to iterate over a table in order to get proper row & column values from a walker.\n        for (const tableSlot of tableWalker) {\n            if (tableSlot.cell == tableCell) {\n                const isHeading = tableSlot.row < headingRows || tableSlot.column < headingColumns;\n                const cellElementName = isHeading ? 'th' : 'td';\n                result = options.asWidget ?\n                    toWidgetEditable(writer.createEditableElement(cellElementName), writer, { withAriaRole: false }) :\n                    writer.createContainerElement(cellElementName);\n                break;\n            }\n        }\n        return result;\n    };\n}\n/**\n * Overrides paragraph inside table cell conversion.\n *\n * This converter:\n * * should be used to override default paragraph conversion.\n * * It will only convert `<paragraph>` placed directly inside `<tableCell>`.\n * * For a single paragraph without attributes it returns `<span>` to simulate data table.\n * * For all other cases it returns `<p>` element.\n *\n * @internal\n * @param options.asWidget If set to `true`, the downcast conversion will produce a widget.\n * @returns Element creator.\n */\nexport function convertParagraphInTableCell(options = {}) {\n    return (modelElement, { writer }) => {\n        if (!modelElement.parent.is('element', 'tableCell')) {\n            return null;\n        }\n        if (!isSingleParagraphWithoutAttributes(modelElement)) {\n            return null;\n        }\n        if (options.asWidget) {\n            return writer.createContainerElement('span', { class: 'ck-table-bogus-paragraph' });\n        }\n        else {\n            // Using `<p>` in case there are some markers on it and transparentRendering will render it anyway.\n            const viewElement = writer.createContainerElement('p');\n            writer.setCustomProperty('dataPipeline:transparentRendering', true, viewElement);\n            return viewElement;\n        }\n    };\n}\n/**\n * Checks if given model `<paragraph>` is an only child of a parent (`<tableCell>`) and if it has any attribute set.\n *\n * The paragraph should be converted in the editing view to:\n *\n * * If returned `true` - to a `<span class=\"ck-table-bogus-paragraph\">`\n * * If returned `false` - to a `<p>`\n *\n * @internal\n */\nexport function isSingleParagraphWithoutAttributes(modelElement) {\n    const tableCell = modelElement.parent;\n    const isSingleParagraph = tableCell.childCount == 1;\n    return isSingleParagraph && !hasAnyAttribute(modelElement);\n}\n/**\n * Converts a given {@link module:engine/view/element~ViewElement} to a table widget:\n * * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property}\n * allowing to recognize the table widget element.\n * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.\n *\n * @param writer An instance of the view writer.\n * @param label The element's label. It will be concatenated with the table `alt` attribute if one is present.\n */\nfunction toTableWidget(viewElement, writer) {\n    writer.setCustomProperty('table', true, viewElement);\n    return toWidget(viewElement, writer, { hasSelectionHandle: true });\n}\n/**\n * Checks if an element has any attributes set.\n */\nfunction hasAnyAttribute(element) {\n    for (const attributeKey of element.getAttributeKeys()) {\n        // Ignore selection attributes stored on block elements.\n        if (attributeKey.startsWith('selection:') || attributeKey == 'htmlEmptyBlock') {\n            continue;\n        }\n        return true;\n    }\n    return false;\n}\n/**\n * Downcasts a plain table (also used in the clipboard pipeline).\n */\nexport function convertPlainTable(editor) {\n    return (table, conversionApi) => {\n        const hasPlainTableOutput = editor.plugins.has('PlainTableOutput');\n        const isClipboardPipeline = conversionApi.options.isClipboardPipeline;\n        const useExtendedAlignment = editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');\n        if (!hasPlainTableOutput && !(useExtendedAlignment && isClipboardPipeline)) {\n            return null;\n        }\n        return downcastPlainTable(table, conversionApi, editor);\n    };\n}\n/**\n * Downcasts a plain table caption (also used in the clipboard pipeline).\n */\nexport function convertPlainTableCaption(editor) {\n    return (modelElement, { writer, options }) => {\n        const hasPlainTableOutput = editor.plugins.has('PlainTableOutput');\n        const isClipboardPipeline = options.isClipboardPipeline;\n        const useExtendedAlignment = editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');\n        if (!hasPlainTableOutput && !(useExtendedAlignment && isClipboardPipeline)) {\n            return null;\n        }\n        if (modelElement.parent.name === 'table') {\n            return writer.createContainerElement('caption');\n        }\n        return null;\n    };\n}\n/**\n * Downcasts a plain table.\n *\n * @param table Table model element.\n * @param conversionApi The conversion API object.\n * @param defaultTableProperties Normalized default table properties.\n * @returns Created element.\n */\nexport function downcastPlainTable(table, conversionApi, editor) {\n    const writer = conversionApi.writer;\n    const headingRows = table.getAttribute('headingRows') || 0;\n    // Table head rows slot.\n    const headRowsSlot = writer.createSlot((element) => element.is('element', 'tableRow') && element.index < headingRows);\n    // Table body rows slot.\n    const bodyRowsSlot = writer.createSlot((element) => element.is('element', 'tableRow') && element.index >= headingRows);\n    // Table children slot.\n    const childrenSlot = writer.createSlot((element) => !element.is('element', 'tableRow'));\n    // Table <thead> element with all the heading rows.\n    const theadElement = writer.createContainerElement('thead', null, headRowsSlot);\n    // Table <tbody> element with all the body rows.\n    const tbodyElement = writer.createContainerElement('tbody', null, bodyRowsSlot);\n    // Table contents element containing <thead> and <tbody> when necessary.\n    const tableContentElements = [];\n    if (headingRows) {\n        tableContentElements.push(theadElement);\n    }\n    if (headingRows < table.childCount) {\n        tableContentElements.push(tbodyElement);\n    }\n    const tableAttributes = { class: 'table' };\n    if (editor.plugins.has('TableProperties') && conversionApi.options.isClipboardPipeline) {\n        const defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {\n            includeAlignmentProperty: true\n        });\n        const tableAlignment = table.getAttribute('tableAlignment');\n        let localDefaultValue = defaultTableProperties.alignment;\n        if (table.getAttribute('tableType') === 'layout') {\n            localDefaultValue = '';\n        }\n        const tableAlignmentValue = tableAlignment || localDefaultValue;\n        if (tableAlignmentValue) {\n            tableAttributes.class += ' ' + downcastTableAlignmentConfig[tableAlignmentValue].className;\n            tableAttributes.style = downcastTableAlignmentConfig[tableAlignmentValue].style;\n            if (downcastTableAlignmentConfig[tableAlignmentValue].align !== undefined) {\n                tableAttributes.align = downcastTableAlignmentConfig[tableAlignmentValue].align;\n            }\n        }\n    }\n    // Create table structure.\n    //\n    // <table>\n    //    {children-slot-like-caption}\n    //    <thead>\n    //        {table-head-rows-slot}\n    //    </thead>\n    //    <tbody>\n    //        {table-body-rows-slot}\n    //    </tbody>\n    // </table>\n    return writer.createContainerElement('table', tableAttributes, [childrenSlot, ...tableContentElements]);\n}\n/**\n * Registers border and background attributes converters for plain tables or when the clipboard pipeline is used.\n */\nexport function downcastTableBorderAndBackgroundAttributes(editor) {\n    const modelAttributes = {\n        'border-width': 'tableBorderWidth',\n        'border-color': 'tableBorderColor',\n        'border-style': 'tableBorderStyle',\n        'background-color': 'tableBackgroundColor'\n    };\n    for (const [styleName, modelAttribute] of Object.entries(modelAttributes)) {\n        editor.conversion.for('dataDowncast').add(dispatcher => {\n            return dispatcher.on(`attribute:${modelAttribute}:table`, (evt, data, conversionApi) => {\n                const { item, attributeNewValue } = data;\n                const { mapper, writer } = conversionApi;\n                const hasPlainTableOutput = editor.plugins.has('PlainTableOutput');\n                const isClipboardPipeline = conversionApi.options.isClipboardPipeline;\n                const useExtendedAlignment = editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');\n                if (!hasPlainTableOutput && !(useExtendedAlignment && isClipboardPipeline)) {\n                    return;\n                }\n                if (!conversionApi.consumable.consume(item, evt.name)) {\n                    return;\n                }\n                const table = mapper.toViewElement(item);\n                if (attributeNewValue) {\n                    writer.setStyle(styleName, attributeNewValue, table);\n                }\n                else {\n                    writer.removeStyle(styleName, table);\n                }\n            }, { priority: 'high' });\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/inserttablecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The insert table command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'insertTable'` editor command.\n *\n * To insert a table at the current selection, execute the command and specify the dimensions:\n *\n * ```ts\n * editor.execute( 'insertTable', { rows: 20, columns: 5 } );\n * ```\n */\nexport class InsertTableCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const schema = model.schema;\n        this.isEnabled = isAllowedInParent(selection, schema);\n    }\n    /**\n     * Executes the command.\n     *\n     * Inserts a table with the given number of rows and columns into the editor.\n     *\n     * @param options.rows The number of rows to create in the inserted table. Default value is 2.\n     * @param options.columns The number of columns to create in the inserted table. Default value is 2.\n     * @param options.headingRows The number of heading rows. If not provided it will default to\n     * {@link module:table/tableconfig~TableConfig#defaultHeadings `config.table.defaultHeadings.rows`} table config.\n     * @param options.headingColumns The number of heading columns. If not provided it will default to\n     * {@link module:table/tableconfig~TableConfig#defaultHeadings `config.table.defaultHeadings.columns`} table config.\n     * @fires execute\n     */\n    execute(options = {}) {\n        const editor = this.editor;\n        const model = editor.model;\n        const tableUtils = editor.plugins.get('TableUtils');\n        const defaultRows = editor.config.get('table.defaultHeadings.rows');\n        const defaultColumns = editor.config.get('table.defaultHeadings.columns');\n        if (options.headingRows === undefined && defaultRows) {\n            options.headingRows = defaultRows;\n        }\n        if (options.headingColumns === undefined && defaultColumns) {\n            options.headingColumns = defaultColumns;\n        }\n        model.change(writer => {\n            const table = tableUtils.createTable(writer, options);\n            model.insertObject(table, null, null, { findOptimalPosition: 'auto' });\n            writer.setSelection(writer.createPositionAt(table.getNodeByPath([0, 0, 0]), 0));\n        });\n    }\n}\n/**\n * Checks if the table is allowed in the parent.\n */\nfunction isAllowedInParent(selection, schema) {\n    const positionParent = selection.getFirstPosition().parent;\n    const validParent = positionParent === positionParent.root ? positionParent : positionParent.parent;\n    return schema.checkChild(validParent, 'table');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/insertrowcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The insert row command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'insertTableRowBelow'` and\n * `'insertTableRowAbove'` editor commands.\n *\n * To insert a row below the selected cell, execute the following command:\n *\n * ```ts\n * editor.execute( 'insertTableRowBelow' );\n * ```\n *\n * To insert a row above the selected cell, execute the following command:\n *\n * ```ts\n * editor.execute( 'insertTableRowAbove' );\n * ```\n */\nexport class InsertRowCommand extends Command {\n    /**\n     * The order of insertion relative to the row in which the caret is located.\n     */\n    order;\n    /**\n     * Creates a new `InsertRowCommand` instance.\n     *\n     * @param editor The editor on which this command will be used.\n     * @param options.order The order of insertion relative to the row in which the caret is located.\n     * Possible values: `\"above\"` and `\"below\"`. Default value is \"below\"\n     */\n    constructor(editor, options = {}) {\n        super(editor);\n        this.order = options.order || 'below';\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const selection = this.editor.model.document.selection;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const isAnyCellSelected = !!tableUtils.getSelectionAffectedTableCells(selection).length;\n        this.isEnabled = isAnyCellSelected;\n    }\n    /**\n     * Executes the command.\n     *\n     * Depending on the command's {@link #order} value, it inserts a row `'below'` or `'above'` the row in which selection is set.\n     *\n     * @fires execute\n     */\n    execute() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const tableUtils = editor.plugins.get('TableUtils');\n        const insertAbove = this.order === 'above';\n        const affectedTableCells = tableUtils.getSelectionAffectedTableCells(selection);\n        const rowIndexes = tableUtils.getRowIndexes(affectedTableCells);\n        const row = insertAbove ? rowIndexes.first : rowIndexes.last;\n        const table = affectedTableCells[0].findAncestor('table');\n        tableUtils.insertRows(table, { at: insertAbove ? row : row + 1, copyStructureFromAbove: !insertAbove });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/insertcolumncommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The insert column command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'insertTableColumnLeft'` and\n * `'insertTableColumnRight'` editor commands.\n *\n * To insert a column to the left of the selected cell, execute the following command:\n *\n * ```ts\n * editor.execute( 'insertTableColumnLeft' );\n * ```\n *\n * To insert a column to the right of the selected cell, execute the following command:\n *\n * ```ts\n * editor.execute( 'insertTableColumnRight' );\n * ```\n */\nexport class InsertColumnCommand extends Command {\n    /**\n     * The order of insertion relative to the column in which the caret is located.\n     */\n    order;\n    /**\n     * Creates a new `InsertColumnCommand` instance.\n     *\n     * @param editor An editor on which this command will be used.\n     * @param options.order The order of insertion relative to the column in which the caret is located.\n     * Possible values: `\"left\"` and `\"right\"`. Default value is \"right\".\n     */\n    constructor(editor, options = {}) {\n        super(editor);\n        this.order = options.order || 'right';\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const selection = this.editor.model.document.selection;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const isAnyCellSelected = !!tableUtils.getSelectionAffectedTableCells(selection).length;\n        this.isEnabled = isAnyCellSelected;\n    }\n    /**\n     * Executes the command.\n     *\n     * Depending on the command's {@link #order} value, it inserts a column to the `'left'` or `'right'` of the column\n     * in which the selection is set.\n     *\n     * @fires execute\n     */\n    execute() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const tableUtils = editor.plugins.get('TableUtils');\n        const insertBefore = this.order === 'left';\n        const affectedTableCells = tableUtils.getSelectionAffectedTableCells(selection);\n        const columnIndexes = tableUtils.getColumnIndexes(affectedTableCells);\n        const column = insertBefore ? columnIndexes.first : columnIndexes.last;\n        const table = affectedTableCells[0].findAncestor('table');\n        tableUtils.insertColumns(table, { columns: 1, at: insertBefore ? column : column + 1 });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/splitcellcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The split cell command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'splitTableCellVertically'`\n * and `'splitTableCellHorizontally'`  editor commands.\n *\n * You can split any cell vertically or horizontally by executing this command. For example, to split the selected table cell vertically:\n *\n * ```ts\n * editor.execute( 'splitTableCellVertically' );\n * ```\n */\nexport class SplitCellCommand extends Command {\n    /**\n     * The direction that indicates which cell will be split.\n     */\n    direction;\n    /**\n     * Creates a new `SplitCellCommand` instance.\n     *\n     * @param editor The editor on which this command will be used.\n     * @param options.direction Indicates whether the command should split cells `'horizontally'` or `'vertically'`.\n     */\n    constructor(editor, options = {}) {\n        super(editor);\n        this.direction = options.direction || 'horizontally';\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(this.editor.model.document.selection);\n        this.isEnabled = selectedCells.length === 1;\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const tableCell = tableUtils.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];\n        const isHorizontal = this.direction === 'horizontally';\n        if (isHorizontal) {\n            tableUtils.splitCellHorizontally(tableCell, 2);\n        }\n        else {\n            tableUtils.splitCellVertically(tableCell, 2);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { TableWalker } from '../tablewalker.js';\nimport { isHeadingColumnCell } from '../utils/common.js';\nimport { removeEmptyRowsColumns } from '../utils/structure.js';\n/**\n * The merge cell command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'mergeTableCellRight'`, `'mergeTableCellLeft'`,\n * `'mergeTableCellUp'` and `'mergeTableCellDown'` editor commands.\n *\n * To merge a table cell at the current selection with another cell, execute the command corresponding with the preferred direction.\n *\n * For example, to merge with a cell to the right:\n *\n * ```ts\n * editor.execute( 'mergeTableCellRight' );\n * ```\n *\n * **Note**: If a table cell has a different [`rowspan`](https://www.w3.org/TR/html50/tabular-data.html#attr-tdth-rowspan)\n * (for `'mergeTableCellRight'` and `'mergeTableCellLeft'`) or [`colspan`](https://www.w3.org/TR/html50/tabular-data.html#attr-tdth-colspan)\n * (for `'mergeTableCellUp'` and `'mergeTableCellDown'`), the command will be disabled.\n */\nexport class MergeCellCommand extends Command {\n    /**\n     * The direction that indicates which cell will be merged with the currently selected one.\n     */\n    direction;\n    /**\n     * Whether the merge is horizontal (left/right) or vertical (up/down).\n     */\n    isHorizontal;\n    /**\n     * Creates a new `MergeCellCommand` instance.\n     *\n     * @param editor The editor on which this command will be used.\n     * @param options.direction Indicates which cell to merge with the currently selected one.\n     * Possible values are: `'left'`, `'right'`, `'up'` and `'down'`.\n     */\n    constructor(editor, options) {\n        super(editor);\n        this.direction = options.direction;\n        this.isHorizontal = this.direction == 'right' || this.direction == 'left';\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const cellToMerge = this._getMergeableCell();\n        this.value = cellToMerge;\n        this.isEnabled = !!cellToMerge;\n    }\n    /**\n     * Executes the command.\n     *\n     * Depending on the command's {@link #direction} value, it will merge the cell that is to the `'left'`, `'right'`, `'up'` or `'down'`.\n     *\n     * @fires execute\n     */\n    execute() {\n        const model = this.editor.model;\n        const doc = model.document;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const tableCell = tableUtils.getTableCellsContainingSelection(doc.selection)[0];\n        const cellToMerge = this.value;\n        const direction = this.direction;\n        model.change(writer => {\n            const isMergeNext = direction == 'right' || direction == 'down';\n            // The merge mechanism is always the same so sort cells to be merged.\n            const cellToExpand = (isMergeNext ? tableCell : cellToMerge);\n            const cellToRemove = (isMergeNext ? cellToMerge : tableCell);\n            // Cache the parent of cell to remove for later check.\n            const removedTableCellRow = cellToRemove.parent;\n            mergeTableCells(cellToRemove, cellToExpand, writer);\n            const spanAttribute = this.isHorizontal ? 'colspan' : 'rowspan';\n            const cellSpan = parseInt(tableCell.getAttribute(spanAttribute) || '1');\n            const cellToMergeSpan = parseInt(cellToMerge.getAttribute(spanAttribute) || '1');\n            // Update table cell span attribute and merge set selection on merged contents.\n            writer.setAttribute(spanAttribute, cellSpan + cellToMergeSpan, cellToExpand);\n            writer.setSelection(writer.createRangeIn(cellToExpand));\n            const tableUtils = this.editor.plugins.get('TableUtils');\n            const table = removedTableCellRow.findAncestor('table');\n            // Remove empty rows and columns after merging.\n            removeEmptyRowsColumns(table, tableUtils);\n        });\n    }\n    /**\n     * Returns a cell that can be merged with the current cell depending on the command's direction.\n     */\n    _getMergeableCell() {\n        const model = this.editor.model;\n        const doc = model.document;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const tableCell = tableUtils.getTableCellsContainingSelection(doc.selection)[0];\n        if (!tableCell) {\n            return;\n        }\n        // First get the cell on proper direction.\n        const cellToMerge = this.isHorizontal ?\n            getHorizontalCell(tableCell, this.direction, tableUtils) :\n            getVerticalCell(tableCell, this.direction, tableUtils);\n        if (!cellToMerge) {\n            return;\n        }\n        // If found check if the span perpendicular to merge direction is equal on both cells.\n        const spanAttribute = this.isHorizontal ? 'rowspan' : 'colspan';\n        const span = parseInt(tableCell.getAttribute(spanAttribute) || '1');\n        const cellToMergeSpan = parseInt(cellToMerge.getAttribute(spanAttribute) || '1');\n        if (cellToMergeSpan === span) {\n            return cellToMerge;\n        }\n    }\n}\n/**\n * Returns the cell that can be merged horizontally.\n */\nfunction getHorizontalCell(tableCell, direction, tableUtils) {\n    const tableRow = tableCell.parent;\n    const table = tableRow.parent;\n    const horizontalCell = direction == 'right' ? tableCell.nextSibling : tableCell.previousSibling;\n    const hasHeadingColumns = (table.getAttribute('headingColumns') || 0) > 0;\n    if (!horizontalCell) {\n        return;\n    }\n    // Sort cells:\n    const cellOnLeft = (direction == 'right' ? tableCell : horizontalCell);\n    const cellOnRight = (direction == 'right' ? horizontalCell : tableCell);\n    // Get their column indexes:\n    const { column: leftCellColumn } = tableUtils.getCellLocation(cellOnLeft);\n    const { column: rightCellColumn } = tableUtils.getCellLocation(cellOnRight);\n    const leftCellSpan = parseInt(cellOnLeft.getAttribute('colspan') || '1');\n    const isCellOnLeftInHeadingColumn = isHeadingColumnCell(tableUtils, cellOnLeft);\n    const isCellOnRightInHeadingColumn = isHeadingColumnCell(tableUtils, cellOnRight);\n    // We cannot merge heading columns cells with regular cells.\n    if (hasHeadingColumns && isCellOnLeftInHeadingColumn != isCellOnRightInHeadingColumn) {\n        return;\n    }\n    // The cell on the right must have index that is distant to the cell on the left by the left cell's width (colspan).\n    const cellsAreTouching = leftCellColumn + leftCellSpan === rightCellColumn;\n    // If the right cell's column index is different it means that there are rowspanned cells between them.\n    return cellsAreTouching ? horizontalCell : undefined;\n}\n/**\n * Returns the cell that can be merged vertically.\n */\nfunction getVerticalCell(tableCell, direction, tableUtils) {\n    const tableRow = tableCell.parent;\n    const table = tableRow.parent;\n    const rowIndex = table.getChildIndex(tableRow);\n    // Don't search for mergeable cell if direction points out of the table.\n    if ((direction == 'down' && rowIndex === tableUtils.getRows(table) - 1) || (direction == 'up' && rowIndex === 0)) {\n        return null;\n    }\n    const rowspan = parseInt(tableCell.getAttribute('rowspan') || '1');\n    const headingRows = table.getAttribute('headingRows') || 0;\n    const isMergeWithBodyCell = direction == 'down' && (rowIndex + rowspan) === headingRows;\n    const isMergeWithHeadCell = direction == 'up' && rowIndex === headingRows;\n    // Don't search for mergeable cell if direction points out of the current table section.\n    if (headingRows && (isMergeWithBodyCell || isMergeWithHeadCell)) {\n        return null;\n    }\n    const currentCellRowSpan = parseInt(tableCell.getAttribute('rowspan') || '1');\n    const rowOfCellToMerge = direction == 'down' ? rowIndex + currentCellRowSpan : rowIndex;\n    const tableMap = [...new TableWalker(table, { endRow: rowOfCellToMerge })];\n    const currentCellData = tableMap.find(value => value.cell === tableCell);\n    const mergeColumn = currentCellData.column;\n    const cellToMergeData = tableMap.find(({ row, cellHeight, column }) => {\n        if (column !== mergeColumn) {\n            return false;\n        }\n        if (direction == 'down') {\n            // If merging a cell below the mergeRow is already calculated.\n            return row === rowOfCellToMerge;\n        }\n        else {\n            // If merging a cell above calculate if it spans to mergeRow.\n            return rowOfCellToMerge === row + cellHeight;\n        }\n    });\n    return cellToMergeData && cellToMergeData.cell ? cellToMergeData.cell : null;\n}\n/**\n * Merges two table cells. It will ensure that after merging cells with an empty paragraph, the resulting table cell will only have one\n * paragraph. If one of the merged table cells is empty, the merged table cell will have the contents of the non-empty table cell.\n * If both are empty, the merged table cell will have only one empty paragraph.\n */\nfunction mergeTableCells(cellToRemove, cellToExpand, writer) {\n    if (!isEmpty(cellToRemove)) {\n        if (isEmpty(cellToExpand)) {\n            writer.remove(writer.createRangeIn(cellToExpand));\n        }\n        writer.move(writer.createRangeIn(cellToRemove), writer.createPositionAt(cellToExpand, 'end'));\n    }\n    // Remove merged table cell.\n    writer.remove(cellToRemove);\n}\n/**\n * Checks if the passed table cell contains an empty paragraph.\n */\nfunction isEmpty(tableCell) {\n    const firstTableChild = tableCell.getChild(0);\n    return tableCell.childCount == 1 && firstTableChild.is('element', 'paragraph') && firstTableChild.isEmpty;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/removerowcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The remove row command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'removeTableRow'` editor command.\n *\n * To remove the row containing the selected cell, execute the command:\n *\n * ```ts\n * editor.execute( 'removeTableRow' );\n * ```\n */\nexport class RemoveRowCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(this.editor.model.document.selection);\n        const firstCell = selectedCells[0];\n        if (firstCell) {\n            const table = firstCell.findAncestor('table');\n            const tableRowCount = tableUtils.getRows(table);\n            const lastRowIndex = tableRowCount - 1;\n            const selectedRowIndexes = tableUtils.getRowIndexes(selectedCells);\n            const areAllRowsSelected = selectedRowIndexes.first === 0 && selectedRowIndexes.last === lastRowIndex;\n            // Disallow selecting whole table -> delete whole table should be used instead.\n            this.isEnabled = !areAllRowsSelected;\n        }\n        else {\n            this.isEnabled = false;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const model = this.editor.model;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const referenceCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        const removedRowIndexes = tableUtils.getRowIndexes(referenceCells);\n        const firstCell = referenceCells[0];\n        const table = firstCell.findAncestor('table');\n        const columnIndexToFocus = tableUtils.getCellLocation(firstCell).column;\n        model.change(writer => {\n            const rowsToRemove = removedRowIndexes.last - removedRowIndexes.first + 1;\n            tableUtils.removeRows(table, {\n                at: removedRowIndexes.first,\n                rows: rowsToRemove\n            });\n            const cellToFocus = getCellToFocus(table, removedRowIndexes.first, columnIndexToFocus, tableUtils.getRows(table));\n            writer.setSelection(writer.createPositionAt(cellToFocus, 0));\n        });\n    }\n}\n/**\n * Returns a cell that should be focused before removing the row, belonging to the same column as the currently focused cell.\n * - If the row was not the last one, the cell to focus will be in the row that followed it (before removal).\n * - If the row was the last one, the cell to focus will be in the row that preceded it (before removal).\n */\nfunction getCellToFocus(table, removedRowIndex, columnToFocus, tableRowCount) {\n    // Don't go beyond last row's index.\n    const row = table.getChild(Math.min(removedRowIndex, tableRowCount - 1));\n    // Default to first table cell.\n    let cellToFocus = row.getChild(0);\n    let column = 0;\n    for (const tableCell of row.getChildren()) {\n        if (column > columnToFocus) {\n            return cellToFocus;\n        }\n        cellToFocus = tableCell;\n        column += parseInt(tableCell.getAttribute('colspan') || '1');\n    }\n    return cellToFocus;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/removecolumncommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { TableWalker } from '../tablewalker.js';\n/**\n * The remove column command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'removeTableColumn'` editor command.\n *\n * To remove the column containing the selected cell, execute the command:\n *\n * ```ts\n * editor.execute( 'removeTableColumn' );\n * ```\n */\nexport class RemoveColumnCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(this.editor.model.document.selection);\n        const firstCell = selectedCells[0];\n        if (firstCell) {\n            const table = firstCell.findAncestor('table');\n            const tableColumnCount = tableUtils.getColumns(table);\n            const { first, last } = tableUtils.getColumnIndexes(selectedCells);\n            this.isEnabled = last - first < (tableColumnCount - 1);\n        }\n        else {\n            this.isEnabled = false;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const [firstCell, lastCell] = getBoundaryCells(this.editor.model.document.selection, tableUtils);\n        const table = firstCell.parent.parent;\n        // Cache the table before removing or updating colspans.\n        const tableMap = [...new TableWalker(table)];\n        // Store column indexes of removed columns.\n        const removedColumnIndexes = {\n            first: tableMap.find(value => value.cell === firstCell).column,\n            last: tableMap.find(value => value.cell === lastCell).column\n        };\n        const cellToFocus = getCellToFocus(tableMap, firstCell, lastCell, removedColumnIndexes);\n        this.editor.model.change(writer => {\n            const columnsToRemove = removedColumnIndexes.last - removedColumnIndexes.first + 1;\n            tableUtils.removeColumns(table, {\n                at: removedColumnIndexes.first,\n                columns: columnsToRemove\n            });\n            writer.setSelection(writer.createPositionAt(cellToFocus, 0));\n        });\n    }\n}\n/**\n * Returns a proper table cell to focus after removing a column.\n * - selection is on last table cell it will return previous cell.\n */\nfunction getCellToFocus(tableMap, firstCell, lastCell, removedColumnIndexes) {\n    const colspan = parseInt(lastCell.getAttribute('colspan') || '1');\n    // If the table cell is spanned over 2+ columns - it will be truncated so the selection should\n    // stay in that cell.\n    if (colspan > 1) {\n        return lastCell;\n    }\n    // Normally, look for the cell in the same row that precedes the first cell to put selection there (\"column on the left\").\n    // If the deleted column is the first column of the table, there will be no predecessor: use the cell\n    // from the column that follows then (also in the same row).\n    else if (firstCell.previousSibling || lastCell.nextSibling) {\n        return lastCell.nextSibling || firstCell.previousSibling;\n    }\n    // It can happen that table cells have no siblings in a row, for instance, when there are row spans\n    // in the table (in the previous row). Then just look for the closest cell that is in a column\n    // that will not be removed to put the selection there.\n    else {\n        // Look for any cell in a column that precedes the first removed column.\n        if (removedColumnIndexes.first) {\n            return tableMap.reverse().find(({ column }) => {\n                return column < removedColumnIndexes.first;\n            }).cell;\n        }\n        // If the first removed column is the first column of the table, then\n        // look for any cell that is in a column that follows the last removed column.\n        else {\n            return tableMap.reverse().find(({ column }) => {\n                return column > removedColumnIndexes.last;\n            }).cell;\n        }\n    }\n}\n/**\n * Returns helper object returning the first and the last cell contained in given selection, based on DOM order.\n */\nfunction getBoundaryCells(selection, tableUtils) {\n    const referenceCells = tableUtils.getSelectionAffectedTableCells(selection);\n    const firstCell = referenceCells[0];\n    const lastCell = referenceCells.pop();\n    const returnValue = [firstCell, lastCell];\n    return firstCell.isBefore(lastCell) ? returnValue : returnValue.reverse();\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/setheaderrowcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { updateNumericAttribute } from '../utils/common.js';\nimport { getVerticallyOverlappingCells, splitHorizontally } from '../utils/structure.js';\n/**\n * The header row command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'setTableColumnHeader'` editor command.\n *\n * You can make the row containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element) by executing:\n *\n * ```ts\n * editor.execute( 'setTableRowHeader' );\n * ```\n *\n * **Note:** All preceding rows will also become headers. If the current row is already a header, executing this command\n * will make it a regular row back again (including the following rows).\n */\nexport class SetHeaderRowCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const model = this.editor.model;\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        if (selectedCells.length === 0) {\n            this.isEnabled = false;\n            this.value = false;\n            return;\n        }\n        const table = selectedCells[0].findAncestor('table');\n        this.isEnabled = model.schema.checkAttribute(table, 'headingRows');\n        this.value = selectedCells.every(cell => this._isInHeading(cell, cell.parent.parent));\n    }\n    /**\n     * Executes the command.\n     *\n     * When the selection is in a non-header row, the command will set the `headingRows` table attribute to cover that row.\n     *\n     * When the selection is already in a header row, it will set `headingRows` so the heading section will end before that row.\n     *\n     * @fires execute\n     * @param options.forceValue If set, the command will set (`true`) or unset (`false`) the header rows according to\n     * the `forceValue` parameter instead of the current model state.\n     */\n    execute(options = {}) {\n        if (options.forceValue === this.value) {\n            return;\n        }\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const model = this.editor.model;\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        const table = selectedCells[0].findAncestor('table');\n        const { first, last } = tableUtils.getRowIndexes(selectedCells);\n        const headingRowsToSet = this.value ? first : last + 1;\n        const currentHeadingRows = table.getAttribute('headingRows') || 0;\n        model.change(writer => {\n            if (headingRowsToSet) {\n                // Changing heading rows requires to check if any of a heading cell is overlapping vertically the table head.\n                // Any table cell that has a rowspan attribute > 1 will not exceed the table head so we need to fix it in rows below.\n                const startRow = headingRowsToSet > currentHeadingRows ? currentHeadingRows : 0;\n                const overlappingCells = getVerticallyOverlappingCells(table, headingRowsToSet, startRow);\n                for (const { cell } of overlappingCells) {\n                    splitHorizontally(cell, headingRowsToSet, writer);\n                }\n            }\n            updateNumericAttribute('headingRows', headingRowsToSet, table, writer, 0);\n        });\n    }\n    /**\n     * Checks if a table cell is in the heading section.\n     */\n    _isInHeading(tableCell, table) {\n        const headingRows = parseInt(table.getAttribute('headingRows') || '0');\n        return !!headingRows && tableCell.parent.index < headingRows;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/setheadercolumncommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { isHeadingColumnCell, updateNumericAttribute } from '../utils/common.js';\nimport { getHorizontallyOverlappingCells, splitVertically } from '../utils/structure.js';\n/**\n * The header column command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'setTableColumnHeader'` editor command.\n *\n * You can make the column containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element)\n * by executing:\n *\n * ```ts\n * editor.execute( 'setTableColumnHeader' );\n * ```\n *\n * **Note:** All preceding columns will also become headers. If the current column is already a header, executing this command\n * will make it a regular column back again (including the following columns).\n */\nexport class SetHeaderColumnCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const model = this.editor.model;\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        if (selectedCells.length === 0) {\n            this.isEnabled = false;\n            this.value = false;\n            return;\n        }\n        const table = selectedCells[0].findAncestor('table');\n        this.isEnabled = model.schema.checkAttribute(table, 'headingColumns');\n        this.value = selectedCells.every(cell => isHeadingColumnCell(tableUtils, cell));\n    }\n    /**\n     * Executes the command.\n     *\n     * When the selection is in a non-header column, the command will set the `headingColumns` table attribute to cover that column.\n     *\n     * When the selection is already in a header column, it will set `headingColumns` so the heading section will end before that column.\n     *\n     * @fires execute\n     * @param options.forceValue If set, the command will set (`true`) or unset (`false`) the header columns according to\n     * the `forceValue` parameter instead of the current model state.\n     */\n    execute(options = {}) {\n        if (options.forceValue === this.value) {\n            return;\n        }\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const model = this.editor.model;\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        const table = selectedCells[0].findAncestor('table');\n        const { first, last } = tableUtils.getColumnIndexes(selectedCells);\n        const headingColumnsToSet = this.value ? first : last + 1;\n        model.change(writer => {\n            if (headingColumnsToSet) {\n                // Changing heading columns requires to check if any of a heading cell is overlapping horizontally the table head.\n                // Any table cell that has a colspan attribute > 1 will not exceed the table head so we need to fix it in columns before.\n                const overlappingCells = getHorizontallyOverlappingCells(table, headingColumnsToSet);\n                for (const { cell, column } of overlappingCells) {\n                    splitVertically(cell, column, headingColumnsToSet, writer);\n                }\n            }\n            updateNumericAttribute('headingColumns', headingColumnsToSet, table, writer, 0);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { global } from 'ckeditor5/src/utils.js';\nimport { COLUMN_WIDTH_PRECISION, COLUMN_MIN_WIDTH_AS_PERCENTAGE, COLUMN_MIN_WIDTH_IN_PIXELS } from './constants.js';\n/**\n * Returns all the inserted or changed table model elements in a given change set. Only the tables\n * with 'columnsWidth' attribute are taken into account. The returned set may be empty.\n *\n * Most notably if an entire table is removed it will not be included in returned set.\n *\n * @internal\n * @param model The model to collect the affected elements from.\n * @returns A set of table model elements.\n */\nexport function getChangedResizedTables(model) {\n    const affectedTables = new Set();\n    for (const change of model.document.differ.getChanges()) {\n        let referencePosition = null;\n        // Checks if the particular change from the differ is:\n        // - an insertion or removal of a table, a row or a cell,\n        // - an attribute change on a table, a row or a cell.\n        switch (change.type) {\n            case 'insert':\n                referencePosition = ['table', 'tableRow', 'tableCell'].includes(change.name) ?\n                    change.position :\n                    null;\n                break;\n            case 'remove':\n                // If the whole table is removed, there's no need to update its column widths (#12201).\n                referencePosition = ['tableRow', 'tableCell'].includes(change.name) ?\n                    change.position :\n                    null;\n                break;\n            case 'attribute':\n                if (change.range.start.nodeAfter) {\n                    referencePosition = ['table', 'tableRow', 'tableCell'].includes(change.range.start.nodeAfter.name) ?\n                        change.range.start :\n                        null;\n                }\n                break;\n        }\n        if (!referencePosition) {\n            continue;\n        }\n        const tableNode = (referencePosition.nodeAfter && referencePosition.nodeAfter.is('element', 'table')) ?\n            referencePosition.nodeAfter : referencePosition.findAncestor('table');\n        // We iterate over the whole table looking for the nested tables that are also affected.\n        for (const node of model.createRangeOn(tableNode).getItems()) {\n            if (!node.is('element', 'table')) {\n                continue;\n            }\n            if (!getColumnGroupElement(node)) {\n                continue;\n            }\n            affectedTables.add(node);\n        }\n    }\n    return affectedTables;\n}\n/**\n * Calculates the percentage of the minimum column width given in pixels for a given table.\n *\n * @internal\n * @param modelTable A table model element.\n * @param editor The editor instance.\n * @returns The minimal column width in percentage.\n */\nexport function getColumnMinWidthAsPercentage(modelTable, editor) {\n    return COLUMN_MIN_WIDTH_IN_PIXELS * 100 / getTableWidthInPixels(modelTable, editor);\n}\n/**\n * Calculates the table width in pixels.\n *\n * @internal\n * @param modelTable A table model element.\n * @param editor The editor instance.\n * @returns The width of the table in pixels.\n */\nexport function getTableWidthInPixels(modelTable, editor) {\n    // It is possible for a table to not have a <tbody> element - see #11878.\n    const referenceElement = getChildrenViewElement(modelTable, 'tbody', editor) || getChildrenViewElement(modelTable, 'thead', editor);\n    const domReferenceElement = editor.editing.view.domConverter.mapViewToDom(referenceElement);\n    return getElementWidthInPixels(domReferenceElement);\n}\n/**\n * Returns the a view element with a given name that is nested directly in a `<table>` element\n * related to a given `modelTable`.\n *\n * @param elementName Name of a view to be looked for, e.g. `'colgroup`', `'thead`'.\n * @returns Matched view or `undefined` otherwise.\n */\nfunction getChildrenViewElement(modelTable, elementName, editor) {\n    const viewFigure = editor.editing.mapper.toViewElement(modelTable);\n    const viewTable = [...viewFigure.getChildren()]\n        .find((node) => node.is('element', 'table'));\n    return [...viewTable.getChildren()]\n        .find((node) => node.is('element', elementName));\n}\n/**\n * Returns the computed width (in pixels) of the DOM element without padding and borders.\n *\n * @internal\n * @param domElement A DOM element.\n * @returns The width of the DOM element in pixels.\n */\nexport function getElementWidthInPixels(domElement) {\n    const styles = global.window.getComputedStyle(domElement);\n    // In the 'border-box' box sizing algorithm, the element's width\n    // already includes the padding and border width (#12335).\n    if (styles.boxSizing === 'border-box') {\n        return parseFloat(styles.width) -\n            parseFloat(styles.paddingLeft) -\n            parseFloat(styles.paddingRight) -\n            parseFloat(styles.borderLeftWidth) -\n            parseFloat(styles.borderRightWidth);\n    }\n    else {\n        return parseFloat(styles.width);\n    }\n}\n/**\n * Returns the column indexes on the left and right edges of a cell. They differ if the cell spans\n * across multiple columns.\n *\n * @internal\n * @param cell A table cell model element.\n * @param tableUtils The Table Utils plugin instance.\n * @returns An object containing the indexes of the left and right edges of the cell.\n */\nexport function getColumnEdgesIndexes(cell, tableUtils) {\n    const cellColumnIndex = tableUtils.getCellLocation(cell).column;\n    const cellWidth = cell.getAttribute('colspan') || 1;\n    return {\n        leftEdge: cellColumnIndex,\n        rightEdge: cellColumnIndex + cellWidth - 1\n    };\n}\n/**\n * Rounds the provided value to a fixed-point number with defined number of digits after the decimal point.\n *\n * @internal\n * @param value A number to be rounded.\n * @returns The rounded number.\n */\nexport function toPrecision(value) {\n    const multiplier = Math.pow(10, COLUMN_WIDTH_PRECISION);\n    const number = typeof value === 'number' ? value : parseFloat(value);\n    return Math.round(number * multiplier) / multiplier;\n}\n/**\n * Clamps the number within the inclusive lower (min) and upper (max) bounds. Returned number is rounded using the\n * {@link ~toPrecision `toPrecision()`} function.\n *\n * @internal\n * @param number A number to be clamped.\n * @param min A lower bound.\n * @param max An upper bound.\n * @returns The clamped number.\n */\nexport function clamp(number, min, max) {\n    if (number <= min) {\n        return toPrecision(min);\n    }\n    if (number >= max) {\n        return toPrecision(max);\n    }\n    return toPrecision(number);\n}\n/**\n * Creates an array with defined length and fills all elements with defined value.\n *\n * @internal\n * @param length The length of the array.\n * @param value The value to fill the array with.\n * @returns An array with defined length and filled with defined value.\n */\nexport function createFilledArray(length, value) {\n    return Array(length).fill(value);\n}\n/**\n * Sums all array values that can be parsed to a float.\n *\n * @internal\n * @param array An array of numbers.\n * @returns The sum of all array values.\n */\nexport function sumArray(array) {\n    return array\n        .map(value => typeof value === 'number' ? value : parseFloat(value))\n        .filter(value => !Number.isNaN(value))\n        .reduce((result, item) => result + item, 0);\n}\n/**\n * Makes sure that the sum of the widths from all columns is 100%. If the sum of all the widths is not equal 100%, all the widths are\n * changed proportionally so that they all sum back to 100%. If there are columns without specified width, the amount remaining\n * after assigning the known widths will be distributed equally between them.\n *\n * @internal\n * @param columnWidths An array of column widths.\n * @returns An array of column widths guaranteed to sum up to 100%.\n */\nexport function normalizeColumnWidths(columnWidths) {\n    const widths = columnWidths.map(width => {\n        if (width === 'auto' || width === undefined) {\n            return 'auto';\n        }\n        return parseFloat(width.replace('%', ''));\n    });\n    let normalizedWidths = calculateMissingColumnWidths(widths);\n    const totalWidth = sumArray(normalizedWidths);\n    if (totalWidth !== 100) {\n        normalizedWidths = normalizedWidths\n            // Adjust all the columns proportionally.\n            .map(width => toPrecision(width * 100 / totalWidth))\n            // Due to rounding of numbers it may happen that the sum of the widths of all columns will not be exactly 100%.\n            // Therefore, the width of the last column is explicitly adjusted (narrowed or expanded), since all the columns\n            // have been proportionally changed already.\n            .map((columnWidth, columnIndex, width) => {\n            const isLastColumn = columnIndex === width.length - 1;\n            if (!isLastColumn) {\n                return columnWidth;\n            }\n            const totalWidth = sumArray(width);\n            return toPrecision(columnWidth + 100 - totalWidth);\n        });\n    }\n    return normalizedWidths.map(width => width + '%');\n}\n/**\n * Initializes the column widths by parsing the attribute value and calculating the uninitialized column widths. The special value 'auto'\n * indicates that width for the column must be calculated. The width of such uninitialized column is calculated as follows:\n * - If there is enough free space in the table for all uninitialized columns to have at least the minimum allowed width for all of them,\n *   then set this width equally for all uninitialized columns.\n * - Otherwise, just set the minimum allowed width for all uninitialized columns. The sum of all column widths will be greater than 100%,\n *   but then it will be adjusted proportionally to 100% in {@link #normalizeColumnWidths `normalizeColumnWidths()`}.\n *\n * @param columnWidths An array of column widths.\n * @returns An array with 'auto' values replaced with calculated widths.\n */\nfunction calculateMissingColumnWidths(columnWidths) {\n    const numberOfUninitializedColumns = columnWidths.filter(columnWidth => columnWidth === 'auto').length;\n    if (numberOfUninitializedColumns === 0) {\n        return columnWidths.map(columnWidth => toPrecision(columnWidth));\n    }\n    const totalWidthOfInitializedColumns = sumArray(columnWidths);\n    const widthForUninitializedColumn = Math.max((100 - totalWidthOfInitializedColumns) / numberOfUninitializedColumns, COLUMN_MIN_WIDTH_AS_PERCENTAGE);\n    return columnWidths\n        .map(columnWidth => columnWidth === 'auto' ? widthForUninitializedColumn : columnWidth)\n        .map(columnWidth => toPrecision(columnWidth));\n}\n/**\n * Calculates the total horizontal space taken by the cell. That includes:\n *  * width,\n *  * left and red padding,\n *  * border width.\n *\n * @internal\n * @param domCell A DOM cell element.\n * @returns Width in pixels without `px` at the end.\n */\nexport function getDomCellOuterWidth(domCell) {\n    const styles = global.window.getComputedStyle(domCell);\n    // In the 'border-box' box sizing algorithm, the element's width\n    // already includes the padding and border width (#12335).\n    if (styles.boxSizing === 'border-box') {\n        return parseInt(styles.width);\n    }\n    else {\n        return parseFloat(styles.width) +\n            parseFloat(styles.paddingLeft) +\n            parseFloat(styles.paddingRight) +\n            parseFloat(styles.borderWidth);\n    }\n}\n/**\n * Updates column elements to match columns widths.\n *\n * @internal\n * @param columns\n * @param tableColumnGroup\n * @param normalizedWidths\n * @param writer\n */\nexport function updateColumnElements(columns, tableColumnGroup, normalizedWidths, writer) {\n    for (let i = 0; i < Math.max(normalizedWidths.length, columns.length); i++) {\n        const column = columns[i];\n        const columnWidth = normalizedWidths[i];\n        if (!columnWidth) {\n            // Number of `<tableColumn>` elements exceeds actual number of columns.\n            writer.remove(column);\n        }\n        else if (!column) {\n            // There is fewer `<tableColumn>` elements than actual columns.\n            writer.appendElement('tableColumn', { columnWidth }, tableColumnGroup);\n        }\n        else {\n            // Update column width.\n            writer.setAttribute('columnWidth', columnWidth, column);\n        }\n    }\n}\n/**\n * Returns a 'tableColumnGroup' element from the 'table'.\n *\n * @internal\n * @param element A 'table' or 'tableColumnGroup' element.\n * @returns A 'tableColumnGroup' element.\n */\nexport function getColumnGroupElement(element) {\n    if (element.is('element', 'tableColumnGroup')) {\n        return element;\n    }\n    const children = element.getChildren();\n    return Array\n        .from(children)\n        .find(element => element.is('element', 'tableColumnGroup'));\n}\n/**\n * Returns an array of 'tableColumn' elements. It may be empty if there's no `tableColumnGroup` element.\n *\n * @internal\n * @param element A 'table' or 'tableColumnGroup' element.\n * @returns An array of 'tableColumn' elements.\n */\nexport function getTableColumnElements(element) {\n    const columnGroupElement = getColumnGroupElement(element);\n    if (!columnGroupElement) {\n        return [];\n    }\n    return Array.from(columnGroupElement.getChildren());\n}\n/**\n * Returns an array of table column widths.\n *\n * @internal\n * @param element A 'table' or 'tableColumnGroup' element.\n * @returns An array of table column widths.\n */\nexport function getTableColumnsWidths(element) {\n    return getTableColumnElements(element).map(column => column.getAttribute('columnWidth'));\n}\n/**\n * Translates the `colSpan` model attribute into additional column widths and returns the resulting array.\n *\n * @internal\n * @param element A 'table' or 'tableColumnGroup' element.\n * @param writer A writer instance.\n * @returns An array of table column widths.\n */\nexport function translateColSpanAttribute(element, writer) {\n    const tableColumnElements = getTableColumnElements(element);\n    return tableColumnElements.reduce((acc, element) => {\n        const columnWidth = element.getAttribute('columnWidth');\n        const colSpan = element.getAttribute('colSpan');\n        if (!colSpan) {\n            acc.push(columnWidth);\n            return acc;\n        }\n        // Translate the `colSpan` model attribute on to the proper number of column widths\n        // and remove it from the element.\n        // See https://github.com/ckeditor/ckeditor5/issues/14521#issuecomment-1662102889 for more details.\n        for (let i = 0; i < colSpan; i++) {\n            acc.push(columnWidth);\n        }\n        writer.removeAttribute('colSpan', element);\n        return acc;\n    }, []);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableutils\n */\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TableWalker } from './tablewalker.js';\nimport { createEmptyTableCell, updateNumericAttribute } from './utils/common.js';\nimport { removeEmptyColumns, removeEmptyRows } from './utils/structure.js';\nimport { getTableColumnElements } from './tablecolumnresize/utils.js';\n/**\n * The table utilities plugin.\n */\nexport class TableUtils extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this.decorate('insertColumns');\n        this.decorate('insertRows');\n    }\n    /**\n     * Returns the table cell location as an object with table row and table column indexes.\n     *\n     * For instance, in the table below:\n     *\n     *      0   1   2   3\n     *    +---+---+---+---+\n     *  0 | a     | b | c |\n     *    +       +   +---+\n     *  1 |       |   | d |\n     *    +---+---+   +---+\n     *  2 | e     |   | f |\n     *    +---+---+---+---+\n     *\n     * the method will return:\n     *\n     * ```ts\n     * const cellA = table.getNodeByPath( [ 0, 0 ] );\n     * editor.plugins.get( 'TableUtils' ).getCellLocation( cellA );\n     * // will return { row: 0, column: 0 }\n     *\n     * const cellD = table.getNodeByPath( [ 1, 0 ] );\n     * editor.plugins.get( 'TableUtils' ).getCellLocation( cellD );\n     * // will return { row: 1, column: 3 }\n     * ```\n     *\n     * @returns Returns a `{row, column}` object.\n     */\n    getCellLocation(tableCell) {\n        const tableRow = tableCell.parent;\n        const table = tableRow.parent;\n        const rowIndex = table.getChildIndex(tableRow);\n        const tableWalker = new TableWalker(table, { row: rowIndex });\n        for (const { cell, row, column } of tableWalker) {\n            if (cell === tableCell) {\n                return { row, column };\n            }\n        }\n        // Should be unreachable code.\n        /* istanbul ignore next -- @preserve */\n        return undefined;\n    }\n    /**\n     * Creates an empty table with a proper structure. The table needs to be inserted into the model,\n     * for example, by using the {@link module:engine/model/model~Model#insertContent} function.\n     *\n     * ```ts\n     * model.change( ( writer ) => {\n     *   // Create a table of 2 rows and 7 columns:\n     *   const table = tableUtils.createTable( writer, { rows: 2, columns: 7 } );\n     *\n     *   // Insert a table to the model at the best position taking the current selection:\n     *   model.insertContent( table );\n     * }\n     * ```\n     *\n     * @param writer The model writer.\n     * @param options.rows The number of rows to create. Default value is 2.\n     * @param options.columns The number of columns to create. Default value is 2.\n     * @param options.headingRows The number of heading rows. Default value is 0.\n     * @param options.headingColumns The number of heading columns. Default value is 0.\n     * @returns The created table element.\n     */\n    createTable(writer, options) {\n        const table = writer.createElement('table');\n        const rows = options.rows || 2;\n        const columns = options.columns || 2;\n        createEmptyRows(writer, table, 0, rows, columns);\n        if (options.headingRows) {\n            updateNumericAttribute('headingRows', Math.min(options.headingRows, rows), table, writer, 0);\n        }\n        if (options.headingColumns) {\n            updateNumericAttribute('headingColumns', Math.min(options.headingColumns, columns), table, writer, 0);\n        }\n        return table;\n    }\n    /**\n     * Inserts rows into a table.\n     *\n     * ```ts\n     * editor.plugins.get( 'TableUtils' ).insertRows( table, { at: 1, rows: 2 } );\n     * ```\n     *\n     * Assuming the table on the left, the above code will transform it to the table on the right:\n     *\n     *  row index\n     *    0 +---+---+---+       `at` = 1,      +---+---+---+ 0\n     *      | a | b | c |       `rows` = 2,    | a | b | c |\n     *    1 +   +---+---+   <-- insert here    +   +---+---+ 1\n     *      |   | d | e |                      |   |   |   |\n     *    2 +   +---+---+       will give:     +   +---+---+ 2\n     *      |   | f | g |                      |   |   |   |\n     *    3 +---+---+---+                      +   +---+---+ 3\n     *                                         |   | d | e |\n     *                                         +   +---+---+ 4\n     *                                         +   + f | g |\n     *                                         +---+---+---+ 5\n     *\n     * @param table The table model element where the rows will be inserted.\n     * @param options.at The row index at which the rows will be inserted.  Default value is 0.\n     * @param options.rows The number of rows to insert.  Default value is 1.\n     * @param options.copyStructureFromAbove The flag for copying row structure. Note that\n     * the row structure will not be copied if this option is not provided.\n     */\n    insertRows(table, options = {}) {\n        const model = this.editor.model;\n        const insertAt = options.at || 0;\n        const rowsToInsert = options.rows || 1;\n        const isCopyStructure = options.copyStructureFromAbove !== undefined;\n        const copyStructureFrom = options.copyStructureFromAbove ? insertAt - 1 : insertAt;\n        const rows = this.getRows(table);\n        const columns = this.getColumns(table);\n        if (insertAt > rows) {\n            /**\n             * The `options.at` points at a row position that does not exist.\n             *\n             * @error tableutils-insertrows-insert-out-of-range\n             */\n            throw new CKEditorError('tableutils-insertrows-insert-out-of-range', this, { options });\n        }\n        model.change(writer => {\n            const headingRows = table.getAttribute('headingRows') || 0;\n            // Inserting rows inside heading section requires to update `headingRows` attribute as the heading section will grow.\n            if (headingRows > insertAt) {\n                updateNumericAttribute('headingRows', headingRows + rowsToInsert, table, writer, 0);\n            }\n            // Inserting at the end or at the beginning of a table doesn't require to calculate anything special.\n            if (!isCopyStructure && (insertAt === 0 || insertAt === rows)) {\n                createEmptyRows(writer, table, insertAt, rowsToInsert, columns);\n                return;\n            }\n            // Iterate over all the rows above the inserted rows in order to check for the row-spanned cells.\n            const walkerEndRow = isCopyStructure ? Math.max(insertAt, copyStructureFrom) : insertAt;\n            const tableIterator = new TableWalker(table, { endRow: walkerEndRow });\n            // Store spans of the reference row to reproduce it's structure. This array is column number indexed.\n            const rowColSpansMap = new Array(columns).fill(1);\n            for (const { row, column, cellHeight, cellWidth, cell } of tableIterator) {\n                const lastCellRow = row + cellHeight - 1;\n                const isOverlappingInsertedRow = row < insertAt && insertAt <= lastCellRow;\n                const isReferenceRow = row <= copyStructureFrom && copyStructureFrom <= lastCellRow;\n                // If the cell is row-spanned and overlaps the inserted row, then reserve space for it in the row map.\n                if (isOverlappingInsertedRow) {\n                    // This cell overlaps the inserted rows so we need to expand it further.\n                    writer.setAttribute('rowspan', cellHeight + rowsToInsert, cell);\n                    // Mark this cell with negative number to indicate how many cells should be skipped when adding the new cells.\n                    rowColSpansMap[column] = -cellWidth;\n                }\n                // Store the colspan from reference row.\n                else if (isCopyStructure && isReferenceRow) {\n                    rowColSpansMap[column] = cellWidth;\n                }\n            }\n            for (let rowIndex = 0; rowIndex < rowsToInsert; rowIndex++) {\n                const tableRow = writer.createElement('tableRow');\n                writer.insert(tableRow, table, insertAt);\n                for (let cellIndex = 0; cellIndex < rowColSpansMap.length; cellIndex++) {\n                    const colspan = rowColSpansMap[cellIndex];\n                    const insertPosition = writer.createPositionAt(tableRow, 'end');\n                    // Insert the empty cell only if this slot is not row-spanned from any other cell.\n                    if (colspan > 0) {\n                        createEmptyTableCell(writer, insertPosition, colspan > 1 ? { colspan } : undefined);\n                    }\n                    // Skip the col-spanned slots, there won't be any cells.\n                    cellIndex += Math.abs(colspan) - 1;\n                }\n            }\n        });\n    }\n    /**\n     * Inserts columns into a table.\n     *\n     * ```ts\n     * editor.plugins.get( 'TableUtils' ).insertColumns( table, { at: 1, columns: 2 } );\n     * ```\n     *\n     * Assuming the table on the left, the above code will transform it to the table on the right:\n     *\n     *  0   1   2   3                   0   1   2   3   4   5\n     *  +---+---+---+                   +---+---+---+---+---+\n     *  | a     | b |                   | a             | b |\n     *  +       +---+                   +               +---+\n     *  |       | c |                   |               | c |\n     *  +---+---+---+     will give:    +---+---+---+---+---+\n     *  | d | e | f |                   | d |   |   | e | f |\n     *  +---+   +---+                   +---+---+---+   +---+\n     *  | g |   | h |                   | g |   |   |   | h |\n     *  +---+---+---+                   +---+---+---+---+---+\n     *  | i         |                   | i                 |\n     *  +---+---+---+                   +---+---+---+---+---+\n     *      ^---- insert here, `at` = 1, `columns` = 2\n     *\n     * @param table The table model element where the columns will be inserted.\n     * @param options.at The column index at which the columns will be inserted. Default value is 0.\n     * @param options.columns The number of columns to insert. Default value is 1.\n     */\n    insertColumns(table, options = {}) {\n        const model = this.editor.model;\n        const insertAt = options.at || 0;\n        const columnsToInsert = options.columns || 1;\n        model.change(writer => {\n            const headingColumns = table.getAttribute('headingColumns');\n            // Inserting columns inside heading section requires to update `headingColumns` attribute as the heading section will grow.\n            if (insertAt < headingColumns) {\n                writer.setAttribute('headingColumns', headingColumns + columnsToInsert, table);\n            }\n            const tableColumns = this.getColumns(table);\n            // Inserting at the end and at the beginning of a table doesn't require to calculate anything special.\n            if (insertAt === 0 || tableColumns === insertAt) {\n                for (const tableRow of table.getChildren()) {\n                    // Ignore non-row elements inside the table (e.g. caption).\n                    if (!tableRow.is('element', 'tableRow')) {\n                        continue;\n                    }\n                    createCells(columnsToInsert, writer, writer.createPositionAt(tableRow, insertAt ? 'end' : 0));\n                }\n                return;\n            }\n            const tableWalker = new TableWalker(table, { column: insertAt, includeAllSlots: true });\n            for (const tableSlot of tableWalker) {\n                const { row, cell, cellAnchorColumn, cellAnchorRow, cellWidth, cellHeight } = tableSlot;\n                // When iterating over column the table walker outputs either:\n                // - cells at given column index (cell \"e\" from method docs),\n                // - spanned columns (spanned cell from row between cells \"g\" and \"h\" - spanned by \"e\", only if `includeAllSlots: true`),\n                // - or a cell from the same row which spans over this column (cell \"a\").\n                if (cellAnchorColumn < insertAt) {\n                    // If cell is anchored in previous column, it is a cell that spans over an inserted column (cell \"a\" & \"i\").\n                    // For such cells expand them by a number of columns inserted.\n                    writer.setAttribute('colspan', cellWidth + columnsToInsert, cell);\n                    // This cell will overlap cells in rows below so skip them (because of `includeAllSlots` option) - (cell \"a\")\n                    const lastCellRow = cellAnchorRow + cellHeight - 1;\n                    for (let i = row; i <= lastCellRow; i++) {\n                        tableWalker.skipRow(i);\n                    }\n                }\n                else {\n                    // It's either cell at this column index or spanned cell by a row-spanned cell from row above.\n                    // In table above it's cell \"e\" and a spanned position from row below (empty cell between cells \"g\" and \"h\")\n                    createCells(columnsToInsert, writer, tableSlot.getPositionBefore());\n                }\n            }\n        });\n    }\n    /**\n     * Removes rows from the given `table`.\n     *\n     * This method re-calculates the table geometry including `rowspan` attribute of table cells overlapping removed rows\n     * and table headings values.\n     *\n     * ```ts\n     * editor.plugins.get( 'TableUtils' ).removeRows( table, { at: 1, rows: 2 } );\n     * ```\n     *\n     * Executing the above code in the context of the table on the left will transform its structure as presented on the right:\n     *\n     *  row index\n     *      ┌───┬───┬───┐        `at` = 1        ┌───┬───┬───┐\n     *    0 │ a │ b │ c │        `rows` = 2      │ a │ b │ c │ 0\n     *      │   ├───┼───┤                        │   ├───┼───┤\n     *    1 │   │ d │ e │  <-- remove from here  │   │ d │ g │ 1\n     *      │   │   ├───┤        will give:      ├───┼───┼───┤\n     *    2 │   │   │ f │                        │ h │ i │ j │ 2\n     *      │   │   ├───┤                        └───┴───┴───┘\n     *    3 │   │   │ g │\n     *      ├───┼───┼───┤\n     *    4 │ h │ i │ j │\n     *      └───┴───┴───┘\n     *\n     * @param options.at The row index at which the removing rows will start.\n     * @param options.rows The number of rows to remove. Default value is 1.\n     */\n    removeRows(table, options) {\n        const model = this.editor.model;\n        const rowsToRemove = options.rows || 1;\n        const rowCount = this.getRows(table);\n        const first = options.at;\n        const last = first + rowsToRemove - 1;\n        if (last > rowCount - 1) {\n            /**\n             * The `options.at` param must point at existing row and `options.rows` must not exceed the rows in the table.\n             *\n             * @error tableutils-removerows-row-index-out-of-range\n             */\n            throw new CKEditorError('tableutils-removerows-row-index-out-of-range', this, { table, options });\n        }\n        model.change(writer => {\n            const indexesObject = { first, last };\n            // Removing rows from the table require that most calculations to be done prior to changing table structure.\n            // Preparations must be done in the same enqueueChange callback to use the current table structure.\n            // 1. Preparation - get row-spanned cells that have to be modified after removing rows.\n            const { cellsToMove, cellsToTrim } = getCellsToMoveAndTrimOnRemoveRow(table, indexesObject);\n            // 2. Execution\n            // 2a. Move cells from removed rows that extends over a removed section - must be done before removing rows.\n            // This will fill any gaps in a rows below that previously were empty because of row-spanned cells.\n            if (cellsToMove.size) {\n                const rowAfterRemovedSection = last + 1;\n                moveCellsToRow(table, rowAfterRemovedSection, cellsToMove, writer);\n            }\n            // 2b. Remove all required rows.\n            for (let i = last; i >= first; i--) {\n                writer.remove(table.getChild(i));\n            }\n            // 2c. Update cells from rows above that overlap removed section. Similar to step 2 but does not involve moving cells.\n            for (const { rowspan, cell } of cellsToTrim) {\n                updateNumericAttribute('rowspan', rowspan, cell, writer);\n            }\n            // 2d. Adjust heading rows if removed rows were in a heading section.\n            updateHeadingRows(table, indexesObject, writer);\n            // 2e. Remove empty columns (without anchored cells) if there are any.\n            if (!removeEmptyColumns(table, this)) {\n                // If there wasn't any empty columns then we still need to check if this wasn't called\n                // because of cleaning empty rows and we only removed one of them.\n                removeEmptyRows(table, this);\n            }\n        });\n    }\n    /**\n     * Removes columns from the given `table`.\n     *\n     * This method re-calculates the table geometry including the `colspan` attribute of table cells overlapping removed columns\n     * and table headings values.\n     *\n     * ```ts\n     * editor.plugins.get( 'TableUtils' ).removeColumns( table, { at: 1, columns: 2 } );\n     * ```\n     *\n     * Executing the above code in the context of the table on the left will transform its structure as presented on the right:\n     *\n     *    0   1   2   3   4                       0   1   2\n     *  ┌───────────────┬───┐                   ┌───────┬───┐\n     *  │ a             │ b │                   │ a     │ b │\n     *  │               ├───┤                   │       ├───┤\n     *  │               │ c │                   │       │ c │\n     *  ├───┬───┬───┬───┼───┤     will give:    ├───┬───┼───┤\n     *  │ d │ e │ f │ g │ h │                   │ d │ g │ h │\n     *  ├───┼───┼───┤   ├───┤                   ├───┤   ├───┤\n     *  │ i │ j │ k │   │ l │                   │ i │   │ l │\n     *  ├───┴───┴───┴───┴───┤                   ├───┴───┴───┤\n     *  │ m                 │                   │ m         │\n     *  └───────────────────┘                   └───────────┘\n     *        ^---- remove from here, `at` = 1, `columns` = 2\n     *\n     * @param options.at The row index at which the removing columns will start.\n     * @param options.columns The number of columns to remove.\n     */\n    removeColumns(table, options) {\n        const model = this.editor.model;\n        const first = options.at;\n        const columnsToRemove = options.columns || 1;\n        const last = options.at + columnsToRemove - 1;\n        model.change(writer => {\n            adjustHeadingColumns(table, { first, last }, writer);\n            const tableColumns = getTableColumnElements(table);\n            for (let removedColumnIndex = last; removedColumnIndex >= first; removedColumnIndex--) {\n                for (const { cell, column, cellWidth } of [...new TableWalker(table)]) {\n                    // If colspaned cell overlaps removed column decrease its span.\n                    if (column <= removedColumnIndex && cellWidth > 1 && column + cellWidth > removedColumnIndex) {\n                        updateNumericAttribute('colspan', cellWidth - 1, cell, writer);\n                    }\n                    else if (column === removedColumnIndex) {\n                        // The cell in removed column has colspan of 1.\n                        writer.remove(cell);\n                    }\n                }\n                // If table has `tableColumn` elements, we need to update it manually.\n                // See https://github.com/ckeditor/ckeditor5/issues/14521#issuecomment-1662102889 for details.\n                if (tableColumns[removedColumnIndex]) {\n                    // If the removed column is the first one then we need to add its width to the next column.\n                    // Otherwise we add it to the previous column.\n                    const adjacentColumn = removedColumnIndex === 0 ? tableColumns[1] : tableColumns[removedColumnIndex - 1];\n                    const removedColumnWidth = parseFloat(tableColumns[removedColumnIndex].getAttribute('columnWidth'));\n                    const adjacentColumnWidth = parseFloat(adjacentColumn.getAttribute('columnWidth'));\n                    writer.remove(tableColumns[removedColumnIndex]);\n                    // Add the removed column width (in %) to the adjacent column.\n                    writer.setAttribute('columnWidth', removedColumnWidth + adjacentColumnWidth + '%', adjacentColumn);\n                }\n            }\n            // Remove empty rows that could appear after removing columns.\n            if (!removeEmptyRows(table, this)) {\n                // If there wasn't any empty rows then we still need to check if this wasn't called\n                // because of cleaning empty columns and we only removed one of them.\n                removeEmptyColumns(table, this);\n            }\n        });\n    }\n    /**\n     * Divides a table cell vertically into several ones.\n     *\n     * The cell will be visually split into more cells by updating colspans of other cells in a column\n     * and inserting cells (columns) after that cell.\n     *\n     * In the table below, if cell \"a\" is split into 3 cells:\n     *\n     *  +---+---+---+\n     *  | a | b | c |\n     *  +---+---+---+\n     *  | d | e | f |\n     *  +---+---+---+\n     *\n     * it will result in the table below:\n     *\n     *  +---+---+---+---+---+\n     *  | a |   |   | b | c |\n     *  +---+---+---+---+---+\n     *  | d         | e | f |\n     *  +---+---+---+---+---+\n     *\n     * So cell \"d\" will get its `colspan` updated to `3` and 2 cells will be added (2 columns will be created).\n     *\n     * Splitting a cell that already has a `colspan` attribute set will distribute the cell `colspan` evenly and the remainder\n     * will be left to the original cell:\n     *\n     *  +---+---+---+\n     *  | a         |\n     *  +---+---+---+\n     *  | b | c | d |\n     *  +---+---+---+\n     *\n     * Splitting cell \"a\" with `colspan=3` into 2 cells will create 1 cell with a `colspan=a` and cell \"a\" that will have `colspan=2`:\n     *\n     *  +---+---+---+\n     *  | a     |   |\n     *  +---+---+---+\n     *  | b | c | d |\n     *  +---+---+---+\n     */\n    splitCellVertically(tableCell, numberOfCells = 2) {\n        const model = this.editor.model;\n        const tableRow = tableCell.parent;\n        const table = tableRow.parent;\n        const rowspan = parseInt(tableCell.getAttribute('rowspan') || '1');\n        const colspan = parseInt(tableCell.getAttribute('colspan') || '1');\n        model.change(writer => {\n            // First check - the cell spans over multiple rows so before doing anything else just split this cell.\n            if (colspan > 1) {\n                // Get spans of new (inserted) cells and span to update of split cell.\n                const { newCellsSpan, updatedSpan } = breakSpanEvenly(colspan, numberOfCells);\n                updateNumericAttribute('colspan', updatedSpan, tableCell, writer);\n                // Each inserted cell will have the same attributes:\n                const newCellsAttributes = {};\n                // Do not store default value in the model.\n                if (newCellsSpan > 1) {\n                    newCellsAttributes.colspan = newCellsSpan;\n                }\n                // Copy rowspan of split cell.\n                if (rowspan > 1) {\n                    newCellsAttributes.rowspan = rowspan;\n                }\n                const cellsToInsert = colspan > numberOfCells ? numberOfCells - 1 : colspan - 1;\n                createCells(cellsToInsert, writer, writer.createPositionAfter(tableCell), newCellsAttributes);\n            }\n            // Second check - the cell has colspan of 1 or we need to create more cells then the currently one spans over.\n            if (colspan < numberOfCells) {\n                const cellsToInsert = numberOfCells - colspan;\n                // First step: expand cells on the same column as split cell.\n                const tableMap = [...new TableWalker(table)];\n                // Get the column index of split cell.\n                const { column: splitCellColumn } = tableMap.find(({ cell }) => cell === tableCell);\n                // Find cells which needs to be expanded vertically - those on the same column or those that spans over split cell's column.\n                const cellsToUpdate = tableMap.filter(({ cell, cellWidth, column }) => {\n                    const isOnSameColumn = cell !== tableCell && column === splitCellColumn;\n                    const spansOverColumn = (column < splitCellColumn && column + cellWidth > splitCellColumn);\n                    return isOnSameColumn || spansOverColumn;\n                });\n                // Expand cells vertically.\n                for (const { cell, cellWidth } of cellsToUpdate) {\n                    writer.setAttribute('colspan', cellWidth + cellsToInsert, cell);\n                }\n                // Second step: create columns after split cell.\n                // Each inserted cell will have the same attributes:\n                const newCellsAttributes = {};\n                // Do not store default value in the model.\n                // Copy rowspan of split cell.\n                if (rowspan > 1) {\n                    newCellsAttributes.rowspan = rowspan;\n                }\n                createCells(cellsToInsert, writer, writer.createPositionAfter(tableCell), newCellsAttributes);\n                const headingColumns = table.getAttribute('headingColumns') || 0;\n                // Update heading section if split cell is in heading section.\n                if (headingColumns > splitCellColumn) {\n                    updateNumericAttribute('headingColumns', headingColumns + cellsToInsert, table, writer);\n                }\n            }\n        });\n    }\n    /**\n     * Divides a table cell horizontally into several ones.\n     *\n     * The cell will be visually split into more cells by updating rowspans of other cells in the row and inserting rows with a single cell\n     * below.\n     *\n     * If in the table below cell \"b\" is split into 3 cells:\n     *\n     *  +---+---+---+\n     *  | a | b | c |\n     *  +---+---+---+\n     *  | d | e | f |\n     *  +---+---+---+\n     *\n     * It will result in the table below:\n     *\n     *  +---+---+---+\n     *  | a | b | c |\n     *  +   +---+   +\n     *  |   |   |   |\n     *  +   +---+   +\n     *  |   |   |   |\n     *  +---+---+---+\n     *  | d | e | f |\n     *  +---+---+---+\n     *\n     * So cells \"a\" and \"b\" will get their `rowspan` updated to `3` and 2 rows with a single cell will be added.\n     *\n     * Splitting a cell that already has a `rowspan` attribute set will distribute the cell `rowspan` evenly and the remainder\n     * will be left to the original cell:\n     *\n     *  +---+---+---+\n     *  | a | b | c |\n     *  +   +---+---+\n     *  |   | d | e |\n     *  +   +---+---+\n     *  |   | f | g |\n     *  +   +---+---+\n     *  |   | h | i |\n     *  +---+---+---+\n     *\n     * Splitting cell \"a\" with `rowspan=4` into 3 cells will create 2 cells with a `rowspan=1` and cell \"a\" will have `rowspan=2`:\n     *\n     *  +---+---+---+\n     *  | a | b | c |\n     *  +   +---+---+\n     *  |   | d | e |\n     *  +---+---+---+\n     *  |   | f | g |\n     *  +---+---+---+\n     *  |   | h | i |\n     *  +---+---+---+\n     */\n    splitCellHorizontally(tableCell, numberOfCells = 2) {\n        const model = this.editor.model;\n        const tableRow = tableCell.parent;\n        const table = tableRow.parent;\n        const splitCellRow = table.getChildIndex(tableRow);\n        const rowspan = parseInt(tableCell.getAttribute('rowspan') || '1');\n        const colspan = parseInt(tableCell.getAttribute('colspan') || '1');\n        model.change(writer => {\n            // First check - the cell spans over multiple rows so before doing anything else just split this cell.\n            if (rowspan > 1) {\n                // Cache table map before updating table.\n                const tableMap = [...new TableWalker(table, {\n                        startRow: splitCellRow,\n                        endRow: splitCellRow + rowspan - 1,\n                        includeAllSlots: true\n                    })];\n                // Get spans of new (inserted) cells and span to update of split cell.\n                const { newCellsSpan, updatedSpan } = breakSpanEvenly(rowspan, numberOfCells);\n                updateNumericAttribute('rowspan', updatedSpan, tableCell, writer);\n                const { column: cellColumn } = tableMap.find(({ cell }) => cell === tableCell);\n                // Each inserted cell will have the same attributes:\n                const newCellsAttributes = {};\n                // Do not store default value in the model.\n                if (newCellsSpan > 1) {\n                    newCellsAttributes.rowspan = newCellsSpan;\n                }\n                // Copy colspan of split cell.\n                if (colspan > 1) {\n                    newCellsAttributes.colspan = colspan;\n                }\n                // Accumulator that stores distance from the last inserted cell span.\n                // It helps with evenly splitting larger cell spans (for example 10 cells collapsing into 3 cells).\n                // We split these cells into 3, 3, 4 cells and we have to call `createCells` only when distance between\n                // these cells is equal or greater than the new cells span size.\n                let distanceFromLastCellSpan = 0;\n                for (const tableSlot of tableMap) {\n                    const { column, row } = tableSlot;\n                    // As both newly created cells and the split cell might have rowspan,\n                    // the insertion of new cells must go to appropriate rows:\n                    //\n                    // 1. It's a row after split cell + it's height.\n                    const isAfterSplitCell = row >= splitCellRow + updatedSpan;\n                    // 2. Is on the same column.\n                    const isOnSameColumn = column === cellColumn;\n                    // Reset distance from the last cell span if we are on the same column and we exceeded the new cells span size.\n                    if (distanceFromLastCellSpan >= newCellsSpan && isOnSameColumn) {\n                        distanceFromLastCellSpan = 0;\n                    }\n                    if (isAfterSplitCell && isOnSameColumn) {\n                        // Create new cells only if the distance from the last cell span is equal or greater than the new cells span.\n                        if (!distanceFromLastCellSpan) {\n                            createCells(1, writer, tableSlot.getPositionBefore(), newCellsAttributes);\n                        }\n                        // Increase the distance from the last cell span.\n                        distanceFromLastCellSpan++;\n                    }\n                }\n            }\n            // Second check - the cell has rowspan of 1 or we need to create more cells than the current cell spans over.\n            if (rowspan < numberOfCells) {\n                // We already split the cell in check one so here we split to the remaining number of cells only.\n                const cellsToInsert = numberOfCells - rowspan;\n                // This check is needed since we need to check if there are any cells from previous rows than spans over this cell's row.\n                const tableMap = [...new TableWalker(table, { startRow: 0, endRow: splitCellRow })];\n                // First step: expand cells.\n                for (const { cell, cellHeight, row } of tableMap) {\n                    // Expand rowspan of cells that are either:\n                    // - on the same row as current cell,\n                    // - or are below split cell row and overlaps that row.\n                    if (cell !== tableCell && row + cellHeight > splitCellRow) {\n                        const rowspanToSet = cellHeight + cellsToInsert;\n                        writer.setAttribute('rowspan', rowspanToSet, cell);\n                    }\n                }\n                // Second step: create rows with single cell below split cell.\n                const newCellsAttributes = {};\n                // Copy colspan of split cell.\n                if (colspan > 1) {\n                    newCellsAttributes.colspan = colspan;\n                }\n                createEmptyRows(writer, table, splitCellRow + 1, cellsToInsert, 1, newCellsAttributes);\n                // Update heading section if split cell is in heading section.\n                const headingRows = table.getAttribute('headingRows') || 0;\n                if (headingRows > splitCellRow) {\n                    updateNumericAttribute('headingRows', headingRows + cellsToInsert, table, writer);\n                }\n            }\n        });\n    }\n    /**\n     * Returns the number of columns for a given table.\n     *\n     * ```ts\n     * editor.plugins.get( 'TableUtils' ).getColumns( table );\n     * ```\n     *\n     * @param table The table to analyze.\n     */\n    getColumns(table) {\n        // Analyze first row only as all the rows should have the same width.\n        // Using the first row without checking if it's a tableRow because we expect\n        // that table will have only tableRow model elements at the beginning.\n        const row = table.getChild(0);\n        return [...row.getChildren()]\n            // $marker elements can also be children of a row too (when TrackChanges is on). Don't include them in the count.\n            .filter(node => node.is('element', 'tableCell'))\n            .reduce((columns, row) => {\n            const columnWidth = parseInt(row.getAttribute('colspan') || '1');\n            return columns + columnWidth;\n        }, 0);\n    }\n    /**\n     * Returns the number of rows for a given table. Any other element present in the table model is omitted.\n     *\n     * ```ts\n     * editor.plugins.get( 'TableUtils' ).getRows( table );\n     * ```\n     *\n     * @param table The table to analyze.\n     */\n    getRows(table) {\n        // Rowspan not included due to #6427.\n        return Array.from(table.getChildren())\n            .reduce((rowCount, child) => child.is('element', 'tableRow') ? rowCount + 1 : rowCount, 0);\n    }\n    /**\n     * Creates an instance of the table walker.\n     *\n     * The table walker iterates internally by traversing the table from row index = 0 and column index = 0.\n     * It walks row by row and column by column in order to output values defined in the options.\n     * By default it will output only the locations that are occupied by a cell. To include also spanned rows and columns,\n     * pass the `includeAllSlots` option.\n     *\n     * @internal\n     * @param table A table over which the walker iterates.\n     * @param options An object with configuration.\n     */\n    createTableWalker(table, options = {}) {\n        return new TableWalker(table, options);\n    }\n    /**\n     * Returns all model table cells that are fully selected (from the outside)\n     * within the provided model selection's ranges.\n     *\n     * To obtain the cells selected from the inside, use\n     * {@link #getTableCellsContainingSelection}.\n     */\n    getSelectedTableCells(selection) {\n        const cells = [];\n        for (const range of this.sortRanges(selection.getRanges())) {\n            const element = range.getContainedElement();\n            if (element && element.is('element', 'tableCell')) {\n                cells.push(element);\n            }\n        }\n        return cells;\n    }\n    /**\n     * Returns all model table cells that the provided model selection's ranges\n     * {@link module:engine/model/range~ModelRange#start} inside.\n     *\n     * To obtain the cells selected from the outside, use\n     * {@link #getSelectedTableCells}.\n     */\n    getTableCellsContainingSelection(selection) {\n        const cells = [];\n        for (const range of selection.getRanges()) {\n            const cellWithSelection = range.start.findAncestor('tableCell');\n            if (cellWithSelection) {\n                cells.push(cellWithSelection);\n            }\n        }\n        return cells;\n    }\n    /**\n     * Returns all model table cells that are either completely selected\n     * by selection ranges or host selection range\n     * {@link module:engine/model/range~ModelRange#start start positions} inside them.\n     *\n     * Combines {@link #getTableCellsContainingSelection} and\n     * {@link #getSelectedTableCells}.\n     */\n    getSelectionAffectedTableCells(selection) {\n        const selectedCells = this.getSelectedTableCells(selection);\n        if (selectedCells.length) {\n            return selectedCells;\n        }\n        return this.getTableCellsContainingSelection(selection);\n    }\n    /**\n     * Returns an object with the `first` and `last` row index contained in the given `tableCells`.\n     *\n     * ```ts\n     * const selectedTableCells = getSelectedTableCells( editor.model.document.selection );\n     *\n     * const { first, last } = getRowIndexes( selectedTableCells );\n     *\n     * console.log( `Selected rows: ${ first } to ${ last }` );\n     * ```\n     *\n     * @returns Returns an object with the `first` and `last` table row indexes.\n     */\n    getRowIndexes(tableCells) {\n        const indexes = tableCells.map(cell => cell.parent.index);\n        return this._getFirstLastIndexesObject(indexes);\n    }\n    /**\n     * Returns an object with the `first` and `last` column index contained in the given `tableCells`.\n     *\n     * ```ts\n     * const selectedTableCells = getSelectedTableCells( editor.model.document.selection );\n     *\n     * const { first, last } = getColumnIndexes( selectedTableCells );\n     *\n     * console.log( `Selected columns: ${ first } to ${ last }` );\n     * ```\n     *\n     * @returns Returns an object with the `first` and `last` table column indexes.\n     */\n    getColumnIndexes(tableCells) {\n        const table = tableCells[0].findAncestor('table');\n        const tableMap = [...new TableWalker(table)];\n        const indexes = tableMap\n            .filter(entry => tableCells.includes(entry.cell))\n            .map(entry => entry.column);\n        return this._getFirstLastIndexesObject(indexes);\n    }\n    /**\n     * Checks if the selection contains cells that do not exceed rectangular selection.\n     *\n     * In a table below:\n     *\n     *  ┌───┬───┬───┬───┐\n     *  │ a │ b │ c │ d │\n     *  ├───┴───┼───┤   │\n     *  │ e     │ f │   │\n     *  │       ├───┼───┤\n     *  │       │ g │ h │\n     *  └───────┴───┴───┘\n     *\n     * Valid selections are these which create a solid rectangle (without gaps), such as:\n     *   - a, b (two horizontal cells)\n     *   - c, f (two vertical cells)\n     *   - a, b, e (cell \"e\" spans over four cells)\n     *   - c, d, f (cell d spans over a cell in the row below)\n     *\n     * While an invalid selection would be:\n     *   - a, c (the unselected cell \"b\" creates a gap)\n     *   - f, g, h (cell \"d\" spans over a cell from the row of \"f\" cell - thus creates a gap)\n     */\n    isSelectionRectangular(selectedTableCells) {\n        if (selectedTableCells.length < 2 || !this._areCellInTheSameTableSection(selectedTableCells)) {\n            return false;\n        }\n        // A valid selection is a fully occupied rectangle composed of table cells.\n        // Below we will calculate the area of a selected table cells and the area of valid selection.\n        // The area of a valid selection is defined by top-left and bottom-right cells.\n        const rows = new Set();\n        const columns = new Set();\n        let areaOfSelectedCells = 0;\n        for (const tableCell of selectedTableCells) {\n            const { row, column } = this.getCellLocation(tableCell);\n            const rowspan = parseInt(tableCell.getAttribute('rowspan')) || 1;\n            const colspan = parseInt(tableCell.getAttribute('colspan')) || 1;\n            // Record row & column indexes of current cell.\n            rows.add(row);\n            columns.add(column);\n            // For cells that spans over multiple rows add also the last row that this cell spans over.\n            if (rowspan > 1) {\n                rows.add(row + rowspan - 1);\n            }\n            // For cells that spans over multiple columns add also the last column that this cell spans over.\n            if (colspan > 1) {\n                columns.add(column + colspan - 1);\n            }\n            areaOfSelectedCells += (rowspan * colspan);\n        }\n        // We can only merge table cells that are in adjacent rows...\n        const areaOfValidSelection = getBiggestRectangleArea(rows, columns);\n        return areaOfValidSelection == areaOfSelectedCells;\n    }\n    /**\n     * Returns array of sorted ranges.\n     */\n    sortRanges(ranges) {\n        return Array.from(ranges).sort(compareRangeOrder);\n    }\n    /**\n     * Helper method to get an object with `first` and `last` indexes from an unsorted array of indexes.\n     */\n    _getFirstLastIndexesObject(indexes) {\n        const allIndexesSorted = indexes.sort((indexA, indexB) => indexA - indexB);\n        const first = allIndexesSorted[0];\n        const last = allIndexesSorted[allIndexesSorted.length - 1];\n        return { first, last };\n    }\n    /**\n     * Checks if the selection does not mix a header (column or row) with other cells.\n     *\n     * For instance, in the table below valid selections consist of cells with the same letter only.\n     * So, a-a (same heading row and column) or d-d (body cells) are valid while c-d or a-b are not.\n     *\n     * header columns\n     *    ↓   ↓\n     *  ┌───┬───┬───┬───┐\n     *  │ a │ a │ b │ b │  ← header row\n     *  ├───┼───┼───┼───┤\n     *  │ c │ c │ d │ d │\n     *  ├───┼───┼───┼───┤\n     *  │ c │ c │ d │ d │\n     *  └───┴───┴───┴───┘\n     */\n    _areCellInTheSameTableSection(tableCells) {\n        const table = tableCells[0].findAncestor('table');\n        const rowIndexes = this.getRowIndexes(tableCells);\n        const headingRows = parseInt(table.getAttribute('headingRows')) || 0;\n        // Calculating row indexes is a bit cheaper so if this check fails we can't merge.\n        if (!this._areIndexesInSameSection(rowIndexes, headingRows)) {\n            return false;\n        }\n        const columnIndexes = this.getColumnIndexes(tableCells);\n        const headingColumns = parseInt(table.getAttribute('headingColumns')) || 0;\n        // Similarly cells must be in same column section.\n        return this._areIndexesInSameSection(columnIndexes, headingColumns);\n    }\n    /**\n     * Unified check if table rows/columns indexes are in the same heading/body section.\n     */\n    _areIndexesInSameSection({ first, last }, headingSectionSize) {\n        const firstCellIsInHeading = first < headingSectionSize;\n        const lastCellIsInHeading = last < headingSectionSize;\n        return firstCellIsInHeading === lastCellIsInHeading;\n    }\n}\n/**\n * Creates empty rows at the given index in an existing table.\n *\n * @param insertAt The row index of row insertion.\n * @param rows The number of rows to create.\n * @param tableCellToInsert The number of cells to insert in each row.\n */\nfunction createEmptyRows(writer, table, insertAt, rows, tableCellToInsert, attributes = {}) {\n    for (let i = 0; i < rows; i++) {\n        const tableRow = writer.createElement('tableRow');\n        writer.insert(tableRow, table, insertAt);\n        createCells(tableCellToInsert, writer, writer.createPositionAt(tableRow, 'end'), attributes);\n    }\n}\n/**\n * Creates cells at a given position.\n *\n * @param cells The number of cells to create\n */\nfunction createCells(cells, writer, insertPosition, attributes = {}) {\n    for (let i = 0; i < cells; i++) {\n        createEmptyTableCell(writer, insertPosition, attributes);\n    }\n}\n/**\n * Evenly distributes the span of a cell to a number of provided cells.\n * The resulting spans will always be integer values.\n *\n * For instance breaking a span of 7 into 3 cells will return:\n *\n * ```ts\n * { newCellsSpan: 2, updatedSpan: 3 }\n * ```\n *\n * as two cells will have a span of 2 and the remainder will go the first cell so its span will change to 3.\n *\n * @param span The span value do break.\n * @param numberOfCells The number of resulting spans.\n */\nfunction breakSpanEvenly(span, numberOfCells) {\n    if (span < numberOfCells) {\n        return { newCellsSpan: 1, updatedSpan: 1 };\n    }\n    const newCellsSpan = Math.floor(span / numberOfCells);\n    const updatedSpan = (span - newCellsSpan * numberOfCells) + newCellsSpan;\n    return { newCellsSpan, updatedSpan };\n}\n/**\n * Updates heading columns attribute if removing a row from head section.\n */\nfunction adjustHeadingColumns(table, removedColumnIndexes, writer) {\n    const headingColumns = table.getAttribute('headingColumns') || 0;\n    if (headingColumns && removedColumnIndexes.first < headingColumns) {\n        const headingsRemoved = Math.min(headingColumns - 1 /* Other numbers are 0-based */, removedColumnIndexes.last) -\n            removedColumnIndexes.first + 1;\n        writer.setAttribute('headingColumns', headingColumns - headingsRemoved, table);\n    }\n}\n/**\n * Calculates a new heading rows value for removing rows from heading section.\n */\nfunction updateHeadingRows(table, { first, last }, writer) {\n    const headingRows = table.getAttribute('headingRows') || 0;\n    if (first < headingRows) {\n        const newRows = last < headingRows ? headingRows - (last - first + 1) : first;\n        updateNumericAttribute('headingRows', newRows, table, writer, 0);\n    }\n}\n/**\n * Finds cells that will be:\n * - trimmed - Cells that are \"above\" removed rows sections and overlap the removed section - their rowspan must be trimmed.\n * - moved - Cells from removed rows section might stick out of. These cells are moved to the next row after a removed section.\n *\n * Sample table with overlapping & sticking out cells:\n *\n *      +----+----+----+----+----+\n *      | 00 | 01 | 02 | 03 | 04 |\n *      +----+    +    +    +    +\n *      | 10 |    |    |    |    |\n *      +----+----+    +    +    +\n *      | 20 | 21 |    |    |    | <-- removed row\n *      +    +    +----+    +    +\n *      |    |    | 32 |    |    | <-- removed row\n *      +----+    +    +----+    +\n *      | 40 |    |    | 43 |    |\n *      +----+----+----+----+----+\n *\n * In a table above:\n * - cells to trim: '02', '03' & '04'.\n * - cells to move: '21' & '32'.\n */\nfunction getCellsToMoveAndTrimOnRemoveRow(table, { first, last }) {\n    const cellsToMove = new Map();\n    const cellsToTrim = [];\n    for (const { row, column, cellHeight, cell } of new TableWalker(table, { endRow: last })) {\n        const lastRowOfCell = row + cellHeight - 1;\n        const isCellStickingOutFromRemovedRows = row >= first && row <= last && lastRowOfCell > last;\n        if (isCellStickingOutFromRemovedRows) {\n            const rowspanInRemovedSection = last - row + 1;\n            const rowSpanToSet = cellHeight - rowspanInRemovedSection;\n            cellsToMove.set(column, {\n                cell,\n                rowspan: rowSpanToSet\n            });\n        }\n        const isCellOverlappingRemovedRows = row < first && lastRowOfCell >= first;\n        if (isCellOverlappingRemovedRows) {\n            let rowspanAdjustment;\n            // Cell fully covers removed section - trim it by removed rows count.\n            if (lastRowOfCell >= last) {\n                rowspanAdjustment = last - first + 1;\n            }\n            // Cell partially overlaps removed section - calculate cell's span that is in removed section.\n            else {\n                rowspanAdjustment = lastRowOfCell - first + 1;\n            }\n            cellsToTrim.push({\n                cell,\n                rowspan: cellHeight - rowspanAdjustment\n            });\n        }\n    }\n    return { cellsToMove, cellsToTrim };\n}\nfunction moveCellsToRow(table, targetRowIndex, cellsToMove, writer) {\n    const tableWalker = new TableWalker(table, {\n        includeAllSlots: true,\n        row: targetRowIndex\n    });\n    const tableRowMap = [...tableWalker];\n    const row = table.getChild(targetRowIndex);\n    let previousCell;\n    for (const { column, cell, isAnchor } of tableRowMap) {\n        if (cellsToMove.has(column)) {\n            const { cell: cellToMove, rowspan } = cellsToMove.get(column);\n            const targetPosition = previousCell ?\n                writer.createPositionAfter(previousCell) :\n                writer.createPositionAt(row, 0);\n            writer.move(writer.createRangeOn(cellToMove), targetPosition);\n            updateNumericAttribute('rowspan', rowspan, cellToMove, writer);\n            previousCell = cellToMove;\n        }\n        else if (isAnchor) {\n            // If cell is spanned then `cell` holds reference to overlapping cell. See ckeditor/ckeditor5#6502.\n            previousCell = cell;\n        }\n    }\n}\nfunction compareRangeOrder(rangeA, rangeB) {\n    // Since table cell ranges are disjoint, it's enough to check their start positions.\n    const posA = rangeA.start;\n    const posB = rangeB.start;\n    // Checking for equal position (returning 0) is not needed because this would be either:\n    // a. Intersecting range (not allowed by model)\n    // b. Collapsed range on the same position (allowed by model but should not happen).\n    return posA.isBefore(posB) ? -1 : 1;\n}\n/**\n * Calculates the area of a maximum rectangle that can span over the provided row & column indexes.\n */\nfunction getBiggestRectangleArea(rows, columns) {\n    const rowsIndexes = Array.from(rows.values());\n    const columnIndexes = Array.from(columns.values());\n    const lastRow = Math.max(...rowsIndexes);\n    const firstRow = Math.min(...rowsIndexes);\n    const lastColumn = Math.max(...columnIndexes);\n    const firstColumn = Math.min(...columnIndexes);\n    return (lastRow - firstRow + 1) * (lastColumn - firstColumn + 1);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { TableUtils } from '../tableutils.js';\nimport { updateNumericAttribute } from '../utils/common.js';\nimport { removeEmptyRowsColumns } from '../utils/structure.js';\n/**\n * The merge cells command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'mergeTableCells'` editor command.\n *\n * For example, to merge selected table cells:\n *\n * ```ts\n * editor.execute( 'mergeTableCells' );\n * ```\n */\nexport class MergeCellsCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const selectedTableCells = tableUtils.getSelectedTableCells(this.editor.model.document.selection);\n        this.isEnabled = tableUtils.isSelectionRectangular(selectedTableCells);\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     */\n    execute() {\n        const model = this.editor.model;\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        model.change(writer => {\n            const selectedTableCells = tableUtils.getSelectedTableCells(model.document.selection);\n            // All cells will be merged into the first one.\n            const firstTableCell = selectedTableCells.shift();\n            // Update target cell dimensions.\n            const { mergeWidth, mergeHeight } = getMergeDimensions(firstTableCell, selectedTableCells, tableUtils);\n            updateNumericAttribute('colspan', mergeWidth, firstTableCell, writer);\n            updateNumericAttribute('rowspan', mergeHeight, firstTableCell, writer);\n            for (const tableCell of selectedTableCells) {\n                mergeTableCells(tableCell, firstTableCell, writer);\n            }\n            const table = firstTableCell.findAncestor('table');\n            // Remove rows and columns that become empty (have no anchored cells).\n            removeEmptyRowsColumns(table, tableUtils);\n            writer.setSelection(firstTableCell, 'in');\n        });\n    }\n}\n/**\n *  Merges two table cells. It will ensure that after merging cells with empty paragraphs the resulting table cell will only have one\n * paragraph. If one of the merged table cells is empty, the merged table cell will have contents of the non-empty table cell.\n * If both are empty, the merged table cell will have only one empty paragraph.\n */\nfunction mergeTableCells(cellBeingMerged, targetCell, writer) {\n    if (!isEmpty(cellBeingMerged)) {\n        if (isEmpty(targetCell)) {\n            writer.remove(writer.createRangeIn(targetCell));\n        }\n        writer.move(writer.createRangeIn(cellBeingMerged), writer.createPositionAt(targetCell, 'end'));\n    }\n    // Remove merged table cell.\n    writer.remove(cellBeingMerged);\n}\n/**\n * Checks if the passed table cell contains an empty paragraph.\n */\nfunction isEmpty(tableCell) {\n    const firstTableChild = tableCell.getChild(0);\n    return tableCell.childCount == 1 && firstTableChild.is('element', 'paragraph') && firstTableChild.isEmpty;\n}\nfunction getMergeDimensions(firstTableCell, selectedTableCells, tableUtils) {\n    let maxWidthOffset = 0;\n    let maxHeightOffset = 0;\n    for (const tableCell of selectedTableCells) {\n        const { row, column } = tableUtils.getCellLocation(tableCell);\n        maxWidthOffset = getMaxOffset(tableCell, column, maxWidthOffset, 'colspan');\n        maxHeightOffset = getMaxOffset(tableCell, row, maxHeightOffset, 'rowspan');\n    }\n    // Update table cell span attribute and merge set selection on a merged contents.\n    const { row: firstCellRow, column: firstCellColumn } = tableUtils.getCellLocation(firstTableCell);\n    const mergeWidth = maxWidthOffset - firstCellColumn;\n    const mergeHeight = maxHeightOffset - firstCellRow;\n    return { mergeWidth, mergeHeight };\n}\nfunction getMaxOffset(tableCell, start, currentMaxOffset, which) {\n    const dimensionValue = parseInt(tableCell.getAttribute(which) || '1');\n    return Math.max(currentMaxOffset, start + dimensionValue);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/selectrowcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The select row command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'selectTableRow'` editor command.\n *\n * To select the rows containing the selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'selectTableRow' );\n * ```\n */\nexport class SelectRowCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // It does not affect data so should be enabled in read-only mode.\n        this.affectsData = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(this.editor.model.document.selection);\n        this.isEnabled = selectedCells.length > 0;\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const model = this.editor.model;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const referenceCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        const rowIndexes = tableUtils.getRowIndexes(referenceCells);\n        const table = referenceCells[0].findAncestor('table');\n        const rangesToSelect = [];\n        for (let rowIndex = rowIndexes.first; rowIndex <= rowIndexes.last; rowIndex++) {\n            for (const cell of table.getChild(rowIndex).getChildren()) {\n                rangesToSelect.push(model.createRangeOn(cell));\n            }\n        }\n        model.change(writer => {\n            writer.setSelection(rangesToSelect);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/commands/selectcolumncommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { TableWalker } from '../tablewalker.js';\n/**\n * The select column command.\n *\n * The command is registered by {@link module:table/tableediting~TableEditing} as the `'selectTableColumn'` editor command.\n *\n * To select the columns containing the selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'selectTableColumn' );\n * ```\n */\nexport class SelectColumnCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // It does not affect data so should be enabled in read-only mode.\n        this.affectsData = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const selectedCells = tableUtils.getSelectionAffectedTableCells(this.editor.model.document.selection);\n        this.isEnabled = selectedCells.length > 0;\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const model = this.editor.model;\n        const referenceCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        const firstCell = referenceCells[0];\n        const lastCell = referenceCells.pop();\n        const table = firstCell.findAncestor('table');\n        const startLocation = tableUtils.getCellLocation(firstCell);\n        const endLocation = tableUtils.getCellLocation(lastCell);\n        const startColumn = Math.min(startLocation.column, endLocation.column);\n        const endColumn = Math.max(startLocation.column, endLocation.column);\n        const rangesToSelect = [];\n        for (const cellInfo of new TableWalker(table, { startColumn, endColumn })) {\n            rangesToSelect.push(model.createRangeOn(cellInfo.cell));\n        }\n        model.change(writer => {\n            writer.setSelection(rangesToSelect);\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableWalker } from './../tablewalker.js';\nimport { createEmptyTableCell, updateNumericAttribute } from '../utils/common.js';\n/**\n * Injects a table layout post-fixer into the model.\n *\n * The role of the table layout post-fixer is to ensure that the table rows have the correct structure\n * after a {@link module:engine/model/model~Model#change `change()`} block was executed.\n *\n * The correct structure means that:\n *\n * * All table rows have the same size.\n * * None of the table cells extend vertically beyond their section (either header or body).\n * * A table cell has always at least one element as a child.\n *\n * If the table structure is not correct, the post-fixer will automatically correct it in two steps:\n *\n * 1. It will clip table cells that extend beyond their section.\n * 2. It will add empty table cells to the rows that are narrower than the widest table row.\n *\n * ## Clipping overlapping table cells\n *\n * Such situation may occur when pasting a table (or a part of a table) to the editor from external sources.\n *\n * For example, see the following table which has a cell (FOO) with the rowspan attribute (2):\n *\n * ```xml\n * <table headingRows=\"1\">\n *   <tableRow>\n *     <tableCell rowspan=\"2\"><paragraph>FOO</paragraph></tableCell>\n *     <tableCell colspan=\"2\"><paragraph>BAR</paragraph></tableCell>\n *   </tableRow>\n *   <tableRow>\n *     <tableCell><paragraph>BAZ</paragraph></tableCell>\n *     <tableCell><paragraph>XYZ</paragraph></tableCell>\n *   </tableRow>\n * </table>\n * ```\n *\n * It will be rendered in the view as:\n *\n * ```xml\n * <table>\n *   <thead>\n *     <tr>\n *       <td rowspan=\"2\">FOO</td>\n *       <td colspan=\"2\">BAR</td>\n *     </tr>\n *   </thead>\n *   <tbody>\n *     <tr>\n *       <td>BAZ</td>\n *       <td>XYZ</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * In the above example the table will be rendered as a table with two rows: one in the header and second one in the body.\n * The table cell (FOO) cannot span over multiple rows as it would extend from the header to the body section.\n * The `rowspan` attribute must be changed to (1). The value (1) is the default value of the `rowspan` attribute\n * so the `rowspan` attribute will be removed from the model.\n *\n * The table cell with BAZ in the content will be in the first column of the table.\n *\n * ## Adding missing table cells\n *\n * The table post-fixer will insert empty table cells to equalize table row sizes (the number of columns).\n * The size of a table row is calculated by counting column spans of table cells, both horizontal (from the same row) and\n * vertical (from the rows above).\n *\n * In the above example, the table row in the body section of the table is narrower then the row from the header: it has two cells\n * with the default colspan (1). The header row has one cell with colspan (1) and the second with colspan (2).\n * The table cell (FOO) does not extend beyond the head section (and as such will be fixed in the first step of this post-fixer).\n * The post-fixer will add a missing table cell to the row in the body section of the table.\n *\n * The table from the above example will be fixed and rendered to the view as below:\n *\n * ```xml\n * <table>\n *   <thead>\n *     <tr>\n *       <td rowspan=\"2\">FOO</td>\n *       <td colspan=\"2\">BAR</td>\n *     </tr>\n *   </thead>\n *   <tbody>\n *     <tr>\n *       <td>BAZ</td>\n *       <td>XYZ</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * ## Collaboration and undo - Expectations vs post-fixer results\n *\n * The table post-fixer only ensures proper structure without a deeper analysis of the nature of the change. As such, it might lead\n * to a structure which was not intended by the user. In particular, it will also fix undo steps (in conjunction with collaboration)\n * in which the editor content might not return to the original state.\n *\n * This will usually happen when one or more users change the size of the table.\n *\n * As an example see the table below:\n *\n * ```xml\n * <table>\n *   <tbody>\n *     <tr>\n *       <td>11</td>\n *       <td>12</td>\n *     </tr>\n *     <tr>\n *       <td>21</td>\n *       <td>22</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * and the user actions:\n *\n * 1. Both users have a table with two rows and two columns.\n * 2. User A adds a column at the end of the table. This will insert empty table cells to two rows.\n * 3. User B adds a row at the end of the table. This will insert a row with two empty table cells.\n * 4. Both users will have a table as below:\n *\n * ```xml\n * <table>\n *   <tbody>\n *     <tr>\n *       <td>11</td>\n *       <td>12</td>\n *       <td>(empty, inserted by A)</td>\n *     </tr>\n *     <tr>\n *       <td>21</td>\n *       <td>22</td>\n *       <td>(empty, inserted by A)</td>\n *     </tr>\n *     <tr>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by B)</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * The last row is shorter then others so the table post-fixer will add an empty row to the last row:\n *\n * ```xml\n * <table>\n *   <tbody>\n *     <tr>\n *       <td>11</td>\n *       <td>12</td>\n *       <td>(empty, inserted by A)</td>\n *     </tr>\n *     <tr>\n *       <td>21</td>\n *       <td>22</td>\n *       <td>(empty, inserted by A)</td>\n *     </tr>\n *     <tr>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by the post-fixer)</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * Unfortunately undo does not know the nature of the changes and depending on which user applies the post-fixer changes, undoing them\n * might lead to a broken table. If User B undoes inserting the column to the table, the undo engine will undo only the operations of\n * inserting empty cells to rows from the initial table state (row 1 and 2) but the cell in the post-fixed row will remain:\n *\n * ```xml\n * <table>\n *   <tbody>\n *     <tr>\n *       <td>11</td>\n *       <td>12</td>\n *     </tr>\n *     <tr>\n *       <td>21</td>\n *       <td>22</td>\n *     </tr>\n *     <tr>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by a post-fixer)</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * After undo, the table post-fixer will detect that two rows are shorter than others and will fix the table to:\n *\n * ```xml\n * <table>\n *   <tbody>\n *     <tr>\n *       <td>11</td>\n *       <td>12</td>\n *       <td>(empty, inserted by a post-fixer after undo)</td>\n *     </tr>\n *     <tr>\n *       <td>21</td>\n *       <td>22</td>\n *       <td>(empty, inserted by a post-fixer after undo)</td>\n *     </tr>\n *     <tr>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by B)</td>\n *       <td>(empty, inserted by a post-fixer)</td>\n *     </tr>\n *   </tbody>\n * </table>\n * ```\n *\n * @internal\n */\nexport function injectTableLayoutPostFixer(model) {\n    model.document.registerPostFixer(writer => tableLayoutPostFixer(writer, model));\n}\n/**\n * The table layout post-fixer.\n */\nfunction tableLayoutPostFixer(writer, model) {\n    const changes = model.document.differ.getChanges();\n    let wasFixed = false;\n    // Do not analyze the same table more then once - may happen for multiple changes in the same table.\n    const analyzedTables = new Set();\n    for (const entry of changes) {\n        let table = null;\n        if (entry.type == 'insert' && entry.name == 'table') {\n            table = entry.position.nodeAfter;\n        }\n        // Fix table on adding/removing table cells and rows.\n        if ((entry.type == 'insert' || entry.type == 'remove') && (entry.name == 'tableRow' || entry.name == 'tableCell')) {\n            table = entry.position.findAncestor('table');\n        }\n        // Fix table on any table's attribute change - including attributes of table cells.\n        if (isTableAttributeEntry(entry)) {\n            table = entry.range.start.findAncestor('table');\n        }\n        if (table && !analyzedTables.has(table)) {\n            // Step 1: correct rowspans of table cells if necessary.\n            // The wasFixed flag should be true if any of tables in batch was fixed - might be more then one.\n            wasFixed = fixTableCellsRowspan(table, writer) || wasFixed;\n            // Step 2: fix table rows sizes.\n            wasFixed = fixTableRowsSizes(table, writer) || wasFixed;\n            analyzedTables.add(table);\n        }\n    }\n    return wasFixed;\n}\n/**\n * Fixes the invalid value of the `rowspan` attribute because a table cell cannot vertically extend beyond the table section it belongs to.\n *\n * @returns Returns `true` if the table was fixed.\n */\nfunction fixTableCellsRowspan(table, writer) {\n    let wasFixed = false;\n    const cellsToTrim = findCellsToTrim(table);\n    if (cellsToTrim.length) {\n        // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: trimming cells row-spans (${ cellsToTrim.length }).` );\n        wasFixed = true;\n        for (const data of cellsToTrim) {\n            updateNumericAttribute('rowspan', data.rowspan, data.cell, writer, 1);\n        }\n    }\n    return wasFixed;\n}\n/**\n * Makes all table rows in a table the same size.\n *\n * @returns Returns `true` if the table was fixed.\n */\nfunction fixTableRowsSizes(table, writer) {\n    let wasFixed = false;\n    const childrenLengths = getChildrenLengths(table);\n    const rowsToRemove = [];\n    // Find empty rows.\n    for (const [rowIndex, size] of childrenLengths.entries()) {\n        // Ignore all non-row models.\n        if (!size && table.getChild(rowIndex).is('element', 'tableRow')) {\n            rowsToRemove.push(rowIndex);\n        }\n    }\n    // Remove empty rows.\n    if (rowsToRemove.length) {\n        // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: remove empty rows (${ rowsToRemove.length }).` );\n        wasFixed = true;\n        for (const rowIndex of rowsToRemove.reverse()) {\n            writer.remove(table.getChild(rowIndex));\n            childrenLengths.splice(rowIndex, 1);\n        }\n    }\n    // Filter out everything that's not a table row.\n    const rowsLengths = childrenLengths.filter((row, rowIndex) => table.getChild(rowIndex).is('element', 'tableRow'));\n    // Verify if all the rows have the same number of columns.\n    const tableSize = rowsLengths[0];\n    const isValid = rowsLengths.every(length => length === tableSize);\n    if (!isValid) {\n        // @if CK_DEBUG_TABLE // console.log( 'Post-fixing table: adding missing cells.' );\n        // Find the maximum number of columns.\n        const maxColumns = rowsLengths.reduce((prev, current) => current > prev ? current : prev, 0);\n        for (const [rowIndex, size] of rowsLengths.entries()) {\n            const columnsToInsert = maxColumns - size;\n            if (columnsToInsert) {\n                for (let i = 0; i < columnsToInsert; i++) {\n                    createEmptyTableCell(writer, writer.createPositionAt(table.getChild(rowIndex), 'end'));\n                }\n                wasFixed = true;\n            }\n        }\n    }\n    return wasFixed;\n}\n/**\n * Searches for table cells that extend beyond the table section to which they belong to. It will return an array of objects\n * that stores table cells to be trimmed and the correct value of the `rowspan` attribute to set.\n */\nfunction findCellsToTrim(table) {\n    const headingRows = parseInt(table.getAttribute('headingRows') || '0');\n    const maxRows = Array.from(table.getChildren())\n        .reduce((count, row) => row.is('element', 'tableRow') ? count + 1 : count, 0);\n    const cellsToTrim = [];\n    for (const { row, cell, cellHeight } of new TableWalker(table)) {\n        // Skip cells that do not expand over its row.\n        if (cellHeight < 2) {\n            continue;\n        }\n        const isInHeader = row < headingRows;\n        // Row limit is either end of header section or whole table as table body is after the header.\n        const rowLimit = isInHeader ? headingRows : maxRows;\n        // If table cell expands over its limit reduce it height to proper value.\n        if (row + cellHeight > rowLimit) {\n            const newRowspan = rowLimit - row;\n            cellsToTrim.push({ cell, rowspan: newRowspan });\n        }\n    }\n    return cellsToTrim;\n}\n/**\n * Returns an array with lengths of rows assigned to the corresponding row index.\n */\nfunction getChildrenLengths(table) {\n    // TableWalker will not provide items for the empty rows, we need to pre-fill this array.\n    const lengths = new Array(table.childCount).fill(0);\n    for (const { rowIndex } of new TableWalker(table, { includeAllSlots: true })) {\n        lengths[rowIndex]++;\n    }\n    return lengths;\n}\n/**\n * Checks if the differ entry for an attribute change is one of the table's attributes.\n */\nfunction isTableAttributeEntry(entry) {\n    if (entry.type !== 'attribute') {\n        return false;\n    }\n    const key = entry.attributeKey;\n    return key === 'headingRows' || key === 'colspan' || key === 'rowspan';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Injects a table cell post-fixer into the model which inserts a `paragraph` element into empty table cells.\n *\n * A table cell must contain at least one block element as a child. An empty table cell will have an empty `paragraph` as a child.\n *\n * ```xml\n * <table>\n *   <tableRow>\n *      <tableCell></tableCell>\n *   </tableRow>\n * </table>\n * ```\n *\n * Will be fixed to:\n *\n * ```xml\n * <table>\n *   <tableRow>\n *      <tableCell><paragraph></paragraph></tableCell>\n *   </tableRow>\n * </table>\n * ```\n *\n * @internal\n */\nexport function injectTableCellParagraphPostFixer(model) {\n    model.document.registerPostFixer(writer => tableCellContentsPostFixer(writer, model));\n}\n/**\n * The table cell contents post-fixer.\n */\nfunction tableCellContentsPostFixer(writer, model) {\n    const changes = model.document.differ.getChanges();\n    let wasFixed = false;\n    for (const entry of changes) {\n        if (entry.type == 'insert' && entry.name == 'table') {\n            wasFixed = fixTable(entry.position.nodeAfter, writer) || wasFixed;\n        }\n        if (entry.type == 'insert' && entry.name == 'tableRow') {\n            wasFixed = fixTableRow(entry.position.nodeAfter, writer) || wasFixed;\n        }\n        if (entry.type == 'insert' && entry.name == 'tableCell') {\n            wasFixed = fixTableCellContent(entry.position.nodeAfter, writer) || wasFixed;\n        }\n        if ((entry.type == 'remove' || entry.type == 'insert') && checkTableCellChange(entry)) {\n            wasFixed = fixTableCellContent(entry.position.parent, writer) || wasFixed;\n        }\n    }\n    return wasFixed;\n}\n/**\n * Fixes all table cells in a table.\n */\nfunction fixTable(table, writer) {\n    let wasFixed = false;\n    for (const row of table.getChildren()) {\n        if (row.is('element', 'tableRow')) {\n            wasFixed = fixTableRow(row, writer) || wasFixed;\n        }\n    }\n    return wasFixed;\n}\n/**\n * Fixes all table cells in a table row.\n */\nfunction fixTableRow(tableRow, writer) {\n    let wasFixed = false;\n    for (const tableCell of tableRow.getChildren()) {\n        wasFixed = fixTableCellContent(tableCell, writer) || wasFixed;\n    }\n    return wasFixed;\n}\n/**\n * Fixes all table cell content by:\n * - Adding a paragraph to a table cell without any child.\n * - Wrapping direct $text in a `<paragraph>`.\n */\nfunction fixTableCellContent(tableCell, writer) {\n    // Insert paragraph to an empty table cell.\n    if (tableCell.childCount == 0) {\n        // @if CK_DEBUG_TABLE // console.log( 'Post-fixing table: insert paragraph in empty cell.' );\n        writer.insertElement('paragraph', tableCell);\n        return true;\n    }\n    // Check table cell children for directly placed text nodes.\n    // Temporary solution. See https://github.com/ckeditor/ckeditor5/issues/1464.\n    const textNodes = Array.from(tableCell.getChildren()).filter(child => child.is('$text'));\n    // @if CK_DEBUG_TABLE // textNodes.length && console.log( 'Post-fixing table: wrap cell content with paragraph.' );\n    for (const child of textNodes) {\n        writer.wrap(writer.createRangeOn(child), 'paragraph');\n    }\n    // Return true when there were text nodes to fix.\n    return !!textNodes.length;\n}\n/**\n * Checks if a differ change should fix the table cell. This happens on:\n * - Removing content from the table cell (i.e. `tableCell` can be left empty).\n * - Adding a text node directly into a table cell.\n */\nfunction checkTableCellChange(entry) {\n    if (!entry.position.parent.is('element', 'tableCell')) {\n        return false;\n    }\n    return entry.type == 'insert' && entry.name == '$text' || entry.type == 'remove';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { isSingleParagraphWithoutAttributes } from './downcast.js';\n/**\n * A table cell refresh handler which marks the table cell in the differ to have it re-rendered.\n *\n * Model `paragraph` inside a table cell can be rendered as `<span>` or `<p>`. It is rendered as `<span>` if this is the only block\n * element in that table cell and it does not have any attributes. It is rendered as `<p>` otherwise.\n *\n * When table cell content changes, for example a second `paragraph` element is added, we need to ensure that the first `paragraph` is\n * re-rendered so it changes from `<span>` to `<p>`. The easiest way to do it is to re-render the entire table cell.\n *\n * @internal\n */\nexport function tableCellRefreshHandler(model, editing) {\n    const differ = model.document.differ;\n    // Stores cells to be refreshed, so the table cell will be refreshed once for multiple changes.\n    const cellsToCheck = new Set();\n    for (const change of differ.getChanges()) {\n        const parent = change.type == 'attribute' ? change.range.start.parent : change.position.parent;\n        if (parent.is('element', 'tableCell')) {\n            cellsToCheck.add(parent);\n        }\n    }\n    for (const tableCell of cellsToCheck.values()) {\n        const paragraphsToRefresh = Array.from(tableCell.getChildren())\n            .filter(child => shouldRefresh(child, editing.mapper));\n        for (const paragraph of paragraphsToRefresh) {\n            editing.reconvertItem(paragraph);\n        }\n    }\n}\n/**\n * Check if given model element needs refreshing.\n */\nfunction shouldRefresh(child, mapper) {\n    if (!child.is('element', 'paragraph')) {\n        return false;\n    }\n    const viewElement = mapper.toViewElement(child);\n    if (!viewElement) {\n        return false;\n    }\n    return isSingleParagraphWithoutAttributes(child) !== viewElement.is('element', 'span');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { upcastTable, ensureParagraphInTableCell, skipEmptyTableRow, upcastTableFigure } from './converters/upcasttable.js';\nimport { convertParagraphInTableCell, downcastCell, downcastRow, downcastTable, downcastTableBorderAndBackgroundAttributes, convertPlainTable, convertPlainTableCaption } from './converters/downcast.js';\nimport { InsertTableCommand } from './commands/inserttablecommand.js';\nimport { InsertRowCommand } from './commands/insertrowcommand.js';\nimport { InsertColumnCommand } from './commands/insertcolumncommand.js';\nimport { SplitCellCommand } from './commands/splitcellcommand.js';\nimport { MergeCellCommand } from './commands/mergecellcommand.js';\nimport { RemoveRowCommand } from './commands/removerowcommand.js';\nimport { RemoveColumnCommand } from './commands/removecolumncommand.js';\nimport { SetHeaderRowCommand } from './commands/setheaderrowcommand.js';\nimport { SetHeaderColumnCommand } from './commands/setheadercolumncommand.js';\nimport { MergeCellsCommand } from './commands/mergecellscommand.js';\nimport { SelectRowCommand } from './commands/selectrowcommand.js';\nimport { SelectColumnCommand } from './commands/selectcolumncommand.js';\nimport { TableUtils } from '../src/tableutils.js';\nimport { injectTableLayoutPostFixer } from './converters/table-layout-post-fixer.js';\nimport { injectTableCellParagraphPostFixer } from './converters/table-cell-paragraph-post-fixer.js';\nimport { tableHeadingsRefreshHandler } from './converters/table-headings-refresh-handler.js';\nimport { tableCellRefreshHandler } from './converters/table-cell-refresh-handler.js';\nimport '../theme/tableediting.css';\n/**\n * The table editing feature.\n */\nexport class TableEditing extends Plugin {\n    /**\n     * Handlers for creating additional slots in the table.\n     */\n    _additionalSlots;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this._additionalSlots = [];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const schema = model.schema;\n        const conversion = editor.conversion;\n        const tableUtils = editor.plugins.get(TableUtils);\n        schema.register('table', {\n            inheritAllFrom: '$blockObject',\n            allowAttributes: ['headingRows', 'headingColumns']\n        });\n        schema.register('tableRow', {\n            allowIn: 'table',\n            isLimit: true\n        });\n        schema.register('tableCell', {\n            allowContentOf: '$container',\n            allowIn: 'tableRow',\n            allowAttributes: ['colspan', 'rowspan'],\n            isLimit: true,\n            isSelectable: true\n        });\n        // Figure conversion.\n        conversion.for('upcast').add(upcastTableFigure());\n        // Table conversion.\n        conversion.for('upcast').add(upcastTable());\n        conversion.for('editingDowncast').elementToStructure({\n            model: {\n                name: 'table',\n                attributes: ['headingRows']\n            },\n            view: downcastTable(tableUtils, {\n                asWidget: true,\n                additionalSlots: this._additionalSlots\n            })\n        });\n        conversion.for('dataDowncast').elementToStructure({\n            model: {\n                name: 'table',\n                attributes: ['headingRows']\n            },\n            view: downcastTable(tableUtils, {\n                additionalSlots: this._additionalSlots\n            })\n        });\n        // Table row conversion.\n        conversion.for('upcast').elementToElement({ model: 'tableRow', view: 'tr' });\n        conversion.for('upcast').add(skipEmptyTableRow());\n        conversion.for('downcast').elementToElement({\n            model: 'tableRow',\n            view: downcastRow()\n        });\n        // Table cell conversion.\n        conversion.for('upcast').elementToElement({ model: 'tableCell', view: 'td' });\n        conversion.for('upcast').elementToElement({ model: 'tableCell', view: 'th' });\n        conversion.for('upcast').add(ensureParagraphInTableCell('td'));\n        conversion.for('upcast').add(ensureParagraphInTableCell('th'));\n        conversion.for('editingDowncast').elementToElement({\n            model: 'tableCell',\n            view: downcastCell({ asWidget: true })\n        });\n        conversion.for('dataDowncast').elementToElement({\n            model: 'tableCell',\n            view: downcastCell()\n        });\n        // Duplicates code - needed to properly refresh paragraph inside a table cell.\n        conversion.for('editingDowncast').elementToElement({\n            model: 'paragraph',\n            view: convertParagraphInTableCell({ asWidget: true }),\n            converterPriority: 'high'\n        });\n        conversion.for('dataDowncast').elementToElement({\n            model: 'paragraph',\n            view: convertParagraphInTableCell(),\n            converterPriority: 'high'\n        });\n        // Table attributes conversion.\n        conversion.for('downcast').attributeToAttribute({ model: 'colspan', view: 'colspan' });\n        conversion.for('upcast').attributeToAttribute({\n            model: { key: 'colspan', value: upcastCellSpan('colspan') },\n            view: 'colspan'\n        });\n        conversion.for('downcast').attributeToAttribute({ model: 'rowspan', view: 'rowspan' });\n        conversion.for('upcast').attributeToAttribute({\n            model: { key: 'rowspan', value: upcastCellSpan('rowspan') },\n            view: 'rowspan'\n        });\n        // Plain table output converters (also used in the clipboard pipeline).\n        this._addPlainTableOutputConverters();\n        // Define the config.\n        editor.config.define('table.defaultHeadings.rows', 0);\n        editor.config.define('table.defaultHeadings.columns', 0);\n        // Define all the commands.\n        editor.commands.add('insertTable', new InsertTableCommand(editor));\n        editor.commands.add('insertTableRowAbove', new InsertRowCommand(editor, { order: 'above' }));\n        editor.commands.add('insertTableRowBelow', new InsertRowCommand(editor, { order: 'below' }));\n        editor.commands.add('insertTableColumnLeft', new InsertColumnCommand(editor, { order: 'left' }));\n        editor.commands.add('insertTableColumnRight', new InsertColumnCommand(editor, { order: 'right' }));\n        editor.commands.add('removeTableRow', new RemoveRowCommand(editor));\n        editor.commands.add('removeTableColumn', new RemoveColumnCommand(editor));\n        editor.commands.add('splitTableCellVertically', new SplitCellCommand(editor, { direction: 'vertically' }));\n        editor.commands.add('splitTableCellHorizontally', new SplitCellCommand(editor, { direction: 'horizontally' }));\n        editor.commands.add('mergeTableCells', new MergeCellsCommand(editor));\n        editor.commands.add('mergeTableCellRight', new MergeCellCommand(editor, { direction: 'right' }));\n        editor.commands.add('mergeTableCellLeft', new MergeCellCommand(editor, { direction: 'left' }));\n        editor.commands.add('mergeTableCellDown', new MergeCellCommand(editor, { direction: 'down' }));\n        editor.commands.add('mergeTableCellUp', new MergeCellCommand(editor, { direction: 'up' }));\n        editor.commands.add('setTableColumnHeader', new SetHeaderColumnCommand(editor));\n        editor.commands.add('setTableRowHeader', new SetHeaderRowCommand(editor));\n        editor.commands.add('selectTableRow', new SelectRowCommand(editor));\n        editor.commands.add('selectTableColumn', new SelectColumnCommand(editor));\n        injectTableLayoutPostFixer(model);\n        injectTableCellParagraphPostFixer(model);\n        this.listenTo(model.document, 'change:data', () => {\n            tableHeadingsRefreshHandler(model, editor.editing);\n            tableCellRefreshHandler(model, editor.editing);\n        });\n    }\n    /**\n     * Registers downcast handler for the additional table slot.\n     */\n    registerAdditionalSlot(slotHandler) {\n        this._additionalSlots.push(slotHandler);\n    }\n    /**\n     * Adds converters for plain table output. These converters are used either when the `PlainTableOutput` plugin is loaded\n     * or when content is processed by the clipboard pipeline, ensuring that pasted tables are not wrapped in a <figure> element.\n     */\n    _addPlainTableOutputConverters() {\n        const editor = this.editor;\n        // Override default table data downcast converter.\n        editor.conversion.for('dataDowncast').elementToStructure({\n            model: 'table',\n            view: convertPlainTable(editor),\n            converterPriority: 'high'\n        });\n        // Make sure table <caption> is downcasted into <caption> in the data pipeline when necessary.\n        if (editor.plugins.has('TableCaption')) {\n            editor.conversion.for('dataDowncast').elementToElement({\n                model: 'caption',\n                view: convertPlainTableCaption(editor),\n                converterPriority: 'high'\n            });\n        }\n        // Handle border-style, border-color, border-width and background-color table attributes.\n        if (editor.plugins.has('TableProperties')) {\n            downcastTableBorderAndBackgroundAttributes(editor);\n        }\n    }\n}\n/**\n * Returns fixed colspan and rowspan attrbutes values.\n *\n * @param type colspan or rowspan.\n * @returns conversion value function.\n */\nfunction upcastCellSpan(type) {\n    return (cell) => {\n        const span = parseInt(cell.getAttribute(type));\n        if (Number.isNaN(span) || span <= 0) {\n            return null;\n        }\n        return span;\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableWalker } from '../tablewalker.js';\n/**\n * A table headings refresh handler which marks the table cells or rows in the differ to have it re-rendered\n * if the headings attribute changed.\n *\n * Table heading rows and heading columns are represented in the model by a `headingRows` and `headingColumns` attributes.\n *\n * When table headings attribute changes, all the cells/rows are marked to re-render to change between `<td>` and `<th>`.\n *\n * @internal\n */\nexport function tableHeadingsRefreshHandler(model, editing) {\n    const differ = model.document.differ;\n    for (const change of differ.getChanges()) {\n        let table;\n        let isRowChange = false;\n        if (change.type == 'attribute') {\n            const element = change.range.start.nodeAfter;\n            if (!element || !element.is('element', 'table')) {\n                continue;\n            }\n            if (change.attributeKey != 'headingRows' && change.attributeKey != 'headingColumns') {\n                continue;\n            }\n            table = element;\n            isRowChange = change.attributeKey == 'headingRows';\n        }\n        else if (change.name == 'tableRow' || change.name == 'tableCell') {\n            table = change.position.findAncestor('table');\n            isRowChange = change.name == 'tableRow';\n        }\n        if (!table) {\n            continue;\n        }\n        const headingRows = table.getAttribute('headingRows') || 0;\n        const headingColumns = table.getAttribute('headingColumns') || 0;\n        const tableWalker = new TableWalker(table);\n        for (const tableSlot of tableWalker) {\n            const isHeading = tableSlot.row < headingRows || tableSlot.column < headingColumns;\n            const expectedElementName = isHeading ? 'th' : 'td';\n            const viewElement = editing.mapper.toViewElement(tableSlot.cell);\n            if (viewElement && viewElement.is('element') && viewElement.name != expectedElementName) {\n                editing.reconvertItem((isRowChange ? tableSlot.cell.parent : tableSlot.cell));\n            }\n        }\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M3 5.5v3h4v-3zm0 4v3h4v-3zm0 4v3h4v-3zm5 3h4v-3H8zm5 0h4v-3h-4zm4-4v-3h-4v3zm0-4v-3h-4v3zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5zm-6.5-4v-3H8v3zm0-4v-3H8v3z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/ui/inserttableview\n */\nimport { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui.js';\nimport { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils.js';\nimport './../../theme/inserttable.css';\n/**\n * The table size view.\n *\n * It renders a 10x10 grid to choose the inserted table size.\n *\n * @internal\n */\nexport class InsertTableView extends View {\n    /**\n     * A collection of table size box items.\n     */\n    items;\n    /**\n     * Listen to `keydown` events fired in this view's main element.\n     */\n    keystrokes;\n    /**\n     * Tracks information about the DOM focus in the grid.\n     */\n    focusTracker;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.items = this._createGridCollection();\n        this.keystrokes = new KeystrokeHandler();\n        this.focusTracker = new FocusTracker();\n        this.set('rows', 0);\n        this.set('columns', 0);\n        this.bind('label').to(this, 'columns', this, 'rows', (columns, rows) => `${rows} × ${columns}`);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck']\n            },\n            children: [\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: ['ck-insert-table-dropdown__grid']\n                    },\n                    on: {\n                        'mouseover@.ck-insert-table-dropdown-grid-box': bind.to('boxover')\n                    },\n                    children: this.items\n                },\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-insert-table-dropdown__label'\n                        ],\n                        'aria-hidden': true\n                    },\n                    children: [\n                        {\n                            text: bind.to('label')\n                        }\n                    ]\n                }\n            ],\n            on: {\n                mousedown: bind.to(evt => {\n                    evt.preventDefault();\n                }),\n                click: bind.to(() => {\n                    this.fire('execute');\n                })\n            }\n        });\n        // #rows and #columns are set via changes to #focusTracker on mouse over.\n        this.on('boxover', (evt, domEvt) => {\n            const { row, column } = domEvt.target.dataset;\n            this.items.get((parseInt(row, 10) - 1) * 10 + (parseInt(column, 10) - 1)).focus();\n        });\n        // This allows the #rows and #columns to be updated when:\n        // * the user navigates the grid using the keyboard,\n        // * the user moves the mouse over grid items.\n        this.focusTracker.on('change:focusedElement', (evt, name, focusedElement) => {\n            if (!focusedElement) {\n                return;\n            }\n            const { row, column } = focusedElement.dataset;\n            // As row & column indexes are zero-based transform it to number of selected rows & columns.\n            this.set({\n                rows: parseInt(row),\n                columns: parseInt(column)\n            });\n        });\n        this.on('change:columns', () => this._highlightGridBoxes());\n        this.on('change:rows', () => this._highlightGridBoxes());\n    }\n    render() {\n        super.render();\n        addKeyboardHandlingForGrid({\n            keystrokeHandler: this.keystrokes,\n            focusTracker: this.focusTracker,\n            gridItems: this.items,\n            numberOfColumns: 10,\n            uiLanguageDirection: this.locale && this.locale.uiLanguageDirection\n        });\n        for (const item of this.items) {\n            this.focusTracker.add(item.element);\n        }\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * Resets the rows and columns selection.\n     */\n    reset() {\n        this.set({\n            rows: 1,\n            columns: 1\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    focus() {\n        this.items.get(0).focus();\n    }\n    /**\n     * @inheritDoc\n     */\n    focusLast() {\n        this.items.get(0).focus();\n    }\n    /**\n     * Highlights grid boxes depending on rows and columns selected.\n     */\n    _highlightGridBoxes() {\n        const rows = this.rows;\n        const columns = this.columns;\n        this.items.map((boxView, index) => {\n            // Translate box index to the row & column index.\n            const itemRow = Math.floor(index / 10);\n            const itemColumn = index % 10;\n            // Grid box is highlighted when its row & column index belongs to selected number of rows & columns.\n            const isOn = itemRow < rows && itemColumn < columns;\n            boxView.set('isOn', isOn);\n        });\n    }\n    /**\n     * Creates a new Button for the grid.\n     *\n     * @param locale The locale instance.\n     * @param row Row number.\n     * @param column Column number.\n     * @param label The grid button label.\n     */\n    _createGridButton(locale, row, column, label) {\n        const button = new ButtonView(locale);\n        button.set({\n            label,\n            class: 'ck-insert-table-dropdown-grid-box'\n        });\n        button.extendTemplate({\n            attributes: {\n                'data-row': row,\n                'data-column': column\n            }\n        });\n        return button;\n    }\n    /**\n     * @returns A view collection containing boxes to be placed in a table grid.\n     */\n    _createGridCollection() {\n        const boxes = [];\n        // Add grid boxes to table selection view.\n        for (let index = 0; index < 100; index++) {\n            const row = Math.floor(index / 10);\n            const column = index % 10;\n            const label = `${row + 1} × ${column + 1}`;\n            boxes.push(this._createGridButton(this.locale, row + 1, column + 1, label));\n        }\n        return this.createCollection(boxes);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconTable, IconTableColumn, IconTableRow, IconTableMergeCell } from 'ckeditor5/src/icons.js';\nimport { addListToDropdown, createDropdown, UIModel, SplitButtonView, SwitchButtonView, MenuBarMenuView } from 'ckeditor5/src/ui.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { InsertTableView } from './ui/inserttableview.js';\n/**\n * The table UI plugin. It introduces:\n *\n * * The `'insertTable'` dropdown,\n * * The `'menuBar:insertTable'` menu bar menu,\n * * The `'tableColumn'` dropdown,\n * * The `'tableRow'` dropdown,\n * * The `'mergeTableCells'` split button.\n *\n * The `'tableColumn'`, `'tableRow'` and `'mergeTableCells'` dropdowns work best with {@link module:table/tabletoolbar~TableToolbar}.\n */\nexport class TableUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = this.editor.t;\n        const contentLanguageDirection = editor.locale.contentLanguageDirection;\n        const isContentLtr = contentLanguageDirection === 'ltr';\n        editor.ui.componentFactory.add('insertTable', locale => {\n            const command = editor.commands.get('insertTable');\n            const dropdownView = createDropdown(locale);\n            dropdownView.bind('isEnabled').to(command);\n            // Decorate dropdown's button.\n            dropdownView.buttonView.set({\n                icon: IconTable,\n                label: t('Insert table'),\n                tooltip: true\n            });\n            let insertTableView;\n            dropdownView.on('change:isOpen', () => {\n                if (insertTableView) {\n                    return;\n                }\n                // Prepare custom view for dropdown's panel.\n                insertTableView = new InsertTableView(locale);\n                dropdownView.panelView.children.add(insertTableView);\n                insertTableView.delegate('execute').to(dropdownView);\n                dropdownView.on('execute', () => {\n                    editor.execute('insertTable', { rows: insertTableView.rows, columns: insertTableView.columns });\n                    editor.editing.view.focus();\n                });\n            });\n            return dropdownView;\n        });\n        editor.ui.componentFactory.add('menuBar:insertTable', locale => {\n            const command = editor.commands.get('insertTable');\n            const menuView = new MenuBarMenuView(locale);\n            const insertTableView = new InsertTableView(locale);\n            insertTableView.delegate('execute').to(menuView);\n            menuView.on('change:isOpen', (event, name, isOpen) => {\n                if (!isOpen) {\n                    insertTableView.reset();\n                }\n            });\n            insertTableView.on('execute', () => {\n                editor.execute('insertTable', { rows: insertTableView.rows, columns: insertTableView.columns });\n                editor.editing.view.focus();\n            });\n            menuView.buttonView.set({\n                label: t('Table'),\n                icon: IconTable\n            });\n            menuView.panelView.children.add(insertTableView);\n            menuView.bind('isEnabled').to(command);\n            return menuView;\n        });\n        editor.ui.componentFactory.add('tableColumn', locale => {\n            const options = [\n                {\n                    type: 'switchbutton',\n                    model: {\n                        commandName: 'setTableColumnHeader',\n                        label: t('Header column'),\n                        bindIsOn: true\n                    }\n                },\n                { type: 'separator' },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: isContentLtr ? 'insertTableColumnLeft' : 'insertTableColumnRight',\n                        label: t('Insert column left')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: isContentLtr ? 'insertTableColumnRight' : 'insertTableColumnLeft',\n                        label: t('Insert column right')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'removeTableColumn',\n                        label: t('Delete column')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'selectTableColumn',\n                        label: t('Select column')\n                    }\n                }\n            ];\n            return this._prepareDropdown(t('Column'), IconTableColumn, options, locale);\n        });\n        editor.ui.componentFactory.add('tableRow', locale => {\n            const options = [\n                {\n                    type: 'switchbutton',\n                    model: {\n                        commandName: 'setTableRowHeader',\n                        label: t('Header row'),\n                        bindIsOn: true\n                    }\n                },\n                { type: 'separator' },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'insertTableRowAbove',\n                        label: t('Insert row above')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'insertTableRowBelow',\n                        label: t('Insert row below')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'removeTableRow',\n                        label: t('Delete row')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'selectTableRow',\n                        label: t('Select row')\n                    }\n                }\n            ];\n            return this._prepareDropdown(t('Row'), IconTableRow, options, locale);\n        });\n        editor.ui.componentFactory.add('mergeTableCells', locale => {\n            const options = [\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'mergeTableCellUp',\n                        label: t('Merge cell up')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: isContentLtr ? 'mergeTableCellRight' : 'mergeTableCellLeft',\n                        label: t('Merge cell right')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'mergeTableCellDown',\n                        label: t('Merge cell down')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: isContentLtr ? 'mergeTableCellLeft' : 'mergeTableCellRight',\n                        label: t('Merge cell left')\n                    }\n                },\n                { type: 'separator' },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'splitTableCellVertically',\n                        label: t('Split cell vertically')\n                    }\n                },\n                {\n                    type: 'button',\n                    model: {\n                        commandName: 'splitTableCellHorizontally',\n                        label: t('Split cell horizontally')\n                    }\n                }\n            ];\n            return this._prepareMergeSplitButtonDropdown(t('Merge cells'), IconTableMergeCell, options, locale);\n        });\n    }\n    /**\n     * Creates a dropdown view from a set of options.\n     *\n     * @param label The dropdown button label.\n     * @param icon An icon for the dropdown button.\n     * @param options The list of options for the dropdown.\n     */\n    _prepareDropdown(label, icon, options, locale) {\n        const editor = this.editor;\n        const dropdownView = createDropdown(locale);\n        const commands = this._fillDropdownWithListOptions(dropdownView, options);\n        // Decorate dropdown's button.\n        dropdownView.buttonView.set({\n            label,\n            icon,\n            tooltip: true\n        });\n        // Make dropdown button disabled when all options are disabled.\n        dropdownView.bind('isEnabled').toMany(commands, 'isEnabled', (...areEnabled) => {\n            return areEnabled.some(isEnabled => isEnabled);\n        });\n        this.listenTo(dropdownView, 'execute', evt => {\n            editor.execute(evt.source.commandName);\n            // Toggling a switch button view should not move the focus to the editable.\n            if (!(evt.source instanceof SwitchButtonView)) {\n                editor.editing.view.focus();\n            }\n        });\n        return dropdownView;\n    }\n    /**\n     * Creates a dropdown view with a {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} for\n     * merge (and split)–related commands.\n     *\n     * @param label The dropdown button label.\n     * @param icon An icon for the dropdown button.\n     * @param options The list of options for the dropdown.\n     */\n    _prepareMergeSplitButtonDropdown(label, icon, options, locale) {\n        const editor = this.editor;\n        const dropdownView = createDropdown(locale, SplitButtonView);\n        const mergeCommandName = 'mergeTableCells';\n        // Main command.\n        const mergeCommand = editor.commands.get(mergeCommandName);\n        // Subcommands in the dropdown.\n        const commands = this._fillDropdownWithListOptions(dropdownView, options);\n        dropdownView.buttonView.set({\n            label,\n            icon,\n            tooltip: true,\n            isEnabled: true\n        });\n        // Make dropdown button disabled when all options are disabled together with the main command.\n        dropdownView.bind('isEnabled').toMany([mergeCommand, ...commands], 'isEnabled', (...areEnabled) => {\n            return areEnabled.some(isEnabled => isEnabled);\n        });\n        // Merge selected table cells when the main part of the split button is clicked.\n        this.listenTo(dropdownView.buttonView, 'execute', () => {\n            editor.execute(mergeCommandName);\n            editor.editing.view.focus();\n        });\n        // Execute commands for events coming from the list in the dropdown panel.\n        this.listenTo(dropdownView, 'execute', evt => {\n            editor.execute(evt.source.commandName);\n            editor.editing.view.focus();\n        });\n        return dropdownView;\n    }\n    /**\n     * Injects a {@link module:ui/list/listview~ListView} into the passed dropdown with buttons\n     * which execute editor commands as configured in passed options.\n     *\n     * @param options The list of options for the dropdown.\n     * @returns Commands the list options are interacting with.\n     */\n    _fillDropdownWithListOptions(dropdownView, options) {\n        const editor = this.editor;\n        const commands = [];\n        const itemDefinitions = new Collection();\n        for (const option of options) {\n            addListOption(option, editor, commands, itemDefinitions);\n        }\n        addListToDropdown(dropdownView, itemDefinitions);\n        return commands;\n    }\n}\n/**\n * Adds an option to a list view.\n *\n * @param option A configuration option.\n * @param commands The list of commands to update.\n * @param itemDefinitions A collection of dropdown items to update with the given option.\n */\nfunction addListOption(option, editor, commands, itemDefinitions) {\n    if (option.type === 'button' || option.type === 'switchbutton') {\n        const model = option.model = new UIModel(option.model);\n        const { commandName, bindIsOn } = option.model;\n        const command = editor.commands.get(commandName);\n        commands.push(command);\n        model.set({ commandName });\n        model.bind('isEnabled').to(command);\n        if (bindIsOn) {\n            model.bind('isOn').to(command, 'value');\n        }\n        model.set({\n            withText: true\n        });\n    }\n    itemDefinitions.add(option);\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1M2 2v16h16V2z\\\" opacity=\\\".6\\\"/><path d=\\\"M18 7v1H2V7zm0 5v1H2v-1z\\\" opacity=\\\".6\\\"/><path d=\\\"M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1m-2 1H8v4h4zm0 6H8v4h4zm0 6H8v4h4z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1M2 2v16h16V2z\\\" opacity=\\\".6\\\"/><path d=\\\"M7 2h1v16H7zm5 0h1v16h-1z\\\" opacity=\\\".6\\\"/><path d=\\\"M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1m1 2v4h4V8zm6 0v4h4V8zm6 0v4h4V8z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1M2 2v16h16V2z\\\" opacity=\\\".6\\\"/><path d=\\\"M7 2h1v16H7zm5 0h1v7h-1zm6 5v1H2V7zM8 12v1H2v-1z\\\" opacity=\\\".6\\\"/><path d=\\\"M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1m1 2v9h10V9z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableselection\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { TableWalker } from './tablewalker.js';\nimport { TableUtils } from './tableutils.js';\nimport { cropTableToDimensions, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure.js';\nimport '../theme/tableselection.css';\n/**\n * This plugin enables the advanced table cells, rows and columns selection.\n * It is loaded automatically by the {@link module:table/table~Table} plugin.\n */\nexport class TableSelection extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableSelection';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableUtils, TableUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const view = editor.editing.view;\n        this.listenTo(model, 'deleteContent', (evt, args) => this._handleDeleteContent(evt, args), { priority: 'high' });\n        this.listenTo(view.document, 'insertText', (evt, data) => this._handleInsertTextEvent(evt, data), { priority: 'high' });\n        this._defineSelectionConverter();\n        this._enablePluginDisabling(); // sic!\n    }\n    /**\n     * Returns the currently selected table cells or `null` if it is not a table cells selection.\n     */\n    getSelectedTableCells() {\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const selection = this.editor.model.document.selection;\n        const selectedCells = tableUtils.getSelectedTableCells(selection);\n        if (selectedCells.length == 0) {\n            return null;\n        }\n        // This should never happen, but let's know if it ever happens.\n        // @if CK_DEBUG //\tif ( selectedCells.length != selection.rangeCount ) {\n        // @if CK_DEBUG //\t\tconsole.warn( 'Mixed selection warning. The selection contains table cells and some other ranges.' );\n        // @if CK_DEBUG //\t}\n        return selectedCells;\n    }\n    /**\n     * Returns the selected table fragment as a document fragment.\n     */\n    getSelectionAsFragment() {\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const selectedCells = this.getSelectedTableCells();\n        if (!selectedCells) {\n            return null;\n        }\n        return this.editor.model.change(writer => {\n            const documentFragment = writer.createDocumentFragment();\n            const { first: firstColumn, last: lastColumn } = tableUtils.getColumnIndexes(selectedCells);\n            const { first: firstRow, last: lastRow } = tableUtils.getRowIndexes(selectedCells);\n            const sourceTable = selectedCells[0].findAncestor('table');\n            let adjustedLastRow = lastRow;\n            let adjustedLastColumn = lastColumn;\n            // If the selection is rectangular there could be a case of all cells in the last row/column spanned over\n            // next row/column so the real lastRow/lastColumn should be updated.\n            if (tableUtils.isSelectionRectangular(selectedCells)) {\n                const dimensions = {\n                    firstColumn,\n                    lastColumn,\n                    firstRow,\n                    lastRow\n                };\n                adjustedLastRow = adjustLastRowIndex(sourceTable, dimensions);\n                adjustedLastColumn = adjustLastColumnIndex(sourceTable, dimensions);\n            }\n            const cropDimensions = {\n                startRow: firstRow,\n                startColumn: firstColumn,\n                endRow: adjustedLastRow,\n                endColumn: adjustedLastColumn\n            };\n            const table = cropTableToDimensions(sourceTable, cropDimensions, writer);\n            writer.insert(table, documentFragment, 0);\n            return documentFragment;\n        });\n    }\n    /**\n     * Sets the model selection based on given anchor and target cells (can be the same cell).\n     * Takes care of setting the backward flag.\n     *\n     * ```ts\n     * const modelRoot = editor.model.document.getRoot();\n     * const firstCell = modelRoot.getNodeByPath( [ 0, 0, 0 ] );\n     * const lastCell = modelRoot.getNodeByPath( [ 0, 0, 1 ] );\n     *\n     * const tableSelection = editor.plugins.get( 'TableSelection' );\n     * tableSelection.setCellSelection( firstCell, lastCell );\n     * ```\n     */\n    setCellSelection(anchorCell, targetCell) {\n        const cellsToSelect = this._getCellsToSelect(anchorCell, targetCell);\n        this.editor.model.change(writer => {\n            writer.setSelection(cellsToSelect.cells.map(cell => writer.createRangeOn(cell)), { backward: cellsToSelect.backward });\n        });\n    }\n    /**\n     * Returns the focus cell from the current selection.\n     */\n    getFocusCell() {\n        const selection = this.editor.model.document.selection;\n        const focusCellRange = [...selection.getRanges()].pop();\n        const element = focusCellRange.getContainedElement();\n        if (element && element.is('element', 'tableCell')) {\n            return element;\n        }\n        return null;\n    }\n    /**\n     * Returns the anchor cell from the current selection.\n     */\n    getAnchorCell() {\n        const selection = this.editor.model.document.selection;\n        const anchorCellRange = first(selection.getRanges());\n        const element = anchorCellRange.getContainedElement();\n        if (element && element.is('element', 'tableCell')) {\n            return element;\n        }\n        return null;\n    }\n    /**\n     * Defines a selection converter which marks the selected cells with a specific class.\n     *\n     * The real DOM selection is put in the last cell. Since the order of ranges is dependent on whether the\n     * selection is backward or not, the last cell will usually be close to the \"focus\" end of the selection\n     * (a selection has anchor and focus).\n     *\n     * The real DOM selection is then hidden with CSS.\n     */\n    _defineSelectionConverter() {\n        const editor = this.editor;\n        const highlighted = new Set();\n        editor.conversion.for('editingDowncast').add(dispatcher => dispatcher.on('selection', (evt, data, conversionApi) => {\n            const viewWriter = conversionApi.writer;\n            clearHighlightedTableCells(viewWriter);\n            const selectedCells = this.getSelectedTableCells();\n            if (!selectedCells) {\n                return;\n            }\n            for (const tableCell of selectedCells) {\n                const viewElement = conversionApi.mapper.toViewElement(tableCell);\n                viewWriter.addClass('ck-editor__editable_selected', viewElement);\n                highlighted.add(viewElement);\n            }\n            const lastViewCell = conversionApi.mapper.toViewElement(selectedCells[selectedCells.length - 1]);\n            viewWriter.setSelection(lastViewCell, 0);\n        }, { priority: 'lowest' }));\n        function clearHighlightedTableCells(viewWriter) {\n            for (const previouslyHighlighted of highlighted) {\n                viewWriter.removeClass('ck-editor__editable_selected', previouslyHighlighted);\n            }\n            highlighted.clear();\n        }\n    }\n    /**\n     * Creates a listener that reacts to changes in {@link #isEnabled} and, if the plugin was disabled,\n     * it collapses the multi-cell selection to a regular selection placed inside a table cell.\n     *\n     * This listener helps features that disable the table selection plugin bring the selection\n     * to a clear state they can work with (for instance, because they don't support multiple cell selection).\n     */\n    _enablePluginDisabling() {\n        const editor = this.editor;\n        this.on('change:isEnabled', () => {\n            if (!this.isEnabled) {\n                const selectedCells = this.getSelectedTableCells();\n                if (!selectedCells) {\n                    return;\n                }\n                editor.model.change(writer => {\n                    const position = writer.createPositionAt(selectedCells[0], 0);\n                    const range = editor.model.schema.getNearestSelectionRange(position);\n                    writer.setSelection(range);\n                });\n            }\n        });\n    }\n    /**\n     * Overrides the default `model.deleteContent()` behavior over a selected table fragment.\n     *\n     * @param args Delete content method arguments.\n     */\n    _handleDeleteContent(event, args) {\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const selection = args[0];\n        const options = args[1];\n        const model = this.editor.model;\n        const isBackward = !options || options.direction == 'backward';\n        const selectedTableCells = tableUtils.getSelectedTableCells(selection);\n        if (!selectedTableCells.length) {\n            return;\n        }\n        event.stop();\n        model.change(writer => {\n            const tableCellToSelect = selectedTableCells[isBackward ? selectedTableCells.length - 1 : 0];\n            model.change(writer => {\n                for (const tableCell of selectedTableCells) {\n                    model.deleteContent(writer.createSelection(tableCell, 'in'));\n                }\n            });\n            const rangeToSelect = model.schema.getNearestSelectionRange(writer.createPositionAt(tableCellToSelect, 0));\n            // Note: we ignore the case where rangeToSelect may be null because deleteContent() will always (unless someone broke it)\n            // create an empty paragraph to accommodate the selection.\n            if (selection.is('documentSelection')) {\n                writer.setSelection(rangeToSelect);\n            }\n            else {\n                selection.setTo(rangeToSelect);\n            }\n        });\n    }\n    /**\n     * This handler makes it possible to remove the content of all selected cells by starting to type.\n     * If you take a look at {@link #_defineSelectionConverter} you will find out that despite the multi-cell selection being set\n     * in the model, the view selection is collapsed in the last cell (because most browsers are unable to render multi-cell selections;\n     * yes, it's a hack).\n     *\n     * When multiple cells are selected in the model and the user starts to type, the\n     * {@link module:engine/view/document~ViewDocument#event:insertText} event carries information provided by the\n     * beforeinput DOM  event, that in turn only knows about this collapsed DOM selection in the last cell.\n     *\n     * As a result, the selected cells have no chance to be cleaned up. To fix this, this listener intercepts\n     * the event and injects the custom view selection in the data that translates correctly to the actual state\n     * of the multi-cell selection in the model.\n     *\n     * @param data Insert text event data.\n     */\n    _handleInsertTextEvent(evt, data) {\n        const editor = this.editor;\n        const selectedCells = this.getSelectedTableCells();\n        if (!selectedCells) {\n            return;\n        }\n        const view = editor.editing.view;\n        const mapper = editor.editing.mapper;\n        const viewRanges = selectedCells.map(tableCell => view.createRangeOn(mapper.toViewElement(tableCell)));\n        data.selection = view.createSelection(viewRanges);\n        // Do not let the browser handle it itself. We must modify the model and then apply changes to the view and DOM.\n        data.preventDefault();\n    }\n    /**\n     * Returns an array of table cells that should be selected based on the\n     * given anchor cell and target (focus) cell.\n     *\n     * The cells are returned in a reverse direction if the selection is backward.\n     */\n    _getCellsToSelect(anchorCell, targetCell) {\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const startLocation = tableUtils.getCellLocation(anchorCell);\n        const endLocation = tableUtils.getCellLocation(targetCell);\n        const startRow = Math.min(startLocation.row, endLocation.row);\n        const endRow = Math.max(startLocation.row, endLocation.row);\n        const startColumn = Math.min(startLocation.column, endLocation.column);\n        // Adjust the selection to include the entire row if a cell with colspan is selected.\n        // This ensures that the selection covers the full width of the colspan cell.\n        //\n        // Example:\n        // +---+---+---+---+\n        // | A | B | C | D |\n        // +---+---+---+---+\n        // | E             |\n        // +---+---+---+---+\n        //\n        // If the selection starts at `B` and ends at `E`, the entire first row should be selected.\n        //\n        // In other words, the selection will represent the following cells:\n        // \t* Without this adjustment, only `B`, `A` and `E` would be selected.\n        // \t* With this adjustment, `A`, `B`, `C`, `D`, and `E` are selected.\n        //\n        // See: https://github.com/ckeditor/ckeditor5/issues/17538\n        const endColumnExtraColspan = (parseInt(targetCell.getAttribute('colspan') || '1') - 1);\n        const endColumn = Math.max(startLocation.column, endLocation.column + endColumnExtraColspan);\n        // 2-dimensional array of the selected cells to ease flipping the order of cells for backward selections.\n        const selectionMap = new Array(endRow - startRow + 1).fill(null).map(() => []);\n        const walkerOptions = {\n            startRow,\n            endRow,\n            startColumn,\n            endColumn\n        };\n        for (const { row, cell } of new TableWalker(anchorCell.findAncestor('table'), walkerOptions)) {\n            selectionMap[row - startRow].push(cell);\n        }\n        const flipVertically = endLocation.row < startLocation.row;\n        const flipHorizontally = endLocation.column < startLocation.column;\n        if (flipVertically) {\n            selectionMap.reverse();\n        }\n        if (flipHorizontally) {\n            selectionMap.forEach(row => row.reverse());\n        }\n        return {\n            cells: selectionMap.flat(),\n            backward: flipVertically || flipHorizontally\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ClipboardPipeline, ClipboardMarkersUtils } from 'ckeditor5/src/clipboard.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TableSelection } from './tableselection.js';\nimport { TableWalker } from './tablewalker.js';\nimport { TableUtils } from './tableutils.js';\nimport { cropTableToDimensions, getHorizontallyOverlappingCells, getVerticallyOverlappingCells, removeEmptyRowsColumns, splitHorizontally, splitVertically, trimTableCellIfNeeded, adjustLastRowIndex, adjustLastColumnIndex } from './utils/structure.js';\n/**\n * This plugin adds support for copying/cutting/pasting fragments of tables.\n * It is loaded automatically by the {@link module:table/table~Table} plugin.\n */\nexport class TableClipboard extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableClipboard';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ClipboardMarkersUtils, ClipboardPipeline, TableSelection, TableUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        this.listenTo(viewDocument, 'copy', (evt, data) => this._onCopyCut(evt, data));\n        this.listenTo(viewDocument, 'cut', (evt, data) => this._onCopyCut(evt, data));\n        this._listenToContentInsertion();\n        this.decorate('_replaceTableSlotCell');\n    }\n    /**\n     * Sets up listening for events from the clipboard pipeline to properly handle\n     * table content merging during paste/drop operations.\n     *\n     * When a user is dragging and dropping a table, we want to insert the entire table into\n     * a table cell instead of merging table contents. For paste and other events,\n     * the normal table merge behavior is applied.\n     */\n    _listenToContentInsertion() {\n        const { editor } = this;\n        const clipboardPipeline = editor.plugins.get(ClipboardPipeline);\n        const tableSelection = editor.plugins.get(TableSelection);\n        let isPaste = false;\n        clipboardPipeline.on('contentInsertion', (evt, data) => {\n            isPaste = data.method === 'paste';\n        });\n        this.listenTo(editor.model, 'insertContent', (evt, [content, selectable]) => {\n            // Handles drag-and-drop of tables, where tables are inserted into selected cells rather than merged.\n            // The `isPaste` flag handles scenarios where other features (e.g., Templates) insert tables into specific cells.\n            if (isPaste || tableSelection.getSelectedTableCells() !== null) {\n                this._onInsertContent(evt, content, selectable);\n            }\n        }, { priority: 'high' });\n        clipboardPipeline.on('contentInsertion', () => {\n            isPaste = false;\n        }, { priority: 'lowest' });\n    }\n    /**\n     * Copies table content to a clipboard on \"copy\" & \"cut\" events.\n     *\n     * @param evt An object containing information about the handled event.\n     * @param data Clipboard event data.\n     */\n    _onCopyCut(evt, data) {\n        const view = this.editor.editing.view;\n        const tableSelection = this.editor.plugins.get(TableSelection);\n        const clipboardMarkersUtils = this.editor.plugins.get(ClipboardMarkersUtils);\n        if (!tableSelection.getSelectedTableCells()) {\n            return;\n        }\n        if (evt.name == 'cut' && !this.editor.model.canEditAt(this.editor.model.document.selection)) {\n            return;\n        }\n        data.preventDefault();\n        evt.stop();\n        this.editor.model.enqueueChange({ isUndoable: evt.name === 'cut' }, () => {\n            const documentFragment = clipboardMarkersUtils._copySelectedFragmentWithMarkers(evt.name, this.editor.model.document.selection, () => tableSelection.getSelectionAsFragment());\n            view.document.fire('clipboardOutput', {\n                dataTransfer: data.dataTransfer,\n                content: this.editor.data.toView(documentFragment),\n                method: evt.name\n            });\n        });\n    }\n    /**\n     * Overrides default {@link module:engine/model/model~Model#insertContent `model.insertContent()`} method to handle pasting table inside\n     * selected table fragment.\n     *\n     * Depending on selected table fragment:\n     * - If a selected table fragment is smaller than paste table it will crop pasted table to match dimensions.\n     * - If dimensions are equal it will replace selected table fragment with a pasted table contents.\n     *\n     * @param content The content to insert.\n     * @param selectable The selection into which the content should be inserted.\n     * If not provided the current model document selection will be used.\n     */\n    _onInsertContent(evt, content, selectable) {\n        if (selectable && !selectable.is('documentSelection')) {\n            return;\n        }\n        const model = this.editor.model;\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const clipboardMarkersUtils = this.editor.plugins.get(ClipboardMarkersUtils);\n        // We might need to crop table before inserting so reference might change.\n        const pastedTable = this.getTableIfOnlyTableInContent(content, model);\n        if (!pastedTable) {\n            return;\n        }\n        const selectedTableCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        if (!selectedTableCells.length) {\n            removeEmptyRowsColumns(pastedTable, tableUtils);\n            return;\n        }\n        // Override default model.insertContent() handling at this point.\n        evt.stop();\n        if (content.is('documentFragment')) {\n            clipboardMarkersUtils._pasteMarkersIntoTransformedElement(content.markers, writer => this._replaceSelectedCells(pastedTable, selectedTableCells, writer));\n        }\n        else {\n            this.editor.model.change(writer => {\n                this._replaceSelectedCells(pastedTable, selectedTableCells, writer);\n            });\n        }\n    }\n    /**\n     * Inserts provided `selectedTableCells` into `pastedTable`.\n     */\n    _replaceSelectedCells(pastedTable, selectedTableCells, writer) {\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const pastedDimensions = {\n            width: tableUtils.getColumns(pastedTable),\n            height: tableUtils.getRows(pastedTable)\n        };\n        // Prepare the table for pasting.\n        const selection = prepareTableForPasting(selectedTableCells, pastedDimensions, writer, tableUtils);\n        // Beyond this point we operate on a fixed content table with rectangular selection and proper last row/column values.\n        const selectionHeight = selection.lastRow - selection.firstRow + 1;\n        const selectionWidth = selection.lastColumn - selection.firstColumn + 1;\n        // Crop pasted table if:\n        // - Pasted table dimensions exceeds selection area.\n        // - Pasted table has broken layout (ie some cells sticks out by the table dimensions established by the first and last row).\n        //\n        // Note: The table dimensions are established by the width of the first row and the total number of rows.\n        // It is possible to programmatically create a table that has rows which would have cells anchored beyond first row width but\n        // such table will not be created by other editing solutions.\n        const cropDimensions = {\n            startRow: 0,\n            startColumn: 0,\n            endRow: Math.min(selectionHeight, pastedDimensions.height) - 1,\n            endColumn: Math.min(selectionWidth, pastedDimensions.width) - 1\n        };\n        pastedTable = cropTableToDimensions(pastedTable, cropDimensions, writer);\n        // Content table to which we insert a pasted table.\n        const selectedTable = selectedTableCells[0].findAncestor('table');\n        const cellsToSelect = this._replaceSelectedCellsWithPasted(pastedTable, pastedDimensions, selectedTable, selection, writer);\n        if (this.editor.plugins.get('TableSelection').isEnabled) {\n            // Selection ranges must be sorted because the first and last selection ranges are considered\n            // as anchor/focus cell ranges for multi-cell selection.\n            const selectionRanges = tableUtils.sortRanges(cellsToSelect.map(cell => writer.createRangeOn(cell)));\n            writer.setSelection(selectionRanges);\n        }\n        else {\n            // Set selection inside first cell if multi-cell selection is disabled.\n            writer.setSelection(cellsToSelect[0], 0);\n        }\n        return selectedTable;\n    }\n    /**\n     * Replaces the part of selectedTable with pastedTable.\n     */\n    _replaceSelectedCellsWithPasted(pastedTable, pastedDimensions, selectedTable, selection, writer) {\n        const { width: pastedWidth, height: pastedHeight } = pastedDimensions;\n        // Holds two-dimensional array that is addressed by [ row ][ column ] that stores cells anchored at given location.\n        const pastedTableLocationMap = createLocationMap(pastedTable, pastedWidth, pastedHeight);\n        const selectedTableMap = [...new TableWalker(selectedTable, {\n                startRow: selection.firstRow,\n                endRow: selection.lastRow,\n                startColumn: selection.firstColumn,\n                endColumn: selection.lastColumn,\n                includeAllSlots: true\n            })];\n        // Selection must be set to pasted cells (some might be removed or new created).\n        const cellsToSelect = [];\n        // Store next cell insert position.\n        let insertPosition;\n        // Content table replace cells algorithm iterates over a selected table fragment and:\n        //\n        // - Removes existing table cells at current slot (location).\n        // - Inserts cell from a pasted table for a matched slots.\n        //\n        // This ensures proper table geometry after the paste\n        for (const tableSlot of selectedTableMap) {\n            const { row, column } = tableSlot;\n            // Save the insert position for current row start.\n            if (column === selection.firstColumn) {\n                insertPosition = tableSlot.getPositionBefore();\n            }\n            // Map current table slot location to an pasted table slot location.\n            const pastedRow = row - selection.firstRow;\n            const pastedColumn = column - selection.firstColumn;\n            const pastedCell = pastedTableLocationMap[pastedRow % pastedHeight][pastedColumn % pastedWidth];\n            // Clone cell to insert (to duplicate its attributes and children).\n            // Cloning is required to support repeating pasted table content when inserting to a bigger selection.\n            const cellToInsert = pastedCell ? writer.cloneElement(pastedCell) : null;\n            // Replace the cell from the current slot with new table cell.\n            const newTableCell = this._replaceTableSlotCell(tableSlot, cellToInsert, insertPosition, writer);\n            // The cell was only removed.\n            if (!newTableCell) {\n                continue;\n            }\n            // Trim the cell if it's row/col-spans would exceed selection area.\n            trimTableCellIfNeeded(newTableCell, row, column, selection.lastRow, selection.lastColumn, writer);\n            cellsToSelect.push(newTableCell);\n            insertPosition = writer.createPositionAfter(newTableCell);\n        }\n        // If there are any headings, all the cells that overlap from heading must be splitted.\n        const headingRows = parseInt(selectedTable.getAttribute('headingRows') || '0');\n        const headingColumns = parseInt(selectedTable.getAttribute('headingColumns') || '0');\n        const areHeadingRowsIntersectingSelection = selection.firstRow < headingRows && headingRows <= selection.lastRow;\n        const areHeadingColumnsIntersectingSelection = selection.firstColumn < headingColumns && headingColumns <= selection.lastColumn;\n        if (areHeadingRowsIntersectingSelection) {\n            const columnsLimit = { first: selection.firstColumn, last: selection.lastColumn };\n            const newCells = doHorizontalSplit(selectedTable, headingRows, columnsLimit, writer, selection.firstRow);\n            cellsToSelect.push(...newCells);\n        }\n        if (areHeadingColumnsIntersectingSelection) {\n            const rowsLimit = { first: selection.firstRow, last: selection.lastRow };\n            const newCells = doVerticalSplit(selectedTable, headingColumns, rowsLimit, writer);\n            cellsToSelect.push(...newCells);\n        }\n        return cellsToSelect;\n    }\n    /**\n     * Replaces a single table slot.\n     *\n     * @returns Inserted table cell or null if slot should remain empty.\n     * @private\n     */\n    _replaceTableSlotCell(tableSlot, cellToInsert, insertPosition, writer) {\n        const { cell, isAnchor } = tableSlot;\n        // If the slot is occupied by a cell in a selected table - remove it.\n        // The slot of this cell will be either:\n        // - Replaced by a pasted table cell.\n        // - Spanned by a previously pasted table cell.\n        if (isAnchor) {\n            writer.remove(cell);\n        }\n        // There is no cell to insert (might be spanned by other cell in a pasted table) - advance to the next content table slot.\n        if (!cellToInsert) {\n            return null;\n        }\n        writer.insert(cellToInsert, insertPosition);\n        return cellToInsert;\n    }\n    /**\n     * Extracts the table for pasting into a table.\n     *\n     * @param content The content to insert.\n     * @param model The editor model.\n     */\n    getTableIfOnlyTableInContent(content, model) {\n        if (!content.is('documentFragment') && !content.is('element')) {\n            return null;\n        }\n        // Table passed directly.\n        if (content.is('element', 'table')) {\n            return content;\n        }\n        // We do not support mixed content when pasting table into table.\n        // See: https://github.com/ckeditor/ckeditor5/issues/6817.\n        if (content.childCount == 1 && content.getChild(0).is('element', 'table')) {\n            return content.getChild(0);\n        }\n        // If there are only whitespaces around a table then use that table for pasting.\n        const contentRange = model.createRangeIn(content);\n        for (const element of contentRange.getItems()) {\n            if (element.is('element', 'table')) {\n                // Stop checking if there is some content before table.\n                const rangeBefore = model.createRange(contentRange.start, model.createPositionBefore(element));\n                if (model.hasContent(rangeBefore, { ignoreWhitespaces: true })) {\n                    return null;\n                }\n                // Stop checking if there is some content after table.\n                const rangeAfter = model.createRange(model.createPositionAfter(element), contentRange.end);\n                if (model.hasContent(rangeAfter, { ignoreWhitespaces: true })) {\n                    return null;\n                }\n                // There wasn't any content neither before nor after.\n                return element;\n            }\n        }\n        return null;\n    }\n}\n/**\n * Prepares a table for pasting and returns adjusted selection dimensions.\n */\nfunction prepareTableForPasting(selectedTableCells, pastedDimensions, writer, tableUtils) {\n    const selectedTable = selectedTableCells[0].findAncestor('table');\n    const columnIndexes = tableUtils.getColumnIndexes(selectedTableCells);\n    const rowIndexes = tableUtils.getRowIndexes(selectedTableCells);\n    const selection = {\n        firstColumn: columnIndexes.first,\n        lastColumn: columnIndexes.last,\n        firstRow: rowIndexes.first,\n        lastRow: rowIndexes.last\n    };\n    // Single cell selected - expand selection to pasted table dimensions.\n    const shouldExpandSelection = selectedTableCells.length === 1;\n    if (shouldExpandSelection) {\n        selection.lastRow += pastedDimensions.height - 1;\n        selection.lastColumn += pastedDimensions.width - 1;\n        expandTableSize(selectedTable, selection.lastRow + 1, selection.lastColumn + 1, tableUtils);\n    }\n    // In case of expanding selection we do not reset the selection so in this case we will always try to fix selection\n    // like in the case of a non-rectangular area. This might be fixed by re-setting selected cells array but this shortcut is safe.\n    if (shouldExpandSelection || !tableUtils.isSelectionRectangular(selectedTableCells)) {\n        // For a non-rectangular selection (ie in which some cells sticks out from a virtual selection rectangle) we need to create\n        // a table layout that has a rectangular selection. This will split cells so the selection become rectangular.\n        // Beyond this point we will operate on fixed content table.\n        splitCellsToRectangularSelection(selectedTable, selection, writer);\n    }\n    // However a selected table fragment might be invalid if examined alone. Ie such table fragment:\n    //\n    //    +---+---+---+---+\n    //  0 | a | b | c | d |\n    //    +   +   +---+---+\n    //  1 |   | e | f | g |\n    //    +   +---+   +---+\n    //  2 |   | h |   | i | <- last row, each cell has rowspan = 2,\n    //    +   +   +   +   +    so we need to return 3, not 2\n    //  3 |   |   |   |   |\n    //    +---+---+---+---+\n    //\n    // is invalid as the cells \"h\" and \"i\" have rowspans.\n    // This case needs only adjusting the selection dimension as the rest of the algorithm operates on empty slots also.\n    else {\n        selection.lastRow = adjustLastRowIndex(selectedTable, selection);\n        selection.lastColumn = adjustLastColumnIndex(selectedTable, selection);\n    }\n    return selection;\n}\n/**\n * Expand table (in place) to expected size.\n */\nfunction expandTableSize(table, expectedHeight, expectedWidth, tableUtils) {\n    const tableWidth = tableUtils.getColumns(table);\n    const tableHeight = tableUtils.getRows(table);\n    if (expectedWidth > tableWidth) {\n        tableUtils.insertColumns(table, {\n            at: tableWidth,\n            columns: expectedWidth - tableWidth\n        });\n    }\n    if (expectedHeight > tableHeight) {\n        tableUtils.insertRows(table, {\n            at: tableHeight,\n            rows: expectedHeight - tableHeight\n        });\n    }\n}\n/**\n * Returns two-dimensional array that is addressed by [ row ][ column ] that stores cells anchored at given location.\n *\n * At given row & column location it might be one of:\n *\n * * cell - cell from pasted table anchored at this location.\n * * null - if no cell is anchored at this location.\n *\n * For instance, from a table below:\n *\n *   +----+----+----+----+\n *   | 00 | 01 | 02 | 03 |\n *   +    +----+----+----+\n *   |    | 11      | 13 |\n *   +----+         +----+\n *   | 20 |         | 23 |\n *   +----+----+----+----+\n *\n * The method will return an array (numbers represents cell element):\n *\n * ```ts\n * const map = [\n *   [ '00', '01', '02', '03' ],\n *   [ null, '11', null, '13' ],\n *   [ '20', null, null, '23' ]\n * ]\n * ```\n *\n * This allows for a quick access to table at give row & column. For instance to access table cell \"13\" from pasted table call:\n *\n * ```ts\n * const cell = map[ 1 ][ 3 ]\n * ```\n */\nfunction createLocationMap(table, width, height) {\n    // Create height x width (row x column) two-dimensional table to store cells.\n    const map = new Array(height).fill(null)\n        .map(() => new Array(width).fill(null));\n    for (const { column, row, cell } of new TableWalker(table)) {\n        map[row][column] = cell;\n    }\n    return map;\n}\n/**\n * Make selected cells rectangular by splitting the cells that stand out from a rectangular selection.\n *\n * In the table below a selection is shown with \"::\" and slots with anchor cells are named.\n *\n * +----+----+----+----+----+                    +----+----+----+----+----+\n * | 00 | 01 | 02 | 03      |                    | 00 | 01 | 02 | 03      |\n * +    +----+    +----+----+                    |    ::::::::::::::::----+\n * |    | 11 |    | 13 | 14 |                    |    ::11 |    | 13:: 14 |    <- first row\n * +----+----+    +    +----+                    +----::---|    |   ::----+\n * | 20 | 21 |    |    | 24 |   select cells:    | 20 ::21 |    |   :: 24 |\n * +----+----+    +----+----+     11 -> 33       +----::---|    |---::----+\n * | 30      |    | 33 | 34 |                    | 30 ::   |    | 33:: 34 |    <- last row\n * +         +    +----+    +                    |    ::::::::::::::::    +\n * |         |    | 43 |    |                    |         |    | 43 |    |\n * +----+----+----+----+----+                    +----+----+----+----+----+\n *                                                      ^          ^\n *                                                     first & last columns\n *\n * Will update table to:\n *\n *                       +----+----+----+----+----+\n *                       | 00 | 01 | 02 | 03      |\n *                       +    +----+----+----+----+\n *                       |    | 11 |    | 13 | 14 |\n *                       +----+----+    +    +----+\n *                       | 20 | 21 |    |    | 24 |\n *                       +----+----+    +----+----+\n *                       | 30 |    |    | 33 | 34 |\n *                       +    +----+----+----+    +\n *                       |    |    |    | 43 |    |\n *                       +----+----+----+----+----+\n *\n * In th example above:\n * - Cell \"02\" which have `rowspan = 4` must be trimmed at first and at after last row.\n * - Cell \"03\" which have `rowspan = 2` and `colspan = 2` must be trimmed at first column and after last row.\n * - Cells \"00\", \"03\" & \"30\" which cannot be cut by this algorithm as they are outside the trimmed area.\n * - Cell \"13\" cannot be cut as it is inside the trimmed area.\n */\nfunction splitCellsToRectangularSelection(table, dimensions, writer) {\n    const { firstRow, lastRow, firstColumn, lastColumn } = dimensions;\n    const rowIndexes = { first: firstRow, last: lastRow };\n    const columnIndexes = { first: firstColumn, last: lastColumn };\n    // 1. Split cells vertically in two steps as first step might create cells that needs to split again.\n    doVerticalSplit(table, firstColumn, rowIndexes, writer);\n    doVerticalSplit(table, lastColumn + 1, rowIndexes, writer);\n    // 2. Split cells horizontally in two steps as first step might create cells that needs to split again.\n    doHorizontalSplit(table, firstRow, columnIndexes, writer);\n    doHorizontalSplit(table, lastRow + 1, columnIndexes, writer, firstRow);\n}\nfunction doHorizontalSplit(table, splitRow, limitColumns, writer, startRow = 0) {\n    // If selection starts at first row then no split is needed.\n    if (splitRow < 1) {\n        return;\n    }\n    const overlappingCells = getVerticallyOverlappingCells(table, splitRow, startRow);\n    // Filter out cells that are not touching insides of the rectangular selection.\n    const cellsToSplit = overlappingCells.filter(({ column, cellWidth }) => isAffectedBySelection(column, cellWidth, limitColumns));\n    return cellsToSplit.map(({ cell }) => splitHorizontally(cell, splitRow, writer));\n}\nfunction doVerticalSplit(table, splitColumn, limitRows, writer) {\n    // If selection starts at first column then no split is needed.\n    if (splitColumn < 1) {\n        return;\n    }\n    const overlappingCells = getHorizontallyOverlappingCells(table, splitColumn);\n    // Filter out cells that are not touching insides of the rectangular selection.\n    const cellsToSplit = overlappingCells.filter(({ row, cellHeight }) => isAffectedBySelection(row, cellHeight, limitRows));\n    return cellsToSplit.map(({ cell, column }) => splitVertically(cell, column, splitColumn, writer));\n}\n/**\n * Checks if cell at given row (column) is affected by a rectangular selection defined by first/last column (row).\n *\n * The same check is used for row as for column.\n */\nfunction isAffectedBySelection(index, span, limit) {\n    const endIndex = index + span - 1;\n    const { first, last } = limit;\n    const isInsideSelection = index >= first && index <= last;\n    const overlapsSelectionFromOutside = index < first && endIndex >= first;\n    return isInsideSelection || overlapsSelectionFromOutside;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablekeyboard\n */\nimport { TableSelection } from './tableselection.js';\nimport { TableWalker } from './tablewalker.js';\nimport { TableUtils } from './tableutils.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { getLocalizedArrowKeyCodeDirection } from 'ckeditor5/src/utils.js';\n/**\n * This plugin enables keyboard navigation for tables.\n * It is loaded automatically by the {@link module:table/table~Table} plugin.\n */\nexport class TableKeyboard extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableKeyboard';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableSelection, TableUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const view = editor.editing.view;\n        const viewDocument = view.document;\n        const t = editor.t;\n        this.listenTo(viewDocument, 'arrowKey', (...args) => this._onArrowKey(...args), { context: 'table' });\n        this.listenTo(viewDocument, 'tab', (...args) => this._handleTabOnSelectedTable(...args), { context: 'figure' });\n        this.listenTo(viewDocument, 'tab', (...args) => this._handleTab(...args), { context: ['th', 'td'] });\n        // Add the information about the keystrokes to the accessibility database.\n        editor.accessibility.addKeystrokeInfoGroup({\n            id: 'table',\n            label: t('Keystrokes that can be used in a table cell'),\n            keystrokes: [\n                {\n                    label: t('Move the selection to the next cell'),\n                    keystroke: 'Tab'\n                },\n                {\n                    label: t('Move the selection to the previous cell'),\n                    keystroke: 'Shift+Tab'\n                },\n                {\n                    label: t('Insert a new table row (when in the last cell of a table)'),\n                    keystroke: 'Tab'\n                },\n                {\n                    label: t('Navigate through the table'),\n                    keystroke: [['arrowup'], ['arrowright'], ['arrowdown'], ['arrowleft']]\n                }\n            ]\n        });\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed\n     * when the table widget is selected.\n     */\n    _handleTabOnSelectedTable(bubblingEventInfo, domEventData) {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const selectedElement = selection.getSelectedElement();\n        if (!selectedElement || !selectedElement.is('element', 'table')) {\n            return;\n        }\n        // For backward compatibility stop propagation of this DOM event.\n        // The default tab handling from widgets handles navigation.\n        domEventData.stopPropagation();\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:tab tab} events for the <kbd>Tab</kbd> key executed\n     * inside table cells.\n     */\n    _handleTab(bubblingEventInfo, domEventData) {\n        const editor = this.editor;\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const tableSelection = this.editor.plugins.get('TableSelection');\n        const selection = editor.model.document.selection;\n        const isForward = !domEventData.shiftKey;\n        let tableCell = tableUtils.getTableCellsContainingSelection(selection)[0];\n        if (!tableCell) {\n            tableCell = tableSelection.getFocusCell();\n        }\n        if (!tableCell) {\n            return;\n        }\n        // For backward compatibility stop propagation of this DOM event.\n        // The default tab handling from widgets handles navigation.\n        domEventData.stopPropagation();\n        const tableRow = tableCell.parent;\n        const table = tableRow.parent;\n        const currentRowIndex = table.getChildIndex(tableRow);\n        const currentCellIndex = tableRow.getChildIndex(tableCell);\n        const isLastCellInRow = currentCellIndex === tableRow.childCount - 1;\n        const isLastRow = currentRowIndex === tableUtils.getRows(table) - 1;\n        if (isForward && isLastRow && isLastCellInRow) {\n            editor.execute('insertTableRowBelow');\n        }\n    }\n    /**\n     * Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events.\n     */\n    _onArrowKey(eventInfo, domEventData) {\n        const editor = this.editor;\n        const keyCode = domEventData.keyCode;\n        const direction = getLocalizedArrowKeyCodeDirection(keyCode, editor.locale.contentLanguageDirection);\n        const wasHandled = this._handleArrowKeys(direction, domEventData.shiftKey);\n        if (wasHandled) {\n            domEventData.preventDefault();\n            domEventData.stopPropagation();\n            eventInfo.stop();\n        }\n    }\n    /**\n     * Handles arrow keys to move the selection around the table.\n     *\n     * @param direction The direction of the arrow key.\n     * @param expandSelection If the current selection should be expanded.\n     * @returns Returns `true` if key was handled.\n     */\n    _handleArrowKeys(direction, expandSelection) {\n        const tableUtils = this.editor.plugins.get(TableUtils);\n        const tableSelection = this.editor.plugins.get('TableSelection');\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const isForward = ['right', 'down'].includes(direction);\n        // In case one or more table cells are selected (from outside),\n        // move the selection to a cell adjacent to the selected table fragment.\n        const selectedCells = tableUtils.getSelectedTableCells(selection);\n        if (selectedCells.length) {\n            let focusCell;\n            if (expandSelection) {\n                focusCell = tableSelection.getFocusCell();\n            }\n            else {\n                focusCell = isForward ? selectedCells[selectedCells.length - 1] : selectedCells[0];\n            }\n            this._navigateFromCellInDirection(focusCell, direction, expandSelection);\n            return true;\n        }\n        // Abort if we're not in a table cell.\n        const tableCell = selection.focus.findAncestor('tableCell');\n        /* istanbul ignore if: paranoid check -- @preserve */\n        if (!tableCell) {\n            return false;\n        }\n        // When the selection is not collapsed.\n        if (!selection.isCollapsed) {\n            if (expandSelection) {\n                // Navigation is in the opposite direction than the selection direction so this is shrinking of the selection.\n                // Selection for sure will not approach cell edge.\n                //\n                // With a special case when all cell content is selected - then selection should expand to the other cell.\n                // Note: When the entire cell gets selected using CTRL+A, the selection is always forward.\n                if (selection.isBackward == isForward && !selection.containsEntireContent(tableCell)) {\n                    return false;\n                }\n            }\n            else {\n                const selectedElement = selection.getSelectedElement();\n                // It will collapse for non-object selected so it's not going to move to other cell.\n                if (!selectedElement || !model.schema.isObject(selectedElement)) {\n                    return false;\n                }\n            }\n        }\n        // Let's check if the selection is at the beginning/end of the cell.\n        if (this._isSelectionAtCellEdge(selection, tableCell, isForward)) {\n            this._navigateFromCellInDirection(tableCell, direction, expandSelection);\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Returns `true` if the selection is at the boundary of a table cell according to the navigation direction.\n     *\n     * @param selection The current selection.\n     * @param tableCell The current table cell element.\n     * @param isForward The expected navigation direction.\n     */\n    _isSelectionAtCellEdge(selection, tableCell, isForward) {\n        const model = this.editor.model;\n        const schema = this.editor.model.schema;\n        const focus = isForward ? selection.getLastPosition() : selection.getFirstPosition();\n        // If the current limit element is not table cell we are for sure not at the cell edge.\n        // Also `modifySelection` will not let us out of it.\n        if (!schema.getLimitElement(focus).is('element', 'tableCell')) {\n            const boundaryPosition = model.createPositionAt(tableCell, isForward ? 'end' : 0);\n            return boundaryPosition.isTouching(focus);\n        }\n        const probe = model.createSelection(focus);\n        model.modifySelection(probe, { direction: isForward ? 'forward' : 'backward' });\n        // If there was no change in the focus position, then it's not possible to move the selection there.\n        return focus.isEqual(probe.focus);\n    }\n    /**\n     * Moves the selection from the given table cell in the specified direction.\n     *\n     * @param focusCell The table cell that is current multi-cell selection focus.\n     * @param direction Direction in which selection should move.\n     * @param expandSelection If the current selection should be expanded. Default value is false.\n     */\n    _navigateFromCellInDirection(focusCell, direction, expandSelection = false) {\n        const model = this.editor.model;\n        const table = focusCell.findAncestor('table');\n        const tableMap = [...new TableWalker(table, { includeAllSlots: true })];\n        const { row: lastRow, column: lastColumn } = tableMap[tableMap.length - 1];\n        const currentCellInfo = tableMap.find(({ cell }) => cell == focusCell);\n        let { row, column } = currentCellInfo;\n        switch (direction) {\n            case 'left':\n                column--;\n                break;\n            case 'up':\n                row--;\n                break;\n            case 'right':\n                column += currentCellInfo.cellWidth;\n                break;\n            case 'down':\n                row += currentCellInfo.cellHeight;\n                break;\n        }\n        const isOutsideVertically = row < 0 || row > lastRow;\n        const isBeforeFirstCell = column < 0 && row <= 0;\n        const isAfterLastCell = column > lastColumn && row >= lastRow;\n        // Note that if the table cell at the end of a row is row-spanned then isAfterLastCell will never be true.\n        // However, we don't know if user was navigating on the last row or not, so let's stay in the table.\n        if (isOutsideVertically || isBeforeFirstCell || isAfterLastCell) {\n            model.change(writer => {\n                writer.setSelection(writer.createRangeOn(table));\n            });\n            return;\n        }\n        if (column < 0) {\n            column = expandSelection ? 0 : lastColumn;\n            row--;\n        }\n        else if (column > lastColumn) {\n            column = expandSelection ? lastColumn : 0;\n            row++;\n        }\n        const cellToSelect = tableMap.find(cellInfo => cellInfo.row == row && cellInfo.column == column).cell;\n        const isForward = ['right', 'down'].includes(direction);\n        const tableSelection = this.editor.plugins.get('TableSelection');\n        if (expandSelection && tableSelection.isEnabled) {\n            const anchorCell = tableSelection.getAnchorCell() || focusCell;\n            tableSelection.setCellSelection(anchorCell, cellToSelect);\n        }\n        else {\n            const positionToSelect = model.createPositionAt(cellToSelect, isForward ? 0 : 'end');\n            model.change(writer => {\n                writer.setSelection(positionToSelect);\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablemouse/mouseeventsobserver\n */\nimport { DomEventObserver } from 'ckeditor5/src/engine.js';\n/**\n * The mouse selection event observer.\n *\n * It registers listeners for the following DOM events:\n *\n * - `'mousemove'`\n * - `'mouseleave'`\n *\n * Note that this observer is disabled by default. To enable this observer, it needs to be added to\n * {@link module:engine/view/view~EditingView} using the {@link module:engine/view/view~EditingView#addObserver} method.\n *\n * The observer is registered by the {@link module:table/tableselection~TableSelection} plugin.\n *\n * @internal\n */\nexport class MouseEventsObserver extends DomEventObserver {\n    domEventType = [\n        'mousemove', 'mouseleave'\n    ];\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        this.fire(domEvent.type, domEvent);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablemouse\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TableSelection } from './tableselection.js';\nimport { MouseEventsObserver } from './tablemouse/mouseeventsobserver.js';\nimport { TableUtils } from './tableutils.js';\n/**\n * This plugin enables a table cells' selection with the mouse.\n * It is loaded automatically by the {@link module:table/table~Table} plugin.\n */\nexport class TableMouse extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableMouse';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableSelection, TableUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Currently the MouseObserver only handles `mousedown` and `mouseup` events.\n        // TODO move to the engine?\n        editor.editing.view.addObserver(MouseEventsObserver);\n        this._enableShiftClickSelection();\n        this._enableMouseDragSelection();\n    }\n    /**\n     * Enables making cells selection by <kbd>Shift</kbd>+click. Creates a selection from the cell which previously held\n     * the selection to the cell which was clicked. It can be the same cell, in which case it selects a single cell.\n     */\n    _enableShiftClickSelection() {\n        const editor = this.editor;\n        const tableUtils = editor.plugins.get(TableUtils);\n        let blockSelectionChange = false;\n        const tableSelection = editor.plugins.get(TableSelection);\n        this.listenTo(editor.editing.view.document, 'mousedown', (evt, domEventData) => {\n            const selection = editor.model.document.selection;\n            if (!this.isEnabled || !tableSelection.isEnabled) {\n                return;\n            }\n            if (!domEventData.domEvent.shiftKey) {\n                return;\n            }\n            const anchorCell = tableSelection.getAnchorCell() || tableUtils.getTableCellsContainingSelection(selection)[0];\n            if (!anchorCell) {\n                return;\n            }\n            const targetCell = this._getModelTableCellFromDomEvent(domEventData);\n            if (targetCell && haveSameTableParent(anchorCell, targetCell)) {\n                blockSelectionChange = true;\n                tableSelection.setCellSelection(anchorCell, targetCell);\n                domEventData.preventDefault();\n            }\n        });\n        this.listenTo(editor.editing.view.document, 'mouseup', () => {\n            blockSelectionChange = false;\n        });\n        // We need to ignore a `selectionChange` event that is fired after we render our new table cells selection.\n        // When downcasting table cells selection to the view, we put the view selection in the last selected cell\n        // in a place that may not be natively a \"correct\" location. This is – we put it directly in the `<td>` element.\n        // All browsers fire the native `selectionchange` event.\n        // However, all browsers except Safari return the selection in the exact place where we put it\n        // (even though it's visually normalized). Safari returns `<td><p>^foo` that makes our selection observer\n        // fire our `selectionChange` event (because the view selection that we set in the first step differs from the DOM selection).\n        // Since `selectionChange` is fired, we automatically update the model selection that moves it that paragraph.\n        // This breaks our dear cells selection.\n        //\n        // Theoretically this issue concerns only Safari that is the only browser that do normalize the selection.\n        // However, to avoid code branching and to have a good coverage for this event blocker, I enabled it for all browsers.\n        //\n        // Note: I'm keeping the `blockSelectionChange` state separately for shift+click and mouse drag (exact same logic)\n        // so I don't have to try to analyze whether they don't overlap in some weird cases. Probably they don't.\n        // But I have other things to do, like writing this comment.\n        this.listenTo(editor.editing.view.document, 'selectionChange', evt => {\n            if (blockSelectionChange) {\n                // @if CK_DEBUG // console.log( 'Blocked selectionChange to avoid breaking table cells selection.' );\n                evt.stop();\n            }\n        }, { priority: 'highest' });\n    }\n    /**\n     * Enables making cells selection by dragging.\n     *\n     * The selection is made only on mousemove. Mouse tracking is started on mousedown.\n     * However, the cells selection is enabled only after the mouse cursor left the anchor cell.\n     * Thanks to that normal text selection within one cell works just fine. However, you can still select\n     * just one cell by leaving the anchor cell and moving back to it.\n     */\n    _enableMouseDragSelection() {\n        const editor = this.editor;\n        let anchorCell, targetCell;\n        let beganCellSelection = false;\n        let blockSelectionChange = false;\n        const tableSelection = editor.plugins.get(TableSelection);\n        this.listenTo(editor.editing.view.document, 'mousedown', (evt, domEventData) => {\n            if (!this.isEnabled || !tableSelection.isEnabled) {\n                return;\n            }\n            // Make sure to not conflict with the shift+click listener and any other possible handler.\n            if (domEventData.domEvent.shiftKey || domEventData.domEvent.ctrlKey || domEventData.domEvent.altKey) {\n                return;\n            }\n            anchorCell = this._getModelTableCellFromDomEvent(domEventData);\n        });\n        this.listenTo(editor.editing.view.document, 'mousemove', (evt, domEventData) => {\n            if (!domEventData.domEvent.buttons) {\n                return;\n            }\n            if (!anchorCell) {\n                return;\n            }\n            const newTargetCell = this._getModelTableCellFromDomEvent(domEventData);\n            if (newTargetCell && haveSameTableParent(anchorCell, newTargetCell)) {\n                targetCell = newTargetCell;\n                // Switch to the cell selection mode after the mouse cursor left the anchor cell.\n                // Switch off only on mouseup (makes selecting a single cell possible).\n                if (!beganCellSelection && targetCell != anchorCell) {\n                    beganCellSelection = true;\n                }\n            }\n            // Yep, not making a cell selection yet. See method docs.\n            if (!beganCellSelection) {\n                return;\n            }\n            blockSelectionChange = true;\n            tableSelection.setCellSelection(anchorCell, targetCell);\n            domEventData.preventDefault();\n        });\n        this.listenTo(editor.editing.view.document, 'mouseup', () => {\n            beganCellSelection = false;\n            blockSelectionChange = false;\n            anchorCell = null;\n            targetCell = null;\n        });\n        // See the explanation in `_enableShiftClickSelection()`.\n        this.listenTo(editor.editing.view.document, 'selectionChange', evt => {\n            if (blockSelectionChange) {\n                // @if CK_DEBUG // console.log( 'Blocked selectionChange to avoid breaking table cells selection.' );\n                evt.stop();\n            }\n        }, { priority: 'highest' });\n    }\n    /**\n     * Returns the model table cell element based on the target element of the passed DOM event.\n     *\n     * @returns Returns the table cell or `undefined`.\n     */\n    _getModelTableCellFromDomEvent(domEventData) {\n        // Note: Work with positions (not element mapping) because the target element can be an attribute or other non-mapped element.\n        const viewTargetElement = domEventData.target;\n        const viewPosition = this.editor.editing.view.createPositionAt(viewTargetElement, 0);\n        const modelPosition = this.editor.editing.mapper.toModelPosition(viewPosition);\n        const modelElement = modelPosition.parent;\n        return modelElement.findAncestor('tableCell', { includeSelf: true });\n    }\n}\nfunction haveSameTableParent(cellA, cellB) {\n    return cellA.parent.parent == cellB.parent.parent;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { isWidget } from 'ckeditor5/src/widget.js';\n/**\n * Depending on the position of the selection either return the selected table or the table higher in the hierarchy.\n *\n * @internal\n */\nexport function getSelectionAffectedTableWidget(selection) {\n    const selectedTable = getSelectedTableWidget(selection);\n    if (selectedTable) {\n        return selectedTable;\n    }\n    return getTableWidgetAncestor(selection);\n}\n/**\n * Returns a table widget editing view element if one is selected.\n *\n * @internal\n */\nexport function getSelectedTableWidget(selection) {\n    const viewElement = selection.getSelectedElement();\n    if (viewElement && isTableWidget(viewElement)) {\n        return viewElement;\n    }\n    return null;\n}\n/**\n * Returns a table widget editing view element if one is among the selection's ancestors.\n *\n * @internal\n */\nexport function getTableWidgetAncestor(selection) {\n    const selectionPosition = selection.getFirstPosition();\n    if (!selectionPosition) {\n        return null;\n    }\n    let parent = selectionPosition.parent;\n    while (parent) {\n        if (parent.is('element') && isTableWidget(parent)) {\n            return parent;\n        }\n        parent = parent.parent;\n    }\n    return null;\n}\n/**\n * Checks if a given view element is a table widget.\n *\n * @internal\n */\nexport function isTableWidget(viewNode) {\n    return viewNode.is('element') && !!viewNode.getCustomProperty('table') && isWidget(viewNode);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getSelectionAffectedTable } from '../../utils/common.js';\n/**\n * The table cell attribute command.\n *\n * This command is a base command for other table property commands.\n */\nexport class TablePropertyCommand extends Command {\n    /**\n     * The attribute that will be set by the command.\n     */\n    attributeName;\n    /**\n     * The default value for the attribute.\n     *\n     * @readonly\n     */\n    _defaultValue;\n    /**\n     * The default value for the attribute for the content table.\n     */\n    _defaultContentTableValue;\n    /**\n     * The default value for the attribute for the layout table.\n     */\n    _defaultLayoutTableValue;\n    /**\n     * Creates a new `TablePropertyCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param attributeName Table cell attribute name.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, attributeName, defaultValue) {\n        super(editor);\n        this.attributeName = attributeName;\n        this._defaultContentTableValue = defaultValue;\n        this._defaultLayoutTableValue = attributeName === 'tableBorderStyle' ? 'none' : undefined;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const table = getSelectionAffectedTable(selection);\n        this._defaultValue = !table || table.getAttribute('tableType') !== 'layout' ?\n            this._defaultContentTableValue :\n            this._defaultLayoutTableValue;\n        this.isEnabled = !!table;\n        this.value = this._getValue(table);\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options.value If set, the command will set the attribute on the selected table.\n     * If not set, the command will remove the attribute from the selected table.\n     * @param options.batch Pass the model batch instance to the command to aggregate changes,\n     * for example, to allow a single undo step for multiple executions.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const { value, batch } = options;\n        const table = getSelectionAffectedTable(selection);\n        const valueToSet = this._getValueToSet(value);\n        model.enqueueChange(batch, writer => {\n            if (valueToSet) {\n                writer.setAttribute(this.attributeName, valueToSet, table);\n            }\n            else {\n                writer.removeAttribute(this.attributeName, table);\n            }\n        });\n    }\n    /**\n     * Returns the attribute value for a table.\n     */\n    _getValue(table) {\n        if (!table) {\n            return;\n        }\n        const value = table.getAttribute(this.attributeName);\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n    /**\n     * Returns the proper model value. It can be used to add a default unit to numeric values.\n     */\n    _getValueToSet(value) {\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\n/**\n * The table background color command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableBackgroundColor'` editor command.\n *\n * To change the background color of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableBackgroundColor', {\n *   value: '#f00'\n * } );\n * ```\n */\nexport class TableBackgroundColorCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableBackgroundColorCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableBackgroundColor', defaultValue);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\nimport { getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table border color command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableBorderColor'` editor command.\n *\n * To change the border color of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableBorderColor', {\n *   value: '#f00'\n * } );\n * ```\n */\nexport class TableBorderColorCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableBorderColorCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableBorderColor', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValue(table) {\n        if (!table) {\n            return;\n        }\n        const value = getSingleValue(table.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\nimport { getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table style border command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableBorderStyle'` editor command.\n *\n * To change the border style of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableBorderStyle', {\n *   value: 'dashed'\n * } );\n * ```\n */\nexport class TableBorderStyleCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableBorderStyleCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableBorderStyle', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValue(table) {\n        if (!table) {\n            return;\n        }\n        const value = getSingleValue(table.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\nimport { addDefaultUnitToNumericValue, getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table width border command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableBorderWidth'` editor command.\n *\n * To change the border width of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableBorderWidth', {\n *   value: '5px'\n * } );\n * ```\n *\n * **Note**: This command adds the default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableBorderWidth', {\n *   value: '5'\n * } );\n * ```\n *\n * will set the `borderWidth` attribute to `'5px'` in the model.\n */\nexport class TableBorderWidthCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableBorderWidthCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableBorderWidth', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValue(table) {\n        if (!table) {\n            return;\n        }\n        const value = getSingleValue(table.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        const newValue = addDefaultUnitToNumericValue(value, 'px');\n        if (newValue === this._defaultValue) {\n            return;\n        }\n        return newValue;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableproperties/commands/tablewidthcommand\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\nimport { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';\n/**\n * The table width command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableWidth'` editor command.\n *\n * To change the width of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableWidth', {\n *   value: '400px'\n * } );\n * ```\n *\n * **Note**: This command adds the default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableWidth', {\n *   value: '50'\n * } );\n * ```\n *\n * will set the `width` attribute to `'50px'` in the model.\n */\nexport class TableWidthCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableWidthCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableWidth', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        value = addDefaultUnitToNumericValue(value, 'px');\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableproperties/commands/tableheightcommand\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\nimport { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';\n/**\n * The table height command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableHeight'` editor command.\n *\n * To change the height of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableHeight', {\n *   value: '500px'\n * } );\n * ```\n *\n * **Note**: This command adds the default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableHeight', {\n *   value: '50'\n * } );\n * ```\n *\n * will set the `height` attribute to `'50px'` in the model.\n */\nexport class TableHeightCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableHeightCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableHeight', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        value = addDefaultUnitToNumericValue(value, 'px');\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TablePropertyCommand } from './tablepropertycommand.js';\n/**\n * The table alignment command.\n *\n * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as\n * the `'tableAlignment'` editor command.\n *\n * To change the alignment of the selected table, execute the command:\n *\n * ```ts\n * editor.execute( 'tableAlignment', {\n *   value: 'right'\n * } );\n * ```\n */\nexport class TableAlignmentCommand extends TablePropertyCommand {\n    /**\n     * Creates a new `TableAlignmentCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value for the \"alignment\" attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableAlignment', defaultValue);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableproperties/tablepropertiesediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { addBackgroundStylesRules, addBorderStylesRules, addMarginStylesRules } from 'ckeditor5/src/engine.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { TableEditing } from '../tableediting.js';\nimport { downcastAttributeToStyle, downcastTableAttribute, getDefaultValueAdjusted, upcastBorderStyles, upcastStyleToAttribute, upcastTableAlignmentConfig, DEFAULT_TABLE_ALIGNMENT_OPTIONS } from '../converters/tableproperties.js';\nimport { TableBackgroundColorCommand } from './commands/tablebackgroundcolorcommand.js';\nimport { TableBorderColorCommand } from './commands/tablebordercolorcommand.js';\nimport { TableBorderStyleCommand } from './commands/tableborderstylecommand.js';\nimport { TableBorderWidthCommand } from './commands/tableborderwidthcommand.js';\nimport { TableWidthCommand } from './commands/tablewidthcommand.js';\nimport { TableHeightCommand } from './commands/tableheightcommand.js';\nimport { TableAlignmentCommand } from './commands/tablealignmentcommand.js';\nimport { getNormalizedDefaultTableProperties } from '../utils/table-properties.js';\nimport { getViewTableFromWrapper } from '../utils/structure.js';\n/**\n * The table properties editing feature.\n *\n * Introduces table's model attributes and their conversion:\n *\n * - border: `tableBorderStyle`, `tableBorderColor` and `tableBorderWidth`\n * - background color: `tableBackgroundColor`\n * - horizontal alignment: `tableAlignment`\n * - width & height: `tableWidth` & `tableHeight`\n *\n * It also registers commands used to manipulate the above attributes:\n *\n * - border: `'tableBorderStyle'`, `'tableBorderColor'` and `'tableBorderWidth'` commands\n * - background color: `'tableBackgroundColor'`\n * - horizontal alignment: `'tableAlignment'`\n * - width & height: `'tableWidth'` & `'tableHeight'`\n */\nexport class TablePropertiesEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TablePropertiesEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'TCP';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        editor.config.define('table.tableProperties.defaultProperties', {});\n        const defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {\n            includeAlignmentProperty: true\n        });\n        const useInlineStyles = editor.config.get('table.tableProperties.alignment.useInlineStyles') !== false;\n        editor.data.addStyleProcessorRules(addMarginStylesRules);\n        editor.data.addStyleProcessorRules(addBorderStylesRules);\n        enableBorderProperties(editor, {\n            color: defaultTableProperties.borderColor,\n            style: defaultTableProperties.borderStyle,\n            width: defaultTableProperties.borderWidth\n        });\n        editor.commands.add('tableBorderColor', new TableBorderColorCommand(editor, defaultTableProperties.borderColor));\n        editor.commands.add('tableBorderStyle', new TableBorderStyleCommand(editor, defaultTableProperties.borderStyle));\n        editor.commands.add('tableBorderWidth', new TableBorderWidthCommand(editor, defaultTableProperties.borderWidth));\n        if (editor.config.get('experimentalFlags.useExtendedTableBlockAlignment')) {\n            enableExtendedAlignmentProperty(schema, conversion, defaultTableProperties.alignment, useInlineStyles);\n        }\n        else {\n            enableAlignmentProperty(schema, conversion, defaultTableProperties.alignment);\n        }\n        editor.commands.add('tableAlignment', new TableAlignmentCommand(editor, defaultTableProperties.alignment));\n        enableTableToFigureProperty(schema, conversion, {\n            modelAttribute: 'tableWidth',\n            styleName: 'width',\n            attributeName: 'width',\n            attributeType: 'length',\n            defaultValue: defaultTableProperties.width\n        });\n        editor.commands.add('tableWidth', new TableWidthCommand(editor, defaultTableProperties.width));\n        enableTableToFigureProperty(schema, conversion, {\n            modelAttribute: 'tableHeight',\n            styleName: 'height',\n            attributeName: 'height',\n            attributeType: 'length',\n            defaultValue: defaultTableProperties.height\n        });\n        editor.commands.add('tableHeight', new TableHeightCommand(editor, defaultTableProperties.height));\n        editor.data.addStyleProcessorRules(addBackgroundStylesRules);\n        enableProperty(schema, conversion, {\n            modelAttribute: 'tableBackgroundColor',\n            styleName: 'background-color',\n            attributeName: 'bgcolor',\n            attributeType: 'color',\n            defaultValue: defaultTableProperties.backgroundColor\n        });\n        editor.commands.add('tableBackgroundColor', new TableBackgroundColorCommand(editor, defaultTableProperties.backgroundColor));\n        if (editor.config.get('experimentalFlags.useExtendedTableBlockAlignment')) {\n            const viewDoc = editor.editing.view.document;\n            // Adjust clipboard output to wrap tables in divs if needed (for alignment).\n            this.listenTo(viewDoc, 'clipboardOutput', (evt, data) => {\n                editor.editing.view.change(writer => {\n                    for (const { item } of writer.createRangeIn(data.content)) {\n                        wrapInDivIfNeeded(item, writer);\n                    }\n                    data.dataTransfer.setData('text/html', this.editor.data.htmlProcessor.toData(data.content));\n                });\n            }, { priority: 'lowest' });\n        }\n    }\n}\n/**\n * Checks whether the view element is a table and if it needs to be wrapped in a div for alignment purposes.\n * If so, it wraps it in a div and inserts it into the data content.\n */\nfunction wrapInDivIfNeeded(viewItem, writer) {\n    if (!viewItem.is('element', 'table')) {\n        return;\n    }\n    const alignAttribute = viewItem.getAttribute('align');\n    const floatAttribute = viewItem.getStyle('float');\n    const marginLeft = viewItem.getStyle('margin-left');\n    const marginRight = viewItem.getStyle('margin-right');\n    if (\n    // Align center.\n    (alignAttribute && alignAttribute === 'center') ||\n        // Align right with text wrapping.\n        (floatAttribute && floatAttribute === 'right' && alignAttribute && alignAttribute === 'right')) {\n        insertWrapperWithAlignment(writer, alignAttribute, viewItem);\n        return;\n    }\n    // Align right with no text wrapping.\n    if (floatAttribute === undefined && marginLeft === 'auto' && marginRight === '0') {\n        insertWrapperWithAlignment(writer, 'right', viewItem);\n    }\n}\nfunction insertWrapperWithAlignment(writer, align, table) {\n    const position = writer.createPositionBefore(table);\n    const wrapper = writer.createContainerElement('div', { align }, table);\n    writer.insert(position, wrapper);\n}\n/**\n * Enables `tableBorderStyle'`, `tableBorderColor'` and `tableBorderWidth'` attributes for table.\n *\n * @param defaultBorder The default border values.\n * @param defaultBorder.color The default `tableBorderColor` value.\n * @param defaultBorder.style The default `tableBorderStyle` value.\n * @param defaultBorder.width The default `tableBorderWidth` value.\n */\nfunction enableBorderProperties(editor, defaultBorder) {\n    const { conversion } = editor;\n    const { schema } = editor.model;\n    const modelAttributes = {\n        width: 'tableBorderWidth',\n        color: 'tableBorderColor',\n        style: 'tableBorderStyle'\n    };\n    schema.extend('table', {\n        allowAttributes: Object.values(modelAttributes)\n    });\n    for (const modelAttribute of Object.values(modelAttributes)) {\n        schema.setAttributeProperties(modelAttribute, { isFormatting: true });\n    }\n    upcastBorderStyles(editor, 'table', modelAttributes, defaultBorder);\n    downcastTableAttribute(conversion, { modelAttribute: modelAttributes.color, styleName: 'border-color' });\n    downcastTableAttribute(conversion, { modelAttribute: modelAttributes.style, styleName: 'border-style' });\n    downcastTableAttribute(conversion, { modelAttribute: modelAttributes.width, styleName: 'border-width' });\n}\n/**\n * Enables the extended block`'alignment'` attribute for table.\n *\n * @param defaultValue The default alignment value.\n */\nfunction enableExtendedAlignmentProperty(schema, conversion, defaultValue, useInlineStyles) {\n    schema.extend('table', {\n        allowAttributes: ['tableAlignment']\n    });\n    schema.setAttributeProperties('tableAlignment', { isFormatting: true });\n    conversion.for('downcast')\n        .attributeToAttribute({\n        model: {\n            name: 'table',\n            key: 'tableAlignment',\n            values: ['left', 'center', 'right', 'blockLeft', 'blockRight']\n        },\n        view: {\n            left: useInlineStyles ? {\n                key: 'style',\n                value: {\n                    float: 'left',\n                    'margin-right': 'var(--ck-content-table-style-spacing, 1.5em)'\n                }\n            } : {\n                key: 'class',\n                value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.left.className\n            },\n            right: useInlineStyles ? {\n                key: 'style',\n                value: {\n                    float: 'right',\n                    'margin-left': 'var(--ck-content-table-style-spacing, 1.5em)'\n                }\n            } : {\n                key: 'class',\n                value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.right.className\n            },\n            center: useInlineStyles ? {\n                key: 'style',\n                value: {\n                    'margin-left': 'auto',\n                    'margin-right': 'auto'\n                }\n            } : {\n                key: 'class',\n                value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.center.className\n            },\n            blockLeft: useInlineStyles ? {\n                key: 'style',\n                value: {\n                    'margin-left': '0',\n                    'margin-right': 'auto'\n                }\n            } : {\n                key: 'class',\n                value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockLeft.className\n            },\n            blockRight: useInlineStyles ? {\n                key: 'style',\n                value: {\n                    'margin-left': 'auto',\n                    'margin-right': '0'\n                }\n            } : {\n                key: 'class',\n                value: DEFAULT_TABLE_ALIGNMENT_OPTIONS.blockRight.className\n            }\n        },\n        converterPriority: 'high'\n    });\n    /**\n     * Enables upcasting of the `tableAlignment` attribute.\n     */\n    upcastTableAlignmentConfig.forEach(config => {\n        conversion.for('upcast').attributeToAttribute({\n            view: config.view,\n            model: {\n                key: 'tableAlignment',\n                value: (viewElement, conversionApi, data) => {\n                    if (isNonTableFigureElement(viewElement)) {\n                        return;\n                    }\n                    const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n                    const align = config.getAlign(viewElement);\n                    const consumables = config.getConsumables(viewElement);\n                    conversionApi.consumable.consume(viewElement, consumables);\n                    if (align !== localDefaultValue) {\n                        return align;\n                    }\n                }\n            }\n        });\n    });\n    conversion.for('upcast').add(upcastTableAlignedDiv(defaultValue));\n}\n/**\n * Enables the `'alignment'` attribute for table.\n *\n * @param defaultValue The default alignment value.\n */\nfunction enableAlignmentProperty(schema, conversion, defaultValue) {\n    const ALIGN_VALUES_REG_EXP = /^(left|center|right)$/;\n    const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;\n    schema.extend('table', {\n        allowAttributes: ['tableAlignment']\n    });\n    schema.setAttributeProperties('tableAlignment', { isFormatting: true });\n    conversion.for('downcast')\n        .attributeToAttribute({\n        model: {\n            name: 'table',\n            key: 'tableAlignment',\n            values: ['left', 'center', 'right']\n        },\n        view: {\n            left: {\n                key: 'style',\n                value: {\n                    float: 'left'\n                }\n            },\n            right: {\n                key: 'style',\n                value: {\n                    float: 'right'\n                }\n            },\n            center: (alignment, conversionApi, data) => {\n                const value = data.item.getAttribute('tableType') !== 'layout' ? {\n                    // Model: `alignment:center` => CSS: `float:none`.\n                    float: 'none'\n                } : {\n                    'margin-left': 'auto',\n                    'margin-right': 'auto'\n                };\n                return {\n                    key: 'style',\n                    value\n                };\n            }\n        },\n        converterPriority: 'high'\n    });\n    conversion.for('upcast')\n        // Support for the `float:*;` CSS definition for the table alignment.\n        .attributeToAttribute({\n        view: {\n            name: /^(table|figure)$/,\n            styles: {\n                float: FLOAT_VALUES_REG_EXP\n            }\n        },\n        model: {\n            key: 'tableAlignment',\n            value: (viewElement, conversionApi, data) => {\n                // Ignore other figure elements.\n                if (viewElement.name == 'figure' && !viewElement.hasClass('table')) {\n                    return;\n                }\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n                let align = viewElement.getStyle('float');\n                // CSS: `float:none` => Model: `alignment:center`.\n                if (align === 'none') {\n                    align = 'center';\n                }\n                if (align !== localDefaultValue) {\n                    return align;\n                }\n                // Consume the style even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { styles: 'float' });\n            }\n        }\n    })\n        // Support for the `margin-left:auto; margin-right:auto;` CSS definition for the table alignment.\n        .attributeToAttribute({\n        view: {\n            name: /^(table|figure)$/,\n            styles: {\n                'margin-left': 'auto',\n                'margin-right': 'auto'\n            }\n        },\n        model: {\n            key: 'tableAlignment',\n            value: (viewElement, conversionApi, data) => {\n                // Ignore other figure elements.\n                if (viewElement.name == 'figure' && !viewElement.hasClass('table')) {\n                    return;\n                }\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n                const align = 'center';\n                if (align !== localDefaultValue) {\n                    return align;\n                }\n                // Consume the styles even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { styles: ['margin-left', 'margin-right'] });\n            }\n        }\n    })\n        // Support for the `align` attribute as the backward compatibility while pasting from other sources.\n        .attributeToAttribute({\n        view: {\n            name: 'table',\n            attributes: {\n                align: ALIGN_VALUES_REG_EXP\n            }\n        },\n        model: {\n            key: 'tableAlignment',\n            value: (viewElement, conversionApi, data) => {\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n                const align = viewElement.getAttribute('align');\n                if (align !== localDefaultValue) {\n                    return align;\n                }\n                // Consume the attribute even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { attributes: 'align' });\n            }\n        }\n    });\n}\n/**\n * Returns a function that converts the table view representation:\n *\n * ```html\n * <div align=\"right\"><table>...</table></div>\n * <!-- or -->\n * <div align=\"center\"><table>...</table></div>\n * <!-- or -->\n * <div align=\"left\"><table>...</table></div>\n * ```\n *\n * to the model representation:\n *\n * ```xml\n * <table tableAlignment=\"right|center|left\"></table>\n * ```\n *\n * @internal\n */\nfunction upcastTableAlignedDiv(defaultValue) {\n    return (dispatcher) => {\n        dispatcher.on('element:div', (evt, data, conversionApi) => {\n            // Do not convert if this is not a \"table wrapped in div with align attribute\".\n            if (!conversionApi.consumable.test(data.viewItem, { name: true, attributes: 'align' })) {\n                return;\n            }\n            // Find a table element inside the div element.\n            const viewTable = getViewTableFromWrapper(data.viewItem);\n            // Do not convert if table element is absent or was already converted.\n            if (!viewTable || !conversionApi.consumable.test(viewTable, { name: true })) {\n                return;\n            }\n            // Consume the div to prevent other converters from processing it again.\n            conversionApi.consumable.consume(data.viewItem, { name: true, attributes: 'align' });\n            // Convert view table to model table.\n            const conversionResult = conversionApi.convertItem(viewTable, data.modelCursor);\n            // Get table element from conversion result.\n            const modelTable = first(conversionResult.modelRange.getItems());\n            // When table wasn't successfully converted then finish conversion.\n            if (!modelTable || !modelTable.is('element', 'table')) {\n                // Revert consumed div so other features can convert it.\n                conversionApi.consumable.revert(data.viewItem, { name: true, attributes: 'align' });\n                // If anyway some table content was converted, we have to pass the model range and cursor.\n                if (conversionResult.modelRange && !conversionResult.modelRange.isCollapsed) {\n                    data.modelRange = conversionResult.modelRange;\n                    data.modelCursor = conversionResult.modelCursor;\n                }\n                return;\n            }\n            const alignAttributeFromDiv = data.viewItem.getAttribute('align');\n            const alignAttributeFromTable = viewTable.getAttribute('align');\n            const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);\n            const align = convertToTableAlignment(alignAttributeFromDiv, alignAttributeFromTable, localDefaultValue);\n            if (align) {\n                conversionApi.writer.setAttribute('tableAlignment', align, modelTable);\n            }\n            conversionApi.convertChildren(data.viewItem, conversionApi.writer.createPositionAt(modelTable, 'end'));\n            conversionApi.updateConversionResult(modelTable, data);\n        });\n    };\n}\n/**\n * Converts div `align` and table `align` attributes to the model `tableAlignment` attribute.\n *\n * @param divAlign The value of the div `align` attribute.\n * @param tableAlign The value of the table `align` attribute.\n * @param defaultValue The default alignment value.\n * @returns The model `tableAlignment` value or `undefined` if no conversion is needed.\n */\nfunction convertToTableAlignment(divAlign, tableAlign, defaultValue) {\n    if (divAlign) {\n        switch (divAlign) {\n            case 'right':\n                if (tableAlign === 'right') {\n                    return 'right';\n                }\n                else if (tableAlign === 'left') {\n                    return 'left';\n                }\n                else {\n                    return 'blockRight';\n                }\n            case 'center':\n                return 'center';\n            case 'left':\n                return tableAlign === undefined ? 'blockLeft' : 'left';\n            default:\n                return defaultValue;\n        }\n    }\n    return undefined;\n}\n/**\n * Enables conversion for an attribute for simple view-model mappings.\n *\n * @param options.defaultValue The default value for the specified `modelAttribute`.\n */\nfunction enableProperty(schema, conversion, options) {\n    const { modelAttribute } = options;\n    schema.extend('table', {\n        allowAttributes: [modelAttribute]\n    });\n    schema.setAttributeProperties(modelAttribute, { isFormatting: true });\n    upcastStyleToAttribute(conversion, { viewElement: 'table', ...options });\n    downcastTableAttribute(conversion, options);\n}\n/**\n * Enables conversion for an attribute for simple view (figure) to model (table) mappings.\n */\nfunction enableTableToFigureProperty(schema, conversion, options) {\n    const { modelAttribute } = options;\n    schema.extend('table', {\n        allowAttributes: [modelAttribute]\n    });\n    schema.setAttributeProperties(modelAttribute, { isFormatting: true });\n    upcastStyleToAttribute(conversion, {\n        viewElement: /^(table|figure)$/,\n        shouldUpcast: (viewElement) => !(viewElement.name == 'table' && viewElement.parent.name == 'figure' ||\n            viewElement.name == 'figure' && !viewElement.hasClass('table')),\n        ...options\n    });\n    downcastAttributeToStyle(conversion, { modelElement: 'table', ...options });\n}\n/**\n * Checks whether a given figure element should be ignored when upcasting table properties.\n */\nfunction isNonTableFigureElement(viewElement) {\n    return viewElement.name == 'figure' && !viewElement.hasClass('table');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/ui/colorinputview\n */\nimport { View, InputTextView, createDropdown, FocusCycler, ViewCollection, ColorSelectorView } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport '../../theme/colorinput.css';\n/**\n * The color input view class. It allows the user to type in a color (hex, rgb, etc.)\n * or choose it from the configurable color palette with a preview.\n *\n * @internal\n */\nexport class ColorInputView extends View {\n    /**\n     * A cached reference to the options passed to the constructor.\n     */\n    options;\n    /**\n     * Tracks information about the DOM focus in the view.\n     */\n    focusTracker;\n    /**\n     * Helps cycling over focusable children in the input view.\n     */\n    focusCycler;\n    /**\n     * A collection of views that can be focused in the view.\n     */\n    _focusables;\n    /**\n     * An instance of the dropdown allowing to select a color from a grid.\n     */\n    dropdownView;\n    /**\n     * An instance of the input allowing the user to type a color value.\n     */\n    inputView;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * The flag that indicates whether the user is still typing.\n     * If set to true, it means that the text input field ({@link #inputView}) still has the focus.\n     * So, we should interrupt the user by replacing the input's value.\n     */\n    _stillTyping;\n    /**\n     * Creates an instance of the color input view.\n     *\n     * @param locale The locale instance.\n     * @param options The input options.\n     * @param options.colorDefinitions The colors to be displayed in the palette inside the input's dropdown.\n     * @param options.columns The number of columns in which the colors will be displayed.\n     * @param options.defaultColorValue If specified, the color input view will replace the \"Remove color\" button with\n     * the \"Restore default\" button. Instead of clearing the input field, the default color value will be set.\n     */\n    constructor(locale, options) {\n        super(locale);\n        this.set('value', '');\n        this.set('isReadOnly', false);\n        this.set('isFocused', false);\n        this.set('isEmpty', true);\n        this.options = options;\n        this.focusTracker = new FocusTracker();\n        this._focusables = new ViewCollection();\n        this.dropdownView = this._createDropdownView();\n        this.inputView = this._createInputTextView();\n        this.keystrokes = new KeystrokeHandler();\n        this._stillTyping = false;\n        this.focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate items backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate items forwards using the <kbd>Tab</kbd> key.\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-input-color'\n                ]\n            },\n            children: [\n                this.dropdownView,\n                this.inputView\n            ]\n        });\n        this.on('change:value', (evt, name, inputValue) => this._setInputValue(inputValue));\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        [this.inputView, this.dropdownView.buttonView].forEach(view => {\n            this.focusTracker.add(view.element);\n            this._focusables.add(view);\n        });\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * Focuses the view.\n     */\n    focus(direction) {\n        if (direction === -1) {\n            this.focusCycler.focusLast();\n        }\n        else {\n            this.focusCycler.focusFirst();\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Creates and configures the {@link #dropdownView}.\n     */\n    _createDropdownView() {\n        const locale = this.locale;\n        const t = locale.t;\n        const bind = this.bindTemplate;\n        const colorSelector = this._createColorSelector(locale);\n        const dropdown = createDropdown(locale);\n        const colorPreview = new View();\n        colorPreview.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-input-color__button__preview'\n                ],\n                style: {\n                    backgroundColor: bind.to('value')\n                }\n            },\n            children: [{\n                    tag: 'span',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-input-color__button__preview__no-color-indicator',\n                            bind.if('value', 'ck-hidden', value => value != '')\n                        ]\n                    }\n                }]\n        });\n        dropdown.buttonView.extendTemplate({\n            attributes: {\n                class: 'ck-input-color__button'\n            }\n        });\n        dropdown.buttonView.children.add(colorPreview);\n        dropdown.buttonView.label = t('Color picker');\n        dropdown.buttonView.tooltip = true;\n        dropdown.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';\n        dropdown.panelView.children.add(colorSelector);\n        dropdown.bind('isEnabled').to(this, 'isReadOnly', value => !value);\n        dropdown.on('change:isOpen', (evt, name, isVisible) => {\n            if (isVisible) {\n                colorSelector.updateSelectedColors();\n                colorSelector.showColorGridsFragment();\n            }\n        });\n        return dropdown;\n    }\n    /**\n     * Creates and configures an instance of {@link module:ui/inputtext/inputtextview~InputTextView}.\n     *\n     * @returns A configured instance to be set as {@link #inputView}.\n     */\n    _createInputTextView() {\n        const locale = this.locale;\n        const inputView = new InputTextView(locale);\n        inputView.extendTemplate({\n            on: {\n                blur: inputView.bindTemplate.to('blur')\n            }\n        });\n        inputView.value = this.value;\n        inputView.bind('isReadOnly', 'hasError').to(this);\n        this.bind('isFocused', 'isEmpty').to(inputView);\n        inputView.on('input', () => {\n            const inputValue = inputView.element.value;\n            // Check if the value matches one of our defined colors' label.\n            const mappedColor = this.options.colorDefinitions.find(def => inputValue === def.label);\n            this._stillTyping = true;\n            this.value = mappedColor && mappedColor.color || inputValue;\n        });\n        inputView.on('blur', () => {\n            this._stillTyping = false;\n            this._setInputValue(inputView.element.value);\n        });\n        inputView.delegate('input').to(this);\n        return inputView;\n    }\n    /**\n     * Creates and configures the panel with \"color grid\" and \"color picker\" inside the {@link #dropdownView}.\n     */\n    _createColorSelector(locale) {\n        const t = locale.t;\n        const defaultColor = this.options.defaultColorValue || '';\n        const removeColorButtonLabel = defaultColor ? t('Restore default') : t('Remove color');\n        const colorSelector = new ColorSelectorView(locale, {\n            colors: this.options.colorDefinitions,\n            columns: this.options.columns,\n            removeButtonLabel: removeColorButtonLabel,\n            colorPickerLabel: t('Color picker'),\n            colorPickerViewConfig: this.options.colorPickerConfig === false ? false : {\n                ...this.options.colorPickerConfig,\n                hideInput: true\n            }\n        });\n        colorSelector.appendUI();\n        colorSelector.on('execute', (evt, data) => {\n            if (data.source === 'colorPickerSaveButton') {\n                this.dropdownView.isOpen = false;\n                return;\n            }\n            this.value = data.value || defaultColor;\n            // Trigger the listener that actually applies the set value.\n            this.fire('input');\n            if (data.source !== 'colorPicker') {\n                this.dropdownView.isOpen = false;\n            }\n        });\n        /**\n         * Color is saved before changes in color picker. In case \"cancel button\" is pressed\n         * this color will be applied.\n         */\n        let backupColor = this.value;\n        colorSelector.on('colorPicker:cancel', () => {\n            /**\n             * Revert color to previous value before changes in color picker.\n             */\n            this.value = backupColor;\n            this.fire('input');\n            this.dropdownView.isOpen = false;\n        });\n        colorSelector.colorGridsFragmentView.colorPickerButtonView.on('execute', () => {\n            /**\n             * Save color value before changes in color picker.\n             */\n            backupColor = this.value;\n        });\n        colorSelector.bind('selectedColor').to(this, 'value');\n        return colorSelector;\n    }\n    /**\n     * Sets {@link #inputView}'s value property to the color value or color label,\n     * if there is one and the user is not typing.\n     *\n     * Handles cases like:\n     *\n     * * Someone picks the color in the grid.\n     * * The color is set from the plugin level.\n     *\n     * @param inputValue Color value to be set.\n     */\n    _setInputValue(inputValue) {\n        if (!this._stillTyping) {\n            const normalizedInputValue = normalizeColor(inputValue);\n            // Check if the value matches one of our defined colors.\n            const mappedColor = this.options.colorDefinitions.find(def => normalizedInputValue === normalizeColor(def.color));\n            if (mappedColor) {\n                this.inputView.value = mappedColor.label;\n            }\n            else {\n                this.inputView.value = inputValue || '';\n            }\n        }\n    }\n}\n/**\n * Normalizes color value, by stripping extensive whitespace.\n * For example., transforms:\n * * `   rgb(  25 50    0 )` to `rgb(25 50 0)`,\n * * \"\\t  rgb(  25 ,  50,0 )\t\t\" to `rgb(25 50 0)`.\n *\n * @param colorString The value to be normalized.\n */\nfunction normalizeColor(colorString) {\n    return colorString\n        // Remove any whitespace right after `(` or `,`.\n        .replace(/([(,])\\s+/g, '$1')\n        // Remove any whitespace at the beginning or right before the end, `)`, `,`, or another whitespace.\n        .replace(/^\\s+|\\s+(?=[),\\s]|$)/g, '')\n        // Then, replace `,` or whitespace with a single space.\n        .replace(/,|\\s/g, ' ');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/utils/ui/table-properties\n */\nimport { ButtonView, UIModel } from 'ckeditor5/src/ui.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { isColorStyleValue, isLengthStyleValue, isPercentageStyleValue } from 'ckeditor5/src/engine.js';\nimport { ColorInputView } from '../../ui/colorinputview.js';\nconst isEmpty = (val) => val === '';\n/**\n * Returns an object containing pairs of CSS border style values and their localized UI\n * labels. Used by {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}\n * and {@link module:table/tableproperties/ui/tablepropertiesview~TablePropertiesView}.\n *\n * @internal\n * @param t The \"t\" function provided by the editor that is used to localize strings.\n */\nexport function getBorderStyleLabels(t) {\n    return {\n        none: t('None'),\n        solid: t('Solid'),\n        dotted: t('Dotted'),\n        dashed: t('Dashed'),\n        double: t('Double'),\n        groove: t('Groove'),\n        ridge: t('Ridge'),\n        inset: t('Inset'),\n        outset: t('Outset')\n    };\n}\n/**\n * Returns a localized error string that can be displayed next to color (background, border)\n * fields that have an invalid value.\n *\n * @internal\n * @param t The \"t\" function provided by the editor that is used to localize strings.\n */\nexport function getLocalizedColorErrorText(t) {\n    return t('The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\".');\n}\n/**\n * Returns a localized error string that can be displayed next to length (padding, border width)\n * fields that have an invalid value.\n *\n * @internal\n * @param t The \"t\" function provided by the editor that is used to localize strings.\n */\nexport function getLocalizedLengthErrorText(t) {\n    return t('The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".');\n}\n/**\n * Returns `true` when the passed value is an empty string or a valid CSS color expression.\n * Otherwise, `false` is returned.\n *\n * See {@link module:engine/view/styles/utils~isColorStyleValue}.\n *\n * @internal\n */\nexport function colorFieldValidator(value) {\n    value = value.trim().toLowerCase();\n    return isEmpty(value) || isColorStyleValue(value);\n}\n/**\n * Returns `true` when the passed value is an empty string, a number without a unit or a valid CSS length expression.\n * Otherwise, `false` is returned.\n *\n * See {@link module:engine/view/styles/utils~isLengthStyleValue}.\n * See {@link module:engine/view/styles/utils~isPercentageStyleValue}.\n *\n * @internal\n */\nexport function lengthFieldValidator(value) {\n    value = value.trim();\n    return isEmpty(value) || isNumberString(value) || isLengthStyleValue(value) || isPercentageStyleValue(value);\n}\n/**\n * Returns `true` when the passed value is an empty string, a number without a unit or a valid CSS length expression.\n * Otherwise, `false` is returned.\n *\n * See {@link module:engine/view/styles/utils~isLengthStyleValue}.\n *\n * @internal\n */\nexport function lineWidthFieldValidator(value) {\n    value = value.trim();\n    return isEmpty(value) || isNumberString(value) || isLengthStyleValue(value);\n}\n/**\n * Generates item definitions for a UI dropdown that allows changing the border style of a table or a table cell.\n *\n * @internal\n * @param defaultStyle The default border.\n */\nexport function getBorderStyleDefinitions(view, defaultStyle) {\n    const itemDefinitions = new Collection();\n    const styleLabels = getBorderStyleLabels(view.t);\n    for (const style in styleLabels) {\n        const definition = {\n            type: 'button',\n            model: new UIModel({\n                _borderStyleValue: style,\n                label: styleLabels[style],\n                role: 'menuitemradio',\n                withText: true\n            })\n        };\n        if (style === 'none') {\n            definition.model.bind('isOn').to(view, 'borderStyle', value => {\n                if (defaultStyle === 'none') {\n                    return !value;\n                }\n                return value === style;\n            });\n        }\n        else {\n            definition.model.bind('isOn').to(view, 'borderStyle', value => {\n                return value === style;\n            });\n        }\n        itemDefinitions.add(definition);\n    }\n    return itemDefinitions;\n}\n/**\n * A helper that fills a toolbar with buttons that:\n *\n * * have some labels,\n * * have some icons,\n * * set a certain UI view property value upon execution.\n *\n * @internal\n * @param options Configuration options\n * @param options.view The view that has the observable property.\n * @param options.icons Object with button icons.\n * @param options.toolbar The toolbar to fill with buttons.\n * @param options.labels Object with button labels.\n * @param options.propertyName The name of the observable property in the view.\n * @param options.nameToValue A function that maps a button name to a value. By default names are the same as values.\n * @param options.defaultValue Default value for the property.\n */\nexport function fillToolbar(options) {\n    const { view, icons, toolbar, labels, propertyName, nameToValue, defaultValue } = options;\n    for (const name in labels) {\n        const button = new ButtonView(view.locale);\n        button.set({\n            role: 'radio',\n            isToggleable: true,\n            label: labels[name],\n            icon: icons[name],\n            tooltip: labels[name]\n        });\n        // If specified the `nameToValue()` callback, map the value based on the option's name.\n        const buttonValue = nameToValue ? nameToValue(name) : name;\n        button.bind('isOn').to(view, propertyName, value => {\n            // `value` comes from `view[ propertyName ]`.\n            let valueToCompare = value;\n            // If it's empty, and the `defaultValue` is specified, use it instead.\n            if (value === '' && defaultValue) {\n                valueToCompare = defaultValue;\n            }\n            return buttonValue === valueToCompare;\n        });\n        button.on('execute', () => {\n            // Allow toggling alignment if there is no default value specified (especially for layout tables).\n            if (!defaultValue && buttonValue && view[propertyName] === buttonValue) {\n                view[propertyName] = undefined;\n            }\n            else {\n                view[propertyName] = buttonValue;\n            }\n        });\n        toolbar.items.add(button);\n    }\n}\n/**\n * A default color palette used by various user interfaces related to tables, for instance,\n * by {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI} or\n * {@link module:table/tableproperties/tablepropertiesui~TablePropertiesUI}.\n *\n * The color palette follows the {@link module:table/tableconfig~TableColorConfig table color configuration format}\n * and contains the following color definitions:\n *\n * ```ts\n * const defaultColors = [\n *   {\n *     color: 'hsl(0, 0%, 0%)',\n *     label: 'Black'\n *   },\n *   {\n *     color: 'hsl(0, 0%, 30%)',\n *     label: 'Dim grey'\n *   },\n *   {\n *     color: 'hsl(0, 0%, 60%)',\n *     label: 'Grey'\n *   },\n *   {\n *     color: 'hsl(0, 0%, 90%)',\n *     label: 'Light grey'\n *   },\n *   {\n *     color: 'hsl(0, 0%, 100%)',\n *     label: 'White',\n *     hasBorder: true\n *   },\n *   {\n *     color: 'hsl(0, 75%, 60%)',\n *     label: 'Red'\n *   },\n *   {\n *     color: 'hsl(30, 75%, 60%)',\n *     label: 'Orange'\n *   },\n *   {\n *     color: 'hsl(60, 75%, 60%)',\n *     label: 'Yellow'\n *   },\n *   {\n *     color: 'hsl(90, 75%, 60%)',\n *     label: 'Light green'\n *   },\n *   {\n *     color: 'hsl(120, 75%, 60%)',\n *     label: 'Green'\n *   },\n *   {\n *     color: 'hsl(150, 75%, 60%)',\n *     label: 'Aquamarine'\n *   },\n *   {\n *     color: 'hsl(180, 75%, 60%)',\n *     label: 'Turquoise'\n *   },\n *   {\n *     color: 'hsl(210, 75%, 60%)',\n *     label: 'Light blue'\n *   },\n *   {\n *     color: 'hsl(240, 75%, 60%)',\n *     label: 'Blue'\n *   },\n *   {\n *     color: 'hsl(270, 75%, 60%)',\n *     label: 'Purple'\n *   }\n * ];\n * ```\n *\n * @internal\n */\nexport const defaultColors = [\n    {\n        color: 'hsl(0, 0%, 0%)',\n        label: 'Black'\n    },\n    {\n        color: 'hsl(0, 0%, 30%)',\n        label: 'Dim grey'\n    },\n    {\n        color: 'hsl(0, 0%, 60%)',\n        label: 'Grey'\n    },\n    {\n        color: 'hsl(0, 0%, 90%)',\n        label: 'Light grey'\n    },\n    {\n        color: 'hsl(0, 0%, 100%)',\n        label: 'White',\n        hasBorder: true\n    },\n    {\n        color: 'hsl(0, 75%, 60%)',\n        label: 'Red'\n    },\n    {\n        color: 'hsl(30, 75%, 60%)',\n        label: 'Orange'\n    },\n    {\n        color: 'hsl(60, 75%, 60%)',\n        label: 'Yellow'\n    },\n    {\n        color: 'hsl(90, 75%, 60%)',\n        label: 'Light green'\n    },\n    {\n        color: 'hsl(120, 75%, 60%)',\n        label: 'Green'\n    },\n    {\n        color: 'hsl(150, 75%, 60%)',\n        label: 'Aquamarine'\n    },\n    {\n        color: 'hsl(180, 75%, 60%)',\n        label: 'Turquoise'\n    },\n    {\n        color: 'hsl(210, 75%, 60%)',\n        label: 'Light blue'\n    },\n    {\n        color: 'hsl(240, 75%, 60%)',\n        label: 'Blue'\n    },\n    {\n        color: 'hsl(270, 75%, 60%)',\n        label: 'Purple'\n    }\n];\n/**\n * Returns a creator for a color input with a label.\n *\n * For given options, it returns a function that creates an instance of a\n * {@link module:table/ui/colorinputview~ColorInputView color input} logically related to\n * a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled view} in the DOM.\n *\n * The helper does the following:\n *\n * * It sets the color input `id` and `ariaDescribedById` attributes.\n * * It binds the color input `isReadOnly` to the labeled view.\n * * It binds the color input `hasError` to the labeled view.\n * * It enables a logic that cleans up the error when the user starts typing in the color input.\n *\n * Usage:\n *\n * ```ts\n * const colorInputCreator = getLabeledColorInputCreator( {\n *   colorConfig: [ ... ],\n *   columns: 3,\n * } );\n *\n * const labeledInputView = new LabeledFieldView( locale, colorInputCreator );\n * console.log( labeledInputView.view ); // A color input instance.\n * ```\n *\n * @internal\n * @param options Color input options.\n * @param options.colorConfig The configuration of the color palette displayed in the input's dropdown.\n * @param options.columns The configuration of the number of columns the color palette consists of in the input's dropdown.\n * @param options.defaultColorValue If specified, the color input view will replace the \"Remove color\" button with\n * the \"Restore default\" button. Instead of clearing the input field, the default color value will be set.\n * @param options.colorPickerConfig The configuration of the color picker. You could disable it or define your output format.\n */\nexport function getLabeledColorInputCreator(options) {\n    return (labeledFieldView, viewUid, statusUid) => {\n        const colorInputView = new ColorInputView(labeledFieldView.locale, {\n            colorDefinitions: colorConfigToColorGridDefinitions(options.colorConfig),\n            columns: options.columns,\n            defaultColorValue: options.defaultColorValue,\n            colorPickerConfig: options.colorPickerConfig\n        });\n        colorInputView.inputView.set({\n            id: viewUid,\n            ariaDescribedById: statusUid\n        });\n        colorInputView.bind('isReadOnly').to(labeledFieldView, 'isEnabled', value => !value);\n        colorInputView.bind('hasError').to(labeledFieldView, 'errorText', value => !!value);\n        colorInputView.on('input', () => {\n            // UX: Make the error text disappear and disable the error indicator as the user\n            // starts fixing the errors.\n            labeledFieldView.errorText = null;\n        });\n        labeledFieldView.bind('isEmpty', 'isFocused').to(colorInputView);\n        return colorInputView;\n    };\n}\n/**\n * A simple helper method to detect number strings.\n * I allows full number notation, so omitting 0 is not allowed:\n */\nfunction isNumberString(value) {\n    const parsedValue = parseFloat(value);\n    return !Number.isNaN(parsedValue) && value === String(parsedValue);\n}\nfunction colorConfigToColorGridDefinitions(colorConfig) {\n    return colorConfig.map(item => ({\n        color: item.model,\n        label: item.label,\n        options: {\n            hasBorder: item.hasBorder\n        }\n    }));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableproperties/ui/tablepropertiesview\n */\nimport { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormRowView, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { IconCancel, IconCheck, IconObjectCenter, IconObjectInlineLeft, IconObjectInlineRight } from 'ckeditor5/src/icons.js';\nimport { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/form/form.css';\nimport '../../../theme/formrow.css';\nimport '../../../theme/tableform.css';\nimport '../../../theme/tableproperties.css';\n/**\n * The class representing a table properties form, allowing users to customize\n * certain style aspects of a table, for instance, border, background color, alignment, etc..\n */\nexport class TablePropertiesView extends View {\n    /**\n     * Options passed to the view. See {@link #constructor} to learn more.\n     */\n    options;\n    /**\n     * Tracks information about the DOM focus in the form.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of child views in the form.\n     */\n    children;\n    /**\n     * A dropdown that allows selecting the style of the table border.\n     */\n    borderStyleDropdown;\n    /**\n     * An input that allows specifying the width of the table border.\n     */\n    borderWidthInput;\n    /**\n     * An input that allows specifying the color of the table border.\n     */\n    borderColorInput;\n    /**\n     * An input that allows specifying the table background color.\n     */\n    backgroundInput;\n    /**\n     * An input that allows specifying the table width.\n     */\n    widthInput;\n    /**\n     * An input that allows specifying the table height.\n     */\n    heightInput;\n    /**\n     * A toolbar with buttons that allow changing the alignment of an entire table.\n     */\n    alignmentToolbar;\n    /**\n     * The \"Save\" button view.\n     */\n    saveButtonView;\n    /**\n     * The \"Cancel\" button view.\n     */\n    cancelButtonView;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param options Additional configuration of the view.\n     */\n    constructor(locale, options) {\n        super(locale);\n        this.set({\n            borderStyle: '',\n            borderWidth: '',\n            borderColor: '',\n            backgroundColor: '',\n            width: '',\n            height: '',\n            alignment: ''\n        });\n        this.options = options;\n        const { borderStyleDropdown, borderWidthInput, borderColorInput, borderRowLabel } = this._createBorderFields();\n        const { backgroundRowLabel, backgroundInput } = this._createBackgroundFields();\n        const { widthInput, operatorLabel, heightInput, dimensionsLabel } = this._createDimensionFields();\n        const { alignmentToolbar, alignmentLabel } = this._createAlignmentFields();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.children = this.createCollection();\n        this.borderStyleDropdown = borderStyleDropdown;\n        this.borderWidthInput = borderWidthInput;\n        this.borderColorInput = borderColorInput;\n        this.backgroundInput = backgroundInput;\n        this.widthInput = widthInput;\n        this.heightInput = heightInput;\n        this.alignmentToolbar = alignmentToolbar;\n        // Defer creating to make sure other fields are present and the Save button can\n        // bind its #isEnabled to their error messages so there's no way to save unless all\n        // fields are valid.\n        const { saveButtonView, cancelButtonView } = this._createActionButtons();\n        this.saveButtonView = saveButtonView;\n        this.cancelButtonView = cancelButtonView;\n        this._focusables = new ViewCollection();\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        // Form header.\n        this.children.add(new FormHeaderView(locale, {\n            label: this.t('Table properties')\n        }));\n        // Border row.\n        this.children.add(new FormRowView(locale, {\n            labelView: borderRowLabel,\n            children: [\n                borderRowLabel,\n                borderStyleDropdown,\n                borderColorInput,\n                borderWidthInput\n            ],\n            class: 'ck-table-form__border-row'\n        }));\n        // Background row.\n        this.children.add(new FormRowView(locale, {\n            labelView: backgroundRowLabel,\n            children: [\n                backgroundRowLabel,\n                backgroundInput\n            ],\n            class: 'ck-table-form__background-row'\n        }));\n        this.children.add(new FormRowView(locale, {\n            children: [\n                // Dimensions row.\n                new FormRowView(locale, {\n                    labelView: dimensionsLabel,\n                    children: [\n                        dimensionsLabel,\n                        widthInput,\n                        operatorLabel,\n                        heightInput\n                    ],\n                    class: 'ck-table-form__dimensions-row'\n                }),\n                // Alignment row.\n                new FormRowView(locale, {\n                    labelView: alignmentLabel,\n                    children: [\n                        alignmentLabel,\n                        alignmentToolbar\n                    ],\n                    class: 'ck-table-properties-form__alignment-row'\n                })\n            ]\n        }));\n        // Action row.\n        this.children.add(new FormRowView(locale, {\n            children: [\n                this.saveButtonView,\n                this.cancelButtonView\n            ],\n            class: 'ck-table-form__action-row'\n        }));\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form',\n                    'ck-table-form',\n                    'ck-table-properties-form'\n                ],\n                // https://github.com/ckeditor/ckeditor5-link/issues/90\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Enable the \"submit\" event for this view. It can be triggered by the #saveButtonView\n        // which is of the \"submit\" DOM \"type\".\n        submitHandler({\n            view: this\n        });\n        // Maintain continuous focus cycling over views that have focusable children and focus cyclers themselves.\n        [this.borderColorInput, this.backgroundInput].forEach(view => {\n            this._focusCycler.chain(view.fieldView.focusCycler);\n        });\n        [\n            this.borderStyleDropdown,\n            this.borderColorInput,\n            this.borderWidthInput,\n            this.backgroundInput,\n            this.widthInput,\n            this.heightInput,\n            this.alignmentToolbar,\n            this.saveButtonView,\n            this.cancelButtonView\n        ].forEach(view => {\n            // Register the view as focusable.\n            this._focusables.add(view);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(view.element);\n        });\n        // Mainly for closing using \"Esc\" and navigation using \"Tab\".\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the fist focusable field in the form.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #borderStyleDropdown},\n     * * {@link #borderWidthInput},\n     * * {@link #borderColorInput}.\n     */\n    _createBorderFields() {\n        const defaultTableProperties = this.options.defaultTableProperties;\n        const defaultBorder = {\n            style: defaultTableProperties.borderStyle,\n            width: defaultTableProperties.borderWidth,\n            color: defaultTableProperties.borderColor\n        };\n        const colorInputCreator = getLabeledColorInputCreator({\n            colorConfig: this.options.borderColors,\n            columns: 5,\n            defaultColorValue: defaultBorder.color,\n            colorPickerConfig: this.options.colorPickerConfig\n        });\n        const locale = this.locale;\n        const t = this.t;\n        const accessibleLabel = t('Style');\n        // -- Group label ---------------------------------------------\n        const borderRowLabel = new LabelView(locale);\n        borderRowLabel.text = t('Border');\n        // -- Style ---------------------------------------------------\n        const styleLabels = getBorderStyleLabels(t);\n        const borderStyleDropdown = new LabeledFieldView(locale, createLabeledDropdown);\n        borderStyleDropdown.set({\n            label: accessibleLabel,\n            class: 'ck-table-form__border-style'\n        });\n        borderStyleDropdown.fieldView.buttonView.set({\n            ariaLabel: accessibleLabel,\n            ariaLabelledBy: undefined,\n            isOn: false,\n            withText: true,\n            tooltip: accessibleLabel\n        });\n        borderStyleDropdown.fieldView.buttonView.bind('label').to(this, 'borderStyle', value => {\n            return styleLabels[value ? value : 'none'];\n        });\n        borderStyleDropdown.fieldView.on('execute', evt => {\n            this.borderStyle = evt.source._borderStyleValue;\n        });\n        borderStyleDropdown.bind('isEmpty').to(this, 'borderStyle', value => !value);\n        addListToDropdown(borderStyleDropdown.fieldView, getBorderStyleDefinitions(this, defaultBorder.style), {\n            role: 'menu',\n            ariaLabel: accessibleLabel\n        });\n        // -- Width ---------------------------------------------------\n        const borderWidthInput = new LabeledFieldView(locale, createLabeledInputText);\n        borderWidthInput.set({\n            label: t('Width'),\n            class: 'ck-table-form__border-width'\n        });\n        borderWidthInput.fieldView.bind('value').to(this, 'borderWidth');\n        borderWidthInput.bind('isEnabled').to(this, 'borderStyle', isBorderStyleSet);\n        borderWidthInput.fieldView.on('input', () => {\n            this.borderWidth = borderWidthInput.fieldView.element.value;\n        });\n        // -- Color ---------------------------------------------------\n        const borderColorInput = new LabeledFieldView(locale, colorInputCreator);\n        borderColorInput.set({\n            label: t('Color'),\n            class: 'ck-table-form__border-color'\n        });\n        borderColorInput.fieldView.bind('value').to(this, 'borderColor');\n        borderColorInput.bind('isEnabled').to(this, 'borderStyle', isBorderStyleSet);\n        borderColorInput.fieldView.on('input', () => {\n            this.borderColor = borderColorInput.fieldView.value;\n        });\n        // Reset the border color and width fields depending on the `border-style` value.\n        this.on('change:borderStyle', (evt, name, newValue, oldValue) => {\n            // When removing the border (`border-style:none`), clear the remaining `border-*` properties.\n            // See: https://github.com/ckeditor/ckeditor5/issues/6227.\n            if (!isBorderStyleSet(newValue)) {\n                this.borderColor = '';\n                this.borderWidth = '';\n            }\n            // When setting the `border-style` from `none`, set the default `border-color` and `border-width` properties.\n            if (!isBorderStyleSet(oldValue)) {\n                this.borderColor = defaultBorder.color;\n                this.borderWidth = defaultBorder.width;\n            }\n        });\n        return {\n            borderRowLabel,\n            borderStyleDropdown,\n            borderColorInput,\n            borderWidthInput\n        };\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #backgroundInput}.\n     */\n    _createBackgroundFields() {\n        const locale = this.locale;\n        const t = this.t;\n        // -- Group label ---------------------------------------------\n        const backgroundRowLabel = new LabelView(locale);\n        backgroundRowLabel.text = t('Background');\n        // -- Background color input -----------------------------------\n        const backgroundInputCreator = getLabeledColorInputCreator({\n            colorConfig: this.options.backgroundColors,\n            columns: 5,\n            defaultColorValue: this.options.defaultTableProperties.backgroundColor,\n            colorPickerConfig: this.options.colorPickerConfig\n        });\n        const backgroundInput = new LabeledFieldView(locale, backgroundInputCreator);\n        backgroundInput.set({\n            label: t('Color'),\n            class: 'ck-table-properties-form__background'\n        });\n        backgroundInput.fieldView.bind('value').to(this, 'backgroundColor');\n        backgroundInput.fieldView.on('input', () => {\n            this.backgroundColor = backgroundInput.fieldView.value;\n        });\n        return {\n            backgroundRowLabel,\n            backgroundInput\n        };\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #widthInput},\n     * * {@link #heightInput}.\n     */\n    _createDimensionFields() {\n        const locale = this.locale;\n        const t = this.t;\n        // -- Label ---------------------------------------------------\n        const dimensionsLabel = new LabelView(locale);\n        dimensionsLabel.text = t('Dimensions');\n        // -- Width ---------------------------------------------------\n        const widthInput = new LabeledFieldView(locale, createLabeledInputText);\n        widthInput.set({\n            label: t('Width'),\n            class: 'ck-table-form__dimensions-row__width'\n        });\n        widthInput.fieldView.bind('value').to(this, 'width');\n        widthInput.fieldView.on('input', () => {\n            this.width = widthInput.fieldView.element.value;\n        });\n        // -- Operator ---------------------------------------------------\n        const operatorLabel = new View(locale);\n        operatorLabel.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck-table-form__dimension-operator'\n                ]\n            },\n            children: [\n                { text: '×' }\n            ]\n        });\n        // -- Height ---------------------------------------------------\n        const heightInput = new LabeledFieldView(locale, createLabeledInputText);\n        heightInput.set({\n            label: t('Height'),\n            class: 'ck-table-form__dimensions-row__height'\n        });\n        heightInput.fieldView.bind('value').to(this, 'height');\n        heightInput.fieldView.on('input', () => {\n            this.height = heightInput.fieldView.element.value;\n        });\n        return {\n            dimensionsLabel,\n            widthInput,\n            operatorLabel,\n            heightInput\n        };\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #alignmentToolbar}.\n     */\n    _createAlignmentFields() {\n        const locale = this.locale;\n        const t = this.t;\n        // -- Label ---------------------------------------------------\n        const alignmentLabel = new LabelView(locale);\n        alignmentLabel.text = t('Alignment');\n        // -- Toolbar ---------------------------------------------------\n        const alignmentToolbar = new ToolbarView(locale);\n        alignmentToolbar.set({\n            role: 'radiogroup',\n            isCompact: true,\n            ariaLabel: t('Table alignment toolbar')\n        });\n        fillToolbar({\n            view: this,\n            icons: {\n                left: IconObjectInlineLeft,\n                center: IconObjectCenter,\n                right: IconObjectInlineRight\n            },\n            toolbar: alignmentToolbar,\n            labels: this._alignmentLabels,\n            propertyName: 'alignment',\n            defaultValue: this.options.defaultTableProperties.alignment\n        });\n        return {\n            alignmentLabel,\n            alignmentToolbar\n        };\n    }\n    /**\n     * Creates the following form controls:\n     *\n     * * {@link #saveButtonView},\n     * * {@link #cancelButtonView}.\n     */\n    _createActionButtons() {\n        const locale = this.locale;\n        const t = this.t;\n        const saveButtonView = new ButtonView(locale);\n        const cancelButtonView = new ButtonView(locale);\n        const fieldsThatShouldValidateToSave = [\n            this.borderWidthInput,\n            this.borderColorInput,\n            this.backgroundInput,\n            this.widthInput,\n            this.heightInput\n        ];\n        saveButtonView.set({\n            label: t('Save'),\n            icon: IconCheck,\n            class: 'ck-button-save',\n            type: 'submit',\n            withText: true\n        });\n        saveButtonView.bind('isEnabled').toMany(fieldsThatShouldValidateToSave, 'errorText', (...errorTexts) => {\n            return errorTexts.every(errorText => !errorText);\n        });\n        cancelButtonView.set({\n            label: t('Cancel'),\n            icon: IconCancel,\n            class: 'ck-button-cancel',\n            withText: true\n        });\n        cancelButtonView.delegate('execute').to(this, 'cancel');\n        return {\n            saveButtonView, cancelButtonView\n        };\n    }\n    /**\n     * Provides localized labels for {@link #alignmentToolbar} buttons.\n     */\n    get _alignmentLabels() {\n        const locale = this.locale;\n        const t = this.t;\n        const left = t('Align table to the left');\n        const center = t('Center table');\n        const right = t('Align table to the right');\n        // Returns object with a proper order of labels.\n        if (locale.uiLanguageDirection === 'rtl') {\n            return { right, center, left };\n        }\n        else {\n            return { left, center, right };\n        }\n    }\n}\nfunction isBorderStyleSet(value) {\n    return value !== 'none';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/utils/ui/contextualballoon\n */\nimport { Rect } from 'ckeditor5/src/utils.js';\nimport { BalloonPanelView } from 'ckeditor5/src/ui.js';\nimport { getSelectionAffectedTableWidget, getTableWidgetAncestor } from './widget.js';\nimport { getSelectionAffectedTable } from '../common.js';\nconst BALLOON_POSITIONS = /* #__PURE__ */ (() => [\n    BalloonPanelView.defaultPositions.northArrowSouth,\n    BalloonPanelView.defaultPositions.northArrowSouthWest,\n    BalloonPanelView.defaultPositions.northArrowSouthEast,\n    BalloonPanelView.defaultPositions.southArrowNorth,\n    BalloonPanelView.defaultPositions.southArrowNorthWest,\n    BalloonPanelView.defaultPositions.southArrowNorthEast,\n    BalloonPanelView.defaultPositions.viewportStickyNorth\n])();\n/**\n * A helper utility that positions the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} instance\n * with respect to the table in the editor content, if one is selected.\n *\n * @internal\n * @param editor The editor instance.\n * @param target Either \"cell\" or \"table\". Determines the target the balloon will be attached to.\n */\nexport function repositionContextualBalloon(editor, target) {\n    const balloon = editor.plugins.get('ContextualBalloon');\n    const selection = editor.editing.view.document.selection;\n    let position;\n    if (target === 'cell') {\n        if (getTableWidgetAncestor(selection)) {\n            position = getBalloonCellPositionData(editor);\n        }\n    }\n    else if (getSelectionAffectedTableWidget(selection)) {\n        position = getBalloonTablePositionData(editor);\n    }\n    if (position) {\n        balloon.updatePosition(position);\n    }\n}\n/**\n * Returns the positioning options that control the geometry of the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} with respect\n * to the selected table in the editor content.\n *\n * @param editor The editor instance.\n */\nexport function getBalloonTablePositionData(editor) {\n    const selection = editor.model.document.selection;\n    const modelTable = getSelectionAffectedTable(selection);\n    const viewTable = editor.editing.mapper.toViewElement(modelTable);\n    return {\n        target: editor.editing.view.domConverter.mapViewToDom(viewTable),\n        positions: BALLOON_POSITIONS\n    };\n}\n/**\n * Returns the positioning options that control the geometry of the\n * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon} with respect\n * to the selected table cell in the editor content.\n *\n * @param editor The editor instance.\n * @internal\n */\nexport function getBalloonCellPositionData(editor) {\n    const mapper = editor.editing.mapper;\n    const domConverter = editor.editing.view.domConverter;\n    const selection = editor.model.document.selection;\n    if (selection.rangeCount > 1) {\n        return {\n            target: () => createBoundingRect(selection.getRanges(), editor),\n            positions: BALLOON_POSITIONS\n        };\n    }\n    const modelTableCell = getTableCellAtPosition(selection.getFirstPosition());\n    const viewTableCell = mapper.toViewElement(modelTableCell);\n    return {\n        target: domConverter.mapViewToDom(viewTableCell),\n        positions: BALLOON_POSITIONS\n    };\n}\n/**\n * Returns the first selected table cell from a multi-cell or in-cell selection.\n *\n * @param position Document position.\n */\nfunction getTableCellAtPosition(position) {\n    const isTableCellSelected = position.nodeAfter && position.nodeAfter.is('element', 'tableCell');\n    return isTableCellSelected ? position.nodeAfter : position.findAncestor('tableCell');\n}\n/**\n * Returns bounding rectangle for given model ranges.\n *\n * @param ranges Model ranges that the bounding rect should be returned for.\n * @param editor The editor instance.\n */\nfunction createBoundingRect(ranges, editor) {\n    const mapper = editor.editing.mapper;\n    const domConverter = editor.editing.view.domConverter;\n    const rects = Array.from(ranges).map(range => {\n        const modelTableCell = getTableCellAtPosition(range.start);\n        const viewTableCell = mapper.toViewElement(modelTableCell);\n        return new Rect(domConverter.mapViewToDom(viewTableCell));\n    });\n    return Rect.getBoundingRect(rects);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableproperties/tablepropertiesui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconTableProperties } from 'ckeditor5/src/icons.js';\nimport { ButtonView, ContextualBalloon, clickOutsideHandler, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';\nimport { debounce } from 'es-toolkit/compat';\nimport { TablePropertiesView } from './ui/tablepropertiesview.js';\nimport { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties.js';\nimport { getSelectionAffectedTableWidget } from '../utils/ui/widget.js';\nimport { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';\nimport { getNormalizedDefaultProperties, getNormalizedDefaultTableProperties } from '../utils/table-properties.js';\nconst ERROR_TEXT_TIMEOUT = 500;\n// Map of view properties and related commands.\nconst propertyToCommandMap = {\n    borderStyle: 'tableBorderStyle',\n    borderColor: 'tableBorderColor',\n    borderWidth: 'tableBorderWidth',\n    backgroundColor: 'tableBackgroundColor',\n    width: 'tableWidth',\n    height: 'tableHeight',\n    alignment: 'tableAlignment'\n};\n/**\n * The table properties UI plugin. It introduces the `'tableProperties'` button\n * that opens a form allowing to specify visual styling of an entire table.\n *\n * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.\n */\nexport class TablePropertiesUI extends Plugin {\n    /**\n     * The default table properties.\n     */\n    _defaultContentTableProperties;\n    /**\n     * The default layout table properties.\n     */\n    _defaultLayoutTableProperties;\n    /**\n     * The contextual balloon plugin instance.\n     */\n    _balloon;\n    /**\n     * The properties form view displayed inside the balloon.\n     */\n    view = null;\n    /**\n     * The properties form view displayed inside the balloon (content table).\n     */\n    _viewWithContentTableDefaults = null;\n    /**\n     * The properties form view displayed inside the balloon (layout table).\n     */\n    _viewWithLayoutTableDefaults = null;\n    /**\n     * The batch used to undo all changes made by the form (which are live, as the user types)\n     * when \"Cancel\" was pressed. Each time the view is shown, a new batch is created.\n     */\n    _undoStepBatch;\n    /**\n     * Flag used to indicate whether view is ready to execute update commands\n     * (it finished loading initial data).\n     */\n    _isReady;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TablePropertiesUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('table.tableProperties', {\n            borderColors: defaultColors,\n            backgroundColors: defaultColors\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        this._defaultContentTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {\n            includeAlignmentProperty: true\n        });\n        this._defaultLayoutTableProperties = getNormalizedDefaultProperties();\n        this._balloon = editor.plugins.get(ContextualBalloon);\n        editor.ui.componentFactory.add('tableProperties', () => this._createTablePropertiesButton());\n    }\n    /**\n     * Creates the table properties button.\n     *\n     * @internal\n     */\n    _createTablePropertiesButton() {\n        const editor = this.editor;\n        const t = editor.t;\n        const view = new ButtonView(editor.locale);\n        view.set({\n            label: t('Table properties'),\n            icon: IconTableProperties,\n            tooltip: true\n        });\n        this.listenTo(view, 'execute', () => this._showView());\n        const commands = Object.values(propertyToCommandMap)\n            .map(commandName => editor.commands.get(commandName));\n        view.bind('isEnabled').toMany(commands, 'isEnabled', (...areEnabled) => (areEnabled.some(isCommandEnabled => isCommandEnabled)));\n        return view;\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        // Destroy created UI components as they are not automatically destroyed.\n        // See https://github.com/ckeditor/ckeditor5/issues/1341.\n        if (this.view) {\n            this.view.destroy();\n        }\n    }\n    /**\n     * Creates the {@link module:table/tableproperties/ui/tablepropertiesview~TablePropertiesView} instance.\n     *\n     * @returns The table properties form view instance.\n     */\n    _createPropertiesView(defaultTableProperties) {\n        const editor = this.editor;\n        const config = editor.config.get('table.tableProperties');\n        const borderColorsConfig = normalizeColorOptions(config.borderColors);\n        const localizedBorderColors = getLocalizedColorOptions(editor.locale, borderColorsConfig);\n        const backgroundColorsConfig = normalizeColorOptions(config.backgroundColors);\n        const localizedBackgroundColors = getLocalizedColorOptions(editor.locale, backgroundColorsConfig);\n        const hasColorPicker = config.colorPicker !== false;\n        const view = new TablePropertiesView(editor.locale, {\n            borderColors: localizedBorderColors,\n            backgroundColors: localizedBackgroundColors,\n            defaultTableProperties,\n            colorPickerConfig: hasColorPicker ? (config.colorPicker || {}) : false\n        });\n        const t = editor.t;\n        // Render the view so its #element is available for the clickOutsideHandler.\n        view.render();\n        this.listenTo(view, 'submit', () => {\n            this._hideView();\n        });\n        this.listenTo(view, 'cancel', () => {\n            // https://github.com/ckeditor/ckeditor5/issues/6180\n            if (this._undoStepBatch.operations.length) {\n                editor.execute('undo', this._undoStepBatch);\n            }\n            this._hideView();\n        });\n        // Close the balloon on Esc key press.\n        view.keystrokes.set('Esc', (data, cancel) => {\n            this._hideView();\n            cancel();\n        });\n        // Close on click outside of balloon panel element.\n        clickOutsideHandler({\n            emitter: view,\n            activator: () => this._isViewInBalloon,\n            contextElements: [this._balloon.view.element],\n            callback: () => this._hideView()\n        });\n        const colorErrorText = getLocalizedColorErrorText(t);\n        const lengthErrorText = getLocalizedLengthErrorText(t);\n        // Create the \"UI -> editor data\" binding.\n        // These listeners update the editor data (via table commands) when any observable\n        // property of the view has changed. They also validate the value and display errors in the UI\n        // when necessary. This makes the view live, which means the changes are\n        // visible in the editing as soon as the user types or changes fields' values.\n        view.on('change:borderStyle', this._getPropertyChangeCallback('tableBorderStyle'));\n        view.on('change:borderColor', this._getValidatedPropertyChangeCallback({\n            viewField: view.borderColorInput,\n            commandName: 'tableBorderColor',\n            errorText: colorErrorText,\n            validator: colorFieldValidator\n        }));\n        view.on('change:borderWidth', this._getValidatedPropertyChangeCallback({\n            viewField: view.borderWidthInput,\n            commandName: 'tableBorderWidth',\n            errorText: lengthErrorText,\n            validator: lineWidthFieldValidator\n        }));\n        view.on('change:backgroundColor', this._getValidatedPropertyChangeCallback({\n            viewField: view.backgroundInput,\n            commandName: 'tableBackgroundColor',\n            errorText: colorErrorText,\n            validator: colorFieldValidator\n        }));\n        view.on('change:width', this._getValidatedPropertyChangeCallback({\n            viewField: view.widthInput,\n            commandName: 'tableWidth',\n            errorText: lengthErrorText,\n            validator: lengthFieldValidator\n        }));\n        view.on('change:height', this._getValidatedPropertyChangeCallback({\n            viewField: view.heightInput,\n            commandName: 'tableHeight',\n            errorText: lengthErrorText,\n            validator: lengthFieldValidator\n        }));\n        view.on('change:alignment', this._getPropertyChangeCallback('tableAlignment'));\n        return view;\n    }\n    /**\n     * In this method the \"editor data -> UI\" binding is happening.\n     *\n     * When executed, this method obtains selected table property values from various table commands\n     * and passes them to the {@link #view}.\n     *\n     * This way, the UI stays up–to–date with the editor data.\n     */\n    _fillViewFormFromCommandValues() {\n        const commands = this.editor.commands;\n        const borderStyleCommand = commands.get('tableBorderStyle');\n        Object.entries(propertyToCommandMap)\n            .map(([property, commandName]) => {\n            const propertyKey = property;\n            const defaultValue = this.view === this._viewWithContentTableDefaults ?\n                this._defaultContentTableProperties[propertyKey] || '' :\n                this._defaultLayoutTableProperties[propertyKey] || '';\n            return [propertyKey, (commands.get(commandName).value || defaultValue)];\n        })\n            .forEach(([property, value]) => {\n            // Do not set the `border-color` and `border-width` fields if `border-style:none`.\n            if ((property === 'borderColor' || property === 'borderWidth') && borderStyleCommand.value === 'none') {\n                return;\n            }\n            this.view.set(property, value);\n        });\n        this._isReady = true;\n    }\n    /**\n     * Shows the {@link #view} in the {@link #_balloon}.\n     *\n     * **Note**: Each time a view is shown, the new {@link #_undoStepBatch} is created that contains\n     * all changes made to the document when the view is visible, allowing a single undo step\n     * for all of them.\n     */\n    _showView() {\n        const editor = this.editor;\n        const viewTable = getSelectionAffectedTableWidget(editor.editing.view.document.selection);\n        const modelTable = viewTable && editor.editing.mapper.toModelElement(viewTable);\n        const useDefaults = !modelTable || modelTable.getAttribute('tableType') !== 'layout';\n        if (useDefaults && !this._viewWithContentTableDefaults) {\n            this._viewWithContentTableDefaults = this._createPropertiesView(this._defaultContentTableProperties);\n        }\n        else if (!useDefaults && !this._viewWithLayoutTableDefaults) {\n            this._viewWithLayoutTableDefaults = this._createPropertiesView(this._defaultLayoutTableProperties);\n        }\n        this.view = useDefaults ? this._viewWithContentTableDefaults : this._viewWithLayoutTableDefaults;\n        this.listenTo(editor.ui, 'update', () => {\n            this._updateView();\n        });\n        // Update the view with the model values.\n        this._fillViewFormFromCommandValues();\n        this._balloon.add({\n            view: this.view,\n            position: getBalloonTablePositionData(editor)\n        });\n        // Create a new batch. Clicking \"Cancel\" will undo this batch.\n        this._undoStepBatch = editor.model.createBatch();\n        // Basic a11y.\n        this.view.focus();\n    }\n    /**\n     * Removes the {@link #view} from the {@link #_balloon}.\n     */\n    _hideView() {\n        const editor = this.editor;\n        this.stopListening(editor.ui, 'update');\n        this._isReady = false;\n        // Blur any input element before removing it from DOM to prevent issues in some browsers.\n        // See https://github.com/ckeditor/ckeditor5/issues/1501.\n        this.view.saveButtonView.focus();\n        this._balloon.remove(this.view);\n        // Make sure the focus is not lost in the process by putting it directly\n        // into the editing view.\n        this.editor.editing.view.focus();\n    }\n    /**\n     * Repositions the {@link #_balloon} or hides the {@link #view} if a table is no longer selected.\n     */\n    _updateView() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        if (!getSelectionAffectedTableWidget(viewDocument.selection)) {\n            this._hideView();\n        }\n        else if (this._isViewVisible) {\n            repositionContextualBalloon(editor, 'table');\n        }\n    }\n    /**\n     * Returns `true` when the {@link #view} is the visible in the {@link #_balloon}.\n     */\n    get _isViewVisible() {\n        return !!this.view && this._balloon.visibleView === this.view;\n    }\n    /**\n     * Returns `true` when the {@link #view} is in the {@link #_balloon}.\n     */\n    get _isViewInBalloon() {\n        return !!this.view && this._balloon.hasView(this.view);\n    }\n    /**\n     * Creates a callback that when executed upon {@link #view view's} property change\n     * executes a related editor command with the new property value.\n     *\n     * If new value will be set to the default value, the command will not be executed.\n     *\n     * @param commandName The command that will be executed.\n     */\n    _getPropertyChangeCallback(commandName) {\n        return (evt, propertyName, newValue) => {\n            // Do not execute the command on initial call (opening the table properties view).\n            if (!this._isReady) {\n                return;\n            }\n            this.editor.execute(commandName, {\n                value: newValue,\n                batch: this._undoStepBatch\n            });\n        };\n    }\n    /**\n     * Creates a callback that when executed upon {@link #view view's} property change:\n     * * executes a related editor command with the new property value if the value is valid,\n     * * or sets the error text next to the invalid field, if the value did not pass the validation.\n     */\n    _getValidatedPropertyChangeCallback(options) {\n        const { commandName, viewField, validator, errorText } = options;\n        const setErrorTextDebounced = debounce(() => {\n            viewField.errorText = errorText;\n        }, ERROR_TEXT_TIMEOUT);\n        return (evt, propertyName, newValue) => {\n            setErrorTextDebounced.cancel();\n            // Do not execute the command on initial call (opening the table properties view).\n            if (!this._isReady) {\n                return;\n            }\n            if (validator(newValue)) {\n                this.editor.execute(commandName, {\n                    value: newValue,\n                    batch: this._undoStepBatch\n                });\n                viewField.errorText = null;\n            }\n            else {\n                setErrorTextDebounced();\n            }\n        };\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2zm4 6H8v4h4z\\\" opacity=\\\".6\\\"/><path d=\\\"m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2 2 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecellproperties/ui/tablecellpropertiesview\n */\nimport { addListToDropdown, ButtonView, createLabeledDropdown, createLabeledInputText, FocusCycler, FormRowView, FormHeaderView, LabeledFieldView, LabelView, submitHandler, ToolbarView, View, ViewCollection } from 'ckeditor5/src/ui.js';\nimport { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils.js';\nimport { IconAlignBottom, IconAlignCenter, IconAlignJustify, IconAlignLeft, IconAlignMiddle, IconAlignRight, IconAlignTop, IconCancel, IconCheck } from 'ckeditor5/src/icons.js';\nimport { fillToolbar, getBorderStyleDefinitions, getBorderStyleLabels, getLabeledColorInputCreator } from '../../utils/ui/table-properties.js';\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/form/form.css';\nimport '../../../theme/formrow.css';\nimport '../../../theme/tableform.css';\nimport '../../../theme/tablecellproperties.css';\n/**\n * The class representing a table cell properties form, allowing users to customize\n * certain style aspects of a table cell, for instance, border, padding, text alignment, etc..\n */\nexport class TableCellPropertiesView extends View {\n    /**\n     * Options passed to the view. See {@link #constructor} to learn more.\n     */\n    options;\n    /**\n     * Tracks information about the DOM focus in the form.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of child views in the form.\n     */\n    children;\n    /**\n     * A dropdown that allows selecting the style of the table cell border.\n     */\n    borderStyleDropdown;\n    /**\n     * An input that allows specifying the width of the table cell border.\n     */\n    borderWidthInput;\n    /**\n     * An input that allows specifying the color of the table cell border.\n     */\n    borderColorInput;\n    /**\n     * An input that allows specifying the table cell background color.\n     */\n    backgroundInput;\n    /**\n     * An input that allows specifying the table cell padding.\n     */\n    paddingInput;\n    /**\n     * An input that allows specifying the table cell width.\n     */\n    widthInput;\n    /**\n     * An input that allows specifying the table cell height.\n     */\n    heightInput;\n    /**\n     * A toolbar with buttons that allow changing the horizontal text alignment in a table cell.\n     */\n    horizontalAlignmentToolbar;\n    /**\n     * A toolbar with buttons that allow changing the vertical text alignment in a table cell.\n     */\n    verticalAlignmentToolbar;\n    /**\n     * The \"Save\" button view.\n     */\n    saveButtonView;\n    /**\n     * The \"Cancel\" button view.\n     */\n    cancelButtonView;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    _focusCycler;\n    /**\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param options Additional configuration of the view.\n     * @param options.borderColors A configuration of the border color palette used by the\n     * {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#borderColorInput}.\n     * @param options.backgroundColors A configuration of the background color palette used by the\n     * {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#backgroundInput}.\n     * @param options.defaultTableCellProperties The default table cell properties.\n     */\n    constructor(locale, options) {\n        super(locale);\n        this.set({\n            borderStyle: '',\n            borderWidth: '',\n            borderColor: '',\n            padding: '',\n            backgroundColor: '',\n            width: '',\n            height: '',\n            horizontalAlignment: '',\n            verticalAlignment: ''\n        });\n        this.options = options;\n        const { borderStyleDropdown, borderWidthInput, borderColorInput, borderRowLabel } = this._createBorderFields();\n        const { backgroundRowLabel, backgroundInput } = this._createBackgroundFields();\n        const { widthInput, operatorLabel, heightInput, dimensionsLabel } = this._createDimensionFields();\n        const { horizontalAlignmentToolbar, verticalAlignmentToolbar, alignmentLabel } = this._createAlignmentFields();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.children = this.createCollection();\n        this.borderStyleDropdown = borderStyleDropdown;\n        this.borderWidthInput = borderWidthInput;\n        this.borderColorInput = borderColorInput;\n        this.backgroundInput = backgroundInput;\n        this.paddingInput = this._createPaddingField();\n        this.widthInput = widthInput;\n        this.heightInput = heightInput;\n        this.horizontalAlignmentToolbar = horizontalAlignmentToolbar;\n        this.verticalAlignmentToolbar = verticalAlignmentToolbar;\n        // Defer creating to make sure other fields are present and the Save button can\n        // bind its #isEnabled to their error messages so there's no way to save unless all\n        // fields are valid.\n        const { saveButtonView, cancelButtonView } = this._createActionButtons();\n        this.saveButtonView = saveButtonView;\n        this.cancelButtonView = cancelButtonView;\n        this._focusables = new ViewCollection();\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate form fields backwards using the Shift + Tab keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the Tab key.\n                focusNext: 'tab'\n            }\n        });\n        // Form header.\n        this.children.add(new FormHeaderView(locale, {\n            label: this.t('Cell properties')\n        }));\n        // Border row.\n        this.children.add(new FormRowView(locale, {\n            labelView: borderRowLabel,\n            children: [\n                borderRowLabel,\n                borderStyleDropdown,\n                borderColorInput,\n                borderWidthInput\n            ],\n            class: 'ck-table-form__border-row'\n        }));\n        // Background.\n        this.children.add(new FormRowView(locale, {\n            labelView: backgroundRowLabel,\n            children: [\n                backgroundRowLabel,\n                backgroundInput\n            ],\n            class: 'ck-table-form__background-row'\n        }));\n        // Dimensions row and padding.\n        this.children.add(new FormRowView(locale, {\n            children: [\n                // Dimensions row.\n                new FormRowView(locale, {\n                    labelView: dimensionsLabel,\n                    children: [\n                        dimensionsLabel,\n                        widthInput,\n                        operatorLabel,\n                        heightInput\n                    ],\n                    class: 'ck-table-form__dimensions-row'\n                }),\n                // Padding row.\n                new FormRowView(locale, {\n                    children: [\n                        this.paddingInput\n                    ],\n                    class: 'ck-table-cell-properties-form__padding-row'\n                })\n            ]\n        }));\n        // Text alignment row.\n        this.children.add(new FormRowView(locale, {\n            labelView: alignmentLabel,\n            children: [\n                alignmentLabel,\n                horizontalAlignmentToolbar,\n                verticalAlignmentToolbar\n            ],\n            class: 'ck-table-cell-properties-form__alignment-row'\n        }));\n        // Action row.\n        this.children.add(new FormRowView(locale, {\n            children: [\n                this.saveButtonView,\n                this.cancelButtonView\n            ],\n            class: 'ck-table-form__action-row'\n        }));\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-form',\n                    'ck-table-form',\n                    'ck-table-cell-properties-form'\n                ],\n                // https://github.com/ckeditor/ckeditor5-link/issues/90\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Enable the \"submit\" event for this view. It can be triggered by the #saveButtonView\n        // which is of the \"submit\" DOM \"type\".\n        submitHandler({\n            view: this\n        });\n        // Maintain continuous focus cycling over views that have focusable children and focus cyclers themselves.\n        [this.borderColorInput, this.backgroundInput].forEach(view => {\n            this._focusCycler.chain(view.fieldView.focusCycler);\n        });\n        [\n            this.borderStyleDropdown,\n            this.borderColorInput,\n            this.borderWidthInput,\n            this.backgroundInput,\n            this.widthInput,\n            this.heightInput,\n            this.paddingInput,\n            this.horizontalAlignmentToolbar,\n            this.verticalAlignmentToolbar,\n            this.saveButtonView,\n            this.cancelButtonView\n        ].forEach(view => {\n            // Register the view as focusable.\n            this._focusables.add(view);\n            // Register the view in the focus tracker.\n            this.focusTracker.add(view.element);\n        });\n        // Mainly for closing using \"Esc\" and navigation using \"Tab\".\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the fist focusable field in the form.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #borderStyleDropdown},\n     * * {@link #borderWidthInput},\n     * * {@link #borderColorInput}.\n     */\n    _createBorderFields() {\n        const defaultTableCellProperties = this.options.defaultTableCellProperties;\n        const defaultBorder = {\n            style: defaultTableCellProperties.borderStyle,\n            width: defaultTableCellProperties.borderWidth,\n            color: defaultTableCellProperties.borderColor\n        };\n        const colorInputCreator = getLabeledColorInputCreator({\n            colorConfig: this.options.borderColors,\n            columns: 5,\n            defaultColorValue: defaultBorder.color,\n            colorPickerConfig: this.options.colorPickerConfig\n        });\n        const locale = this.locale;\n        const t = this.t;\n        const accessibleLabel = t('Style');\n        // -- Group label ---------------------------------------------\n        const borderRowLabel = new LabelView(locale);\n        borderRowLabel.text = t('Border');\n        // -- Style ---------------------------------------------------\n        const styleLabels = getBorderStyleLabels(t);\n        const borderStyleDropdown = new LabeledFieldView(locale, createLabeledDropdown);\n        borderStyleDropdown.set({\n            label: accessibleLabel,\n            class: 'ck-table-form__border-style'\n        });\n        borderStyleDropdown.fieldView.buttonView.set({\n            ariaLabel: accessibleLabel,\n            ariaLabelledBy: undefined,\n            isOn: false,\n            withText: true,\n            tooltip: accessibleLabel\n        });\n        borderStyleDropdown.fieldView.buttonView.bind('label').to(this, 'borderStyle', value => {\n            return styleLabels[value ? value : 'none'];\n        });\n        borderStyleDropdown.fieldView.on('execute', evt => {\n            this.borderStyle = evt.source._borderStyleValue;\n        });\n        borderStyleDropdown.bind('isEmpty').to(this, 'borderStyle', value => !value);\n        addListToDropdown(borderStyleDropdown.fieldView, getBorderStyleDefinitions(this, defaultBorder.style), {\n            role: 'menu',\n            ariaLabel: accessibleLabel\n        });\n        // -- Width ---------------------------------------------------\n        const borderWidthInput = new LabeledFieldView(locale, createLabeledInputText);\n        borderWidthInput.set({\n            label: t('Width'),\n            class: 'ck-table-form__border-width'\n        });\n        borderWidthInput.fieldView.bind('value').to(this, 'borderWidth');\n        borderWidthInput.bind('isEnabled').to(this, 'borderStyle', isBorderStyleSet);\n        borderWidthInput.fieldView.on('input', () => {\n            this.borderWidth = borderWidthInput.fieldView.element.value;\n        });\n        // -- Color ---------------------------------------------------\n        const borderColorInput = new LabeledFieldView(locale, colorInputCreator);\n        borderColorInput.set({\n            label: t('Color'),\n            class: 'ck-table-form__border-color'\n        });\n        borderColorInput.fieldView.bind('value').to(this, 'borderColor');\n        borderColorInput.bind('isEnabled').to(this, 'borderStyle', isBorderStyleSet);\n        borderColorInput.fieldView.on('input', () => {\n            this.borderColor = borderColorInput.fieldView.value;\n        });\n        // Reset the border color and width fields depending on the `border-style` value.\n        this.on('change:borderStyle', (evt, name, newValue, oldValue) => {\n            // When removing the border (`border-style:none`), clear the remaining `border-*` properties.\n            // See: https://github.com/ckeditor/ckeditor5/issues/6227.\n            if (!isBorderStyleSet(newValue)) {\n                this.borderColor = '';\n                this.borderWidth = '';\n            }\n            // When setting the `border-style` from `none`, set the default `border-color` and `border-width` properties.\n            if (!isBorderStyleSet(oldValue)) {\n                this.borderColor = defaultBorder.color;\n                this.borderWidth = defaultBorder.width;\n            }\n        });\n        return {\n            borderRowLabel,\n            borderStyleDropdown,\n            borderColorInput,\n            borderWidthInput\n        };\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #backgroundInput}.\n     */\n    _createBackgroundFields() {\n        const locale = this.locale;\n        const t = this.t;\n        // -- Group label ---------------------------------------------\n        const backgroundRowLabel = new LabelView(locale);\n        backgroundRowLabel.text = t('Background');\n        // -- Background color input -----------------------------------\n        const colorInputCreator = getLabeledColorInputCreator({\n            colorConfig: this.options.backgroundColors,\n            columns: 5,\n            defaultColorValue: this.options.defaultTableCellProperties.backgroundColor,\n            colorPickerConfig: this.options.colorPickerConfig\n        });\n        const backgroundInput = new LabeledFieldView(locale, colorInputCreator);\n        backgroundInput.set({\n            label: t('Color'),\n            class: 'ck-table-cell-properties-form__background'\n        });\n        backgroundInput.fieldView.bind('value').to(this, 'backgroundColor');\n        backgroundInput.fieldView.on('input', () => {\n            this.backgroundColor = backgroundInput.fieldView.value;\n        });\n        return {\n            backgroundRowLabel,\n            backgroundInput\n        };\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #widthInput}.\n     * * {@link #heightInput}.\n     */\n    _createDimensionFields() {\n        const locale = this.locale;\n        const t = this.t;\n        // -- Label ---------------------------------------------------\n        const dimensionsLabel = new LabelView(locale);\n        dimensionsLabel.text = t('Dimensions');\n        // -- Width ---------------------------------------------------\n        const widthInput = new LabeledFieldView(locale, createLabeledInputText);\n        widthInput.set({\n            label: t('Width'),\n            class: 'ck-table-form__dimensions-row__width'\n        });\n        widthInput.fieldView.bind('value').to(this, 'width');\n        widthInput.fieldView.on('input', () => {\n            this.width = widthInput.fieldView.element.value;\n        });\n        // -- Operator ---------------------------------------------------\n        const operatorLabel = new View(locale);\n        operatorLabel.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck-table-form__dimension-operator'\n                ]\n            },\n            children: [\n                { text: '×' }\n            ]\n        });\n        // -- Height ---------------------------------------------------\n        const heightInput = new LabeledFieldView(locale, createLabeledInputText);\n        heightInput.set({\n            label: t('Height'),\n            class: 'ck-table-form__dimensions-row__height'\n        });\n        heightInput.fieldView.bind('value').to(this, 'height');\n        heightInput.fieldView.on('input', () => {\n            this.height = heightInput.fieldView.element.value;\n        });\n        return {\n            dimensionsLabel,\n            widthInput,\n            operatorLabel,\n            heightInput\n        };\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #paddingInput}.\n     */\n    _createPaddingField() {\n        const locale = this.locale;\n        const t = this.t;\n        const paddingInput = new LabeledFieldView(locale, createLabeledInputText);\n        paddingInput.set({\n            label: t('Padding'),\n            class: 'ck-table-cell-properties-form__padding'\n        });\n        paddingInput.fieldView.bind('value').to(this, 'padding');\n        paddingInput.fieldView.on('input', () => {\n            this.padding = paddingInput.fieldView.element.value;\n        });\n        return paddingInput;\n    }\n    /**\n     * Creates the following form fields:\n     *\n     * * {@link #horizontalAlignmentToolbar},\n     * * {@link #verticalAlignmentToolbar}.\n     */\n    _createAlignmentFields() {\n        const locale = this.locale;\n        const t = this.t;\n        const alignmentLabel = new LabelView(locale);\n        const ALIGNMENT_ICONS = {\n            left: IconAlignLeft,\n            center: IconAlignCenter,\n            right: IconAlignRight,\n            justify: IconAlignJustify,\n            top: IconAlignTop,\n            middle: IconAlignMiddle,\n            bottom: IconAlignBottom\n        };\n        alignmentLabel.text = t('Table cell text alignment');\n        // -- Horizontal ---------------------------------------------------\n        const horizontalAlignmentToolbar = new ToolbarView(locale);\n        const isContentRTL = locale.contentLanguageDirection === 'rtl';\n        horizontalAlignmentToolbar.set({\n            isCompact: true,\n            role: 'radiogroup',\n            ariaLabel: t('Horizontal text alignment toolbar')\n        });\n        fillToolbar({\n            view: this,\n            icons: ALIGNMENT_ICONS,\n            toolbar: horizontalAlignmentToolbar,\n            labels: this._horizontalAlignmentLabels,\n            propertyName: 'horizontalAlignment',\n            nameToValue: name => {\n                // For the RTL content, we want to swap the buttons \"align to the left\" and \"align to the right\".\n                if (isContentRTL) {\n                    if (name === 'left') {\n                        return 'right';\n                    }\n                    else if (name === 'right') {\n                        return 'left';\n                    }\n                }\n                return name;\n            },\n            defaultValue: this.options.defaultTableCellProperties.horizontalAlignment\n        });\n        // -- Vertical -----------------------------------------------------\n        const verticalAlignmentToolbar = new ToolbarView(locale);\n        verticalAlignmentToolbar.set({\n            isCompact: true,\n            role: 'radiogroup',\n            ariaLabel: t('Vertical text alignment toolbar')\n        });\n        fillToolbar({\n            view: this,\n            icons: ALIGNMENT_ICONS,\n            toolbar: verticalAlignmentToolbar,\n            labels: this._verticalAlignmentLabels,\n            propertyName: 'verticalAlignment',\n            defaultValue: this.options.defaultTableCellProperties.verticalAlignment\n        });\n        return {\n            horizontalAlignmentToolbar,\n            verticalAlignmentToolbar,\n            alignmentLabel\n        };\n    }\n    /**\n     * Creates the following form controls:\n     *\n     * * {@link #saveButtonView},\n     * * {@link #cancelButtonView}.\n     */\n    _createActionButtons() {\n        const locale = this.locale;\n        const t = this.t;\n        const saveButtonView = new ButtonView(locale);\n        const cancelButtonView = new ButtonView(locale);\n        const fieldsThatShouldValidateToSave = [\n            this.borderWidthInput,\n            this.borderColorInput,\n            this.backgroundInput,\n            this.paddingInput\n        ];\n        saveButtonView.set({\n            label: t('Save'),\n            icon: IconCheck,\n            class: 'ck-button-save',\n            type: 'submit',\n            withText: true\n        });\n        saveButtonView.bind('isEnabled').toMany(fieldsThatShouldValidateToSave, 'errorText', (...errorTexts) => {\n            return errorTexts.every(errorText => !errorText);\n        });\n        cancelButtonView.set({\n            label: t('Cancel'),\n            icon: IconCancel,\n            class: 'ck-button-cancel',\n            withText: true\n        });\n        cancelButtonView.delegate('execute').to(this, 'cancel');\n        return {\n            saveButtonView, cancelButtonView\n        };\n    }\n    /**\n     * Provides localized labels for {@link #horizontalAlignmentToolbar} buttons.\n     */\n    get _horizontalAlignmentLabels() {\n        const locale = this.locale;\n        const t = this.t;\n        const left = t('Align cell text to the left');\n        const center = t('Align cell text to the center');\n        const right = t('Align cell text to the right');\n        const justify = t('Justify cell text');\n        // Returns object with a proper order of labels.\n        if (locale.uiLanguageDirection === 'rtl') {\n            return { right, center, left, justify };\n        }\n        else {\n            return { left, center, right, justify };\n        }\n    }\n    /**\n     * Provides localized labels for {@link #verticalAlignmentToolbar} buttons.\n     */\n    get _verticalAlignmentLabels() {\n        const t = this.t;\n        return {\n            top: t('Align cell text to the top'),\n            middle: t('Align cell text to the middle'),\n            bottom: t('Align cell text to the bottom')\n        };\n    }\n}\nfunction isBorderStyleSet(value) {\n    return value !== 'none';\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.75.75 0 0 1 .511-.187.75.75 0 0 1 .511.187M15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M9.75 11.875a.75.75 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.75.75 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.75.75 0 0 1-.508.184.75.75 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.75.75 0 0 1-.511.187.75.75 0 0 1-.511-.187M4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecellproperties/tablecellpropertiesui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconTableCellProperties } from 'ckeditor5/src/icons.js';\nimport { ButtonView, clickOutsideHandler, ContextualBalloon, getLocalizedColorOptions, normalizeColorOptions } from 'ckeditor5/src/ui.js';\nimport { TableCellPropertiesView } from './ui/tablecellpropertiesview.js';\nimport { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, defaultColors, lengthFieldValidator, lineWidthFieldValidator } from '../utils/ui/table-properties.js';\nimport { debounce } from 'es-toolkit/compat';\nimport { getSelectionAffectedTableWidget, getTableWidgetAncestor } from '../utils/ui/widget.js';\nimport { getBalloonCellPositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';\nimport { getNormalizedDefaultCellProperties, getNormalizedDefaultProperties } from '../utils/table-properties.js';\nconst ERROR_TEXT_TIMEOUT = 500;\n// Map of view properties and related commands.\nconst propertyToCommandMap = {\n    borderStyle: 'tableCellBorderStyle',\n    borderColor: 'tableCellBorderColor',\n    borderWidth: 'tableCellBorderWidth',\n    height: 'tableCellHeight',\n    width: 'tableCellWidth',\n    padding: 'tableCellPadding',\n    backgroundColor: 'tableCellBackgroundColor',\n    horizontalAlignment: 'tableCellHorizontalAlignment',\n    verticalAlignment: 'tableCellVerticalAlignment'\n};\n/**\n * The table cell properties UI plugin. It introduces the `'tableCellProperties'` button\n * that opens a form allowing to specify the visual styling of a table cell.\n *\n * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.\n */\nexport class TableCellPropertiesUI extends Plugin {\n    /**\n     * The default table cell properties.\n     */\n    _defaultContentTableCellProperties;\n    /**\n     * The default layout table cell properties.\n     */\n    _defaultLayoutTableCellProperties;\n    /**\n     * The contextual balloon plugin instance.\n     */\n    _balloon;\n    /**\n     * The cell properties form view displayed inside the balloon.\n     */\n    view;\n    /**\n     * The cell properties form view displayed inside the balloon (content table).\n     */\n    _viewWithContentTableDefaults;\n    /**\n     * The cell properties form view displayed inside the balloon (layout table).\n     */\n    _viewWithLayoutTableDefaults;\n    /**\n     * The batch used to undo all changes made by the form (which are live, as the user types)\n     * when \"Cancel\" was pressed. Each time the view is shown, a new batch is created.\n     */\n    _undoStepBatch;\n    /**\n     * Flag used to indicate whether view is ready to execute update commands\n     * (it finished loading initial data).\n     */\n    _isReady;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCellPropertiesUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('table.tableCellProperties', {\n            borderColors: defaultColors,\n            backgroundColors: defaultColors\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        this._defaultContentTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {\n            includeVerticalAlignmentProperty: true,\n            includeHorizontalAlignmentProperty: true,\n            includePaddingProperty: true,\n            isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'\n        });\n        this._defaultLayoutTableCellProperties = getNormalizedDefaultProperties(undefined, {\n            includeVerticalAlignmentProperty: true,\n            includeHorizontalAlignmentProperty: true,\n            isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'\n        });\n        this._balloon = editor.plugins.get(ContextualBalloon);\n        this.view = null;\n        this._isReady = false;\n        editor.ui.componentFactory.add('tableCellProperties', locale => {\n            const view = new ButtonView(locale);\n            view.set({\n                label: t('Cell properties'),\n                icon: IconTableCellProperties,\n                tooltip: true\n            });\n            this.listenTo(view, 'execute', () => this._showView());\n            const commands = Object.values(propertyToCommandMap)\n                .map(commandName => editor.commands.get(commandName));\n            view.bind('isEnabled').toMany(commands, 'isEnabled', (...areEnabled) => (areEnabled.some(isCommandEnabled => isCommandEnabled)));\n            return view;\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        // Destroy created UI components as they are not automatically destroyed.\n        // See https://github.com/ckeditor/ckeditor5/issues/1341.\n        if (this.view) {\n            this.view.destroy();\n        }\n    }\n    /**\n     * Creates the {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView} instance.\n     *\n     * @returns The cell properties form view instance.\n     */\n    _createPropertiesView(defaultTableCellProperties) {\n        const editor = this.editor;\n        const config = editor.config.get('table.tableCellProperties');\n        const borderColorsConfig = normalizeColorOptions(config.borderColors);\n        const localizedBorderColors = getLocalizedColorOptions(editor.locale, borderColorsConfig);\n        const backgroundColorsConfig = normalizeColorOptions(config.backgroundColors);\n        const localizedBackgroundColors = getLocalizedColorOptions(editor.locale, backgroundColorsConfig);\n        const hasColorPicker = config.colorPicker !== false;\n        const view = new TableCellPropertiesView(editor.locale, {\n            borderColors: localizedBorderColors,\n            backgroundColors: localizedBackgroundColors,\n            defaultTableCellProperties,\n            colorPickerConfig: hasColorPicker ? (config.colorPicker || {}) : false\n        });\n        const t = editor.t;\n        // Render the view so its #element is available for the clickOutsideHandler.\n        view.render();\n        this.listenTo(view, 'submit', () => {\n            this._hideView();\n        });\n        this.listenTo(view, 'cancel', () => {\n            // https://github.com/ckeditor/ckeditor5/issues/6180\n            if (this._undoStepBatch.operations.length) {\n                editor.execute('undo', this._undoStepBatch);\n            }\n            this._hideView();\n        });\n        // Close the balloon on Esc key press.\n        view.keystrokes.set('Esc', (data, cancel) => {\n            this._hideView();\n            cancel();\n        });\n        // Close on click outside of balloon panel element.\n        clickOutsideHandler({\n            emitter: view,\n            activator: () => this._isViewInBalloon,\n            contextElements: [this._balloon.view.element],\n            callback: () => this._hideView()\n        });\n        const colorErrorText = getLocalizedColorErrorText(t);\n        const lengthErrorText = getLocalizedLengthErrorText(t);\n        // Create the \"UI -> editor data\" binding.\n        // These listeners update the editor data (via table commands) when any observable\n        // property of the view has changed. They also validate the value and display errors in the UI\n        // when necessary. This makes the view live, which means the changes are\n        // visible in the editing as soon as the user types or changes fields' values.\n        view.on('change:borderStyle', this._getPropertyChangeCallback('tableCellBorderStyle'));\n        view.on('change:borderColor', this._getValidatedPropertyChangeCallback({\n            viewField: view.borderColorInput,\n            commandName: 'tableCellBorderColor',\n            errorText: colorErrorText,\n            validator: colorFieldValidator\n        }));\n        view.on('change:borderWidth', this._getValidatedPropertyChangeCallback({\n            viewField: view.borderWidthInput,\n            commandName: 'tableCellBorderWidth',\n            errorText: lengthErrorText,\n            validator: lineWidthFieldValidator\n        }));\n        view.on('change:padding', this._getValidatedPropertyChangeCallback({\n            viewField: view.paddingInput,\n            commandName: 'tableCellPadding',\n            errorText: lengthErrorText,\n            validator: lengthFieldValidator\n        }));\n        view.on('change:width', this._getValidatedPropertyChangeCallback({\n            viewField: view.widthInput,\n            commandName: 'tableCellWidth',\n            errorText: lengthErrorText,\n            validator: lengthFieldValidator\n        }));\n        view.on('change:height', this._getValidatedPropertyChangeCallback({\n            viewField: view.heightInput,\n            commandName: 'tableCellHeight',\n            errorText: lengthErrorText,\n            validator: lengthFieldValidator\n        }));\n        view.on('change:backgroundColor', this._getValidatedPropertyChangeCallback({\n            viewField: view.backgroundInput,\n            commandName: 'tableCellBackgroundColor',\n            errorText: colorErrorText,\n            validator: colorFieldValidator\n        }));\n        view.on('change:horizontalAlignment', this._getPropertyChangeCallback('tableCellHorizontalAlignment'));\n        view.on('change:verticalAlignment', this._getPropertyChangeCallback('tableCellVerticalAlignment'));\n        return view;\n    }\n    /**\n     * In this method the \"editor data -> UI\" binding is happening.\n     *\n     * When executed, this method obtains selected cell property values from various table commands\n     * and passes them to the {@link #view}.\n     *\n     * This way, the UI stays up–to–date with the editor data.\n     */\n    _fillViewFormFromCommandValues() {\n        const commands = this.editor.commands;\n        const borderStyleCommand = commands.get('tableCellBorderStyle');\n        Object.entries(propertyToCommandMap)\n            .map(([property, commandName]) => {\n            const propertyKey = property;\n            const defaultValue = this.view === this._viewWithContentTableDefaults ?\n                this._defaultContentTableCellProperties[propertyKey] || '' :\n                this._defaultLayoutTableCellProperties[propertyKey] || '';\n            return [\n                property,\n                commands.get(commandName).value || defaultValue\n            ];\n        })\n            .forEach(([property, value]) => {\n            // Do not set the `border-color` and `border-width` fields if `border-style:none`.\n            if ((property === 'borderColor' || property === 'borderWidth') && borderStyleCommand.value === 'none') {\n                return;\n            }\n            this.view.set(property, value);\n        });\n        this._isReady = true;\n    }\n    /**\n     * Shows the {@link #view} in the {@link #_balloon}.\n     *\n     * **Note**: Each time a view is shown, a new {@link #_undoStepBatch} is created. It contains\n     * all changes made to the document when the view is visible, allowing a single undo step\n     * for all of them.\n     */\n    _showView() {\n        const editor = this.editor;\n        const viewTable = getSelectionAffectedTableWidget(editor.editing.view.document.selection);\n        const modelTable = viewTable && editor.editing.mapper.toModelElement(viewTable);\n        const useDefaults = !modelTable || modelTable.getAttribute('tableType') !== 'layout';\n        if (useDefaults && !this._viewWithContentTableDefaults) {\n            this._viewWithContentTableDefaults = this._createPropertiesView(this._defaultContentTableCellProperties);\n        }\n        else if (!useDefaults && !this._viewWithLayoutTableDefaults) {\n            this._viewWithLayoutTableDefaults = this._createPropertiesView(this._defaultLayoutTableCellProperties);\n        }\n        this.view = useDefaults ? this._viewWithContentTableDefaults : this._viewWithLayoutTableDefaults;\n        this.listenTo(editor.ui, 'update', () => {\n            this._updateView();\n        });\n        // Update the view with the model values.\n        this._fillViewFormFromCommandValues();\n        this._balloon.add({\n            view: this.view,\n            position: getBalloonCellPositionData(editor)\n        });\n        // Create a new batch. Clicking \"Cancel\" will undo this batch.\n        this._undoStepBatch = editor.model.createBatch();\n        // Basic a11y.\n        this.view.focus();\n    }\n    /**\n     * Removes the {@link #view} from the {@link #_balloon}.\n     */\n    _hideView() {\n        const editor = this.editor;\n        this.stopListening(editor.ui, 'update');\n        this._isReady = false;\n        // Blur any input element before removing it from DOM to prevent issues in some browsers.\n        // See https://github.com/ckeditor/ckeditor5/issues/1501.\n        this.view.saveButtonView.focus();\n        this._balloon.remove(this.view);\n        // Make sure the focus is not lost in the process by putting it directly\n        // into the editing view.\n        this.editor.editing.view.focus();\n    }\n    /**\n     * Repositions the {@link #_balloon} or hides the {@link #view} if a table cell is no longer selected.\n     */\n    _updateView() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        if (!getTableWidgetAncestor(viewDocument.selection)) {\n            this._hideView();\n        }\n        else if (this._isViewVisible) {\n            repositionContextualBalloon(editor, 'cell');\n        }\n    }\n    /**\n     * Returns `true` when the {@link #view} is visible in the {@link #_balloon}.\n     */\n    get _isViewVisible() {\n        return !!this.view && this._balloon.visibleView === this.view;\n    }\n    /**\n     * Returns `true` when the {@link #view} is in the {@link #_balloon}.\n     */\n    get _isViewInBalloon() {\n        return !!this.view && this._balloon.hasView(this.view);\n    }\n    /**\n     * Creates a callback that when executed upon the {@link #view view's} property change\n     * executes a related editor command with the new property value.\n     *\n     * @param commandName The default value of the command.\n     */\n    _getPropertyChangeCallback(commandName) {\n        return (evt, propertyName, newValue) => {\n            if (!this._isReady) {\n                return;\n            }\n            this.editor.execute(commandName, {\n                value: newValue,\n                batch: this._undoStepBatch\n            });\n        };\n    }\n    /**\n     * Creates a callback that when executed upon the {@link #view view's} property change:\n     * * Executes a related editor command with the new property value if the value is valid,\n     * * Or sets the error text next to the invalid field, if the value did not pass the validation.\n     */\n    _getValidatedPropertyChangeCallback(options) {\n        const { commandName, viewField, validator, errorText } = options;\n        const setErrorTextDebounced = debounce(() => {\n            viewField.errorText = errorText;\n        }, ERROR_TEXT_TIMEOUT);\n        return (evt, propertyName, newValue) => {\n            setErrorTextDebounced.cancel();\n            // Do not execute the command on initial call (opening the table properties view).\n            if (!this._isReady) {\n                return;\n            }\n            if (validator(newValue)) {\n                this.editor.execute(commandName, {\n                    value: newValue,\n                    batch: this._undoStepBatch\n                });\n                viewField.errorText = null;\n            }\n            else {\n                setErrorTextDebounced();\n            }\n        };\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5zM2 12h5V8H2zm10-4H8v4h4zM2 2v5h5V2zm0 16h5v-5H2zM13 7h5V2h-5zM8 2v5h4V2z\\\" opacity=\\\".6\\\"/><path d=\\\"m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43zM13 6a1 1 0 0 1 1 1v3.172a2 2 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.98 1.98 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm-1 2H8v4h4z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecellproperties/commands/tablecellpropertycommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getSelectionAffectedTable } from '../../utils/common.js';\n/**\n * The table cell attribute command.\n *\n * The command is a base command for other table cell property commands.\n */\nexport class TableCellPropertyCommand extends Command {\n    /**\n     * The attribute that will be set by the command.\n     */\n    attributeName;\n    /**\n     * The default value for the attribute.\n     *\n     * @readonly\n     */\n    _defaultValue;\n    /**\n     * The default value for the attribute for the content table.\n     */\n    _defaultContentTableValue;\n    /**\n     * The default value for the attribute for the layout table.\n     */\n    _defaultLayoutTableValue;\n    /**\n     * Creates a new `TableCellPropertyCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param attributeName Table cell attribute name.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, attributeName, defaultValue) {\n        super(editor);\n        this.attributeName = attributeName;\n        this._defaultContentTableValue = defaultValue;\n        // Hardcoded defaults for layout table.\n        switch (attributeName) {\n            case 'tableCellBorderStyle':\n                this._defaultLayoutTableValue = 'none';\n                break;\n            case 'tableCellHorizontalAlignment':\n                this._defaultLayoutTableValue = 'left';\n                break;\n            case 'tableCellVerticalAlignment':\n                this._defaultLayoutTableValue = 'middle';\n                break;\n            default:\n                this._defaultLayoutTableValue = undefined;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const selection = editor.model.document.selection;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const selectedTableCells = tableUtils.getSelectionAffectedTableCells(selection);\n        const table = getSelectionAffectedTable(selection);\n        this._defaultValue = !table || table.getAttribute('tableType') !== 'layout' ?\n            this._defaultContentTableValue :\n            this._defaultLayoutTableValue;\n        this.isEnabled = !!selectedTableCells.length;\n        this.value = this._getSingleValue(selectedTableCells);\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options.value If set, the command will set the attribute on selected table cells.\n     * If it is not set, the command will remove the attribute from the selected table cells.\n     * @param options.batch Pass the model batch instance to the command to aggregate changes,\n     * for example to allow a single undo step for multiple executions.\n     */\n    execute(options = {}) {\n        const { value, batch } = options;\n        const model = this.editor.model;\n        const tableUtils = this.editor.plugins.get('TableUtils');\n        const tableCells = tableUtils.getSelectionAffectedTableCells(model.document.selection);\n        const valueToSet = this._getValueToSet(value);\n        model.enqueueChange(batch, writer => {\n            if (valueToSet) {\n                tableCells.forEach(tableCell => writer.setAttribute(this.attributeName, valueToSet, tableCell));\n            }\n            else {\n                tableCells.forEach(tableCell => writer.removeAttribute(this.attributeName, tableCell));\n            }\n        });\n    }\n    /**\n     * Returns the attribute value for a table cell.\n     */\n    _getAttribute(tableCell) {\n        if (!tableCell) {\n            return;\n        }\n        const value = tableCell.getAttribute(this.attributeName);\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n    /**\n     * Returns the proper model value. It can be used to add a default unit to numeric values.\n     */\n    _getValueToSet(value) {\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n    /**\n     * Returns a single value for all selected table cells. If the value is the same for all cells,\n     * it will be returned (`undefined` otherwise).\n     */\n    _getSingleValue(tableCells) {\n        const firstCellValue = this._getAttribute(tableCells[0]);\n        const everyCellHasAttribute = tableCells.every(tableCells => this._getAttribute(tableCells) === firstCellValue);\n        return everyCellHasAttribute ? firstCellValue : undefined;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from '../../tablecellproperties/commands/tablecellpropertycommand.js';\nimport { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';\n/**\n * The table cell width command.\n *\n * The command is registered by the {@link module:table/tablecellwidth/tablecellwidthediting~TableCellWidthEditing} as\n * the `'tableCellWidth'` editor command.\n *\n * To change the width of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellWidth', {\n *   value: '50px'\n * } );\n * ```\n *\n * **Note**: This command adds a default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableCellWidth', {\n *   value: '50'\n * } );\n * ```\n *\n * will set the `width` attribute to `'50px'` in the model.\n */\nexport class TableCellWidthCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellWidthCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellWidth', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        value = addDefaultUnitToNumericValue(value, 'px');\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecellwidth/tablecellwidthediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TableEditing } from './../tableediting.js';\nimport { TableCellWidthCommand } from './commands/tablecellwidthcommand.js';\nimport { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';\nimport { enableProperty } from '../utils/common.js';\n/**\n * The table cell width editing feature.\n *\n * Introduces `tableCellWidth` table cell model attribute alongside with its converters\n * and a command.\n */\nexport class TableCellWidthEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCellWidthEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const defaultTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'));\n        enableProperty(editor.model.schema, editor.conversion, {\n            modelAttribute: 'tableCellWidth',\n            styleName: 'width',\n            attributeName: 'width',\n            attributeType: 'length',\n            defaultValue: defaultTableCellProperties.width\n        });\n        editor.commands.add('tableCellWidth', new TableCellWidthCommand(editor, defaultTableCellProperties.width));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\nimport { addDefaultUnitToNumericValue, getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table cell padding command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellPadding'` editor command.\n *\n * To change the padding of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellPadding', {\n *   value: '5px'\n * } );\n * ```\n *\n * **Note**: This command adds the default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableCellPadding', {\n *   value: '5'\n * } );\n * ```\n *\n * will set the `padding` attribute to `'5px'` in the model.\n */\nexport class TableCellPaddingCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellPaddingCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellPadding', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getAttribute(tableCell) {\n        if (!tableCell) {\n            return;\n        }\n        const value = getSingleValue(tableCell.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        const newValue = addDefaultUnitToNumericValue(value, 'px');\n        if (newValue === this._defaultValue) {\n            return;\n        }\n        return newValue;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\nimport { addDefaultUnitToNumericValue } from '../../utils/table-properties.js';\n/**\n * The table cell height command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellHeight'` editor command.\n *\n * To change the height of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellHeight', {\n *   value: '50px'\n * } );\n * ```\n *\n * **Note**: This command adds the default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableCellHeight', {\n *   value: '50'\n * } );\n * ```\n *\n * will set the `height` attribute to `'50px'` in the model.\n */\nexport class TableCellHeightCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellHeightCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellHeight', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        const newValue = addDefaultUnitToNumericValue(value, 'px');\n        if (newValue === this._defaultValue) {\n            return;\n        }\n        return newValue;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\n/**\n * The table cell background color command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellBackgroundColor'` editor command.\n *\n * To change the background color of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellBackgroundColor', {\n *   value: '#f00'\n * } );\n * ```\n */\nexport class TableCellBackgroundColorCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellBackgroundColorCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellBackgroundColor', defaultValue);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\n/**\n * The table cell vertical alignment command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellVerticalAlignment'` editor command.\n *\n * To change the vertical text alignment of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellVerticalAlignment', {\n *   value: 'top'\n * } );\n * ```\n *\n * The following values, corresponding to the\n * [`vertical-align` CSS attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align), are allowed:\n *\n * * `'top'`\n * * `'bottom'`\n *\n * The `'middle'` value is the default one so there is no need to set it.\n */\nexport class TableCellVerticalAlignmentCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellVerticalAlignmentCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value for the \"alignment\" attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellVerticalAlignment', defaultValue);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\n/**\n * The table cell horizontal alignment command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellHorizontalAlignment'` editor command.\n *\n * To change the horizontal text alignment of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellHorizontalAlignment', {\n *  value: 'right'\n * } );\n * ```\n */\nexport class TableCellHorizontalAlignmentCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellHorizontalAlignmentCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value for the \"alignment\" attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellHorizontalAlignment', defaultValue);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\nimport { getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table cell border style command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellBorderStyle'` editor command.\n *\n * To change the border style of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellBorderStyle', {\n *   value: 'dashed'\n * } );\n * ```\n */\nexport class TableCellBorderStyleCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellBorderStyleCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellBorderStyle', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getAttribute(tableCell) {\n        if (!tableCell) {\n            return;\n        }\n        const value = getSingleValue(tableCell.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\nimport { getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table cell border color command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellBorderColor'` editor command.\n *\n * To change the border color of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellBorderColor', {\n *   value: '#f00'\n * } );\n * ```\n */\nexport class TableCellBorderColorCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellBorderColorCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellBorderColor', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getAttribute(tableCell) {\n        if (!tableCell) {\n            return;\n        }\n        const value = getSingleValue(tableCell.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { TableCellPropertyCommand } from './tablecellpropertycommand.js';\nimport { addDefaultUnitToNumericValue, getSingleValue } from '../../utils/table-properties.js';\n/**\n * The table cell border width command.\n *\n * The command is registered by the {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing} as\n * the `'tableCellBorderWidth'` editor command.\n *\n * To change the border width of selected cells, execute the command:\n *\n * ```ts\n * editor.execute( 'tableCellBorderWidth', {\n *   value: '5px'\n * } );\n * ```\n *\n * **Note**: This command adds the default `'px'` unit to numeric values. Executing:\n *\n * ```ts\n * editor.execute( 'tableCellBorderWidth', {\n *   value: '5'\n * } );\n * ```\n *\n * will set the `borderWidth` attribute to `'5px'` in the model.\n */\nexport class TableCellBorderWidthCommand extends TableCellPropertyCommand {\n    /**\n     * Creates a new `TableCellBorderWidthCommand` instance.\n     *\n     * @param editor An editor in which this command will be used.\n     * @param defaultValue The default value of the attribute.\n     */\n    constructor(editor, defaultValue) {\n        super(editor, 'tableCellBorderWidth', defaultValue);\n    }\n    /**\n     * @inheritDoc\n     */\n    _getAttribute(tableCell) {\n        if (!tableCell) {\n            return;\n        }\n        const value = getSingleValue(tableCell.getAttribute(this.attributeName));\n        if (value === this._defaultValue) {\n            return;\n        }\n        return value;\n    }\n    /**\n     * @inheritDoc\n     */\n    _getValueToSet(value) {\n        const newValue = addDefaultUnitToNumericValue(value, 'px');\n        if (newValue === this._defaultValue) {\n            return;\n        }\n        return newValue;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecellproperties/tablecellpropertiesediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { addBorderStylesRules, addPaddingStylesRules, addBackgroundStylesRules } from 'ckeditor5/src/engine.js';\nimport { downcastAttributeToStyle, getDefaultValueAdjusted, upcastBorderStyles } from '../converters/tableproperties.js';\nimport { TableEditing } from './../tableediting.js';\nimport { TableCellWidthEditing } from '../tablecellwidth/tablecellwidthediting.js';\nimport { TableCellPaddingCommand } from './commands/tablecellpaddingcommand.js';\nimport { TableCellHeightCommand } from './commands/tablecellheightcommand.js';\nimport { TableCellBackgroundColorCommand } from './commands/tablecellbackgroundcolorcommand.js';\nimport { TableCellVerticalAlignmentCommand } from './commands/tablecellverticalalignmentcommand.js';\nimport { TableCellHorizontalAlignmentCommand } from './commands/tablecellhorizontalalignmentcommand.js';\nimport { TableCellBorderStyleCommand } from './commands/tablecellborderstylecommand.js';\nimport { TableCellBorderColorCommand } from './commands/tablecellbordercolorcommand.js';\nimport { TableCellBorderWidthCommand } from './commands/tablecellborderwidthcommand.js';\nimport { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';\nimport { enableProperty } from '../utils/common.js';\nconst VALIGN_VALUES_REG_EXP = /^(top|middle|bottom)$/;\nconst ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;\n/**\n * The table cell properties editing feature.\n *\n * Introduces table cell model attributes and their conversion:\n *\n * - border: `tableCellBorderStyle`, `tableCellBorderColor` and `tableCellBorderWidth`\n * - background color: `tableCellBackgroundColor`\n * - cell padding: `tableCellPadding`\n * - horizontal and vertical alignment: `tableCellHorizontalAlignment`, `tableCellVerticalAlignment`\n * - cell width and height: `tableCellWidth`, `tableCellHeight`\n *\n * It also registers commands used to manipulate the above attributes:\n *\n * - border: the `'tableCellBorderStyle'`, `'tableCellBorderColor'` and `'tableCellBorderWidth'` commands\n * - background color: the `'tableCellBackgroundColor'` command\n * - cell padding: the `'tableCellPadding'` command\n * - horizontal and vertical alignment: the `'tableCellHorizontalAlignment'` and `'tableCellVerticalAlignment'` commands\n * - width and height: the `'tableCellWidth'` and `'tableCellHeight'` commands\n */\nexport class TableCellPropertiesEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCellPropertiesEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'TCP';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableEditing, TableCellWidthEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        editor.config.define('table.tableCellProperties.defaultProperties', {});\n        const defaultTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {\n            includeVerticalAlignmentProperty: true,\n            includeHorizontalAlignmentProperty: true,\n            includePaddingProperty: true,\n            isRightToLeftContent: editor.locale.contentLanguageDirection === 'rtl'\n        });\n        editor.data.addStyleProcessorRules(addBorderStylesRules);\n        enableBorderProperties(editor, {\n            color: defaultTableCellProperties.borderColor,\n            style: defaultTableCellProperties.borderStyle,\n            width: defaultTableCellProperties.borderWidth\n        });\n        editor.commands.add('tableCellBorderStyle', new TableCellBorderStyleCommand(editor, defaultTableCellProperties.borderStyle));\n        editor.commands.add('tableCellBorderColor', new TableCellBorderColorCommand(editor, defaultTableCellProperties.borderColor));\n        editor.commands.add('tableCellBorderWidth', new TableCellBorderWidthCommand(editor, defaultTableCellProperties.borderWidth));\n        enableProperty(schema, conversion, {\n            modelAttribute: 'tableCellHeight',\n            styleName: 'height',\n            attributeName: 'height',\n            attributeType: 'length',\n            defaultValue: defaultTableCellProperties.height\n        });\n        editor.commands.add('tableCellHeight', new TableCellHeightCommand(editor, defaultTableCellProperties.height));\n        editor.data.addStyleProcessorRules(addPaddingStylesRules);\n        enableProperty(schema, conversion, {\n            modelAttribute: 'tableCellPadding',\n            styleName: 'padding',\n            reduceBoxSides: true,\n            defaultValue: defaultTableCellProperties.padding\n        });\n        editor.commands.add('tableCellPadding', new TableCellPaddingCommand(editor, defaultTableCellProperties.padding));\n        editor.data.addStyleProcessorRules(addBackgroundStylesRules);\n        enableProperty(schema, conversion, {\n            modelAttribute: 'tableCellBackgroundColor',\n            styleName: 'background-color',\n            attributeName: 'bgcolor',\n            attributeType: 'color',\n            defaultValue: defaultTableCellProperties.backgroundColor\n        });\n        editor.commands.add('tableCellBackgroundColor', new TableCellBackgroundColorCommand(editor, defaultTableCellProperties.backgroundColor));\n        enableHorizontalAlignmentProperty(schema, conversion, defaultTableCellProperties.horizontalAlignment);\n        editor.commands.add('tableCellHorizontalAlignment', new TableCellHorizontalAlignmentCommand(editor, defaultTableCellProperties.horizontalAlignment));\n        enableVerticalAlignmentProperty(schema, conversion, defaultTableCellProperties.verticalAlignment);\n        editor.commands.add('tableCellVerticalAlignment', new TableCellVerticalAlignmentCommand(editor, defaultTableCellProperties.verticalAlignment));\n    }\n}\n/**\n * Enables the `'tableCellBorderStyle'`, `'tableCellBorderColor'` and `'tableCellBorderWidth'` attributes for table cells.\n *\n * @param editor The editor instance.\n * @param defaultBorder The default border values.\n * @param defaultBorder.color The default `tableCellBorderColor` value.\n * @param defaultBorder.style The default `tableCellBorderStyle` value.\n * @param defaultBorder.width The default `tableCellBorderWidth` value.\n */\nfunction enableBorderProperties(editor, defaultBorder) {\n    const { conversion } = editor;\n    const { schema } = editor.model;\n    const modelAttributes = {\n        width: 'tableCellBorderWidth',\n        color: 'tableCellBorderColor',\n        style: 'tableCellBorderStyle'\n    };\n    schema.extend('tableCell', {\n        allowAttributes: Object.values(modelAttributes)\n    });\n    for (const modelAttribute of Object.values(modelAttributes)) {\n        schema.setAttributeProperties(modelAttribute, { isFormatting: true });\n    }\n    upcastBorderStyles(editor, 'td', modelAttributes, defaultBorder);\n    upcastBorderStyles(editor, 'th', modelAttributes, defaultBorder);\n    downcastAttributeToStyle(conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.style, styleName: 'border-style' });\n    downcastAttributeToStyle(conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.color, styleName: 'border-color' });\n    downcastAttributeToStyle(conversion, { modelElement: 'tableCell', modelAttribute: modelAttributes.width, styleName: 'border-width' });\n}\n/**\n * Enables the `'tableCellHorizontalAlignment'` attribute for table cells.\n *\n * @param defaultValue The default horizontal alignment value.\n */\nfunction enableHorizontalAlignmentProperty(schema, conversion, defaultValue) {\n    schema.extend('tableCell', {\n        allowAttributes: ['tableCellHorizontalAlignment']\n    });\n    schema.setAttributeProperties('tableCellHorizontalAlignment', { isFormatting: true });\n    conversion.for('downcast')\n        .attributeToAttribute({\n        model: {\n            name: 'tableCell',\n            key: 'tableCellHorizontalAlignment'\n        },\n        view: alignment => ({\n            key: 'style',\n            value: {\n                'text-align': alignment\n            }\n        })\n    });\n    conversion.for('upcast')\n        // Support for the `text-align:*;` CSS definition for the table cell alignment.\n        .attributeToAttribute({\n        view: {\n            name: /^(td|th)$/,\n            styles: {\n                'text-align': ALIGN_VALUES_REG_EXP\n            }\n        },\n        model: {\n            key: 'tableCellHorizontalAlignment',\n            value: (viewElement, conversionApi, data) => {\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);\n                const align = viewElement.getStyle('text-align');\n                if (align !== localDefaultValue) {\n                    return align;\n                }\n                // Consume the style even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { styles: 'text-align' });\n            }\n        }\n    })\n        // Support for the `align` attribute as the backward compatibility while pasting from other sources.\n        .attributeToAttribute({\n        view: {\n            name: /^(td|th)$/,\n            attributes: {\n                align: ALIGN_VALUES_REG_EXP\n            }\n        },\n        model: {\n            key: 'tableCellHorizontalAlignment',\n            value: (viewElement, conversionApi, data) => {\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'left', data);\n                const align = viewElement.getAttribute('align');\n                if (align !== localDefaultValue) {\n                    return align;\n                }\n                // Consume the style even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { attributes: 'align' });\n            }\n        }\n    });\n}\n/**\n * Enables the `'verticalAlignment'` attribute for table cells.\n *\n * @param defaultValue The default vertical alignment value.\n */\nfunction enableVerticalAlignmentProperty(schema, conversion, defaultValue) {\n    schema.extend('tableCell', {\n        allowAttributes: ['tableCellVerticalAlignment']\n    });\n    schema.setAttributeProperties('tableCellVerticalAlignment', { isFormatting: true });\n    conversion.for('downcast')\n        .attributeToAttribute({\n        model: {\n            name: 'tableCell',\n            key: 'tableCellVerticalAlignment'\n        },\n        view: alignment => ({\n            key: 'style',\n            value: {\n                'vertical-align': alignment\n            }\n        })\n    });\n    conversion.for('upcast')\n        // Support for the `vertical-align:*;` CSS definition for the table cell alignment.\n        .attributeToAttribute({\n        view: {\n            name: /^(td|th)$/,\n            styles: {\n                'vertical-align': VALIGN_VALUES_REG_EXP\n            }\n        },\n        model: {\n            key: 'tableCellVerticalAlignment',\n            value: (viewElement, conversionApi, data) => {\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);\n                const align = viewElement.getStyle('vertical-align');\n                if (align !== localDefaultValue) {\n                    return align;\n                }\n                // Consume the style even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { styles: 'vertical-align' });\n            }\n        }\n    })\n        // Support for the `align` attribute as the backward compatibility while pasting from other sources.\n        .attributeToAttribute({\n        view: {\n            name: /^(td|th)$/,\n            attributes: {\n                valign: VALIGN_VALUES_REG_EXP\n            }\n        },\n        model: {\n            key: 'tableCellVerticalAlignment',\n            value: (viewElement, conversionApi, data) => {\n                const localDefaultValue = getDefaultValueAdjusted(defaultValue, 'middle', data);\n                const valign = viewElement.getAttribute('valign');\n                if (valign !== localDefaultValue) {\n                    return valign;\n                }\n                // Consume the attribute even if not applied to the element so it won't be processed by other converters.\n                conversionApi.consumable.consume(viewElement, { attributes: 'valign' });\n            }\n        }\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module indent/indentediting\n */\nimport { Plugin, MultiCommand } from 'ckeditor5/src/core.js';\n/**\n * The indent editing feature.\n *\n * This plugin registers the `'indent'` and `'outdent'` commands.\n *\n * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in the\n * {@link module:indent/indent~Indent indent feature} API documentation.\n */\nexport class IndentEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'IndentEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.commands.add('indent', new MultiCommand(editor));\n        editor.commands.add('outdent', new MultiCommand(editor));\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5M1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5m1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module indent/indentui\n */\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconIndent, IconOutdent } from 'ckeditor5/src/icons.js';\n/**\n * The indent UI feature.\n *\n * This plugin registers the `'indent'` and `'outdent'` buttons.\n *\n * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in\n * the {@link module:indent/indent~Indent indent feature} API documentation.\n */\nexport class IndentUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'IndentUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const t = editor.t;\n        const localizedIndentIcon = locale.uiLanguageDirection == 'ltr' ? IconIndent : IconOutdent;\n        const localizedOutdentIcon = locale.uiLanguageDirection == 'ltr' ? IconOutdent : IconIndent;\n        this._defineButton('indent', t('Increase indent'), localizedIndentIcon);\n        this._defineButton('outdent', t('Decrease indent'), localizedOutdentIcon);\n    }\n    /**\n     * Defines UI buttons for both toolbar and menu bar.\n     */\n    _defineButton(commandName, label, icon) {\n        const editor = this.editor;\n        editor.ui.componentFactory.add(commandName, () => {\n            const buttonView = this._createButton(ButtonView, commandName, label, icon);\n            buttonView.set({\n                tooltip: true\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:' + commandName, () => {\n            return this._createButton(MenuBarMenuListItemButtonView, commandName, label, icon);\n        });\n    }\n    /**\n     * Creates a button to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass, commandName, label, icon) {\n        const editor = this.editor;\n        const command = editor.commands.get(commandName);\n        const view = new ButtonClass(editor.locale);\n        view.set({\n            label,\n            icon\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute(commandName);\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module indent/indentblockcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * The indent block command.\n *\n * The command is registered by the {@link module:indent/indentblock~IndentBlock} as `'indentBlock'` for indenting blocks and\n * `'outdentBlock'` for outdenting blocks.\n *\n * To increase block indentation at the current selection, execute the command:\n *\n * ```ts\n * editor.execute( 'indentBlock' );\n * ```\n *\n * To decrease block indentation at the current selection, execute the command:\n *\n * ```ts\n * editor.execute( 'outdentBlock' );\n * ```\n */\nexport class IndentBlockCommand extends Command {\n    /**\n     * The command's indentation behavior.\n     */\n    _indentBehavior;\n    /**\n     * Creates an instance of the command.\n     */\n    constructor(editor, indentBehavior) {\n        super(editor);\n        this._indentBehavior = indentBehavior;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const model = editor.model;\n        const block = first(model.document.selection.getSelectedBlocks());\n        if (!block || !this._isIndentationChangeAllowed(block)) {\n            this.isEnabled = false;\n            return;\n        }\n        this.isEnabled = this._indentBehavior.checkEnabled(block.getAttribute('blockIndent'));\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const model = this.editor.model;\n        const blocksToChange = this._getBlocksToChange();\n        model.change(writer => {\n            for (const block of blocksToChange) {\n                const currentIndent = block.getAttribute('blockIndent');\n                const nextIndent = this._indentBehavior.getNextIndent(currentIndent);\n                if (nextIndent) {\n                    writer.setAttribute('blockIndent', nextIndent, block);\n                }\n                else {\n                    writer.removeAttribute('blockIndent', block);\n                }\n            }\n        });\n    }\n    /**\n     * Returns blocks from selection that should have blockIndent selection set.\n     */\n    _getBlocksToChange() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const blocksInSelection = Array.from(selection.getSelectedBlocks());\n        return blocksInSelection.filter(block => this._isIndentationChangeAllowed(block));\n    }\n    /**\n     * Returns false if indentation cannot be applied, i.e.:\n     * - for blocks disallowed by schema declaration\n     * - for blocks in Document Lists (disallowed forward indentation only). See https://github.com/ckeditor/ckeditor5/issues/14155.\n     * Otherwise returns true.\n     */\n    _isIndentationChangeAllowed(element) {\n        const editor = this.editor;\n        if (!editor.model.schema.checkAttribute(element, 'blockIndent')) {\n            return false;\n        }\n        if (!editor.plugins.has('ListUtils')) {\n            return true;\n        }\n        // Only forward indentation is disallowed in list items. This allows the user to outdent blocks that are already indented.\n        if (!this._indentBehavior.isForward) {\n            return true;\n        }\n        const listUtils = editor.plugins.get('ListUtils');\n        return !listUtils.isListItemBlock(element);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * The block indentation behavior that uses offsets to set indentation.\n *\n * @internal\n */\nexport class IndentUsingOffset {\n    /**\n     * The direction of indentation.\n     */\n    isForward;\n    /**\n     * The offset of the next indentation step.\n     */\n    offset;\n    /**\n     * Indentation unit.\n     */\n    unit;\n    /**\n     * Creates an instance of the indentation behavior.\n     *\n     * @param config.direction The direction of indentation.\n     * @param config.offset The offset of the next indentation step.\n     * @param config.unit Indentation unit.\n     */\n    constructor(config) {\n        this.isForward = config.direction === 'forward';\n        this.offset = config.offset;\n        this.unit = config.unit;\n    }\n    /**\n     * @inheritDoc\n     */\n    checkEnabled(indentAttributeValue) {\n        const currentOffset = parseFloat(indentAttributeValue || '0');\n        // The command is always enabled for forward indentation.\n        return this.isForward || currentOffset > 0;\n    }\n    /**\n     * @inheritDoc\n     */\n    getNextIndent(indentAttributeValue) {\n        const currentOffset = parseFloat(indentAttributeValue || '0');\n        const isSameUnit = !indentAttributeValue || indentAttributeValue.endsWith(this.unit);\n        if (!isSameUnit) {\n            return this.isForward ? this.offset + this.unit : undefined;\n        }\n        const nextOffset = this.isForward ? this.offset : -this.offset;\n        const offsetToSet = currentOffset + nextOffset;\n        return offsetToSet > 0 ? offsetToSet + this.unit : undefined;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * The block indentation behavior that uses classes to set indentation.\n *\n * @internal\n */\nexport class IndentUsingClasses {\n    /**\n     * The direction of indentation.\n     */\n    isForward;\n    /**\n     * A list of classes used for indentation.\n     */\n    classes;\n    /**\n     * Creates an instance of the indentation behavior.\n     *\n     * @param config.direction The direction of indentation.\n     * @param config.classes A list of classes used for indentation.\n     */\n    constructor(config) {\n        this.isForward = config.direction === 'forward';\n        this.classes = config.classes;\n    }\n    /**\n     * @inheritDoc\n     */\n    checkEnabled(indentAttributeValue) {\n        const currentIndex = this.classes.indexOf(indentAttributeValue);\n        if (this.isForward) {\n            return currentIndex < this.classes.length - 1;\n        }\n        else {\n            return currentIndex >= 0;\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    getNextIndent(indentAttributeValue) {\n        const currentIndex = this.classes.indexOf(indentAttributeValue);\n        const indexStep = this.isForward ? 1 : -1;\n        return this.classes[currentIndex + indexStep];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module indent/indentblock\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { addMarginStylesRules } from 'ckeditor5/src/engine.js';\nimport { IndentBlockCommand } from './indentblockcommand.js';\nimport { IndentUsingOffset } from './indentcommandbehavior/indentusingoffset.js';\nimport { IndentUsingClasses } from './indentcommandbehavior/indentusingclasses.js';\nconst DEFAULT_ELEMENTS = ['paragraph', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6'];\n/**\n * The block indentation feature.\n *\n * It registers the `'indentBlock'` and `'outdentBlock'` commands.\n *\n * If the plugin {@link module:indent/indent~Indent} is defined, it also attaches the `'indentBlock'` and `'outdentBlock'` commands to\n * the `'indent'` and `'outdent'` commands.\n */\nexport class IndentBlock extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('indentBlock', {\n            offset: 40,\n            unit: 'px'\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'IndentBlock';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const configuration = editor.config.get('indentBlock');\n        if (configuration.classes && configuration.classes.length) {\n            this._setupConversionUsingClasses(configuration.classes);\n            editor.commands.add('indentBlock', new IndentBlockCommand(editor, new IndentUsingClasses({\n                direction: 'forward',\n                classes: configuration.classes\n            })));\n            editor.commands.add('outdentBlock', new IndentBlockCommand(editor, new IndentUsingClasses({\n                direction: 'backward',\n                classes: configuration.classes\n            })));\n        }\n        else {\n            editor.data.addStyleProcessorRules(addMarginStylesRules);\n            this._setupConversionUsingOffset();\n            editor.commands.add('indentBlock', new IndentBlockCommand(editor, new IndentUsingOffset({\n                direction: 'forward',\n                offset: configuration.offset,\n                unit: configuration.unit\n            })));\n            editor.commands.add('outdentBlock', new IndentBlockCommand(editor, new IndentUsingOffset({\n                direction: 'backward',\n                offset: configuration.offset,\n                unit: configuration.unit\n            })));\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const indentCommand = editor.commands.get('indent');\n        const outdentCommand = editor.commands.get('outdent');\n        // Enable block indentation to heading configuration options. If it is not defined enable in paragraph and default headings.\n        const options = editor.config.get('heading.options');\n        const configuredElements = options && options.map(option => option.model);\n        const knownElements = configuredElements || DEFAULT_ELEMENTS;\n        knownElements.forEach(elementName => {\n            if (schema.isRegistered(elementName)) {\n                schema.extend(elementName, { allowAttributes: 'blockIndent' });\n            }\n        });\n        schema.setAttributeProperties('blockIndent', { isFormatting: true });\n        indentCommand.registerChildCommand(editor.commands.get('indentBlock'));\n        outdentCommand.registerChildCommand(editor.commands.get('outdentBlock'));\n    }\n    /**\n     * Setups conversion for using offset indents.\n     */\n    _setupConversionUsingOffset() {\n        const conversion = this.editor.conversion;\n        const locale = this.editor.locale;\n        const marginProperty = locale.contentLanguageDirection === 'rtl' ? 'margin-right' : 'margin-left';\n        conversion.for('upcast').attributeToAttribute({\n            view: {\n                styles: {\n                    [marginProperty]: /[\\s\\S]+/\n                }\n            },\n            model: {\n                key: 'blockIndent',\n                value: (viewElement) => {\n                    // Do not indent block elements in Document Lists. See https://github.com/ckeditor/ckeditor5/issues/12466.\n                    if (!viewElement.is('element', 'li')) {\n                        return viewElement.getStyle(marginProperty);\n                    }\n                }\n            }\n        });\n        conversion.for('downcast').attributeToAttribute({\n            model: 'blockIndent',\n            view: modelAttributeValue => {\n                return {\n                    key: 'style',\n                    value: {\n                        [marginProperty]: modelAttributeValue\n                    }\n                };\n            }\n        });\n    }\n    /**\n     * Setups conversion for using classes.\n     */\n    _setupConversionUsingClasses(classes) {\n        const definition = {\n            model: {\n                key: 'blockIndent',\n                values: []\n            },\n            view: {}\n        };\n        for (const className of classes) {\n            definition.model.values.push(className);\n            definition.view[className] = {\n                key: 'class',\n                value: [className]\n            };\n        }\n        this.editor.conversion.attributeToAttribute(definition);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module highlight/highlightcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The highlight command. It is used by the {@link module:highlight/highlightediting~HighlightEditing highlight feature}\n * to apply the text highlighting.\n *\n * ```ts\n * editor.execute( 'highlight', { value: 'greenMarker' } );\n * ```\n *\n * **Note**: Executing the command without a value removes the attribute from the model. If the selection is collapsed\n * inside a text with the highlight attribute, the command will remove the attribute from the entire range\n * of that text.\n */\nexport class HighlightCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const doc = model.document;\n        this.value = doc.selection.getAttribute('highlight');\n        this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, 'highlight');\n    }\n    /**\n     * Executes the command.\n     *\n     * @param options Options for the executed command.\n     * @param options.value The value to apply.\n     *\n     * @fires execute\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        const selection = document.selection;\n        const highlighter = options.value;\n        model.change(writer => {\n            if (selection.isCollapsed) {\n                const position = selection.getFirstPosition();\n                // When selection is inside text with `highlight` attribute.\n                if (selection.hasAttribute('highlight')) {\n                    // Find the full highlighted range.\n                    const isSameHighlight = (value) => {\n                        return value.item.hasAttribute('highlight') && value.item.getAttribute('highlight') === this.value;\n                    };\n                    const highlightStart = position.getLastMatchingPosition(isSameHighlight, { direction: 'backward' });\n                    const highlightEnd = position.getLastMatchingPosition(isSameHighlight);\n                    const highlightRange = writer.createRange(highlightStart, highlightEnd);\n                    // Then depending on current value...\n                    if (!highlighter || this.value === highlighter) {\n                        // ...remove attribute when passing highlighter different then current or executing \"eraser\".\n                        // If we're at the end of the highlighted range, we don't want to remove highlight of the range.\n                        if (!position.isEqual(highlightEnd)) {\n                            writer.removeAttribute('highlight', highlightRange);\n                        }\n                        writer.removeSelectionAttribute('highlight');\n                    }\n                    else {\n                        // ...update `highlight` value.\n                        // If we're at the end of the highlighted range, we don't want to change the highlight of the range.\n                        if (!position.isEqual(highlightEnd)) {\n                            writer.setAttribute('highlight', highlighter, highlightRange);\n                        }\n                        writer.setSelectionAttribute('highlight', highlighter);\n                    }\n                }\n                else if (highlighter) {\n                    writer.setSelectionAttribute('highlight', highlighter);\n                }\n            }\n            else {\n                const ranges = model.schema.getValidRanges(selection.getRanges(), 'highlight');\n                for (const range of ranges) {\n                    if (highlighter) {\n                        writer.setAttribute('highlight', highlighter, range);\n                    }\n                    else {\n                        writer.removeAttribute('highlight', range);\n                    }\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module highlight/highlightediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { HighlightCommand } from './highlightcommand.js';\n/**\n * The highlight editing feature. It introduces the {@link module:highlight/highlightcommand~HighlightCommand command} and the `highlight`\n * attribute in the {@link module:engine/model/model~Model model} which renders in the {@link module:engine/view/view view}\n * as a `<mark>` element with a `class` attribute (`<mark class=\"marker-green\">...</mark>`) depending\n * on the {@link module:highlight/highlightconfig~HighlightConfig configuration}.\n */\nexport class HighlightEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HighlightEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('highlight', {\n            options: [\n                {\n                    model: 'yellowMarker',\n                    class: 'marker-yellow',\n                    title: 'Yellow marker',\n                    color: 'var(--ck-content-highlight-marker-yellow)',\n                    type: 'marker'\n                },\n                {\n                    model: 'greenMarker',\n                    class: 'marker-green',\n                    title: 'Green marker',\n                    color: 'var(--ck-content-highlight-marker-green)',\n                    type: 'marker'\n                },\n                {\n                    model: 'pinkMarker',\n                    class: 'marker-pink',\n                    title: 'Pink marker',\n                    color: 'var(--ck-content-highlight-marker-pink)',\n                    type: 'marker'\n                },\n                {\n                    model: 'blueMarker',\n                    class: 'marker-blue',\n                    title: 'Blue marker',\n                    color: 'var(--ck-content-highlight-marker-blue)',\n                    type: 'marker'\n                },\n                {\n                    model: 'redPen',\n                    class: 'pen-red',\n                    title: 'Red pen',\n                    color: 'var(--ck-content-highlight-pen-red)',\n                    type: 'pen'\n                },\n                {\n                    model: 'greenPen',\n                    class: 'pen-green',\n                    title: 'Green pen',\n                    color: 'var(--ck-content-highlight-pen-green)',\n                    type: 'pen'\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Allow highlight attribute on text nodes.\n        editor.model.schema.extend('$text', { allowAttributes: 'highlight' });\n        const options = editor.config.get('highlight.options');\n        // Set-up the two-way conversion.\n        editor.conversion.attributeToElement(_buildDefinition(options));\n        editor.commands.add('highlight', new HighlightCommand(editor));\n    }\n}\n/**\n * Converts the options array to a converter definition.\n *\n * @param options An array with configured options.\n */\nfunction _buildDefinition(options) {\n    const definition = {\n        model: {\n            key: 'highlight',\n            values: []\n        },\n        view: {}\n    };\n    for (const option of options) {\n        definition.model.values.push(option.model);\n        definition.view[option.model] = {\n            name: 'mark',\n            classes: option.class\n        };\n    }\n    return definition;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module highlight/highlightui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconEraser, IconMarker, IconPen } from 'ckeditor5/src/icons.js';\nimport { addToolbarToDropdown, createDropdown, ButtonView, ListSeparatorView, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView, SplitButtonView, ToolbarSeparatorView } from 'ckeditor5/src/ui.js';\nimport './../theme/highlight.css';\n/**\n * The default highlight UI plugin. It introduces:\n *\n * * The `'highlight'` dropdown,\n * * The `'removeHighlight'` and `'highlight:*'` buttons.\n *\n * The default configuration includes the following buttons:\n *\n * * `'highlight:yellowMarker'`\n * * `'highlight:greenMarker'`\n * * `'highlight:pinkMarker'`\n * * `'highlight:blueMarker'`\n * * `'highlight:redPen'`\n * * `'highlight:greenPen'`\n *\n * See the {@link module:highlight/highlightconfig~HighlightConfig#options configuration} to learn more\n * about the defaults.\n */\nexport class HighlightUI extends Plugin {\n    /**\n     * Returns the localized option titles provided by the plugin.\n     *\n     * The following localized titles corresponding with default\n     * {@link module:highlight/highlightconfig~HighlightConfig#options} are available:\n     *\n     * * `'Yellow marker'`,\n     * * `'Green marker'`,\n     * * `'Pink marker'`,\n     * * `'Blue marker'`,\n     * * `'Red pen'`,\n     * * `'Green pen'`.\n     */\n    get localizedOptionTitles() {\n        const t = this.editor.t;\n        return {\n            'Yellow marker': t('Yellow marker'),\n            'Green marker': t('Green marker'),\n            'Pink marker': t('Pink marker'),\n            'Blue marker': t('Blue marker'),\n            'Red pen': t('Red pen'),\n            'Green pen': t('Green pen')\n        };\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HighlightUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const options = this.editor.config.get('highlight.options');\n        for (const option of options) {\n            this._addHighlighterButton(option);\n        }\n        this._addRemoveHighlightButton();\n        this._addDropdown(options);\n        this._addMenuBarButton(options);\n    }\n    /**\n     * Creates the \"Remove highlight\" button.\n     */\n    _addRemoveHighlightButton() {\n        const t = this.editor.t;\n        const command = this.editor.commands.get('highlight');\n        this._addButton('removeHighlight', t('Remove highlight'), IconEraser, null, button => {\n            button.bind('isEnabled').to(command, 'isEnabled');\n        });\n    }\n    /**\n     * Creates a toolbar button from the provided highlight option.\n     */\n    _addHighlighterButton(option) {\n        const command = this.editor.commands.get('highlight');\n        // TODO: change naming\n        this._addButton('highlight:' + option.model, option.title, getIconForType(option.type), option.model, decorateHighlightButton);\n        function decorateHighlightButton(button) {\n            button.bind('isEnabled').to(command, 'isEnabled');\n            button.bind('isOn').to(command, 'value', value => value === option.model);\n            button.iconView.fillColor = option.color;\n            button.isToggleable = true;\n        }\n    }\n    /**\n     * Internal method for creating highlight buttons.\n     *\n     * @param name The name of the button.\n     * @param label The label for the button.\n     * @param icon The button icon.\n     * @param value The `value` property passed to the executed command.\n     * @param decorateButton A callback getting ButtonView instance so that it can be further customized.\n     */\n    _addButton(name, label, icon, value, decorateButton) {\n        const editor = this.editor;\n        editor.ui.componentFactory.add(name, locale => {\n            const buttonView = new ButtonView(locale);\n            const localized = this.localizedOptionTitles[label] ? this.localizedOptionTitles[label] : label;\n            buttonView.set({\n                label: localized,\n                icon,\n                tooltip: true\n            });\n            buttonView.on('execute', () => {\n                editor.execute('highlight', { value });\n                editor.editing.view.focus();\n            });\n            // Add additional behavior for buttonView.\n            decorateButton(buttonView);\n            return buttonView;\n        });\n    }\n    /**\n     * Creates the split button dropdown UI from the provided highlight options.\n     */\n    _addDropdown(options) {\n        const editor = this.editor;\n        const t = editor.t;\n        const componentFactory = editor.ui.componentFactory;\n        const startingHighlighter = options[0];\n        const optionsMap = options.reduce((retVal, option) => {\n            retVal[option.model] = option;\n            return retVal;\n        }, {});\n        componentFactory.add('highlight', locale => {\n            const command = editor.commands.get('highlight');\n            const dropdownView = createDropdown(locale, SplitButtonView);\n            const splitButtonView = dropdownView.buttonView;\n            splitButtonView.set({\n                label: t('Highlight'),\n                tooltip: true,\n                // Holds last executed highlighter.\n                lastExecuted: startingHighlighter.model,\n                // Holds current highlighter to execute (might be different then last used).\n                commandValue: startingHighlighter.model,\n                isToggleable: true\n            });\n            // Dropdown button changes to selection (command.value):\n            // - If selection is in highlight it get active highlight appearance (icon, color) and is activated.\n            // - Otherwise it gets appearance (icon, color) of last executed highlight.\n            splitButtonView.bind('icon').to(command, 'value', value => getIconForType(getActiveOption(value, 'type')));\n            splitButtonView.bind('color').to(command, 'value', value => getActiveOption(value, 'color'));\n            splitButtonView.bind('commandValue').to(command, 'value', value => getActiveOption(value, 'model'));\n            splitButtonView.bind('isOn').to(command, 'value', value => !!value);\n            splitButtonView.delegate('execute').to(dropdownView);\n            // Create buttons array.\n            const buttonsCreator = () => {\n                const buttons = options.map(option => {\n                    // Get existing highlighter button.\n                    const buttonView = componentFactory.create('highlight:' + option.model);\n                    // Update lastExecutedHighlight on execute.\n                    this.listenTo(buttonView, 'execute', () => {\n                        dropdownView.buttonView.set({ lastExecuted: option.model });\n                    });\n                    return buttonView;\n                });\n                // Add separator and eraser buttons to dropdown.\n                buttons.push(new ToolbarSeparatorView());\n                buttons.push(componentFactory.create('removeHighlight'));\n                return buttons;\n            };\n            // Make toolbar button enabled when any button in dropdown is enabled before adding separator and eraser.\n            dropdownView.bind('isEnabled').to(command, 'isEnabled');\n            addToolbarToDropdown(dropdownView, buttonsCreator, {\n                enableActiveItemFocusOnDropdownOpen: true,\n                ariaLabel: t('Text highlight toolbar')\n            });\n            bindToolbarIconStyleToActiveColor(dropdownView);\n            // Execute current action from dropdown's split button action button.\n            splitButtonView.on('execute', () => {\n                editor.execute('highlight', { value: splitButtonView.commandValue });\n            });\n            // Focus the editable after executing the command.\n            // It overrides a default behaviour where the focus is moved to the dropdown button (#12125).\n            this.listenTo(dropdownView, 'execute', () => {\n                editor.editing.view.focus();\n            });\n            /**\n             * Returns active highlighter option depending on current command value.\n             * If current is not set or it is the same as last execute this method will return the option key (like icon or color)\n             * of last executed highlighter. Otherwise it will return option key for current one.\n             */\n            function getActiveOption(current, key) {\n                const whichHighlighter = !current ||\n                    current === splitButtonView.lastExecuted ? splitButtonView.lastExecuted : current;\n                return optionsMap[whichHighlighter][key];\n            }\n            return dropdownView;\n        });\n    }\n    /**\n     * Creates the menu bar button for highlight including submenu with available options.\n     */\n    _addMenuBarButton(options) {\n        const editor = this.editor;\n        const t = editor.t;\n        const command = editor.commands.get('highlight');\n        editor.ui.componentFactory.add('menuBar:highlight', locale => {\n            const menuView = new MenuBarMenuView(locale);\n            menuView.buttonView.set({\n                label: t('Highlight'),\n                icon: getIconForType('marker')\n            });\n            menuView.bind('isEnabled').to(command);\n            menuView.buttonView.iconView.fillColor = 'transparent';\n            const listView = new MenuBarMenuListView(locale);\n            for (const option of options) {\n                const listItemView = new MenuBarMenuListItemView(locale, menuView);\n                const buttonView = new MenuBarMenuListItemButtonView(locale);\n                buttonView.set({\n                    label: option.title,\n                    icon: getIconForType(option.type),\n                    role: 'menuitemradio',\n                    isToggleable: true\n                });\n                buttonView.iconView.fillColor = option.color;\n                buttonView.delegate('execute').to(menuView);\n                buttonView.bind('isOn').to(command, 'value', value => value === option.model);\n                buttonView.on('execute', () => {\n                    editor.execute('highlight', { value: option.model });\n                    editor.editing.view.focus();\n                });\n                listItemView.children.add(buttonView);\n                listView.items.add(listItemView);\n            }\n            // Add remove highlight button\n            listView.items.add(new ListSeparatorView(locale));\n            const listItemView = new MenuBarMenuListItemView(locale, menuView);\n            const buttonView = new MenuBarMenuListItemButtonView(locale);\n            buttonView.set({\n                label: t('Remove highlight'),\n                icon: IconEraser\n            });\n            buttonView.delegate('execute').to(menuView);\n            buttonView.on('execute', () => {\n                editor.execute('highlight', { value: null });\n                editor.editing.view.focus();\n            });\n            listItemView.children.add(buttonView);\n            listView.items.add(listItemView);\n            menuView.panelView.children.add(listView);\n            return menuView;\n        });\n    }\n}\n/**\n * Extends split button icon style to reflect last used button style.\n */\nfunction bindToolbarIconStyleToActiveColor(dropdownView) {\n    const actionView = dropdownView.buttonView.actionView;\n    actionView.iconView.bind('fillColor').to(dropdownView.buttonView, 'color');\n}\n/**\n * Returns icon for given highlighter type.\n */\nfunction getIconForType(type) {\n    return type === 'marker' ? IconMarker : IconPen;\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z\\\" class=\\\"ck-icon__fill\\\"/><path d=\\\"m2.556 16.727.234-.348q-.445-.226-.498-.426-.054-.206.115-.837.14-.375.169-.595a4.5 4.5 0 0 0 0-.725q-.313-.931-.284-1.26.03-.327.475-.862l6.77-9.414q.808-1.365 3.199.18 2.39 1.549 1.784 2.686l-5.877 10.36q-.237.618-.526.782-.29.163-1.232.21-.543.196-.738.318t-.526.47q-.44.397-.632.397-.143 0-.524-.226l-.31.41zm-.279.415 1.575 1.103-.392.515H1.19zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574q.263-.375-1.092-1.192-1.354-.819-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568z\\\" class=\\\"ck-icon__fill\\\"/><path d=\\\"m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97q.249-.348.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005zm-.634.166-1.976.516-.026-1.918zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349M8.245 18.5 9.59 17h9.406v1.5z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/todolist/checktodolistcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getAllListItemBlocks } from '../list/utils/model.js';\n/**\n * The check to-do command.\n *\n * The command is registered by the {@link module:list/todolist/todolistediting~TodoListEditing} as\n * the `checkTodoList` editor command.\n */\nexport class CheckTodoListCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // Refresh command before executing to be sure all values are up to date.\n        // It is needed when selection has changed before command execution, in the same change block.\n        this.on('execute', () => {\n            this.refresh();\n        }, { priority: 'highest' });\n    }\n    /**\n     * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.\n     */\n    refresh() {\n        const selectedElements = this._getSelectedItems();\n        this.value = this._getValue(selectedElements);\n        this.isEnabled = !!selectedElements.length;\n    }\n    /**\n     * Executes the command.\n     *\n     * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply\n     * the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current\n     * value to decide what it should do.\n     */\n    execute(options = {}) {\n        this.editor.model.change(writer => {\n            const selectedElements = this._getSelectedItems();\n            const value = (options.forceValue === undefined) ? !this._getValue(selectedElements) : options.forceValue;\n            for (const element of selectedElements) {\n                if (value) {\n                    writer.setAttribute('todoListChecked', true, element);\n                }\n                else {\n                    writer.removeAttribute('todoListChecked', element);\n                }\n            }\n        });\n    }\n    /**\n     * Returns a value for the command.\n     */\n    _getValue(selectedElements) {\n        return selectedElements.every(element => element.getAttribute('todoListChecked'));\n    }\n    /**\n     * Gets all to-do list items selected by the {@link module:engine/model/selection~ModelSelection}.\n     */\n    _getSelectedItems() {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selectionRange = model.document.selection.getFirstRange();\n        const startElement = selectionRange.start.parent;\n        const elements = [];\n        if (schema.checkAttribute(startElement, 'todoListChecked')) {\n            elements.push(...getAllListItemBlocks(startElement));\n        }\n        for (const item of selectionRange.getItems({ shallow: true })) {\n            if (schema.checkAttribute(item, 'todoListChecked') && !elements.includes(item)) {\n                elements.push(...getAllListItemBlocks(item));\n            }\n        }\n        return elements;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/todolist/todocheckboxchangeobserver\n */\nimport { DomEventObserver } from 'ckeditor5/src/engine.js';\n/**\n * Observes all to-do list checkboxes state changes.\n *\n * Note that this observer is not available by default. To make it available it needs to be added to\n * {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.\n *\n * @internal\n */\nexport class TodoCheckboxChangeObserver extends DomEventObserver {\n    /**\n     * @inheritDoc\n     */\n    domEventType = ['change'];\n    /**\n     * @inheritDoc\n     */\n    onDomEvent(domEvent) {\n        if (domEvent.target) {\n            const viewTarget = this.view.domConverter.mapDomToView(domEvent.target);\n            if (viewTarget &&\n                viewTarget.is('element', 'input') &&\n                viewTarget.getAttribute('type') == 'checkbox' &&\n                viewTarget.findAncestor({ classes: 'todo-list__label' })) {\n                this.fire('todoCheckboxChange', domEvent);\n            }\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/todolist/todolistediting\n */\nimport { Matcher } from 'ckeditor5/src/engine.js';\nimport { getCode, parseKeystroke, getLocalizedArrowKeyCodeDirection } from 'ckeditor5/src/utils.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { getAllListItemBlocks, isFirstBlockOfListItem, isListItemBlock } from '../list/utils/model.js';\nimport { ListEditing } from '../list/listediting.js';\nimport { ListCommand } from '../list/listcommand.js';\nimport { CheckTodoListCommand } from './checktodolistcommand.js';\nimport { TodoCheckboxChangeObserver } from './todocheckboxchangeobserver.js';\nconst ITEM_TOGGLE_KEYSTROKE = /* #__PURE__ */ parseKeystroke('Ctrl+Enter');\n/**\n * The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.\n *\n * It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin}\n * and extends it with the commands:\n *\n * - `'todoList'`,\n * - `'checkTodoList'`,\n */\nexport class TodoListEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TodoListEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const editing = editor.editing;\n        const listEditing = editor.plugins.get(ListEditing);\n        const multiBlock = editor.config.get('list.multiBlock');\n        const elementName = multiBlock ? 'paragraph' : 'listItem';\n        editor.commands.add('todoList', new ListCommand(editor, 'todo'));\n        editor.commands.add('checkTodoList', new CheckTodoListCommand(editor));\n        editing.view.addObserver(TodoCheckboxChangeObserver);\n        model.schema.extend('$listItem', { allowAttributes: 'todoListChecked' });\n        model.schema.addAttributeCheck(context => {\n            const item = context.last;\n            // Don't allow `todoListChecked` attribute on elements which are not todo list items.\n            if (!item.getAttribute('listItemId') || item.getAttribute('listType') != 'todo') {\n                return false;\n            }\n        }, 'todoListChecked');\n        editor.conversion.for('upcast').add(dispatcher => {\n            // Upcast of to-do list item is based on a checkbox at the beginning of a <li> to keep compatibility with markdown input.\n            dispatcher.on('element:input', todoItemInputConverter());\n            // Priority is set to low to allow generic list item converter to run first.\n            dispatcher.on('element:li', todoListItemUpcastConverter(), {\n                priority: 'low'\n            });\n            // Consume other elements that are normally generated in data downcast, so they won't get captured by GHS.\n            dispatcher.on('element:label', elementUpcastConsumingConverter({ name: 'label', classes: 'todo-list__label' }));\n            dispatcher.on('element:label', elementUpcastConsumingConverter({ name: 'label', classes: ['todo-list__label', 'todo-list__label_without-description'] }));\n            dispatcher.on('element:span', elementUpcastConsumingConverter({ name: 'span', classes: 'todo-list__label__description' }));\n            dispatcher.on('element:ul', attributeUpcastConsumingConverter({ name: 'ul', classes: 'todo-list' }));\n        });\n        editor.conversion.for('downcast').elementToElement({\n            model: elementName,\n            view: (element, { writer }) => {\n                if (isDescriptionBlock(element, listEditing.getListAttributeNames())) {\n                    return writer.createContainerElement('span', { class: 'todo-list__label__description' });\n                }\n            },\n            converterPriority: 'highest'\n        });\n        listEditing.registerDowncastStrategy({\n            scope: 'list',\n            attributeName: 'listType',\n            setAttributeOnDowncast(writer, value, element) {\n                if (value == 'todo') {\n                    writer.addClass('todo-list', element);\n                }\n                else {\n                    writer.removeClass('todo-list', element);\n                }\n            }\n        });\n        listEditing.registerDowncastStrategy({\n            scope: 'itemMarker',\n            attributeName: 'todoListChecked',\n            createElement(writer, modelElement, { dataPipeline }) {\n                if (modelElement.getAttribute('listType') != 'todo') {\n                    return null;\n                }\n                const viewElement = writer.createUIElement('input', {\n                    type: 'checkbox',\n                    ...(modelElement.getAttribute('todoListChecked') ?\n                        { checked: 'checked' } :\n                        null),\n                    ...(dataPipeline ?\n                        { disabled: 'disabled' } :\n                        { tabindex: '-1' })\n                });\n                if (dataPipeline) {\n                    return viewElement;\n                }\n                const wrapper = writer.createContainerElement('span', { contenteditable: 'false' }, viewElement);\n                wrapper.getFillerOffset = () => null;\n                return wrapper;\n            },\n            canWrapElement(modelElement) {\n                return isDescriptionBlock(modelElement, listEditing.getListAttributeNames());\n            },\n            createWrapperElement(writer, modelElement, { dataPipeline }) {\n                const classes = ['todo-list__label'];\n                if (!isDescriptionBlock(modelElement, listEditing.getListAttributeNames())) {\n                    classes.push('todo-list__label_without-description');\n                }\n                return writer.createAttributeElement(dataPipeline ? 'label' : 'span', {\n                    class: classes.join(' ')\n                });\n            }\n        });\n        // Verifies if a to-do list block requires reconversion of a first item downcasted as an item description.\n        listEditing.on('checkElement', (evt, { modelElement, viewElement }) => {\n            const isFirstTodoModelParagraphBlock = isDescriptionBlock(modelElement, listEditing.getListAttributeNames());\n            const hasViewClass = viewElement.hasClass('todo-list__label__description');\n            if (hasViewClass != isFirstTodoModelParagraphBlock) {\n                evt.return = true;\n                evt.stop();\n            }\n        });\n        // Verifies if a to-do list block requires reconversion of a checkbox element\n        // (for example there is a new paragraph inserted as a first block of a list item).\n        listEditing.on('checkElement', (evt, { modelElement, viewElement }) => {\n            const isFirstTodoModelItemBlock = modelElement.getAttribute('listType') == 'todo' && isFirstBlockOfListItem(modelElement);\n            let hasViewItemMarker = false;\n            const viewWalker = editor.editing.view.createPositionBefore(viewElement).getWalker({ direction: 'backward' });\n            for (const { item } of viewWalker) {\n                if (item.is('element') && editor.editing.mapper.toModelElement(item)) {\n                    break;\n                }\n                if (item.is('element', 'input') && item.getAttribute('type') == 'checkbox') {\n                    hasViewItemMarker = true;\n                }\n            }\n            if (hasViewItemMarker != isFirstTodoModelItemBlock) {\n                evt.return = true;\n                evt.stop();\n            }\n        });\n        // Make sure that all blocks of the same list item have the same todoListChecked attribute.\n        listEditing.on('postFixer', (evt, { listNodes, writer }) => {\n            for (const { node, previousNodeInList } of listNodes) {\n                // This is a first item of a nested list.\n                if (!previousNodeInList) {\n                    continue;\n                }\n                if (previousNodeInList.getAttribute('listItemId') != node.getAttribute('listItemId')) {\n                    continue;\n                }\n                const previousHasAttribute = previousNodeInList.hasAttribute('todoListChecked');\n                const nodeHasAttribute = node.hasAttribute('todoListChecked');\n                if (nodeHasAttribute && !previousHasAttribute) {\n                    writer.removeAttribute('todoListChecked', node);\n                    evt.return = true;\n                }\n                else if (!nodeHasAttribute && previousHasAttribute) {\n                    writer.setAttribute('todoListChecked', true, node);\n                    evt.return = true;\n                }\n            }\n        });\n        // Make sure that todoListChecked attribute is only present for to-do list items.\n        model.document.registerPostFixer(writer => {\n            const changes = model.document.differ.getChanges();\n            let wasFixed = false;\n            for (const change of changes) {\n                if (change.type == 'attribute' && change.attributeKey == 'listType') {\n                    const element = change.range.start.nodeAfter;\n                    if (change.attributeOldValue == 'todo' && element.hasAttribute('todoListChecked')) {\n                        writer.removeAttribute('todoListChecked', element);\n                        wasFixed = true;\n                    }\n                }\n                else if (change.type == 'insert' && change.name != '$text') {\n                    for (const { item } of writer.createRangeOn(change.position.nodeAfter)) {\n                        if (item.is('element') && item.getAttribute('listType') != 'todo' && item.hasAttribute('todoListChecked')) {\n                            writer.removeAttribute('todoListChecked', item);\n                            wasFixed = true;\n                        }\n                    }\n                }\n            }\n            return wasFixed;\n        });\n        // Toggle check state of selected to-do list items on keystroke.\n        this.listenTo(editing.view.document, 'keydown', (evt, data) => {\n            if (getCode(data) === ITEM_TOGGLE_KEYSTROKE) {\n                editor.execute('checkTodoList');\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        // Toggle check state of a to-do list item clicked on the checkbox.\n        this.listenTo(editing.view.document, 'todoCheckboxChange', (evt, data) => {\n            const viewTarget = data.target;\n            if (!viewTarget || !viewTarget.is('element', 'input')) {\n                return;\n            }\n            const viewPositionAfter = editing.view.createPositionAfter(viewTarget);\n            const modelPositionAfter = editing.mapper.toModelPosition(viewPositionAfter);\n            const modelElement = modelPositionAfter.parent;\n            if (modelElement && isListItemBlock(modelElement) && modelElement.getAttribute('listType') == 'todo') {\n                this._handleCheckmarkChange(modelElement);\n            }\n        });\n        // Jump at the start/end of the next node on right arrow key press, when selection is before the checkbox.\n        //\n        // <blockquote><p>Foo{}</p></blockquote>\n        // <ul><li><checkbox/>Bar</li></ul>\n        //\n        // press: `->`\n        //\n        // <blockquote><p>Foo</p></blockquote>\n        // <ul><li><checkbox/>{}Bar</li></ul>\n        //\n        this.listenTo(editing.view.document, 'arrowKey', jumpOverCheckmarkOnSideArrowKeyPress(model, editor.locale), { context: '$text' });\n        // Map view positions inside the checkbox and wrappers to the position in the first block of the list item.\n        this.listenTo(editing.mapper, 'viewToModelPosition', (evt, data) => {\n            const viewParent = data.viewPosition.parent;\n            const isStartOfListItem = viewParent.is('attributeElement', 'li') && data.viewPosition.offset == 0;\n            const isStartOfListLabel = isLabelElement(viewParent) && data.viewPosition.offset <= 1;\n            const isInInputWrapper = viewParent.is('element', 'span') &&\n                viewParent.getAttribute('contenteditable') == 'false' &&\n                isLabelElement(viewParent.parent);\n            if (!isStartOfListItem && !isStartOfListLabel && !isInInputWrapper) {\n                return;\n            }\n            const nodeAfter = data.modelPosition.nodeAfter;\n            if (nodeAfter && nodeAfter.getAttribute('listType') == 'todo') {\n                data.modelPosition = model.createPositionAt(nodeAfter, 0);\n            }\n        }, { priority: 'low' });\n        this._initAriaAnnouncements();\n    }\n    /**\n     * Handles the checkbox element change, moves the selection to the corresponding model item to make it possible\n     * to toggle the `todoListChecked` attribute using the command, and restores the selection position.\n     *\n     * Some say it's a hack :) Moving the selection only for executing the command on a certain node and restoring it after,\n     * is not a clear solution. We need to design an API for using commands beyond the selection range.\n     * See https://github.com/ckeditor/ckeditor5/issues/1954.\n     */\n    _handleCheckmarkChange(listItem) {\n        const editor = this.editor;\n        const model = editor.model;\n        const previousSelectionRanges = Array.from(model.document.selection.getRanges());\n        model.change(writer => {\n            writer.setSelection(listItem, 'end');\n            editor.execute('checkTodoList');\n            writer.setSelection(previousSelectionRanges);\n        });\n    }\n    /**\n     * Observe when user enters or leaves todo list and set proper aria value in global live announcer.\n     * This allows screen readers to indicate when the user has entered and left the specified todo list.\n     *\n     * @internal\n     */\n    _initAriaAnnouncements() {\n        const { model, ui, t } = this.editor;\n        let lastFocusedCodeBlock = null;\n        if (!ui) {\n            return;\n        }\n        model.document.selection.on('change:range', () => {\n            const focusParent = model.document.selection.focus.parent;\n            const lastElementIsTodoList = isTodoListItemElement(lastFocusedCodeBlock);\n            const currentElementIsTodoList = isTodoListItemElement(focusParent);\n            if (lastElementIsTodoList && !currentElementIsTodoList) {\n                ui.ariaLiveAnnouncer.announce(t('Leaving a to-do list'));\n            }\n            else if (!lastElementIsTodoList && currentElementIsTodoList) {\n                ui.ariaLiveAnnouncer.announce(t('Entering a to-do list'));\n            }\n            lastFocusedCodeBlock = focusParent;\n        });\n    }\n}\n/**\n * Returns an upcast converter for to-do list items.\n */\nfunction todoListItemUpcastConverter() {\n    return (evt, data, conversionApi) => {\n        const { writer, schema } = conversionApi;\n        if (!data.modelRange) {\n            return;\n        }\n        // Group to-do list items by their listItemId attribute to ensure that all items of the same list item have the same checked state.\n        const groupedItems = Array\n            .from(data.modelRange.getItems({ shallow: true }))\n            .filter((item) => item.getAttribute('listType') === 'todo' && schema.checkAttribute(item, 'listItemId'))\n            .reduce((acc, item) => {\n            const listItemId = item.getAttribute('listItemId');\n            if (!acc.has(listItemId)) {\n                acc.set(listItemId, getAllListItemBlocks(item));\n            }\n            return acc;\n        }, new Map());\n        // During the upcast, we need to ensure that all items of the same list have the same checked state. From time to time\n        // the checked state of the items can be different when the user pastes content from the clipboard with <input type=\"checkbox\">\n        // that has checked state set to true. In such cases, we need to ensure that all items of the same list have the same checked state.\n        // See more: https://github.com/ckeditor/ckeditor5/issues/15602\n        for (const [, items] of groupedItems.entries()) {\n            if (items.some(item => item.getAttribute('todoListChecked'))) {\n                for (const item of items) {\n                    writer.setAttribute('todoListChecked', true, item);\n                }\n            }\n        }\n    };\n}\n/**\n * Returns an upcast converter that detects a to-do list checkbox and marks the list item as a to-do list.\n */\nfunction todoItemInputConverter() {\n    return (evt, data, conversionApi) => {\n        const modelCursor = data.modelCursor;\n        const modelItem = modelCursor.parent;\n        const viewItem = data.viewItem;\n        if (!conversionApi.consumable.test(viewItem, { name: true })) {\n            return;\n        }\n        if (viewItem.getAttribute('type') != 'checkbox' || !modelCursor.isAtStart || !modelItem.hasAttribute('listType')) {\n            return;\n        }\n        conversionApi.consumable.consume(viewItem, { name: true });\n        const writer = conversionApi.writer;\n        writer.setAttribute('listType', 'todo', modelItem);\n        if (data.viewItem.hasAttribute('checked')) {\n            writer.setAttribute('todoListChecked', true, modelItem);\n        }\n        data.modelRange = writer.createRange(modelCursor);\n    };\n}\n/**\n * Returns an upcast converter that consumes element matching the given matcher pattern.\n */\nfunction elementUpcastConsumingConverter(matcherPattern) {\n    const matcher = new Matcher(matcherPattern);\n    return (evt, data, conversionApi) => {\n        const matcherResult = matcher.match(data.viewItem);\n        if (!matcherResult) {\n            return;\n        }\n        if (!conversionApi.consumable.consume(data.viewItem, matcherResult.match)) {\n            return;\n        }\n        Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));\n    };\n}\n/**\n * Returns an upcast converter that consumes attributes matching the given matcher pattern.\n */\nfunction attributeUpcastConsumingConverter(matcherPattern) {\n    const matcher = new Matcher(matcherPattern);\n    return (evt, data, conversionApi) => {\n        const matcherResult = matcher.match(data.viewItem);\n        if (!matcherResult) {\n            return;\n        }\n        const match = matcherResult.match;\n        match.name = false;\n        conversionApi.consumable.consume(data.viewItem, match);\n    };\n}\n/**\n * Returns true if the given list item block should be converted as a description block of a to-do list item.\n */\nfunction isDescriptionBlock(modelElement, listAttributeNames) {\n    return (modelElement.is('element', 'paragraph') || modelElement.is('element', 'listItem')) &&\n        modelElement.getAttribute('listType') == 'todo' &&\n        isFirstBlockOfListItem(modelElement) &&\n        hasOnlyListAttributes(modelElement, listAttributeNames);\n}\n/**\n * Returns true if only attributes from the given list are present on the model element.\n */\nfunction hasOnlyListAttributes(modelElement, attributeNames) {\n    for (const attributeKey of modelElement.getAttributeKeys()) {\n        // Ignore selection attributes stored on block elements.\n        if (attributeKey.startsWith('selection:')) {\n            continue;\n        }\n        if (!attributeNames.includes(attributeKey)) {\n            return false;\n        }\n    }\n    return true;\n}\n/**\n * Jump at the start and end of a to-do list item.\n */\nfunction jumpOverCheckmarkOnSideArrowKeyPress(model, locale) {\n    return (eventInfo, domEventData) => {\n        const direction = getLocalizedArrowKeyCodeDirection(domEventData.keyCode, locale.contentLanguageDirection);\n        const schema = model.schema;\n        const selection = model.document.selection;\n        if (!selection.isCollapsed) {\n            return;\n        }\n        const position = selection.getFirstPosition();\n        const parent = position.parent;\n        // Right arrow before a to-do list item.\n        if (direction == 'right' && position.isAtEnd) {\n            const newRange = schema.getNearestSelectionRange(model.createPositionAfter(parent), 'forward');\n            if (!newRange) {\n                return;\n            }\n            const newRangeParent = newRange.start.parent;\n            if (newRangeParent && isListItemBlock(newRangeParent) && newRangeParent.getAttribute('listType') == 'todo') {\n                model.change(writer => writer.setSelection(newRange));\n                domEventData.preventDefault();\n                domEventData.stopPropagation();\n                eventInfo.stop();\n            }\n        }\n        // Left arrow at the beginning of a to-do list item.\n        else if (direction == 'left' && position.isAtStart && isListItemBlock(parent) && parent.getAttribute('listType') == 'todo') {\n            const newRange = schema.getNearestSelectionRange(model.createPositionBefore(parent), 'backward');\n            if (!newRange) {\n                return;\n            }\n            model.change(writer => writer.setSelection(newRange));\n            domEventData.preventDefault();\n            domEventData.stopPropagation();\n            eventInfo.stop();\n        }\n    };\n}\n/**\n * Returns true if the given element is a label element of a to-do list item.\n */\nfunction isLabelElement(viewElement) {\n    return !!viewElement && viewElement.is('attributeElement') && viewElement.hasClass('todo-list__label');\n}\n/**\n * Returns true if the given element is a list item model element of a to-do list.\n */\nfunction isTodoListItemElement(element) {\n    if (!element) {\n        return false;\n    }\n    if (!element.is('element', 'paragraph') && !element.is('element', 'listItem')) {\n        return false;\n    }\n    return element.getAttribute('listType') == 'todo';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/todolist/todolistui\n */\nimport { createUIComponents } from '../list/utils.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconTodoList } from 'ckeditor5/src/icons.js';\n/**\n * The to-do list UI feature. It introduces the `'todoList'` button that\n * allows to convert elements to and from to-do list items and to indent or outdent them.\n */\nexport class TodoListUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TodoListUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const t = this.editor.t;\n        createUIComponents(this.editor, 'todoList', t('To-do List'), IconTodoList);\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m2.315 14.705 2.224-2.24a.69.69 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.7.7 0 0 1-.112.089.65.65 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75M2.329 5.745l2.21-2.226a.69.69 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.7.7 0 0 1-.496.196.64.64 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { first } from 'ckeditor5/src/utils.js';\n/**\n * Returns code block languages as defined in `config.codeBlock.languages` but processed:\n *\n * * To consider the editor localization, i.e. to display {@link module:code-block/codeblockconfig~CodeBlockLanguageDefinition}\n * in the correct language. There is no way to use {@link module:utils/locale~Locale#t} when the user\n * configuration is defined because the editor does not exist yet.\n * * To make sure each definition has a CSS class associated with it even if not specified\n * in the original configuration.\n *\n * @internal\n */\nexport function getNormalizedAndLocalizedLanguageDefinitions(editor) {\n    const t = editor.t;\n    const languageDefs = editor.config.get('codeBlock.languages');\n    for (const def of languageDefs) {\n        if (def.label === 'Plain text') {\n            def.label = t('Plain text');\n        }\n        if (def.class === undefined) {\n            def.class = `language-${def.language}`;\n        }\n    }\n    return languageDefs;\n}\n/**\n * Returns an object associating certain language definition properties with others. For instance:\n *\n * For:\n *\n * ```ts\n * const definitions = {\n * \t{ language: 'php', class: 'language-php', label: 'PHP' },\n * \t{ language: 'javascript', class: 'js', label: 'JavaScript' },\n * };\n *\n * getPropertyAssociation( definitions, 'class', 'language' );\n * ```\n *\n * returns:\n *\n * ```ts\n * {\n * \t'language-php': 'php',\n * \t'js': 'javascript'\n * }\n * ```\n *\n * and\n *\n * ```ts\n * getPropertyAssociation( definitions, 'language', 'label' );\n * ```\n *\n * returns:\n *\n * ```ts\n * {\n * \t'php': 'PHP',\n * \t'javascript': 'JavaScript'\n * }\n * ```\n *\n * @internal\n */\nexport function getPropertyAssociation(languageDefs, key, value) {\n    const association = {};\n    for (const def of languageDefs) {\n        if (key === 'class') {\n            // Only the first class is considered.\n            const newKey = (def[key]).split(' ').shift();\n            association[newKey] = def[value];\n        }\n        else {\n            association[def[key]] = def[value];\n        }\n    }\n    return association;\n}\n/**\n * For a given model text node, it returns white spaces that precede other characters in that node.\n * This corresponds to the indentation part of the code block line.\n *\n * @internal\n */\nexport function getLeadingWhiteSpaces(textNode) {\n    return textNode.data.match(/^(\\s*)/)[0];\n}\n/**\n * For plain text containing the code (a snippet), it returns a document fragment containing\n * view text nodes separated by `<br>` elements (in place of new line characters \"\\n\"), for instance:\n *\n * Input:\n *\n * ```ts\n * \"foo()\\n\n * bar()\"\n * ```\n *\n * Output:\n *\n * ```html\n * <DocumentFragment>\n * \t\"foo()\"\n * \t<br/>\n * \t\"bar()\"\n * </DocumentFragment>\n * ```\n *\n * @param text The raw code text to be converted.\n * @internal\n */\nexport function rawSnippetTextToViewDocumentFragment(writer, text) {\n    const fragment = writer.createDocumentFragment();\n    const textLines = text.split('\\n');\n    const items = textLines.reduce((nodes, line, lineIndex) => {\n        nodes.push(line);\n        if (lineIndex < textLines.length - 1) {\n            nodes.push(writer.createElement('br'));\n        }\n        return nodes;\n    }, []);\n    writer.appendChild(items, fragment);\n    return fragment;\n}\n/**\n * Returns an array of all model positions within the selection that represent code block lines.\n *\n * If the selection is collapsed, it returns the exact selection anchor position:\n *\n * ```html\n * <codeBlock>[]foo</codeBlock>        ->     <codeBlock>^foo</codeBlock>\n * <codeBlock>foo[]bar</codeBlock>     ->     <codeBlock>foo^bar</codeBlock>\n * ```\n *\n * Otherwise, it returns positions **before** each text node belonging to all code blocks contained by the selection:\n *\n * ```html\n * <codeBlock>                                <codeBlock>\n *     foo[bar                                   ^foobar\n *     <softBreak></softBreak>         ->        <softBreak></softBreak>\n *     baz]qux                                   ^bazqux\n * </codeBlock>                               </codeBlock>\n * ```\n *\n * It also works across other non–code blocks:\n *\n * ```html\n * <codeBlock>                                <codeBlock>\n *     foo[bar                                   ^foobar\n * </codeBlock>                               </codeBlock>\n * <paragraph>text</paragraph>         ->     <paragraph>text</paragraph>\n * <codeBlock>                                <codeBlock>\n *     baz]qux                                   ^bazqux\n * </codeBlock>                               </codeBlock>\n * ```\n *\n * **Note:** The positions are in reverse order so they do not get outdated when iterating over them and\n * the writer inserts or removes elements at the same time.\n *\n * **Note:** The position is located after the leading white spaces in the text node.\n *\n * @internal\n */\nexport function getIndentOutdentPositions(model) {\n    const selection = model.document.selection;\n    const positions = [];\n    // When the selection is collapsed, there's only one position we can indent or outdent.\n    if (selection.isCollapsed) {\n        return [selection.anchor];\n    }\n    // When the selection is NOT collapsed, collect all positions starting before text nodes\n    // (code lines) in any <codeBlock> within the selection.\n    // Walk backward so positions we are about to collect here do not get outdated when\n    // inserting or deleting using the writer.\n    const walker = selection.getFirstRange().getWalker({\n        ignoreElementEnd: true,\n        direction: 'backward'\n    });\n    for (const { item } of walker) {\n        let node = item.is('$textProxy') ? item.textNode : item;\n        const parent = node.parent;\n        if (!parent.is('element', 'codeBlock') || node.is('element', 'softBreak')) {\n            continue;\n        }\n        // For each item in code block, move backwards until the beginning of the line it is in is found.\n        while (node.previousSibling && !node.previousSibling.is('element', 'softBreak')) {\n            node = node.previousSibling;\n        }\n        // Take the leading white spaces into account (only for text nodes).\n        const startOffset = !node.is('$text') ? node.startOffset : node.startOffset + getLeadingWhiteSpaces(node).length;\n        const position = model.createPositionAt(parent, startOffset);\n        // Do not add the same position twice. Unfortunately using set doesn't deduplicate positions because\n        // they are different objects.\n        if (positions.every(pos => !pos.isEqual(position))) {\n            positions.push(position);\n        }\n    }\n    return positions;\n}\n/**\n * Checks if any of the blocks within the model selection is a code block.\n *\n * @internal\n */\nexport function isModelSelectionInCodeBlock(selection) {\n    const firstBlock = first(selection.getSelectedBlocks());\n    return !!firstBlock && firstBlock.is('element', 'codeBlock');\n}\n/**\n * Checks if an {@link module:engine/model/element~ModelElement Element} can become a code block.\n *\n * @param schema Model's schema.\n * @param element The element to be checked.\n * @returns Check result.\n * @internal\n */\nexport function canBeCodeBlock(schema, element) {\n    if (element.is('rootElement') || schema.isLimit(element)) {\n        return false;\n    }\n    return schema.checkChild(element.parent, 'codeBlock');\n}\n/**\n * Get the translated message read by the screen reader when you enter or exit an element with your cursor.\n *\n * @internal\n */\nexport function getCodeBlockAriaAnnouncement(t, languageDefs, element, direction) {\n    const languagesToLabels = getPropertyAssociation(languageDefs, 'language', 'label');\n    const codeBlockLanguage = element.getAttribute('language');\n    if (codeBlockLanguage in languagesToLabels) {\n        const language = languagesToLabels[codeBlockLanguage];\n        if (direction === 'enter') {\n            return t('Entering %0 code snippet', language);\n        }\n        return t('Leaving %0 code snippet', language);\n    }\n    if (direction === 'enter') {\n        return t('Entering code snippet');\n    }\n    return t('Leaving code snippet');\n}\n/**\n * For given position, finds the closest position that is at the beginning of a line of code and returns a text node that is at the\n * beginning of the line (or `null` if there's no text node at the beginning of a given line).\n *\n * Line beings at the start of a code block element and after each `softBreak` element.\n *\n * Note: even though code block doesn't allow inline elements other than `<softBreak>` by default, some features may overwrite this rule,\n * so such inline elements are taken into account.\n *\n * Some examples of expected results:\n *\n * ```\n * <codeBlock>^</codeBlock>                                ->   null\n * <codeBlock>^foobar</codeBlock>                          ->   <codeBlock>[foobar]</codeBlock>\n * <codeBlock>foobar^</codeBlock>                          ->   <codeBlock>[foobar]</codeBlock>\n * <codeBlock>foo^bar</codeBlock>                          ->   <codeBlock>[foobar]</codeBlock>\n * <codeBlock>foo^<softBreak />bar</codeBlock>             ->   <codeBlock>[foo]<softBreak />bar</codeBlock>\n * <codeBlock>foo<softBreak />bar^</codeBlock>             ->   <codeBlock>foo<softBreak />[bar]</codeBlock>\n * <codeBlock>foo<softBreak />b^ar</codeBlock>             ->   <codeBlock>foo<softBreak />[bar]</codeBlock>\n * <codeBlock>foo<softBreak />^bar</codeBlock>             ->   <codeBlock>foo<softBreak />[bar]</codeBlock>\n * <codeBlock>^<element /></codeBlock>                     ->   null\n * <codeBlock><element />^</codeBlock>                     ->   null\n * <codeBlock>foo^<element /></codeBlock>                  ->   <codeBlock>[foo]<element /></codeBlock>\n * <codeBlock>foo<element />^</codeBlock>                  ->   <codeBlock>[foo]<element /></codeBlock>\n * <codeBlock>foo<element />bar^</codeBlock>               ->   <codeBlock>[foo]<element />bar</codeBlock>\n * <codeBlock><element />bar^</codeBlock>                  ->   null\n * <codeBlock>foo<softBreak />^<softBreak /></codeBlock>   ->   null\n * <codeBlock>foo<softBreak />^<element /></codeBlock>     ->   null\n * <codeBlock>foo<softBreak /><element />^</codeBlock>     ->   null\n * <codeBlock>foo<softBreak />bar<element />^</codeBlock>  ->   <codeBlock>foo<softBreak />[bar]<element /></codeBlock>\n * <codeBlock>foo<softBreak /><element />ba^r</codeBlock>  ->   null\n * ```\n *\n * @internal\n */\nexport function getTextNodeAtLineStart(position, model) {\n    // First, move position before a text node, if it is inside a text node.\n    if (position.textNode) {\n        position = model.createPositionBefore(position.textNode);\n    }\n    // Then, jump-back the position until it is before a `softBreak` or at the beginning of the `codeBlock`.\n    while (position.nodeBefore && !position.nodeBefore.is('element', 'softBreak')) {\n        position = model.createPositionBefore(position.nodeBefore);\n    }\n    // Now, the position is at the beginning of a line.\n    // Return a text node after the position, if there is one.\n    const nodeAtStart = position.nodeAfter;\n    return nodeAtStart && nodeAtStart.is('$text') ? nodeAtStart : null;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { getNormalizedAndLocalizedLanguageDefinitions, canBeCodeBlock } from './utils.js';\n/**\n * The code block command plugin.\n */\nexport class CodeBlockCommand extends Command {\n    /**\n     * Contains the last used language.\n     */\n    _lastLanguage;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this._lastLanguage = null;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.value = this._getValue();\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Executes the command. When the command {@link #value is on}, all topmost code blocks within\n     * the selection will be removed. If it is off, all selected blocks will be flattened and\n     * wrapped by a code block.\n     *\n     * @fires execute\n     * @param options Command options.\n     * @param options.language The code block language.\n     * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a code block,\n     * otherwise the command will remove the code block. If not set, the command will act basing on its current value.\n     * @param options.usePreviousLanguageChoice If set on `true` and the `options.language` is not specified, the command\n     * will apply the previous language (if the command was already executed) when inserting the `codeBlock` element.\n     */\n    execute(options = {}) {\n        const editor = this.editor;\n        const model = editor.model;\n        const selection = model.document.selection;\n        const normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions(editor);\n        const firstLanguageInConfig = normalizedLanguagesDefs[0];\n        const blocks = Array.from(selection.getSelectedBlocks());\n        const value = options.forceValue == undefined ? !this.value : options.forceValue;\n        const language = getLanguage(options, this._lastLanguage, firstLanguageInConfig.language);\n        model.change(writer => {\n            if (value) {\n                this._applyCodeBlock(writer, blocks, language);\n            }\n            else {\n                this._removeCodeBlock(writer, blocks);\n            }\n        });\n    }\n    /**\n     * Checks the command's {@link #value}.\n     *\n     * @returns The current value.\n     */\n    _getValue() {\n        const selection = this.editor.model.document.selection;\n        const firstBlock = first(selection.getSelectedBlocks());\n        const isCodeBlock = !!firstBlock?.is('element', 'codeBlock');\n        return isCodeBlock ? firstBlock.getAttribute('language') : false;\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        if (this.value) {\n            return true;\n        }\n        const selection = this.editor.model.document.selection;\n        const schema = this.editor.model.schema;\n        const firstBlock = first(selection.getSelectedBlocks());\n        if (!firstBlock) {\n            return false;\n        }\n        return canBeCodeBlock(schema, firstBlock);\n    }\n    _applyCodeBlock(writer, blocks, language) {\n        this._lastLanguage = language;\n        const schema = this.editor.model.schema;\n        const allowedBlocks = blocks.filter(block => canBeCodeBlock(schema, block));\n        for (const block of allowedBlocks) {\n            writer.rename(block, 'codeBlock');\n            writer.setAttribute('language', language, block);\n            schema.removeDisallowedAttributes([block], writer);\n            // Remove children of the  `codeBlock` element that are not allowed. See #9567.\n            Array.from(block.getChildren())\n                .filter(child => !schema.checkChild(block, child))\n                .forEach(child => writer.remove(child));\n        }\n        allowedBlocks.reverse().forEach((currentBlock, i) => {\n            const nextBlock = allowedBlocks[i + 1];\n            if (currentBlock.previousSibling === nextBlock) {\n                writer.appendElement('softBreak', nextBlock);\n                writer.merge(writer.createPositionBefore(currentBlock));\n            }\n        });\n    }\n    _removeCodeBlock(writer, blocks) {\n        const codeBlocks = blocks.filter(block => block.is('element', 'codeBlock'));\n        for (const block of codeBlocks) {\n            const range = writer.createRangeOn(block);\n            for (const item of Array.from(range.getItems()).reverse()) {\n                if (item.is('element', 'softBreak') && item.parent.is('element', 'codeBlock')) {\n                    const { position } = writer.split(writer.createPositionBefore(item));\n                    const elementAfter = position.nodeAfter;\n                    writer.rename(elementAfter, 'paragraph');\n                    writer.removeAttribute('language', elementAfter);\n                    writer.remove(item);\n                }\n            }\n            writer.rename(block, 'paragraph');\n            writer.removeAttribute('language', block);\n        }\n    }\n}\n/**\n * Picks the language for the new code block. If any language is passed as an option,\n * it will be returned. Else, if option usePreviousLanguageChoice is true and some\n * code block was already created (lastLanguage is not null) then previously used\n * language will be returned. If not, it will return default language.\n */\nfunction getLanguage(options, lastLanguage, defaultLanguage) {\n    if (options.language) {\n        return options.language;\n    }\n    if (options.usePreviousLanguageChoice && lastLanguage) {\n        return lastLanguage;\n    }\n    return defaultLanguage;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module code-block/indentcodeblockcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getIndentOutdentPositions, isModelSelectionInCodeBlock } from './utils.js';\n/**\n * The code block indentation increase command plugin.\n */\nexport class IndentCodeBlockCommand extends Command {\n    /**\n     * A sequence of characters added to the line when the command is executed.\n     */\n    _indentSequence;\n    constructor(editor) {\n        super(editor);\n        this._indentSequence = editor.config.get('codeBlock.indentSequence');\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Executes the command. When the command {@link #isEnabled is enabled}, the indentation of the\n     * code lines in the selection will be increased.\n     *\n     * @fires execute\n     */\n    execute() {\n        const editor = this.editor;\n        const model = editor.model;\n        model.change(writer => {\n            const positions = getIndentOutdentPositions(model);\n            // Indent all positions, for instance assuming the indent sequence is 4x space (\"    \"):\n            //\n            //\t\t<codeBlock>^foo</codeBlock>        ->       <codeBlock>    foo</codeBlock>\n            //\n            //\t\t<codeBlock>foo^bar</codeBlock>     ->       <codeBlock>foo    bar</codeBlock>\n            //\n            // Also, when there is more than one position:\n            //\n            //\t\t<codeBlock>\n            //\t\t\t^foobar\n            //\t\t\t<softBreak></softBreak>\n            //\t\t\t^bazqux\n            //\t\t</codeBlock>\n            //\n            //\t\t->\n            //\n            //\t\t<codeBlock>\n            //\t\t\t    foobar\n            //\t\t\t<softBreak></softBreak>\n            //\t\t\t    bazqux\n            //\t\t</codeBlock>\n            //\n            for (const position of positions) {\n                const indentSequenceTextElement = writer.createText(this._indentSequence);\n                // Previously insertion was done by writer.insertText(). It was changed to insertContent() to enable\n                // integration of code block with track changes. It's the easiest way of integration because insertContent()\n                // is already integrated with track changes, but if it ever cause any troubles it can be reverted, however\n                // some additional work will be required in track changes integration of code block.\n                model.insertContent(indentSequenceTextElement, position);\n            }\n        });\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     */\n    _checkEnabled() {\n        if (!this._indentSequence) {\n            return false;\n        }\n        // Indent (forward) command is always enabled when there's any code block in the selection\n        // because you can always indent code lines.\n        return isModelSelectionInCodeBlock(this.editor.model.document.selection);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getLeadingWhiteSpaces, getIndentOutdentPositions, isModelSelectionInCodeBlock, getTextNodeAtLineStart } from './utils.js';\n/**\n * The code block indentation decrease command plugin.\n */\nexport class OutdentCodeBlockCommand extends Command {\n    /**\n     * A sequence of characters removed from the line when the command is executed.\n     */\n    _indentSequence;\n    constructor(editor) {\n        super(editor);\n        this._indentSequence = editor.config.get('codeBlock.indentSequence');\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Executes the command. When the command {@link #isEnabled is enabled}, the indentation of the\n     * code lines in the selection will be decreased.\n     *\n     * @fires execute\n     */\n    execute() {\n        const editor = this.editor;\n        const model = editor.model;\n        model.change(() => {\n            const positions = getIndentOutdentPositions(model);\n            // Outdent all positions, for instance assuming the indent sequence is 4x space (\"    \"):\n            //\n            //\t\t<codeBlock>^foo</codeBlock>         ->       <codeBlock>foo</codeBlock>\n            //\n            //\t\t<codeBlock>    ^bar</codeBlock>     ->       <codeBlock>bar</codeBlock>\n            //\n            // Also, when there is more than one position:\n            //\n            //\t\t<codeBlock>\n            //\t\t\t    ^foobar\n            //\t\t\t<softBreak></softBreak>\n            //\t\t\t    ^bazqux\n            //\t\t</codeBlock>\n            //\n            //\t\t->\n            //\n            //\t\t<codeBlock>\n            //\t\t\tfoobar\n            //\t\t\t<softBreak></softBreak>\n            //\t\t\tbazqux\n            //\t\t</codeBlock>\n            for (const position of positions) {\n                const range = getLastOutdentableSequenceRange(model, position, this._indentSequence);\n                if (range) {\n                    // Previously deletion was done by writer.remove(). It was changed to deleteContent() to enable\n                    // integration of code block with track changes. It's the easiest way of integration because deleteContent()\n                    // is already integrated with track changes, but if it ever cause any troubles it can be reverted, however\n                    // some additional work will be required in track changes integration of code block.\n                    model.deleteContent(model.createSelection(range));\n                }\n            }\n        });\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @private\n     * @returns {Boolean} Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        if (!this._indentSequence) {\n            return false;\n        }\n        const model = this.editor.model;\n        if (!isModelSelectionInCodeBlock(model.document.selection)) {\n            return false;\n        }\n        // Outdent command can execute only when there is an indent character sequence\n        // in some of the lines.\n        return getIndentOutdentPositions(model).some(position => {\n            return getLastOutdentableSequenceRange(model, position, this._indentSequence);\n        });\n    }\n}\n// For a position coming from `getIndentOutdentPositions()`, it returns the range representing\n// the last occurrence of the indent sequence among the leading whitespaces of the code line the\n// position represents.\n//\n// For instance, assuming the indent sequence is 4x space (\"    \"):\n//\n//\t\t<codeBlock>foo^</codeBlock>                                 ->          null\n//\t\t<codeBlock>foo^<softBreak></softBreak>bar</codeBlock>       ->          null\n//\t\t<codeBlock>  ^foo</codeBlock>                               ->          null\n//\t\t<codeBlock>        ^foo</codeBlock>                         ->          <codeBlock>    [    ]foo</codeBlock>\n//\t\t<codeBlock>    ^foo    bar</codeBlock>                      ->          <codeBlock>[    ]foo    bar</codeBlock>\n//\n// @param {<module:engine/model/model~Model>} model\n// @param {<module:engine/model/position~ModelPosition>} position\n// @param {String} sequence\n// @returns {<module:engine/model/range~ModelRange>|null}\nfunction getLastOutdentableSequenceRange(model, position, sequence) {\n    // Positions start before each text node (code line). Get the node corresponding to the position.\n    const nodeAtPosition = getTextNodeAtLineStart(position, model);\n    if (!nodeAtPosition) {\n        return null;\n    }\n    const leadingWhiteSpaces = getLeadingWhiteSpaces(nodeAtPosition);\n    const lastIndexOfSequence = leadingWhiteSpaces.lastIndexOf(sequence);\n    // For instance, assuming the indent sequence is 4x space (\"    \"):\n    //\n    //\t\t<codeBlock>    \t^foo</codeBlock>           ->             null\n    //\n    if (lastIndexOfSequence + sequence.length !== leadingWhiteSpaces.length) {\n        return null;\n    }\n    // For instance, assuming the indent sequence is 4x space (\"    \"):\n    //\n    //\t\t<codeBlock>  ^foo</codeBlock>           ->             null\n    //\n    if (lastIndexOfSequence === -1) {\n        return null;\n    }\n    const { parent, startOffset } = nodeAtPosition;\n    // Create a range that contains the **last** indent sequence among the leading whitespaces\n    // of the line.\n    //\n    // For instance, assuming the indent sequence is 4x space (\"    \"):\n    //\n    //\t\t<codeBlock>        ^foo</codeBlock>      ->     <codeBlock>    [    ]foo</codeBlock>\n    //\n    return model.createRange(model.createPositionAt(parent, startOffset + lastIndexOfSequence), model.createPositionAt(parent, startOffset + lastIndexOfSequence + sequence.length));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getPropertyAssociation } from './utils.js';\n/**\n * A model-to-view (both editing and data) converter for the `codeBlock` element.\n *\n * Sample input:\n *\n * ```html\n * <codeBlock language=\"javascript\">foo();<softBreak></softBreak>bar();</codeBlock>\n * ```\n *\n * Sample output (editing):\n *\n * ```html\n * <pre data-language=\"JavaScript\"><code class=\"language-javascript\">foo();<br />bar();</code></pre>\n * ```\n *\n * Sample output (data, see {@link module:code-block/converters~modelToDataViewSoftBreakInsertion}):\n *\n * ```html\n * <pre><code class=\"language-javascript\">foo();\\nbar();</code></pre>\n * ```\n *\n * @param languageDefs The normalized language configuration passed to the feature.\n * @param useLabels When `true`, the `<pre>` element will get a `data-language` attribute with a\n * human–readable label of the language. Used only in the editing.\n * @returns Returns a conversion callback.\n * @internal\n */\nexport function modelToViewCodeBlockInsertion(model, languageDefs, useLabels = false) {\n    // Language CSS classes:\n    //\n    //\t\t{\n    //\t\t\tphp: 'language-php',\n    //\t\t\tpython: 'language-python',\n    //\t\t\tjavascript: 'js',\n    //\t\t\t...\n    //\t\t}\n    const languagesToClasses = getPropertyAssociation(languageDefs, 'language', 'class');\n    // Language labels:\n    //\n    //\t\t{\n    //\t\t\tphp: 'PHP',\n    //\t\t\tpython: 'Python',\n    //\t\t\tjavascript: 'JavaScript',\n    //\t\t\t...\n    //\t\t}\n    const languagesToLabels = getPropertyAssociation(languageDefs, 'language', 'label');\n    return (evt, data, conversionApi) => {\n        const { writer, mapper, consumable } = conversionApi;\n        if (!consumable.consume(data.item, 'insert')) {\n            return;\n        }\n        const codeBlockLanguage = data.item.getAttribute('language');\n        const targetViewPosition = mapper.toViewPosition(model.createPositionBefore(data.item));\n        const preAttributes = {};\n        // Attributes added only in the editing view.\n        if (useLabels) {\n            preAttributes['data-language'] = languagesToLabels[codeBlockLanguage];\n            preAttributes.spellcheck = 'false';\n        }\n        const codeAttributes = languagesToClasses[codeBlockLanguage] ? {\n            class: languagesToClasses[codeBlockLanguage]\n        } : undefined;\n        const code = writer.createContainerElement('code', codeAttributes);\n        const pre = writer.createContainerElement('pre', preAttributes, code);\n        writer.insert(targetViewPosition, pre);\n        mapper.bindElements(data.item, code);\n    };\n}\n/**\n * A model-to-data view converter for the new line (`softBreak`) separator.\n *\n * Sample input:\n *\n * ```html\n * <codeBlock ...>foo();<softBreak></softBreak>bar();</codeBlock>\n * ```\n *\n * Sample output:\n *\n * ```html\n * <pre><code ...>foo();\\nbar();</code></pre>\n * ```\n *\n * @returns Returns a conversion callback.\n * @internal\n */\nexport function modelToDataViewSoftBreakInsertion(model) {\n    return (evt, data, conversionApi) => {\n        if (data.item.parent.name !== 'codeBlock') {\n            return;\n        }\n        const { writer, mapper, consumable } = conversionApi;\n        if (!consumable.consume(data.item, 'insert')) {\n            return;\n        }\n        const position = mapper.toViewPosition(model.createPositionBefore(data.item));\n        writer.insert(position, writer.createText('\\n'));\n    };\n}\n/**\n * A view-to-model converter for `<pre>` with the `<code>` HTML.\n *\n * Sample input:\n *\n * ```html\n * <pre><code class=\"language-javascript\">foo();bar();</code></pre>\n * ```\n *\n * Sample output:\n *\n * ```html\n * <codeBlock language=\"javascript\">foo();bar();</codeBlock>\n * ```\n *\n * @param languageDefs The normalized language configuration passed to the feature.\n * @returns Returns a conversion callback.\n * @internal\n */\nexport function dataViewToModelCodeBlockInsertion(editingView, languageDefs) {\n    // Language names associated with CSS classes:\n    //\n    //\t\t{\n    //\t\t\t'language-php': 'php',\n    //\t\t\t'language-python': 'python',\n    //\t\t\tjs: 'javascript',\n    //\t\t\t...\n    //\t\t}\n    const classesToLanguages = getPropertyAssociation(languageDefs, 'class', 'language');\n    const defaultLanguageName = languageDefs[0].language;\n    return (evt, data, conversionApi) => {\n        const viewCodeElement = data.viewItem;\n        const viewPreElement = viewCodeElement.parent;\n        if (!viewPreElement || !viewPreElement.is('element', 'pre')) {\n            return;\n        }\n        // In case of nested code blocks we don't want to convert to another code block.\n        if (data.modelCursor.findAncestor('codeBlock')) {\n            return;\n        }\n        const { consumable, writer } = conversionApi;\n        if (!consumable.test(viewCodeElement, { name: true })) {\n            return;\n        }\n        const codeBlock = writer.createElement('codeBlock');\n        const viewChildClasses = [...viewCodeElement.getClassNames()];\n        // As we're to associate each class with a model language, a lack of class (empty class) can be\n        // also associated with a language if the language definition was configured so. Pushing an empty\n        // string to make sure the association will work.\n        if (!viewChildClasses.length) {\n            viewChildClasses.push('');\n        }\n        // Figure out if any of the <code> element's class names is a valid programming\n        // language class. If so, use it on the model element (becomes the language of the entire block).\n        for (const className of viewChildClasses) {\n            const language = classesToLanguages[className];\n            if (language) {\n                consumable.consume(viewCodeElement, { classes: [className] });\n                writer.setAttribute('language', language, codeBlock);\n                break;\n            }\n        }\n        // If no language value was set, use the default language from the config.\n        if (!codeBlock.hasAttribute('language')) {\n            writer.setAttribute('language', defaultLanguageName, codeBlock);\n        }\n        // Convert children before inserting the code block element\n        // to make sure that code block won't be splitted by any block.\n        conversionApi.convertChildren(viewCodeElement, codeBlock);\n        // Let's try to insert code block.\n        if (!conversionApi.safeInsert(codeBlock, data.modelCursor)) {\n            return;\n        }\n        consumable.consume(viewCodeElement, { name: true });\n        conversionApi.updateConversionResult(codeBlock, data);\n    };\n}\n/**\n * A view-to-model converter for new line characters in `<pre>`.\n *\n * Sample input:\n *\n * ```html\n * <pre><code class=\"language-javascript\">foo();\\nbar();</code></pre>\n * ```\n *\n * Sample output:\n *\n * ```html\n * <codeBlock language=\"javascript\">foo();<softBreak></softBreak>bar();</codeBlock>\n * ```\n *\n * @returns {Function} Returns a conversion callback.\n * @internal\n */\nexport function dataViewToModelTextNewlinesInsertion() {\n    return (evt, data, { consumable, writer }) => {\n        let position = data.modelCursor;\n        // When node is already converted then do nothing.\n        if (!consumable.test(data.viewItem)) {\n            return;\n        }\n        // When not inside `codeBlock` then do nothing.\n        if (!position.findAncestor('codeBlock')) {\n            return;\n        }\n        consumable.consume(data.viewItem);\n        const text = data.viewItem.data;\n        const textLines = text.split('\\n').map(data => writer.createText(data));\n        const lastLine = textLines[textLines.length - 1];\n        for (const node of textLines) {\n            writer.insert(node, position);\n            position = position.getShiftedBy(node.offsetSize);\n            if (node !== lastLine) {\n                const softBreak = writer.createElement('softBreak');\n                writer.insert(softBreak, position);\n                position = writer.createPositionAfter(softBreak);\n            }\n        }\n        data.modelRange = writer.createRange(data.modelCursor, position);\n        data.modelCursor = position;\n    };\n}\n/**\n * A view-to-model converter that handles orphan text nodes (white spaces, new lines, etc.)\n * that surround `<code>` inside `<pre>`.\n *\n * Sample input:\n *\n * ```html\n * // White spaces\n * <pre> <code>foo()</code> </pre>\n *\n * // White spaces\n * <pre>      <code>foo()</code>      </pre>\n *\n * // White spaces\n * <pre>\t\t\t<code>foo()</code>\t\t\t</pre>\n *\n * // New lines\n * <pre>\n * \t<code>foo()</code>\n * </pre>\n *\n * // Redundant text\n * <pre>ABC<code>foo()</code>DEF</pre>\n * ```\n *\n * Unified output for each case:\n *\n * ```html\n * <codeBlock language=\"plaintext\">foo()</codeBlock>\n * ```\n *\n * @returns Returns a conversion callback.\n * @internal\n */\nexport function dataViewToModelOrphanNodeConsumer() {\n    return (evt, data, { consumable }) => {\n        const preElement = data.viewItem;\n        // Don't clean up nested pre elements. Their content should stay as it is, they are not upcasted\n        // to code blocks.\n        if (preElement.findAncestor('pre')) {\n            return;\n        }\n        const preChildren = Array.from(preElement.getChildren());\n        const childCodeElement = preChildren.find(node => node.is('element', 'code'));\n        // <code>-less <pre>. It will not upcast to code block in the model, skipping.\n        if (!childCodeElement) {\n            return;\n        }\n        for (const child of preChildren) {\n            if (child === childCodeElement || !child.is('$text')) {\n                continue;\n            }\n            // Consuming the orphan to remove it from the input data.\n            // Second argument in `consumable.consume` is discarded for text nodes.\n            consumable.consume(child, { name: true });\n        }\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module code-block/codeblockediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ShiftEnter } from 'ckeditor5/src/enter.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport { CodeBlockCommand } from './codeblockcommand.js';\nimport { IndentCodeBlockCommand } from './indentcodeblockcommand.js';\nimport { OutdentCodeBlockCommand } from './outdentcodeblockcommand.js';\nimport { getNormalizedAndLocalizedLanguageDefinitions, getLeadingWhiteSpaces, rawSnippetTextToViewDocumentFragment, getCodeBlockAriaAnnouncement, getTextNodeAtLineStart } from './utils.js';\nimport { modelToViewCodeBlockInsertion, modelToDataViewSoftBreakInsertion, dataViewToModelCodeBlockInsertion, dataViewToModelTextNewlinesInsertion, dataViewToModelOrphanNodeConsumer } from './converters.js';\nconst DEFAULT_ELEMENT = 'paragraph';\n/**\n * The editing part of the code block feature.\n *\n * Introduces the `'codeBlock'` command and the `'codeBlock'` model element.\n */\nexport class CodeBlockEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CodeBlockEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ShiftEnter];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('codeBlock', {\n            languages: [\n                { language: 'plaintext', label: 'Plain text' },\n                { language: 'c', label: 'C' },\n                { language: 'cs', label: 'C#' },\n                { language: 'cpp', label: 'C++' },\n                { language: 'css', label: 'CSS' },\n                { language: 'diff', label: 'Diff' },\n                { language: 'go', label: 'Go' },\n                { language: 'html', label: 'HTML' },\n                { language: 'java', label: 'Java' },\n                { language: 'javascript', label: 'JavaScript' },\n                { language: 'php', label: 'PHP' },\n                { language: 'python', label: 'Python' },\n                { language: 'ruby', label: 'Ruby' },\n                { language: 'typescript', label: 'TypeScript' },\n                { language: 'xml', label: 'XML' }\n            ],\n            // A single tab.\n            indentSequence: '\\t'\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const model = editor.model;\n        const view = editor.editing.view;\n        const normalizedLanguagesDefs = getNormalizedAndLocalizedLanguageDefinitions(editor);\n        // The main command.\n        editor.commands.add('codeBlock', new CodeBlockCommand(editor));\n        // Commands that change the indentation.\n        editor.commands.add('indentCodeBlock', new IndentCodeBlockCommand(editor));\n        editor.commands.add('outdentCodeBlock', new OutdentCodeBlockCommand(editor));\n        this.listenTo(view.document, 'tab', (evt, data) => {\n            const commandName = data.shiftKey ? 'outdentCodeBlock' : 'indentCodeBlock';\n            const command = editor.commands.get(commandName);\n            if (!command.isEnabled) {\n                return;\n            }\n            editor.execute(commandName);\n            data.stopPropagation();\n            data.preventDefault();\n            evt.stop();\n        }, { context: 'pre' });\n        schema.register('codeBlock', {\n            allowWhere: '$block',\n            allowChildren: '$text',\n            // Disallow `$inlineObject` and its derivatives like `inlineWidget` inside `codeBlock` to ensure that only text,\n            // not other inline elements like inline images, are allowed. This maintains the semantic integrity of code blocks.\n            disallowChildren: '$inlineObject',\n            allowAttributes: ['language'],\n            allowAttributesOf: '$listItem',\n            isBlock: true\n        });\n        // Disallow formatting attributes on `codeBlock` children.\n        schema.addAttributeCheck((context, attributeName) => {\n            const parent = context.getItem(context.length - 2);\n            const isFormatting = schema.getAttributeProperties(attributeName).isFormatting;\n            if (isFormatting && parent && parent.name == 'codeBlock') {\n                return false;\n            }\n        });\n        // Conversion.\n        editor.editing.downcastDispatcher.on('insert:codeBlock', modelToViewCodeBlockInsertion(model, normalizedLanguagesDefs, true));\n        editor.data.downcastDispatcher.on('insert:codeBlock', modelToViewCodeBlockInsertion(model, normalizedLanguagesDefs));\n        editor.data.downcastDispatcher.on('insert:softBreak', modelToDataViewSoftBreakInsertion(model), { priority: 'high' });\n        editor.data.upcastDispatcher.on('element:code', dataViewToModelCodeBlockInsertion(view, normalizedLanguagesDefs));\n        editor.data.upcastDispatcher.on('text', dataViewToModelTextNewlinesInsertion());\n        editor.data.upcastDispatcher.on('element:pre', dataViewToModelOrphanNodeConsumer(), { priority: 'high' });\n        // Intercept the clipboard input (paste) when the selection is anchored in the code block and force the clipboard\n        // data to be pasted as a single plain text. Otherwise, the code lines will split the code block and\n        // \"spill out\" as separate paragraphs.\n        this.listenTo(editor.editing.view.document, 'clipboardInput', (evt, data) => {\n            let insertionRange = model.createRange(model.document.selection.anchor);\n            // Use target ranges in case this is a drop.\n            if (data.targetRanges) {\n                insertionRange = editor.editing.mapper.toModelRange(data.targetRanges[0]);\n            }\n            if (!insertionRange.start.parent.is('element', 'codeBlock')) {\n                return;\n            }\n            const text = data.dataTransfer.getData('text/plain');\n            const writer = new ViewUpcastWriter(editor.editing.view.document);\n            // Pass the view fragment to the default clipboardInput handler.\n            data.content = rawSnippetTextToViewDocumentFragment(writer, text);\n        });\n        if (editor.plugins.has('ClipboardPipeline')) {\n            // Elements may have a plain textual representation (hence be present in the 'text/plain' data transfer),\n            // but not be allowed in the code block.\n            // Filter them out before inserting the content to the model.\n            editor.plugins.get(ClipboardPipeline).on('contentInsertion', (evt, data) => {\n                const model = editor.model;\n                const selection = model.document.selection;\n                if (!selection.anchor.parent.is('element', 'codeBlock')) {\n                    return;\n                }\n                model.change(writer => {\n                    const contentRange = writer.createRangeIn(data.content);\n                    for (const item of [...contentRange.getItems()]) {\n                        // Remove all nodes disallowed in the code block.\n                        if (item.is('node') && !schema.checkChild(selection.anchor, item)) {\n                            writer.remove(item);\n                        }\n                    }\n                });\n            });\n        }\n        // Make sure multi–line selection is always wrapped in a code block when `getSelectedContent()`\n        // is used (e.g. clipboard copy). Otherwise, only the raw text will be copied to the clipboard and,\n        // upon next paste, this bare text will not be inserted as a code block, which is not the best UX.\n        // Similarly, when the selection in a single line, the selected content should be an inline code\n        // so it can be pasted later on and retain it's preformatted nature.\n        this.listenTo(model, 'getSelectedContent', (evt, [selection]) => {\n            const anchor = selection.anchor;\n            if (selection.isCollapsed || !anchor.parent.is('element', 'codeBlock') || !anchor.hasSameParentAs(selection.focus)) {\n                return;\n            }\n            model.change(writer => {\n                const docFragment = evt.return;\n                // fo[o<softBreak></softBreak>b]ar  ->   <codeBlock language=\"...\">[o<softBreak></softBreak>b]<codeBlock>\n                if (anchor.parent.is('element') &&\n                    (docFragment.childCount > 1 || selection.containsEntireContent(anchor.parent))) {\n                    const codeBlock = writer.createElement('codeBlock', anchor.parent.getAttributes());\n                    writer.append(docFragment, codeBlock);\n                    const newDocumentFragment = writer.createDocumentFragment();\n                    writer.append(codeBlock, newDocumentFragment);\n                    evt.return = newDocumentFragment;\n                    return;\n                }\n                // \"f[oo]\"                          ->   <$text code=\"true\">oo</text>\n                const textNode = docFragment.getChild(0);\n                if (schema.checkAttribute(textNode, 'code')) {\n                    writer.setAttribute('code', true, textNode);\n                }\n            });\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const commands = editor.commands;\n        const indent = commands.get('indent');\n        const outdent = commands.get('outdent');\n        if (indent) {\n            // Priority is highest due to integration with `IndentList` command of `List` plugin.\n            // If selection is in a code block we give priority to it. This way list item cannot be indented\n            // but if we would give priority to indenting list item then user would have to indent list item\n            // as much as possible and only then he could indent code block.\n            indent.registerChildCommand(commands.get('indentCodeBlock'), { priority: 'highest' });\n        }\n        if (outdent) {\n            outdent.registerChildCommand(commands.get('outdentCodeBlock'));\n        }\n        // Customize the response to the <kbd>Enter</kbd> and <kbd>Shift</kbd>+<kbd>Enter</kbd>\n        // key press when the selection is in the code block. Upon enter key press we can either\n        // leave the block if it's \"two or three enters\" in a row or create a new code block line, preserving\n        // previous line's indentation.\n        this.listenTo(editor.editing.view.document, 'enter', (evt, data) => {\n            const positionParent = editor.model.document.selection.getLastPosition().parent;\n            if (!positionParent.is('element', 'codeBlock')) {\n                return;\n            }\n            if (!leaveBlockStartOnEnter(editor, data.isSoft) && !leaveBlockEndOnEnter(editor, data.isSoft)) {\n                breakLineOnEnter(editor);\n            }\n            data.preventDefault();\n            evt.stop();\n        }, { context: 'pre' });\n        this._initAriaAnnouncements();\n    }\n    /**\n     * Observe when user enters or leaves code block and set proper aria value in global live announcer.\n     * This allows screen readers to indicate when the user has entered and left the specified code block.\n     *\n     * @internal\n     */\n    _initAriaAnnouncements() {\n        const { model, ui, t } = this.editor;\n        const languageDefs = getNormalizedAndLocalizedLanguageDefinitions(this.editor);\n        let lastFocusedCodeBlock = null;\n        model.document.selection.on('change:range', () => {\n            const focusParent = model.document.selection.focus.parent;\n            if (!ui || lastFocusedCodeBlock === focusParent || !focusParent.is('element')) {\n                return;\n            }\n            if (lastFocusedCodeBlock && lastFocusedCodeBlock.is('element', 'codeBlock')) {\n                ui.ariaLiveAnnouncer.announce(getCodeBlockAriaAnnouncement(t, languageDefs, lastFocusedCodeBlock, 'leave'));\n            }\n            if (focusParent.is('element', 'codeBlock')) {\n                ui.ariaLiveAnnouncer.announce(getCodeBlockAriaAnnouncement(t, languageDefs, focusParent, 'enter'));\n            }\n            lastFocusedCodeBlock = focusParent;\n        });\n    }\n}\n/**\n * Normally, when the Enter (or Shift+Enter) key is pressed, a soft line break is to be added to the\n * code block. Let's try to follow the indentation of the previous line when possible, for instance:\n *\n * ```html\n * // Before pressing enter (or shift enter)\n * <codeBlock>\n * \"    foo()\"[]                   // Indent of 4 spaces.\n * </codeBlock>\n *\n * // After pressing:\n * <codeBlock>\n * \"    foo()\"                 // Indent of 4 spaces.\n * <softBreak></softBreak>     // A new soft break created by pressing enter.\n * \"    \"[]                    // Retain the indent of 4 spaces.\n * </codeBlock>\n * ```\n */\nfunction breakLineOnEnter(editor) {\n    const model = editor.model;\n    const modelDoc = model.document;\n    // Use last position as other mechanisms (e.g. condition deciding whether this function should be called) also check that.\n    const lastSelectionPosition = modelDoc.selection.getLastPosition();\n    let leadingWhiteSpaces;\n    const node = getTextNodeAtLineStart(lastSelectionPosition, model);\n    // Figure out the indentation (white space chars) at the beginning of the line.\n    if (node && node.is('$text')) {\n        leadingWhiteSpaces = getLeadingWhiteSpaces(node);\n    }\n    // Keeping everything in a change block for a single undo step.\n    editor.model.change(writer => {\n        editor.execute('shiftEnter');\n        // If the line before being broken in two had some indentation, let's retain it\n        // in the new line.\n        if (leadingWhiteSpaces) {\n            writer.insertText(leadingWhiteSpaces, modelDoc.selection.anchor);\n        }\n    });\n}\n/**\n * Leave the code block when Enter (but NOT Shift+Enter) has been pressed twice at the beginning\n * of the code block:\n *\n * ```html\n * // Before:\n * <codeBlock>[]<softBreak></softBreak>foo</codeBlock>\n *\n * // After pressing:\n * <paragraph>[]</paragraph><codeBlock>foo</codeBlock>\n * ```\n *\n * @param isSoftEnter When `true`, enter was pressed along with <kbd>Shift</kbd>.\n * @returns `true` when selection left the block. `false` if stayed.\n */\nfunction leaveBlockStartOnEnter(editor, isSoftEnter) {\n    const model = editor.model;\n    const modelDoc = model.document;\n    const view = editor.editing.view;\n    const lastSelectionPosition = modelDoc.selection.getLastPosition();\n    const nodeAfter = lastSelectionPosition.nodeAfter;\n    if (isSoftEnter || !modelDoc.selection.isCollapsed || !lastSelectionPosition.isAtStart) {\n        return false;\n    }\n    if (!isSoftBreakNode(nodeAfter)) {\n        return false;\n    }\n    // We're doing everything in a single change block to have a single undo step.\n    editor.model.change(writer => {\n        // \"Clone\" the <codeBlock> in the standard way.\n        editor.execute('enter');\n        // The cloned block exists now before the original code block.\n        const newBlock = modelDoc.selection.anchor.parent.previousSibling;\n        // Make the cloned <codeBlock> a regular <paragraph> (with clean attributes, so no language).\n        writer.rename(newBlock, DEFAULT_ELEMENT);\n        writer.setSelection(newBlock, 'in');\n        editor.model.schema.removeDisallowedAttributes([newBlock], writer);\n        // Remove the <softBreak> that originally followed the selection position.\n        writer.remove(nodeAfter);\n    });\n    // Eye candy.\n    view.scrollToTheSelection();\n    return true;\n}\n/**\n * Leave the code block when Enter (but NOT Shift+Enter) has been pressed twice at the end\n * of the code block:\n *\n * ```html\n * // Before:\n * <codeBlock>foo[]</codeBlock>\n *\n * // After first press:\n * <codeBlock>foo<softBreak></softBreak>[]</codeBlock>\n *\n * // After second press:\n * <codeBlock>foo</codeBlock><paragraph>[]</paragraph>\n * ```\n *\n * @param isSoftEnter When `true`, enter was pressed along with <kbd>Shift</kbd>.\n * @returns `true` when selection left the block. `false` if stayed.\n */\nfunction leaveBlockEndOnEnter(editor, isSoftEnter) {\n    const model = editor.model;\n    const modelDoc = model.document;\n    const view = editor.editing.view;\n    const lastSelectionPosition = modelDoc.selection.getLastPosition();\n    const nodeBefore = lastSelectionPosition.nodeBefore;\n    let emptyLineRangeToRemoveOnEnter;\n    if (isSoftEnter || !modelDoc.selection.isCollapsed || !lastSelectionPosition.isAtEnd || !nodeBefore || !nodeBefore.previousSibling) {\n        return false;\n    }\n    // When the position is directly preceded by two soft breaks\n    //\n    //\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>[]</codeBlock>\n    //\n    // it creates the following range that will be cleaned up before leaving:\n    //\n    //\t\t<codeBlock>foo[<softBreak></softBreak><softBreak></softBreak>]</codeBlock>\n    //\n    if (isSoftBreakNode(nodeBefore) && isSoftBreakNode(nodeBefore.previousSibling)) {\n        emptyLineRangeToRemoveOnEnter = model.createRange(model.createPositionBefore(nodeBefore.previousSibling), model.createPositionAfter(nodeBefore));\n    }\n    // When there's some text before the position that is\n    // preceded by two soft breaks and made purely of white–space characters\n    //\n    //\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>    []</codeBlock>\n    //\n    // it creates the following range to clean up before leaving:\n    //\n    //\t\t<codeBlock>foo[<softBreak></softBreak><softBreak></softBreak>    ]</codeBlock>\n    //\n    else if (isEmptyishTextNode(nodeBefore) &&\n        isSoftBreakNode(nodeBefore.previousSibling) &&\n        isSoftBreakNode(nodeBefore.previousSibling.previousSibling)) {\n        emptyLineRangeToRemoveOnEnter = model.createRange(model.createPositionBefore(nodeBefore.previousSibling.previousSibling), model.createPositionAfter(nodeBefore));\n    }\n    // When there's some text before the position that is made purely of white–space characters\n    // and is preceded by some other text made purely of white–space characters\n    //\n    //\t\t<codeBlock>foo<softBreak></softBreak>    <softBreak></softBreak>    []</codeBlock>\n    //\n    // it creates the following range to clean up before leaving:\n    //\n    //\t\t<codeBlock>foo[<softBreak></softBreak>    <softBreak></softBreak>    ]</codeBlock>\n    //\n    else if (isEmptyishTextNode(nodeBefore) &&\n        isSoftBreakNode(nodeBefore.previousSibling) &&\n        isEmptyishTextNode(nodeBefore.previousSibling.previousSibling) &&\n        nodeBefore.previousSibling.previousSibling &&\n        isSoftBreakNode(nodeBefore.previousSibling.previousSibling.previousSibling)) {\n        emptyLineRangeToRemoveOnEnter = model.createRange(model.createPositionBefore(nodeBefore.previousSibling.previousSibling.previousSibling), model.createPositionAfter(nodeBefore));\n    }\n    // Not leaving the block in the following cases:\n    //\n    //\t\t<codeBlock>    []</codeBlock>\n    //\t\t<codeBlock>  a []</codeBlock>\n    //\t\t<codeBlock>foo<softBreak></softBreak>[]</codeBlock>\n    //\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak>bar[]</codeBlock>\n    //\t\t<codeBlock>foo<softBreak></softBreak><softBreak></softBreak> a []</codeBlock>\n    //\n    else {\n        return false;\n    }\n    // We're doing everything in a single change block to have a single undo step.\n    editor.model.change(writer => {\n        // Remove the last <softBreak>s and all white space characters that followed them.\n        writer.remove(emptyLineRangeToRemoveOnEnter);\n        // \"Clone\" the <codeBlock> in the standard way.\n        editor.execute('enter');\n        const newBlock = modelDoc.selection.anchor.parent;\n        // Make the cloned <codeBlock> a regular <paragraph> (with clean attributes, so no language).\n        writer.rename(newBlock, DEFAULT_ELEMENT);\n        editor.model.schema.removeDisallowedAttributes([newBlock], writer);\n    });\n    // Eye candy.\n    view.scrollToTheSelection();\n    return true;\n}\nfunction isEmptyishTextNode(node) {\n    return node && node.is('$text') && !node.data.match(/\\S/);\n}\nfunction isSoftBreakNode(node) {\n    return node && node.is('element', 'softBreak');\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174m2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207M16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zM5.009 15l.003 1H3v-1zm2.188-2-1.471 1H5v-1zM10 11v.095L8.668 12H7v-1zm4-2v1H7V9zm0-2v1H7V7zm-4-2v1H5V5zM6 3v1H3V3z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module code-block/codeblockui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { UIModel, SplitButtonView, createDropdown, addListToDropdown, MenuBarMenuListItemButtonView, MenuBarMenuListView, MenuBarMenuView, MenuBarMenuListItemView } from 'ckeditor5/src/ui.js';\nimport { IconCodeBlock } from 'ckeditor5/src/icons.js';\nimport { getNormalizedAndLocalizedLanguageDefinitions } from './utils.js';\nimport '../theme/codeblock.css';\n/**\n * The code block UI plugin.\n *\n * Introduces the `'codeBlock'` dropdown.\n */\nexport class CodeBlockUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CodeBlockUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const componentFactory = editor.ui.componentFactory;\n        const normalizedLanguageDefs = getNormalizedAndLocalizedLanguageDefinitions(editor);\n        const itemDefinitions = this._getLanguageListItemDefinitions(normalizedLanguageDefs);\n        const command = editor.commands.get('codeBlock');\n        componentFactory.add('codeBlock', locale => {\n            const dropdownView = createDropdown(locale, SplitButtonView);\n            const splitButtonView = dropdownView.buttonView;\n            const accessibleLabel = t('Insert code block');\n            splitButtonView.set({\n                label: accessibleLabel,\n                tooltip: true,\n                icon: IconCodeBlock,\n                isToggleable: true\n            });\n            splitButtonView.bind('isOn').to(command, 'value', value => !!value);\n            splitButtonView.on('execute', () => {\n                editor.execute('codeBlock', {\n                    usePreviousLanguageChoice: true\n                });\n                editor.editing.view.focus();\n            });\n            dropdownView.on('execute', evt => {\n                editor.execute('codeBlock', {\n                    language: evt.source._codeBlockLanguage,\n                    forceValue: true\n                });\n                editor.editing.view.focus();\n            });\n            dropdownView.class = 'ck-code-block-dropdown';\n            dropdownView.bind('isEnabled').to(command);\n            addListToDropdown(dropdownView, itemDefinitions, {\n                role: 'menu',\n                ariaLabel: accessibleLabel\n            });\n            return dropdownView;\n        });\n        componentFactory.add('menuBar:codeBlock', locale => {\n            const menuView = new MenuBarMenuView(locale);\n            menuView.buttonView.set({\n                role: 'menuitem',\n                label: t('Code block'),\n                icon: IconCodeBlock\n            });\n            menuView.bind('isEnabled').to(command);\n            const listView = new MenuBarMenuListView(locale);\n            listView.set({\n                ariaLabel: t('Insert code block')\n            });\n            for (const definition of itemDefinitions) {\n                const listItemView = new MenuBarMenuListItemView(locale, menuView);\n                const buttonView = new MenuBarMenuListItemButtonView(locale);\n                buttonView.bind(...Object.keys(definition.model)).to(definition.model);\n                buttonView.set({\n                    isToggleable: true,\n                    role: 'menuitemcheckbox'\n                });\n                buttonView.delegate('execute').to(menuView);\n                buttonView.on('execute', () => {\n                    editor.execute('codeBlock', {\n                        language: definition.model._codeBlockLanguage,\n                        forceValue: command.value == definition.model._codeBlockLanguage ? false : true\n                    });\n                    editor.editing.view.focus();\n                });\n                listItemView.children.add(buttonView);\n                listView.items.add(listItemView);\n            }\n            menuView.panelView.children.add(listView);\n            return menuView;\n        });\n    }\n    /**\n     * A helper returning a collection of the `codeBlock` dropdown items representing languages\n     * available for the user to choose from.\n     */\n    _getLanguageListItemDefinitions(normalizedLanguageDefs) {\n        const editor = this.editor;\n        const command = editor.commands.get('codeBlock');\n        const itemDefinitions = new Collection();\n        for (const languageDef of normalizedLanguageDefs) {\n            const definition = {\n                type: 'button',\n                model: new UIModel({\n                    _codeBlockLanguage: languageDef.language,\n                    label: languageDef.label,\n                    role: 'menuitemradio',\n                    withText: true\n                })\n            };\n            definition.model.bind('isOn').to(command, 'value', value => {\n                return value === definition.model._codeBlockLanguage;\n            });\n            itemDefinitions.add(definition);\n        }\n        return itemDefinitions;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/liststartcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { expandListBlocksToCompleteList, isListItemBlock, isNumberedListType } from '../list/utils/model.js';\n/**\n * The list start index command. It changes the `listStart` attribute of the selected list items,\n * letting the user to choose the starting point of an ordered list.\n * It is used by the {@link module:list/listproperties~ListProperties list properties feature}.\n */\nexport class ListStartCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const value = this._getValue();\n        this.value = value;\n        this.isEnabled = value != null;\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options Execute options.\n     * @param options.startIndex The list start index.\n     */\n    execute({ startIndex = 1 } = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        let blocks = Array.from(document.selection.getSelectedBlocks())\n            .filter(block => isListItemBlock(block) &&\n            isNumberedListType(block.getAttribute('listType')));\n        blocks = expandListBlocksToCompleteList(blocks);\n        model.change(writer => {\n            for (const block of blocks) {\n                writer.setAttribute('listStart', startIndex >= 0 ? startIndex : 1, block);\n            }\n        });\n    }\n    /**\n     * Checks the command's {@link #value}.\n     *\n     * @returns The current value.\n     */\n    _getValue() {\n        const model = this.editor.model;\n        const document = model.document;\n        const block = first(document.selection.getSelectedBlocks());\n        if (block &&\n            isListItemBlock(block) &&\n            isNumberedListType(block.getAttribute('listType'))) {\n            return block.getAttribute('listStart');\n        }\n        return null;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n* @module list/listproperties/utils/style\n*/\nconst LIST_STYLE_TO_LIST_TYPE = {};\nconst LIST_STYLE_TO_TYPE_ATTRIBUTE = {};\nconst TYPE_ATTRIBUTE_TO_LIST_STYLE = {};\nconst LIST_STYLE_TYPES = [\n    { listStyle: 'disc', typeAttribute: 'disc', listType: 'bulleted' },\n    { listStyle: 'circle', typeAttribute: 'circle', listType: 'bulleted' },\n    { listStyle: 'square', typeAttribute: 'square', listType: 'bulleted' },\n    { listStyle: 'decimal', typeAttribute: '1', listType: 'numbered' },\n    { listStyle: 'decimal-leading-zero', typeAttribute: null, listType: 'numbered' },\n    { listStyle: 'lower-roman', typeAttribute: 'i', listType: 'numbered' },\n    { listStyle: 'upper-roman', typeAttribute: 'I', listType: 'numbered' },\n    { listStyle: 'lower-alpha', typeAttribute: 'a', listType: 'numbered' },\n    { listStyle: 'upper-alpha', typeAttribute: 'A', listType: 'numbered' },\n    { listStyle: 'lower-latin', typeAttribute: 'a', listType: 'numbered' },\n    { listStyle: 'upper-latin', typeAttribute: 'A', listType: 'numbered' }\n];\nfor (const { listStyle, typeAttribute, listType } of LIST_STYLE_TYPES) {\n    LIST_STYLE_TO_LIST_TYPE[listStyle] = listType;\n    LIST_STYLE_TO_TYPE_ATTRIBUTE[listStyle] = typeAttribute;\n    if (typeAttribute) {\n        TYPE_ATTRIBUTE_TO_LIST_STYLE[typeAttribute] = listStyle;\n    }\n}\n/**\n * Gets all the style types supported by given list type.\n *\n * @internal\n */\nexport function getAllSupportedStyleTypes() {\n    return LIST_STYLE_TYPES.map(x => x.listStyle);\n}\n/**\n * Checks whether the given list-style-type is supported by numbered or bulleted list.\n *\n * @internal\n */\nexport function getListTypeFromListStyleType(listStyleType) {\n    return LIST_STYLE_TO_LIST_TYPE[listStyleType] || null;\n}\n/**\n * Converts `type` attribute of `<ul>` or `<ol>` elements to `list-style-type` equivalent.\n *\n * @internal\n */\nexport function getListStyleTypeFromTypeAttribute(value) {\n    return TYPE_ATTRIBUTE_TO_LIST_STYLE[value] || null;\n}\n/**\n * Converts `list-style-type` style to `type` attribute of `<ul>` or `<ol>` elements.\n *\n * @internal\n */\nexport function getTypeAttributeFromListStyleType(value) {\n    return LIST_STYLE_TO_TYPE_ATTRIBUTE[value] || null;\n}\n/**\n * Normalizes list style by converting aliases to their canonical form.\n *\n * @internal\n * @param listStyle The list style value to normalize.\n * @returns The canonical form of the list style.\n *\n * @example\n * normalizeListStyle( 'lower-alpha' ); // Returns 'lower-latin'\n * normalizeListStyle( 'upper-alpha' ); // Returns 'upper-latin'\n * normalizeListStyle( 'disc' ); // Returns 'disc'\n */\nexport function normalizeListStyle(listStyle) {\n    switch (listStyle) {\n        case 'lower-alpha':\n            return 'lower-latin';\n        case 'upper-alpha':\n            return 'upper-latin';\n        default:\n            return listStyle;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/liststylecommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { expandListBlocksToCompleteList, isListItemBlock } from '../list/utils/model.js';\nimport { getListTypeFromListStyleType } from './utils/style.js';\n/**\n * The list style command. It changes `listStyle` attribute of the selected list items,\n * letting the user choose styles for the list item markers.\n * It is used by the {@link module:list/listproperties~ListProperties list properties feature}.\n */\nexport class ListStyleCommand extends Command {\n    /**\n     * The default type of the list style.\n     */\n    defaultType;\n    /**\n     * The list of supported style types by this command.\n     */\n    _supportedTypes;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor The editor instance.\n     * @param defaultType The list type that will be used by default if the value was not specified during\n     * the command execution.\n     * @param supportedTypes The list of supported style types by this command.\n     */\n    constructor(editor, defaultType, supportedTypes) {\n        super(editor);\n        this.defaultType = defaultType;\n        this._supportedTypes = supportedTypes;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.value = this._getValue();\n        this.isEnabled = this._checkEnabled();\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options.type The type of the list style, e.g. `'disc'` or `'square'`. If `null` is specified, the default\n     * style will be applied.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        model.change(writer => {\n            this._tryToConvertItemsToList(options);\n            let blocks = Array.from(document.selection.getSelectedBlocks())\n                .filter(block => block.hasAttribute('listType'));\n            if (!blocks.length) {\n                return;\n            }\n            blocks = expandListBlocksToCompleteList(blocks);\n            for (const block of blocks) {\n                writer.setAttribute('listStyle', options.type || this.defaultType, block);\n            }\n        });\n    }\n    /**\n     * Checks if the given style type is supported by this plugin.\n     */\n    isStyleTypeSupported(value) {\n        if (!this._supportedTypes) {\n            return true;\n        }\n        return this._supportedTypes.includes(value);\n    }\n    /**\n     * Checks the command's {@link #value}.\n     *\n     * @returns The current value.\n     */\n    _getValue() {\n        const listItem = first(this.editor.model.document.selection.getSelectedBlocks());\n        if (isListItemBlock(listItem)) {\n            return listItem.getAttribute('listStyle');\n        }\n        return null;\n    }\n    /**\n     * Checks whether the command can be enabled in the current context.\n     *\n     * @returns Whether the command should be enabled.\n     */\n    _checkEnabled() {\n        const editor = this.editor;\n        const numberedList = editor.commands.get('numberedList');\n        const bulletedList = editor.commands.get('bulletedList');\n        return numberedList.isEnabled || bulletedList.isEnabled;\n    }\n    /**\n     * Check if the provided list style is valid. Also change the selection to a list if it's not set yet.\n     *\n     * @param options.type The type of the list style. If `null` is specified, the function does nothing.\n    */\n    _tryToConvertItemsToList(options) {\n        if (!options.type) {\n            return;\n        }\n        const listType = getListTypeFromListStyleType(options.type);\n        if (!listType) {\n            return;\n        }\n        const editor = this.editor;\n        const commandName = `${listType}List`;\n        const command = editor.commands.get(commandName);\n        if (!command.value) {\n            editor.execute(commandName);\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/listreversedcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { first } from 'ckeditor5/src/utils.js';\nimport { expandListBlocksToCompleteList, isListItemBlock } from '../list/utils/model.js';\n/**\n * The list reversed command. It changes the `listReversed` attribute of the selected list items,\n * letting the user to choose the order of an ordered list.\n * It is used by the {@link module:list/listproperties~ListProperties list properties feature}.\n */\nexport class ListReversedCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const value = this._getValue();\n        this.value = value;\n        this.isEnabled = value != null;\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options.reversed Whether the list should be reversed.\n     */\n    execute(options = {}) {\n        const model = this.editor.model;\n        const document = model.document;\n        let blocks = Array.from(document.selection.getSelectedBlocks())\n            .filter(block => isListItemBlock(block) && block.getAttribute('listType') == 'numbered');\n        blocks = expandListBlocksToCompleteList(blocks);\n        model.change(writer => {\n            for (const block of blocks) {\n                writer.setAttribute('listReversed', !!options.reversed, block);\n            }\n        });\n    }\n    /**\n     * Checks the command's {@link #value}.\n     */\n    _getValue() {\n        const model = this.editor.model;\n        const document = model.document;\n        const block = first(document.selection.getSelectedBlocks());\n        if (isListItemBlock(block) && block.getAttribute('listType') == 'numbered') {\n            return block.getAttribute('listReversed');\n        }\n        return null;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns a converter that consumes the `style`, `reversed`, and `start` attributes.\n * In `style`, it searches for the `list-style-type` definition.\n * If not found, the `\"default\"` value will be used.\n *\n * @internal\n * @param strategy\n */\nexport function listPropertiesUpcastConverter(strategy) {\n    return (evt, data, conversionApi) => {\n        const { writer, schema, consumable } = conversionApi;\n        // If there is no view consumable to consume, set the default attribute value to be able to reconvert nested lists on parent change.\n        // So abort converting if attribute was directly consumed.\n        if (consumable.test(data.viewItem, strategy.viewConsumables) === false) {\n            return;\n        }\n        if (!data.modelRange) {\n            Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));\n        }\n        let applied = false;\n        for (const item of data.modelRange.getItems({ shallow: true })) {\n            if (!schema.checkAttribute(item, strategy.attributeName)) {\n                continue;\n            }\n            if (!strategy.appliesToListItem(item)) {\n                continue;\n            }\n            // Set list attributes only on same level items, those nested deeper are already handled by the recursive conversion.\n            if (item.hasAttribute(strategy.attributeName)) {\n                continue;\n            }\n            writer.setAttribute(strategy.attributeName, strategy.getAttributeOnUpcast(data.viewItem), item);\n            applied = true;\n        }\n        if (applied) {\n            consumable.consume(data.viewItem, strategy.viewConsumables);\n        }\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/listpropertiesutils\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { getAllSupportedStyleTypes, getListStyleTypeFromTypeAttribute, getListTypeFromListStyleType, getTypeAttributeFromListStyleType } from './utils/style.js';\n/**\n * A set of helpers related to document lists.\n */\nexport class ListPropertiesUtils extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListPropertiesUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Gets all the style types supported by given list type.\n     */\n    getAllSupportedStyleTypes() {\n        return getAllSupportedStyleTypes();\n    }\n    /**\n     * Checks whether the given list-style-type is supported by numbered or bulleted list.\n     */\n    getListTypeFromListStyleType(listStyleType) {\n        return getListTypeFromListStyleType(listStyleType);\n    }\n    /**\n     * Converts `type` attribute of `<ul>` or `<ol>` elements to `list-style-type` equivalent.\n     */\n    getListStyleTypeFromTypeAttribute(value) {\n        return getListStyleTypeFromTypeAttribute(value);\n    }\n    /**\n     * Converts `list-style-type` style to `type` attribute of `<ul>` or `<ol>` elements.\n     */\n    getTypeAttributeFromListStyleType(value) {\n        return getTypeAttributeFromListStyleType(value);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/utils/config\n */\nimport { toArray } from 'ckeditor5/src/utils.js';\n/**\n * Normalizes {@link module:list/listconfig~ListPropertiesConfig} in the configuration of the list properties feature.\n * The structure of normalized list properties options looks as follows:\n *\n * ```ts\n * {\n * \tstyles: {\n * \t\tlistTypes: [ 'bulleted', 'numbered' ],\n * \t\tuseAttribute: false\n * \t},\n * \tstartIndex: true,\n * \treversed: true\n * }\n * ```\n *\n * @internal\n * @param config The list properties {@link module:list/listconfig~ListPropertiesConfig config}.\n * @returns An object with normalized list properties options.\n */\nexport function getNormalizedConfig(config) {\n    const { startIndex, reversed, styles } = config;\n    return {\n        styles: getNormalizedStylesConfig(styles),\n        startIndex: startIndex || false,\n        reversed: reversed || false\n    };\n}\n/**\n * Normalizes styles in the configuration of the list properties feature.\n * The structure of normalized list properties options looks as follows:\n *\n * ```ts\n * {\n * \tlistTypes: [ 'bulleted', 'numbered' ],\n * \tuseAttribute: false\n * }\n * ```\n *\n * @param styles The list properties styles.\n * @returns An object with normalized list properties styles.\n */\nfunction getNormalizedStylesConfig(styles) {\n    const normalizedConfig = {\n        listTypes: ['bulleted', 'numbered'],\n        useAttribute: false\n    };\n    if (styles === true) {\n        return normalizedConfig;\n    }\n    if (!styles) {\n        normalizedConfig.listTypes = [];\n    }\n    else if (Array.isArray(styles) || typeof styles == 'string') {\n        normalizedConfig.listTypes = toArray(styles);\n    }\n    else {\n        normalizedConfig.listTypes = styles.listTypes ?\n            toArray(styles.listTypes) :\n            normalizedConfig.listTypes;\n        normalizedConfig.useAttribute = !!styles.useAttribute;\n        if (styles.listStyleTypes) {\n            normalizedConfig.listStyleTypes = styles.listStyleTypes;\n        }\n    }\n    return normalizedConfig;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/listpropertiesediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ListEditing } from '../list/listediting.js';\nimport { ListStartCommand } from './liststartcommand.js';\nimport { ListStyleCommand } from './liststylecommand.js';\nimport { ListReversedCommand } from './listreversedcommand.js';\nimport { listPropertiesUpcastConverter } from './converters.js';\nimport { getAllSupportedStyleTypes, getListTypeFromListStyleType, getListStyleTypeFromTypeAttribute, getTypeAttributeFromListStyleType, normalizeListStyle } from './utils/style.js';\nimport { ListPropertiesUtils } from './listpropertiesutils.js';\nimport { isNumberedListType } from '../list/utils/model.js';\nimport { getNormalizedConfig } from './utils/config.js';\nconst DEFAULT_LIST_TYPE = 'default';\n/**\n * The document list properties engine feature.\n *\n * It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they are enabled in the configuration.\n * Read more in {@link module:list/listconfig~ListPropertiesConfig}.\n */\nexport class ListPropertiesEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing, ListPropertiesUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListPropertiesEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'LP';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('list.properties', {\n            styles: true,\n            startIndex: false,\n            reversed: false\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const listEditing = editor.plugins.get(ListEditing);\n        const enabledProperties = editor.config.get('list.properties');\n        const strategies = createAttributeStrategies(enabledProperties);\n        for (const strategy of strategies) {\n            strategy.addCommand(editor);\n            model.schema.extend('$listItem', { allowAttributes: strategy.attributeName });\n            // Register downcast strategy.\n            listEditing.registerDowncastStrategy({\n                scope: 'list',\n                attributeName: strategy.attributeName,\n                setAttributeOnDowncast(writer, attributeValue, viewElement) {\n                    strategy.setAttributeOnDowncast(writer, attributeValue, viewElement);\n                }\n            });\n        }\n        // Set up conversion.\n        editor.conversion.for('upcast').add(dispatcher => {\n            for (const strategy of strategies) {\n                dispatcher.on('element:ol', listPropertiesUpcastConverter(strategy));\n                dispatcher.on('element:ul', listPropertiesUpcastConverter(strategy));\n            }\n        });\n        // Verify if the list view element (ul or ol) requires refreshing.\n        listEditing.on('checkAttributes:list', (evt, { viewElement, modelAttributes, modelReferenceElement }) => {\n            for (const strategy of strategies) {\n                if (!strategy.appliesToListItem(modelReferenceElement)) {\n                    continue;\n                }\n                if (strategy.getAttributeOnUpcast(viewElement) != modelAttributes[strategy.attributeName]) {\n                    evt.return = true;\n                    evt.stop();\n                }\n            }\n        });\n        // Reset list properties after indenting list items.\n        this.listenTo(editor.commands.get('indentList'), 'afterExecute', (evt, changedBlocks) => {\n            model.change(writer => {\n                for (const node of changedBlocks) {\n                    for (const strategy of strategies) {\n                        if (strategy.appliesToListItem(node)) {\n                            // Just reset the attribute.\n                            // If there is a previous indented list that this node should be merged into,\n                            // the postfixer will unify all the attributes of both sub-lists.\n                            writer.setAttribute(strategy.attributeName, strategy.defaultValue, node);\n                        }\n                    }\n                }\n            });\n        });\n        // Add or remove list properties attributes depending on the list type.\n        listEditing.on('postFixer', (evt, { listNodes, writer }) => {\n            for (const { node } of listNodes) {\n                for (const strategy of strategies) {\n                    // Check if attribute is valid.\n                    if (strategy.hasValidAttribute(node)) {\n                        continue;\n                    }\n                    // Add missing default property attributes...\n                    if (strategy.appliesToListItem(node)) {\n                        writer.setAttribute(strategy.attributeName, strategy.defaultValue, node);\n                    }\n                    // ...or remove invalid property attributes.\n                    else {\n                        writer.removeAttribute(strategy.attributeName, node);\n                    }\n                    evt.return = true;\n                }\n            }\n        });\n        // Make sure that all items in a single list (items at the same level & listType) have the same properties.\n        listEditing.on('postFixer', (evt, { listNodes, writer }) => {\n            for (const { node, previousNodeInList } of listNodes) {\n                // This is a first item of a nested list.\n                if (!previousNodeInList) {\n                    continue;\n                }\n                // This is a first block of a list of a different type.\n                if (previousNodeInList.getAttribute('listType') != node.getAttribute('listType')) {\n                    continue;\n                }\n                // Copy properties from the previous one.\n                for (const strategy of strategies) {\n                    const { attributeName } = strategy;\n                    if (!strategy.appliesToListItem(node)) {\n                        continue;\n                    }\n                    const value = previousNodeInList.getAttribute(attributeName);\n                    if (node.getAttribute(attributeName) != value) {\n                        writer.setAttribute(attributeName, value, node);\n                        evt.return = true;\n                    }\n                }\n            }\n        });\n    }\n}\n/**\n * Creates an array of strategies for dealing with enabled listItem attributes.\n */\nfunction createAttributeStrategies(enabledProperties) {\n    const strategies = [];\n    const normalizedConfig = getNormalizedConfig(enabledProperties);\n    if (enabledProperties.styles) {\n        const useAttribute = normalizedConfig.styles.useAttribute;\n        strategies.push({\n            attributeName: 'listStyle',\n            defaultValue: DEFAULT_LIST_TYPE,\n            viewConsumables: { styles: 'list-style-type' },\n            addCommand(editor) {\n                let supportedTypes = getAllSupportedStyleTypes();\n                if (useAttribute) {\n                    supportedTypes = supportedTypes.filter(styleType => !!getTypeAttributeFromListStyleType(styleType));\n                }\n                editor.commands.add('listStyle', new ListStyleCommand(editor, DEFAULT_LIST_TYPE, supportedTypes));\n            },\n            appliesToListItem(item) {\n                return item.getAttribute('listType') == 'numbered' || item.getAttribute('listType') == 'bulleted';\n            },\n            hasValidAttribute(item) {\n                if (!this.appliesToListItem(item)) {\n                    return !item.hasAttribute('listStyle');\n                }\n                if (!item.hasAttribute('listStyle')) {\n                    return false;\n                }\n                const value = item.getAttribute('listStyle');\n                if (value == DEFAULT_LIST_TYPE) {\n                    return true;\n                }\n                return getListTypeFromListStyleType(value) == item.getAttribute('listType');\n            },\n            setAttributeOnDowncast(writer, listStyle, element) {\n                if (listStyle && listStyle !== DEFAULT_LIST_TYPE) {\n                    if (useAttribute) {\n                        const value = getTypeAttributeFromListStyleType(listStyle);\n                        if (value) {\n                            writer.setAttribute('type', value, element);\n                            return;\n                        }\n                    }\n                    else {\n                        writer.setStyle('list-style-type', listStyle, element);\n                        return;\n                    }\n                }\n                writer.removeStyle('list-style-type', element);\n                writer.removeAttribute('type', element);\n            },\n            getAttributeOnUpcast(listParent) {\n                const style = listParent.getStyle('list-style-type');\n                if (style) {\n                    return normalizeListStyle(style);\n                }\n                const attribute = listParent.getAttribute('type');\n                if (attribute) {\n                    return getListStyleTypeFromTypeAttribute(attribute);\n                }\n                return DEFAULT_LIST_TYPE;\n            }\n        });\n    }\n    if (enabledProperties.reversed) {\n        strategies.push({\n            attributeName: 'listReversed',\n            defaultValue: false,\n            viewConsumables: { attributes: 'reversed' },\n            addCommand(editor) {\n                editor.commands.add('listReversed', new ListReversedCommand(editor));\n            },\n            appliesToListItem(item) {\n                return item.getAttribute('listType') == 'numbered';\n            },\n            hasValidAttribute(item) {\n                return this.appliesToListItem(item) == item.hasAttribute('listReversed');\n            },\n            setAttributeOnDowncast(writer, listReversed, element) {\n                if (listReversed) {\n                    writer.setAttribute('reversed', 'reversed', element);\n                }\n                else {\n                    writer.removeAttribute('reversed', element);\n                }\n            },\n            getAttributeOnUpcast(listParent) {\n                return listParent.hasAttribute('reversed');\n            }\n        });\n    }\n    if (enabledProperties.startIndex) {\n        strategies.push({\n            attributeName: 'listStart',\n            defaultValue: 1,\n            viewConsumables: { attributes: 'start' },\n            addCommand(editor) {\n                editor.commands.add('listStart', new ListStartCommand(editor));\n            },\n            appliesToListItem(item) {\n                return isNumberedListType(item.getAttribute('listType'));\n            },\n            hasValidAttribute(item) {\n                return this.appliesToListItem(item) == item.hasAttribute('listStart');\n            },\n            setAttributeOnDowncast(writer, listStart, element) {\n                if (listStart == 0 || listStart > 1) {\n                    writer.setAttribute('start', listStart, element);\n                }\n                else {\n                    writer.removeAttribute('start', element);\n                }\n            },\n            getAttributeOnUpcast(listParent) {\n                const startAttributeValue = listParent.getAttribute('start');\n                return startAttributeValue >= 0 ? startAttributeValue : 1;\n            }\n        });\n    }\n    return strategies;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/ui/listpropertiesview\n */\nimport { ButtonView, View, ViewCollection, FocusCycler, SwitchButtonView, LabeledFieldView, createLabeledInputNumber, addKeyboardHandlingForGrid, CollapsibleView } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler, global } from 'ckeditor5/src/utils.js';\nimport '../../../theme/listproperties.css';\n/**\n * The list properties view to be displayed in the list dropdown.\n *\n * Contains a grid of available list styles and, for numbered list, also the list start index and reversed fields.\n *\n * @internal\n */\nexport class ListPropertiesView extends View {\n    /**\n     * A collection of the child views.\n     */\n    children;\n    /**\n     * A view that renders the grid of list styles.\n     */\n    stylesView = null;\n    /**\n     * A collapsible view that hosts additional list property fields ({@link #startIndexFieldView} and\n     * {@link #reversedSwitchButtonView}) to visually separate them from the {@link #stylesView grid of styles}.\n     *\n     * **Note**: Only present when:\n     * * the view represents **numbered** list properties,\n     * * and the {@link #stylesView} is rendered,\n     * * and either {@link #startIndexFieldView} or {@link #reversedSwitchButtonView} is rendered.\n     *\n     * @readonly\n     */\n    additionalPropertiesCollapsibleView = null;\n    /**\n     * A labeled number field allowing the user to set the start index of the list.\n     *\n     * **Note**: Only present when the view represents **numbered** list properties.\n     *\n     * @readonly\n     */\n    startIndexFieldView = null;\n    /**\n     * A switch button allowing the user to make the edited list reversed.\n     *\n     * **Note**: Only present when the view represents **numbered** list properties.\n     *\n     * @readonly\n     */\n    reversedSwitchButtonView = null;\n    /**\n     * Tracks information about the DOM focus in the view.\n     */\n    focusTracker = new FocusTracker();\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes = new KeystrokeHandler();\n    /**\n     * A collection of views that can be focused in the properties view.\n     */\n    focusables = new ViewCollection();\n    /**\n     * Helps cycling over {@link #focusables} in the view.\n     */\n    focusCycler;\n    /**\n     * Creates an instance of the list properties view.\n     *\n     * @param locale The {@link module:core/editor/editor~Editor#locale} instance.\n     * @param options Options of the view.\n     * @param options.enabledProperties An object containing the configuration of enabled list property names.\n     * Allows conditional rendering the sub-components of the properties view.\n     * @param options.styleButtonViews A list of style buttons to be rendered\n     * inside the styles grid. The grid will not be rendered when `enabledProperties` does not include the `'styles'` key.\n     * @param options.styleGridAriaLabel An assistive technologies label set on the grid of styles (if the grid is rendered).\n     */\n    constructor(locale, { enabledProperties, styleButtonViews, styleGridAriaLabel }) {\n        super(locale);\n        const elementCssClasses = [\n            'ck',\n            'ck-list-properties'\n        ];\n        this.children = this.createCollection();\n        this.focusCycler = new FocusCycler({\n            focusables: this.focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate #children backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate #children forwards using the <kbd>Tab</kbd> key.\n                focusNext: 'tab'\n            }\n        });\n        // The rendering of the styles grid is conditional. When there is no styles grid, the view will render without collapsible\n        // for numbered list properties, hence simplifying the layout.\n        if (styleButtonViews && styleButtonViews.length) {\n            this.stylesView = this._createStylesView(styleButtonViews, styleGridAriaLabel);\n            this.children.add(this.stylesView);\n        }\n        else {\n            elementCssClasses.push('ck-list-properties_without-styles');\n        }\n        // The rendering of the numbered list property views is also conditional. It only makes sense for the numbered list\n        // dropdown. The unordered list does not have such properties.\n        if (enabledProperties.startIndex || enabledProperties.reversed) {\n            this._addNumberedListPropertyViews(enabledProperties);\n            elementCssClasses.push('ck-list-properties_with-numbered-properties');\n        }\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: elementCssClasses\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        if (this.stylesView) {\n            this.focusables.add(this.stylesView);\n            this.focusTracker.add(this.stylesView.element);\n            // Register the collapsible toggle button to the focus system.\n            if (this.startIndexFieldView || this.reversedSwitchButtonView) {\n                this.focusables.add(this.children.last.buttonView);\n                this.focusTracker.add(this.children.last.buttonView.element);\n            }\n            for (const item of this.stylesView.children) {\n                this.stylesView.focusTracker.add(item.element);\n            }\n            addKeyboardHandlingForGrid({\n                keystrokeHandler: this.stylesView.keystrokes,\n                focusTracker: this.stylesView.focusTracker,\n                gridItems: this.stylesView.children,\n                // Note: The styles view has a different number of columns depending on whether the other properties\n                // are enabled in the dropdown or not (https://github.com/ckeditor/ckeditor5/issues/12340)\n                numberOfColumns: () => global.window\n                    .getComputedStyle(this.stylesView.element)\n                    .getPropertyValue('grid-template-columns')\n                    .split(' ')\n                    .length,\n                uiLanguageDirection: this.locale && this.locale.uiLanguageDirection\n            });\n        }\n        if (this.startIndexFieldView) {\n            this.focusables.add(this.startIndexFieldView);\n            this.focusTracker.add(this.startIndexFieldView.element);\n            const stopPropagation = (data) => data.stopPropagation();\n            // Since the form is in the dropdown panel which is a child of the toolbar, the toolbar's\n            // keystroke handler would take over the key management in the input. We need to prevent\n            // this ASAP. Otherwise, the basic caret movement using the arrow keys will be impossible.\n            this.keystrokes.set('arrowright', stopPropagation);\n            this.keystrokes.set('arrowleft', stopPropagation);\n            this.keystrokes.set('arrowup', stopPropagation);\n            this.keystrokes.set('arrowdown', stopPropagation);\n        }\n        if (this.reversedSwitchButtonView) {\n            this.focusables.add(this.reversedSwitchButtonView);\n            this.focusTracker.add(this.reversedSwitchButtonView.element);\n        }\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    focus() {\n        this.focusCycler.focusFirst();\n    }\n    /**\n     * @inheritDoc\n     */\n    focusLast() {\n        this.focusCycler.focusLast();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Creates the list styles grid.\n     *\n     * @param styleButtons Buttons to be placed in the grid.\n     * @param styleGridAriaLabel The assistive technology label of the grid.\n     */\n    _createStylesView(styleButtons, styleGridAriaLabel) {\n        const stylesView = new View(this.locale);\n        stylesView.children = stylesView.createCollection();\n        stylesView.children.addMany(styleButtons);\n        stylesView.setTemplate({\n            tag: 'div',\n            attributes: {\n                'aria-label': styleGridAriaLabel,\n                class: [\n                    'ck',\n                    'ck-list-styles-list'\n                ]\n            },\n            children: stylesView.children\n        });\n        stylesView.children.delegate('execute').to(this);\n        stylesView.focus = function () {\n            // If there is a button that is already on, focus it.\n            // It's counterintuitive to focus the first button when there is already a button on.\n            for (const child of this.children) {\n                if (child instanceof ButtonView && child.isOn) {\n                    child.focus();\n                    return;\n                }\n            }\n            // ... otherwise focus the first button.\n            this.children.first.focus();\n        };\n        stylesView.focusTracker = new FocusTracker();\n        stylesView.keystrokes = new KeystrokeHandler();\n        stylesView.render();\n        stylesView.keystrokes.listenTo(stylesView.element);\n        return stylesView;\n    }\n    /**\n     * Renders {@link #startIndexFieldView} and/or {@link #reversedSwitchButtonView} depending on the configuration of the properties view.\n     *\n     * @param enabledProperties An object containing the configuration of enabled list property names\n     * (see {@link #constructor}).\n     */\n    _addNumberedListPropertyViews(enabledProperties) {\n        const t = this.locale.t;\n        const numberedPropertyViews = [];\n        if (enabledProperties.startIndex) {\n            this.startIndexFieldView = this._createStartIndexField();\n            numberedPropertyViews.push(this.startIndexFieldView);\n        }\n        if (enabledProperties.reversed) {\n            this.reversedSwitchButtonView = this._createReversedSwitchButton();\n            numberedPropertyViews.push(this.reversedSwitchButtonView);\n        }\n        // When there are some style buttons, pack the numbered list properties into a collapsible to separate them.\n        if (this.stylesView) {\n            this.additionalPropertiesCollapsibleView = new CollapsibleView(this.locale, numberedPropertyViews);\n            this.additionalPropertiesCollapsibleView.set({\n                label: t('List properties'),\n                isCollapsed: true\n            });\n            // Don't enable the collapsible view unless either start index or reversed field is enabled (e.g. when no list is selected).\n            this.additionalPropertiesCollapsibleView.buttonView.bind('isEnabled').toMany(numberedPropertyViews, 'isEnabled', (...areEnabled) => areEnabled.some(isEnabled => isEnabled));\n            // Automatically collapse the additional properties collapsible when either start index or reversed field gets disabled.\n            this.additionalPropertiesCollapsibleView.buttonView.on('change:isEnabled', (evt, data, isEnabled) => {\n                if (!isEnabled) {\n                    this.additionalPropertiesCollapsibleView.isCollapsed = true;\n                }\n            });\n            this.children.add(this.additionalPropertiesCollapsibleView);\n        }\n        else {\n            this.children.addMany(numberedPropertyViews);\n        }\n    }\n    /**\n     * Creates the list start index labeled field.\n     */\n    _createStartIndexField() {\n        const t = this.locale.t;\n        const startIndexFieldView = new LabeledFieldView(this.locale, createLabeledInputNumber);\n        startIndexFieldView.set({\n            label: t('Start at'),\n            class: 'ck-numbered-list-properties__start-index'\n        });\n        startIndexFieldView.fieldView.set({\n            min: 0,\n            step: 1,\n            value: 1,\n            inputMode: 'numeric'\n        });\n        startIndexFieldView.fieldView.on('input', () => {\n            const inputElement = startIndexFieldView.fieldView.element;\n            const startIndex = inputElement.valueAsNumber;\n            if (Number.isNaN(startIndex)) {\n                // Number inputs allow for the entry of characters that may result in NaN,\n                // such as 'e', '+', '123e', '2-'.\n                startIndexFieldView.errorText = t('Invalid start index value.');\n                return;\n            }\n            if (!inputElement.checkValidity()) {\n                startIndexFieldView.errorText = t('Start index must be greater than 0.');\n            }\n            else {\n                this.fire('listStart', { startIndex });\n            }\n        });\n        return startIndexFieldView;\n    }\n    /**\n     * Creates the reversed list switch button.\n     */\n    _createReversedSwitchButton() {\n        const t = this.locale.t;\n        const reversedButtonView = new SwitchButtonView(this.locale);\n        reversedButtonView.set({\n            withText: true,\n            label: t('Reversed order'),\n            class: 'ck-numbered-list-properties__reversed-order'\n        });\n        reversedButtonView.delegate('execute').to(this, 'listReversed');\n        return reversedButtonView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties/listpropertiesui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconBulletedList, IconNumberedList, IconListStyleCircle, IconListStyleDecimal, IconListStyleDecimalLeadingZero, IconListStyleDisc, IconListStyleLowerLatin, IconListStyleLowerRoman, IconListStyleSquare, IconListStyleUpperLatin, IconListStyleUpperRoman } from 'ckeditor5/src/icons.js';\nimport { ButtonView, SplitButtonView, createDropdown, focusChildOnDropdownOpen, MenuBarMenuView } from 'ckeditor5/src/ui.js';\nimport { ListPropertiesView } from './ui/listpropertiesview.js';\nimport { getNormalizedConfig } from './utils/config.js';\nimport '../../theme/liststyles.css';\n/**\n * The list properties UI plugin. It introduces the extended `'bulletedList'` and `'numberedList'` toolbar\n * buttons that allow users to control such aspects of list as the marker, start index or order.\n *\n * **Note**: Buttons introduced by this plugin override implementations from the {@link module:list/list/listui~ListUI}\n * (because they share the same names).\n */\nexport class ListPropertiesUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListPropertiesUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    init() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const propertiesConfig = editor.config.get('list.properties');\n        const normalizedConfig = getNormalizedConfig(propertiesConfig);\n        const stylesListTypes = normalizedConfig.styles.listTypes;\n        // Note: When this plugin does not register the \"bulletedList\" dropdown due to properties configuration,\n        // a simple button will be still registered under the same name by ListUI as a fallback. This should happen\n        // in most editor configuration because the List plugin automatically requires ListUI.\n        if (stylesListTypes.includes('bulleted')) {\n            const styleDefinitions = [\n                {\n                    label: t('Toggle the disc list style'),\n                    tooltip: t('Disc'),\n                    type: 'disc',\n                    icon: IconListStyleDisc\n                },\n                {\n                    label: t('Toggle the circle list style'),\n                    tooltip: t('Circle'),\n                    type: 'circle',\n                    icon: IconListStyleCircle\n                },\n                {\n                    label: t('Toggle the square list style'),\n                    tooltip: t('Square'),\n                    type: 'square',\n                    icon: IconListStyleSquare\n                }\n            ];\n            const buttonLabel = t('Bulleted List');\n            const styleGridAriaLabel = t('Bulleted list styles toolbar');\n            const commandName = 'bulletedList';\n            editor.ui.componentFactory.add(commandName, getDropdownViewCreator({\n                editor,\n                normalizedConfig,\n                parentCommandName: commandName,\n                buttonLabel,\n                buttonIcon: IconBulletedList,\n                styleGridAriaLabel,\n                styleDefinitions\n            }));\n            // Add the menu bar item for bulleted list.\n            editor.ui.componentFactory.add(`menuBar:${commandName}`, getMenuBarStylesMenuCreator({\n                editor,\n                normalizedConfig,\n                parentCommandName: commandName,\n                buttonLabel,\n                styleGridAriaLabel,\n                styleDefinitions\n            }));\n        }\n        // Note: When this plugin does not register the \"numberedList\" dropdown due to properties configuration,\n        // a simple button will be still registered under the same name by ListUI as a fallback. This should happen\n        // in most editor configuration because the List plugin automatically requires ListUI.\n        if (stylesListTypes.includes('numbered') || propertiesConfig.startIndex || propertiesConfig.reversed) {\n            const styleDefinitions = [\n                {\n                    label: t('Toggle the decimal list style'),\n                    tooltip: t('Decimal'),\n                    type: 'decimal',\n                    icon: IconListStyleDecimal\n                },\n                {\n                    label: t('Toggle the decimal with leading zero list style'),\n                    tooltip: t('Decimal with leading zero'),\n                    type: 'decimal-leading-zero',\n                    icon: IconListStyleDecimalLeadingZero\n                },\n                {\n                    label: t('Toggle the lower–roman list style'),\n                    tooltip: t('Lower–roman'),\n                    type: 'lower-roman',\n                    icon: IconListStyleLowerRoman\n                },\n                {\n                    label: t('Toggle the upper–roman list style'),\n                    tooltip: t('Upper-roman'),\n                    type: 'upper-roman',\n                    icon: IconListStyleUpperRoman\n                },\n                {\n                    label: t('Toggle the lower–latin list style'),\n                    tooltip: t('Lower-latin'),\n                    type: 'lower-latin',\n                    icon: IconListStyleLowerLatin\n                },\n                {\n                    label: t('Toggle the upper–latin list style'),\n                    tooltip: t('Upper-latin'),\n                    type: 'upper-latin',\n                    icon: IconListStyleUpperLatin\n                }\n            ];\n            const buttonLabel = t('Numbered List');\n            const styleGridAriaLabel = t('Numbered list styles toolbar');\n            const commandName = 'numberedList';\n            editor.ui.componentFactory.add(commandName, getDropdownViewCreator({\n                editor,\n                normalizedConfig,\n                parentCommandName: commandName,\n                buttonLabel,\n                buttonIcon: IconNumberedList,\n                styleGridAriaLabel,\n                styleDefinitions\n            }));\n            // Menu bar menu does not display list start index or reverse UI. If there are no styles enabled,\n            // the menu makes no sense and should be omitted.\n            if (stylesListTypes.includes('numbered')) {\n                editor.ui.componentFactory.add(`menuBar:${commandName}`, getMenuBarStylesMenuCreator({\n                    editor,\n                    normalizedConfig,\n                    parentCommandName: commandName,\n                    buttonLabel,\n                    styleGridAriaLabel,\n                    styleDefinitions\n                }));\n            }\n        }\n    }\n}\n/**\n * A helper that returns a function that creates a split button with a toolbar in the dropdown,\n * which in turn contains buttons allowing users to change list styles in the context of the current selection.\n *\n * @param options.editor\n * @param options.normalizedConfig List properties configuration.\n * @param options.parentCommandName The name of the higher-order editor command associated with\n * the set of particular list styles (e.g. \"bulletedList\" for \"disc\", \"circle\", and \"square\" styles).\n * @param options.buttonLabel Label of the main part of the split button.\n * @param options.buttonIcon The SVG string of an icon for the main part of the split button.\n * @param options.styleGridAriaLabel The ARIA label for the styles grid in the split button dropdown.\n * @param options.styleDefinitions Definitions of the style buttons.\n * @returns A function that can be passed straight into {@link module:ui/componentfactory~ComponentFactory#add}.\n */\nfunction getDropdownViewCreator({ editor, normalizedConfig, parentCommandName, buttonLabel, buttonIcon, styleGridAriaLabel, styleDefinitions }) {\n    const parentCommand = editor.commands.get(parentCommandName);\n    return (locale) => {\n        const dropdownView = createDropdown(locale, SplitButtonView);\n        const mainButtonView = dropdownView.buttonView;\n        dropdownView.bind('isEnabled').to(parentCommand);\n        dropdownView.class = 'ck-list-styles-dropdown';\n        // Main button was clicked.\n        mainButtonView.on('execute', () => {\n            editor.execute(parentCommandName);\n            editor.editing.view.focus();\n        });\n        mainButtonView.set({\n            label: buttonLabel,\n            icon: buttonIcon,\n            tooltip: true,\n            isToggleable: true\n        });\n        mainButtonView.bind('isOn').to(parentCommand, 'value', value => !!value);\n        dropdownView.once('change:isOpen', () => {\n            const listPropertiesView = createListPropertiesView({\n                editor,\n                normalizedConfig,\n                dropdownView,\n                parentCommandName,\n                styleGridAriaLabel,\n                styleDefinitions\n            });\n            dropdownView.panelView.children.add(listPropertiesView);\n        });\n        // Focus the editable after executing the command.\n        // Overrides a default behaviour where the focus is moved to the dropdown button (#12125).\n        dropdownView.on('execute', () => {\n            editor.editing.view.focus();\n        });\n        return dropdownView;\n    };\n}\n/**\n * A helper that returns a function (factory) that creates individual buttons used by users to change styles\n * of lists.\n *\n * @param options.editor\n * @param options.listStyleCommand The instance of the `ListStylesCommand` class.\n * @param options.parentCommandName The name of the higher-order command associated with a\n * particular list style (e.g. \"bulletedList\" is associated with \"square\" and \"numberedList\" is associated with \"roman\").\n * @returns A function that can be passed straight into {@link module:ui/componentfactory~ComponentFactory#add}.\n */\nfunction getStyleButtonCreator({ editor, listStyleCommand, parentCommandName }) {\n    const locale = editor.locale;\n    const parentCommand = editor.commands.get(parentCommandName);\n    return ({ label, type, icon, tooltip }) => {\n        const button = new ButtonView(locale);\n        button.set({ label, icon, tooltip });\n        button.bind('isOn').to(listStyleCommand, 'value', value => value === type);\n        button.on('execute', () => {\n            // If the content the selection is anchored to is a list, let's change its style.\n            if (parentCommand.value) {\n                // Remove the list when the current list style is the same as the one that would normally be applied.\n                if (listStyleCommand.value === type) {\n                    editor.execute(parentCommandName);\n                }\n                // If the current list style is not set in the model or the style is different than the\n                // one to be applied, simply apply the new style.\n                else if (listStyleCommand.value !== type) {\n                    editor.execute('listStyle', { type });\n                }\n            }\n            // Otherwise, leave the creation of the styled list to the `ListStyleCommand`.\n            else {\n                editor.model.change(() => {\n                    editor.execute('listStyle', { type });\n                });\n            }\n        });\n        return button;\n    };\n}\n/**\n * A helper that creates the properties view for the individual style dropdown.\n *\n * @param options.editor Editor instance.\n * @param options.normalizedConfig List properties configuration.\n * @param options.dropdownView Styles dropdown view that hosts the properties view.\n * @param options.parentCommandName The name of the higher-order editor command associated with\n * the set of particular list styles (e.g. \"bulletedList\" for \"disc\", \"circle\", and \"square\" styles).\n * @param options.styleDefinitions Definitions of the style buttons.\n * @param options.styleGridAriaLabel An assistive technologies label set on the grid of styles (if the grid is rendered).\n */\nfunction createListPropertiesView({ editor, normalizedConfig, dropdownView, parentCommandName, styleDefinitions, styleGridAriaLabel }) {\n    const locale = editor.locale;\n    const enabledProperties = {\n        ...normalizedConfig,\n        ...(parentCommandName != 'numberedList' ? {\n            startIndex: false,\n            reversed: false\n        } : null)\n    };\n    const listType = parentCommandName.replace('List', '');\n    let styleButtonViews = null;\n    if (normalizedConfig.styles.listTypes.includes(listType)) {\n        const listStyleCommand = editor.commands.get('listStyle');\n        const styleButtonCreator = getStyleButtonCreator({\n            editor,\n            parentCommandName,\n            listStyleCommand\n        });\n        const configuredListStylesTypes = normalizedConfig.styles.listStyleTypes;\n        let filteredDefinitions = styleDefinitions;\n        if (configuredListStylesTypes) {\n            const allowedTypes = configuredListStylesTypes[listType];\n            if (allowedTypes) {\n                filteredDefinitions = styleDefinitions.filter(def => allowedTypes.includes(def.type));\n            }\n        }\n        const isStyleTypeSupported = getStyleTypeSupportChecker(listStyleCommand);\n        styleButtonViews = filteredDefinitions\n            .filter(isStyleTypeSupported)\n            .map(styleButtonCreator);\n    }\n    const listPropertiesView = new ListPropertiesView(locale, {\n        styleGridAriaLabel,\n        enabledProperties,\n        styleButtonViews\n    });\n    if (normalizedConfig.styles.listTypes.includes(listType)) {\n        // Accessibility: focus the first active style when opening the dropdown.\n        focusChildOnDropdownOpen(dropdownView, () => {\n            return listPropertiesView.stylesView.children.find((child) => child.isOn);\n        });\n    }\n    if (enabledProperties.startIndex) {\n        const listStartCommand = editor.commands.get('listStart');\n        listPropertiesView.startIndexFieldView.bind('isEnabled').to(listStartCommand);\n        listPropertiesView.startIndexFieldView.fieldView.bind('value').to(listStartCommand);\n        listPropertiesView.on('listStart', (evt, data) => editor.execute('listStart', data));\n    }\n    if (enabledProperties.reversed) {\n        const listReversedCommand = editor.commands.get('listReversed');\n        listPropertiesView.reversedSwitchButtonView.bind('isEnabled').to(listReversedCommand);\n        listPropertiesView.reversedSwitchButtonView.bind('isOn').to(listReversedCommand, 'value', value => !!value);\n        listPropertiesView.on('listReversed', () => {\n            const isReversed = listReversedCommand.value;\n            editor.execute('listReversed', { reversed: !isReversed });\n        });\n    }\n    // Make sure applying styles closes the dropdown.\n    listPropertiesView.delegate('execute').to(dropdownView);\n    return listPropertiesView;\n}\n/**\n * A helper that creates the list style submenu for menu bar.\n *\n * @param editor Editor instance.\n * @param normalizedConfig List properties configuration.\n * @param parentCommandName Name of the list command.\n * @param buttonLabel Label of the menu button.\n * @param styleGridAriaLabel ARIA label of the styles grid.\n */\nfunction getMenuBarStylesMenuCreator({ editor, normalizedConfig, parentCommandName, buttonLabel, styleGridAriaLabel, styleDefinitions }) {\n    return (locale) => {\n        const menuView = new MenuBarMenuView(locale);\n        const listCommand = editor.commands.get(parentCommandName);\n        const listStyleCommand = editor.commands.get('listStyle');\n        const isStyleTypeSupported = getStyleTypeSupportChecker(listStyleCommand);\n        const styleButtonCreator = getStyleButtonCreator({\n            editor,\n            parentCommandName,\n            listStyleCommand\n        });\n        const configuredListStylesTypes = normalizedConfig.styles.listStyleTypes;\n        let filteredDefinitions = styleDefinitions;\n        if (configuredListStylesTypes) {\n            const listType = listCommand.type;\n            const allowedTypes = configuredListStylesTypes[listType];\n            if (allowedTypes) {\n                filteredDefinitions = styleDefinitions.filter(def => allowedTypes.includes(def.type));\n            }\n        }\n        const styleButtonViews = filteredDefinitions.filter(isStyleTypeSupported).map(styleButtonCreator);\n        const listPropertiesView = new ListPropertiesView(locale, {\n            styleGridAriaLabel,\n            enabledProperties: {\n                ...normalizedConfig,\n                // Disable list start index and reversed in the menu bar.\n                startIndex: false,\n                reversed: false\n            },\n            styleButtonViews\n        });\n        listPropertiesView.delegate('execute').to(menuView);\n        menuView.buttonView.set({\n            label: buttonLabel,\n            icon: parentCommandName === 'bulletedList' ? IconBulletedList : IconNumberedList\n        });\n        menuView.panelView.children.add(listPropertiesView);\n        menuView.bind('isEnabled').to(listCommand, 'isEnabled');\n        menuView.on('execute', () => {\n            editor.editing.view.focus();\n        });\n        return menuView;\n    };\n}\nfunction getStyleTypeSupportChecker(listStyleCommand) {\n    if (typeof listStyleCommand.isStyleTypeSupported == 'function') {\n        return (styleDefinition) => listStyleCommand.isStyleTypeSupported(styleDefinition.type);\n    }\n    else {\n        return () => true;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M14 27v6H8v-6zm0-9v6H8v-6zm0-9v6H8V9z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M10.29 15V8.531H9.286q-.21.59-.778 1.03-.567.442-1.05.6v1.121a4.3 4.3 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15zM11.3 24v-1.147H8.848q.096-.167.252-.343.156-.175.74-.712.585-.536.81-.821.338-.431.494-.824.156-.394.156-.829 0-.765-.545-1.279t-1.499-.514q-.87 0-1.45.444t-.69 1.463l1.23.124q.036-.54.264-.774.23-.233.616-.233.39 0 .613.222t.222.635q0 .374-.255.756-.19.277-1.024 1.055-1.038.962-1.389 1.544T6.971 24zm2.333 0v-1.235h-1.235V24zM9.204 34.11q.922 0 1.542-.598.62-.597.62-1.446 0-.585-.332-.997a1.5 1.5 0 0 0-.886-.532q.928-.505.928-1.353 0-.598-.453-1.073-.549-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.6 1.6 0 0 0-.668.55q-.24.349-.358.933l1.138.194q.048-.422.272-.642t.54-.22q.322 0 .515.194c.193.194.193.302.193.518q0 .383-.263.613-.263.231-.765.218l-.136 1.006q.33-.092.567-.092.36 0 .61.272.251.273.251.739 0 .492-.261.782a.83.83 0 0 1-.644.29.84.84 0 0 1-.607-.242q-.251-.241-.307-.698l-1.196.145q.093.813.668 1.316t1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M5.714 15.11q.935 0 1.46-.66.632-.799.632-2.627 0-1.832-.629-2.624-.527-.668-1.463-.668t-1.459.66q-.633.8-.633 2.619 0 1.854.576 2.577.577.723 1.516.723m0-1.024a.6.6 0 0 1-.398-.14q-.173-.141-.287-.565-.115-.424-.115-1.558c0-1.134.043-1.294.128-1.613q.096-.37.272-.512a.62.62 0 0 1 .4-.143.6.6 0 0 1 .398.143q.173.143.288.567t.114 1.558c0 1.134-.043 1.292-.128 1.608q-.096.37-.272.512a.62.62 0 0 1-.4.143m6.078.914V8.531H10.79q-.21.59-.778 1.03-.567.442-1.05.6v1.121a4.3 4.3 0 0 0 1.595-.936V15zm3.344 0v-1.235h-1.235V15zm-9.422 9.11q.935 0 1.46-.66.632-.799.632-2.627 0-1.833-.629-2.624-.527-.668-1.463-.668t-1.459.66q-.633.8-.633 2.619 0 1.854.576 2.577.577.723 1.516.723m0-1.024a.6.6 0 0 1-.398-.14q-.173-.142-.287-.565-.115-.424-.115-1.558c0-1.134.043-1.294.128-1.613q.096-.37.272-.512a.62.62 0 0 1 .4-.143.6.6 0 0 1 .398.143q.173.142.288.567t.114 1.558c0 1.134-.043 1.292-.128 1.608q-.096.37-.272.512a.62.62 0 0 1-.4.143m7.088.914v-1.147H10.35q.097-.167.253-.343.155-.175.74-.712t.81-.821q.338-.431.493-.824.156-.394.156-.829 0-.765-.544-1.279-.546-.514-1.499-.514-.87 0-1.45.444t-.69 1.463l1.23.124q.036-.54.264-.774t.615-.233q.391 0 .613.222t.222.635q0 .374-.255.756-.189.277-1.024 1.055-1.037.962-1.388 1.544-.352.583-.422 1.233zm2.334 0v-1.235h-1.235V24zM5.714 34.11q.935 0 1.46-.66.632-.799.632-2.627 0-1.832-.629-2.624-.527-.668-1.463-.668t-1.459.66q-.633.8-.633 2.619 0 1.854.576 2.577.577.723 1.516.723m0-1.024a.6.6 0 0 1-.398-.14q-.173-.142-.287-.565-.115-.424-.115-1.558c0-1.134.043-1.294.128-1.613q.096-.37.272-.512a.62.62 0 0 1 .4-.143.6.6 0 0 1 .398.143q.173.142.288.567t.114 1.558c0 1.134-.043 1.292-.128 1.608q-.096.37-.272.512a.62.62 0 0 1-.4.143m4.992 1.024q.924 0 1.543-.598.62-.597.62-1.446 0-.585-.332-.997a1.5 1.5 0 0 0-.886-.532q.927-.505.927-1.353 0-.598-.452-1.073-.55-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.6 1.6 0 0 0-.667.55q-.24.349-.359.933l1.139.194q.048-.422.272-.642t.54-.22q.321 0 .515.194c.194.194.193.302.193.518q0 .383-.264.613-.263.231-.764.218l-.136 1.006q.33-.092.566-.092.36 0 .611.272.25.273.25.739 0 .492-.26.782a.83.83 0 0 1-.644.29.84.84 0 0 1-.607-.242q-.25-.241-.308-.698l-1.195.145q.093.813.668 1.316t1.45.503m4.43-.11v-1.235h-1.235V34z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M11.88 8.7V7.558h-1.234V8.7zm0 5.3V9.333h-1.234V14zm2.5 0v-1.235h-1.234V14zm-4.75 4.7v-1.142H8.395V18.7zm0 5.3v-4.667H8.395V24zm2.5-5.3v-1.142h-1.234V18.7zm0 5.3v-4.667h-1.234V24zm2.501 0v-1.235h-1.235V24zM7.38 28.7v-1.142H6.145V28.7zm0 5.3v-4.667H6.145V34zm2.5-5.3v-1.142H8.646V28.7zm0 5.3v-4.667H8.646V34zm2.5-5.3v-1.142h-1.234V28.7zm0 5.3v-4.667h-1.234V34zm2.501 0v-1.235h-1.235V34z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M11.916 15V8.558h-1.301V15zm2.465 0v-1.235h-1.235V15zM9.665 25v-6.442h-1.3V25zm2.5 0v-6.442h-1.3V25zm2.466 0v-1.235h-1.235V25zm-7.216 9v-6.442h-1.3V34zm2.5 0v-6.442h-1.3V34zm2.501 0v-6.442h-1.3V34zm2.465 0v-1.235h-1.235V34z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"M9.62 14.105q.408 0 .768-.153c.36-.153.466-.257.677-.462q.013.036.044.145.07.242.119.365h1.221a2.7 2.7 0 0 1-.222-.626q-.06-.293-.059-.908l.013-1.441q0-.804-.165-1.105-.165-.302-.569-.497-.405-.195-1.23-.195-.91 0-1.371.325-.462.325-.65 1.002l1.12.202q.114-.326.299-.455.184-.13.514-.13.488 0 .663.152.176.151.176.508v.123q-.333.14-1.2.303-.641.123-.982.288t-.53.474a1.33 1.33 0 0 0-.188.706q0 .598.415.988.416.391 1.136.391zm.368-.87a.68.68 0 0 1-.492-.189.6.6 0 0 1-.193-.448q0-.263.241-.435.159-.105.673-.215a7 7 0 0 0 .751-.19v.247q0 .443-.048.602a.77.77 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14zM10.2 25.105q.813 0 1.382-.646.57-.645.57-1.84 0-1.156-.559-1.774a1.82 1.82 0 0 0-1.41-.617q-.783 0-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592q.39.2.79.2zm-.299-.975q-.531 0-.852-.492-.23-.348-.229-1.073 0-.703.295-1.048a.93.93 0 0 1 .738-.345q.453 0 .743.354t.29 1.154q0 .751-.288 1.1t-.697.35m4.478.87v-1.235h-1.234V25zm-4.017 9.105q.9 0 1.437-.426.536-.426.725-1.261l-1.213-.207q-.092.489-.316.688a.83.83 0 0 1-.576.2.92.92 0 0 1-.75-.343q-.278-.343-.278-1.173 0-.747.274-1.066.275-.318.736-.318.348 0 .565.184t.28.55l1.216-.22q-.22-.751-.722-1.119-.504-.366-1.356-.366-1.042 0-1.653.643-.61.645-.61 1.8 0 1.143.608 1.788.609.646 1.633.646M14.633 34v-1.235h-1.235V34z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 44 44\\\"><path fill-opacity=\\\".163\\\" d=\\\"M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z\\\"/><path d=\\\"m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15zM9.352 25q1.244-.009 1.569-.044.518-.057.872-.305.354-.249.558-.664t.205-.855q0-.558-.317-.97-.315-.414-.905-.585a1.5 1.5 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83q0-.419-.197-.754a1.65 1.65 0 0 0-.495-.539 1.7 1.7 0 0 0-.672-.266q-.375-.063-1.14-.063H7.158V25zm.142-3.88H8.46v-1.49h.747q.918 0 1.112.022.325.04.49.226.165.188.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 12 12 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05q.888 0 1.154.092.266.093.406.295a.84.84 0 0 1 .14.492q0 .342-.181.547a.8.8 0 0 1-.473.257q-.189.04-.892.04M14.88 25v-1.235h-1.234V25zm-5.018 9.11q1.037 0 1.711-.512t.965-1.567l-1.261-.4q-.163.708-.536 1.037-.375.33-.892.33-.704 0-1.143-.519-.44-.518-.44-1.74 0-1.15.447-1.665.445-.514 1.162-.514.52 0 .881.29.362.29.477.79l1.288-.307q-.22-.774-.66-1.187-.738-.698-1.92-.698-1.353 0-2.184.89-.83.89-.83 2.498 0 1.521.825 2.397.826.877 2.11.877M14.88 34v-1.235h-1.234V34z\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m12.5 0 5 4.5v15.003h-16V0zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692z\\\"/><path d=\\\"M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module source-editing/sourceediting\n */\nimport { Plugin, PendingActions } from 'ckeditor5/src/core.js';\nimport { IconSource } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { CKEditorError, createElement, ElementReplacer, formatHtml } from 'ckeditor5/src/utils.js';\nimport '../theme/sourceediting.css';\nconst COMMAND_FORCE_DISABLE_ID = 'SourceEditingMode';\n/**\n * The source editing feature.\n *\n * It provides the possibility to view and edit the source of the document.\n *\n * For a detailed overview, check the {@glink features/source-editing/source-editing source editing feature documentation} and the\n * {@glink api/source-editing package page}.\n */\nexport class SourceEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SourceEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [PendingActions];\n    }\n    /**\n     * The element replacer instance used to replace the editing roots with the wrapper elements containing the document source.\n     */\n    _elementReplacer;\n    /**\n     * Maps all root names to wrapper elements containing the document source.\n     */\n    _replacedRoots;\n    /**\n     * Maps all root names to their document data.\n     */\n    _dataFromRoots;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this.set('isSourceEditingMode', false);\n        this._elementReplacer = new ElementReplacer();\n        this._replacedRoots = new Map();\n        this._dataFromRoots = new Map();\n        editor.config.define('sourceEditing.allowCollaborationFeatures', false);\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this._checkCompatibility();\n        const editor = this.editor;\n        const t = editor.locale.t;\n        editor.ui.componentFactory.add('sourceEditing', () => {\n            const buttonView = this._createButton(ButtonView);\n            buttonView.set({\n                label: t('Source'),\n                icon: IconSource,\n                tooltip: true,\n                class: 'ck-source-editing-button'\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:sourceEditing', () => {\n            const buttonView = this._createButton(MenuBarMenuListItemButtonView);\n            buttonView.set({\n                label: t('Show source'),\n                role: 'menuitemcheckbox'\n            });\n            return buttonView;\n        });\n        // Currently, the plugin handles the source editing mode by itself only for the classic editor. To use this plugin with other\n        // integrations, listen to the `change:isSourceEditingMode` event and act accordingly.\n        if (this._isAllowedToHandleSourceEditingMode()) {\n            this.on('change:isSourceEditingMode', (evt, name, isSourceEditingMode) => {\n                if (isSourceEditingMode) {\n                    this._hideVisibleDialog();\n                    this._showSourceEditing();\n                    this._disableCommands();\n                }\n                else {\n                    this._hideSourceEditing();\n                    this._enableCommands();\n                }\n            });\n            this.on('change:isEnabled', (evt, name, isEnabled) => this._handleReadOnlyMode(!isEnabled));\n            this.listenTo(editor, 'change:isReadOnly', (evt, name, isReadOnly) => this._handleReadOnlyMode(isReadOnly));\n        }\n        // Update the editor data while calling editor.getData() in the source editing mode.\n        editor.data.on('get', () => {\n            if (this.isSourceEditingMode) {\n                this.updateEditorData();\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * Updates the source data in all hidden editing roots.\n     */\n    updateEditorData() {\n        const editor = this.editor;\n        const data = {};\n        for (const [rootName, domSourceEditingElementWrapper] of this._replacedRoots) {\n            const oldData = this._dataFromRoots.get(rootName);\n            const newData = domSourceEditingElementWrapper.dataset.value;\n            // Do not set the data unless some changes have been made in the meantime.\n            // This prevents empty undo steps after switching to the normal editor.\n            if (oldData !== newData) {\n                data[rootName] = newData;\n                this._dataFromRoots.set(rootName, newData);\n            }\n        }\n        if (Object.keys(data).length) {\n            editor.data.set(data, { batchType: { isUndoable: true }, suppressErrorInCollaboration: true });\n        }\n    }\n    _checkCompatibility() {\n        const editor = this.editor;\n        const allowCollaboration = editor.config.get('sourceEditing.allowCollaborationFeatures');\n        if (!allowCollaboration && editor.plugins.has('RealTimeCollaborativeEditing')) {\n            /**\n             * Source editing feature is not fully compatible with real-time collaboration,\n             * and using it may lead to data loss. Please read\n             * {@glink features/source-editing/source-editing#limitations-and-incompatibilities source editing feature guide} to learn more.\n             *\n             * If you understand the possible risk of data loss, you can enable the source editing\n             * by setting the\n             * {@link module:source-editing/sourceeditingconfig~SourceEditingConfig#allowCollaborationFeatures}\n             * configuration flag to `true`.\n             *\n             * @error source-editing-incompatible-with-real-time-collaboration\n             */\n            throw new CKEditorError('source-editing-incompatible-with-real-time-collaboration', null);\n        }\n        const collaborationPluginNamesToWarn = [\n            'CommentsEditing',\n            'TrackChangesEditing',\n            'RevisionHistory'\n        ];\n        // Currently, the basic integration with Collaboration Features is to display a warning in the console.\n        //\n        // If `allowCollaboration` flag is set, do not show these warnings. If the flag is set, we assume that the integrator read\n        // appropriate section of the guide so there's no use to spam the console with warnings.\n        //\n        if (!allowCollaboration && collaborationPluginNamesToWarn.some(pluginName => editor.plugins.has(pluginName))) {\n            console.warn('You initialized the editor with the source editing feature and at least one of the collaboration features. ' +\n                'Please be advised that the source editing feature may not work, and be careful when editing document source ' +\n                'that contains markers created by the collaboration features.');\n        }\n        // Restricted Editing integration can also lead to problems. Warn the user accordingly.\n        if (editor.plugins.has('RestrictedEditingModeEditing')) {\n            console.warn('You initialized the editor with the source editing feature and restricted editing feature. ' +\n                'Please be advised that the source editing feature may not work, and be careful when editing document source ' +\n                'that contains markers created by the restricted editing feature.');\n        }\n    }\n    /**\n     * Creates source editing wrappers that replace each editing root. Each wrapper contains the document source from the corresponding\n     * root.\n     *\n     * The wrapper element contains a textarea and it solves the problem, that the textarea element cannot auto expand its height based on\n     * the content it contains. The solution is to make the textarea more like a plain div element, which expands in height as much as it\n     * needs to, in order to display the whole document source without scrolling. The wrapper element is a parent for the textarea and for\n     * the pseudo-element `::after`, that replicates the look, content, and position of the textarea. The pseudo-element replica is hidden,\n     * but it is styled to be an identical visual copy of the textarea with the same content. Then, the wrapper is a grid container and both\n     * of its children (the textarea and the `::after` pseudo-element) are positioned within a CSS grid to occupy the same grid cell. The\n     * content in the pseudo-element `::after` is set in CSS and it stretches the grid to the appropriate size based on the textarea value.\n     * Since both children occupy the same grid cell, both have always the same height.\n     */\n    _showSourceEditing() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const model = editor.model;\n        model.change(writer => {\n            writer.setSelection(null);\n            writer.removeSelectionAttribute(model.document.selection.getAttributeKeys());\n        });\n        // It is not needed to iterate through all editing roots, as currently the plugin supports only the Classic Editor with a single\n        // main root, but this code may help understand and use this feature in external integrations.\n        for (const [rootName, domRootElement] of editingView.domRoots) {\n            const data = formatSource(editor.data.get({ rootName }));\n            const domSourceEditingElementTextarea = createElement(domRootElement.ownerDocument, 'textarea', {\n                rows: '1',\n                'aria-label': 'Source code editing area'\n            });\n            const domSourceEditingElementWrapper = createElement(domRootElement.ownerDocument, 'div', {\n                class: 'ck-source-editing-area',\n                'data-value': data\n            }, [domSourceEditingElementTextarea]);\n            domSourceEditingElementTextarea.value = data;\n            // Setting a value to textarea moves the input cursor to the end. We want the selection at the beginning.\n            domSourceEditingElementTextarea.setSelectionRange(0, 0);\n            // Bind the textarea's value to the wrapper's `data-value` property. Each change of the textarea's value updates the\n            // wrapper's `data-value` property.\n            domSourceEditingElementTextarea.addEventListener('input', () => {\n                domSourceEditingElementWrapper.dataset.value = domSourceEditingElementTextarea.value;\n                editor.ui.update();\n            });\n            editingView.change(writer => {\n                const viewRoot = editingView.document.getRoot(rootName);\n                writer.addClass('ck-hidden', viewRoot);\n            });\n            // Register the element so it becomes available for Alt+F10 and Esc navigation.\n            editor.ui.setEditableElement('sourceEditing:' + rootName, domSourceEditingElementTextarea);\n            this._replacedRoots.set(rootName, domSourceEditingElementWrapper);\n            this._elementReplacer.replace(domRootElement, domSourceEditingElementWrapper);\n            this._dataFromRoots.set(rootName, data);\n        }\n        this._hideDocumentOutline();\n        this._refreshAnnotationsVisibility();\n        this._focusSourceEditing();\n    }\n    /**\n     * Restores all hidden editing roots and sets the source data in them.\n     */\n    _hideSourceEditing() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        this.updateEditorData();\n        editingView.change(writer => {\n            for (const [rootName] of this._replacedRoots) {\n                writer.removeClass('ck-hidden', editingView.document.getRoot(rootName));\n            }\n        });\n        this._elementReplacer.restore();\n        this._replacedRoots.clear();\n        this._dataFromRoots.clear();\n        this._showDocumentOutline();\n        this._refreshAnnotationsVisibility();\n        editingView.focus();\n    }\n    /**\n     * Hides the document outline if it is configured.\n     */\n    _hideDocumentOutline() {\n        if (this.editor.plugins.has('DocumentOutlineUI')) {\n            this.editor.plugins.get('DocumentOutlineUI').view.element.style.display = 'none';\n        }\n    }\n    /**\n     * Shows the document outline if it was hidden when entering the source editing.\n     */\n    _showDocumentOutline() {\n        if (this.editor.plugins.has('DocumentOutlineUI')) {\n            this.editor.plugins.get('DocumentOutlineUI').view.element.style.display = '';\n        }\n    }\n    /**\n     * Hides the annotations when entering the source editing mode and shows back them after leaving it.\n     */\n    _refreshAnnotationsVisibility() {\n        if (this.editor.plugins.has('Annotations')) {\n            this.editor.plugins.get('Annotations').refreshVisibility();\n        }\n    }\n    /**\n     * Focuses the textarea containing document source from the first editing root.\n     */\n    _focusSourceEditing() {\n        const editor = this.editor;\n        const [domSourceEditingElementWrapper] = this._replacedRoots.values();\n        const textarea = domSourceEditingElementWrapper.querySelector('textarea');\n        // The FocusObserver was disabled by View.render() while the DOM root was getting hidden and the replacer\n        // revealed the textarea. So it couldn't notice that the DOM root got blurred in the process.\n        // Let's sync this state manually here because otherwise Renderer will attempt to render selection\n        // in an invisible DOM root.\n        editor.editing.view.document.isFocused = false;\n        textarea.focus();\n    }\n    /**\n     * Disables all commands.\n     */\n    _disableCommands() {\n        const editor = this.editor;\n        for (const command of editor.commands.commands()) {\n            command.forceDisabled(COMMAND_FORCE_DISABLE_ID);\n        }\n        // Comments archive UI plugin will be disabled manually too.\n        if (editor.plugins.has('CommentsArchiveUI')) {\n            editor.plugins.get('CommentsArchiveUI').forceDisabled(COMMAND_FORCE_DISABLE_ID);\n        }\n    }\n    /**\n     * Clears forced disable for all commands, that was previously set through {@link #_disableCommands}.\n     */\n    _enableCommands() {\n        const editor = this.editor;\n        for (const command of editor.commands.commands()) {\n            command.clearForceDisabled(COMMAND_FORCE_DISABLE_ID);\n        }\n        // Comments archive UI plugin will be enabled manually too.\n        if (editor.plugins.has('CommentsArchiveUI')) {\n            editor.plugins.get('CommentsArchiveUI').clearForceDisabled(COMMAND_FORCE_DISABLE_ID);\n        }\n    }\n    /**\n     * Adds or removes the `readonly` attribute from the textarea from all roots, if document source mode is active.\n     *\n     * @param isReadOnly Indicates whether all textarea elements should be read-only.\n     */\n    _handleReadOnlyMode(isReadOnly) {\n        if (!this.isSourceEditingMode) {\n            return;\n        }\n        for (const [, domSourceEditingElementWrapper] of this._replacedRoots) {\n            domSourceEditingElementWrapper.querySelector('textarea').readOnly = isReadOnly;\n        }\n    }\n    /**\n     * Checks, if the plugin is allowed to handle the source editing mode by itself. Currently, the source editing mode is supported only\n     * for the {@link module:editor-classic/classiceditor~ClassicEditor classic editor}.\n     */\n    _isAllowedToHandleSourceEditingMode() {\n        const editor = this.editor;\n        const editable = editor.ui.view.editable;\n        // Checks, if the editor's editable belongs to the editor's DOM tree.\n        return editable && !editable.hasExternalElement;\n    }\n    /**\n     * If any {@link module:ui/dialog/dialogview~DialogView editor dialog} is currently visible, hide it.\n     */\n    _hideVisibleDialog() {\n        if (this.editor.plugins.has('Dialog')) {\n            const dialogPlugin = this.editor.plugins.get('Dialog');\n            if (dialogPlugin.isOpen) {\n                dialogPlugin.hide();\n            }\n        }\n    }\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const buttonView = new ButtonClass(editor.locale);\n        buttonView.set({\n            withText: true,\n            isToggleable: true\n        });\n        buttonView.bind('isOn').to(this, 'isSourceEditingMode');\n        // The button should be disabled if one of the following conditions is met:\n        buttonView.bind('isEnabled').to(this, 'isEnabled', editor, 'isReadOnly', editor.plugins.get(PendingActions), 'hasAny', (isEnabled, isEditorReadOnly, hasAnyPendingActions) => {\n            // (1) The plugin itself is disabled.\n            if (!isEnabled) {\n                return false;\n            }\n            // (2) The editor is in read-only mode.\n            if (isEditorReadOnly) {\n                return false;\n            }\n            // (3) Any pending action is scheduled. It may change the model, so modifying the document source should be prevented\n            // until the model is finally set.\n            if (hasAnyPendingActions) {\n                return false;\n            }\n            return true;\n        });\n        this.listenTo(buttonView, 'execute', () => {\n            this.isSourceEditingMode = !this.isSourceEditingMode;\n        });\n        return buttonView;\n    }\n}\n/**\n * Formats the content for a better readability.\n *\n * For a non-HTML source the unchanged input string is returned.\n *\n * @param input Input string to check.\n */\nfunction formatSource(input) {\n    if (!isHtml(input)) {\n        return input;\n    }\n    return formatHtml(input);\n}\n/**\n * Checks, if the document source is HTML. It is sufficient to just check the first character from the document data.\n *\n * @param input Input string to check.\n */\nfunction isHtml(input) {\n    return input.startsWith('<');\n}\n","const CASE_SPLIT_PATTERN = /\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+/gu;\nfunction words(str) {\n    return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n\nexport { CASE_SPLIT_PATTERN, words };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { startCase, cloneDeep } from 'es-toolkit/compat';\n/**\n* Helper function for the downcast converter. Updates attributes on the given view element.\n*\n* @param writer The view writer.\n* @param oldViewAttributes The previous GHS attribute value.\n* @param newViewAttributes The current GHS attribute value.\n* @param viewElement The view element to update.\n* @internal\n*/\nexport function updateViewAttributes(writer, oldViewAttributes, newViewAttributes, viewElement) {\n    if (oldViewAttributes) {\n        removeViewAttributes(writer, oldViewAttributes, viewElement);\n    }\n    if (newViewAttributes) {\n        setViewAttributes(writer, newViewAttributes, viewElement);\n    }\n}\n/**\n * Helper function for the downcast converter. Sets attributes on the given view element.\n *\n * @param writer The view writer.\n * @param viewAttributes The GHS attribute value.\n * @param viewElement The view element to update.\n * @internal\n */\nexport function setViewAttributes(writer, viewAttributes, viewElement) {\n    if (viewAttributes.attributes) {\n        for (const [key, value] of Object.entries(viewAttributes.attributes)) {\n            writer.setAttribute(key, value, viewElement);\n        }\n    }\n    if (viewAttributes.styles) {\n        writer.setStyle(viewAttributes.styles, viewElement);\n    }\n    if (viewAttributes.classes) {\n        writer.addClass(viewAttributes.classes, viewElement);\n    }\n}\n/**\n * Helper function for the downcast converter. Removes attributes on the given view element.\n *\n * @param writer The view writer.\n * @param viewAttributes The GHS attribute value.\n * @param viewElement The view element to update.\n * @internal\n */\nexport function removeViewAttributes(writer, viewAttributes, viewElement) {\n    if (viewAttributes.attributes) {\n        for (const [key] of Object.entries(viewAttributes.attributes)) {\n            writer.removeAttribute(key, viewElement);\n        }\n    }\n    if (viewAttributes.styles) {\n        for (const style of Object.keys(viewAttributes.styles)) {\n            writer.removeStyle(style, viewElement);\n        }\n    }\n    if (viewAttributes.classes) {\n        writer.removeClass(viewAttributes.classes, viewElement);\n    }\n}\n/**\n* Merges view element attribute objects.\n*\n* @internal\n*/\nexport function mergeViewElementAttributes(target, source) {\n    const result = cloneDeep(target);\n    let key = 'attributes';\n    for (key in source) {\n        // Merge classes.\n        if (key == 'classes') {\n            result[key] = Array.from(new Set([...(target[key] || []), ...source[key]]));\n        }\n        // Merge attributes or styles.\n        else {\n            result[key] = { ...target[key], ...source[key] };\n        }\n    }\n    return result;\n}\nexport function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {\n    const oldValue = item.getAttribute(ghsAttributeName);\n    const newValue = {};\n    for (const kind of ['attributes', 'styles', 'classes']) {\n        // Properties other than `subject` should be assigned from `oldValue`.\n        if (kind != subject) {\n            if (oldValue && oldValue[kind]) {\n                newValue[kind] = oldValue[kind];\n            }\n            continue;\n        }\n        // `callback` should be applied on property [`subject`].\n        if (subject == 'classes') {\n            const values = new Set(oldValue && oldValue.classes || []);\n            callback(values);\n            if (values.size) {\n                newValue[kind] = Array.from(values);\n            }\n            continue;\n        }\n        const values = new Map(Object.entries(oldValue && oldValue[kind] || {}));\n        callback(values);\n        if (values.size) {\n            newValue[kind] = Object.fromEntries(values);\n        }\n    }\n    if (Object.keys(newValue).length) {\n        if (item.is('documentSelection')) {\n            writer.setSelectionAttribute(ghsAttributeName, newValue);\n        }\n        else {\n            writer.setAttribute(ghsAttributeName, newValue, item);\n        }\n    }\n    else if (oldValue) {\n        if (item.is('documentSelection')) {\n            writer.removeSelectionAttribute(ghsAttributeName);\n        }\n        else {\n            writer.removeAttribute(ghsAttributeName, item);\n        }\n    }\n}\n/**\n * Strips the `styles`, and `classes` keys from the GHS attribute value on the given item.\n *\n * @internal\n */\nexport function removeFormatting(ghsAttributeName, itemRange, writer) {\n    for (const item of itemRange.getItems({ shallow: true })) {\n        const value = item.getAttribute(ghsAttributeName);\n        // Copy only attributes to the new attribute value.\n        if (value && value.attributes && Object.keys(value.attributes).length) {\n            // But reset the GHS attribute only when there is anything more than just attributes.\n            if (Object.keys(value).length > 1) {\n                writer.setAttribute(ghsAttributeName, { attributes: value.attributes }, item);\n            }\n        }\n        else {\n            // There are no attributes, so remove the GHS attribute completely.\n            writer.removeAttribute(ghsAttributeName, item);\n        }\n    }\n}\n/**\n * Transforms passed string to PascalCase format. Examples:\n * * `div` => `Div`\n * * `h1` => `H1`\n * * `table` => `Table`\n *\n * @internal\n */\nexport function toPascalCase(data) {\n    return startCase(data).replace(/ /g, '');\n}\n/**\n * Returns the attribute name of the model element that holds raw HTML attributes.\n *\n * @internal\n */\nexport function getHtmlAttributeName(viewElementName) {\n    return `html${toPascalCase(viewElementName)}Attributes`;\n}\n","import { words } from '../../string/words.mjs';\nimport { normalizeForCase } from '../_internal/normalizeForCase.mjs';\n\nfunction startCase(str) {\n    const words$1 = words(normalizeForCase(str).trim());\n    let result = '';\n    for (let i = 0; i < words$1.length; i++) {\n        const word = words$1[i];\n        if (result) {\n            result += ' ';\n        }\n        if (word === word.toUpperCase()) {\n            result += word;\n        }\n        else {\n            result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n        }\n    }\n    return result;\n}\n\nexport { startCase };\n","import { toString } from '../util/toString.mjs';\n\nfunction normalizeForCase(str) {\n    if (typeof str !== 'string') {\n        str = toString(str);\n    }\n    return str.replace(/['\\u2019]/g, '');\n}\n\nexport { normalizeForCase };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { toWidget } from 'ckeditor5/src/widget.js';\nimport { setViewAttributes, mergeViewElementAttributes, updateViewAttributes, getHtmlAttributeName } from './utils.js';\n/**\n * View-to-model conversion helper for object elements.\n *\n * Preserves object element content in `htmlContent` attribute.\n *\n * @returns Returns a conversion callback.\n * @internal\n*/\nexport function viewToModelObjectConverter({ model: modelName }) {\n    return (viewElement, conversionApi) => {\n        // Let's keep element HTML and its attributes, so we can rebuild element in downcast conversions.\n        return conversionApi.writer.createElement(modelName, {\n            htmlContent: viewElement.getCustomProperty('$rawContent')\n        });\n    };\n}\n/**\n * Conversion helper converting an object element to an HTML object widget.\n *\n * @returns Returns a conversion callback.\n * @internal\n*/\nexport function toObjectWidgetConverter(editor, { view: viewName, isInline }) {\n    const t = editor.t;\n    return (modelElement, { writer }) => {\n        const widgetLabel = t('HTML object');\n        const viewElement = createObjectView(viewName, modelElement, writer);\n        const viewAttributes = modelElement.getAttribute(getHtmlAttributeName(viewName));\n        writer.addClass('html-object-embed__content', viewElement);\n        if (viewAttributes) {\n            setViewAttributes(writer, viewAttributes, viewElement);\n        }\n        // Widget cannot be a raw element because the widget system would not be able\n        // to add its UI to it. Thus, we need separate view container.\n        const viewContainer = writer.createContainerElement(isInline ? 'span' : 'div', {\n            class: 'html-object-embed',\n            'data-html-object-embed-label': widgetLabel\n        }, viewElement);\n        return toWidget(viewContainer, writer, { label: widgetLabel });\n    };\n}\n/**\n* Creates object view element from the given model element.\n*\n* @internal\n*/\nexport function createObjectView(viewName, modelElement, writer) {\n    return writer.createRawElement(viewName, null, (domElement, domConverter) => {\n        domConverter.setContentOf(domElement, modelElement.getAttribute('htmlContent'));\n    });\n}\n/**\n * View-to-attribute conversion helper preserving inline element attributes on `$text`.\n *\n * @returns Returns a conversion callback.\n * @internal\n*/\nexport function viewToAttributeInlineConverter({ view: viewName, model: attributeKey, allowEmpty }, dataFilter) {\n    return dispatcher => {\n        dispatcher.on(`element:${viewName}`, (evt, data, conversionApi) => {\n            let viewAttributes = dataFilter.processViewAttributes(data.viewItem, conversionApi);\n            // Do not apply the attribute if the element itself is already consumed and there are no view attributes to store.\n            if (!viewAttributes && !conversionApi.consumable.test(data.viewItem, { name: true })) {\n                return;\n            }\n            // Otherwise, we might need to convert it to an empty object just to preserve element itself,\n            // for example `<cite>` => <$text htmlCite=\"{}\">.\n            viewAttributes = viewAttributes || {};\n            // Consume the element itself if it wasn't consumed by any other converter.\n            conversionApi.consumable.consume(data.viewItem, { name: true });\n            // Since we are converting to attribute we need a range on which we will set the attribute.\n            // If the range is not created yet, we will create it.\n            if (!data.modelRange) {\n                data = Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));\n            }\n            // Convert empty inline element if allowed and has any attributes.\n            if (allowEmpty && data.modelRange.isCollapsed && Object.keys(viewAttributes).length) {\n                const modelElement = conversionApi.writer.createElement('htmlEmptyElement');\n                if (!conversionApi.safeInsert(modelElement, data.modelCursor)) {\n                    return;\n                }\n                const parts = conversionApi.getSplitParts(modelElement);\n                data.modelRange = conversionApi.writer.createRange(data.modelRange.start, conversionApi.writer.createPositionAfter(parts[parts.length - 1]));\n                conversionApi.updateConversionResult(modelElement, data);\n                setAttributeOnItem(modelElement, viewAttributes, conversionApi);\n                return;\n            }\n            // Set attribute on each item in range according to the schema.\n            for (const node of data.modelRange.getItems()) {\n                setAttributeOnItem(node, viewAttributes, conversionApi);\n            }\n        }, { priority: 'low' });\n    };\n    function setAttributeOnItem(node, viewAttributes, conversionApi) {\n        if (conversionApi.schema.checkAttribute(node, attributeKey)) {\n            // Node's children are converted recursively, so node can already include model attribute.\n            // We want to extend it, not replace.\n            const nodeAttributes = node.getAttribute(attributeKey);\n            const attributesToAdd = mergeViewElementAttributes(viewAttributes, nodeAttributes || {});\n            conversionApi.writer.setAttribute(attributeKey, attributesToAdd, node);\n        }\n    }\n}\n/**\n * Conversion helper converting an empty inline model element to an HTML element or widget.\n *\n * @internal\n */\nexport function emptyInlineModelElementToViewConverter({ model: attributeKey, view: viewName }, asWidget) {\n    return (item, { writer, consumable }) => {\n        if (!item.hasAttribute(attributeKey)) {\n            return null;\n        }\n        const viewElement = writer.createContainerElement(viewName);\n        const attributeValue = item.getAttribute(attributeKey);\n        consumable.consume(item, `attribute:${attributeKey}`);\n        setViewAttributes(writer, attributeValue, viewElement);\n        viewElement.getFillerOffset = () => null;\n        return asWidget ? toWidget(viewElement, writer) : viewElement;\n    };\n}\n/**\n * Attribute-to-view conversion helper applying attributes to view element preserved on `$text`.\n *\n * @returns Returns a conversion callback.\n * @internal\n*/\nexport function attributeToViewInlineConverter({ priority, view: viewName }) {\n    return (attributeValue, conversionApi) => {\n        if (!attributeValue) {\n            return;\n        }\n        const { writer } = conversionApi;\n        const viewElement = writer.createAttributeElement(viewName, null, { priority });\n        setViewAttributes(writer, attributeValue, viewElement);\n        return viewElement;\n    };\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on block element.\n *\n * All matched attributes will be preserved on `html*Attributes` attribute.\n *\n * @returns Returns a conversion callback.\n * @internal\n*/\nexport function viewToModelBlockAttributeConverter({ view: viewName }, dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on(`element:${viewName}`, (evt, data, conversionApi) => {\n            // Converting an attribute of an element that has not been converted to anything does not make sense\n            // because there will be nowhere to set that attribute on. At this stage, the element should've already\n            // been converted. A collapsed range can show up in to-do lists (<input>) or complex widgets (e.g. table).\n            // (https://github.com/ckeditor/ckeditor5/issues/11000).\n            if (!data.modelRange || data.modelRange.isCollapsed) {\n                return;\n            }\n            const viewAttributes = dataFilter.processViewAttributes(data.viewItem, conversionApi);\n            if (!viewAttributes) {\n                return;\n            }\n            conversionApi.writer.setAttribute(getHtmlAttributeName(data.viewItem.name), viewAttributes, data.modelRange);\n        }, { priority: 'low' });\n    };\n}\n/**\n * Model-to-view conversion helper applying attributes preserved in `html*Attributes` attribute\n * for block elements.\n *\n * @returns Returns a conversion callback.\n * @internal\n*/\nexport function modelToViewBlockAttributeConverter({ view: viewName, model: modelName }) {\n    return (dispatcher) => {\n        dispatcher.on(`attribute:${getHtmlAttributeName(viewName)}:${modelName}`, (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                return;\n            }\n            const { attributeOldValue, attributeNewValue } = data;\n            const viewWriter = conversionApi.writer;\n            const viewElement = conversionApi.mapper.toViewElement(data.item);\n            updateViewAttributes(viewWriter, attributeOldValue, attributeNewValue, viewElement);\n        });\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/schemadefinitions\n */\n/**\n * Skipped elements due to HTML deprecation:\n * * noframes (not sure if we should provide support for this element. CKE4 is not supporting frameset and frame,\n *   but it will unpack <frameset><noframes>foobar</noframes></frameset> to <noframes>foobar</noframes>, so there\n *   may be some content loss. Although using noframes as a standalone element seems invalid)\n * * keygen (this one is also empty)\n * * applet (support is limited mostly to old IE)\n * * basefont (this one is also empty)\n * * isindex (basically no support for modern browsers at all)\n *\n * Skipped elements due to lack empty element support:\n * * hr\n * * area\n * * br\n * * command\n * * map\n * * wbr\n * * colgroup -> col\n *\n * Skipped elements due to complexity:\n * * datalist with option elements used as a data source for input[list] element\n *\n * Skipped elements as they are handled as an object content:\n * * track\n * * source\n * * option\n * * param\n * * optgroup\n *\n * Skipped full page HTML elements:\n * * body\n * * html\n * * title\n * * head\n * * meta\n * * link\n * * etc...\n *\n * Skipped hidden elements:\n * noscript\n *\n * When adding elements to this list, update the feature guide listing, too.\n *\n * @internal\n */\nexport const defaultConfig = {\n    block: [\n        // Existing features.\n        {\n            model: 'codeBlock',\n            view: 'pre'\n        },\n        {\n            model: 'paragraph',\n            view: 'p'\n        },\n        {\n            model: 'blockQuote',\n            view: 'blockquote'\n        },\n        {\n            model: 'listItem',\n            view: 'li'\n        },\n        {\n            model: 'pageBreak',\n            view: 'div'\n        },\n        {\n            model: 'rawHtml',\n            view: 'div'\n        },\n        {\n            model: 'table',\n            view: 'table'\n        },\n        {\n            model: 'tableRow',\n            view: 'tr'\n        },\n        {\n            model: 'tableCell',\n            view: 'td'\n        },\n        {\n            model: 'tableCell',\n            view: 'th'\n        },\n        {\n            model: 'tableColumnGroup',\n            view: 'colgroup'\n        },\n        {\n            model: 'tableColumn',\n            view: 'col'\n        },\n        {\n            model: 'caption',\n            view: 'caption'\n        },\n        {\n            model: 'caption',\n            view: 'figcaption'\n        },\n        {\n            model: 'imageBlock',\n            view: 'img'\n        },\n        {\n            model: 'imageInline',\n            view: 'img'\n        },\n        {\n            model: 'horizontalLine',\n            view: 'hr'\n        },\n        // Compatibility features.\n        {\n            model: 'htmlP',\n            view: 'p',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlBlockquote',\n            view: 'blockquote',\n            modelSchema: {\n                inheritAllFrom: '$container'\n            }\n        },\n        {\n            model: 'htmlTable',\n            view: 'table',\n            modelSchema: {\n                allowWhere: '$block',\n                isBlock: true\n            }\n        },\n        {\n            model: 'htmlTbody',\n            view: 'tbody',\n            modelSchema: {\n                allowIn: 'htmlTable',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlThead',\n            view: 'thead',\n            modelSchema: {\n                allowIn: 'htmlTable',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlTfoot',\n            view: 'tfoot',\n            modelSchema: {\n                allowIn: 'htmlTable',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlCaption',\n            view: 'caption',\n            modelSchema: {\n                allowIn: 'htmlTable',\n                allowChildren: '$text',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlColgroup',\n            view: 'colgroup',\n            modelSchema: {\n                allowIn: 'htmlTable',\n                allowChildren: 'col',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlCol',\n            view: 'col',\n            modelSchema: {\n                allowIn: 'htmlColgroup',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlTr',\n            view: 'tr',\n            modelSchema: {\n                allowIn: ['htmlTable', 'htmlThead', 'htmlTbody'],\n                isLimit: true\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlTd',\n            view: 'td',\n            modelSchema: {\n                allowIn: 'htmlTr',\n                allowContentOf: '$container',\n                isLimit: true,\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlTh',\n            view: 'th',\n            modelSchema: {\n                allowIn: 'htmlTr',\n                allowContentOf: '$container',\n                isLimit: true,\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlFigure',\n            view: 'figure',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include other block elements.\n        {\n            model: 'htmlFigcaption',\n            view: 'figcaption',\n            modelSchema: {\n                allowIn: 'htmlFigure',\n                allowChildren: '$text',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlAddress',\n            view: 'address',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlAside',\n            view: 'aside',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlMain',\n            view: 'main',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlDetails',\n            view: 'details',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlSummary',\n            view: 'summary',\n            modelSchema: {\n                allowChildren: [\n                    'htmlH1',\n                    'htmlH2',\n                    'htmlH3',\n                    'htmlH4',\n                    'htmlH5',\n                    'htmlH6',\n                    '$text'\n                ],\n                allowIn: 'htmlDetails',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlDiv',\n            view: 'div',\n            paragraphLikeModel: 'htmlDivParagraph',\n            modelSchema: {\n                inheritAllFrom: '$container'\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlFieldset',\n            view: 'fieldset',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include h1-h6.\n        {\n            model: 'htmlLegend',\n            view: 'legend',\n            modelSchema: {\n                allowIn: 'htmlFieldset',\n                allowChildren: '$text'\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlHeader',\n            view: 'header',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlFooter',\n            view: 'footer',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlForm',\n            view: 'form',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: true\n            }\n        },\n        {\n            model: 'htmlHgroup',\n            view: 'hgroup',\n            modelSchema: {\n                allowIn: ['$root', '$container'],\n                allowChildren: [\n                    'paragraph',\n                    'htmlP',\n                    'htmlH1',\n                    'htmlH2',\n                    'htmlH3',\n                    'htmlH4',\n                    'htmlH5',\n                    'htmlH6'\n                ],\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlH1',\n            view: 'h1',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlH2',\n            view: 'h2',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlH3',\n            view: 'h3',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlH4',\n            view: 'h4',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlH5',\n            view: 'h5',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlH6',\n            view: 'h6',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: '$htmlList',\n            modelSchema: {\n                allowWhere: '$container',\n                allowChildren: ['$htmlList', 'htmlLi'],\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlDir',\n            view: 'dir',\n            modelSchema: {\n                inheritAllFrom: '$htmlList'\n            }\n        },\n        {\n            model: 'htmlMenu',\n            view: 'menu',\n            modelSchema: {\n                inheritAllFrom: '$htmlList'\n            }\n        },\n        {\n            model: 'htmlUl',\n            view: 'ul',\n            modelSchema: {\n                inheritAllFrom: '$htmlList'\n            }\n        },\n        {\n            model: 'htmlOl',\n            view: 'ol',\n            modelSchema: {\n                inheritAllFrom: '$htmlList'\n            }\n        },\n        // TODO can also include other block elements.\n        {\n            model: 'htmlLi',\n            view: 'li',\n            modelSchema: {\n                allowIn: '$htmlList',\n                allowChildren: '$text',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlPre',\n            view: 'pre',\n            modelSchema: {\n                inheritAllFrom: '$block'\n            }\n        },\n        {\n            model: 'htmlArticle',\n            view: 'article',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlSection',\n            view: 'section',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        // TODO can also include text.\n        {\n            model: 'htmlNav',\n            view: 'nav',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlDivDl',\n            view: 'div',\n            modelSchema: {\n                allowChildren: ['htmlDt', 'htmlDd'],\n                allowIn: 'htmlDl'\n            }\n        },\n        {\n            model: 'htmlDl',\n            view: 'dl',\n            modelSchema: {\n                allowWhere: '$container',\n                allowChildren: ['htmlDt', 'htmlDd', 'htmlDivDl'],\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlDt',\n            view: 'dt',\n            modelSchema: {\n                allowChildren: '$block',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlDd',\n            view: 'dd',\n            modelSchema: {\n                allowChildren: '$block',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlCenter',\n            view: 'center',\n            modelSchema: {\n                inheritAllFrom: '$container',\n                isBlock: false\n            }\n        },\n        {\n            model: 'htmlHr',\n            view: 'hr',\n            isEmpty: true,\n            modelSchema: {\n                inheritAllFrom: '$blockObject'\n            }\n        }\n    ],\n    inline: [\n        // Existing features (attribute set on an existing model element).\n        {\n            model: 'htmlLiAttributes',\n            view: 'li',\n            appliesToBlock: true,\n            coupledAttribute: 'listItemId'\n        },\n        {\n            model: 'htmlOlAttributes',\n            view: 'ol',\n            appliesToBlock: true,\n            coupledAttribute: 'listItemId'\n        },\n        {\n            model: 'htmlUlAttributes',\n            view: 'ul',\n            appliesToBlock: true,\n            coupledAttribute: 'listItemId'\n        },\n        {\n            model: 'htmlFigureAttributes',\n            view: 'figure',\n            appliesToBlock: 'table'\n        },\n        {\n            model: 'htmlTheadAttributes',\n            view: 'thead',\n            appliesToBlock: 'table'\n        },\n        {\n            model: 'htmlTbodyAttributes',\n            view: 'tbody',\n            appliesToBlock: 'table'\n        },\n        {\n            model: 'htmlFigureAttributes',\n            view: 'figure',\n            appliesToBlock: 'imageBlock'\n        },\n        // Compatibility features.\n        {\n            model: 'htmlAcronym',\n            view: 'acronym',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlTt',\n            view: 'tt',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlFont',\n            view: 'font',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlTime',\n            view: 'time',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlVar',\n            view: 'var',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlBig',\n            view: 'big',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlSmall',\n            view: 'small',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlSamp',\n            view: 'samp',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlQ',\n            view: 'q',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlOutput',\n            view: 'output',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlKbd',\n            view: 'kbd',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlBdi',\n            view: 'bdi',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlBdo',\n            view: 'bdo',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlAbbr',\n            view: 'abbr',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlA',\n            view: 'a',\n            priority: 5,\n            coupledAttribute: 'linkHref',\n            attributeProperties: {\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlStrong',\n            view: 'strong',\n            coupledAttribute: 'bold',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlB',\n            view: 'b',\n            coupledAttribute: 'bold',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlI',\n            view: 'i',\n            coupledAttribute: 'italic',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlEm',\n            view: 'em',\n            coupledAttribute: 'italic',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlS',\n            view: 's',\n            coupledAttribute: 'strikethrough',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        // TODO According to HTML-spec can behave as div-like element, although CKE4 only handles it as an inline element.\n        {\n            model: 'htmlDel',\n            view: 'del',\n            coupledAttribute: 'strikethrough',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        // TODO According to HTML-spec can behave as div-like element, although CKE4 only handles it as an inline element.\n        {\n            model: 'htmlIns',\n            view: 'ins',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlU',\n            view: 'u',\n            coupledAttribute: 'underline',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlSub',\n            view: 'sub',\n            coupledAttribute: 'subscript',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlSup',\n            view: 'sup',\n            coupledAttribute: 'superscript',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlCode',\n            view: 'code',\n            coupledAttribute: 'code',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlMark',\n            view: 'mark',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlSpan',\n            view: 'span',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlCite',\n            view: 'cite',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlLabel',\n            view: 'label',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        {\n            model: 'htmlDfn',\n            view: 'dfn',\n            attributeProperties: {\n                copyOnEnter: true,\n                isFormatting: true\n            }\n        },\n        // Objects.\n        {\n            model: 'htmlObject',\n            view: 'object',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlIframe',\n            view: 'iframe',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlInput',\n            view: 'input',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlButton',\n            view: 'button',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlTextarea',\n            view: 'textarea',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlSelect',\n            view: 'select',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlVideo',\n            view: 'video',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlEmbed',\n            view: 'embed',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlOembed',\n            view: 'oembed',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlAudio',\n            view: 'audio',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlImg',\n            view: 'img',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlCanvas',\n            view: 'canvas',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        // TODO it could be probably represented as non-object element, although it has graphical representation,\n        // so probably makes more sense to keep it as an object.\n        {\n            model: 'htmlMeter',\n            view: 'meter',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        // TODO it could be probably represented as non-object element, although it has graphical representation,\n        // so probably makes more sense to keep it as an object.\n        {\n            model: 'htmlProgress',\n            view: 'progress',\n            isObject: true,\n            modelSchema: {\n                inheritAllFrom: '$inlineObject'\n            }\n        },\n        {\n            model: 'htmlScript',\n            view: 'script',\n            modelSchema: {\n                allowWhere: ['$text', '$block'],\n                isInline: true\n            }\n        },\n        {\n            model: 'htmlStyle',\n            view: 'style',\n            modelSchema: {\n                allowWhere: ['$text', '$block'],\n                isInline: true\n            }\n        },\n        {\n            model: 'htmlCustomElement',\n            view: '$customElement',\n            modelSchema: {\n                allowWhere: ['$text', '$block'],\n                allowAttributesOf: '$inlineObject',\n                isInline: true\n            }\n        }\n    ]\n};\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/dataschema\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { toArray } from 'ckeditor5/src/utils.js';\nimport { defaultConfig } from './schemadefinitions.js';\nimport { mergeWith } from 'es-toolkit/compat';\n/**\n * Holds representation of the extended HTML document type definitions to be used by the\n * editor in HTML support.\n *\n * Data schema is represented by data schema definitions.\n *\n * To add new definition for block element,\n * use {@link module:html-support/dataschema~DataSchema#registerBlockElement} method:\n *\n * ```ts\n * dataSchema.registerBlockElement( {\n * \tview: 'section',\n * \tmodel: 'my-section',\n * \tmodelSchema: {\n * \t\tinheritAllFrom: '$block'\n * \t}\n * } );\n * ```\n *\n * To add new definition for inline element,\n * use {@link module:html-support/dataschema~DataSchema#registerInlineElement} method:\n *\n * ```\n * dataSchema.registerInlineElement( {\n * \tview: 'span',\n * \tmodel: 'my-span',\n * \tattributeProperties: {\n * \t\tcopyOnEnter: true\n * \t}\n * } );\n * ```\n */\nexport class DataSchema extends Plugin {\n    /**\n     * A map of registered data schema definitions.\n     */\n    _definitions = [];\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'DataSchema';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        for (const definition of defaultConfig.block) {\n            this.registerBlockElement(definition);\n        }\n        for (const definition of defaultConfig.inline) {\n            this.registerInlineElement(definition);\n        }\n    }\n    /**\n     * Add new data schema definition describing block element.\n     */\n    registerBlockElement(definition) {\n        this._definitions.push({ ...definition, isBlock: true });\n    }\n    /**\n     * Add new data schema definition describing inline element.\n     */\n    registerInlineElement(definition) {\n        this._definitions.push({ ...definition, isInline: true });\n    }\n    /**\n     * Updates schema definition describing block element with new properties.\n     *\n     * Creates new scheme if it doesn't exist.\n     * Array properties are concatenated with original values.\n     *\n     * @param definition Definition update.\n     */\n    extendBlockElement(definition) {\n        this._extendDefinition({ ...definition, isBlock: true });\n    }\n    /**\n     * Updates schema definition describing inline element with new properties.\n     *\n     * Creates new scheme if it doesn't exist.\n     * Array properties are concatenated with original values.\n     *\n     * @param definition Definition update.\n     */\n    extendInlineElement(definition) {\n        this._extendDefinition({ ...definition, isInline: true });\n    }\n    /**\n     * Returns all definitions matching the given view name.\n     *\n     * @param includeReferences Indicates if this method should also include definitions of referenced models.\n     */\n    getDefinitionsForView(viewName, includeReferences = false) {\n        const definitions = new Set();\n        for (const definition of this._getMatchingViewDefinitions(viewName)) {\n            if (includeReferences) {\n                for (const reference of this._getReferences(definition.model)) {\n                    definitions.add(reference);\n                }\n            }\n            definitions.add(definition);\n        }\n        return definitions;\n    }\n    /**\n     * Returns definitions matching the given model name.\n     */\n    getDefinitionsForModel(modelName) {\n        return this._definitions.filter(definition => definition.model == modelName);\n    }\n    /**\n     * Returns definitions matching the given view name.\n     */\n    _getMatchingViewDefinitions(viewName) {\n        return this._definitions.filter(def => def.view && testViewName(viewName, def.view));\n    }\n    /**\n     * Resolves all definition references registered for the given data schema definition.\n     *\n     * @param modelName Data schema model name.\n     */\n    *_getReferences(modelName) {\n        const inheritProperties = [\n            'inheritAllFrom',\n            'inheritTypesFrom',\n            'allowWhere',\n            'allowContentOf',\n            'allowAttributesOf'\n        ];\n        const definitions = this._definitions.filter(definition => definition.model == modelName);\n        for (const { modelSchema } of definitions) {\n            if (!modelSchema) {\n                continue;\n            }\n            for (const property of inheritProperties) {\n                for (const referenceName of toArray(modelSchema[property] || [])) {\n                    const definitions = this._definitions.filter(definition => definition.model == referenceName);\n                    for (const definition of definitions) {\n                        if (referenceName !== modelName) {\n                            yield* this._getReferences(definition.model);\n                            yield definition;\n                        }\n                    }\n                }\n            }\n        }\n    }\n    /**\n     * Updates schema definition with new properties.\n     *\n     * Creates new scheme if it doesn't exist.\n     * Array properties are concatenated with original values.\n     *\n     * @param definition Definition update.\n     */\n    _extendDefinition(definition) {\n        const currentDefinitions = Array.from(this._definitions.entries())\n            .filter(([, currentDefinition]) => currentDefinition.model == definition.model);\n        if (currentDefinitions.length == 0) {\n            this._definitions.push(definition);\n            return;\n        }\n        for (const [idx, currentDefinition] of currentDefinitions) {\n            this._definitions[idx] = mergeWith({}, currentDefinition, definition, (target, source) => {\n                return Array.isArray(target) ? target.concat(source) : undefined;\n            });\n        }\n    }\n}\n/**\n * Test view name against the given pattern.\n */\nfunction testViewName(pattern, viewName) {\n    if (typeof pattern === 'string') {\n        return pattern === viewName;\n    }\n    if (pattern instanceof RegExp) {\n        return pattern.test(viewName);\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/datafilter\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Matcher, StylesMap } from 'ckeditor5/src/engine.js';\nimport { CKEditorError, priorities, isValidAttributeName } from 'ckeditor5/src/utils.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { viewToModelObjectConverter, toObjectWidgetConverter, createObjectView, viewToAttributeInlineConverter, attributeToViewInlineConverter, emptyInlineModelElementToViewConverter, viewToModelBlockAttributeConverter, modelToViewBlockAttributeConverter } from './converters.js';\nimport { DataSchema } from './dataschema.js';\nimport { getHtmlAttributeName } from './utils.js';\nimport { isPlainObject } from 'es-toolkit/compat';\nimport '../theme/datafilter.css';\n/**\n * Allows to validate elements and element attributes registered by {@link module:html-support/dataschema~DataSchema}.\n *\n * To enable registered element in the editor, use {@link module:html-support/datafilter~DataFilter#allowElement} method:\n *\n * ```ts\n * dataFilter.allowElement( 'section' );\n * ```\n *\n * You can also allow or disallow specific element attributes:\n *\n * ```ts\n * // Allow `data-foo` attribute on `section` element.\n * dataFilter.allowAttributes( {\n * \tname: 'section',\n * \tattributes: {\n * \t\t'data-foo': true\n * \t}\n * } );\n *\n * // Disallow `color` style attribute on 'section' element.\n * dataFilter.disallowAttributes( {\n * \tname: 'section',\n * \tstyles: {\n * \t\tcolor: /[\\s\\S]+/\n * \t}\n * } );\n * ```\n *\n * To apply the information about allowed and disallowed attributes in custom integration plugin,\n * use the {@link module:html-support/datafilter~DataFilter#processViewAttributes `processViewAttributes()`} method.\n */\nexport class DataFilter extends Plugin {\n    /**\n     * An instance of the {@link module:html-support/dataschema~DataSchema}.\n     */\n    _dataSchema;\n    /**\n     * {@link module:engine/view/matcher~Matcher Matcher} instance describing rules upon which\n     * content attributes should be allowed.\n     */\n    _allowedAttributes;\n    /**\n     * {@link module:engine/view/matcher~Matcher Matcher} instance describing rules upon which\n     * content attributes should be disallowed.\n     */\n    _disallowedAttributes;\n    /**\n     * Allowed element definitions by {@link module:html-support/datafilter~DataFilter#allowElement} method.\n    */\n    _allowedElements;\n    /**\n     * Disallowed element names by {@link module:html-support/datafilter~DataFilter#disallowElement} method.\n     */\n    _disallowedElements;\n    /**\n     * Indicates if {@link module:engine/controller/datacontroller~DataController editor's data controller}\n     * data has been already initialized.\n    */\n    _dataInitialized;\n    /**\n     * Cached map of coupled attributes. Keys are the feature attributes names\n     * and values are arrays with coupled GHS attributes names.\n     */\n    _coupledAttributes;\n    constructor(editor) {\n        super(editor);\n        this._dataSchema = editor.plugins.get('DataSchema');\n        this._allowedAttributes = new Matcher();\n        this._disallowedAttributes = new Matcher();\n        this._allowedElements = new Set();\n        this._disallowedElements = new Set();\n        this._dataInitialized = false;\n        this._coupledAttributes = null;\n        this._registerElementsAfterInit();\n        this._registerElementHandlers();\n        this._registerCoupledAttributesPostFixer();\n        this._registerAssociatedHtmlAttributesPostFixer();\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'DataFilter';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataSchema, Widget];\n    }\n    /**\n     * Load a configuration of one or many elements, where their attributes should be allowed.\n     *\n     * **Note**: Rules will be applied just before next data pipeline data init or set.\n     *\n     * @param config Configuration of elements that should have their attributes accepted in the editor.\n     */\n    loadAllowedConfig(config) {\n        for (const pattern of config) {\n            // MatcherPattern allows omitting `name` to widen the search of elements.\n            // Let's keep it consistent and match every element if a `name` has not been provided.\n            const elementName = pattern.name || /[\\s\\S]+/;\n            const rules = splitRules(pattern);\n            this.allowElement(elementName);\n            rules.forEach(pattern => this.allowAttributes(pattern));\n        }\n    }\n    /**\n     * Load a configuration of one or many elements, where their attributes should be disallowed.\n     *\n     * **Note**: Rules will be applied just before next data pipeline data init or set.\n     *\n     * @param config Configuration of elements that should have their attributes rejected from the editor.\n     */\n    loadDisallowedConfig(config) {\n        for (const pattern of config) {\n            // MatcherPattern allows omitting `name` to widen the search of elements.\n            // Let's keep it consistent and match every element if a `name` has not been provided.\n            const elementName = pattern.name || /[\\s\\S]+/;\n            const rules = splitRules(pattern);\n            // Disallow element itself if there is no other rules.\n            if (rules.length == 0) {\n                this.disallowElement(elementName);\n            }\n            else {\n                rules.forEach(pattern => this.disallowAttributes(pattern));\n            }\n        }\n    }\n    /**\n     * Load a configuration of one or many elements, where when empty should be allowed.\n     *\n     * **Note**: It modifies DataSchema so must be loaded before registering filtering rules.\n     *\n     * @param config Configuration of elements that should be preserved even if empty.\n     */\n    loadAllowedEmptyElementsConfig(config) {\n        for (const elementName of config) {\n            this.allowEmptyElement(elementName);\n        }\n    }\n    /**\n     * Allow the given element in the editor context.\n     *\n     * This method will only allow elements described by the {@link module:html-support/dataschema~DataSchema} used\n     * to create data filter.\n     *\n     * **Note**: Rules will be applied just before next data pipeline data init or set.\n     *\n     * @param viewName String or regular expression matching view name.\n     */\n    allowElement(viewName) {\n        for (const definition of this._dataSchema.getDefinitionsForView(viewName, true)) {\n            this._addAllowedElement(definition);\n            // Reset cached map to recalculate it on the next usage.\n            this._coupledAttributes = null;\n        }\n    }\n    /**\n     * Disallow the given element in the editor context.\n     *\n     * This method will only disallow elements described by the {@link module:html-support/dataschema~DataSchema} used\n     * to create data filter.\n     *\n     * @param viewName String or regular expression matching view name.\n     */\n    disallowElement(viewName) {\n        for (const definition of this._dataSchema.getDefinitionsForView(viewName, false)) {\n            this._disallowedElements.add(definition.view);\n        }\n    }\n    /**\n     * Allow the given empty element in the editor context.\n     *\n     * This method will only allow elements described by the {@link module:html-support/dataschema~DataSchema} used\n     * to create data filter.\n     *\n     * **Note**: It modifies DataSchema so must be called before registering filtering rules.\n     *\n     * @param viewName String or regular expression matching view name.\n     */\n    allowEmptyElement(viewName) {\n        for (const definition of this._dataSchema.getDefinitionsForView(viewName, true)) {\n            if (definition.isInline) {\n                this._dataSchema.extendInlineElement({ ...definition, allowEmpty: true });\n            }\n        }\n    }\n    /**\n     * Allow the given attributes for view element allowed by {@link #allowElement} method.\n     *\n     * @param config Pattern matching all attributes which should be allowed.\n     */\n    allowAttributes(config) {\n        this._allowedAttributes.add(config);\n    }\n    /**\n     * Disallow the given attributes for view element allowed by {@link #allowElement} method.\n     *\n     * @param config Pattern matching all attributes which should be disallowed.\n     */\n    disallowAttributes(config) {\n        this._disallowedAttributes.add(config);\n    }\n    /**\n     * Processes all allowed and disallowed attributes on the view element by consuming them and returning the allowed ones.\n     *\n     * This method applies the configuration set up by {@link #allowAttributes `allowAttributes()`}\n     * and {@link #disallowAttributes `disallowAttributes()`} over the given view element by consuming relevant attributes.\n     * It returns the allowed attributes that were found on the given view element for further processing by integration code.\n     *\n     * ```ts\n     * dispatcher.on( 'element:myElement', ( evt, data, conversionApi ) => {\n     * \t// Get rid of disallowed and extract all allowed attributes from a viewElement.\n     * \tconst viewAttributes = dataFilter.processViewAttributes( data.viewItem, conversionApi );\n     * \t// Do something with them, i.e. store inside a model as a dictionary.\n     * \tif ( viewAttributes ) {\n     * \t\tconversionApi.writer.setAttribute( 'htmlAttributesOfMyElement', viewAttributes, data.modelRange );\n     * \t}\n     * } );\n     * ```\n     *\n     * @see module:engine/conversion/viewconsumable~ViewConsumable#consume\n     *\n     * @returns Object with following properties:\n     * - attributes Set with matched attribute names.\n     * - styles Set with matched style names.\n     * - classes Set with matched class names.\n     */\n    processViewAttributes(viewElement, conversionApi) {\n        const { consumable } = conversionApi;\n        // Make sure that the disabled attributes are handled before the allowed attributes are called.\n        // For example, for block images the <figure> converter triggers conversion for <img> first and then for other elements, i.e. <a>.\n        matchAndConsumeAttributes(viewElement, this._disallowedAttributes, consumable);\n        return prepareGHSAttribute(viewElement, matchAndConsumeAttributes(viewElement, this._allowedAttributes, consumable));\n    }\n    /**\n     * Adds allowed element definition and fires registration event.\n     */\n    _addAllowedElement(definition) {\n        if (this._allowedElements.has(definition)) {\n            return;\n        }\n        this._allowedElements.add(definition);\n        // For attribute based integrations (table figure, document lists, etc.) register related element definitions.\n        if ('appliesToBlock' in definition && typeof definition.appliesToBlock == 'string') {\n            for (const relatedDefinition of this._dataSchema.getDefinitionsForModel(definition.appliesToBlock)) {\n                if (relatedDefinition.isBlock) {\n                    this._addAllowedElement(relatedDefinition);\n                }\n            }\n        }\n        // We need to wait for all features to be initialized before we can register\n        // element, so we can access existing features model schemas.\n        // If the data has not been initialized yet, _registerElementsAfterInit() method will take care of\n        // registering elements.\n        if (this._dataInitialized) {\n            // Defer registration to the next data pipeline data set so any disallow rules could be applied\n            // even if added after allow rule (disallowElement).\n            this.editor.data.once('set', () => {\n                this._fireRegisterEvent(definition);\n            }, {\n                // With the highest priority listener we are able to register elements right before\n                // running data conversion.\n                priority: priorities.highest + 1\n            });\n        }\n    }\n    /**\n     * Registers elements allowed by {@link module:html-support/datafilter~DataFilter#allowElement} method\n     * once {@link module:engine/controller/datacontroller~DataController editor's data controller} is initialized.\n    */\n    _registerElementsAfterInit() {\n        this.editor.data.on('init', () => {\n            this._dataInitialized = true;\n            for (const definition of this._allowedElements) {\n                this._fireRegisterEvent(definition);\n            }\n        }, {\n            // With highest priority listener we are able to register elements right before\n            // running data conversion. Also:\n            // * Make sure that priority is higher than the one used by `RealTimeCollaborationClient`,\n            // as RTC is stopping event propagation.\n            // * Make sure no other features hook into this event before GHS because otherwise the\n            // downcast conversion (for these features) could run before GHS registered its converters\n            // (https://github.com/ckeditor/ckeditor5/issues/11356).\n            priority: priorities.highest + 1\n        });\n    }\n    /**\n     * Registers default element handlers.\n     */\n    _registerElementHandlers() {\n        this.on('register', (evt, definition) => {\n            const schema = this.editor.model.schema;\n            // Object element should be only registered for new features.\n            // If the model schema is already registered, it should be handled by\n            // #_registerBlockElement() or #_registerObjectElement() attribute handlers.\n            if (definition.isObject && !schema.isRegistered(definition.model)) {\n                this._registerObjectElement(definition);\n            }\n            else if (definition.isBlock) {\n                this._registerBlockElement(definition);\n            }\n            else if (definition.isInline) {\n                this._registerInlineElement(definition);\n            }\n            else {\n                /**\n                 * The definition cannot be handled by the data filter.\n                 *\n                 * Make sure that the registered definition is correct.\n                 *\n                 * @error data-filter-invalid-definition\n                 */\n                throw new CKEditorError('data-filter-invalid-definition', null, definition);\n            }\n            evt.stop();\n        }, { priority: 'lowest' });\n    }\n    /**\n     * Registers a model post-fixer that is removing coupled GHS attributes of inline elements. Those attributes\n     * are removed if a coupled feature attribute is removed.\n     *\n     * For example, consider following HTML:\n     *\n     * ```html\n     * <a href=\"foo.html\" id=\"myId\">bar</a>\n     * ```\n     *\n     * Which would be upcasted to following text node in the model:\n     *\n     * ```html\n     * <$text linkHref=\"foo.html\" htmlA=\"{ attributes: { id: 'myId' } }\">bar</$text>\n     * ```\n     *\n     * When the user removes the link from that text (using UI), only `linkHref` attribute would be removed:\n     *\n     * ```html\n     * <$text htmlA=\"{ attributes: { id: 'myId' } }\">bar</$text>\n     * ```\n     *\n     * The `htmlA` attribute would stay in the model and would cause GHS to generate an `<a>` element.\n     * This is incorrect from UX point of view, as the user wanted to remove the whole link (not only `href`).\n     */\n    _registerCoupledAttributesPostFixer() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        model.document.registerPostFixer(writer => {\n            const changes = model.document.differ.getChanges();\n            let changed = false;\n            const coupledAttributes = this._getCoupledAttributesMap();\n            for (const change of changes) {\n                // Handle only attribute removals.\n                if (change.type != 'attribute' || change.attributeNewValue !== null) {\n                    continue;\n                }\n                // Find a list of coupled GHS attributes.\n                const attributeKeys = coupledAttributes.get(change.attributeKey);\n                if (!attributeKeys) {\n                    continue;\n                }\n                // Remove the coupled GHS attributes on the same range as the feature attribute was removed.\n                for (const { item } of change.range.getWalker()) {\n                    for (const attributeKey of attributeKeys) {\n                        if (item.hasAttribute(attributeKey)) {\n                            writer.removeAttribute(attributeKey, item);\n                            changed = true;\n                        }\n                    }\n                }\n            }\n            return changed;\n        });\n        this.listenTo(selection, 'change:attribute', (evt, { attributeKeys }) => {\n            const removeAttributes = new Set();\n            const coupledAttributes = this._getCoupledAttributesMap();\n            for (const attributeKey of attributeKeys) {\n                // Handle only attribute removals.\n                if (selection.hasAttribute(attributeKey)) {\n                    continue;\n                }\n                // Find a list of coupled GHS attributes.\n                const coupledAttributeKeys = coupledAttributes.get(attributeKey);\n                if (!coupledAttributeKeys) {\n                    continue;\n                }\n                for (const coupledAttributeKey of coupledAttributeKeys) {\n                    if (selection.hasAttribute(coupledAttributeKey)) {\n                        removeAttributes.add(coupledAttributeKey);\n                    }\n                }\n            }\n            if (removeAttributes.size == 0) {\n                return;\n            }\n            model.change(writer => {\n                for (const attributeKey of removeAttributes) {\n                    writer.removeSelectionAttribute(attributeKey);\n                }\n            });\n        });\n    }\n    /**\n     * Removes `html*Attributes` attributes from incompatible elements.\n     *\n     * For example, consider the following HTML:\n     *\n     * ```html\n     * <heading2 htmlH2Attributes=\"...\">foobar[]</heading2>\n     * ```\n     *\n     * Pressing `enter` creates a new `paragraph` element that inherits\n     * the `htmlH2Attributes` attribute from `heading2`.\n     *\n     * ```html\n     * <heading2 htmlH2Attributes=\"...\">foobar</heading2>\n     * <paragraph htmlH2Attributes=\"...\">[]</paragraph>\n     * ```\n     *\n     * This postfixer ensures that this doesn't happen, and that elements can\n     * only have `html*Attributes` associated with them,\n     * e.g.: `htmlPAttributes` for `<p>`, `htmlDivAttributes` for `<div>`, etc.\n     *\n     * With it enabled, pressing `enter` at the end of `<heading2>` will create\n     * a new paragraph without the `htmlH2Attributes` attribute.\n     *\n     * ```html\n     * <heading2 htmlH2Attributes=\"...\">foobar</heading2>\n     * <paragraph>[]</paragraph>\n     * ```\n     */\n    _registerAssociatedHtmlAttributesPostFixer() {\n        const model = this.editor.model;\n        model.document.registerPostFixer(writer => {\n            const changes = model.document.differ.getChanges();\n            let changed = false;\n            for (const change of changes) {\n                if (change.type !== 'insert' || change.name === '$text') {\n                    continue;\n                }\n                for (const attr of change.attributes.keys()) {\n                    if (!attr.startsWith('html') || !attr.endsWith('Attributes')) {\n                        continue;\n                    }\n                    if (!model.schema.checkAttribute(change.name, attr)) {\n                        writer.removeAttribute(attr, change.position.nodeAfter);\n                        changed = true;\n                    }\n                }\n            }\n            return changed;\n        });\n    }\n    /**\n     * Collects the map of coupled attributes. The returned map is keyed by the feature attribute name\n     * and coupled GHS attribute names are stored in the value array.\n     */\n    _getCoupledAttributesMap() {\n        if (this._coupledAttributes) {\n            return this._coupledAttributes;\n        }\n        this._coupledAttributes = new Map();\n        for (const definition of this._allowedElements) {\n            if (definition.coupledAttribute && definition.model) {\n                const attributeNames = this._coupledAttributes.get(definition.coupledAttribute);\n                if (attributeNames) {\n                    attributeNames.push(definition.model);\n                }\n                else {\n                    this._coupledAttributes.set(definition.coupledAttribute, [definition.model]);\n                }\n            }\n        }\n        return this._coupledAttributes;\n    }\n    /**\n     * Fires `register` event for the given element definition.\n     */\n    _fireRegisterEvent(definition) {\n        if (definition.view && this._disallowedElements.has(definition.view)) {\n            return;\n        }\n        this.fire(definition.view ? `register:${definition.view}` : 'register', definition);\n    }\n    /**\n     * Registers object element and attribute converters for the given data schema definition.\n     */\n    _registerObjectElement(definition) {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const { view: viewName, model: modelName } = definition;\n        schema.register(modelName, definition.modelSchema);\n        /* istanbul ignore next: paranoid check -- @preserve */\n        if (!viewName) {\n            return;\n        }\n        schema.extend(definition.model, {\n            allowAttributes: [getHtmlAttributeName(viewName), 'htmlContent']\n        });\n        // Store element content in special `$rawContent` custom property to\n        // avoid editor's data filtering mechanism.\n        editor.data.registerRawContentMatcher({\n            name: viewName\n        });\n        conversion.for('upcast').elementToElement({\n            view: viewName,\n            model: viewToModelObjectConverter(definition),\n            // With a `low` priority, `paragraph` plugin auto-paragraphing mechanism is executed. Make sure\n            // this listener is called before it. If not, some elements will be transformed into a paragraph.\n            // `+ 2` is used to take priority over `_addDefaultH1Conversion` in the Heading plugin.\n            converterPriority: priorities.low + 2\n        });\n        conversion.for('upcast')\n            .add(viewToModelBlockAttributeConverter(definition, this));\n        conversion.for('editingDowncast').elementToStructure({\n            model: {\n                name: modelName,\n                attributes: [getHtmlAttributeName(viewName)]\n            },\n            view: toObjectWidgetConverter(editor, definition)\n        });\n        conversion.for('dataDowncast').elementToElement({\n            model: modelName,\n            view: (modelElement, { writer }) => {\n                return createObjectView(viewName, modelElement, writer);\n            }\n        });\n        conversion.for('dataDowncast')\n            .add(modelToViewBlockAttributeConverter(definition));\n    }\n    /**\n     * Registers block element and attribute converters for the given data schema definition.\n     */\n    _registerBlockElement(definition) {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const { view: viewName, model: modelName } = definition;\n        if (!schema.isRegistered(definition.model)) {\n            // Do not register converters and empty schema for editor existing feature\n            // as empty schema won't allow element anywhere in the model.\n            if (!definition.modelSchema) {\n                return;\n            }\n            schema.register(definition.model, definition.modelSchema);\n            if (!viewName) {\n                return;\n            }\n            conversion.for('upcast').elementToElement({\n                model: modelName,\n                view: viewName,\n                // With a `low` priority, `paragraph` plugin auto-paragraphing mechanism is executed. Make sure\n                // this listener is called before it. If not, some elements will be transformed into a paragraph.\n                // `+ 2` is used to take priority over `_addDefaultH1Conversion` in the Heading plugin.\n                converterPriority: priorities.low + 2\n            });\n            conversion.for('downcast').elementToElement({\n                model: modelName,\n                view: (modelElement, { writer }) => definition.isEmpty ?\n                    writer.createEmptyElement(viewName) :\n                    writer.createContainerElement(viewName)\n            });\n        }\n        if (!viewName) {\n            return;\n        }\n        schema.extend(definition.model, {\n            allowAttributes: getHtmlAttributeName(viewName)\n        });\n        conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, this));\n        conversion.for('downcast').add(modelToViewBlockAttributeConverter(definition));\n    }\n    /**\n     * Registers inline element and attribute converters for the given data schema definition.\n     *\n     * Extends `$text` model schema to allow the given definition model attribute and its properties.\n     */\n    _registerInlineElement(definition) {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const attributeKey = definition.model;\n        // This element is stored in the model as an attribute on a block element, for example Lists.\n        if (definition.appliesToBlock) {\n            return;\n        }\n        schema.extend('$text', {\n            allowAttributes: attributeKey\n        });\n        if (definition.attributeProperties) {\n            schema.setAttributeProperties(attributeKey, definition.attributeProperties);\n        }\n        conversion.for('upcast').add(viewToAttributeInlineConverter(definition, this));\n        conversion.for('downcast').attributeToElement({\n            model: attributeKey,\n            view: attributeToViewInlineConverter(definition)\n        });\n        if (!definition.allowEmpty) {\n            return;\n        }\n        schema.setAttributeProperties(attributeKey, { copyFromObject: false });\n        if (!schema.isRegistered('htmlEmptyElement')) {\n            schema.register('htmlEmptyElement', {\n                inheritAllFrom: '$inlineObject'\n            });\n            // Helper function to check if an element has any HTML attributes.\n            const hasHtmlAttributes = (element) => Array\n                .from(element.getAttributeKeys())\n                .some(key => key.startsWith('html'));\n            // Register a post-fixer that removes htmlEmptyElement when its htmlXX attribute is removed.\n            // See: https://github.com/ckeditor/ckeditor5/issues/18089\n            editor.model.document.registerPostFixer(writer => {\n                const changes = editor.model.document.differ.getChanges();\n                const elementsToRemove = new Set();\n                for (const change of changes) {\n                    if (change.type === 'remove') {\n                        continue;\n                    }\n                    // Look for removal of html* attributes.\n                    if (change.type === 'attribute' && change.attributeNewValue === null) {\n                        // Find htmlEmptyElement instances in the range that lost their html attribute.\n                        for (const { item } of change.range) {\n                            if (item.is('element', 'htmlEmptyElement') && !hasHtmlAttributes(item)) {\n                                elementsToRemove.add(item);\n                            }\n                        }\n                    }\n                    // Look for insertion of htmlEmptyElement.\n                    if (change.type === 'insert' && change.position.nodeAfter) {\n                        const insertedElement = change.position.nodeAfter;\n                        for (const { item } of writer.createRangeOn(insertedElement)) {\n                            if (item.is('element', 'htmlEmptyElement') && !hasHtmlAttributes(item)) {\n                                elementsToRemove.add(item);\n                            }\n                        }\n                    }\n                }\n                for (const element of elementsToRemove) {\n                    writer.remove(element);\n                }\n                return elementsToRemove.size > 0;\n            });\n        }\n        editor.data.htmlProcessor.domConverter.registerInlineObjectMatcher(element => {\n            // Element must be empty and have any attribute.\n            if (element.name == definition.view &&\n                element.isEmpty &&\n                Array.from(element.getAttributeKeys()).length) {\n                return {\n                    name: true\n                };\n            }\n            return null;\n        });\n        conversion.for('editingDowncast')\n            .elementToElement({\n            model: 'htmlEmptyElement',\n            view: emptyInlineModelElementToViewConverter(definition, true)\n        });\n        conversion.for('dataDowncast')\n            .elementToElement({\n            model: 'htmlEmptyElement',\n            view: emptyInlineModelElementToViewConverter(definition)\n        });\n    }\n}\n/**\n * Matches and consumes matched attributes.\n *\n * @returns Object with following properties:\n * - attributes Array with matched attribute names.\n * - classes Array with matched class names.\n * - styles Array with matched style names.\n */\nfunction matchAndConsumeAttributes(viewElement, matcher, consumable) {\n    const matches = matcher.matchAll(viewElement) || [];\n    const stylesProcessor = viewElement.document.stylesProcessor;\n    return matches.reduce((result, { match }) => {\n        for (const [key, token] of match.attributes || []) {\n            // Verify and consume styles.\n            if (key == 'style') {\n                const style = token;\n                // Check longer forms of the same style as those could be matched\n                // but not present in the element directly.\n                // Consider only longhand (or longer than current notation) so that\n                // we do not include all sides of the box if only one side is allowed.\n                const sortedRelatedStyles = stylesProcessor.getRelatedStyles(style)\n                    .filter(relatedStyle => relatedStyle.split('-').length > style.split('-').length)\n                    .sort((a, b) => b.split('-').length - a.split('-').length);\n                for (const relatedStyle of sortedRelatedStyles) {\n                    if (consumable.consume(viewElement, { styles: [relatedStyle] })) {\n                        result.styles.push(relatedStyle);\n                    }\n                }\n                // Verify and consume style as specified in the matcher.\n                if (consumable.consume(viewElement, { styles: [style] })) {\n                    result.styles.push(style);\n                }\n            }\n            // Verify and consume class names.\n            else if (key == 'class') {\n                const className = token;\n                if (consumable.consume(viewElement, { classes: [className] })) {\n                    result.classes.push(className);\n                }\n            }\n            else {\n                // Verify and consume other attributes.\n                if (consumable.consume(viewElement, { attributes: [key] })) {\n                    result.attributes.push(key);\n                }\n            }\n        }\n        return result;\n    }, {\n        attributes: [],\n        classes: [],\n        styles: []\n    });\n}\n/**\n * Prepares the GHS attribute value as an object with element attributes' values.\n */\nfunction prepareGHSAttribute(viewElement, { attributes, classes, styles }) {\n    if (!attributes.length && !classes.length && !styles.length) {\n        return null;\n    }\n    return {\n        ...(attributes.length && {\n            attributes: getAttributes(viewElement, attributes)\n        }),\n        ...(styles.length && {\n            styles: getReducedStyles(viewElement, styles)\n        }),\n        ...(classes.length && {\n            classes\n        })\n    };\n}\n/**\n * Returns attributes as an object with names and values.\n */\nfunction getAttributes(viewElement, attributes) {\n    const attributesObject = {};\n    for (const key of attributes) {\n        const value = viewElement.getAttribute(key);\n        if (value !== undefined && isValidAttributeName(key)) {\n            attributesObject[key] = value;\n        }\n    }\n    return attributesObject;\n}\n/**\n * Returns styles as an object reduced to shorthand notation without redundant entries.\n */\nfunction getReducedStyles(viewElement, styles) {\n    // Use StyleMap to reduce style value to the minimal form (without shorthand and long-hand notation and duplication).\n    const stylesMap = new StylesMap(viewElement.document.stylesProcessor);\n    for (const key of styles) {\n        const styleValue = viewElement.getStyle(key);\n        if (styleValue !== undefined) {\n            stylesMap.set(key, styleValue);\n        }\n    }\n    return Object.fromEntries(stylesMap.getStylesEntries());\n}\n/**\n * Matcher by default has to match **all** patterns to count it as an actual match. Splitting the pattern\n * into separate patterns means that any matched pattern will be count as a match.\n *\n * @param pattern Pattern to split.\n * @param attributeName Name of the attribute to split (e.g. 'attributes', 'classes', 'styles').\n */\nfunction splitPattern(pattern, attributeName) {\n    const { name } = pattern;\n    const attributeValue = pattern[attributeName];\n    if (isPlainObject(attributeValue)) {\n        return Object.entries(attributeValue)\n            .map(([key, value]) => ({\n            name,\n            [attributeName]: {\n                [key]: value\n            }\n        }));\n    }\n    if (Array.isArray(attributeValue)) {\n        return attributeValue\n            .map(value => ({\n            name,\n            [attributeName]: [value]\n        }));\n    }\n    return [pattern];\n}\n/**\n * Rules are matched in conjunction (AND operation), but we want to have a match if *any* of the rules is matched (OR operation).\n * By splitting the rules we force the latter effect.\n */\nfunction splitRules(rules) {\n    const { name, attributes, classes, styles } = rules;\n    const splitRules = [];\n    if (attributes) {\n        splitRules.push(...splitPattern({ name, attributes }, 'attributes'));\n    }\n    if (classes) {\n        splitRules.push(...splitPattern({ name, classes }, 'classes'));\n    }\n    if (styles) {\n        splitRules.push(...splitPattern({ name, styles }, 'styles'));\n    }\n    return splitRules;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { updateViewAttributes } from '../utils.js';\nimport { DataFilter } from '../datafilter.js';\n/**\n * Provides the General HTML Support integration with {@link module:code-block/codeblock~CodeBlock Code Block} feature.\n */\nexport class CodeBlockElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CodeBlockElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        if (!this.editor.plugins.has('CodeBlockEditing')) {\n            return;\n        }\n        const dataFilter = this.editor.plugins.get(DataFilter);\n        dataFilter.on('register:pre', (evt, definition) => {\n            if (definition.model !== 'codeBlock') {\n                return;\n            }\n            const editor = this.editor;\n            const schema = editor.model.schema;\n            const conversion = editor.conversion;\n            // Extend codeBlock to allow attributes required by attribute filtration.\n            schema.extend('codeBlock', {\n                allowAttributes: ['htmlPreAttributes', 'htmlContentAttributes']\n            });\n            conversion.for('upcast').add(viewToModelCodeBlockAttributeConverter(dataFilter));\n            conversion.for('downcast').add(modelToViewCodeBlockAttributeConverter());\n            evt.stop();\n        });\n    }\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link module:code-block/codeblock~CodeBlock Code Block}\n * feature model element.\n *\n * Attributes are preserved as a value of `html*Attributes` model attribute.\n * @param dataFilter\n * @returns Returns a conversion callback.\n */\nfunction viewToModelCodeBlockAttributeConverter(dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on('element:code', (evt, data, conversionApi) => {\n            const viewCodeElement = data.viewItem;\n            const viewPreElement = viewCodeElement.parent;\n            if (!viewPreElement || !viewPreElement.is('element', 'pre')) {\n                return;\n            }\n            preserveElementAttributes(viewPreElement, 'htmlPreAttributes');\n            preserveElementAttributes(viewCodeElement, 'htmlContentAttributes');\n            function preserveElementAttributes(viewElement, attributeName) {\n                const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);\n                if (viewAttributes) {\n                    conversionApi.writer.setAttribute(attributeName, viewAttributes, data.modelRange);\n                }\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * Model-to-view conversion helper applying attributes from {@link module:code-block/codeblock~CodeBlock Code Block}\n * feature model element.\n * @returns Returns a conversion callback.\n */\nfunction modelToViewCodeBlockAttributeConverter() {\n    return (dispatcher) => {\n        dispatcher.on('attribute:htmlPreAttributes:codeBlock', (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                return;\n            }\n            const { attributeOldValue, attributeNewValue } = data;\n            const viewCodeElement = conversionApi.mapper.toViewElement(data.item);\n            const viewPreElement = viewCodeElement.parent;\n            updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewPreElement);\n        });\n        dispatcher.on('attribute:htmlContentAttributes:codeBlock', (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                return;\n            }\n            const { attributeOldValue, attributeNewValue } = data;\n            const viewCodeElement = conversionApi.mapper.toViewElement(data.item);\n            updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewCodeElement);\n        });\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { priorities } from 'ckeditor5/src/utils.js';\nimport { modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter } from '../converters.js';\nimport { DataFilter } from '../datafilter.js';\nimport { getHtmlAttributeName } from '../utils.js';\n/**\n * Provides the General HTML Support integration for elements which can behave like sectioning element (e.g. article) or\n * element accepting only inline content (e.g. paragraph).\n *\n * The distinction between this two content models is important for choosing correct schema model and proper content conversion.\n * As an example, it ensures that:\n *\n * * children elements paragraphing is enabled for sectioning elements only,\n * * element and its content can be correctly handled by editing view (splitting and merging elements),\n * * model element HTML is semantically correct and easier to work with.\n *\n * If element contains any block element, it will be treated as a sectioning element and registered using\n * {@link module:html-support/dataschema~HtmlSupportDataSchemaDefinition#model} and\n * {@link module:html-support/dataschema~HtmlSupportDataSchemaDefinition#modelSchema} in editor schema.\n * Otherwise, it will be registered under\n * {@link module:html-support/dataschema~HtmlSupportDataSchemaBlockElementDefinition#paragraphLikeModel} model\n * name with model schema accepting only inline content (inheriting from `$block`).\n */\nexport class DualContentModelElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'DualContentModelElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const dataFilter = this.editor.plugins.get(DataFilter);\n        dataFilter.on('register', (evt, definition) => {\n            const blockDefinition = definition;\n            const editor = this.editor;\n            const schema = editor.model.schema;\n            const conversion = editor.conversion;\n            if (!blockDefinition.paragraphLikeModel) {\n                return;\n            }\n            // Can only apply to newly registered features.\n            if (schema.isRegistered(blockDefinition.model) || schema.isRegistered(blockDefinition.paragraphLikeModel)) {\n                return;\n            }\n            const paragraphLikeModelDefinition = {\n                model: blockDefinition.paragraphLikeModel,\n                view: blockDefinition.view\n            };\n            schema.register(blockDefinition.model, blockDefinition.modelSchema);\n            schema.register(paragraphLikeModelDefinition.model, {\n                inheritAllFrom: '$block'\n            });\n            conversion.for('upcast').elementToElement({\n                view: blockDefinition.view,\n                model: (viewElement, { writer }) => {\n                    if (this._hasBlockContent(viewElement)) {\n                        return writer.createElement(blockDefinition.model);\n                    }\n                    return writer.createElement(paragraphLikeModelDefinition.model);\n                },\n                // With a `low` priority, `paragraph` plugin auto-paragraphing mechanism is executed. Make sure\n                // this listener is called before it. If not, some elements will be transformed into a paragraph.\n                converterPriority: priorities.low + 0.5\n            });\n            conversion.for('downcast').elementToElement({\n                view: blockDefinition.view,\n                model: blockDefinition.model\n            });\n            this._addAttributeConversion(blockDefinition);\n            conversion.for('downcast').elementToElement({\n                view: paragraphLikeModelDefinition.view,\n                model: paragraphLikeModelDefinition.model\n            });\n            this._addAttributeConversion(paragraphLikeModelDefinition);\n            evt.stop();\n        });\n    }\n    /**\n     * Checks whether the given view element includes any other block element.\n     */\n    _hasBlockContent(viewElement) {\n        const view = this.editor.editing.view;\n        const blockElements = view.domConverter.blockElements;\n        // Traversing the viewElement subtree looking for block elements.\n        // Especially for the cases like <div><a href=\"#\"><p>foo</p></a></div>.\n        // https://github.com/ckeditor/ckeditor5/issues/11513\n        for (const viewItem of view.createRangeIn(viewElement).getItems()) {\n            if (viewItem.is('element') && blockElements.includes(viewItem.name)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    /**\n     * Adds attribute filtering conversion for the given data schema.\n     */\n    _addAttributeConversion(definition) {\n        const editor = this.editor;\n        const conversion = editor.conversion;\n        const dataFilter = editor.plugins.get(DataFilter);\n        editor.model.schema.extend(definition.model, {\n            allowAttributes: getHtmlAttributeName(definition.view)\n        });\n        conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));\n        conversion.for('downcast').add(modelToViewBlockAttributeConverter(definition));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/heading\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Enter } from 'ckeditor5/src/enter.js';\nimport { DataSchema } from '../dataschema.js';\n/**\n * Provides the General HTML Support integration with {@link module:heading/heading~Heading Heading} feature.\n */\nexport class HeadingElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataSchema, Enter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HeadingElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('HeadingEditing')) {\n            return;\n        }\n        const options = editor.config.get('heading.options');\n        this.registerHeadingElements(editor, options);\n    }\n    /**\n     * Registers all elements supported by HeadingEditing to enable custom attributes for those elements.\n     */\n    registerHeadingElements(editor, options) {\n        const dataSchema = editor.plugins.get(DataSchema);\n        const headerModels = [];\n        for (const option of options) {\n            if ('model' in option && 'view' in option) {\n                dataSchema.registerBlockElement({\n                    view: option.view,\n                    model: option.model\n                });\n                headerModels.push(option.model);\n            }\n        }\n        dataSchema.extendBlockElement({\n            model: 'htmlHgroup',\n            modelSchema: {\n                allowChildren: headerModels\n            }\n        });\n        dataSchema.extendBlockElement({\n            model: 'htmlSummary',\n            modelSchema: {\n                allowChildren: headerModels\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/integrationutils\n */\n/**\n * Returns the first view element descendant matching the given view name.\n * Includes view element itself.\n *\n * @internal\n */\nexport function getDescendantElement(writer, containerElement, elementName) {\n    const range = writer.createRangeOn(containerElement);\n    for (const { item } of range.getWalker()) {\n        if (item.is('element', elementName)) {\n            return item;\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/image\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { DataFilter } from '../datafilter.js';\nimport { setViewAttributes, updateViewAttributes } from '../utils.js';\nimport { getDescendantElement } from './integrationutils.js';\n/**\n * Provides the General HTML Support integration with the {@link module:image/image~Image Image} feature.\n */\nexport class ImageElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // At least one image plugin should be loaded for the integration to work properly.\n        if (!editor.plugins.has('ImageInlineEditing') && !editor.plugins.has('ImageBlockEditing')) {\n            return;\n        }\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const dataFilter = editor.plugins.get(DataFilter);\n        dataFilter.on('register:figure', () => {\n            conversion.for('upcast').add(viewToModelFigureAttributeConverter(dataFilter));\n        });\n        dataFilter.on('register:img', (evt, definition) => {\n            if (definition.model !== 'imageBlock' && definition.model !== 'imageInline') {\n                return;\n            }\n            if (schema.isRegistered('imageBlock')) {\n                schema.extend('imageBlock', {\n                    allowAttributes: [\n                        'htmlImgAttributes',\n                        // Figure and Link don't have model counterpart.\n                        // We will preserve attributes on image model element using these attribute keys.\n                        'htmlFigureAttributes',\n                        'htmlLinkAttributes'\n                    ]\n                });\n            }\n            if (schema.isRegistered('imageInline')) {\n                schema.extend('imageInline', {\n                    allowAttributes: [\n                        // `htmlA` is needed for standard GHS link integration.\n                        'htmlA',\n                        'htmlImgAttributes'\n                    ]\n                });\n            }\n            conversion.for('upcast').add(viewToModelImageAttributeConverter(dataFilter));\n            conversion.for('downcast').add(modelToViewImageAttributeConverter());\n            if (editor.plugins.has('LinkImage')) {\n                conversion.for('upcast').add(viewToModelLinkImageAttributeConverter(dataFilter, editor));\n            }\n            evt.stop();\n        });\n    }\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on the {@link module:image/image~Image Image}\n * feature model element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelImageAttributeConverter(dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on('element:img', (evt, data, conversionApi) => {\n            if (!data.modelRange) {\n                return;\n            }\n            const viewImageElement = data.viewItem;\n            const viewAttributes = dataFilter.processViewAttributes(viewImageElement, conversionApi);\n            if (viewAttributes) {\n                conversionApi.writer.setAttribute('htmlImgAttributes', viewAttributes, data.modelRange);\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link module:image/image~Image Image}\n * feature model element from link view element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelLinkImageAttributeConverter(dataFilter, editor) {\n    const imageUtils = editor.plugins.get('ImageUtils');\n    return (dispatcher) => {\n        dispatcher.on('element:a', (evt, data, conversionApi) => {\n            const viewLink = data.viewItem;\n            const viewImage = imageUtils.findViewImgElement(viewLink);\n            if (!viewImage) {\n                return;\n            }\n            const modelImage = data.modelCursor.parent;\n            if (!modelImage.is('element', 'imageBlock')) {\n                return;\n            }\n            const viewAttributes = dataFilter.processViewAttributes(viewLink, conversionApi);\n            if (viewAttributes) {\n                conversionApi.writer.setAttribute('htmlLinkAttributes', viewAttributes, modelImage);\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link module:image/image~Image Image}\n * feature model element from figure view element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelFigureAttributeConverter(dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on('element:figure', (evt, data, conversionApi) => {\n            const viewFigureElement = data.viewItem;\n            if (!data.modelRange || !viewFigureElement.hasClass('image')) {\n                return;\n            }\n            const viewAttributes = dataFilter.processViewAttributes(viewFigureElement, conversionApi);\n            if (viewAttributes) {\n                conversionApi.writer.setAttribute('htmlFigureAttributes', viewAttributes, data.modelRange);\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * A model-to-view conversion helper applying attributes from the {@link module:image/image~Image Image}\n * feature.\n * @returns Returns a conversion callback.\n */\nfunction modelToViewImageAttributeConverter() {\n    return (dispatcher) => {\n        addInlineAttributeConversion('htmlImgAttributes');\n        addBlockAttributeConversion('img', 'htmlImgAttributes');\n        addBlockAttributeConversion('figure', 'htmlFigureAttributes');\n        addBlockAttributeConversion('a', 'htmlLinkAttributes');\n        function addInlineAttributeConversion(attributeName) {\n            dispatcher.on(`attribute:${attributeName}:imageInline`, (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                    return;\n                }\n                const { attributeOldValue, attributeNewValue } = data;\n                const viewElement = conversionApi.mapper.toViewElement(data.item);\n                updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);\n            }, { priority: 'low' });\n        }\n        function addBlockAttributeConversion(elementName, attributeName) {\n            dispatcher.on(`attribute:${attributeName}:imageBlock`, (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.test(data.item, evt.name)) {\n                    return;\n                }\n                const { attributeOldValue, attributeNewValue } = data;\n                const containerElement = conversionApi.mapper.toViewElement(data.item);\n                const viewElement = getDescendantElement(conversionApi.writer, containerElement, elementName);\n                if (viewElement) {\n                    updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);\n                    conversionApi.consumable.consume(data.item, evt.name);\n                }\n            }, { priority: 'low' });\n            if (elementName === 'a') {\n                // To have a link element in the view, we need to attach a converter to the `linkHref` attribute as well.\n                dispatcher.on('attribute:linkHref:imageBlock', (evt, data, conversionApi) => {\n                    if (!conversionApi.consumable.consume(data.item, 'attribute:htmlLinkAttributes:imageBlock')) {\n                        return;\n                    }\n                    const containerElement = conversionApi.mapper.toViewElement(data.item);\n                    const viewElement = getDescendantElement(conversionApi.writer, containerElement, 'a');\n                    setViewAttributes(conversionApi.writer, data.item.getAttribute('htmlLinkAttributes'), viewElement);\n                }, { priority: 'low' });\n            }\n        }\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/mediaembed\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { DataFilter } from '../datafilter.js';\nimport { DataSchema } from '../dataschema.js';\nimport { updateViewAttributes, getHtmlAttributeName } from '../utils.js';\nimport { getDescendantElement } from './integrationutils.js';\n/**\n * Provides the General HTML Support integration with {@link module:media-embed/mediaembed~MediaEmbed Media Embed} feature.\n */\nexport class MediaEmbedElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'MediaEmbedElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Stop here if MediaEmbed plugin is not provided or the integrator wants to output markup with previews as\n        // we do not support filtering previews.\n        if (!editor.plugins.has('MediaEmbed') || editor.config.get('mediaEmbed.previewsInData')) {\n            return;\n        }\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const dataFilter = this.editor.plugins.get(DataFilter);\n        const dataSchema = this.editor.plugins.get(DataSchema);\n        const mediaElementName = editor.config.get('mediaEmbed.elementName');\n        // Overwrite GHS schema definition for a given elementName.\n        dataSchema.registerBlockElement({\n            model: 'media',\n            view: mediaElementName\n        });\n        dataFilter.on('register:figure', () => {\n            conversion.for('upcast').add(viewToModelFigureAttributesConverter(dataFilter));\n        });\n        dataFilter.on(`register:${mediaElementName}`, (evt, definition) => {\n            if (definition.model !== 'media') {\n                return;\n            }\n            schema.extend('media', {\n                allowAttributes: [\n                    getHtmlAttributeName(mediaElementName),\n                    'htmlFigureAttributes'\n                ]\n            });\n            conversion.for('upcast').add(viewToModelMediaAttributesConverter(dataFilter, mediaElementName));\n            conversion.for('dataDowncast').add(modelToViewMediaAttributeConverter(mediaElementName));\n            evt.stop();\n        });\n    }\n}\nfunction viewToModelMediaAttributesConverter(dataFilter, mediaElementName) {\n    const upcastMedia = (evt, data, conversionApi) => {\n        const viewMediaElement = data.viewItem;\n        preserveElementAttributes(viewMediaElement, getHtmlAttributeName(mediaElementName));\n        function preserveElementAttributes(viewElement, attributeName) {\n            const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);\n            if (viewAttributes) {\n                conversionApi.writer.setAttribute(attributeName, viewAttributes, data.modelRange);\n            }\n        }\n    };\n    return (dispatcher) => {\n        dispatcher.on(`element:${mediaElementName}`, upcastMedia, { priority: 'low' });\n    };\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link module:media-embed/mediaembed~MediaEmbed MediaEmbed}\n * feature model element from figure view element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelFigureAttributesConverter(dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on('element:figure', (evt, data, conversionApi) => {\n            const viewFigureElement = data.viewItem;\n            if (!data.modelRange || !viewFigureElement.hasClass('media')) {\n                return;\n            }\n            const viewAttributes = dataFilter.processViewAttributes(viewFigureElement, conversionApi);\n            if (viewAttributes) {\n                conversionApi.writer.setAttribute('htmlFigureAttributes', viewAttributes, data.modelRange);\n            }\n        }, { priority: 'low' });\n    };\n}\nfunction modelToViewMediaAttributeConverter(mediaElementName) {\n    return (dispatcher) => {\n        addAttributeConversionDispatcherHandler(mediaElementName, getHtmlAttributeName(mediaElementName));\n        addAttributeConversionDispatcherHandler('figure', 'htmlFigureAttributes');\n        function addAttributeConversionDispatcherHandler(elementName, attributeName) {\n            dispatcher.on(`attribute:${attributeName}:media`, (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                    return;\n                }\n                const { attributeOldValue, attributeNewValue } = data;\n                const containerElement = conversionApi.mapper.toViewElement(data.item);\n                const viewElement = getDescendantElement(conversionApi.writer, containerElement, elementName);\n                updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);\n            });\n        }\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/script\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { createObjectView, modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter, viewToModelObjectConverter } from '../converters.js';\nimport { DataFilter } from '../datafilter.js';\n/**\n * Provides the General HTML Support for `script` elements.\n */\nexport class ScriptElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ScriptElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const dataFilter = this.editor.plugins.get(DataFilter);\n        dataFilter.on('register:script', (evt, definition) => {\n            const editor = this.editor;\n            const schema = editor.model.schema;\n            const conversion = editor.conversion;\n            schema.register('htmlScript', definition.modelSchema);\n            schema.extend('htmlScript', {\n                allowAttributes: ['htmlScriptAttributes', 'htmlContent'],\n                isContent: true\n            });\n            editor.data.registerRawContentMatcher({\n                name: 'script'\n            });\n            conversion.for('upcast').elementToElement({\n                view: 'script',\n                model: viewToModelObjectConverter(definition)\n            });\n            conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));\n            conversion.for('downcast').elementToElement({\n                model: 'htmlScript',\n                view: (modelElement, { writer }) => {\n                    return createObjectView('script', modelElement, writer);\n                }\n            });\n            conversion.for('downcast')\n                .add(modelToViewBlockAttributeConverter(definition));\n            evt.stop();\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { updateViewAttributes } from '../utils.js';\nimport { DataFilter } from '../datafilter.js';\nimport { getDescendantElement } from './integrationutils.js';\nconst STYLE_ATTRIBUTES_TO_PROPAGATE = [\n    'width',\n    'max-width',\n    'min-width',\n    'height',\n    'min-height',\n    'max-height'\n];\n/**\n * Provides the General HTML Support integration with {@link module:table/table~Table Table} feature.\n */\nexport class TableElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('TableEditing')) {\n            return;\n        }\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const dataFilter = editor.plugins.get(DataFilter);\n        const tableUtils = editor.plugins.get('TableUtils');\n        dataFilter.on('register:figure', () => {\n            conversion.for('upcast').add(viewToModelFigureAttributeConverter(dataFilter));\n        });\n        dataFilter.on('register:table', (evt, definition) => {\n            if (definition.model !== 'table') {\n                return;\n            }\n            schema.extend('table', {\n                allowAttributes: [\n                    'htmlTableAttributes',\n                    // Figure, thead and tbody elements don't have model counterparts.\n                    // We will be preserving attributes on table element using these attribute keys.\n                    'htmlFigureAttributes', 'htmlTheadAttributes', 'htmlTbodyAttributes'\n                ]\n            });\n            conversion.for('upcast').add(viewToModelTableAttributeConverter(dataFilter));\n            conversion.for('downcast').add(modelToViewTableAttributeConverter());\n            editor.model.document.registerPostFixer(createHeadingRowsPostFixer(editor.model, tableUtils));\n            evt.stop();\n        });\n    }\n}\n/**\n * Creates a model post-fixer for thead and tbody GHS related attributes.\n */\nfunction createHeadingRowsPostFixer(model, tableUtils) {\n    return writer => {\n        const changes = model.document.differ.getChanges();\n        let wasFixed = false;\n        for (const change of changes) {\n            if (change.type != 'attribute' || change.attributeKey != 'headingRows') {\n                continue;\n            }\n            const table = change.range.start.nodeAfter;\n            const hasTHeadAttributes = table.getAttribute('htmlTheadAttributes');\n            const hasTBodyAttributes = table.getAttribute('htmlTbodyAttributes');\n            if (hasTHeadAttributes && !change.attributeNewValue) {\n                writer.removeAttribute('htmlTheadAttributes', table);\n                wasFixed = true;\n            }\n            else if (hasTBodyAttributes && change.attributeNewValue == tableUtils.getRows(table)) {\n                writer.removeAttribute('htmlTbodyAttributes', table);\n                wasFixed = true;\n            }\n        }\n        return wasFixed;\n    };\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link module:table/table~Table Table}\n * feature model element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelTableAttributeConverter(dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on('element:table', (evt, data, conversionApi) => {\n            if (!data.modelRange) {\n                return;\n            }\n            const viewTableElement = data.viewItem;\n            // Prevent `table` class on both <table> and <figure> elements simultaneously.\n            conversionApi.consumable.consume(viewTableElement, { classes: 'table' });\n            preserveElementAttributes(viewTableElement, 'htmlTableAttributes');\n            for (const childNode of viewTableElement.getChildren()) {\n                if (childNode.is('element', 'thead')) {\n                    preserveElementAttributes(childNode, 'htmlTheadAttributes');\n                }\n                if (childNode.is('element', 'tbody')) {\n                    preserveElementAttributes(childNode, 'htmlTbodyAttributes');\n                }\n            }\n            function preserveElementAttributes(viewElement, attributeName) {\n                const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);\n                if (viewAttributes) {\n                    conversionApi.writer.setAttribute(attributeName, viewAttributes, data.modelRange);\n                }\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link module:table/table~Table Table}\n * feature model element from figure view element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelFigureAttributeConverter(dataFilter) {\n    return (dispatcher) => {\n        dispatcher.on('element:figure', (evt, data, conversionApi) => {\n            const viewFigureElement = data.viewItem;\n            if (!data.modelRange || !viewFigureElement.hasClass('table')) {\n                return;\n            }\n            const viewAttributes = dataFilter.processViewAttributes(viewFigureElement, conversionApi);\n            if (viewAttributes) {\n                conversionApi.writer.setAttribute('htmlFigureAttributes', viewAttributes, data.modelRange);\n            }\n        }, { priority: 'low' });\n    };\n}\n/**\n * Model-to-view conversion helper applying attributes from {@link module:table/table~Table Table}\n * feature.\n *\n * @returns Returns a conversion callback.\n */\nfunction modelToViewTableAttributeConverter() {\n    return (dispatcher) => {\n        addAttributeConversionDispatcherHandler('table', 'htmlTableAttributes');\n        addAttributeConversionDispatcherHandler('figure', 'htmlFigureAttributes');\n        addAttributeConversionDispatcherHandler('thead', 'htmlTheadAttributes');\n        addAttributeConversionDispatcherHandler('tbody', 'htmlTbodyAttributes');\n        function addAttributeConversionDispatcherHandler(elementName, attributeName) {\n            dispatcher.on(`attribute:${attributeName}:table`, (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.test(data.item, evt.name)) {\n                    return;\n                }\n                const containerElement = conversionApi.mapper.toViewElement(data.item);\n                const viewElement = getDescendantElement(conversionApi.writer, containerElement, elementName);\n                if (!viewElement) {\n                    return;\n                }\n                conversionApi.consumable.consume(data.item, evt.name);\n                // Downcast selected styles to a figure element instead of a table element.\n                if (attributeName === 'htmlTableAttributes' && containerElement !== viewElement) {\n                    const oldAttributes = splitAttributesForFigureAndTable(data.attributeOldValue);\n                    const newAttributes = splitAttributesForFigureAndTable(data.attributeNewValue);\n                    updateViewAttributes(conversionApi.writer, oldAttributes.tableAttributes, newAttributes.tableAttributes, viewElement);\n                    updateViewAttributes(conversionApi.writer, oldAttributes.figureAttributes, newAttributes.figureAttributes, containerElement);\n                }\n                else {\n                    updateViewAttributes(conversionApi.writer, data.attributeOldValue, data.attributeNewValue, viewElement);\n                }\n            });\n        }\n    };\n}\n/**\n * Splits styles based on the `STYLE_ATTRIBUTES_TO_PROPAGATE` pattern that should be moved to the parent element\n * and those that should remain on element.\n */\nfunction splitAttributesForFigureAndTable(data) {\n    const figureAttributes = {};\n    const tableAttributes = { ...data };\n    if (!data || !('styles' in data)) {\n        return { figureAttributes, tableAttributes };\n    }\n    tableAttributes.styles = {};\n    for (const [key, value] of Object.entries(data.styles)) {\n        if (STYLE_ATTRIBUTES_TO_PROPAGATE.includes(key)) {\n            figureAttributes.styles = { ...figureAttributes.styles, [key]: value };\n        }\n        else {\n            tableAttributes.styles = { ...tableAttributes.styles, [key]: value };\n        }\n    }\n    return { figureAttributes, tableAttributes };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/style\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { createObjectView, modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter, viewToModelObjectConverter } from '../converters.js';\nimport { DataFilter } from '../datafilter.js';\n/**\n * Provides the General HTML Support for `style` elements.\n */\nexport class StyleElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'StyleElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const dataFilter = this.editor.plugins.get(DataFilter);\n        dataFilter.on('register:style', (evt, definition) => {\n            const editor = this.editor;\n            const schema = editor.model.schema;\n            const conversion = editor.conversion;\n            schema.register('htmlStyle', definition.modelSchema);\n            schema.extend('htmlStyle', {\n                allowAttributes: ['htmlStyleAttributes', 'htmlContent'],\n                isContent: true\n            });\n            editor.data.registerRawContentMatcher({\n                name: 'style'\n            });\n            conversion.for('upcast').elementToElement({\n                view: 'style',\n                model: viewToModelObjectConverter(definition)\n            });\n            conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));\n            conversion.for('downcast').elementToElement({\n                model: 'htmlStyle',\n                view: (modelElement, { writer }) => {\n                    return createObjectView('style', modelElement, writer);\n                }\n            });\n            conversion.for('downcast')\n                .add(modelToViewBlockAttributeConverter(definition));\n            evt.stop();\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/list\n */\nimport { isEqual } from 'es-toolkit/compat';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { getHtmlAttributeName, setViewAttributes } from '../utils.js';\nimport { DataFilter } from '../datafilter.js';\n/**\n * Provides the General HTML Support integration with the {@link module:list/list~List List} feature.\n */\nexport class ListElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('ListEditing')) {\n            return;\n        }\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const dataFilter = editor.plugins.get(DataFilter);\n        const listEditing = editor.plugins.get('ListEditing');\n        const listUtils = editor.plugins.get('ListUtils');\n        const viewElements = ['ul', 'ol', 'li'];\n        // Register downcast strategy.\n        // Note that this must be done before document list editing registers conversion in afterInit.\n        listEditing.registerDowncastStrategy({\n            scope: 'item',\n            attributeName: 'htmlLiAttributes',\n            setAttributeOnDowncast: setViewAttributes\n        });\n        listEditing.registerDowncastStrategy({\n            scope: 'list',\n            attributeName: 'htmlUlAttributes',\n            setAttributeOnDowncast: setViewAttributes\n        });\n        listEditing.registerDowncastStrategy({\n            scope: 'list',\n            attributeName: 'htmlOlAttributes',\n            setAttributeOnDowncast: setViewAttributes\n        });\n        dataFilter.on('register', (evt, definition) => {\n            if (!viewElements.includes(definition.view)) {\n                return;\n            }\n            evt.stop();\n            // Do not register same converters twice.\n            if (schema.checkAttribute('$block', 'htmlLiAttributes')) {\n                return;\n            }\n            const allowAttributes = viewElements.map(element => getHtmlAttributeName(element));\n            schema.extend('$listItem', { allowAttributes });\n            conversion.for('upcast').add(dispatcher => {\n                dispatcher.on('element:ul', viewToModelListAttributeConverter('htmlUlAttributes', dataFilter), { priority: 'low' });\n                dispatcher.on('element:ol', viewToModelListAttributeConverter('htmlOlAttributes', dataFilter), { priority: 'low' });\n                dispatcher.on('element:li', viewToModelListAttributeConverter('htmlLiAttributes', dataFilter), { priority: 'low' });\n            });\n        });\n        // Make sure that all items in a single list (items at the same level & listType) have the same properties.\n        listEditing.on('postFixer', (evt, { listNodes, writer }) => {\n            for (const { node, previousNodeInList } of listNodes) {\n                // This is a first item of a nested list.\n                if (!previousNodeInList) {\n                    continue;\n                }\n                if (previousNodeInList.getAttribute('listType') == node.getAttribute('listType')) {\n                    const attribute = getAttributeFromListType(previousNodeInList.getAttribute('listType'));\n                    const value = previousNodeInList.getAttribute(attribute);\n                    if (!isEqual(node.getAttribute(attribute), value) &&\n                        writer.model.schema.checkAttribute(node, attribute)) {\n                        writer.setAttribute(attribute, value, node);\n                        evt.return = true;\n                    }\n                }\n                if (previousNodeInList.getAttribute('listItemId') == node.getAttribute('listItemId')) {\n                    const value = previousNodeInList.getAttribute('htmlLiAttributes');\n                    if (!isEqual(node.getAttribute('htmlLiAttributes'), value) &&\n                        writer.model.schema.checkAttribute(node, 'htmlLiAttributes')) {\n                        writer.setAttribute('htmlLiAttributes', value, node);\n                        evt.return = true;\n                    }\n                }\n            }\n        });\n        // Remove `ol` attributes from `ul` elements and vice versa.\n        listEditing.on('postFixer', (evt, { listNodes, writer }) => {\n            for (const { node } of listNodes) {\n                const listType = node.getAttribute('listType');\n                if (!listUtils.isNumberedListType(listType) && node.getAttribute('htmlOlAttributes')) {\n                    writer.removeAttribute('htmlOlAttributes', node);\n                    evt.return = true;\n                }\n                if (listUtils.isNumberedListType(listType) && node.getAttribute('htmlUlAttributes')) {\n                    writer.removeAttribute('htmlUlAttributes', node);\n                    evt.return = true;\n                }\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        if (!editor.commands.get('indentList')) {\n            return;\n        }\n        // Reset list attributes after indenting list items.\n        const indentList = editor.commands.get('indentList');\n        this.listenTo(indentList, 'afterExecute', (evt, changedBlocks) => {\n            editor.model.change(writer => {\n                for (const node of changedBlocks) {\n                    const attribute = getAttributeFromListType(node.getAttribute('listType'));\n                    if (!editor.model.schema.checkAttribute(node, attribute)) {\n                        continue;\n                    }\n                    // Just reset the attribute.\n                    // If there is a previous indented list that this node should be merged into,\n                    // the postfixer will unify all the attributes of both sub-lists.\n                    writer.setAttribute(attribute, {}, node);\n                }\n            });\n        });\n    }\n}\n/**\n * View-to-model conversion helper preserving allowed attributes on {@link TODO}\n * feature model element.\n *\n * @returns Returns a conversion callback.\n */\nfunction viewToModelListAttributeConverter(attributeName, dataFilter) {\n    return (evt, data, conversionApi) => {\n        const viewElement = data.viewItem;\n        if (!data.modelRange) {\n            Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));\n        }\n        const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);\n        for (const item of data.modelRange.getItems({ shallow: true })) {\n            // Apply only to list item blocks.\n            if (!item.hasAttribute('listItemId')) {\n                continue;\n            }\n            // Set list attributes only on same level items, those nested deeper are already handled\n            // by the recursive conversion.\n            if (item.hasAttribute('htmlUlAttributes') || item.hasAttribute('htmlOlAttributes')) {\n                continue;\n            }\n            if (conversionApi.writer.model.schema.checkAttribute(item, attributeName)) {\n                conversionApi.writer.setAttribute(attributeName, viewAttributes || {}, item);\n            }\n        }\n    };\n}\n/**\n * Returns HTML attribute name based on provided list type.\n */\nfunction getAttributeFromListType(listType) {\n    return listType === 'numbered' || listType == 'customNumbered' ?\n        'htmlOlAttributes' :\n        'htmlUlAttributes';\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/horizontalline\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { DataFilter } from '../datafilter.js';\nimport { updateViewAttributes } from '../utils.js';\nimport { getDescendantElement } from './integrationutils.js';\nimport { viewToModelBlockAttributeConverter } from '../converters.js';\n/**\n * Provides the General HTML Support integration with the {@link module:horizontal-line/horizontalline~HorizontalLine} feature.\n */\nexport class HorizontalLineElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HorizontalLineElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('HorizontalLineEditing')) {\n            return;\n        }\n        const schema = editor.model.schema;\n        const conversion = editor.conversion;\n        const dataFilter = editor.plugins.get(DataFilter);\n        dataFilter.on('register:hr', (evt, definition) => {\n            if (definition.model !== 'horizontalLine') {\n                return;\n            }\n            schema.extend('horizontalLine', {\n                allowAttributes: ['htmlHrAttributes']\n            });\n            conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));\n            conversion.for('downcast').add(modelToViewHorizontalLineAttributeConverter());\n            evt.stop();\n        });\n    }\n}\n/**\n * A model-to-view conversion helper applying attributes from the\n * {@link module:horizontal-line/horizontalline~HorizontalLine HorizontalLine} feature.\n *\n * @returns Returns a conversion callback.\n */\nfunction modelToViewHorizontalLineAttributeConverter() {\n    return (dispatcher) => {\n        dispatcher.on('attribute:htmlHrAttributes:horizontalLine', (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.test(data.item, evt.name)) {\n                return;\n            }\n            const { attributeOldValue, attributeNewValue } = data;\n            const containerElement = conversionApi.mapper.toViewElement(data.item);\n            const viewElement = getDescendantElement(conversionApi.writer, containerElement, 'hr');\n            if (viewElement) {\n                updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);\n                conversionApi.consumable.consume(data.item, evt.name);\n            }\n        }, { priority: 'low' });\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/integrations/customelement\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { DataSchema } from '../dataschema.js';\nimport { DataFilter } from '../datafilter.js';\nimport { setViewAttributes } from '../utils.js';\n/**\n * Provides the General HTML Support for custom elements (not registered in the {@link module:html-support/dataschema~DataSchema}).\n */\nexport class CustomElementSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [DataFilter, DataSchema];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CustomElementSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const dataFilter = this.editor.plugins.get(DataFilter);\n        const dataSchema = this.editor.plugins.get(DataSchema);\n        dataFilter.on('register:$customElement', (evt, definition) => {\n            evt.stop();\n            const editor = this.editor;\n            const schema = editor.model.schema;\n            const conversion = editor.conversion;\n            const unsafeElements = editor.editing.view.domConverter.unsafeElements;\n            const preLikeElements = editor.data.htmlProcessor.domConverter.preElements;\n            schema.register(definition.model, definition.modelSchema);\n            schema.extend(definition.model, {\n                allowAttributes: ['htmlElementName', 'htmlCustomElementAttributes', 'htmlContent'],\n                isContent: true\n            });\n            // For the `<template>` element we use only raw-content because DOM API exposes its content\n            // only as a document fragment in the `content` property (or innerHTML).\n            editor.data.htmlProcessor.domConverter.registerRawContentMatcher({ name: 'template' });\n            // Being executed on the low priority, it will catch all elements that were not caught by other converters.\n            conversion.for('upcast').elementToElement({\n                view: /.*/,\n                model: (viewElement, conversionApi) => {\n                    // Do not try to convert $comment fake element.\n                    if (viewElement.name == '$comment') {\n                        return null;\n                    }\n                    /* istanbul ignore next -- @preserve */\n                    if (!isValidElementName(viewElement.name)) {\n                        return null;\n                    }\n                    // Allow for fallback only if this element is not defined in data schema to make sure\n                    // that this will handle only custom elements not registered in the data schema.\n                    if (dataSchema.getDefinitionsForView(viewElement.name).size) {\n                        return null;\n                    }\n                    // Make sure that this element will not render in the editing view.\n                    if (!unsafeElements.includes(viewElement.name)) {\n                        unsafeElements.push(viewElement.name);\n                    }\n                    // Make sure that whitespaces will not be trimmed or replaced by nbsps while stringify content.\n                    if (!preLikeElements.includes(viewElement.name)) {\n                        preLikeElements.push(viewElement.name);\n                    }\n                    const modelElement = conversionApi.writer.createElement(definition.model, {\n                        htmlElementName: viewElement.name\n                    });\n                    const htmlAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);\n                    if (htmlAttributes) {\n                        conversionApi.writer.setAttribute('htmlCustomElementAttributes', htmlAttributes, modelElement);\n                    }\n                    let htmlContent;\n                    // For the `<template>` element we use only raw-content because DOM API exposes its content\n                    // only as a document fragment in the `content` property.\n                    if (viewElement.is('element', 'template') && viewElement.getCustomProperty('$rawContent')) {\n                        htmlContent = viewElement.getCustomProperty('$rawContent');\n                    }\n                    else {\n                        // Store the whole element in the attribute so that ViewDomConverter\n                        // will be able to use the pre like element context.\n                        const viewWriter = new ViewUpcastWriter(viewElement.document);\n                        const documentFragment = viewWriter.createDocumentFragment(viewElement);\n                        const domFragment = editor.data.htmlProcessor.domConverter.viewToDom(documentFragment);\n                        const domElement = domFragment.firstChild;\n                        while (domElement.firstChild) {\n                            domFragment.appendChild(domElement.firstChild);\n                        }\n                        domElement.remove();\n                        htmlContent = editor.data.htmlProcessor.htmlWriter.getHtml(domFragment);\n                    }\n                    conversionApi.writer.setAttribute('htmlContent', htmlContent, modelElement);\n                    // Consume the content of the element.\n                    for (const { item } of editor.editing.view.createRangeIn(viewElement)) {\n                        conversionApi.consumable.consume(item, { name: true });\n                    }\n                    return modelElement;\n                },\n                converterPriority: 'low'\n            });\n            // Because this element is unsafe (DomConverter#unsafeElements), it will render as a transparent <span> but it must\n            // be rendered anyway for the mapping between the model and the view to exist.\n            conversion.for('editingDowncast').elementToElement({\n                model: {\n                    name: definition.model,\n                    attributes: ['htmlElementName', 'htmlCustomElementAttributes', 'htmlContent']\n                },\n                view: (modelElement, { writer }) => {\n                    const viewName = modelElement.getAttribute('htmlElementName');\n                    const viewElement = writer.createRawElement(viewName);\n                    if (modelElement.hasAttribute('htmlCustomElementAttributes')) {\n                        setViewAttributes(writer, modelElement.getAttribute('htmlCustomElementAttributes'), viewElement);\n                    }\n                    return viewElement;\n                }\n            });\n            conversion.for('dataDowncast').elementToElement({\n                model: {\n                    name: definition.model,\n                    attributes: ['htmlElementName', 'htmlCustomElementAttributes', 'htmlContent']\n                },\n                view: (modelElement, { writer }) => {\n                    const viewName = modelElement.getAttribute('htmlElementName');\n                    const htmlContent = modelElement.getAttribute('htmlContent');\n                    const viewElement = writer.createRawElement(viewName, null, (domElement, domConverter) => {\n                        domConverter.setContentOf(domElement, htmlContent);\n                    });\n                    if (modelElement.hasAttribute('htmlCustomElementAttributes')) {\n                        setViewAttributes(writer, modelElement.getAttribute('htmlCustomElementAttributes'), viewElement);\n                    }\n                    return viewElement;\n                }\n            });\n        });\n    }\n}\n/**\n * Returns true if name is valid for a DOM element name.\n */\nfunction isValidElementName(name) {\n    try {\n        document.createElement(name);\n    }\n    catch {\n        /* istanbul ignore next -- @preserve */\n        return false;\n    }\n    return true;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/generalhtmlsupport\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { toArray } from 'ckeditor5/src/utils.js';\nimport { DataFilter } from './datafilter.js';\nimport { CodeBlockElementSupport } from './integrations/codeblock.js';\nimport { DualContentModelElementSupport } from './integrations/dualcontent.js';\nimport { HeadingElementSupport } from './integrations/heading.js';\nimport { ImageElementSupport } from './integrations/image.js';\nimport { MediaEmbedElementSupport } from './integrations/mediaembed.js';\nimport { ScriptElementSupport } from './integrations/script.js';\nimport { TableElementSupport } from './integrations/table.js';\nimport { StyleElementSupport } from './integrations/style.js';\nimport { ListElementSupport } from './integrations/list.js';\nimport { HorizontalLineElementSupport } from './integrations/horizontalline.js';\nimport { CustomElementSupport } from './integrations/customelement.js';\nimport { getHtmlAttributeName, modifyGhsAttribute, removeFormatting } from './utils.js';\n/**\n * The General HTML Support feature.\n *\n * This is a \"glue\" plugin which initializes the {@link module:html-support/datafilter~DataFilter data filter} configuration\n * and features integration with the General HTML Support.\n */\nexport class GeneralHtmlSupport extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'GeneralHtmlSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [\n            DataFilter,\n            CodeBlockElementSupport,\n            DualContentModelElementSupport,\n            HeadingElementSupport,\n            ImageElementSupport,\n            MediaEmbedElementSupport,\n            ScriptElementSupport,\n            TableElementSupport,\n            StyleElementSupport,\n            ListElementSupport,\n            HorizontalLineElementSupport,\n            CustomElementSupport\n        ];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const dataFilter = editor.plugins.get(DataFilter);\n        // Load the allowed empty inline elements' configuration.\n        // Note that this modifies DataSchema so must be loaded before registering filtering rules.\n        dataFilter.loadAllowedEmptyElementsConfig(editor.config.get('htmlSupport.allowEmpty') || []);\n        // Load the filtering configuration.\n        dataFilter.loadAllowedConfig(editor.config.get('htmlSupport.allow') || []);\n        dataFilter.loadDisallowedConfig(editor.config.get('htmlSupport.disallow') || []);\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const removeFormatCommand = this.editor.commands.get('removeFormat');\n        removeFormatCommand?.registerCustomAttribute(attributeName => attributeName.startsWith('html') && attributeName.endsWith('Attributes'), removeFormatting);\n    }\n    /**\n     * Returns a GHS model attribute name related to a given view element name.\n     *\n     * @internal\n     * @param viewElementName A view element name.\n     */\n    getGhsAttributeNameForElement(viewElementName) {\n        const dataSchema = this.editor.plugins.get('DataSchema');\n        const definitions = Array.from(dataSchema.getDefinitionsForView(viewElementName, false));\n        const inlineDefinition = definitions.find(definition => (definition.isInline && !definitions[0].isObject));\n        if (inlineDefinition) {\n            return inlineDefinition.model;\n        }\n        return getHtmlAttributeName(viewElementName);\n    }\n    /**\n     * Updates GHS model attribute for a specified view element name, so it includes the given class name.\n     *\n     * @internal\n     * @param viewElementName A view element name.\n     * @param className The css class to add.\n     * @param selectable The selection or element to update.\n     */\n    addModelHtmlClass(viewElementName, className, selectable) {\n        const model = this.editor.model;\n        const ghsAttributeName = this.getGhsAttributeNameForElement(viewElementName);\n        model.change(writer => {\n            for (const item of getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName)) {\n                modifyGhsAttribute(writer, item, ghsAttributeName, 'classes', classes => {\n                    for (const value of toArray(className)) {\n                        classes.add(value);\n                    }\n                });\n            }\n        });\n    }\n    /**\n     * Updates GHS model attribute for a specified view element name, so it does not include the given class name.\n     *\n     * @internal\n     * @param viewElementName A view element name.\n     * @param className The css class to remove.\n     * @param selectable The selection or element to update.\n     */\n    removeModelHtmlClass(viewElementName, className, selectable) {\n        const model = this.editor.model;\n        const ghsAttributeName = this.getGhsAttributeNameForElement(viewElementName);\n        model.change(writer => {\n            for (const item of getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName)) {\n                modifyGhsAttribute(writer, item, ghsAttributeName, 'classes', classes => {\n                    for (const value of toArray(className)) {\n                        classes.delete(value);\n                    }\n                });\n            }\n        });\n    }\n    /**\n     * Updates GHS model attribute for a specified view element name, so it includes the given attribute.\n     *\n     * @param viewElementName A view element name.\n     * @param attributes The object with attributes to set.\n     * @param selectable The selection or element to update.\n     */\n    setModelHtmlAttributes(viewElementName, attributes, selectable) {\n        const model = this.editor.model;\n        const ghsAttributeName = this.getGhsAttributeNameForElement(viewElementName);\n        model.change(writer => {\n            for (const item of getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName)) {\n                modifyGhsAttribute(writer, item, ghsAttributeName, 'attributes', attributesMap => {\n                    for (const [key, value] of Object.entries(attributes)) {\n                        attributesMap.set(key, value);\n                    }\n                });\n            }\n        });\n    }\n    /**\n     * Updates GHS model attribute for a specified view element name, so it does not include the given attribute.\n     *\n     * @param viewElementName A view element name.\n     * @param attributeName The attribute name (or names) to remove.\n     * @param selectable The selection or element to update.\n     */\n    removeModelHtmlAttributes(viewElementName, attributeName, selectable) {\n        const model = this.editor.model;\n        const ghsAttributeName = this.getGhsAttributeNameForElement(viewElementName);\n        model.change(writer => {\n            for (const item of getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName)) {\n                modifyGhsAttribute(writer, item, ghsAttributeName, 'attributes', attributesMap => {\n                    for (const key of toArray(attributeName)) {\n                        attributesMap.delete(key);\n                    }\n                });\n            }\n        });\n    }\n    /**\n     * Updates GHS model attribute for a specified view element name, so it includes a given style.\n     *\n     * @param viewElementName A view element name.\n     * @param styles The object with styles to set.\n     * @param selectable The selection or element to update.\n     */\n    setModelHtmlStyles(viewElementName, styles, selectable) {\n        const model = this.editor.model;\n        const ghsAttributeName = this.getGhsAttributeNameForElement(viewElementName);\n        model.change(writer => {\n            for (const item of getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName)) {\n                modifyGhsAttribute(writer, item, ghsAttributeName, 'styles', stylesMap => {\n                    for (const [key, value] of Object.entries(styles)) {\n                        stylesMap.set(key, value);\n                    }\n                });\n            }\n        });\n    }\n    /**\n     * Updates GHS model attribute for a specified view element name, so it does not include a given style.\n     *\n     * @param viewElementName A view element name.\n     * @param properties The style (or styles list) to remove.\n     * @param selectable The selection or element to update.\n     */\n    removeModelHtmlStyles(viewElementName, properties, selectable) {\n        const model = this.editor.model;\n        const ghsAttributeName = this.getGhsAttributeNameForElement(viewElementName);\n        model.change(writer => {\n            for (const item of getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName)) {\n                modifyGhsAttribute(writer, item, ghsAttributeName, 'styles', stylesMap => {\n                    for (const key of toArray(properties)) {\n                        stylesMap.delete(key);\n                    }\n                });\n            }\n        });\n    }\n}\n/**\n * Returns an iterator over an items in the selectable that accept given GHS attribute.\n */\nfunction* getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName) {\n    if (!selectable) {\n        return;\n    }\n    if (!(Symbol.iterator in selectable) && selectable.is('documentSelection') && selectable.isCollapsed) {\n        if (model.schema.checkAttributeInSelection(selectable, ghsAttributeName)) {\n            yield selectable;\n        }\n    }\n    else {\n        for (const range of getValidRangesForSelectable(model, selectable, ghsAttributeName)) {\n            yield* range.getItems({ shallow: true });\n        }\n    }\n}\n/**\n * Translates a given selectable to an iterable of ranges.\n */\nfunction getValidRangesForSelectable(model, selectable, ghsAttributeName) {\n    if (!(Symbol.iterator in selectable) &&\n        (selectable.is('node') ||\n            selectable.is('$text') ||\n            selectable.is('$textProxy'))) {\n        if (model.schema.checkAttribute(selectable, ghsAttributeName)) {\n            return [model.createRangeOn(selectable)];\n        }\n        else {\n            return [];\n        }\n    }\n    else {\n        return model.schema.getValidRanges(model.createSelection(selectable).getRanges(), ghsAttributeName);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { global } from 'ckeditor5/src/utils.js';\n/**\n * Creates a regular expression used to test for image files.\n *\n * ```ts\n * const imageType = createImageTypeRegExp( [ 'png', 'jpeg', 'svg+xml', 'vnd.microsoft.icon' ] );\n *\n * console.log( 'is supported image', imageType.test( file.type ) );\n * ```\n */\nexport function createImageTypeRegExp(types) {\n    // Sanitize the MIME type name which may include: \"+\", \"-\" or \".\".\n    const regExpSafeNames = types.map(type => type.replace('+', '\\\\+'));\n    return new RegExp(`^image\\\\/(${regExpSafeNames.join('|')})$`);\n}\n/**\n * Creates a promise that fetches the image local source (Base64 or blob) and resolves with a `File` object.\n *\n * @internal\n * @param image Image whose source to fetch.\n * @returns A promise which resolves when an image source is fetched and converted to a `File` instance.\n * It resolves with a `File` object. If there were any errors during file processing, the promise will be rejected.\n */\nexport function fetchLocalImage(image) {\n    return new Promise((resolve, reject) => {\n        const imageSrc = image.getAttribute('src');\n        // Fetch works asynchronously and so does not block browser UI when processing data.\n        fetch(imageSrc)\n            .then(resource => resource.blob())\n            .then(blob => {\n            const mimeType = getImageMimeType(blob, imageSrc);\n            const ext = mimeType.replace('image/', '');\n            const filename = `image.${ext}`;\n            const file = new File([blob], filename, { type: mimeType });\n            resolve(file);\n        })\n            .catch(err => {\n            // Fetch fails only, if it can't make a request due to a network failure or if anything prevented the request\n            // from completing, i.e. the Content Security Policy rules. It is not possible to detect the exact cause of failure,\n            // so we are just trying the fallback solution, if general TypeError is thrown.\n            return err && err.name === 'TypeError' ?\n                convertLocalImageOnCanvas(imageSrc).then(resolve).catch(reject) :\n                reject(err);\n        });\n    });\n}\n/**\n * Checks whether a given node is an image element with a local source (Base64 or blob).\n *\n * @param node The node to check.\n * @internal\n */\nexport function isLocalImage(imageUtils, node) {\n    if (!imageUtils.isInlineImageView(node) || !node.getAttribute('src')) {\n        return false;\n    }\n    return !!node.getAttribute('src').match(/^data:image\\/\\w+;base64,/g) ||\n        !!node.getAttribute('src').match(/^blob:/g);\n}\n/**\n * Extracts an image type based on its blob representation or its source.\n * @param blob Image blob representation.\n * @param src Image `src` attribute value.\n */\nfunction getImageMimeType(blob, src) {\n    if (blob.type) {\n        return blob.type;\n    }\n    else if (src.match(/data:(image\\/\\w+);base64/)) {\n        return src.match(/data:(image\\/\\w+);base64/)[1].toLowerCase();\n    }\n    else {\n        // Fallback to 'jpeg' as common extension.\n        return 'image/jpeg';\n    }\n}\n/**\n * Creates a promise that converts the image local source (Base64 or blob) to a blob using canvas and resolves\n * with a `File` object.\n * @param imageSrc Image `src` attribute value.\n * @returns A promise which resolves when an image source is converted to a `File` instance.\n * It resolves with a `File` object. If there were any errors during file processing, the promise will be rejected.\n */\nfunction convertLocalImageOnCanvas(imageSrc) {\n    return getBlobFromCanvas(imageSrc).then(blob => {\n        const mimeType = getImageMimeType(blob, imageSrc);\n        const ext = mimeType.replace('image/', '');\n        const filename = `image.${ext}`;\n        return new File([blob], filename, { type: mimeType });\n    });\n}\n/**\n * Creates a promise that resolves with a `Blob` object converted from the image source (Base64 or blob).\n * @param imageSrc Image `src` attribute value.\n */\nfunction getBlobFromCanvas(imageSrc) {\n    return new Promise((resolve, reject) => {\n        const image = global.document.createElement('img');\n        image.addEventListener('load', () => {\n            const canvas = global.document.createElement('canvas');\n            canvas.width = image.width;\n            canvas.height = image.height;\n            const ctx = canvas.getContext('2d');\n            ctx.drawImage(image, 0, 0);\n            canvas.toBlob(blob => blob ? resolve(blob) : reject());\n        });\n        image.addEventListener('error', () => reject());\n        image.src = imageSrc;\n    });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageupload/imageuploadui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FileDialogButtonView, MenuBarMenuListItemFileDialogButtonView } from 'ckeditor5/src/ui.js';\nimport { IconImageUpload } from 'ckeditor5/src/icons.js';\nimport { createImageTypeRegExp } from './utils.js';\n/**\n * The image upload button plugin.\n *\n * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature} documentation.\n *\n * Adds the `'uploadImage'` button to the {@link module:ui/componentfactory~ComponentFactory UI component factory}\n * and also the `imageUpload` button as an alias for backward compatibility.\n *\n * Adds the `'menuBar:uploadImage'` menu button to the {@link module:ui/componentfactory~ComponentFactory UI component factory}.\n *\n * It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are the default components\n * through which image upload is available.\n */\nexport class ImageUploadUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageUploadUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Setup `uploadImage` button and add `imageUpload` button as an alias for backward compatibility.\n        editor.ui.componentFactory.add('uploadImage', () => this._createToolbarButton());\n        editor.ui.componentFactory.add('imageUpload', () => this._createToolbarButton());\n        editor.ui.componentFactory.add('menuBar:uploadImage', () => this._createMenuBarButton('standalone'));\n        if (editor.plugins.has('ImageInsertUI')) {\n            editor.plugins.get('ImageInsertUI').registerIntegration({\n                name: 'upload',\n                observable: () => editor.commands.get('uploadImage'),\n                buttonViewCreator: () => this._createToolbarButton(),\n                formViewCreator: () => this._createDropdownButton(),\n                menuBarButtonViewCreator: isOnly => this._createMenuBarButton(isOnly ? 'insertOnly' : 'insertNested')\n            });\n        }\n    }\n    /**\n     * Creates the base for various kinds of the button component provided by this feature.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('uploadImage');\n        const imageTypes = editor.config.get('image.upload.types');\n        const imageTypesRegExp = createImageTypeRegExp(imageTypes);\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            acceptedType: imageTypes.map(type => `image/${type}`).join(','),\n            allowMultipleFiles: true,\n            label: t('Upload from computer'),\n            icon: IconImageUpload\n        });\n        view.bind('isEnabled').to(command);\n        view.on('done', (evt, files) => {\n            const imagesToUpload = Array.from(files).filter(file => imageTypesRegExp.test(file.type));\n            if (imagesToUpload.length) {\n                editor.execute('uploadImage', { file: imagesToUpload });\n                editor.editing.view.focus();\n            }\n        });\n        return view;\n    }\n    /**\n     * Creates a simple toolbar button, with an icon and a tooltip.\n     */\n    _createToolbarButton() {\n        const t = this.editor.locale.t;\n        const imageInsertUI = this.editor.plugins.get('ImageInsertUI');\n        const uploadImageCommand = this.editor.commands.get('uploadImage');\n        const button = this._createButton(FileDialogButtonView);\n        button.tooltip = true;\n        button.bind('label').to(imageInsertUI, 'isImageSelected', uploadImageCommand, 'isAccessAllowed', (isImageSelected, isAccessAllowed) => {\n            if (!isAccessAllowed) {\n                return t('You have no image upload permissions.');\n            }\n            return isImageSelected ? t('Replace image from computer') : t('Upload image from computer');\n        });\n        return button;\n    }\n    /**\n     * Creates a button for the dropdown view, with an icon, text and no tooltip.\n     */\n    _createDropdownButton() {\n        const t = this.editor.locale.t;\n        const imageInsertUI = this.editor.plugins.get('ImageInsertUI');\n        const button = this._createButton(FileDialogButtonView);\n        button.withText = true;\n        button.bind('label').to(imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Replace from computer') : t('Upload from computer'));\n        button.on('execute', () => {\n            imageInsertUI.dropdownView.isOpen = false;\n        });\n        return button;\n    }\n    /**\n     * Creates a button for the menu bar.\n     */\n    _createMenuBarButton(type) {\n        const t = this.editor.locale.t;\n        const button = this._createButton(MenuBarMenuListItemFileDialogButtonView);\n        button.withText = true;\n        switch (type) {\n            case 'standalone':\n                button.label = t('Image from computer');\n                break;\n            case 'insertOnly':\n                button.label = t('Image');\n                break;\n            case 'insertNested':\n                button.label = t('From computer');\n                break;\n        }\n        return button;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a3 3 0 0 1-.414-.287 3 3 0 0 1-1.055-2.03 3 3 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.13 2.13 0 0 0-1.875-.978\\\"/><path d=\\\"M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.8.8 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79\\\"/><path d=\\\"M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.8.8 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageupload/imageuploadprogress\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FileRepository } from 'ckeditor5/src/upload.js';\nimport '../../theme/imageuploadprogress.css';\nimport '../../theme/imageuploadicon.css';\nimport '../../theme/imageuploadloader.css';\n/**\n * The image upload progress plugin.\n * It shows a placeholder when the image is read from the disk and a progress bar while the image is uploading.\n */\nexport class ImageUploadProgress extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageUploadProgress';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * The image placeholder that is displayed before real image data can be accessed.\n     *\n     * For the record, this image is a 1x1 px GIF with an aspect ratio set by CSS.\n     */\n    placeholder;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this.placeholder = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Upload status change - update image's view according to that status.\n        if (editor.plugins.has('ImageBlockEditing')) {\n            editor.editing.downcastDispatcher.on('attribute:uploadStatus:imageBlock', this.uploadStatusChange);\n        }\n        if (editor.plugins.has('ImageInlineEditing')) {\n            editor.editing.downcastDispatcher.on('attribute:uploadStatus:imageInline', this.uploadStatusChange);\n        }\n    }\n    /**\n     * This method is called each time the image `uploadStatus` attribute is changed.\n     *\n     * @param evt An object containing information about the fired event.\n     * @param data Additional information about the change.\n     */\n    uploadStatusChange = (evt, data, conversionApi) => {\n        const editor = this.editor;\n        const modelImage = data.item;\n        const uploadId = modelImage.getAttribute('uploadId');\n        if (!conversionApi.consumable.consume(data.item, evt.name)) {\n            return;\n        }\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const fileRepository = editor.plugins.get(FileRepository);\n        const status = uploadId ? data.attributeNewValue : null;\n        const placeholder = this.placeholder;\n        const viewFigure = editor.editing.mapper.toViewElement(modelImage);\n        const viewWriter = conversionApi.writer;\n        if (status == 'reading') {\n            // Start \"appearing\" effect and show placeholder with infinite progress bar on the top\n            // while image is read from disk.\n            _startAppearEffect(viewFigure, viewWriter);\n            _showPlaceholder(imageUtils, placeholder, viewFigure, viewWriter);\n            return;\n        }\n        // Show progress bar on the top of the image when image is uploading.\n        if (status == 'uploading') {\n            const loader = fileRepository.loaders.get(uploadId);\n            // Start appear effect if needed - see https://github.com/ckeditor/ckeditor5-image/issues/191.\n            _startAppearEffect(viewFigure, viewWriter);\n            if (!loader) {\n                // There is no loader associated with uploadId - this means that image came from external changes.\n                // In such cases we still want to show the placeholder until image is fully uploaded.\n                // Show placeholder if needed - see https://github.com/ckeditor/ckeditor5-image/issues/191.\n                _showPlaceholder(imageUtils, placeholder, viewFigure, viewWriter);\n            }\n            else {\n                // Hide placeholder and initialize progress bar showing upload progress.\n                _hidePlaceholder(viewFigure, viewWriter);\n                _showProgressBar(viewFigure, viewWriter, loader, editor.editing.view);\n                _displayLocalImage(imageUtils, viewFigure, viewWriter, loader);\n            }\n            return;\n        }\n        if (status == 'complete' && fileRepository.loaders.get(uploadId)) {\n            _showCompleteIcon(viewFigure, viewWriter, editor.editing.view);\n        }\n        // Clean up.\n        _hideProgressBar(viewFigure, viewWriter);\n        _hidePlaceholder(viewFigure, viewWriter);\n        _stopAppearEffect(viewFigure, viewWriter);\n    };\n}\n/**\n * Adds ck-appear class to the image figure if one is not already applied.\n */\nfunction _startAppearEffect(viewFigure, writer) {\n    if (!viewFigure.hasClass('ck-appear')) {\n        writer.addClass('ck-appear', viewFigure);\n    }\n}\n/**\n * Removes ck-appear class to the image figure if one is not already removed.\n */\nfunction _stopAppearEffect(viewFigure, writer) {\n    writer.removeClass('ck-appear', viewFigure);\n}\n/**\n * Shows placeholder together with infinite progress bar on given image figure.\n */\nfunction _showPlaceholder(imageUtils, placeholder, viewFigure, writer) {\n    if (!viewFigure.hasClass('ck-image-upload-placeholder')) {\n        writer.addClass('ck-image-upload-placeholder', viewFigure);\n    }\n    const viewImg = imageUtils.findViewImgElement(viewFigure);\n    if (viewImg.getAttribute('src') !== placeholder) {\n        writer.setAttribute('src', placeholder, viewImg);\n    }\n    if (!_getUIElement(viewFigure, 'placeholder')) {\n        writer.insert(writer.createPositionAfter(viewImg), _createPlaceholder(writer));\n    }\n}\n/**\n * Removes placeholder together with infinite progress bar on given image figure.\n */\nfunction _hidePlaceholder(viewFigure, writer) {\n    if (viewFigure.hasClass('ck-image-upload-placeholder')) {\n        writer.removeClass('ck-image-upload-placeholder', viewFigure);\n    }\n    _removeUIElement(viewFigure, writer, 'placeholder');\n}\n/**\n * Shows progress bar displaying upload progress.\n * Attaches it to the file loader to update when upload percentace is changed.\n */\nfunction _showProgressBar(viewFigure, writer, loader, view) {\n    const progressBar = _createProgressBar(writer);\n    writer.insert(writer.createPositionAt(viewFigure, 'end'), progressBar);\n    // Update progress bar width when uploadedPercent is changed.\n    loader.on('change:uploadedPercent', (evt, name, value) => {\n        view.change(writer => {\n            writer.setStyle('width', value + '%', progressBar);\n        });\n    });\n}\n/**\n * Hides upload progress bar.\n */\nfunction _hideProgressBar(viewFigure, writer) {\n    _removeUIElement(viewFigure, writer, 'progressBar');\n}\n/**\n * Shows complete icon and hides after a certain amount of time.\n */\nfunction _showCompleteIcon(viewFigure, writer, view) {\n    const completeIcon = writer.createUIElement('div', { class: 'ck-image-upload-complete-icon' });\n    writer.insert(writer.createPositionAt(viewFigure, 'end'), completeIcon);\n    setTimeout(() => {\n        view.change(writer => writer.remove(writer.createRangeOn(completeIcon)));\n    }, 3000);\n}\n/**\n * Create progress bar element using {@link module:engine/view/uielement~ViewUIElement}.\n */\nfunction _createProgressBar(writer) {\n    const progressBar = writer.createUIElement('div', { class: 'ck-progress-bar' });\n    writer.setCustomProperty('progressBar', true, progressBar);\n    return progressBar;\n}\n/**\n * Create placeholder element using {@link module:engine/view/uielement~ViewUIElement}.\n */\nfunction _createPlaceholder(writer) {\n    const placeholder = writer.createUIElement('div', { class: 'ck-upload-placeholder-loader' });\n    writer.setCustomProperty('placeholder', true, placeholder);\n    return placeholder;\n}\n/**\n * Returns {@link module:engine/view/uielement~ViewUIElement} of given unique property from image figure element.\n * Returns `undefined` if element is not found.\n */\nfunction _getUIElement(imageFigure, uniqueProperty) {\n    for (const child of imageFigure.getChildren()) {\n        if (child.getCustomProperty(uniqueProperty)) {\n            return child;\n        }\n    }\n}\n/**\n * Removes {@link module:engine/view/uielement~ViewUIElement} of given unique property from image figure element.\n */\nfunction _removeUIElement(viewFigure, writer, uniqueProperty) {\n    const element = _getUIElement(viewFigure, uniqueProperty);\n    if (element) {\n        writer.remove(writer.createRangeOn(element));\n    }\n}\n/**\n * Displays local data from file loader.\n */\nfunction _displayLocalImage(imageUtils, viewFigure, writer, loader) {\n    if (loader.data) {\n        const viewImg = imageUtils.findViewImgElement(viewFigure);\n        writer.setAttribute('src', loader.data, viewImg);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module ui/notification/notification\n */\nimport { ContextPlugin } from '@ckeditor/ckeditor5-core';\n/**\n * The Notification plugin.\n *\n * This plugin sends a few types of notifications: `success`, `info` and `warning`. The notifications need to be\n * handled and displayed by a plugin responsible for showing the UI of the notifications. Using this plugin for dispatching\n * notifications makes it possible to switch the notifications UI.\n *\n * Note that every unhandled and not stopped `warning` notification will be displayed as a system alert.\n * See {@link module:ui/notification/notification~Notification#showWarning}.\n */\nexport class Notification extends ContextPlugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Notification';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        // Each unhandled and not stopped `show:warning` event is displayed as a system alert.\n        this.on('show:warning', (evt, data) => {\n            window.alert(data.message); // eslint-disable-line no-alert\n        }, { priority: 'lowest' });\n    }\n    /**\n     * Shows a success notification.\n     *\n     * By default, it fires the {@link #event:show:success `show:success` event} with the given `data`. The event namespace can be extended\n     * using the `data.namespace` option. For example:\n     *\n     * ```ts\n     * showSuccess( 'Image is uploaded.', {\n     * \tnamespace: 'upload:image'\n     * } );\n     * ```\n     *\n     * will fire the `show:success:upload:image` event.\n     *\n     * You can provide the title of the notification:\n     *\n     * ```ts\n     * showSuccess( 'Image is uploaded.', {\n     * \ttitle: 'Image upload success'\n     * } );\n     * ```\n     *\n     * @param message The content of the notification.\n     * @param data Additional data.\n     * @param data.namespace Additional event namespace.\n     * @param data.title The title of the notification.\n     */\n    showSuccess(message, data = {}) {\n        this._showNotification({\n            message,\n            type: 'success',\n            namespace: data.namespace,\n            title: data.title\n        });\n    }\n    /**\n     * Shows an information notification.\n     *\n     * By default, it fires the {@link #event:show:info `show:info` event} with the given `data`. The event namespace can be extended\n     * using the `data.namespace` option. For example:\n     *\n     * ```ts\n     * showInfo( 'Editor is offline.', {\n     * \tnamespace: 'editor:status'\n     * } );\n     * ```\n     *\n     * will fire the `show:info:editor:status` event.\n     *\n     * You can provide the title of the notification:\n     *\n     * ```ts\n     * showInfo( 'Editor is offline.', {\n     * \ttitle: 'Network information'\n     * } );\n     * ```\n     *\n     * @param message The content of the notification.\n     * @param data Additional data.\n     * @param data.namespace Additional event namespace.\n     * @param data.title The title of the notification.\n     */\n    showInfo(message, data = {}) {\n        this._showNotification({\n            message,\n            type: 'info',\n            namespace: data.namespace,\n            title: data.title\n        });\n    }\n    /**\n     * Shows a warning notification.\n     *\n     * By default, it fires the {@link #event:show:warning `show:warning` event}\n     * with the given `data`. The event namespace can be extended using the `data.namespace` option. For example:\n     *\n     * ```ts\n     * showWarning( 'Image upload error.', {\n     * \tnamespace: 'upload:image'\n     * } );\n     * ```\n     *\n     * will fire the `show:warning:upload:image` event.\n     *\n     * You can provide the title of the notification:\n     *\n     * ```ts\n     * showWarning( 'Image upload error.', {\n     * \ttitle: 'Upload failed'\n     * } );\n     * ```\n     *\n     * Note that each unhandled and not stopped `warning` notification will be displayed as a system alert.\n     * The plugin responsible for displaying warnings should `stop()` the event to prevent displaying it as an alert:\n     *\n     * ```ts\n     * notifications.on( 'show:warning', ( evt, data ) => {\n     * \t// Do something with the data.\n     *\n     * \t// Stop this event to prevent displaying it as an alert.\n     * \tevt.stop();\n     * } );\n     * ```\n     *\n     * You can attach many listeners to the same event and `stop()` this event in a listener with a low priority:\n     *\n     * ```ts\n     * notifications.on( 'show:warning', ( evt, data ) => {\n     * \t// Show the warning in the UI, but do not stop it.\n     * } );\n     *\n     * notifications.on( 'show:warning', ( evt, data ) => {\n     * \t// Log the warning to some error tracker.\n     *\n     * \t// Stop this event to prevent displaying it as an alert.\n     * \tevt.stop();\n     * }, { priority: 'low' } );\n     * ```\n     *\n     * @param message The content of the notification.\n     * @param data Additional data.\n     * @param data.namespace Additional event namespace.\n     * @param data.title The title of the notification.\n     */\n    showWarning(message, data = {}) {\n        this._showNotification({\n            message,\n            type: 'warning',\n            namespace: data.namespace,\n            title: data.title\n        });\n    }\n    /**\n     * Fires the `show` event with the specified type, namespace and message.\n     *\n     * @param data The message data.\n     * @param data.message The content of the notification.\n     * @param data.type The type of the message.\n     * @param data.namespace Additional event namespace.\n     * @param data.title The title of the notification.\n     */\n    _showNotification(data) {\n        const event = data.namespace ?\n            `show:${data.type}:${data.namespace}` :\n            `show:${data.type}`;\n        this.fire(event, {\n            message: data.message,\n            type: data.type,\n            title: data.title || ''\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { FileRepository } from 'ckeditor5/src/upload.js';\nimport { Command } from 'ckeditor5/src/core.js';\nimport { toArray } from 'ckeditor5/src/utils.js';\n/**\n * @module image/imageupload/uploadimagecommand\n */\n/**\n * The upload image command.\n *\n * The command is registered by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin as `uploadImage`\n * and it is also available via aliased `imageUpload` name.\n *\n * In order to upload an image at the current selection position\n * (according to the {@link module:widget/utils~findOptimalInsertionRange} algorithm),\n * execute the command and pass the native image file instance:\n *\n * ```ts\n * this.listenTo( editor.editing.view.document, 'clipboardInput', ( evt, data ) => {\n * \t// Assuming that only images were pasted:\n * \tconst images = Array.from( data.dataTransfer.files );\n *\n * \t// Upload the first image:\n * \teditor.execute( 'uploadImage', { file: images[ 0 ] } );\n * } );\n * ```\n *\n * It is also possible to insert multiple images at once:\n *\n * ```ts\n * editor.execute( 'uploadImage', {\n * \tfile: [\n * \t\tfile1,\n * \t\tfile2\n * \t]\n * } );\n * ```\n */\nexport class UploadImageCommand extends Command {\n    /**\n     * Creates an instance of the `imageUlpoad` command. When executed, the command upload one of\n     * the currently selected image from computer.\n     *\n     * @param editor The editor instance.\n     */\n    constructor(editor) {\n        super(editor);\n        this.set('isAccessAllowed', true);\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const selectedElement = editor.model.document.selection.getSelectedElement();\n        // TODO: This needs refactoring.\n        this.isEnabled = imageUtils.isImageAllowed() || imageUtils.isImage(selectedElement);\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     * @param options Options for the executed command.\n     * @param options.file The image file or an array of image files to upload.\n     */\n    execute(options) {\n        const files = toArray(options.file);\n        const selection = this.editor.model.document.selection;\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        // In case of multiple files, each file (starting from the 2nd) will be inserted at a position that\n        // follows the previous one. That will move the selection and, to stay on the safe side and make sure\n        // all images inherit the same selection attributes, they are collected beforehand.\n        //\n        // Applying these attributes ensures, for instance, that inserting an (inline) image into a link does\n        // not split that link but preserves its continuity.\n        //\n        // Note: Selection attributes that do not make sense for images will be filtered out by insertImage() anyway.\n        const selectionAttributes = Object.fromEntries(selection.getAttributes());\n        files.forEach((file, index) => {\n            const selectedElement = selection.getSelectedElement();\n            // Inserting of an inline image replace the selected element and make a selection on the inserted image.\n            // Therefore inserting multiple inline images requires creating position after each element.\n            if (index && selectedElement && imageUtils.isImage(selectedElement)) {\n                const position = this.editor.model.createPositionAfter(selectedElement);\n                this._uploadImage(file, selectionAttributes, position);\n            }\n            else {\n                this._uploadImage(file, selectionAttributes);\n            }\n        });\n    }\n    /**\n     * Handles uploading single file.\n     */\n    _uploadImage(file, attributes, position) {\n        const editor = this.editor;\n        const fileRepository = editor.plugins.get(FileRepository);\n        const loader = fileRepository.createLoader(file);\n        const imageUtils = editor.plugins.get('ImageUtils');\n        // Do not throw when upload adapter is not set. FileRepository will log an error anyway.\n        if (!loader) {\n            return;\n        }\n        imageUtils.insertImage({ ...attributes, uploadId: loader.id }, position);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageupload/imageuploadediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { Notification } from 'ckeditor5/src/ui.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport { FileRepository } from 'ckeditor5/src/upload.js';\nimport { env } from 'ckeditor5/src/utils.js';\nimport { ImageUtils } from '../imageutils.js';\nimport { UploadImageCommand } from './uploadimagecommand.js';\nimport { fetchLocalImage, isLocalImage } from '../../src/imageupload/utils.js';\nimport { createImageTypeRegExp } from './utils.js';\n/**\n * The editing part of the image upload feature. It registers the `'uploadImage'` command\n * and the `imageUpload` command as an aliased name.\n *\n * When an image is uploaded, it fires the {@link ~ImageUploadEditing#event:uploadComplete `uploadComplete`} event\n * that allows adding custom attributes to the {@link module:engine/model/element~ModelElement image element}.\n */\nexport class ImageUploadEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FileRepository, Notification, ClipboardPipeline, ImageUtils];\n    }\n    static get pluginName() {\n        return 'ImageUploadEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * An internal mapping of {@link module:upload/filerepository~FileLoader#id file loader UIDs} and\n     * model elements during the upload.\n     *\n     * Model element of the uploaded image can change, for instance, when {@link module:image/image/imagetypecommand~ImageTypeCommand}\n     * is executed as a result of adding caption or changing image style. As a result, the upload logic must keep track of the model\n     * element (reference) and resolve the upload for the correct model element (instead of the one that landed in the `$graveyard`\n     * after image type changed).\n     */\n    _uploadImageElements;\n    /**\n     * An internal mapping of {@link module:upload/filerepository~FileLoader#id file loader UIDs} and\n     * upload responses for handling images dragged during their upload process. When such images are later\n     * dropped, their original upload IDs no longer exist in the registry (as the original upload completed).\n     * This map preserves the upload responses to properly handle such cases.\n     */\n    _uploadedImages = new Map();\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('image', {\n            upload: {\n                types: ['jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff']\n            }\n        });\n        this._uploadImageElements = new Map();\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const doc = editor.model.document;\n        const conversion = editor.conversion;\n        const fileRepository = editor.plugins.get(FileRepository);\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const clipboardPipeline = editor.plugins.get('ClipboardPipeline');\n        const imageTypes = createImageTypeRegExp(editor.config.get('image.upload.types'));\n        const uploadImageCommand = new UploadImageCommand(editor);\n        // Register `uploadImage` command and add `imageUpload` command as an alias for backward compatibility.\n        editor.commands.add('uploadImage', uploadImageCommand);\n        editor.commands.add('imageUpload', uploadImageCommand);\n        // Register upcast converter for uploadId.\n        conversion.for('upcast')\n            .attributeToAttribute({\n            view: {\n                name: 'img',\n                key: 'uploadId'\n            },\n            model: 'uploadId'\n        })\n            // Handle the case when the image is not fully uploaded yet but it's being moved.\n            // See more: https://github.com/ckeditor/ckeditor5/pull/17327\n            .add(dispatcher => dispatcher.on('element:img', (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.test(data.viewItem, { attributes: ['data-ck-upload-id'] })) {\n                return;\n            }\n            const uploadId = data.viewItem.getAttribute('data-ck-upload-id');\n            if (!uploadId) {\n                return;\n            }\n            const [modelElement] = Array.from(data.modelRange.getItems({ shallow: true }));\n            const loader = fileRepository.loaders.get(uploadId);\n            if (modelElement) {\n                // Handle case when `uploadId` is set on the image element but the loader is not present in the registry.\n                // It may happen when the image was successfully uploaded and the loader was removed from the registry.\n                // It's still present in the `_uploadedImages` map though. It's why we do not place this line in the condition below.\n                conversionApi.writer.setAttribute('uploadId', uploadId, modelElement);\n                conversionApi.consumable.consume(data.viewItem, { attributes: ['data-ck-upload-id'] });\n                if (loader && loader.data) {\n                    conversionApi.writer.setAttribute('uploadStatus', loader.status, modelElement);\n                }\n            }\n        }, { priority: 'low' }));\n        // Handle pasted images.\n        // For every image file, a new file loader is created and a placeholder image is\n        // inserted into the content. Then, those images are uploaded once they appear in the model\n        // (see Document#change listener below).\n        this.listenTo(editor.editing.view.document, 'clipboardInput', (evt, data) => {\n            // Skip if non empty HTML data is included.\n            // https://github.com/ckeditor/ckeditor5-upload/issues/68\n            if (isHtmlInDataTransfer(data.dataTransfer)) {\n                return;\n            }\n            const images = Array.from(data.dataTransfer.files).filter(file => {\n                // See https://github.com/ckeditor/ckeditor5-image/pull/254.\n                if (!file) {\n                    return false;\n                }\n                return imageTypes.test(file.type);\n            });\n            if (!images.length) {\n                return;\n            }\n            evt.stop();\n            editor.model.change(writer => {\n                // Set selection to paste target.\n                if (data.targetRanges) {\n                    writer.setSelection(data.targetRanges.map(viewRange => editor.editing.mapper.toModelRange(viewRange)));\n                }\n                editor.execute('uploadImage', { file: images });\n            });\n            const uploadImageCommand = editor.commands.get('uploadImage');\n            if (!uploadImageCommand.isAccessAllowed) {\n                const notification = editor.plugins.get('Notification');\n                const t = editor.locale.t;\n                notification.showWarning(t('You have no image upload permissions.'), {\n                    namespace: 'image'\n                });\n            }\n        });\n        // Handle HTML pasted with images with base64 or blob sources.\n        // For every image file, a new file loader is created and a placeholder image is\n        // inserted into the content. Then, those images are uploaded once they appear in the model\n        // (see Document#change listener below).\n        this.listenTo(clipboardPipeline, 'inputTransformation', (evt, data) => {\n            const fetchableImages = Array.from(editor.editing.view.createRangeIn(data.content))\n                .map(value => value.item)\n                .filter(viewElement => isLocalImage(imageUtils, viewElement) &&\n                !viewElement.getAttribute('uploadProcessed'))\n                .map(viewElement => { return { promise: fetchLocalImage(viewElement), imageElement: viewElement }; });\n            if (!fetchableImages.length) {\n                return;\n            }\n            const writer = new ViewUpcastWriter(editor.editing.view.document);\n            for (const fetchableImage of fetchableImages) {\n                // Set attribute marking that the image was processed already.\n                writer.setAttribute('uploadProcessed', true, fetchableImage.imageElement);\n                const loader = fileRepository.createLoader(fetchableImage.promise);\n                if (loader) {\n                    writer.setAttribute('src', '', fetchableImage.imageElement);\n                    writer.setAttribute('uploadId', loader.id, fetchableImage.imageElement);\n                }\n            }\n        });\n        // Prevents from the browser redirecting to the dropped image.\n        editor.editing.view.document.on('dragover', (evt, data) => {\n            data.preventDefault();\n        });\n        // Upload placeholder images that appeared in the model.\n        doc.on('change', () => {\n            // Note: Reversing changes to start with insertions and only then handle removals. If it was the other way around,\n            // loaders for **all** images that land in the $graveyard would abort while in fact only those that were **not** replaced\n            // by other images should be aborted.\n            const changes = doc.differ.getChanges({ includeChangesInGraveyard: true }).reverse();\n            const insertedImagesIds = new Set();\n            for (const entry of changes) {\n                if (entry.type == 'insert' && entry.name != '$text') {\n                    const item = entry.position.nodeAfter;\n                    const isInsertedInGraveyard = entry.position.root.rootName == '$graveyard';\n                    for (const imageElement of getImagesFromChangeItem(editor, item)) {\n                        // Check if the image element still has upload id.\n                        const uploadId = imageElement.getAttribute('uploadId');\n                        const uploadStatus = imageElement.getAttribute('uploadStatus');\n                        // Check if status is complete to ensure that there were no additional reconversions\n                        // in the same batch that set the status to 'complete'. It may happen when list item\n                        // performed refresh of its children (including images) because `uploadStatus` attribute\n                        // has been changed.\n                        if (!uploadId || uploadStatus == 'complete') {\n                            continue;\n                        }\n                        // Check if the image is loaded on this client.\n                        const loader = fileRepository.loaders.get(uploadId);\n                        if (!loader) {\n                            // If the loader does not exist, it means that the image was already uploaded\n                            // and the loader promise was removed from the registry. In that scenario we need\n                            // to restore response object from the internal map.\n                            if (!isInsertedInGraveyard && this._uploadedImages.has(uploadId)) {\n                                // Fire `uploadComplete` to set proper attributes on the image element.\n                                editor.model.enqueueChange({ isUndoable: false }, writer => {\n                                    writer.setAttribute('uploadStatus', 'complete', imageElement);\n                                    this.fire('uploadComplete', {\n                                        data: this._uploadedImages.get(uploadId),\n                                        imageElement: imageElement\n                                    });\n                                });\n                                // While it makes sense to remove the image from the `_uploadedImages` map here,\n                                // it's counterintuitive for the user that pastes image in uploading several times.\n                                // It'll work the first time, but the next time the image will be empty because the\n                                // `_uploadedImages` no longer contain the response.\n                            }\n                            continue;\n                        }\n                        if (isInsertedInGraveyard) {\n                            // If the image was inserted to the graveyard for good (**not** replaced by another image),\n                            // only then abort the loading process.\n                            if (!insertedImagesIds.has(uploadId)) {\n                                // ... but abort it only if all remain images that share the same loader are in the graveyard too.\n                                // This is to prevent situation when we have two images in uploading state and one of them is being\n                                // placed in the graveyard (e.g. using undo). The other one should not be aborted.\n                                const allImagesThatShareUploaderInGraveyard = Array\n                                    .from(this._uploadImageElements.get(uploadId))\n                                    .every(element => element.root.rootName == '$graveyard');\n                                if (allImagesThatShareUploaderInGraveyard) {\n                                    loader.abort();\n                                }\n                            }\n                        }\n                        else {\n                            // Remember the upload id of the inserted image. If it acted as a replacement for another\n                            // image (which landed in the $graveyard), the related loader will not be aborted because\n                            // this is still the same image upload.\n                            insertedImagesIds.add(uploadId);\n                            // Keep the mapping between the upload ID and the image model element so the upload\n                            // can later resolve in the context of the correct model element. The model element could\n                            // change for the same upload if one image was replaced by another (e.g. image type was changed),\n                            // so this may also replace an existing mapping.\n                            if (!this._uploadImageElements.has(uploadId)) {\n                                this._uploadImageElements.set(uploadId, new Set([imageElement]));\n                            }\n                            else {\n                                this._uploadImageElements.get(uploadId).add(imageElement);\n                            }\n                            if (loader.status == 'idle') {\n                                // If the image was inserted into content and has not been loaded yet, start loading it.\n                                this._readAndUpload(loader);\n                            }\n                        }\n                    }\n                }\n            }\n        });\n        // Set the default handler for feeding the image element with `src` and `srcset` attributes.\n        // Also set the natural `width` and `height` attributes (if not already set).\n        this.on('uploadComplete', (evt, { imageElement, data }) => {\n            const urls = data.urls ? data.urls : data;\n            this.editor.model.change(writer => {\n                writer.setAttribute('src', urls.default, imageElement);\n                this._parseAndSetSrcsetAttributeOnImage(urls, imageElement, writer);\n                imageUtils.setImageNaturalSizeAttributes(imageElement);\n            });\n        }, { priority: 'low' });\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const schema = this.editor.model.schema;\n        // Setup schema to allow uploadId and uploadStatus for images.\n        // Wait for ImageBlockEditing or ImageInlineEditing to register their elements first,\n        // that's why doing this in afterInit() instead of init().\n        if (this.editor.plugins.has('ImageBlockEditing')) {\n            schema.extend('imageBlock', {\n                allowAttributes: ['uploadId', 'uploadStatus']\n            });\n            this._registerConverters('imageBlock');\n        }\n        if (this.editor.plugins.has('ImageInlineEditing')) {\n            schema.extend('imageInline', {\n                allowAttributes: ['uploadId', 'uploadStatus']\n            });\n            this._registerConverters('imageInline');\n        }\n    }\n    /**\n     * Reads and uploads an image.\n     *\n     * The image is read from the disk and as a Base64-encoded string it is set temporarily to\n     * `image[src]`. When the image is successfully uploaded, the temporary data is replaced with the target\n     * image's URL (the URL to the uploaded image on the server).\n     */\n    _readAndUpload(loader) {\n        const editor = this.editor;\n        const model = editor.model;\n        const t = editor.locale.t;\n        const fileRepository = editor.plugins.get(FileRepository);\n        const notification = editor.plugins.get(Notification);\n        const imageUtils = editor.plugins.get('ImageUtils');\n        const imageUploadElements = this._uploadImageElements;\n        model.enqueueChange({ isUndoable: false }, writer => {\n            const elements = imageUploadElements.get(loader.id);\n            for (const element of elements) {\n                writer.setAttribute('uploadStatus', 'reading', element);\n            }\n        });\n        return loader.read()\n            .then(() => {\n            const promise = loader.upload();\n            if (editor.ui) {\n                editor.ui.ariaLiveAnnouncer.announce(t('Uploading image'));\n            }\n            for (const imageElement of imageUploadElements.get(loader.id)) {\n                // Force re–paint in Safari. Without it, the image will display with a wrong size.\n                // https://github.com/ckeditor/ckeditor5/issues/1975\n                /* istanbul ignore next -- @preserve */\n                if (env.isSafari) {\n                    const viewFigure = editor.editing.mapper.toViewElement(imageElement);\n                    const viewImg = imageUtils.findViewImgElement(viewFigure);\n                    editor.editing.view.once('render', () => {\n                        // Early returns just to be safe. There might be some code ran\n                        // in between the outer scope and this callback.\n                        if (!viewImg.parent) {\n                            return;\n                        }\n                        const domFigure = editor.editing.view.domConverter.mapViewToDom(viewImg.parent);\n                        if (!domFigure) {\n                            return;\n                        }\n                        const originalDisplay = domFigure.style.display;\n                        domFigure.style.display = 'none';\n                        // Make sure this line will never be removed during minification for having \"no effect\".\n                        domFigure._ckHack = domFigure.offsetHeight;\n                        domFigure.style.display = originalDisplay;\n                    });\n                }\n                model.enqueueChange({ isUndoable: false }, writer => {\n                    writer.setAttribute('uploadStatus', 'uploading', imageElement);\n                });\n            }\n            return promise;\n        })\n            .then(data => {\n            model.enqueueChange({ isUndoable: false }, writer => {\n                for (const imageElement of imageUploadElements.get(loader.id)) {\n                    writer.setAttribute('uploadStatus', 'complete', imageElement);\n                    this.fire('uploadComplete', { data, imageElement });\n                }\n                if (editor.ui) {\n                    editor.ui.ariaLiveAnnouncer.announce(t('Image upload complete'));\n                }\n                this._uploadedImages.set(loader.id, data);\n            });\n            clean();\n        })\n            .catch(error => {\n            if (editor.ui) {\n                editor.ui.ariaLiveAnnouncer.announce(t('Error during image upload'));\n            }\n            // If status is not 'error' nor 'aborted' - throw error because it means that something else went wrong,\n            // it might be generic error and it would be real pain to find what is going on.\n            if (loader.status !== 'error' && loader.status !== 'aborted') {\n                throw error;\n            }\n            // Might be 'aborted'.\n            if (loader.status == 'error' && error) {\n                notification.showWarning(error, {\n                    title: t('Upload failed'),\n                    namespace: 'upload'\n                });\n            }\n            // Permanently remove image from insertion batch.\n            model.enqueueChange({ isUndoable: false }, writer => {\n                for (const imageElement of imageUploadElements.get(loader.id)) {\n                    // Handle situation when the image has been removed and then `abort` exception was thrown.\n                    // See: https://github.com/ckeditor/ckeditor5-commercial/issues/6817\n                    if (imageElement.root.rootName !== '$graveyard') {\n                        writer.remove(imageElement);\n                    }\n                }\n            });\n            clean();\n        });\n        function clean() {\n            model.enqueueChange({ isUndoable: false }, writer => {\n                for (const imageElement of imageUploadElements.get(loader.id)) {\n                    writer.removeAttribute('uploadId', imageElement);\n                    writer.removeAttribute('uploadStatus', imageElement);\n                }\n                imageUploadElements.delete(loader.id);\n            });\n            fileRepository.destroyLoader(loader);\n        }\n    }\n    /**\n     * Creates the `srcset` attribute based on a given file upload response and sets it as an attribute to a specific image element.\n     *\n     * @param data Data object from which `srcset` will be created.\n     * @param image The image element on which the `srcset` attribute will be set.\n     */\n    _parseAndSetSrcsetAttributeOnImage(data, image, writer) {\n        // Srcset attribute for responsive images support.\n        let maxWidth = 0;\n        const srcsetAttribute = Object.keys(data)\n            // Filter out keys that are not integers.\n            .filter(key => {\n            const width = parseInt(key, 10);\n            if (!isNaN(width)) {\n                maxWidth = Math.max(maxWidth, width);\n                return true;\n            }\n        })\n            // Convert each key to srcset entry.\n            .map(key => `${data[key]} ${key}w`)\n            // Join all entries.\n            .join(', ');\n        if (srcsetAttribute != '') {\n            const attributes = {\n                srcset: srcsetAttribute\n            };\n            if (!image.hasAttribute('width') && !image.hasAttribute('height')) {\n                attributes.width = maxWidth;\n            }\n            writer.setAttributes(attributes, image);\n        }\n    }\n    /**\n     * Registers image upload converters.\n     *\n     * @param imageType The type of the image.\n     */\n    _registerConverters(imageType) {\n        const { conversion, plugins } = this.editor;\n        const fileRepository = plugins.get(FileRepository);\n        const imageUtils = plugins.get(ImageUtils);\n        // It sets `data-ck-upload-id` attribute on the view image elements that are not fully uploaded.\n        // It avoids the situation when image disappears when it's being moved and upload is not finished yet.\n        // See more: https://github.com/ckeditor/ckeditor5/issues/16967\n        conversion.for('dataDowncast').add(dispatcher => {\n            dispatcher.on(`attribute:uploadId:${imageType}`, (evt, data, conversionApi) => {\n                if (!conversionApi.consumable.test(data.item, evt.name)) {\n                    return;\n                }\n                const loader = fileRepository.loaders.get(data.attributeNewValue);\n                if (!loader || !loader.data) {\n                    return null;\n                }\n                const viewElement = conversionApi.mapper.toViewElement(data.item);\n                const img = imageUtils.findViewImgElement(viewElement);\n                if (img) {\n                    conversionApi.consumable.consume(data.item, evt.name);\n                    conversionApi.writer.setAttribute('data-ck-upload-id', loader.id, img);\n                }\n            });\n        });\n    }\n}\n/**\n * TODO move this to the clipboard package.\n *\n * Returns `true` if non-empty `text/html` is included in the data transfer.\n */\nexport function isHtmlInDataTransfer(dataTransfer) {\n    return Array.from(dataTransfer.types).includes('text/html') && dataTransfer.getData('text/html') !== '';\n}\nfunction getImagesFromChangeItem(editor, item) {\n    const imageUtils = editor.plugins.get('ImageUtils');\n    return Array.from(editor.model.createRangeOn(item))\n        .filter(value => imageUtils.isImage(value.item))\n        .map(value => value.item);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageupload\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageUploadUI } from './imageupload/imageuploadui.js';\nimport { ImageUploadProgress } from './imageupload/imageuploadprogress.js';\nimport { ImageUploadEditing } from './imageupload/imageuploadediting.js';\n/**\n * The image upload plugin.\n *\n * For a detailed overview, check the {@glink features/images/image-upload/image-upload image upload feature} documentation.\n *\n * This plugin does not do anything directly, but it loads a set of specific plugins to enable image uploading:\n *\n * * {@link module:image/imageupload/imageuploadediting~ImageUploadEditing},\n * * {@link module:image/imageupload/imageuploadui~ImageUploadUI},\n * * {@link module:image/imageupload/imageuploadprogress~ImageUploadProgress}.\n */\nexport class ImageUpload extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageUpload';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUploadEditing, ImageUploadUI, ImageUploadProgress];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinsert/ui/imageinserturlview\n */\nimport { View, LabeledFieldView, createLabeledInputText, submitHandler } from 'ckeditor5/src/ui.js';\nimport { KeystrokeHandler } from 'ckeditor5/src/utils.js';\n/**\n * The insert an image via URL view.\n *\n * See {@link module:image/imageinsert/imageinsertviaurlui~ImageInsertViaUrlUI}.\n *\n * @internal\n */\nexport class ImageInsertUrlView extends View {\n    /**\n     * The URL input field view.\n     */\n    urlInputView;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * Creates a view for the dropdown panel of {@link module:image/imageinsert/imageinsertui~ImageInsertUI}.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.set('imageURLInputValue', '');\n        this.set('isImageSelected', false);\n        this.set('isEnabled', true);\n        this.keystrokes = new KeystrokeHandler();\n        this.urlInputView = this._createUrlInputView();\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-image-insert-url'\n                ],\n                tabindex: '-1'\n            },\n            children: [\n                this.urlInputView,\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-image-insert-url__action-row'\n                        ]\n                    }\n                }\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({\n            view: this\n        });\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Creates the {@link #urlInputView}.\n     */\n    _createUrlInputView() {\n        const locale = this.locale;\n        const t = locale.t;\n        const urlInputView = new LabeledFieldView(locale, createLabeledInputText);\n        urlInputView.bind('label').to(this, 'isImageSelected', value => value ? t('Update image URL') : t('Insert image via URL'));\n        urlInputView.bind('isEnabled').to(this);\n        urlInputView.fieldView.inputMode = 'url';\n        urlInputView.fieldView.placeholder = 'https://example.com/image.png';\n        urlInputView.fieldView.bind('value').to(this, 'imageURLInputValue', (value) => value || '');\n        urlInputView.fieldView.on('input', () => {\n            this.imageURLInputValue = urlInputView.fieldView.element.value.trim();\n        });\n        return urlInputView;\n    }\n    /**\n     * Focuses the view.\n     */\n    focus() {\n        this.urlInputView.focus();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinsert/imageinsertviaurlui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView, Dialog, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport { IconImageUrl } from 'ckeditor5/src/icons.js';\nimport { ImageInsertUI } from './imageinsertui.js';\nimport { ImageInsertUrlView } from './ui/imageinserturlview.js';\n/**\n * The image insert via URL plugin (UI part).\n *\n * The plugin introduces two UI components to the {@link module:ui/componentfactory~ComponentFactory UI component factory}:\n *\n * * the `'insertImageViaUrl'` toolbar button,\n * * the `'menuBar:insertImageViaUrl'` menu bar component.\n *\n * It also integrates with the `insertImage` toolbar component and `menuBar:insertImage` menu component, which are default components\n * through which inserting image via URL is available.\n */\nexport class ImageInsertViaUrlUI extends Plugin {\n    _imageInsertUI;\n    _formView;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageInsertViaUrlUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageInsertUI, Dialog];\n    }\n    init() {\n        this.editor.ui.componentFactory.add('insertImageViaUrl', () => this._createToolbarButton());\n        this.editor.ui.componentFactory.add('menuBar:insertImageViaUrl', () => this._createMenuBarButton('standalone'));\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        this._imageInsertUI = this.editor.plugins.get('ImageInsertUI');\n        this._imageInsertUI.registerIntegration({\n            name: 'url',\n            observable: () => this.editor.commands.get('insertImage'),\n            buttonViewCreator: () => this._createToolbarButton(),\n            formViewCreator: () => this._createDropdownButton(),\n            menuBarButtonViewCreator: isOnly => this._createMenuBarButton(isOnly ? 'insertOnly' : 'insertNested')\n        });\n    }\n    /**\n     * Creates the base for various kinds of the button component provided by this feature.\n     */\n    _createInsertUrlButton(ButtonClass) {\n        const button = new ButtonClass(this.editor.locale);\n        button.icon = IconImageUrl;\n        button.on('execute', () => {\n            this._showModal();\n        });\n        return button;\n    }\n    /**\n     * Creates a simple toolbar button, with an icon and a tooltip.\n     */\n    _createToolbarButton() {\n        const t = this.editor.locale.t;\n        const button = this._createInsertUrlButton(ButtonView);\n        button.tooltip = true;\n        button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Update image URL') : t('Insert image via URL'));\n        return button;\n    }\n    /**\n     * Creates a button for the dropdown view, with an icon, text and no tooltip.\n     */\n    _createDropdownButton() {\n        const t = this.editor.locale.t;\n        const button = this._createInsertUrlButton(ButtonView);\n        button.withText = true;\n        button.bind('label').to(this._imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ? t('Update image URL') : t('Insert via URL'));\n        return button;\n    }\n    /**\n     * Creates a button for the menu bar.\n     */\n    _createMenuBarButton(type) {\n        const t = this.editor.locale.t;\n        const button = this._createInsertUrlButton(MenuBarMenuListItemButtonView);\n        button.withText = true;\n        switch (type) {\n            case 'standalone':\n                button.label = t('Image via URL');\n                break;\n            case 'insertOnly':\n                button.label = t('Image');\n                break;\n            case 'insertNested':\n                button.label = t('Via URL');\n                break;\n        }\n        return button;\n    }\n    /**\n     * Creates the form view used to submit the image URL.\n     */\n    _createInsertUrlView() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const replaceImageSourceCommand = editor.commands.get('replaceImageSource');\n        const insertImageCommand = editor.commands.get('insertImage');\n        const imageInsertUrlView = new ImageInsertUrlView(locale);\n        imageInsertUrlView.bind('isImageSelected').to(this._imageInsertUI);\n        imageInsertUrlView.bind('isEnabled').toMany([insertImageCommand, replaceImageSourceCommand], 'isEnabled', (...isEnabled) => (isEnabled.some(isCommandEnabled => isCommandEnabled)));\n        return imageInsertUrlView;\n    }\n    /**\n     * Shows the insert image via URL form view in a modal.\n     */\n    _showModal() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const t = locale.t;\n        const dialog = editor.plugins.get('Dialog');\n        if (!this._formView) {\n            this._formView = this._createInsertUrlView();\n            this._formView.on('submit', () => this._handleSave());\n        }\n        const replaceImageSourceCommand = editor.commands.get('replaceImageSource');\n        this._formView.imageURLInputValue = replaceImageSourceCommand.value || '';\n        dialog.show({\n            id: 'insertImageViaUrl',\n            title: t('Image via URL'),\n            isModal: true,\n            content: this._formView,\n            actionButtons: [\n                {\n                    label: t('Cancel'),\n                    withText: true,\n                    onExecute: () => dialog.hide()\n                },\n                {\n                    label: this._imageInsertUI.isImageSelected ? t('Save') : t('Insert'),\n                    class: 'ck-button-action',\n                    withText: true,\n                    onExecute: () => this._handleSave()\n                }\n            ]\n        });\n    }\n    /**\n     * Executes appropriate command depending on selection and form value.\n     */\n    _handleSave() {\n        const replaceImageSourceCommand = this.editor.commands.get('replaceImageSource');\n        // If an image element is currently selected, we want to replace its source attribute (instead of inserting a new image).\n        // We detect if an image is selected by checking `replaceImageSource` command state.\n        if (replaceImageSourceCommand.isEnabled) {\n            this.editor.execute('replaceImageSource', { source: this._formView.imageURLInputValue });\n        }\n        else {\n            this.editor.execute('insertImage', { source: this._formView.imageURLInputValue });\n        }\n        this.editor.plugins.get('Dialog').hide();\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.4 5.4 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023q.675.195 1.307.573l.058.033q.068.042.135.086V2.1c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.1 2.1 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978\\\"/><path d=\\\"M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.65.65 0 0 0-.096.492.66.66 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.74 1.74 0 0 1 2.478-.463 1.87 1.87 0 0 1 .476 2.55.64.64 0 0 0-.071.5.65.65 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.23 3.23 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.63.63 0 0 0 .092-.475.64.64 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.74 1.74 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.65.65 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.61.61 0 0 0-.845.17\\\"/><path d=\\\"M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinsertviaurl\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageInsertUI } from './imageinsert/imageinsertui.js';\nimport { ImageInsertViaUrlUI } from './imageinsert/imageinsertviaurlui.js';\n/**\n * The image insert via URL plugin.\n *\n * For a detailed overview, check the {@glink features/images/images-inserting\n * Insert images via source URL} documentation.\n *\n * This plugin does not do anything directly, but it loads a set of specific plugins\n * to enable image inserting via implemented integrations:\n *\n * * {@link module:image/imageinsert/imageinsertui~ImageInsertUI},\n */\nexport class ImageInsertViaUrl extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageInsertViaUrl';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageInsertViaUrlUI, ImageInsertUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { getSelectionAffectedTable } from '../utils/common.js';\n/**\n * Checks if the provided model element is a `table`.\n *\n * @param modelElement Element to check if it is a table.\n * @internal\n */\nexport function isTable(modelElement) {\n    return !!modelElement && modelElement.is('element', 'table');\n}\n/**\n * Returns the caption model element from a given table element. Returns `null` if no caption is found.\n *\n * @param tableModelElement Table element in which we will try to find a caption element.\n * @internal\n */\nexport function getCaptionFromTableModelElement(tableModelElement) {\n    for (const node of tableModelElement.getChildren()) {\n        if (node.is('element', 'caption')) {\n            return node;\n        }\n    }\n    return null;\n}\n/**\n * Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.\n *\n * @param selection The selection checked for caption presence.\n * @internal\n */\nexport function getCaptionFromModelSelection(selection) {\n    const tableElement = getSelectionAffectedTable(selection);\n    if (!tableElement) {\n        return null;\n    }\n    return getCaptionFromTableModelElement(tableElement);\n}\n/**\n * {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a caption.\n *\n * There are two possible forms of the valid caption:\n *  - A `<figcaption>` element inside a `<figure class=\"table\">` element.\n *  - A `<caption>` inside a <table>.\n *\n * @returns Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element cannot be matched.\n * @internal\n */\nexport function matchTableCaptionViewElement(element) {\n    const parent = element.parent;\n    if (element.name == 'figcaption' && parent && parent.is('element', 'figure') && parent.hasClass('table')) {\n        return { name: true };\n    }\n    if (element.name == 'caption' && parent && parent.is('element', 'table')) {\n        return { name: true };\n    }\n    return null;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n* @module table/tablecaption/toggletablecaptioncommand\n*/\nimport { Command } from 'ckeditor5/src/core.js';\nimport { getCaptionFromTableModelElement } from './utils.js';\nimport { getSelectionAffectedTable } from '../utils/common.js';\n/**\n * The toggle table caption command.\n *\n * This command is registered by {@link module:table/tablecaption/tablecaptionediting~TableCaptionEditing} as the\n * `'toggleTableCaption'` editor command.\n *\n * Executing this command:\n *\n * * either adds or removes the table caption of a selected table (depending on whether the caption is present or not),\n * * removes the table caption if the selection is anchored in one.\n *\n * ```ts\n * // Toggle the presence of the caption.\n * editor.execute( 'toggleTableCaption' );\n * ```\n *\n * **Note**: You can move the selection to the caption right away as it shows up upon executing this command by using\n * the `focusCaptionOnShow` option:\n *\n * ```ts\n * editor.execute( 'toggleTableCaption', { focusCaptionOnShow: true } );\n * ```\n */\nexport class ToggleTableCaptionCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const editor = this.editor;\n        const tableElement = getSelectionAffectedTable(editor.model.document.selection);\n        this.isEnabled = !!tableElement && editor.model.schema.checkChild(tableElement, 'caption');\n        if (!this.isEnabled) {\n            this.value = false;\n        }\n        else {\n            this.value = !!getCaptionFromTableModelElement(tableElement);\n        }\n    }\n    /**\n     * Executes the command.\n     *\n     * ```ts\n     * editor.execute( 'toggleTableCaption' );\n     * ```\n     *\n     * @param options Options for the executed command.\n     * @param options.focusCaptionOnShow When true and the caption shows up, the selection will be moved into it straight away.\n     * @fires execute\n     */\n    execute({ focusCaptionOnShow = false } = {}) {\n        this.editor.model.change(writer => {\n            if (this.value) {\n                this._hideTableCaption(writer);\n            }\n            else {\n                this._showTableCaption(writer, focusCaptionOnShow);\n            }\n        });\n    }\n    /**\n     * Shows the table caption. Also:\n     *\n     * * it attempts to restore the caption content from the `TableCaptionEditing` caption registry,\n     * * it moves the selection to the caption right away, it the `focusCaptionOnShow` option was set.\n     *\n     * @param focusCaptionOnShow Default focus behavior when showing the caption.\n     */\n    _showTableCaption(writer, focusCaptionOnShow) {\n        const model = this.editor.model;\n        const tableElement = getSelectionAffectedTable(model.document.selection);\n        const tableCaptionEditing = this.editor.plugins.get('TableCaptionEditing');\n        const savedCaptionElement = tableCaptionEditing._getSavedCaption(tableElement);\n        // Try restoring the caption from the TableCaptionEditing plugin storage.\n        const newCaptionElement = savedCaptionElement || writer.createElement('caption');\n        model.insertContent(newCaptionElement, tableElement, 'end');\n        if (focusCaptionOnShow) {\n            writer.setSelection(newCaptionElement, 'in');\n        }\n    }\n    /**\n     * Hides the caption of a selected table (or an table caption the selection is anchored to).\n     *\n     * The content of the caption is stored in the `TableCaptionEditing` caption registry to make this\n     * a reversible action.\n     */\n    _hideTableCaption(writer) {\n        const model = this.editor.model;\n        const tableElement = getSelectionAffectedTable(model.document.selection);\n        const tableCaptionEditing = this.editor.plugins.get('TableCaptionEditing');\n        const captionElement = getCaptionFromTableModelElement(tableElement);\n        // Store the caption content so it can be restored quickly if the user changes their mind.\n        tableCaptionEditing._saveCaption(tableElement, captionElement);\n        model.deleteContent(writer.createSelection(captionElement, 'on'));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecaption/tablecaptionediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ModelElement, enableViewPlaceholder } from 'ckeditor5/src/engine.js';\nimport { toWidgetEditable } from 'ckeditor5/src/widget.js';\nimport { injectTableCaptionPostFixer } from '../converters/table-caption-post-fixer.js';\nimport { ToggleTableCaptionCommand } from './toggletablecaptioncommand.js';\nimport { isTable, matchTableCaptionViewElement } from './utils.js';\n/**\n * The table caption editing plugin.\n */\nexport class TableCaptionEditing extends Plugin {\n    /**\n     * A map that keeps saved JSONified table captions and table model elements they are\n     * associated with.\n     *\n     * To learn more about this system, see {@link #_saveCaption}.\n     */\n    _savedCaptionsMap = new WeakMap();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCaptionEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const view = editor.editing.view;\n        const t = editor.t;\n        const useCaptionElement = editor.config.get('table.tableCaption.useCaptionElement');\n        if (!schema.isRegistered('caption')) {\n            schema.register('caption', {\n                allowIn: 'table',\n                allowContentOf: '$block',\n                isLimit: true\n            });\n        }\n        else {\n            schema.extend('caption', {\n                allowIn: 'table'\n            });\n        }\n        editor.commands.add('toggleTableCaption', new ToggleTableCaptionCommand(this.editor));\n        if (useCaptionElement) {\n            const tableEditing = editor.plugins.get('TableEditing');\n            tableEditing.registerAdditionalSlot({\n                filter: element => element.is('element', 'caption'),\n                positionOffset: 'end'\n            });\n        }\n        // View -> model converter for the data pipeline.\n        editor.conversion.for('upcast').elementToElement({\n            view: matchTableCaptionViewElement,\n            model: 'caption'\n        });\n        // Model -> view converter for the data pipeline.\n        editor.conversion.for('dataDowncast').elementToElement({\n            model: 'caption',\n            view: (modelElement, { writer }) => {\n                if (!isTable(modelElement.parent)) {\n                    return null;\n                }\n                return writer.createContainerElement(useCaptionElement ? 'caption' : 'figcaption');\n            }\n        });\n        // Model -> view converter for the editing pipeline.\n        editor.conversion.for('editingDowncast').elementToElement({\n            model: 'caption',\n            view: (modelElement, { writer }) => {\n                if (!isTable(modelElement.parent)) {\n                    return null;\n                }\n                const captionElement = writer.createEditableElement(useCaptionElement ? 'caption' : 'figcaption');\n                writer.setCustomProperty('tableCaption', true, captionElement);\n                captionElement.placeholder = t('Enter table caption');\n                enableViewPlaceholder({\n                    view,\n                    element: captionElement,\n                    keepOnFocus: true\n                });\n                return toWidgetEditable(captionElement, writer);\n            }\n        });\n        injectTableCaptionPostFixer(editor.model);\n    }\n    /**\n     * Returns the saved {@link module:engine/model/element~ModelElement#toJSON JSONified} caption\n     * of a table model element.\n     *\n     * See {@link #_saveCaption}.\n     *\n     * @internal\n     * @param tableModelElement The model element the caption should be returned for.\n     * @returns The model caption element or `null` if there is none.\n     */\n    _getSavedCaption(tableModelElement) {\n        const jsonObject = this._savedCaptionsMap.get(tableModelElement);\n        return jsonObject ? ModelElement.fromJSON(jsonObject) : null;\n    }\n    /**\n     * Saves a {@link module:engine/model/element~ModelElement#toJSON JSONified} caption for\n     * a table element to allow restoring it in the future.\n     *\n     * A caption is saved every time it gets hidden. The\n     * user should be able to restore it on demand.\n     *\n     * **Note**: The caption cannot be stored in the table model element attribute because,\n     * for instance, when the model state propagates to collaborators, the attribute would get\n     * lost (mainly because it does not convert to anything when the caption is hidden) and\n     * the states of collaborators' models would de-synchronize causing numerous issues.\n     *\n     * See {@link #_getSavedCaption}.\n     *\n     * @internal\n     * @param tableModelElement The model element the caption is saved for.\n     * @param caption The caption model element to be saved.\n     */\n    _saveCaption(tableModelElement, caption) {\n        this._savedCaptionsMap.set(tableModelElement, caption.toJSON());\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Injects a table caption post-fixer into the model.\n *\n * The role of the table caption post-fixer is to ensure that the table with caption have the correct structure\n * after a {@link module:engine/model/model~Model#change `change()`} block was executed.\n *\n * The correct structure means that:\n *\n * * If there are many caption model element, they are merged into one model.\n * * A final, merged caption model is placed at the end of the table.\n *\n * @internal\n */\nexport function injectTableCaptionPostFixer(model) {\n    model.document.registerPostFixer(writer => tableCaptionPostFixer(writer, model));\n}\n/**\n * The table caption post-fixer.\n */\nfunction tableCaptionPostFixer(writer, model) {\n    const changes = model.document.differ.getChanges();\n    let wasFixed = false;\n    for (const entry of changes) {\n        if (entry.type != 'insert') {\n            continue;\n        }\n        const positionParent = entry.position.parent;\n        if (positionParent.is('element', 'table') || entry.name == 'table') {\n            const table = (entry.name == 'table' ? entry.position.nodeAfter : positionParent);\n            const captionsToMerge = Array.from(table.getChildren())\n                .filter((child) => child.is('element', 'caption'));\n            const firstCaption = captionsToMerge.shift();\n            if (!firstCaption) {\n                continue;\n            }\n            // Move all the contents of the captions to the first one.\n            for (const caption of captionsToMerge) {\n                writer.move(writer.createRangeIn(caption), firstCaption, 'end');\n                writer.remove(caption);\n            }\n            // Make sure the final caption is at the end of the table.\n            if (firstCaption.nextSibling) {\n                writer.move(writer.createRangeOn(firstCaption), table, 'end');\n                wasFixed = true;\n            }\n            // Do we merged captions and/or moved the single caption to the end of the table?\n            wasFixed = !!captionsToMerge.length || wasFixed;\n        }\n    }\n    return wasFixed;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n* @module table/tablecaption/tablecaptionui\n*/\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView } from 'ckeditor5/src/ui.js';\nimport { IconCaption } from 'ckeditor5/src/icons.js';\nimport { getCaptionFromModelSelection } from './utils.js';\n/**\n  * The table caption UI plugin. It introduces the `'toggleTableCaption'` UI button.\n  */\nexport class TableCaptionUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCaptionUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const editingView = editor.editing.view;\n        const t = editor.t;\n        editor.ui.componentFactory.add('toggleTableCaption', locale => {\n            const command = editor.commands.get('toggleTableCaption');\n            const view = new ButtonView(locale);\n            view.set({\n                icon: IconCaption,\n                tooltip: true,\n                isToggleable: true\n            });\n            view.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');\n            view.bind('label').to(command, 'value', value => value ? t('Toggle caption off') : t('Toggle caption on'));\n            this.listenTo(view, 'execute', () => {\n                editor.execute('toggleTableCaption', { focusCaptionOnShow: true });\n                // Scroll to the selection and highlight the caption if the caption showed up.\n                if (command.value) {\n                    const modelCaptionElement = getCaptionFromModelSelection(editor.model.document.selection);\n                    const figcaptionElement = editor.editing.mapper.toViewElement(modelCaptionElement);\n                    if (!figcaptionElement) {\n                        return;\n                    }\n                    editingView.scrollToTheSelection();\n                    editingView.change(writer => {\n                        writer.addClass('table__caption_highlighted', figcaptionElement);\n                    });\n                }\n                editor.editing.view.focus();\n            });\n            return view;\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * Returns a plain text representation of an element and its children.\n *\n * @internal\n * @returns Plain text representing the model's data.\n */\nexport function modelElementToPlainText(item) {\n    if (item.is('$text') || item.is('$textProxy')) {\n        return item.data;\n    }\n    const element = item;\n    let text = '';\n    let prev = null;\n    for (const child of element.getChildren()) {\n        const childText = modelElementToPlainText(child);\n        // If last block was finish, start from new line.\n        if (prev && prev.is('element')) {\n            text += '\\n';\n        }\n        text += childText;\n        prev = child;\n    }\n    return text;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/mentioncommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { CKEditorError, toMap } from 'ckeditor5/src/utils.js';\nimport { _addMentionAttributes } from './mentionediting.js';\nconst BRACKET_PAIRS = {\n    '(': ')',\n    '[': ']',\n    '{': '}'\n};\n/**\n * The mention command.\n *\n * The command is registered by {@link module:mention/mentionediting~MentionEditing} as `'mention'`.\n *\n * To insert a mention into a range, execute the command and specify a mention object with a range to replace:\n *\n * ```ts\n * const focus = editor.model.document.selection.focus;\n *\n * // It will replace one character before the selection focus with the '#1234' text\n * // with the mention attribute filled with passed attributes.\n * editor.execute( 'mention', {\n * \tmarker: '#',\n * \tmention: {\n * \t\tid: '#1234',\n * \t\tname: 'Foo',\n * \t\ttitle: 'Big Foo'\n * \t},\n * \trange: editor.model.createRange( focus.getShiftedBy( -1 ), focus )\n * } );\n *\n * // It will replace one character before the selection focus with the 'The \"Big Foo\"' text\n * // with the mention attribute filled with passed attributes.\n * editor.execute( 'mention', {\n * \tmarker: '#',\n * \tmention: {\n * \t\tid: '#1234',\n * \t\tname: 'Foo',\n * \t\ttitle: 'Big Foo'\n * \t},\n * \ttext: 'The \"Big Foo\"',\n * \trange: editor.model.createRange( focus.getShiftedBy( -1 ), focus )\n * } );\n *\t```\n */\nexport class MentionCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // Since this command may pass range in execution parameters, it should be checked directly in execute block.\n        this._isEnabledBasedOnSelection = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const doc = model.document;\n        this.isEnabled = model.schema.checkAttributeInSelection(doc.selection, 'mention');\n    }\n    /**\n     * Executes the command.\n     *\n     * @param options Options for the executed command.\n     * @param options.mention The mention object to insert. When a string is passed, it will be used to create a plain\n     * object with the name attribute that equals the passed string.\n     * @param options.marker The marker character (e.g. `'@'`).\n     * @param options.text The text of the inserted mention. Defaults to the full mention string composed from `marker` and\n     * `mention` string or `mention.id` if an object is passed.\n     * @param options.range The range to replace.\n     * Note that the replaced range might be shorter than the inserted text with the mention attribute.\n     * @fires execute\n     */\n    execute(options) {\n        const model = this.editor.model;\n        const document = model.document;\n        const selection = document.selection;\n        const mentionData = typeof options.mention == 'string' ? { id: options.mention } : options.mention;\n        const mentionID = mentionData.id;\n        const range = options.range || selection.getFirstRange();\n        // Don't execute command if range is in non-editable place.\n        if (!model.canEditAt(range)) {\n            return;\n        }\n        const mentionText = options.text || mentionID;\n        const mention = _addMentionAttributes({ _text: mentionText, id: mentionID }, mentionData);\n        if (!mentionID.startsWith(options.marker)) {\n            /**\n             * The feed item ID must start with the marker character(s).\n             *\n             * Correct mention feed setting:\n             *\n             * ```ts\n             * mentions: [\n             * \t{\n             * \t\tmarker: '@',\n             * \t\tfeed: [ '@Ann', '@Barney', ... ]\n             * \t}\n             * ]\n             * ```\n             *\n             * Incorrect mention feed setting:\n             *\n             * ```ts\n             * mentions: [\n             * \t{\n             * \t\tmarker: '@',\n             * \t\tfeed: [ 'Ann', 'Barney', ... ]\n             * \t}\n             * ]\n             * ```\n             *\n             * See {@link module:mention/mentionconfig~MentionConfig}.\n             *\n             * @error mentioncommand-incorrect-id\n             */\n            throw new CKEditorError('mentioncommand-incorrect-id', this);\n        }\n        model.change(writer => {\n            const currentAttributes = toMap(selection.getAttributes());\n            const attributesWithMention = new Map(currentAttributes.entries());\n            attributesWithMention.set('mention', mention);\n            // Replace a range with the text with a mention.\n            const insertionRange = model.insertContent(writer.createText(mentionText, attributesWithMention), range);\n            const nodeBefore = insertionRange.start.nodeBefore;\n            const nodeAfter = insertionRange.end.nodeAfter;\n            const isFollowedByWhiteSpace = nodeAfter && nodeAfter.is('$text') && nodeAfter.data.startsWith(' ');\n            let isInsertedInBrackets = false;\n            if (nodeBefore && nodeAfter && nodeBefore.is('$text') && nodeAfter.is('$text')) {\n                const precedingCharacter = nodeBefore.data.slice(-1);\n                const isPrecededByOpeningBracket = precedingCharacter in BRACKET_PAIRS;\n                const isFollowedByBracketClosure = isPrecededByOpeningBracket && nodeAfter.data.startsWith(BRACKET_PAIRS[precedingCharacter]);\n                isInsertedInBrackets = isPrecededByOpeningBracket && isFollowedByBracketClosure;\n            }\n            // Don't add a white space if either of the following is true:\n            // * there's already one after the mention;\n            // * the mention was inserted in the empty matching brackets.\n            // https://github.com/ckeditor/ckeditor5/issues/4651\n            if (!isInsertedInBrackets && !isFollowedByWhiteSpace) {\n                model.insertContent(writer.createText(' ', currentAttributes), range.start.getShiftedBy(mentionText.length));\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/mentionediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { uid } from 'ckeditor5/src/utils.js';\nimport { MentionCommand } from './mentioncommand.js';\n/**\n * The mention editing feature.\n *\n * It introduces the {@link module:mention/mentioncommand~MentionCommand command} and the `mention`\n * attribute in the {@link module:engine/model/model~Model model} which renders in the {@link module:engine/view/view view}\n * as a `<span class=\"mention\" data-mention=\"@mention\">`.\n */\nexport class MentionEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'MentionEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const model = editor.model;\n        const doc = model.document;\n        // Allow the mention attribute on all text nodes.\n        model.schema.extend('$text', { allowAttributes: 'mention' });\n        // Upcast conversion.\n        editor.conversion.for('upcast').elementToAttribute({\n            view: {\n                name: 'span',\n                attributes: 'data-mention',\n                classes: 'mention'\n            },\n            model: {\n                key: 'mention',\n                value: (viewElement) => _toMentionAttribute(viewElement)\n            }\n        });\n        // Downcast conversion.\n        editor.conversion.for('downcast').attributeToElement({\n            model: 'mention',\n            view: createViewMentionElement\n        });\n        editor.conversion.for('downcast').add(preventPartialMentionDowncast);\n        doc.registerPostFixer(writer => removePartialMentionPostFixer(writer, doc, model.schema));\n        doc.registerPostFixer(writer => extendAttributeOnMentionPostFixer(writer, doc));\n        doc.registerPostFixer(writer => selectionMentionAttributePostFixer(writer, doc));\n        editor.commands.add('mention', new MentionCommand(editor));\n    }\n}\n/**\n * @internal\n */\nexport function _addMentionAttributes(baseMentionData, data) {\n    return Object.assign({ uid: uid() }, baseMentionData, data || {});\n}\n/**\n * Creates a mention attribute value from the provided view element and optional data.\n *\n * This function is exposed as\n * {@link module:mention/mention~Mention#toMentionAttribute `editor.plugins.get( 'Mention' ).toMentionAttribute()`}.\n *\n * @internal\n */\nexport function _toMentionAttribute(viewElementOrMention, data) {\n    const dataMention = viewElementOrMention.getAttribute('data-mention');\n    const textNode = viewElementOrMention.getChild(0);\n    // Do not convert empty mentions.\n    if (!textNode) {\n        return;\n    }\n    const baseMentionData = {\n        id: dataMention,\n        _text: textNode.data\n    };\n    return _addMentionAttributes(baseMentionData, data);\n}\n/**\n * A converter that blocks partial mention from being converted.\n *\n * This converter is registered with 'highest' priority in order to consume mention attribute before it is converted by\n * any other converters. This converter only consumes partial mention - those whose `_text` attribute is not equal to text with mention\n * attribute. This may happen when copying part of mention text.\n */\nfunction preventPartialMentionDowncast(dispatcher) {\n    dispatcher.on('attribute:mention', (evt, data, conversionApi) => {\n        const mention = data.attributeNewValue;\n        if (!data.item.is('$textProxy') || !mention) {\n            return;\n        }\n        const start = data.range.start;\n        const textNode = start.textNode || start.nodeAfter;\n        if (textNode.data != mention._text) {\n            // Consume item to prevent partial mention conversion.\n            conversionApi.consumable.consume(data.item, evt.name);\n        }\n    }, { priority: 'highest' });\n}\n/**\n * Creates a mention element from the mention data.\n */\nfunction createViewMentionElement(mention, { writer }) {\n    if (!mention) {\n        return;\n    }\n    const attributes = {\n        class: 'mention',\n        'data-mention': mention.id\n    };\n    const options = {\n        id: mention.uid,\n        priority: 20\n    };\n    return writer.createAttributeElement('span', attributes, options);\n}\n/**\n * Model post-fixer that disallows typing with selection when the selection is placed after the text node with the mention attribute or\n * before a text node with mention attribute.\n */\nfunction selectionMentionAttributePostFixer(writer, doc) {\n    const selection = doc.selection;\n    const focus = selection.focus;\n    if (selection.isCollapsed && selection.hasAttribute('mention') && shouldNotTypeWithMentionAt(focus)) {\n        writer.removeSelectionAttribute('mention');\n        return true;\n    }\n    return false;\n}\n/**\n * Helper function to detect if mention attribute should be removed from selection.\n * This check makes only sense if the selection has mention attribute.\n *\n * The mention attribute should be removed from a selection when selection focus is placed:\n * a) after a text node\n * b) the position is at parents start - the selection will set attributes from node after.\n */\nfunction shouldNotTypeWithMentionAt(position) {\n    const isAtStart = position.isAtStart;\n    const isAfterAMention = position.nodeBefore && position.nodeBefore.is('$text');\n    return isAfterAMention || isAtStart;\n}\n/**\n * Model post-fixer that removes the mention attribute from the modified text node.\n */\nfunction removePartialMentionPostFixer(writer, doc, schema) {\n    const changes = doc.differ.getChanges();\n    let wasChanged = false;\n    for (const change of changes) {\n        if (change.type == 'attribute') {\n            continue;\n        }\n        // Checks the text node on the current position.\n        const position = change.position;\n        if (change.name == '$text') {\n            const nodeAfterInsertedTextNode = position.textNode && position.textNode.nextSibling;\n            // Checks the text node where the change occurred.\n            wasChanged = checkAndFix(position.textNode, writer) || wasChanged;\n            // Occurs on paste inside a text node with mention.\n            wasChanged = checkAndFix(nodeAfterInsertedTextNode, writer) || wasChanged;\n            wasChanged = checkAndFix(position.nodeBefore, writer) || wasChanged;\n            wasChanged = checkAndFix(position.nodeAfter, writer) || wasChanged;\n        }\n        // Checks text nodes in inserted elements (might occur when splitting a paragraph or pasting content inside text with mention).\n        if (change.name != '$text' && change.type == 'insert') {\n            const insertedNode = position.nodeAfter;\n            for (const item of writer.createRangeIn(insertedNode).getItems()) {\n                wasChanged = checkAndFix(item, writer) || wasChanged;\n            }\n        }\n        // Inserted inline elements might break mention.\n        if (change.type == 'insert' && schema.isInline(change.name)) {\n            const nodeAfterInserted = position.nodeAfter && position.nodeAfter.nextSibling;\n            wasChanged = checkAndFix(position.nodeBefore, writer) || wasChanged;\n            wasChanged = checkAndFix(nodeAfterInserted, writer) || wasChanged;\n        }\n    }\n    return wasChanged;\n}\n/**\n * This post-fixer will extend the attribute applied on the part of the mention so the whole text node of the mention will have\n * the added attribute.\n */\nfunction extendAttributeOnMentionPostFixer(writer, doc) {\n    const changes = doc.differ.getChanges();\n    let wasChanged = false;\n    for (const change of changes) {\n        if (change.type === 'attribute' && change.attributeKey != 'mention') {\n            // Checks the node on the left side of the range...\n            const nodeBefore = change.range.start.nodeBefore;\n            // ... and on the right side of the range.\n            const nodeAfter = change.range.end.nodeAfter;\n            for (const node of [nodeBefore, nodeAfter]) {\n                if (isBrokenMentionNode(node) && node.getAttribute(change.attributeKey) != change.attributeNewValue) {\n                    writer.setAttribute(change.attributeKey, change.attributeNewValue, node);\n                    wasChanged = true;\n                }\n            }\n        }\n    }\n    return wasChanged;\n}\n/**\n * Checks if a node has a correct mention attribute if present.\n * Returns `true` if the node is text and has a mention attribute whose text does not match the expected mention text.\n */\nfunction isBrokenMentionNode(node) {\n    if (!node || !(node.is('$text') || node.is('$textProxy')) || !node.hasAttribute('mention')) {\n        return false;\n    }\n    const text = node.data;\n    const mention = node.getAttribute('mention');\n    const expectedText = mention._text;\n    return text != expectedText;\n}\n/**\n * Fixes a mention on a text node if it needs a fix.\n */\nfunction checkAndFix(textNode, writer) {\n    if (isBrokenMentionNode(textNode)) {\n        writer.removeAttribute('mention', textNode);\n        return true;\n    }\n    return false;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/ui/mentionsview\n */\nimport { ListView } from 'ckeditor5/src/ui.js';\nimport { Rect } from 'ckeditor5/src/utils.js';\nimport '../../theme/mentionui.css';\n/**\n * The mention ui view.\n */\nexport class MentionsView extends ListView {\n    selected;\n    position;\n    /**\n     * @inheritDoc\n     */\n    constructor(locale) {\n        super(locale);\n        this.extendTemplate({\n            attributes: {\n                class: [\n                    'ck-mentions'\n                ],\n                tabindex: '-1'\n            }\n        });\n    }\n    /**\n     * {@link #select Selects} the first item.\n     */\n    selectFirst() {\n        this.select(0);\n    }\n    /**\n     * Selects next item to the currently {@link #select selected}.\n     *\n     * If the last item is already selected, it will select the first item.\n     */\n    selectNext() {\n        const item = this.selected;\n        const index = this.items.getIndex(item);\n        this.select(index + 1);\n    }\n    /**\n     * Selects previous item to the currently {@link #select selected}.\n     *\n     * If the first item is already selected, it will select the last item.\n     */\n    selectPrevious() {\n        const item = this.selected;\n        const index = this.items.getIndex(item);\n        this.select(index - 1);\n    }\n    /**\n     * Marks item at a given index as selected.\n     *\n     * Handles selection cycling when passed index is out of bounds:\n     * - if the index is lower than 0, it will select the last item,\n     * - if the index is higher than the last item index, it will select the first item.\n     *\n     * @param index Index of an item to be marked as selected.\n     */\n    select(index) {\n        let indexToGet = 0;\n        if (index > 0 && index < this.items.length) {\n            indexToGet = index;\n        }\n        else if (index < 0) {\n            indexToGet = this.items.length - 1;\n        }\n        const item = this.items.get(indexToGet);\n        // Return early if item is already selected.\n        if (this.selected === item) {\n            return;\n        }\n        // Remove highlight of previously selected item.\n        if (this.selected) {\n            this.selected.removeHighlight();\n        }\n        item.highlight();\n        this.selected = item;\n        // Scroll the mentions view to the selected element.\n        if (!this._isItemVisibleInScrolledArea(item)) {\n            this.element.scrollTop = item.element.offsetTop;\n        }\n    }\n    /**\n     * Triggers the `execute` event on the {@link #select selected} item.\n     */\n    executeSelected() {\n        this.selected.fire('execute');\n    }\n    /**\n     * Checks if an item is visible in the scrollable area.\n     *\n     * The item is considered visible when:\n     * - its top boundary is inside the scrollable rect\n     * - its bottom boundary is inside the scrollable rect (the whole item must be visible)\n     */\n    _isItemVisibleInScrolledArea(item) {\n        return new Rect(this.element).contains(new Rect(item.element));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/ui/domwrapperview\n */\nimport { View } from 'ckeditor5/src/ui.js';\n/**\n * This class wraps DOM element as a CKEditor5 UI View.\n *\n * It allows to render any DOM element and use it in mentions list.\n */\nexport class MentionDomWrapperView extends View {\n    /**\n     * The DOM element for which wrapper was created.\n     */\n    domElement;\n    /**\n     * Creates an instance of {@link module:mention/ui/domwrapperview~MentionDomWrapperView} class.\n     *\n     * Also see {@link #render}.\n     */\n    constructor(locale, domElement) {\n        super(locale);\n        // Disable template rendering on this view.\n        this.template = undefined;\n        this.domElement = domElement;\n        // Render dom wrapper as a button.\n        this.domElement.classList.add('ck-button');\n        this.set('isOn', false);\n        // Handle isOn state as in buttons.\n        this.on('change:isOn', (evt, name, isOn) => {\n            if (isOn) {\n                this.domElement.classList.add('ck-on');\n                this.domElement.classList.remove('ck-off');\n            }\n            else {\n                this.domElement.classList.add('ck-off');\n                this.domElement.classList.remove('ck-on');\n            }\n        });\n        // Pass click event as execute event.\n        this.listenTo(this.domElement, 'click', () => {\n            this.fire('execute');\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.element = this.domElement;\n    }\n    /**\n     * Focuses the DOM element.\n     */\n    focus() {\n        this.domElement.focus();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/ui/mentionlistitemview\n */\nimport { ListItemView } from 'ckeditor5/src/ui.js';\nexport class MentionListItemView extends ListItemView {\n    item;\n    marker;\n    highlight() {\n        const child = this.children.first;\n        child.isOn = true;\n    }\n    removeHighlight() {\n        const child = this.children.first;\n        child.isOn = false;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/mentionui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView, ContextualBalloon, clickOutsideHandler } from 'ckeditor5/src/ui.js';\nimport { CKEditorError, Collection, Rect, env, keyCodes, logWarning } from 'ckeditor5/src/utils.js';\nimport { TextWatcher } from 'ckeditor5/src/typing.js';\nimport { debounce } from 'es-toolkit/compat';\nimport { MentionsView } from './ui/mentionsview.js';\nimport { MentionDomWrapperView } from './ui/domwrapperview.js';\nimport { MentionListItemView } from './ui/mentionlistitemview.js';\nconst VERTICAL_SPACING = 3;\n// The key codes that mention UI handles when it is open (without commit keys).\nconst defaultHandledKeyCodes = [\n    keyCodes.arrowup,\n    keyCodes.arrowdown,\n    keyCodes.esc\n];\n// Dropdown commit key codes.\nconst defaultCommitKeyCodes = [\n    keyCodes.enter,\n    keyCodes.tab\n];\n/**\n * The mention UI feature.\n */\nexport class MentionUI extends Plugin {\n    /**\n     * The mention view.\n     */\n    _mentionsView;\n    /**\n     * Stores mention feeds configurations.\n     */\n    _mentionsConfigurations;\n    /**\n     * The contextual balloon plugin instance.\n     */\n    _balloon;\n    _items = new Collection();\n    _lastRequested;\n    /**\n     * Debounced feed requester. It uses `es-toolkit#debounce` method to delay function call.\n     */\n    _requestFeedDebounced;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'MentionUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ContextualBalloon];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this._mentionsView = this._createMentionView();\n        this._mentionsConfigurations = new Map();\n        this._requestFeedDebounced = debounce(this._requestFeed, 100);\n        editor.config.define('mention', { feeds: [] });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const commitKeys = editor.config.get('mention.commitKeys') || defaultCommitKeyCodes;\n        const handledKeyCodes = defaultHandledKeyCodes.concat(commitKeys);\n        this._balloon = editor.plugins.get(ContextualBalloon);\n        // Key listener that handles navigation in mention view.\n        editor.editing.view.document.on('keydown', (evt, data) => {\n            if (isHandledKey(data.keyCode) && this._isUIVisible) {\n                data.preventDefault();\n                evt.stop(); // Required for Enter key overriding.\n                if (data.keyCode == keyCodes.arrowdown) {\n                    this._mentionsView.selectNext();\n                }\n                if (data.keyCode == keyCodes.arrowup) {\n                    this._mentionsView.selectPrevious();\n                }\n                if (commitKeys.includes(data.keyCode)) {\n                    this._mentionsView.executeSelected();\n                }\n                if (data.keyCode == keyCodes.esc) {\n                    this._hideUIAndRemoveMarker();\n                }\n            }\n        }, { priority: 'highest' }); // Required to override the Enter key.\n        // Close the dropdown upon clicking outside of the plugin UI.\n        clickOutsideHandler({\n            emitter: this._mentionsView,\n            activator: () => this._isUIVisible,\n            contextElements: () => [this._balloon.view.element],\n            callback: () => this._hideUIAndRemoveMarker()\n        });\n        const feeds = editor.config.get('mention.feeds');\n        for (const mentionDescription of feeds) {\n            const { feed, marker, dropdownLimit } = mentionDescription;\n            if (!isValidMentionMarker(marker)) {\n                /**\n                 * The marker must be a single character.\n                 *\n                 * Correct markers: `'@'`, `'#'`.\n                 *\n                 * Incorrect markers: `'$$'`, `'[@'`.\n                 *\n                 * See {@link module:mention/mentionconfig~MentionConfig}.\n                 *\n                 * @error mentionconfig-incorrect-marker\n                 * @param {string} marker Configured marker\n                 */\n                throw new CKEditorError('mentionconfig-incorrect-marker', null, { marker });\n            }\n            const feedCallback = typeof feed == 'function' ? feed.bind(this.editor) : createFeedCallback(feed);\n            const itemRenderer = mentionDescription.itemRenderer;\n            const definition = { marker, feedCallback, itemRenderer, dropdownLimit };\n            this._mentionsConfigurations.set(marker, definition);\n        }\n        this._setupTextWatcher(feeds);\n        this.listenTo(editor, 'change:isReadOnly', () => {\n            this._hideUIAndRemoveMarker();\n        });\n        this.on('requestFeed:response', (evt, data) => this._handleFeedResponse(data));\n        this.on('requestFeed:error', () => this._hideUIAndRemoveMarker());\n        /**\n         * Checks if a given key code is handled by the mention UI.\n         */\n        function isHandledKey(keyCode) {\n            return handledKeyCodes.includes(keyCode);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        // Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).\n        this._mentionsView.destroy();\n    }\n    /**\n     * Returns true when {@link #_mentionsView} is in the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon} and it is\n     * currently visible.\n     */\n    get _isUIVisible() {\n        return this._balloon.visibleView === this._mentionsView;\n    }\n    /**\n     * Creates the {@link #_mentionsView}.\n     */\n    _createMentionView() {\n        const locale = this.editor.locale;\n        const mentionsView = new MentionsView(locale);\n        mentionsView.items.bindTo(this._items).using(data => {\n            const { item, marker } = data;\n            const { dropdownLimit: markerDropdownLimit } = this._mentionsConfigurations.get(marker);\n            // Set to 10 by default for backwards compatibility. See: #10479\n            const dropdownLimit = markerDropdownLimit || this.editor.config.get('mention.dropdownLimit') || 10;\n            if (mentionsView.items.length >= dropdownLimit) {\n                return null;\n            }\n            const listItemView = new MentionListItemView(locale);\n            const view = this._renderItem(item, marker);\n            view.delegate('execute').to(listItemView);\n            listItemView.children.add(view);\n            listItemView.item = item;\n            listItemView.marker = marker;\n            listItemView.on('execute', () => {\n                mentionsView.fire('execute', {\n                    item,\n                    marker\n                });\n            });\n            return listItemView;\n        });\n        mentionsView.on('execute', (evt, data) => {\n            const editor = this.editor;\n            const model = editor.model;\n            const item = data.item;\n            const marker = data.marker;\n            const mentionMarker = editor.model.markers.get('mention');\n            // Create a range on matched text.\n            const end = model.createPositionAt(model.document.selection.focus);\n            const start = model.createPositionAt(mentionMarker.getStart());\n            const range = model.createRange(start, end);\n            this._hideUIAndRemoveMarker();\n            editor.execute('mention', {\n                mention: item,\n                text: item.text,\n                marker,\n                range\n            });\n            editor.editing.view.focus();\n        });\n        return mentionsView;\n    }\n    /**\n     * Returns item renderer for the marker.\n     */\n    _getItemRenderer(marker) {\n        const { itemRenderer } = this._mentionsConfigurations.get(marker);\n        return itemRenderer;\n    }\n    /**\n     * Requests a feed from a configured callbacks.\n     */\n    _requestFeed(marker, feedText) {\n        // @if CK_DEBUG_MENTION // console.log( '%c[Feed]%c Requesting for', 'color: blue', 'color: black', `\"${ feedText }\"` );\n        // Store the last requested feed - it is used to discard any out-of order requests.\n        this._lastRequested = feedText;\n        const { feedCallback } = this._mentionsConfigurations.get(marker);\n        const feedResponse = feedCallback(feedText);\n        const isAsynchronous = feedResponse instanceof Promise;\n        // For synchronous feeds (e.g. callbacks, arrays) fire the response event immediately.\n        if (!isAsynchronous) {\n            this.fire('requestFeed:response', { feed: feedResponse, marker, feedText });\n            return;\n        }\n        // Handle the asynchronous responses.\n        feedResponse\n            .then(response => {\n            // Check the feed text of this response with the last requested one so either:\n            if (this._lastRequested == feedText) {\n                // It is the same and fire the response event.\n                this.fire('requestFeed:response', { feed: response, marker, feedText });\n            }\n            else {\n                // It is different - most probably out-of-order one, so fire the discarded event.\n                this.fire('requestFeed:discarded', { feed: response, marker, feedText });\n            }\n        })\n            .catch(error => {\n            this.fire('requestFeed:error', { error });\n            /**\n             * The callback used for obtaining mention autocomplete feed thrown and error and the mention UI was hidden or\n             * not displayed at all.\n             *\n             * @error mention-feed-callback-error\n             */\n            logWarning('mention-feed-callback-error', { marker });\n        });\n    }\n    /**\n     * Registers a text watcher for the marker.\n     */\n    _setupTextWatcher(feeds) {\n        const editor = this.editor;\n        const feedsWithPattern = feeds.map(feed => ({\n            ...feed,\n            pattern: createRegExp(feed.marker, feed.minimumCharacters || 0)\n        }));\n        const watcher = new TextWatcher(editor.model, createTestCallback(feedsWithPattern));\n        watcher.on('matched', (evt, data) => {\n            const markerDefinition = getLastValidMarkerInText(feedsWithPattern, data.text);\n            const selection = editor.model.document.selection;\n            const focus = selection.focus;\n            const markerPosition = editor.model.createPositionAt(focus.parent, markerDefinition.position);\n            if (isPositionInExistingMention(focus) || isMarkerInExistingMention(markerPosition)) {\n                this._hideUIAndRemoveMarker();\n                return;\n            }\n            const feedText = requestFeedText(markerDefinition, data.text);\n            const matchedTextLength = markerDefinition.marker.length + feedText.length;\n            // Create a marker range.\n            const start = focus.getShiftedBy(-matchedTextLength);\n            const end = focus.getShiftedBy(-feedText.length);\n            const markerRange = editor.model.createRange(start, end);\n            // @if CK_DEBUG_MENTION // console.group( '%c[TextWatcher]%c matched', 'color: red', 'color: black', `\"${ feedText }\"` );\n            // @if CK_DEBUG_MENTION // console.log( 'data#text', `\"${ data.text }\"` );\n            // @if CK_DEBUG_MENTION // console.log( 'data#range', data.range.start.path, data.range.end.path );\n            // @if CK_DEBUG_MENTION // console.log( 'marker definition', markerDefinition );\n            // @if CK_DEBUG_MENTION // console.log( 'marker range', markerRange.start.path, markerRange.end.path );\n            if (checkIfStillInCompletionMode(editor)) {\n                const mentionMarker = editor.model.markers.get('mention');\n                // Update the marker - user might've moved the selection to other mention trigger.\n                editor.model.change(writer => {\n                    // @if CK_DEBUG_MENTION // console.log( '%c[Editing]%c Updating the marker.', 'color: purple', 'color: black' );\n                    writer.updateMarker(mentionMarker, { range: markerRange });\n                });\n            }\n            else {\n                editor.model.change(writer => {\n                    // @if CK_DEBUG_MENTION // console.log( '%c[Editing]%c Adding the marker.', 'color: purple', 'color: black' );\n                    writer.addMarker('mention', { range: markerRange, usingOperation: false, affectsData: false });\n                });\n            }\n            this._requestFeedDebounced(markerDefinition.marker, feedText);\n            // @if CK_DEBUG_MENTION // console.groupEnd();\n        });\n        watcher.on('unmatched', () => {\n            this._hideUIAndRemoveMarker();\n        });\n        const mentionCommand = editor.commands.get('mention');\n        watcher.bind('isEnabled').to(mentionCommand);\n        return watcher;\n    }\n    /**\n     * Handles the feed response event data.\n     */\n    _handleFeedResponse(data) {\n        const { feed, marker } = data;\n        // eslint-disable-next-line @stylistic/max-len\n        // @if CK_DEBUG_MENTION // console.log( `%c[Feed]%c Response for \"${ data.feedText }\" (${ feed.length })`, 'color: blue', 'color: black', feed );\n        // If the marker is not in the document happens when the selection had changed and the 'mention' marker was removed.\n        if (!checkIfStillInCompletionMode(this.editor)) {\n            return;\n        }\n        // Reset the view.\n        this._items.clear();\n        for (const feedItem of feed) {\n            const item = typeof feedItem != 'object' ? { id: feedItem, text: feedItem } : feedItem;\n            this._items.add({ item, marker });\n        }\n        const mentionMarker = this.editor.model.markers.get('mention');\n        if (this._items.length) {\n            this._showOrUpdateUI(mentionMarker);\n        }\n        else {\n            // Do not show empty mention UI.\n            this._hideUIAndRemoveMarker();\n        }\n    }\n    /**\n     * Shows the mentions balloon. If the panel is already visible, it will reposition it.\n     */\n    _showOrUpdateUI(markerMarker) {\n        if (this._isUIVisible) {\n            // @if CK_DEBUG_MENTION // console.log( '%c[UI]%c Updating position.', 'color: green', 'color: black' );\n            // Update balloon position as the mention list view may change its size.\n            this._balloon.updatePosition(this._getBalloonPanelPositionData(markerMarker, this._mentionsView.position));\n        }\n        else {\n            // @if CK_DEBUG_MENTION // console.log( '%c[UI]%c Showing the UI.', 'color: green', 'color: black' );\n            this._balloon.add({\n                view: this._mentionsView,\n                position: this._getBalloonPanelPositionData(markerMarker, this._mentionsView.position),\n                singleViewMode: true,\n                balloonClassName: 'ck-mention-balloon'\n            });\n        }\n        this._mentionsView.position = this._balloon.view.position;\n        this._mentionsView.selectFirst();\n    }\n    /**\n     * Hides the mentions balloon and removes the 'mention' marker from the markers collection.\n     */\n    _hideUIAndRemoveMarker() {\n        // Remove the mention view from balloon before removing marker - it is used by balloon position target().\n        if (this._balloon.hasView(this._mentionsView)) {\n            // @if CK_DEBUG_MENTION // console.log( '%c[UI]%c Hiding the UI.', 'color: green', 'color: black' );\n            this._balloon.remove(this._mentionsView);\n        }\n        if (checkIfStillInCompletionMode(this.editor)) {\n            // @if CK_DEBUG_MENTION // console.log( '%c[Editing]%c Removing marker.', 'color: purple', 'color: black' );\n            this.editor.model.change(writer => writer.removeMarker('mention'));\n        }\n        // Make the last matched position on panel view undefined so the #_getBalloonPanelPositionData() method will return all positions\n        // on the next call.\n        this._mentionsView.position = undefined;\n    }\n    /**\n     * Renders a single item in the autocomplete list.\n     */\n    _renderItem(item, marker) {\n        const editor = this.editor;\n        let view;\n        let label = item.id;\n        const renderer = this._getItemRenderer(marker);\n        if (renderer) {\n            const renderResult = renderer(item);\n            if (typeof renderResult != 'string') {\n                view = new MentionDomWrapperView(editor.locale, renderResult);\n            }\n            else {\n                label = renderResult;\n            }\n        }\n        if (!view) {\n            const buttonView = new ButtonView(editor.locale);\n            buttonView.label = label;\n            buttonView.withText = true;\n            view = buttonView;\n        }\n        return view;\n    }\n    /**\n     * Creates a position options object used to position the balloon panel.\n     *\n     * @param mentionMarker\n     * @param preferredPosition The name of the last matched position name.\n     */\n    _getBalloonPanelPositionData(mentionMarker, preferredPosition) {\n        const editor = this.editor;\n        const editing = editor.editing;\n        const domConverter = editing.view.domConverter;\n        const mapper = editing.mapper;\n        const uiLanguageDirection = editor.locale.uiLanguageDirection;\n        return {\n            target: () => {\n                let modelRange = mentionMarker.getRange();\n                // Target the UI to the model selection range - the marker has been removed so probably the UI will not be shown anyway.\n                // The logic is used by ContextualBalloon to display another panel in the same place.\n                if (modelRange.start.root.rootName == '$graveyard') {\n                    modelRange = editor.model.document.selection.getFirstRange();\n                }\n                const viewRange = mapper.toViewRange(modelRange);\n                const rangeRects = Rect.getDomRangeRects(domConverter.viewRangeToDom(viewRange));\n                return rangeRects.pop();\n            },\n            limiter: () => {\n                const view = this.editor.editing.view;\n                const viewDocument = view.document;\n                const editableElement = viewDocument.selection.editableElement;\n                if (editableElement) {\n                    return view.domConverter.mapViewToDom(editableElement.root);\n                }\n                return null;\n            },\n            positions: getBalloonPanelPositions(preferredPosition, uiLanguageDirection)\n        };\n    }\n}\n/**\n * Returns the balloon positions data callbacks.\n */\nfunction getBalloonPanelPositions(preferredPosition, uiLanguageDirection) {\n    const positions = {\n        // Positions the panel to the southeast of the caret rectangle.\n        'caret_se': (targetRect) => {\n            return {\n                top: targetRect.bottom + VERTICAL_SPACING,\n                left: targetRect.right,\n                name: 'caret_se',\n                config: {\n                    withArrow: false\n                }\n            };\n        },\n        // Positions the panel to the northeast of the caret rectangle.\n        'caret_ne': (targetRect, balloonRect) => {\n            return {\n                top: targetRect.top - balloonRect.height - VERTICAL_SPACING,\n                left: targetRect.right,\n                name: 'caret_ne',\n                config: {\n                    withArrow: false\n                }\n            };\n        },\n        // Positions the panel to the southwest of the caret rectangle.\n        'caret_sw': (targetRect, balloonRect) => {\n            return {\n                top: targetRect.bottom + VERTICAL_SPACING,\n                left: targetRect.right - balloonRect.width,\n                name: 'caret_sw',\n                config: {\n                    withArrow: false\n                }\n            };\n        },\n        // Positions the panel to the northwest of the caret rect.\n        'caret_nw': (targetRect, balloonRect) => {\n            return {\n                top: targetRect.top - balloonRect.height - VERTICAL_SPACING,\n                left: targetRect.right - balloonRect.width,\n                name: 'caret_nw',\n                config: {\n                    withArrow: false\n                }\n            };\n        }\n    };\n    // Returns only the last position if it was matched to prevent the panel from jumping after the first match.\n    if (Object.prototype.hasOwnProperty.call(positions, preferredPosition)) {\n        return [\n            positions[preferredPosition]\n        ];\n    }\n    // By default, return all position callbacks ordered depending on the UI language direction.\n    return uiLanguageDirection !== 'rtl' ? [\n        positions.caret_se,\n        positions.caret_sw,\n        positions.caret_ne,\n        positions.caret_nw\n    ] : [\n        positions.caret_sw,\n        positions.caret_se,\n        positions.caret_nw,\n        positions.caret_ne\n    ];\n}\n/**\n * Returns a marker definition of the last valid occurring marker in a given string.\n * If there is no valid marker in a string, it returns undefined.\n *\n * Example of returned object:\n *\n * ```ts\n * {\n * \tmarker: '@',\n * \tposition: 4,\n * \tminimumCharacters: 0\n * }\n * ````\n *\n * @param feedsWithPattern Registered feeds in editor for mention plugin with created RegExp for matching marker.\n * @param text String to find the marker in\n * @returns Matched marker's definition\n */\nfunction getLastValidMarkerInText(feedsWithPattern, text) {\n    let lastValidMarker;\n    for (const feed of feedsWithPattern) {\n        const currentMarkerLastIndex = text.lastIndexOf(feed.marker);\n        if (currentMarkerLastIndex > 0 && !text.substring(currentMarkerLastIndex - 1).match(feed.pattern)) {\n            continue;\n        }\n        if (!lastValidMarker || currentMarkerLastIndex >= lastValidMarker.position) {\n            lastValidMarker = {\n                marker: feed.marker,\n                position: currentMarkerLastIndex,\n                minimumCharacters: feed.minimumCharacters,\n                pattern: feed.pattern\n            };\n        }\n    }\n    return lastValidMarker;\n}\n/**\n * Creates a RegExp pattern for the marker.\n *\n * Function has to be exported to achieve 100% code coverage.\n *\n * @internal\n */\nexport function createRegExp(marker, minimumCharacters) {\n    const numberOfCharacters = minimumCharacters == 0 ? '*' : `{${minimumCharacters},}`;\n    const openAfterCharacters = env.features.isRegExpUnicodePropertySupported ? '\\\\p{Ps}\\\\p{Pi}\"\\'' : '\\\\(\\\\[{\"\\'';\n    const mentionCharacters = '.';\n    // I wanted to make an util out of it, but since this regexp uses \"u\" flag, it became difficult.\n    // When \"u\" flag is used, the regexp has \"strict\" escaping rules, i.e. if you try to escape a character that does not need\n    // to be escaped, RegExp() will throw. It made it difficult to write a generic util, because different characters are\n    // allowed in different context. For example, escaping \"-\" sometimes was correct, but sometimes it threw an error.\n    marker = marker.replace(/[.*+?^${}()\\-|[\\]\\\\]/g, '\\\\$&');\n    // The pattern consists of 3 groups:\n    //\n    // - 0 (non-capturing): Opening sequence - start of the line, space or an opening punctuation character like \"(\" or \"\\\"\",\n    // - 1: The marker character(s),\n    // - 2: Mention input (taking the minimal length into consideration to trigger the UI),\n    //\n    // The pattern matches up to the caret (end of string switch - $).\n    //               (0:      opening sequence       )(1: marker  )(2:                typed mention              )$\n    const pattern = `(?:^|[ ${openAfterCharacters}])(${marker})(${mentionCharacters}${numberOfCharacters})$`;\n    return new RegExp(pattern, 'u');\n}\n/**\n * Creates a test callback for the marker to be used in the text watcher instance.\n *\n * @param feedsWithPattern Feeds of mention plugin configured in editor with RegExp to match marker in text\n */\nfunction createTestCallback(feedsWithPattern) {\n    const textMatcher = (text) => {\n        const markerDefinition = getLastValidMarkerInText(feedsWithPattern, text);\n        if (!markerDefinition) {\n            return false;\n        }\n        let splitStringFrom = 0;\n        if (markerDefinition.position !== 0) {\n            splitStringFrom = markerDefinition.position - 1;\n        }\n        const textToTest = text.substring(splitStringFrom);\n        return markerDefinition.pattern.test(textToTest);\n    };\n    return textMatcher;\n}\n/**\n * Creates a text matcher from the marker.\n */\nfunction requestFeedText(markerDefinition, text) {\n    let splitStringFrom = 0;\n    if (markerDefinition.position !== 0) {\n        splitStringFrom = markerDefinition.position - 1;\n    }\n    const regExp = createRegExp(markerDefinition.marker, 0);\n    const textToMatch = text.substring(splitStringFrom);\n    const match = textToMatch.match(regExp);\n    return match[2];\n}\n/**\n * The default feed callback.\n */\nfunction createFeedCallback(feedItems) {\n    return (feedText) => {\n        const filteredItems = feedItems\n            // Make the default mention feed case-insensitive.\n            .filter(item => {\n            // Item might be defined as object.\n            const itemId = typeof item == 'string' ? item : String(item.id);\n            // The default feed is case insensitive.\n            return itemId.toLowerCase().includes(feedText.toLowerCase());\n        });\n        return filteredItems;\n    };\n}\n/**\n * Checks if position in inside or right after a text with a mention.\n */\nfunction isPositionInExistingMention(position) {\n    // The text watcher listens only to changed range in selection - so the selection attributes are not yet available\n    // and you cannot use selection.hasAttribute( 'mention' ) just yet.\n    // See https://github.com/ckeditor/ckeditor5-engine/issues/1723.\n    const hasMention = position.textNode && position.textNode.hasAttribute('mention');\n    const nodeBefore = position.nodeBefore;\n    return hasMention || nodeBefore && nodeBefore.is('$text') && nodeBefore.hasAttribute('mention');\n}\n/**\n * Checks if the closest marker offset is at the beginning of a mention.\n *\n * See https://github.com/ckeditor/ckeditor5/issues/11400.\n */\nfunction isMarkerInExistingMention(markerPosition) {\n    const nodeAfter = markerPosition.nodeAfter;\n    return nodeAfter && nodeAfter.is('$text') && nodeAfter.hasAttribute('mention');\n}\n/**\n * Checks if string is a valid mention marker.\n */\nfunction isValidMentionMarker(marker) {\n    return !!marker;\n}\n/**\n * Checks the mention plugins is in completion mode (e.g. when typing is after a valid mention string like @foo).\n */\nfunction checkIfStillInCompletionMode(editor) {\n    return editor.model.markers.has('mention');\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n *   Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n  if (error) {\n    throw error\n  }\n}\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]\n *   Node, position, or point.\n * @returns {string}\n *   Pretty printed positional info of a node (`string`).\n *\n *   In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n *   or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n *   column, `s` for `start`, and `e` for end.\n *   An empty string (`''`) is returned if the given value is neither `node`,\n *   `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n  // Nothing.\n  if (!value || typeof value !== 'object') {\n    return ''\n  }\n\n  // Node.\n  if ('position' in value || 'type' in value) {\n    return position(value.position)\n  }\n\n  // Position.\n  if ('start' in value || 'end' in value) {\n    return position(value)\n  }\n\n  // Point.\n  if ('line' in value || 'column' in value) {\n    return point(value)\n  }\n\n  // ?\n  return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n  return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n  return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n  return value && typeof value === 'number' ? value : 1\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n *\n * @typedef Options\n *   Configuration.\n * @property {Array<Node> | null | undefined} [ancestors]\n *   Stack of (inclusive) ancestor nodes surrounding the message (optional).\n * @property {Error | null | undefined} [cause]\n *   Original error cause of the message (optional).\n * @property {Point | Position | null | undefined} [place]\n *   Place of message (optional).\n * @property {string | null | undefined} [ruleId]\n *   Category of message (optional, example: `'my-rule'`).\n * @property {string | null | undefined} [source]\n *   Namespace of who sent the message (optional, example: `'my-package'`).\n */\n\nimport {stringifyPosition} from 'unist-util-stringify-position'\n\n/**\n * Message.\n */\nexport class VFileMessage extends Error {\n  /**\n   * Create a message for `reason`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Options | null | undefined} [options]\n   * @returns\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns\n   *   Instance of `VFileMessage`.\n   */\n  // eslint-disable-next-line complexity\n  constructor(causeOrReason, optionsOrParentOrPlace, origin) {\n    super()\n\n    if (typeof optionsOrParentOrPlace === 'string') {\n      origin = optionsOrParentOrPlace\n      optionsOrParentOrPlace = undefined\n    }\n\n    /** @type {string} */\n    let reason = ''\n    /** @type {Options} */\n    let options = {}\n    let legacyCause = false\n\n    if (optionsOrParentOrPlace) {\n      // Point.\n      if (\n        'line' in optionsOrParentOrPlace &&\n        'column' in optionsOrParentOrPlace\n      ) {\n        options = {place: optionsOrParentOrPlace}\n      }\n      // Position.\n      else if (\n        'start' in optionsOrParentOrPlace &&\n        'end' in optionsOrParentOrPlace\n      ) {\n        options = {place: optionsOrParentOrPlace}\n      }\n      // Node.\n      else if ('type' in optionsOrParentOrPlace) {\n        options = {\n          ancestors: [optionsOrParentOrPlace],\n          place: optionsOrParentOrPlace.position\n        }\n      }\n      // Options.\n      else {\n        options = {...optionsOrParentOrPlace}\n      }\n    }\n\n    if (typeof causeOrReason === 'string') {\n      reason = causeOrReason\n    }\n    // Error.\n    else if (!options.cause && causeOrReason) {\n      legacyCause = true\n      reason = causeOrReason.message\n      options.cause = causeOrReason\n    }\n\n    if (!options.ruleId && !options.source && typeof origin === 'string') {\n      const index = origin.indexOf(':')\n\n      if (index === -1) {\n        options.ruleId = origin\n      } else {\n        options.source = origin.slice(0, index)\n        options.ruleId = origin.slice(index + 1)\n      }\n    }\n\n    if (!options.place && options.ancestors && options.ancestors) {\n      const parent = options.ancestors[options.ancestors.length - 1]\n\n      if (parent) {\n        options.place = parent.position\n      }\n    }\n\n    const start =\n      options.place && 'start' in options.place\n        ? options.place.start\n        : options.place\n\n    /**\n     * Stack of ancestor nodes surrounding the message.\n     *\n     * @type {Array<Node> | undefined}\n     */\n    this.ancestors = options.ancestors || undefined\n\n    /**\n     * Original error cause of the message.\n     *\n     * @type {Error | undefined}\n     */\n    this.cause = options.cause || undefined\n\n    /**\n     * Starting column of message.\n     *\n     * @type {number | undefined}\n     */\n    this.column = start ? start.column : undefined\n\n    /**\n     * State of problem.\n     *\n     * * `true` — error, file not usable\n     * * `false` — warning, change may be needed\n     * * `undefined` — change likely not needed\n     *\n     * @type {boolean | null | undefined}\n     */\n    this.fatal = undefined\n\n    /**\n     * Path of a file (used throughout the `VFile` ecosystem).\n     *\n     * @type {string | undefined}\n     */\n    this.file = ''\n\n    // Field from `Error`.\n    /**\n     * Reason for message.\n     *\n     * @type {string}\n     */\n    this.message = reason\n\n    /**\n     * Starting line of error.\n     *\n     * @type {number | undefined}\n     */\n    this.line = start ? start.line : undefined\n\n    // Field from `Error`.\n    /**\n     * Serialized positional info of message.\n     *\n     * On normal errors, this would be something like `ParseError`, buit in\n     * `VFile` messages we use this space to show where an error happened.\n     */\n    this.name = stringifyPosition(options.place) || '1:1'\n\n    /**\n     * Place of message.\n     *\n     * @type {Point | Position | undefined}\n     */\n    this.place = options.place || undefined\n\n    /**\n     * Reason for message, should use markdown.\n     *\n     * @type {string}\n     */\n    this.reason = this.message\n\n    /**\n     * Category of message (example: `'my-rule'`).\n     *\n     * @type {string | undefined}\n     */\n    this.ruleId = options.ruleId || undefined\n\n    /**\n     * Namespace of message (example: `'my-package'`).\n     *\n     * @type {string | undefined}\n     */\n    this.source = options.source || undefined\n\n    // Field from `Error`.\n    /**\n     * Stack of message.\n     *\n     * This is used by normal errors to show where something happened in\n     * programming code, irrelevant for `VFile` messages,\n     *\n     * @type {string}\n     */\n    this.stack =\n      legacyCause && options.cause && typeof options.cause.stack === 'string'\n        ? options.cause.stack\n        : ''\n\n    // The following fields are “well known”.\n    // Not standard.\n    // Feel free to add other non-standard fields to your messages.\n\n    /**\n     * Specify the source value that’s being reported, which is deemed\n     * incorrect.\n     *\n     * @type {string | undefined}\n     */\n    this.actual = undefined\n\n    /**\n     * Suggest acceptable values that can be used instead of `actual`.\n     *\n     * @type {Array<string> | undefined}\n     */\n    this.expected = undefined\n\n    /**\n     * Long form description of the message (you should use markdown).\n     *\n     * @type {string | undefined}\n     */\n    this.note = undefined\n\n    /**\n     * Link to docs for the message.\n     *\n     * > 👉 **Note**: this must be an absolute URL that can be passed as `x`\n     * > to `new URL(x)`.\n     *\n     * @type {string | undefined}\n     */\n    this.url = undefined\n  }\n}\n\nVFileMessage.prototype.file = ''\nVFileMessage.prototype.name = ''\nVFileMessage.prototype.reason = ''\nVFileMessage.prototype.message = ''\nVFileMessage.prototype.stack = ''\nVFileMessage.prototype.column = undefined\nVFileMessage.prototype.line = undefined\nVFileMessage.prototype.ancestors = undefined\nVFileMessage.prototype.cause = undefined\nVFileMessage.prototype.fatal = undefined\nVFileMessage.prototype.place = undefined\nVFileMessage.prototype.ruleId = undefined\nVFileMessage.prototype.source = undefined\n","// A derivative work based on:\n// <https://github.com/browserify/path-browserify>.\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// <https://github.com/nodejs/node/blob/master/lib/path.js>.\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n *   File path.\n * @param {string | null | undefined} [extname]\n *   Extension to strip.\n * @returns {string}\n *   Stem or basename.\n */\nfunction basename(path, extname) {\n  if (extname !== undefined && typeof extname !== 'string') {\n    throw new TypeError('\"ext\" argument must be a string')\n  }\n\n  assertPath(path)\n  let start = 0\n  let end = -1\n  let index = path.length\n  /** @type {boolean | undefined} */\n  let seenNonSlash\n\n  if (\n    extname === undefined ||\n    extname.length === 0 ||\n    extname.length > path.length\n  ) {\n    while (index--) {\n      if (path.codePointAt(index) === 47 /* `/` */) {\n        // If we reached a path separator that was not part of a set of path\n        // separators at the end of the string, stop now.\n        if (seenNonSlash) {\n          start = index + 1\n          break\n        }\n      } else if (end < 0) {\n        // We saw the first non-path separator, mark this as the end of our\n        // path component.\n        seenNonSlash = true\n        end = index + 1\n      }\n    }\n\n    return end < 0 ? '' : path.slice(start, end)\n  }\n\n  if (extname === path) {\n    return ''\n  }\n\n  let firstNonSlashEnd = -1\n  let extnameIndex = extname.length - 1\n\n  while (index--) {\n    if (path.codePointAt(index) === 47 /* `/` */) {\n      // If we reached a path separator that was not part of a set of path\n      // separators at the end of the string, stop now.\n      if (seenNonSlash) {\n        start = index + 1\n        break\n      }\n    } else {\n      if (firstNonSlashEnd < 0) {\n        // We saw the first non-path separator, remember this index in case\n        // we need it if the extension ends up not matching.\n        seenNonSlash = true\n        firstNonSlashEnd = index + 1\n      }\n\n      if (extnameIndex > -1) {\n        // Try to match the explicit extension.\n        if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n          if (extnameIndex < 0) {\n            // We matched the extension, so mark this as the end of our path\n            // component\n            end = index\n          }\n        } else {\n          // Extension does not match, so our result is the entire path\n          // component\n          extnameIndex = -1\n          end = firstNonSlashEnd\n        }\n      }\n    }\n  }\n\n  if (start === end) {\n    end = firstNonSlashEnd\n  } else if (end < 0) {\n    end = path.length\n  }\n\n  return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n *   File path.\n * @returns {string}\n *   File path.\n */\nfunction dirname(path) {\n  assertPath(path)\n\n  if (path.length === 0) {\n    return '.'\n  }\n\n  let end = -1\n  let index = path.length\n  /** @type {boolean | undefined} */\n  let unmatchedSlash\n\n  // Prefix `--` is important to not run on `0`.\n  while (--index) {\n    if (path.codePointAt(index) === 47 /* `/` */) {\n      if (unmatchedSlash) {\n        end = index\n        break\n      }\n    } else if (!unmatchedSlash) {\n      // We saw the first non-path separator\n      unmatchedSlash = true\n    }\n  }\n\n  return end < 0\n    ? path.codePointAt(0) === 47 /* `/` */\n      ? '/'\n      : '.'\n    : end === 1 && path.codePointAt(0) === 47 /* `/` */\n      ? '//'\n      : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n *   File path.\n * @returns {string}\n *   Extname.\n */\nfunction extname(path) {\n  assertPath(path)\n\n  let index = path.length\n\n  let end = -1\n  let startPart = 0\n  let startDot = -1\n  // Track the state of characters (if any) we see before our first dot and\n  // after any path separator we find.\n  let preDotState = 0\n  /** @type {boolean | undefined} */\n  let unmatchedSlash\n\n  while (index--) {\n    const code = path.codePointAt(index)\n\n    if (code === 47 /* `/` */) {\n      // If we reached a path separator that was not part of a set of path\n      // separators at the end of the string, stop now.\n      if (unmatchedSlash) {\n        startPart = index + 1\n        break\n      }\n\n      continue\n    }\n\n    if (end < 0) {\n      // We saw the first non-path separator, mark this as the end of our\n      // extension.\n      unmatchedSlash = true\n      end = index + 1\n    }\n\n    if (code === 46 /* `.` */) {\n      // If this is our first dot, mark it as the start of our extension.\n      if (startDot < 0) {\n        startDot = index\n      } else if (preDotState !== 1) {\n        preDotState = 1\n      }\n    } else if (startDot > -1) {\n      // We saw a non-dot and non-path separator before our dot, so we should\n      // have a good chance at having a non-empty extension.\n      preDotState = -1\n    }\n  }\n\n  if (\n    startDot < 0 ||\n    end < 0 ||\n    // We saw a non-dot character immediately before the dot.\n    preDotState === 0 ||\n    // The (right-most) trimmed path component is exactly `..`.\n    (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n  ) {\n    return ''\n  }\n\n  return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array<string>} segments\n *   Path segments.\n * @returns {string}\n *   File path.\n */\nfunction join(...segments) {\n  let index = -1\n  /** @type {string | undefined} */\n  let joined\n\n  while (++index < segments.length) {\n    assertPath(segments[index])\n\n    if (segments[index]) {\n      joined =\n        joined === undefined ? segments[index] : joined + '/' + segments[index]\n    }\n  }\n\n  return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n *   File path.\n * @returns {string}\n *   File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n  assertPath(path)\n\n  const absolute = path.codePointAt(0) === 47 /* `/` */\n\n  // Normalize the path according to POSIX rules.\n  let value = normalizeString(path, !absolute)\n\n  if (value.length === 0 && !absolute) {\n    value = '.'\n  }\n\n  if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n    value += '/'\n  }\n\n  return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n *   File path.\n * @param {boolean} allowAboveRoot\n *   Whether `..` can move above root.\n * @returns {string}\n *   File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n  let result = ''\n  let lastSegmentLength = 0\n  let lastSlash = -1\n  let dots = 0\n  let index = -1\n  /** @type {number | undefined} */\n  let code\n  /** @type {number} */\n  let lastSlashIndex\n\n  while (++index <= path.length) {\n    if (index < path.length) {\n      code = path.codePointAt(index)\n    } else if (code === 47 /* `/` */) {\n      break\n    } else {\n      code = 47 /* `/` */\n    }\n\n    if (code === 47 /* `/` */) {\n      if (lastSlash === index - 1 || dots === 1) {\n        // Empty.\n      } else if (lastSlash !== index - 1 && dots === 2) {\n        if (\n          result.length < 2 ||\n          lastSegmentLength !== 2 ||\n          result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n          result.codePointAt(result.length - 2) !== 46 /* `.` */\n        ) {\n          if (result.length > 2) {\n            lastSlashIndex = result.lastIndexOf('/')\n\n            if (lastSlashIndex !== result.length - 1) {\n              if (lastSlashIndex < 0) {\n                result = ''\n                lastSegmentLength = 0\n              } else {\n                result = result.slice(0, lastSlashIndex)\n                lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n              }\n\n              lastSlash = index\n              dots = 0\n              continue\n            }\n          } else if (result.length > 0) {\n            result = ''\n            lastSegmentLength = 0\n            lastSlash = index\n            dots = 0\n            continue\n          }\n        }\n\n        if (allowAboveRoot) {\n          result = result.length > 0 ? result + '/..' : '..'\n          lastSegmentLength = 2\n        }\n      } else {\n        if (result.length > 0) {\n          result += '/' + path.slice(lastSlash + 1, index)\n        } else {\n          result = path.slice(lastSlash + 1, index)\n        }\n\n        lastSegmentLength = index - lastSlash - 1\n      }\n\n      lastSlash = index\n      dots = 0\n    } else if (code === 46 /* `.` */ && dots > -1) {\n      dots++\n    } else {\n      dots = -1\n    }\n  }\n\n  return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n *   File path.\n * @returns {asserts path is string}\n *   Nothing.\n */\nfunction assertPath(path) {\n  if (typeof path !== 'string') {\n    throw new TypeError(\n      'Path must be a string. Received ' + JSON.stringify(path)\n    )\n  }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// <https://github.com/defunctzombie/node-process/blob/master/browser.js>.\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n  return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n *   File path or URL.\n * @returns {fileUrlOrPath is URL}\n *   Whether it’s a URL.\n */\n// From: <https://github.com/nodejs/node/blob/6a3403c/lib/internal/url.js#L720>\nexport function isUrl(fileUrlOrPath) {\n  return Boolean(\n    fileUrlOrPath !== null &&\n      typeof fileUrlOrPath === 'object' &&\n      'href' in fileUrlOrPath &&\n      fileUrlOrPath.href &&\n      'protocol' in fileUrlOrPath &&\n      fileUrlOrPath.protocol &&\n      // @ts-expect-error: indexing is fine.\n      fileUrlOrPath.auth === undefined\n  )\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n  'history',\n  'path',\n  'basename',\n  'stem',\n  'extname',\n  'dirname'\n])\n\nexport class VFile {\n  /**\n   * Create a new virtual file.\n   *\n   * `options` is treated as:\n   *\n   * *   `string` or `Uint8Array` — `{value: options}`\n   * *   `URL` — `{path: options}`\n   * *   `VFile` — shallow copies its data over to the new file\n   * *   `object` — all fields are shallow copied over to the new file\n   *\n   * Path related fields are set in the following order (least specific to\n   * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n   * `dirname`.\n   *\n   * You cannot set `dirname` or `extname` without setting either `history`,\n   * `path`, `basename`, or `stem` too.\n   *\n   * @param {Compatible | null | undefined} [value]\n   *   File value.\n   * @returns\n   *   New instance.\n   */\n  constructor(value) {\n    /** @type {Options | VFile} */\n    let options\n\n    if (!value) {\n      options = {}\n    } else if (isUrl(value)) {\n      options = {path: value}\n    } else if (typeof value === 'string' || isUint8Array(value)) {\n      options = {value}\n    } else {\n      options = value\n    }\n\n    /* eslint-disable no-unused-expressions */\n\n    /**\n     * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n     *\n     * @type {string}\n     */\n    // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n    // the empty string will be overridden in the next block.\n    this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n    /**\n     * Place to store custom info (default: `{}`).\n     *\n     * It’s OK to store custom data directly on the file but moving it to\n     * `data` is recommended.\n     *\n     * @type {Data}\n     */\n    this.data = {}\n\n    /**\n     * List of file paths the file moved between.\n     *\n     * The first is the original path and the last is the current path.\n     *\n     * @type {Array<string>}\n     */\n    this.history = []\n\n    /**\n     * List of messages associated with the file.\n     *\n     * @type {Array<VFileMessage>}\n     */\n    this.messages = []\n\n    /**\n     * Raw value.\n     *\n     * @type {Value}\n     */\n    this.value\n\n    // The below are non-standard, they are “well-known”.\n    // As in, used in several tools.\n    /**\n     * Source map.\n     *\n     * This type is equivalent to the `RawSourceMap` type from the `source-map`\n     * module.\n     *\n     * @type {Map | null | undefined}\n     */\n    this.map\n\n    /**\n     * Custom, non-string, compiled, representation.\n     *\n     * This is used by unified to store non-string results.\n     * One example is when turning markdown into React nodes.\n     *\n     * @type {unknown}\n     */\n    this.result\n\n    /**\n     * Whether a file was saved to disk.\n     *\n     * This is used by vfile reporters.\n     *\n     * @type {boolean}\n     */\n    this.stored\n    /* eslint-enable no-unused-expressions */\n\n    // Set path related properties in the correct order.\n    let index = -1\n\n    while (++index < order.length) {\n      const field = order[index]\n\n      // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n      // `vfile`s too.\n      if (\n        field in options &&\n        options[field] !== undefined &&\n        options[field] !== null\n      ) {\n        // @ts-expect-error: TS doesn’t understand basic reality.\n        this[field] = field === 'history' ? [...options[field]] : options[field]\n      }\n    }\n\n    /** @type {string} */\n    let field\n\n    // Set non-path related properties.\n    for (field in options) {\n      // @ts-expect-error: fine to set other things.\n      if (!order.includes(field)) {\n        // @ts-expect-error: fine to set other things.\n        this[field] = options[field]\n      }\n    }\n  }\n\n  /**\n   * Get the basename (including extname) (example: `'index.min.js'`).\n   *\n   * @returns {string | undefined}\n   *   Basename.\n   */\n  get basename() {\n    return typeof this.path === 'string'\n      ? minpath.basename(this.path)\n      : undefined\n  }\n\n  /**\n   * Set basename (including extname) (`'index.min.js'`).\n   *\n   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n   * on windows).\n   * Cannot be nullified (use `file.path = file.dirname` instead).\n   *\n   * @param {string} basename\n   *   Basename.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set basename(basename) {\n    assertNonEmpty(basename, 'basename')\n    assertPart(basename, 'basename')\n    this.path = minpath.join(this.dirname || '', basename)\n  }\n\n  /**\n   * Get the parent path (example: `'~'`).\n   *\n   * @returns {string | undefined}\n   *   Dirname.\n   */\n  get dirname() {\n    return typeof this.path === 'string'\n      ? minpath.dirname(this.path)\n      : undefined\n  }\n\n  /**\n   * Set the parent path (example: `'~'`).\n   *\n   * Cannot be set if there’s no `path` yet.\n   *\n   * @param {string | undefined} dirname\n   *   Dirname.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set dirname(dirname) {\n    assertPath(this.basename, 'dirname')\n    this.path = minpath.join(dirname || '', this.basename)\n  }\n\n  /**\n   * Get the extname (including dot) (example: `'.js'`).\n   *\n   * @returns {string | undefined}\n   *   Extname.\n   */\n  get extname() {\n    return typeof this.path === 'string'\n      ? minpath.extname(this.path)\n      : undefined\n  }\n\n  /**\n   * Set the extname (including dot) (example: `'.js'`).\n   *\n   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n   * on windows).\n   * Cannot be set if there’s no `path` yet.\n   *\n   * @param {string | undefined} extname\n   *   Extname.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set extname(extname) {\n    assertPart(extname, 'extname')\n    assertPath(this.dirname, 'extname')\n\n    if (extname) {\n      if (extname.codePointAt(0) !== 46 /* `.` */) {\n        throw new Error('`extname` must start with `.`')\n      }\n\n      if (extname.includes('.', 1)) {\n        throw new Error('`extname` cannot contain multiple dots')\n      }\n    }\n\n    this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n  }\n\n  /**\n   * Get the full path (example: `'~/index.min.js'`).\n   *\n   * @returns {string}\n   *   Path.\n   */\n  get path() {\n    return this.history[this.history.length - 1]\n  }\n\n  /**\n   * Set the full path (example: `'~/index.min.js'`).\n   *\n   * Cannot be nullified.\n   * You can set a file URL (a `URL` object with a `file:` protocol) which will\n   * be turned into a path with `url.fileURLToPath`.\n   *\n   * @param {URL | string} path\n   *   Path.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set path(path) {\n    if (isUrl(path)) {\n      path = urlToPath(path)\n    }\n\n    assertNonEmpty(path, 'path')\n\n    if (this.path !== path) {\n      this.history.push(path)\n    }\n  }\n\n  /**\n   * Get the stem (basename w/o extname) (example: `'index.min'`).\n   *\n   * @returns {string | undefined}\n   *   Stem.\n   */\n  get stem() {\n    return typeof this.path === 'string'\n      ? minpath.basename(this.path, this.extname)\n      : undefined\n  }\n\n  /**\n   * Set the stem (basename w/o extname) (example: `'index.min'`).\n   *\n   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n   * on windows).\n   * Cannot be nullified (use `file.path = file.dirname` instead).\n   *\n   * @param {string} stem\n   *   Stem.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  set stem(stem) {\n    assertNonEmpty(stem, 'stem')\n    assertPart(stem, 'stem')\n    this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n  }\n\n  // Normal prototypal methods.\n  /**\n   * Create a fatal message for `reason` associated with the file.\n   *\n   * The `fatal` field of the message is set to `true` (error; file not usable)\n   * and the `file` field is set to the current file path.\n   * The message is added to the `messages` field on `file`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {MessageOptions | null | undefined} [options]\n   * @returns {never}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns {never}\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns {never}\n   *   Never.\n   * @throws {VFileMessage}\n   *   Message.\n   */\n  fail(causeOrReason, optionsOrParentOrPlace, origin) {\n    // @ts-expect-error: the overloads are fine.\n    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n    message.fatal = true\n\n    throw message\n  }\n\n  /**\n   * Create an info message for `reason` associated with the file.\n   *\n   * The `fatal` field of the message is set to `undefined` (info; change\n   * likely not needed) and the `file` field is set to the current file path.\n   * The message is added to the `messages` field on `file`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {MessageOptions | null | undefined} [options]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns {VFileMessage}\n   *   Message.\n   */\n  info(causeOrReason, optionsOrParentOrPlace, origin) {\n    // @ts-expect-error: the overloads are fine.\n    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n    message.fatal = undefined\n\n    return message\n  }\n\n  /**\n   * Create a message for `reason` associated with the file.\n   *\n   * The `fatal` field of the message is set to `false` (warning; change may be\n   * needed) and the `file` field is set to the current file path.\n   * The message is added to the `messages` field on `file`.\n   *\n   * > 🪦 **Note**: also has obsolete signatures.\n   *\n   * @overload\n   * @param {string} reason\n   * @param {MessageOptions | null | undefined} [options]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {string} reason\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Node | NodeLike | null | undefined} parent\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {Point | Position | null | undefined} place\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @overload\n   * @param {Error | VFileMessage} cause\n   * @param {string | null | undefined} [origin]\n   * @returns {VFileMessage}\n   *\n   * @param {Error | VFileMessage | string} causeOrReason\n   *   Reason for message, should use markdown.\n   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n   *   Configuration (optional).\n   * @param {string | null | undefined} [origin]\n   *   Place in code where the message originates (example:\n   *   `'my-package:my-rule'` or `'my-rule'`).\n   * @returns {VFileMessage}\n   *   Message.\n   */\n  message(causeOrReason, optionsOrParentOrPlace, origin) {\n    const message = new VFileMessage(\n      // @ts-expect-error: the overloads are fine.\n      causeOrReason,\n      optionsOrParentOrPlace,\n      origin\n    )\n\n    if (this.path) {\n      message.name = this.path + ':' + message.name\n      message.file = this.path\n    }\n\n    message.fatal = false\n\n    this.messages.push(message)\n\n    return message\n  }\n\n  /**\n   * Serialize the file.\n   *\n   * > **Note**: which encodings are supported depends on the engine.\n   * > For info on Node.js, see:\n   * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.\n   *\n   * @param {string | null | undefined} [encoding='utf8']\n   *   Character encoding to understand `value` as when it’s a `Uint8Array`\n   *   (default: `'utf-8'`).\n   * @returns {string}\n   *   Serialized file.\n   */\n  toString(encoding) {\n    if (this.value === undefined) {\n      return ''\n    }\n\n    if (typeof this.value === 'string') {\n      return this.value\n    }\n\n    const decoder = new TextDecoder(encoding || undefined)\n    return decoder.decode(this.value)\n  }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n *   File path part.\n * @param {string} name\n *   Part name.\n * @returns {undefined}\n *   Nothing.\n */\nfunction assertPart(part, name) {\n  if (part && part.includes(minpath.sep)) {\n    throw new Error(\n      '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n    )\n  }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n *   Thing.\n * @param {string} name\n *   Part name.\n * @returns {asserts part is string}\n *   Nothing.\n */\nfunction assertNonEmpty(part, name) {\n  if (!part) {\n    throw new Error('`' + name + '` cannot be empty')\n  }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n *   Path.\n * @param {string} name\n *   Dependency name.\n * @returns {asserts path is string}\n *   Nothing.\n */\nfunction assertPath(path, name) {\n  if (!path) {\n    throw new Error('Setting `' + name + '` requires `path` to be set too')\n  }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n *   thing.\n * @returns {value is Uint8Array}\n *   Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      'byteLength' in value &&\n      'byteOffset' in value\n  )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: <https://github.com/nodejs/node/blob/6a3403c/lib/internal/url.js>\n\n/**\n * @param {URL | string} path\n *   File URL.\n * @returns {string}\n *   File URL.\n */\nexport function urlToPath(path) {\n  if (typeof path === 'string') {\n    path = new URL(path)\n  } else if (!isUrl(path)) {\n    /** @type {NodeJS.ErrnoException} */\n    const error = new TypeError(\n      'The \"path\" argument must be of type string or an instance of URL. Received `' +\n        path +\n        '`'\n    )\n    error.code = 'ERR_INVALID_ARG_TYPE'\n    throw error\n  }\n\n  if (path.protocol !== 'file:') {\n    /** @type {NodeJS.ErrnoException} */\n    const error = new TypeError('The URL must be of scheme file')\n    error.code = 'ERR_INVALID_URL_SCHEME'\n    throw error\n  }\n\n  return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n *   URL.\n * @returns {string}\n *   File path.\n */\nfunction getPathFromURLPosix(url) {\n  if (url.hostname !== '') {\n    /** @type {NodeJS.ErrnoException} */\n    const error = new TypeError(\n      'File URL host must be \"localhost\" or empty on darwin'\n    )\n    error.code = 'ERR_INVALID_FILE_URL_HOST'\n    throw error\n  }\n\n  const pathname = url.pathname\n  let index = -1\n\n  while (++index < pathname.length) {\n    if (\n      pathname.codePointAt(index) === 37 /* `%` */ &&\n      pathname.codePointAt(index + 1) === 50 /* `2` */\n    ) {\n      const third = pathname.codePointAt(index + 2)\n      if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n        /** @type {NodeJS.ErrnoException} */\n        const error = new TypeError(\n          'File URL path must not include encoded / characters'\n        )\n        error.code = 'ERR_INVALID_FILE_URL_PATH'\n        throw error\n      }\n    }\n  }\n\n  return decodeURIComponent(pathname)\n}\n","export const CallableInstance =\n  /**\n   * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n   */\n  (\n    /** @type {unknown} */\n    (\n      /**\n       * @this {Function}\n       * @param {string | symbol} property\n       * @returns {(...parameters: Array<unknown>) => unknown}\n       */\n      function (property) {\n        const self = this\n        const constr = self.constructor\n        const proto = /** @type {Record<string | symbol, Function>} */ (\n          // Prototypes do exist.\n          // type-coverage:ignore-next-line\n          constr.prototype\n        )\n        const value = proto[property]\n        /** @type {(...parameters: Array<unknown>) => unknown} */\n        const apply = function () {\n          return value.apply(apply, arguments)\n        }\n\n        Object.setPrototypeOf(apply, proto)\n\n        // Not needed for us in `unified`: we only call this on the `copy`\n        // function,\n        // and we don't need to add its fields (`length`, `name`)\n        // over.\n        // See also: GH-246.\n        // const names = Object.getOwnPropertyNames(value)\n        //\n        // for (const p of names) {\n        //   const descriptor = Object.getOwnPropertyDescriptor(value, p)\n        //   if (descriptor) Object.defineProperty(apply, p, descriptor)\n        // }\n\n        return apply\n      }\n    )\n  )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n *   Acceptable results from compilers.\n *\n *   To register custom results, add them to\n *   {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n *   The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n *   A **compiler** handles the compiling of a syntax tree to something else\n *   (in most cases, text) (TypeScript type).\n *\n *   It is used in the stringify phase and called with a {@linkcode Node}\n *   and {@linkcode VFile} representation of the document to compile.\n *   It should return the textual representation of the given tree (typically\n *   `string`).\n *\n *   > **Note**: unified typically compiles by serializing: most compilers\n *   > return `string` (or `Uint8Array`).\n *   > Some compilers, such as the one configured with\n *   > [`rehype-react`][rehype-react], return other values (in this case, a\n *   > React tree).\n *   > If you’re using a compiler that doesn’t serialize, expect different\n *   > result values.\n *   >\n *   > To register custom results in TypeScript, add them to\n *   > {@linkcode CompileResultMap}.\n *\n *   [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n *   Tree to compile.\n * @param {VFile} file\n *   File associated with `tree`.\n * @returns {Result}\n *   New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n *   something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   The node that the parser yields (default: `Node`)\n * @callback Parser\n *   A **parser** handles the parsing of text to a syntax tree.\n *\n *   It is used in the parse phase and is called with a `string` and\n *   {@linkcode VFile} of the document to parse.\n *   It must return the syntax tree representation of the given file\n *   ({@linkcode Node}).\n * @param {string} document\n *   Document to parse.\n * @param {VFile} file\n *   File associated with `document`.\n * @returns {Tree}\n *   Node representing the given file.\n */\n\n/**\n * @typedef {(\n *   Plugin<Array<any>, any, any> |\n *   PluginTuple<Array<any>, any, any> |\n *   Preset\n * )} Pluggable\n *   Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array<Pluggable>} PluggableList\n *   List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n//  <https://github.com/microsoft/TypeScript/issues/55197>.\n/**\n * @template {Array<unknown>} [PluginParameters=[]]\n *   Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n *   Value that is expected as input (default: `Node`).\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node it expects.\n *   *   If the plugin sets a {@linkcode Parser}, this should be\n *       `string`.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be the\n *       node it expects.\n * @template [Output=Input]\n *   Value that is yielded as output (default: `Input`).\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node that that yields.\n *   *   If the plugin sets a {@linkcode Parser}, this should be the\n *       node that it yields.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be\n *       result it yields.\n * @typedef {(\n *   (this: Processor, ...parameters: PluginParameters) =>\n *     Input extends string ? // Parser.\n *        Output extends Node | undefined ? undefined | void : never :\n *     Output extends CompileResults ? // Compiler.\n *        Input extends Node | undefined ? undefined | void : never :\n *     Transformer<\n *       Input extends Node ? Input : Node,\n *       Output extends Node ? Output : Node\n *     > | undefined | void\n * )} Plugin\n *   Single plugin.\n *\n *   Plugins configure the processors they are applied on in the following\n *   ways:\n *\n *   *   they change the processor, such as the parser, the compiler, or by\n *       configuring data\n *   *   they specify how to handle trees and files\n *\n *   In practice, they are functions that can receive options and configure the\n *   processor (`this`).\n *\n *   > **Note**: plugins are called when the processor is *frozen*, not when\n *   > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array<unknown>} [TupleParameters=[]]\n *   Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n *   Value that is expected as input (optional).\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node it expects.\n *   *   If the plugin sets a {@linkcode Parser}, this should be\n *       `string`.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be the\n *       node it expects.\n * @template [Output=undefined] (optional).\n *   Value that is yielded as output.\n *\n *   *   If the plugin returns a {@linkcode Transformer}, this\n *       should be the node that that yields.\n *   *   If the plugin sets a {@linkcode Parser}, this should be the\n *       node that it yields.\n *   *   If the plugin sets a {@linkcode Compiler}, this should be\n *       result it yields.\n * @typedef {(\n *   [\n *     plugin: Plugin<TupleParameters, Input, Output>,\n *     ...parameters: TupleParameters\n *   ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n *   Sharable configuration.\n *\n *   They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n *   List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n *   Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n *   The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n *   Callback called when the process is done.\n *\n *   Called with either an error or a result.\n * @param {Error | undefined} [error]\n *   Fatal error (optional).\n * @param {File | undefined} [file]\n *   Processed file (optional).\n * @returns {undefined}\n *   Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n *   Callback called when transformers are done.\n *\n *   Called with either an error or results.\n * @param {Error | undefined} [error]\n *   Fatal error (optional).\n * @param {Tree | undefined} [tree]\n *   Transformed tree (optional).\n * @param {VFile | undefined} [file]\n *   File (optional).\n * @returns {undefined}\n *   Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n *   Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n *   Callback passed to transforms.\n *\n *   If the signature of a `transformer` accepts a third argument, the\n *   transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n *   Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n *   New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n *   New, changed, file (optional).\n * @returns {undefined}\n *   Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n *   Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n *   Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n *   Transformers handle syntax trees and files.\n *\n *   They are functions that are called each time a syntax tree and file are\n *   passed through the run phase.\n *   When an error occurs in them (either because it’s thrown, returned,\n *   rejected, or passed to `next`), the process stops.\n *\n *   The run phase is handled by [`trough`][trough], see its documentation for\n *   the exact semantics of these functions.\n *\n *   > **Note**: you should likely ignore `next`: don’t accept it.\n *   > it supports callback-style async work.\n *   > But promises are likely easier to reason about.\n *\n *   [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n *   Tree to handle.\n * @param {VFile} file\n *   File to handle.\n * @param {TransformCallback<Output>} next\n *   Callback.\n * @returns {(\n *   Promise<Output | undefined | void> |\n *   Promise<never> | // For some reason this is needed separately.\n *   Output |\n *   Error |\n *   undefined |\n *   void\n * )}\n *   If you accept `next`, nothing.\n *   Otherwise:\n *\n *   *   `Error` — fatal error to stop the process\n *   *   `Promise<undefined>` or `undefined` — the next transformer keeps using\n *       same tree\n *   *   `Promise<Node>` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n *   Output of `parse`.\n * @template {Node | undefined} HeadTree\n *   Input for `run`.\n * @template {Node | undefined} TailTree\n *   Output for `run`.\n * @template {Node | undefined} CompileTree\n *   Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n *   Output of `stringify`.\n * @template {Node | string | undefined} Input\n *   Input of plugin.\n * @template Output\n *   Output of plugin (optional).\n * @typedef {(\n *   Input extends string\n *     ? Output extends Node | undefined\n *       ? // Parser.\n *         Processor<\n *           Output extends undefined ? ParseTree : Output,\n *           HeadTree,\n *           TailTree,\n *           CompileTree,\n *           CompileResult\n *         >\n *       : // Unknown.\n *         Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n *     : Output extends CompileResults\n *     ? Input extends Node | undefined\n *       ? // Compiler.\n *         Processor<\n *           ParseTree,\n *           HeadTree,\n *           TailTree,\n *           Input extends undefined ? CompileTree : Input,\n *           Output extends undefined ? CompileResult : Output\n *         >\n *       : // Unknown.\n *         Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n *     : Input extends Node | undefined\n *     ? Output extends Node | undefined\n *       ? // Transform.\n *         Processor<\n *           ParseTree,\n *           HeadTree extends undefined ? Input : HeadTree,\n *           Output extends undefined ? TailTree : Output,\n *           CompileTree,\n *           CompileResult\n *         >\n *       : // Unknown.\n *         Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n *     : // Unknown.\n *       Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>\n * )} UsePlugin\n *   Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n *   Node type that the transformer yields.\n * @typedef {(\n *   Result extends Value | undefined ?\n *     VFile :\n *     VFile & {result: Result}\n *   )} VFileWithOutput\n *   Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n *   If a result that is not acceptable on a `VFile` is used, that will\n *   be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n *   Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n *   Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n *   Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n *   Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n *   Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>}\n */\nexport class Processor extends CallableInstance {\n  /**\n   * Create a processor.\n   */\n  constructor() {\n    // If `Processor()` is called (w/o new), `copy` is called instead.\n    super('copy')\n\n    /**\n     * Compiler to use (deprecated).\n     *\n     * @deprecated\n     *   Use `compiler` instead.\n     * @type {(\n     *   Compiler<\n     *     CompileTree extends undefined ? Node : CompileTree,\n     *     CompileResult extends undefined ? CompileResults : CompileResult\n     *   > |\n     *   undefined\n     * )}\n     */\n    this.Compiler = undefined\n\n    /**\n     * Parser to use (deprecated).\n     *\n     * @deprecated\n     *   Use `parser` instead.\n     * @type {(\n     *   Parser<ParseTree extends undefined ? Node : ParseTree> |\n     *   undefined\n     * )}\n     */\n    this.Parser = undefined\n\n    // Note: the following fields are considered private.\n    // However, they are needed for tests, and TSC generates an untyped\n    // `private freezeIndex` field for, which trips `type-coverage` up.\n    // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n    /**\n     * Internal list of configured plugins.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {Array<PluginTuple<Array<unknown>>>}\n     */\n    this.attachers = []\n\n    /**\n     * Compiler to use.\n     *\n     * @type {(\n     *   Compiler<\n     *     CompileTree extends undefined ? Node : CompileTree,\n     *     CompileResult extends undefined ? CompileResults : CompileResult\n     *   > |\n     *   undefined\n     * )}\n     */\n    this.compiler = undefined\n\n    /**\n     * Internal state to track where we are while freezing.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {number}\n     */\n    this.freezeIndex = -1\n\n    /**\n     * Internal state to track whether we’re frozen.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {boolean | undefined}\n     */\n    this.frozen = undefined\n\n    /**\n     * Internal state.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {Data}\n     */\n    this.namespace = {}\n\n    /**\n     * Parser to use.\n     *\n     * @type {(\n     *   Parser<ParseTree extends undefined ? Node : ParseTree> |\n     *   undefined\n     * )}\n     */\n    this.parser = undefined\n\n    /**\n     * Internal list of configured transformers.\n     *\n     * @deprecated\n     *   This is a private internal property and should not be used.\n     * @type {Pipeline}\n     */\n    this.transformers = trough()\n  }\n\n  /**\n   * Copy a processor.\n   *\n   * @deprecated\n   *   This is a private internal method and should not be used.\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *   New *unfrozen* processor ({@linkcode Processor}) that is\n   *   configured to work the same as its ancestor.\n   *   When the descendant processor is configured in the future it does not\n   *   affect the ancestral processor.\n   */\n  copy() {\n    // Cast as the type parameters will be the same after attaching.\n    const destination =\n      /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */ (\n        new Processor()\n      )\n    let index = -1\n\n    while (++index < this.attachers.length) {\n      const attacher = this.attachers[index]\n      destination.use(...attacher)\n    }\n\n    destination.data(extend(true, {}, this.namespace))\n\n    return destination\n  }\n\n  /**\n   * Configure the processor with info available to all plugins.\n   * Information is stored in an object.\n   *\n   * Typically, options can be given to a specific plugin, but sometimes it\n   * makes sense to have information shared with several plugins.\n   * For example, a list of HTML elements that are self-closing, which is\n   * needed during all phases.\n   *\n   * > **Note**: setting information cannot occur on *frozen* processors.\n   * > Call the processor first to create a new unfrozen processor.\n   *\n   * > **Note**: to register custom data in TypeScript, augment the\n   * > {@linkcode Data} interface.\n   *\n   * @example\n   *   This example show how to get and set info:\n   *\n   *   ```js\n   *   import {unified} from 'unified'\n   *\n   *   const processor = unified().data('alpha', 'bravo')\n   *\n   *   processor.data('alpha') // => 'bravo'\n   *\n   *   processor.data() // => {alpha: 'bravo'}\n   *\n   *   processor.data({charlie: 'delta'})\n   *\n   *   processor.data() // => {charlie: 'delta'}\n   *   ```\n   *\n   * @template {keyof Data} Key\n   *\n   * @overload\n   * @returns {Data}\n   *\n   * @overload\n   * @param {Data} dataset\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @overload\n   * @param {Key} key\n   * @returns {Data[Key]}\n   *\n   * @overload\n   * @param {Key} key\n   * @param {Data[Key]} value\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @param {Data | Key} [key]\n   *   Key to get or set, or entire dataset to set, or nothing to get the\n   *   entire dataset (optional).\n   * @param {Data[Key]} [value]\n   *   Value to set (optional).\n   * @returns {unknown}\n   *   The current processor when setting, the value at `key` when getting, or\n   *   the entire dataset when getting without key.\n   */\n  data(key, value) {\n    if (typeof key === 'string') {\n      // Set `key`.\n      if (arguments.length === 2) {\n        assertUnfrozen('data', this.frozen)\n        this.namespace[key] = value\n        return this\n      }\n\n      // Get `key`.\n      return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n    }\n\n    // Set space.\n    if (key) {\n      assertUnfrozen('data', this.frozen)\n      this.namespace = key\n      return this\n    }\n\n    // Get space.\n    return this.namespace\n  }\n\n  /**\n   * Freeze a processor.\n   *\n   * Frozen processors are meant to be extended and not to be configured\n   * directly.\n   *\n   * When a processor is frozen it cannot be unfrozen.\n   * New processors working the same way can be created by calling the\n   * processor.\n   *\n   * It’s possible to freeze processors explicitly by calling `.freeze()`.\n   * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n   * `.stringify()`, `.process()`, or `.processSync()` are called.\n   *\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *   The current processor.\n   */\n  freeze() {\n    if (this.frozen) {\n      return this\n    }\n\n    // Cast so that we can type plugins easier.\n    // Plugins are supposed to be usable on different processors, not just on\n    // this exact processor.\n    const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n    while (++this.freezeIndex < this.attachers.length) {\n      const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n      if (options[0] === false) {\n        continue\n      }\n\n      if (options[0] === true) {\n        options[0] = undefined\n      }\n\n      const transformer = attacher.call(self, ...options)\n\n      if (typeof transformer === 'function') {\n        this.transformers.use(transformer)\n      }\n    }\n\n    this.frozen = true\n    this.freezeIndex = Number.POSITIVE_INFINITY\n\n    return this\n  }\n\n  /**\n   * Parse text to a syntax tree.\n   *\n   * > **Note**: `parse` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `parse` performs the parse phase, not the run phase or other\n   * > phases.\n   *\n   * @param {Compatible | undefined} [file]\n   *   file to parse (optional); typically `string` or `VFile`; any value\n   *   accepted as `x` in `new VFile(x)`.\n   * @returns {ParseTree extends undefined ? Node : ParseTree}\n   *   Syntax tree representing `file`.\n   */\n  parse(file) {\n    this.freeze()\n    const realFile = vfile(file)\n    const parser = this.parser || this.Parser\n    assertParser('parse', parser)\n    return parser(String(realFile), realFile)\n  }\n\n  /**\n   * Process the given file as configured on the processor.\n   *\n   * > **Note**: `process` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `process` performs the parse, run, and stringify phases.\n   *\n   * @overload\n   * @param {Compatible | undefined} file\n   * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done\n   * @returns {undefined}\n   *\n   * @overload\n   * @param {Compatible | undefined} [file]\n   * @returns {Promise<VFileWithOutput<CompileResult>>}\n   *\n   * @param {Compatible | undefined} [file]\n   *   File (optional); typically `string` or `VFile`]; any value accepted as\n   *   `x` in `new VFile(x)`.\n   * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]\n   *   Callback (optional).\n   * @returns {Promise<VFile> | undefined}\n   *   Nothing if `done` is given.\n   *   Otherwise a promise, rejected with a fatal error or resolved with the\n   *   processed file.\n   *\n   *   The parsed, transformed, and compiled value is available at\n   *   `file.value` (see note).\n   *\n   *   > **Note**: unified typically compiles by serializing: most\n   *   > compilers return `string` (or `Uint8Array`).\n   *   > Some compilers, such as the one configured with\n   *   > [`rehype-react`][rehype-react], return other values (in this case, a\n   *   > React tree).\n   *   > If you’re using a compiler that doesn’t serialize, expect different\n   *   > result values.\n   *   >\n   *   > To register custom results in TypeScript, add them to\n   *   > {@linkcode CompileResultMap}.\n   *\n   *   [rehype-react]: https://github.com/rehypejs/rehype-react\n   */\n  process(file, done) {\n    const self = this\n\n    this.freeze()\n    assertParser('process', this.parser || this.Parser)\n    assertCompiler('process', this.compiler || this.Compiler)\n\n    return done ? executor(undefined, done) : new Promise(executor)\n\n    // Note: `void`s needed for TS.\n    /**\n     * @param {((file: VFileWithOutput<CompileResult>) => undefined | void) | undefined} resolve\n     * @param {(error: Error | undefined) => undefined | void} reject\n     * @returns {undefined}\n     */\n    function executor(resolve, reject) {\n      const realFile = vfile(file)\n      // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n      // input of the first transform).\n      const parseTree =\n        /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n          /** @type {unknown} */ (self.parse(realFile))\n        )\n\n      self.run(parseTree, realFile, function (error, tree, file) {\n        if (error || !tree || !file) {\n          return realDone(error)\n        }\n\n        // Assume `TailTree` (the output of the last transform) matches\n        // `CompileTree` (the input of the compiler).\n        const compileTree =\n          /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n            /** @type {unknown} */ (tree)\n          )\n\n        const compileResult = self.stringify(compileTree, file)\n\n        if (looksLikeAValue(compileResult)) {\n          file.value = compileResult\n        } else {\n          file.result = compileResult\n        }\n\n        realDone(error, /** @type {VFileWithOutput<CompileResult>} */ (file))\n      })\n\n      /**\n       * @param {Error | undefined} error\n       * @param {VFileWithOutput<CompileResult> | undefined} [file]\n       * @returns {undefined}\n       */\n      function realDone(error, file) {\n        if (error || !file) {\n          reject(error)\n        } else if (resolve) {\n          resolve(file)\n        } else {\n          assert(done, '`done` is defined if `resolve` is not')\n          done(undefined, file)\n        }\n      }\n    }\n  }\n\n  /**\n   * Process the given file as configured on the processor.\n   *\n   * An error is thrown if asynchronous transforms are configured.\n   *\n   * > **Note**: `processSync` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `processSync` performs the parse, run, and stringify phases.\n   *\n   * @param {Compatible | undefined} [file]\n   *   File (optional); typically `string` or `VFile`; any value accepted as\n   *   `x` in `new VFile(x)`.\n   * @returns {VFileWithOutput<CompileResult>}\n   *   The processed file.\n   *\n   *   The parsed, transformed, and compiled value is available at\n   *   `file.value` (see note).\n   *\n   *   > **Note**: unified typically compiles by serializing: most\n   *   > compilers return `string` (or `Uint8Array`).\n   *   > Some compilers, such as the one configured with\n   *   > [`rehype-react`][rehype-react], return other values (in this case, a\n   *   > React tree).\n   *   > If you’re using a compiler that doesn’t serialize, expect different\n   *   > result values.\n   *   >\n   *   > To register custom results in TypeScript, add them to\n   *   > {@linkcode CompileResultMap}.\n   *\n   *   [rehype-react]: https://github.com/rehypejs/rehype-react\n   */\n  processSync(file) {\n    /** @type {boolean} */\n    let complete = false\n    /** @type {VFileWithOutput<CompileResult> | undefined} */\n    let result\n\n    this.freeze()\n    assertParser('processSync', this.parser || this.Parser)\n    assertCompiler('processSync', this.compiler || this.Compiler)\n\n    this.process(file, realDone)\n    assertDone('processSync', 'process', complete)\n    assert(result, 'we either bailed on an error or have a tree')\n\n    return result\n\n    /**\n     * @type {ProcessCallback<VFileWithOutput<CompileResult>>}\n     */\n    function realDone(error, file) {\n      complete = true\n      bail(error)\n      result = file\n    }\n  }\n\n  /**\n   * Run *transformers* on a syntax tree.\n   *\n   * > **Note**: `run` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `run` performs the run phase, not other phases.\n   *\n   * @overload\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n   * @returns {undefined}\n   *\n   * @overload\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   * @param {Compatible | undefined} file\n   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done\n   * @returns {undefined}\n   *\n   * @overload\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   * @param {Compatible | undefined} [file]\n   * @returns {Promise<TailTree extends undefined ? Node : TailTree>}\n   *\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   *   Tree to transform and inspect.\n   * @param {(\n   *   RunCallback<TailTree extends undefined ? Node : TailTree> |\n   *   Compatible\n   * )} [file]\n   *   File associated with `node` (optional); any value accepted as `x` in\n   *   `new VFile(x)`.\n   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]\n   *   Callback (optional).\n   * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}\n   *   Nothing if `done` is given.\n   *   Otherwise, a promise rejected with a fatal error or resolved with the\n   *   transformed tree.\n   */\n  run(tree, file, done) {\n    assertNode(tree)\n    this.freeze()\n\n    const transformers = this.transformers\n\n    if (!done && typeof file === 'function') {\n      done = file\n      file = undefined\n    }\n\n    return done ? executor(undefined, done) : new Promise(executor)\n\n    // Note: `void`s needed for TS.\n    /**\n     * @param {(\n     *   ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n     *   undefined\n     * )} resolve\n     * @param {(error: Error) => undefined | void} reject\n     * @returns {undefined}\n     */\n    function executor(resolve, reject) {\n      assert(\n        typeof file !== 'function',\n        '`file` can’t be a `done` anymore, we checked'\n      )\n      const realFile = vfile(file)\n      transformers.run(tree, realFile, realDone)\n\n      /**\n       * @param {Error | undefined} error\n       * @param {Node} outputTree\n       * @param {VFile} file\n       * @returns {undefined}\n       */\n      function realDone(error, outputTree, file) {\n        const resultingTree =\n          /** @type {TailTree extends undefined ? Node : TailTree} */ (\n            outputTree || tree\n          )\n\n        if (error) {\n          reject(error)\n        } else if (resolve) {\n          resolve(resultingTree)\n        } else {\n          assert(done, '`done` is defined if `resolve` is not')\n          done(undefined, resultingTree, file)\n        }\n      }\n    }\n  }\n\n  /**\n   * Run *transformers* on a syntax tree.\n   *\n   * An error is thrown if asynchronous transforms are configured.\n   *\n   * > **Note**: `runSync` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `runSync` performs the run phase, not other phases.\n   *\n   * @param {HeadTree extends undefined ? Node : HeadTree} tree\n   *   Tree to transform and inspect.\n   * @param {Compatible | undefined} [file]\n   *   File associated with `node` (optional); any value accepted as `x` in\n   *   `new VFile(x)`.\n   * @returns {TailTree extends undefined ? Node : TailTree}\n   *   Transformed tree.\n   */\n  runSync(tree, file) {\n    /** @type {boolean} */\n    let complete = false\n    /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n    let result\n\n    this.run(tree, file, realDone)\n\n    assertDone('runSync', 'run', complete)\n    assert(result, 'we either bailed on an error or have a tree')\n    return result\n\n    /**\n     * @type {RunCallback<TailTree extends undefined ? Node : TailTree>}\n     */\n    function realDone(error, tree) {\n      bail(error)\n      result = tree\n      complete = true\n    }\n  }\n\n  /**\n   * Compile a syntax tree.\n   *\n   * > **Note**: `stringify` freezes the processor if not already *frozen*.\n   *\n   * > **Note**: `stringify` performs the stringify phase, not the run phase\n   * > or other phases.\n   *\n   * @param {CompileTree extends undefined ? Node : CompileTree} tree\n   *   Tree to compile.\n   * @param {Compatible | undefined} [file]\n   *   File associated with `node` (optional); any value accepted as `x` in\n   *   `new VFile(x)`.\n   * @returns {CompileResult extends undefined ? Value : CompileResult}\n   *   Textual representation of the tree (see note).\n   *\n   *   > **Note**: unified typically compiles by serializing: most compilers\n   *   > return `string` (or `Uint8Array`).\n   *   > Some compilers, such as the one configured with\n   *   > [`rehype-react`][rehype-react], return other values (in this case, a\n   *   > React tree).\n   *   > If you’re using a compiler that doesn’t serialize, expect different\n   *   > result values.\n   *   >\n   *   > To register custom results in TypeScript, add them to\n   *   > {@linkcode CompileResultMap}.\n   *\n   *   [rehype-react]: https://github.com/rehypejs/rehype-react\n   */\n  stringify(tree, file) {\n    this.freeze()\n    const realFile = vfile(file)\n    const compiler = this.compiler || this.Compiler\n    assertCompiler('stringify', compiler)\n    assertNode(tree)\n\n    return compiler(tree, realFile)\n  }\n\n  /**\n   * Configure the processor to use a plugin, a list of usable values, or a\n   * preset.\n   *\n   * If the processor is already using a plugin, the previous plugin\n   * configuration is changed based on the options that are passed in.\n   * In other words, the plugin is not added a second time.\n   *\n   * > **Note**: `use` cannot be called on *frozen* processors.\n   * > Call the processor first to create a new unfrozen processor.\n   *\n   * @example\n   *   There are many ways to pass plugins to `.use()`.\n   *   This example gives an overview:\n   *\n   *   ```js\n   *   import {unified} from 'unified'\n   *\n   *   unified()\n   *     // Plugin with options:\n   *     .use(pluginA, {x: true, y: true})\n   *     // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n   *     .use(pluginA, {y: false, z: true})\n   *     // Plugins:\n   *     .use([pluginB, pluginC])\n   *     // Two plugins, the second with options:\n   *     .use([pluginD, [pluginE, {}]])\n   *     // Preset with plugins and settings:\n   *     .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n   *     // Settings only:\n   *     .use({settings: {position: false}})\n   *   ```\n   *\n   * @template {Array<unknown>} [Parameters=[]]\n   * @template {Node | string | undefined} [Input=undefined]\n   * @template [Output=Input]\n   *\n   * @overload\n   * @param {Preset | null | undefined} [preset]\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @overload\n   * @param {PluggableList} list\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *\n   * @overload\n   * @param {Plugin<Parameters, Input, Output>} plugin\n   * @param {...(Parameters | [boolean])} parameters\n   * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}\n   *\n   * @param {PluggableList | Plugin | Preset | null | undefined} value\n   *   Usable value.\n   * @param {...unknown} parameters\n   *   Parameters, when a plugin is given as a usable value.\n   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}\n   *   Current processor.\n   */\n  use(value, ...parameters) {\n    const attachers = this.attachers\n    const namespace = this.namespace\n\n    assertUnfrozen('use', this.frozen)\n\n    if (value === null || value === undefined) {\n      // Empty.\n    } else if (typeof value === 'function') {\n      addPlugin(value, parameters)\n    } else if (typeof value === 'object') {\n      if (Array.isArray(value)) {\n        addList(value)\n      } else {\n        addPreset(value)\n      }\n    } else {\n      throw new TypeError('Expected usable value, not `' + value + '`')\n    }\n\n    return this\n\n    /**\n     * @param {Pluggable} value\n     * @returns {undefined}\n     */\n    function add(value) {\n      if (typeof value === 'function') {\n        addPlugin(value, [])\n      } else if (typeof value === 'object') {\n        if (Array.isArray(value)) {\n          const [plugin, ...parameters] =\n            /** @type {PluginTuple<Array<unknown>>} */ (value)\n          addPlugin(plugin, parameters)\n        } else {\n          addPreset(value)\n        }\n      } else {\n        throw new TypeError('Expected usable value, not `' + value + '`')\n      }\n    }\n\n    /**\n     * @param {Preset} result\n     * @returns {undefined}\n     */\n    function addPreset(result) {\n      if (!('plugins' in result) && !('settings' in result)) {\n        throw new Error(\n          'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n        )\n      }\n\n      addList(result.plugins)\n\n      if (result.settings) {\n        namespace.settings = extend(true, namespace.settings, result.settings)\n      }\n    }\n\n    /**\n     * @param {PluggableList | null | undefined} plugins\n     * @returns {undefined}\n     */\n    function addList(plugins) {\n      let index = -1\n\n      if (plugins === null || plugins === undefined) {\n        // Empty.\n      } else if (Array.isArray(plugins)) {\n        while (++index < plugins.length) {\n          const thing = plugins[index]\n          add(thing)\n        }\n      } else {\n        throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n      }\n    }\n\n    /**\n     * @param {Plugin} plugin\n     * @param {Array<unknown>} parameters\n     * @returns {undefined}\n     */\n    function addPlugin(plugin, parameters) {\n      let index = -1\n      let entryIndex = -1\n\n      while (++index < attachers.length) {\n        if (attachers[index][0] === plugin) {\n          entryIndex = index\n          break\n        }\n      }\n\n      if (entryIndex === -1) {\n        attachers.push([plugin, ...parameters])\n      }\n      // Only set if there was at least a `primary` value, otherwise we’d change\n      // `arguments.length`.\n      else if (parameters.length > 0) {\n        let [primary, ...rest] = parameters\n        const currentPrimary = attachers[entryIndex][1]\n        if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n          primary = extend(true, currentPrimary, primary)\n        }\n\n        attachers[entryIndex] = [plugin, primary, ...rest]\n      }\n    }\n  }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n *   This example shows how a new processor can be created (from `remark`) and linked\n *   to **stdin**(4) and **stdout**(4).\n *\n *   ```js\n *   import process from 'node:process'\n *   import concatStream from 'concat-stream'\n *   import {remark} from 'remark'\n *\n *   process.stdin.pipe(\n *     concatStream(function (buf) {\n *       process.stdout.write(String(remark().processSync(buf)))\n *     })\n *   )\n *   ```\n *\n * @returns\n *   New *unfrozen* processor (`processor`).\n *\n *   This processor is configured to work the same as its ancestor.\n *   When the descendant processor is configured in the future it does not\n *   affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n  if (typeof value !== 'function') {\n    throw new TypeError('Cannot `' + name + '` without `parser`')\n  }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n  if (typeof value !== 'function') {\n    throw new TypeError('Cannot `' + name + '` without `compiler`')\n  }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n  if (frozen) {\n    throw new Error(\n      'Cannot call `' +\n        name +\n        '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n    )\n  }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n  // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n  // type-coverage:ignore-next-line\n  if (!isPlainObj(node) || typeof node.type !== 'string') {\n    throw new TypeError('Expected node, got `' + node + '`')\n    // Fine.\n  }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n  if (!complete) {\n    throw new Error(\n      '`' + name + '` finished async. Use `' + asyncName + '` instead'\n    )\n  }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n  return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      'message' in value &&\n      'messages' in value\n  )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n  return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n *   thing.\n * @returns {value is Uint8Array}\n *   Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      'byteLength' in value &&\n      'byteOffset' in value\n  )\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback\n *   Callback.\n *\n * @typedef {(...input: Array<any>) => any} Middleware\n *   Ware.\n *\n * @typedef Pipeline\n *   Pipeline.\n * @property {Run} run\n *   Run the pipeline.\n * @property {Use} use\n *   Add middleware.\n *\n * @typedef {(...input: Array<any>) => void} Run\n *   Call all middleware.\n *\n *   Calls `done` on completion with either an error or the output of the\n *   last middleware.\n *\n *   > 👉 **Note**: as the length of input defines whether async functions get a\n *   > `next` function,\n *   > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n *   Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n *   Pipeline.\n */\nexport function trough() {\n  /** @type {Array<Middleware>} */\n  const fns = []\n  /** @type {Pipeline} */\n  const pipeline = {run, use}\n\n  return pipeline\n\n  /** @type {Run} */\n  function run(...values) {\n    let middlewareIndex = -1\n    /** @type {Callback} */\n    const callback = values.pop()\n\n    if (typeof callback !== 'function') {\n      throw new TypeError('Expected function as last argument, not ' + callback)\n    }\n\n    next(null, ...values)\n\n    /**\n     * Run the next `fn`, or we’re done.\n     *\n     * @param {Error | null | undefined} error\n     * @param {Array<any>} output\n     */\n    function next(error, ...output) {\n      const fn = fns[++middlewareIndex]\n      let index = -1\n\n      if (error) {\n        callback(error)\n        return\n      }\n\n      // Copy non-nullish input into values.\n      while (++index < values.length) {\n        if (output[index] === null || output[index] === undefined) {\n          output[index] = values[index]\n        }\n      }\n\n      // Save the newly created `output` for the next call.\n      values = output\n\n      // Next or done.\n      if (fn) {\n        wrap(fn, next)(...output)\n      } else {\n        callback(null, ...output)\n      }\n    }\n  }\n\n  /** @type {Use} */\n  function use(middelware) {\n    if (typeof middelware !== 'function') {\n      throw new TypeError(\n        'Expected `middelware` to be a function, not ' + middelware\n      )\n    }\n\n    fns.push(middelware)\n    return pipeline\n  }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n *   returns a promise that is rejected,\n *   or calls the given `done` function with an error,\n *   `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n *   that value is the main output value\n * * if `middleware` calls `done`,\n *   all non-nullish values except for the first one (the error) overwrite the\n *   output values\n *\n * @param {Middleware} middleware\n *   Function to wrap.\n * @param {Callback} callback\n *   Callback called with the output of `middleware`.\n * @returns {Run}\n *   Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n  /** @type {boolean} */\n  let called\n\n  return wrapped\n\n  /**\n   * Call `middleware`.\n   * @this {any}\n   * @param {Array<any>} parameters\n   * @returns {void}\n   */\n  function wrapped(...parameters) {\n    const fnExpectsCallback = middleware.length > parameters.length\n    /** @type {any} */\n    let result\n\n    if (fnExpectsCallback) {\n      parameters.push(done)\n    }\n\n    try {\n      result = middleware.apply(this, parameters)\n    } catch (error) {\n      const exception = /** @type {Error} */ (error)\n\n      // Well, this is quite the pickle.\n      // `middleware` received a callback and called it synchronously, but that\n      // threw an error.\n      // The only thing left to do is to throw the thing instead.\n      if (fnExpectsCallback && called) {\n        throw exception\n      }\n\n      return done(exception)\n    }\n\n    if (!fnExpectsCallback) {\n      if (result && result.then && typeof result.then === 'function') {\n        result.then(then, done)\n      } else if (result instanceof Error) {\n        done(result)\n      } else {\n        then(result)\n      }\n    }\n  }\n\n  /**\n   * Call `callback`, only once.\n   *\n   * @type {Callback}\n   */\n  function done(error, ...output) {\n    if (!called) {\n      called = true\n      callback(error, ...output)\n    }\n  }\n\n  /**\n   * Call `done` with one value.\n   *\n   * @param {any} [value]\n   */\n  function then(value) {\n    done(null, value)\n  }\n}\n","/**\n * Count how often a character (or substring) is used in a string.\n *\n * @param {string} value\n *   Value to search in.\n * @param {string} character\n *   Character (or substring) to look for.\n * @return {number}\n *   Number of times `character` occurred in `value`.\n */\nexport function ccount(value, character) {\n  const source = String(value)\n\n  if (typeof character !== 'string') {\n    throw new TypeError('Expected character')\n  }\n\n  let count = 0\n  let index = source.indexOf(character)\n\n  while (index !== -1) {\n    count++\n    index = source.indexOf(character, index + character.length)\n  }\n\n  return count\n}\n","/**\n * @import {Code} from 'micromark-util-types'\n */\n\n/**\n * Check whether the character code represents an ASCII alpha (`a` through `z`,\n * case insensitive).\n *\n * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.\n *\n * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)\n * to U+005A (`Z`).\n *\n * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)\n * to U+007A (`z`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiAlpha = regexCheck(/[A-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII alphanumeric (`a`\n * through `z`, case insensitive, or `0` through `9`).\n *\n * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha\n * (see `asciiAlpha`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\n\n/**\n * Check whether the character code represents an ASCII atext.\n *\n * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in\n * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),\n * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F\n * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E\n * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE\n * (`{`) to U+007E TILDE (`~`).\n *\n * See:\n * **\\[RFC5322]**:\n * [Internet Message Format](https://tools.ietf.org/html/rfc5322).\n * P. Resnick.\n * IETF.\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiAtext = regexCheck(/[#-'*+\\--9=?A-Z^-~]/);\n\n/**\n * Check whether a character code is an ASCII control character.\n *\n * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)\n * to U+001F (US), or U+007F (DEL).\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function asciiControl(code) {\n  return (\n    // Special whitespace codes (which have negative values), C0 and Control\n    // character DEL\n    code !== null && (code < 32 || code === 127)\n  );\n}\n\n/**\n * Check whether the character code represents an ASCII digit (`0` through `9`).\n *\n * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to\n * U+0039 (`9`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiDigit = regexCheck(/\\d/);\n\n/**\n * Check whether the character code represents an ASCII hex digit (`a` through\n * `f`, case insensitive, or `0` through `9`).\n *\n * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex\n * digit, or an ASCII lower hex digit.\n *\n * An **ASCII upper hex digit** is a character in the inclusive range U+0041\n * (`A`) to U+0046 (`F`).\n *\n * An **ASCII lower hex digit** is a character in the inclusive range U+0061\n * (`a`) to U+0066 (`f`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiHexDigit = regexCheck(/[\\dA-Fa-f]/);\n\n/**\n * Check whether the character code represents ASCII punctuation.\n *\n * An **ASCII punctuation** is a character in the inclusive ranges U+0021\n * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT\n * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT\n * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).\n *\n * @param code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);\n\n/**\n * Check whether a character code is a markdown line ending.\n *\n * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN\n * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).\n *\n * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE\n * RETURN (CR) are replaced by these virtual characters depending on whether\n * they occurred together.\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function markdownLineEnding(code) {\n  return code !== null && code < -2;\n}\n\n/**\n * Check whether a character code is a markdown line ending (see\n * `markdownLineEnding`) or markdown space (see `markdownSpace`).\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function markdownLineEndingOrSpace(code) {\n  return code !== null && (code < 0 || code === 32);\n}\n\n/**\n * Check whether a character code is a markdown space.\n *\n * A **markdown space** is the concrete character U+0020 SPACE (SP) and the\n * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).\n *\n * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is\n * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL\n * SPACE (VS) characters, depending on the column at which the tab occurred.\n *\n * @param {Code} code\n *   Code.\n * @returns {boolean}\n *   Whether it matches.\n */\nexport function markdownSpace(code) {\n  return code === -2 || code === -1 || code === 32;\n}\n\n// Size note: removing ASCII from the regex and using `asciiPunctuation` here\n// In fact adds to the bundle size.\n/**\n * Check whether the character code represents Unicode punctuation.\n *\n * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,\n * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`\n * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`\n * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII\n * punctuation (see `asciiPunctuation`).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n *   Code.\n * @returns\n *   Whether it matches.\n */\nexport const unicodePunctuation = regexCheck(/\\p{P}|\\p{S}/u);\n\n/**\n * Check whether the character code represents Unicode whitespace.\n *\n * Note that this does handle micromark specific markdown whitespace characters.\n * See `markdownLineEndingOrSpace` to check that.\n *\n * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,\n * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),\n * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\\[UNICODE]**).\n *\n * See:\n * **\\[UNICODE]**:\n * [The Unicode Standard](https://www.unicode.org/versions/).\n * Unicode Consortium.\n *\n * @param code\n *   Code.\n * @returns\n *   Whether it matches.\n */\nexport const unicodeWhitespace = regexCheck(/\\s/);\n\n/**\n * Create a code check from a regex.\n *\n * @param {RegExp} regex\n *   Expression.\n * @returns {(code: Code) => boolean}\n *   Check.\n */\nfunction regexCheck(regex) {\n  return check;\n\n  /**\n   * Check whether a code matches the bound regex.\n   *\n   * @param {Code} code\n   *   Character code.\n   * @returns {boolean}\n   *   Whether the character code matches the bound regex.\n   */\n  function check(code) {\n    return code !== null && code > -1 && regex.test(String.fromCharCode(code));\n  }\n}","/**\n * @import {Node, Parent} from 'unist'\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n *   Check that an arbitrary value is a node.\n * @param {unknown} this\n *   The given context.\n * @param {unknown} [node]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node’s parent.\n * @returns {boolean}\n *   Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n *   Object to check for equivalence.\n *\n *   Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n *   Check for an arbitrary node.\n *\n * @callback TestFunction\n *   Check if a node passes a test.\n * @param {unknown} this\n *   The given context.\n * @param {Node} node\n *   A node.\n * @param {number | undefined} [index]\n *   The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n *   The node’s parent.\n * @returns {boolean | undefined | void}\n *   Whether this node passes the test.\n *\n *   Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n *   Thing to check, typically `Node`.\n * @param {Test} test\n *   A check for a specific node.\n * @param {number | null | undefined} index\n *   The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n *   The node’s parent.\n * @param {unknown} context\n *   Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n *   Whether `node` is a node and passes a test.\n */\nexport const is =\n  // Note: overloads in JSDoc can’t yet use different `@template`s.\n  /**\n   * @type {(\n   *   (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n   *   (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n   *   (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n   *   (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n   *   (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n   *   ((node?: null | undefined) => false) &\n   *   ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n   *   ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n   * )}\n   */\n  (\n    /**\n     * @param {unknown} [node]\n     * @param {Test} [test]\n     * @param {number | null | undefined} [index]\n     * @param {Parent | null | undefined} [parent]\n     * @param {unknown} [context]\n     * @returns {boolean}\n     */\n    // eslint-disable-next-line max-params\n    function (node, test, index, parent, context) {\n      const check = convert(test)\n\n      if (\n        index !== undefined &&\n        index !== null &&\n        (typeof index !== 'number' ||\n          index < 0 ||\n          index === Number.POSITIVE_INFINITY)\n      ) {\n        throw new Error('Expected positive finite index')\n      }\n\n      if (\n        parent !== undefined &&\n        parent !== null &&\n        (!is(parent) || !parent.children)\n      ) {\n        throw new Error('Expected parent node')\n      }\n\n      if (\n        (parent === undefined || parent === null) !==\n        (index === undefined || index === null)\n      ) {\n        throw new Error('Expected both parent and index')\n      }\n\n      return looksLikeANode(node)\n        ? check.call(context, node, index, parent)\n        : false\n    }\n  )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n *   *   when nullish, checks if `node` is a `Node`.\n *   *   when `string`, works like passing `(node) => node.type === test`.\n *   *   when `function` checks if function passed the node is true.\n *   *   when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n *   *   when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n *   An assertion.\n */\nexport const convert =\n  // Note: overloads in JSDoc can’t yet use different `@template`s.\n  /**\n   * @type {(\n   *   (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n   *   (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n   *   (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n   *   ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n   *   ((test?: Test) => Check)\n   * )}\n   */\n  (\n    /**\n     * @param {Test} [test]\n     * @returns {Check}\n     */\n    function (test) {\n      if (test === null || test === undefined) {\n        return ok\n      }\n\n      if (typeof test === 'function') {\n        return castFactory(test)\n      }\n\n      if (typeof test === 'object') {\n        return Array.isArray(test)\n          ? anyFactory(test)\n          : // Cast because `ReadonlyArray` goes into the above but `isArray`\n            // narrows to `Array`.\n            propertiesFactory(/** @type {Props} */ (test))\n      }\n\n      if (typeof test === 'string') {\n        return typeFactory(test)\n      }\n\n      throw new Error('Expected function, string, or object as test')\n    }\n  )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n  /** @type {Array<Check>} */\n  const checks = []\n  let index = -1\n\n  while (++index < tests.length) {\n    checks[index] = convert(tests[index])\n  }\n\n  return castFactory(any)\n\n  /**\n   * @this {unknown}\n   * @type {TestFunction}\n   */\n  function any(...parameters) {\n    let index = -1\n\n    while (++index < checks.length) {\n      if (checks[index].apply(this, parameters)) return true\n    }\n\n    return false\n  }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propertiesFactory(check) {\n  const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n  return castFactory(all)\n\n  /**\n   * @param {Node} node\n   * @returns {boolean}\n   */\n  function all(node) {\n    const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n      /** @type {unknown} */ (node)\n    )\n\n    /** @type {string} */\n    let key\n\n    for (key in check) {\n      if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n    }\n\n    return true\n  }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n  return castFactory(type)\n\n  /**\n   * @param {Node} node\n   */\n  function type(node) {\n    return node && node.type === check\n  }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n  return check\n\n  /**\n   * @this {unknown}\n   * @type {Check}\n   */\n  function check(value, index, parent) {\n    return Boolean(\n      looksLikeANode(value) &&\n        testFunction.call(\n          this,\n          value,\n          typeof index === 'number' ? index : undefined,\n          parent || undefined\n        )\n    )\n  }\n}\n\nfunction ok() {\n  return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n  return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n *   Test from `unist-util-is`.\n *\n *   Note: we have remove and add `undefined`, because otherwise when generating\n *   automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n *   which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n *   Fn extends (value: any) => value is infer Thing\n *   ? Thing\n *   : Fallback\n * )} Predicate\n *   Get the value of a type guard `Fn`.\n * @template Fn\n *   Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n *   Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n *   Check extends null | undefined // No test.\n *   ? Value\n *   : Value extends {type: Check} // String (type) test.\n *   ? Value\n *   : Value extends Check // Partial test.\n *   ? Value\n *   : Check extends Function // Function test.\n *   ? Predicate<Check, Value> extends Value\n *     ? Predicate<Check, Value>\n *     : never\n *   : never // Some other test?\n * )} MatchesOne\n *   Check whether a node matches a primitive check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n *   Check extends ReadonlyArray<infer T>\n *   ? MatchesOne<Value, T>\n *   : Check extends Array<infer T>\n *   ? MatchesOne<Value, T>\n *   : MatchesOne<Value, Check>\n * )} Matches\n *   Check whether a node matches a check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n *   Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n *   Increment a number in the type system.\n * @template {Uint} [I=0]\n *   Index.\n */\n\n/**\n * @typedef {(\n *   Node extends UnistParent\n *   ? Node extends {children: Array<infer Children>}\n *     ? Child extends Children ? Node : never\n *     : never\n *   : never\n * )} InternalParent\n *   Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n *   Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {(\n *   Depth extends Max\n *   ? never\n *   :\n *     | InternalParent<Node, Child>\n *     | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n *   Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor\n *   Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {(\n *   Tree extends UnistParent\n *     ? Depth extends Max\n *       ? Tree\n *       : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n *     : Tree\n * )} InclusiveDescendant\n *   Collect all (inclusive) descendants of `Tree`.\n *\n *   > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n *   > recurse without actually running into an infinite loop, which the\n *   > previous version did.\n *   >\n *   > Practically, a max of `2` is typically enough assuming a `Root` is\n *   > passed, but it doesn’t improve performance.\n *   > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n *   > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n *   Tree type.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n *   Union of the action types.\n *\n * @typedef {number} Index\n *   Move to the sibling at `index` next (after node itself is completely\n *   traversed).\n *\n *   Useful if mutating the tree, such as removing the node the visitor is\n *   currently on, or any of its previous siblings.\n *   Results less than 0 or greater than or equal to `children.length` stop\n *   traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n *   List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n *   Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform the parent of node (the last of `ancestors`).\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of an ancestor still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Array<VisitedParents>} ancestors\n *   Ancestors of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n *   Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n *   Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor\n *   Build a typed `Visitor` function from a tree and a test.\n *\n *   It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n *   Tree type.\n * @template {Test} [Check=Test]\n *   Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly<ActionTuple>} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n *   Tree to traverse.\n * @param {Visitor | Test} test\n *   `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n *   Handle each node.\n * @param {boolean | null | undefined} [reverse]\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n *   Nothing.\n *\n * @template {UnistNode} Tree\n *   Node type.\n * @template {Test} Check\n *   `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n  /** @type {Test} */\n  let check\n\n  if (typeof test === 'function' && typeof visitor !== 'function') {\n    reverse = visitor\n    // @ts-expect-error no visitor given, so `visitor` is test.\n    visitor = test\n  } else {\n    // @ts-expect-error visitor given, so `test` isn’t a visitor.\n    check = test\n  }\n\n  const is = convert(check)\n  const step = reverse ? -1 : 1\n\n  factory(tree, undefined, [])()\n\n  /**\n   * @param {UnistNode} node\n   * @param {number | undefined} index\n   * @param {Array<UnistParent>} parents\n   */\n  function factory(node, index, parents) {\n    const value = /** @type {Record<string, unknown>} */ (\n      node && typeof node === 'object' ? node : {}\n    )\n\n    if (typeof value.type === 'string') {\n      const name =\n        // `hast`\n        typeof value.tagName === 'string'\n          ? value.tagName\n          : // `xast`\n            typeof value.name === 'string'\n            ? value.name\n            : undefined\n\n      Object.defineProperty(visit, 'name', {\n        value:\n          'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n      })\n    }\n\n    return visit\n\n    function visit() {\n      /** @type {Readonly<ActionTuple>} */\n      let result = empty\n      /** @type {Readonly<ActionTuple>} */\n      let subresult\n      /** @type {number} */\n      let offset\n      /** @type {Array<UnistParent>} */\n      let grandparents\n\n      if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n        // @ts-expect-error: `visitor` is now a visitor.\n        result = toResult(visitor(node, parents))\n\n        if (result[0] === EXIT) {\n          return result\n        }\n      }\n\n      if ('children' in node && node.children) {\n        const nodeAsParent = /** @type {UnistParent} */ (node)\n\n        if (nodeAsParent.children && result[0] !== SKIP) {\n          offset = (reverse ? nodeAsParent.children.length : -1) + step\n          grandparents = parents.concat(nodeAsParent)\n\n          while (offset > -1 && offset < nodeAsParent.children.length) {\n            const child = nodeAsParent.children[offset]\n\n            subresult = factory(child, offset, grandparents)()\n\n            if (subresult[0] === EXIT) {\n              return subresult\n            }\n\n            offset =\n              typeof subresult[1] === 'number' ? subresult[1] : offset + step\n          }\n        }\n      }\n\n      return result\n    }\n  }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n *   Valid return values from visitors.\n * @returns {Readonly<ActionTuple>}\n *   Clean result.\n */\nfunction toResult(value) {\n  if (Array.isArray(value)) {\n    return value\n  }\n\n  if (typeof value === 'number') {\n    return [CONTINUE, value]\n  }\n\n  return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @import {Nodes, Parents, PhrasingContent, Root, Text} from 'mdast'\n * @import {BuildVisitor, Test, VisitorResult} from 'unist-util-visit-parents'\n */\n\n/**\n * @typedef RegExpMatchObject\n *   Info on the match.\n * @property {number} index\n *   The index of the search at which the result was found.\n * @property {string} input\n *   A copy of the search string in the text node.\n * @property {[...Array<Parents>, Text]} stack\n *   All ancestors of the text node, where the last node is the text itself.\n *\n * @typedef {RegExp | string} Find\n *   Pattern to find.\n *\n *   Strings are escaped and then turned into global expressions.\n *\n * @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList\n *   Several find and replaces, in array form.\n *\n * @typedef {[Find, Replace?]} FindAndReplaceTuple\n *   Find and replace in tuple form.\n *\n * @typedef {ReplaceFunction | string | null | undefined} Replace\n *   Thing to replace with.\n *\n * @callback ReplaceFunction\n *   Callback called when a search matches.\n * @param {...any} parameters\n *   The parameters are the result of corresponding search expression:\n *\n *   * `value` (`string`) — whole match\n *   * `...capture` (`Array<string>`) — matches from regex capture groups\n *   * `match` (`RegExpMatchObject`) — info on the match\n * @returns {Array<PhrasingContent> | PhrasingContent | string | false | null | undefined}\n *   Thing to replace with.\n *\n *   * when `null`, `undefined`, `''`, remove the match\n *   * …or when `false`, do not replace at all\n *   * …or when `string`, replace with a text node of that value\n *   * …or when `Node` or `Array<Node>`, replace with those nodes\n *\n * @typedef {[RegExp, ReplaceFunction]} Pair\n *   Normalized find and replace.\n *\n * @typedef {Array<Pair>} Pairs\n *   All find and replaced.\n *\n * @typedef Options\n *   Configuration.\n * @property {Test | null | undefined} [ignore]\n *   Test for which nodes to ignore (optional).\n */\n\nimport escape from 'escape-string-regexp'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {convert} from 'unist-util-is'\n\n/**\n * Find patterns in a tree and replace them.\n *\n * The algorithm searches the tree in *preorder* for complete values in `Text`\n * nodes.\n * Partial matches are not supported.\n *\n * @param {Nodes} tree\n *   Tree to change.\n * @param {FindAndReplaceList | FindAndReplaceTuple} list\n *   Patterns to find.\n * @param {Options | null | undefined} [options]\n *   Configuration (when `find` is not `Find`).\n * @returns {undefined}\n *   Nothing.\n */\nexport function findAndReplace(tree, list, options) {\n  const settings = options || {}\n  const ignored = convert(settings.ignore || [])\n  const pairs = toPairs(list)\n  let pairIndex = -1\n\n  while (++pairIndex < pairs.length) {\n    visitParents(tree, 'text', visitor)\n  }\n\n  /** @type {BuildVisitor<Root, 'text'>} */\n  function visitor(node, parents) {\n    let index = -1\n    /** @type {Parents | undefined} */\n    let grandparent\n\n    while (++index < parents.length) {\n      const parent = parents[index]\n      /** @type {Array<Nodes> | undefined} */\n      const siblings = grandparent ? grandparent.children : undefined\n\n      if (\n        ignored(\n          parent,\n          siblings ? siblings.indexOf(parent) : undefined,\n          grandparent\n        )\n      ) {\n        return\n      }\n\n      grandparent = parent\n    }\n\n    if (grandparent) {\n      return handler(node, parents)\n    }\n  }\n\n  /**\n   * Handle a text node which is not in an ignored parent.\n   *\n   * @param {Text} node\n   *   Text node.\n   * @param {Array<Parents>} parents\n   *   Parents.\n   * @returns {VisitorResult}\n   *   Result.\n   */\n  function handler(node, parents) {\n    const parent = parents[parents.length - 1]\n    const find = pairs[pairIndex][0]\n    const replace = pairs[pairIndex][1]\n    let start = 0\n    /** @type {Array<Nodes>} */\n    const siblings = parent.children\n    const index = siblings.indexOf(node)\n    let change = false\n    /** @type {Array<PhrasingContent>} */\n    let nodes = []\n\n    find.lastIndex = 0\n\n    let match = find.exec(node.value)\n\n    while (match) {\n      const position = match.index\n      /** @type {RegExpMatchObject} */\n      const matchObject = {\n        index: match.index,\n        input: match.input,\n        stack: [...parents, node]\n      }\n      let value = replace(...match, matchObject)\n\n      if (typeof value === 'string') {\n        value = value.length > 0 ? {type: 'text', value} : undefined\n      }\n\n      // It wasn’t a match after all.\n      if (value === false) {\n        // False acts as if there was no match.\n        // So we need to reset `lastIndex`, which currently being at the end of\n        // the current match, to the beginning.\n        find.lastIndex = position + 1\n      } else {\n        if (start !== position) {\n          nodes.push({\n            type: 'text',\n            value: node.value.slice(start, position)\n          })\n        }\n\n        if (Array.isArray(value)) {\n          nodes.push(...value)\n        } else if (value) {\n          nodes.push(value)\n        }\n\n        start = position + match[0].length\n        change = true\n      }\n\n      if (!find.global) {\n        break\n      }\n\n      match = find.exec(node.value)\n    }\n\n    if (change) {\n      if (start < node.value.length) {\n        nodes.push({type: 'text', value: node.value.slice(start)})\n      }\n\n      parent.children.splice(index, 1, ...nodes)\n    } else {\n      nodes = [node]\n    }\n\n    return index + nodes.length\n  }\n}\n\n/**\n * Turn a tuple or a list of tuples into pairs.\n *\n * @param {FindAndReplaceList | FindAndReplaceTuple} tupleOrList\n *   Schema.\n * @returns {Pairs}\n *   Clean pairs.\n */\nfunction toPairs(tupleOrList) {\n  /** @type {Pairs} */\n  const result = []\n\n  if (!Array.isArray(tupleOrList)) {\n    throw new TypeError('Expected find and replace tuple or list of tuples')\n  }\n\n  /** @type {FindAndReplaceList} */\n  // @ts-expect-error: correct.\n  const list =\n    !tupleOrList[0] || Array.isArray(tupleOrList[0])\n      ? tupleOrList\n      : [tupleOrList]\n\n  let index = -1\n\n  while (++index < list.length) {\n    const tuple = list[index]\n    result.push([toExpression(tuple[0]), toFunction(tuple[1])])\n  }\n\n  return result\n}\n\n/**\n * Turn a find into an expression.\n *\n * @param {Find} find\n *   Find.\n * @returns {RegExp}\n *   Expression.\n */\nfunction toExpression(find) {\n  return typeof find === 'string' ? new RegExp(escape(find), 'g') : find\n}\n\n/**\n * Turn a replace into a function.\n *\n * @param {Replace} replace\n *   Replace.\n * @returns {ReplaceFunction}\n *   Function.\n */\nfunction toFunction(replace) {\n  return typeof replace === 'function'\n    ? replace\n    : function () {\n        return replace\n      }\n}\n","export default function escapeStringRegexp(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError('Expected a string');\n\t}\n\n\t// Escape characters with special meaning either inside or outside character sets.\n\t// Use a simple backslash escape when it’s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.\n\treturn string\n\t\t.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n\t\t.replace(/-/g, '\\\\x2d');\n}\n","/**\n * @import {RegExpMatchObject, ReplaceFunction} from 'mdast-util-find-and-replace'\n * @import {CompileContext, Extension as FromMarkdownExtension, Handle as FromMarkdownHandle, Transform as FromMarkdownTransform} from 'mdast-util-from-markdown'\n * @import {ConstructName, Options as ToMarkdownExtension} from 'mdast-util-to-markdown'\n * @import {Link, PhrasingContent} from 'mdast'\n */\n\nimport {ccount} from 'ccount'\nimport {ok as assert} from 'devlop'\nimport {unicodePunctuation, unicodeWhitespace} from 'micromark-util-character'\nimport {findAndReplace} from 'mdast-util-find-and-replace'\n\n/** @type {ConstructName} */\nconst inConstruct = 'phrasing'\n/** @type {Array<ConstructName>} */\nconst notInConstruct = ['autolink', 'link', 'image', 'label']\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM autolink\n * literals in markdown.\n *\n * @returns {FromMarkdownExtension}\n *   Extension for `mdast-util-to-markdown` to enable GFM autolink literals.\n */\nexport function gfmAutolinkLiteralFromMarkdown() {\n  return {\n    transforms: [transformGfmAutolinkLiterals],\n    enter: {\n      literalAutolink: enterLiteralAutolink,\n      literalAutolinkEmail: enterLiteralAutolinkValue,\n      literalAutolinkHttp: enterLiteralAutolinkValue,\n      literalAutolinkWww: enterLiteralAutolinkValue\n    },\n    exit: {\n      literalAutolink: exitLiteralAutolink,\n      literalAutolinkEmail: exitLiteralAutolinkEmail,\n      literalAutolinkHttp: exitLiteralAutolinkHttp,\n      literalAutolinkWww: exitLiteralAutolinkWww\n    }\n  }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM autolink\n * literals in markdown.\n *\n * @returns {ToMarkdownExtension}\n *   Extension for `mdast-util-to-markdown` to enable GFM autolink literals.\n */\nexport function gfmAutolinkLiteralToMarkdown() {\n  return {\n    unsafe: [\n      {\n        character: '@',\n        before: '[+\\\\-.\\\\w]',\n        after: '[\\\\-.\\\\w]',\n        inConstruct,\n        notInConstruct\n      },\n      {\n        character: '.',\n        before: '[Ww]',\n        after: '[\\\\-.\\\\w]',\n        inConstruct,\n        notInConstruct\n      },\n      {\n        character: ':',\n        before: '[ps]',\n        after: '\\\\/',\n        inConstruct,\n        notInConstruct\n      }\n    ]\n  }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterLiteralAutolink(token) {\n  this.enter({type: 'link', title: null, url: '', children: []}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterLiteralAutolinkValue(token) {\n  this.config.enter.autolinkProtocol.call(this, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolinkHttp(token) {\n  this.config.exit.autolinkProtocol.call(this, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolinkWww(token) {\n  this.config.exit.data.call(this, token)\n  const node = this.stack[this.stack.length - 1]\n  assert(node.type === 'link')\n  node.url = 'http://' + this.sliceSerialize(token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolinkEmail(token) {\n  this.config.exit.autolinkEmail.call(this, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolink(token) {\n  this.exit(token)\n}\n\n/** @type {FromMarkdownTransform} */\nfunction transformGfmAutolinkLiterals(tree) {\n  findAndReplace(\n    tree,\n    [\n      [/(https?:\\/\\/|www(?=\\.))([-.\\w]+)([^ \\t\\r\\n]*)/gi, findUrl],\n      [/(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)/gu, findEmail]\n    ],\n    {ignore: ['link', 'linkReference']}\n  )\n}\n\n/**\n * @type {ReplaceFunction}\n * @param {string} _\n * @param {string} protocol\n * @param {string} domain\n * @param {string} path\n * @param {RegExpMatchObject} match\n * @returns {Array<PhrasingContent> | Link | false}\n */\n// eslint-disable-next-line max-params\nfunction findUrl(_, protocol, domain, path, match) {\n  let prefix = ''\n\n  // Not an expected previous character.\n  if (!previous(match)) {\n    return false\n  }\n\n  // Treat `www` as part of the domain.\n  if (/^w/i.test(protocol)) {\n    domain = protocol + domain\n    protocol = ''\n    prefix = 'http://'\n  }\n\n  if (!isCorrectDomain(domain)) {\n    return false\n  }\n\n  const parts = splitUrl(domain + path)\n\n  if (!parts[0]) return false\n\n  /** @type {Link} */\n  const result = {\n    type: 'link',\n    title: null,\n    url: prefix + protocol + parts[0],\n    children: [{type: 'text', value: protocol + parts[0]}]\n  }\n\n  if (parts[1]) {\n    return [result, {type: 'text', value: parts[1]}]\n  }\n\n  return result\n}\n\n/**\n * @type {ReplaceFunction}\n * @param {string} _\n * @param {string} atext\n * @param {string} label\n * @param {RegExpMatchObject} match\n * @returns {Link | false}\n */\nfunction findEmail(_, atext, label, match) {\n  if (\n    // Not an expected previous character.\n    !previous(match, true) ||\n    // Label ends in not allowed character.\n    /[-\\d_]$/.test(label)\n  ) {\n    return false\n  }\n\n  return {\n    type: 'link',\n    title: null,\n    url: 'mailto:' + atext + '@' + label,\n    children: [{type: 'text', value: atext + '@' + label}]\n  }\n}\n\n/**\n * @param {string} domain\n * @returns {boolean}\n */\nfunction isCorrectDomain(domain) {\n  const parts = domain.split('.')\n\n  if (\n    parts.length < 2 ||\n    (parts[parts.length - 1] &&\n      (/_/.test(parts[parts.length - 1]) ||\n        !/[a-zA-Z\\d]/.test(parts[parts.length - 1]))) ||\n    (parts[parts.length - 2] &&\n      (/_/.test(parts[parts.length - 2]) ||\n        !/[a-zA-Z\\d]/.test(parts[parts.length - 2])))\n  ) {\n    return false\n  }\n\n  return true\n}\n\n/**\n * @param {string} url\n * @returns {[string, string | undefined]}\n */\nfunction splitUrl(url) {\n  const trailExec = /[!\"&'),.:;<>?\\]}]+$/.exec(url)\n\n  if (!trailExec) {\n    return [url, undefined]\n  }\n\n  url = url.slice(0, trailExec.index)\n\n  let trail = trailExec[0]\n  let closingParenIndex = trail.indexOf(')')\n  const openingParens = ccount(url, '(')\n  let closingParens = ccount(url, ')')\n\n  while (closingParenIndex !== -1 && openingParens > closingParens) {\n    url += trail.slice(0, closingParenIndex + 1)\n    trail = trail.slice(closingParenIndex + 1)\n    closingParenIndex = trail.indexOf(')')\n    closingParens++\n  }\n\n  return [url, trail]\n}\n\n/**\n * @param {RegExpMatchObject} match\n * @param {boolean | null | undefined} [email=false]\n * @returns {boolean}\n */\nfunction previous(match, email) {\n  const code = match.input.charCodeAt(match.index - 1)\n\n  return (\n    (match.index === 0 ||\n      unicodeWhitespace(code) ||\n      unicodePunctuation(code)) &&\n    // If it’s an email, the previous character should not be a slash.\n    (!email || code !== 47)\n  )\n}\n","/**\n * Normalize an identifier (as found in references, definitions).\n *\n * Collapses markdown whitespace, trim, and then lower- and uppercase.\n *\n * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their\n * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different\n * uppercase character (U+0398 (`Θ`)).\n * So, to get a canonical form, we perform both lower- and uppercase.\n *\n * Using uppercase last makes sure keys will never interact with default\n * prototypal values (such as `constructor`): nothing in the prototype of\n * `Object` is uppercase.\n *\n * @param {string} value\n *   Identifier to normalize.\n * @returns {string}\n *   Normalized identifier.\n */\nexport function normalizeIdentifier(value) {\n  return value\n  // Collapse markdown whitespace.\n  .replace(/[\\t\\n\\r ]+/g, \" \")\n  // Trim.\n  .replace(/^ | $/g, '')\n  // Some characters are considered “uppercase”, but if their lowercase\n  // counterpart is uppercased will result in a different uppercase\n  // character.\n  // Hence, to get that form, we perform both lower- and uppercase.\n  // Upper case makes sure keys will not interact with default prototypal\n  // methods: no method is uppercase.\n  .toLowerCase().toUpperCase();\n}","/**\n * @import {\n *   CompileContext,\n *   Extension as FromMarkdownExtension,\n *   Handle as FromMarkdownHandle\n * } from 'mdast-util-from-markdown'\n * @import {ToMarkdownOptions} from 'mdast-util-gfm-footnote'\n * @import {\n *   Handle as ToMarkdownHandle,\n *   Map,\n *   Options as ToMarkdownExtension\n * } from 'mdast-util-to-markdown'\n * @import {FootnoteDefinition, FootnoteReference} from 'mdast'\n */\n\nimport {ok as assert} from 'devlop'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\n\nfootnoteReference.peek = footnoteReferencePeek\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteCallString() {\n  this.buffer()\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteCall(token) {\n  this.enter({type: 'footnoteReference', identifier: '', label: ''}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteDefinitionLabelString() {\n  this.buffer()\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteDefinition(token) {\n  this.enter(\n    {type: 'footnoteDefinition', identifier: '', label: '', children: []},\n    token\n  )\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteCallString(token) {\n  const label = this.resume()\n  const node = this.stack[this.stack.length - 1]\n  assert(node.type === 'footnoteReference')\n  node.identifier = normalizeIdentifier(\n    this.sliceSerialize(token)\n  ).toLowerCase()\n  node.label = label\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteCall(token) {\n  this.exit(token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteDefinitionLabelString(token) {\n  const label = this.resume()\n  const node = this.stack[this.stack.length - 1]\n  assert(node.type === 'footnoteDefinition')\n  node.identifier = normalizeIdentifier(\n    this.sliceSerialize(token)\n  ).toLowerCase()\n  node.label = label\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteDefinition(token) {\n  this.exit(token)\n}\n\n/** @type {ToMarkdownHandle} */\nfunction footnoteReferencePeek() {\n  return '['\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {FootnoteReference} node\n */\nfunction footnoteReference(node, _, state, info) {\n  const tracker = state.createTracker(info)\n  let value = tracker.move('[^')\n  const exit = state.enter('footnoteReference')\n  const subexit = state.enter('reference')\n  value += tracker.move(\n    state.safe(state.associationId(node), {after: ']', before: value})\n  )\n  subexit()\n  exit()\n  value += tracker.move(']')\n  return value\n}\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM footnotes\n * in markdown.\n *\n * @returns {FromMarkdownExtension}\n *   Extension for `mdast-util-from-markdown`.\n */\nexport function gfmFootnoteFromMarkdown() {\n  return {\n    enter: {\n      gfmFootnoteCallString: enterFootnoteCallString,\n      gfmFootnoteCall: enterFootnoteCall,\n      gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,\n      gfmFootnoteDefinition: enterFootnoteDefinition\n    },\n    exit: {\n      gfmFootnoteCallString: exitFootnoteCallString,\n      gfmFootnoteCall: exitFootnoteCall,\n      gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,\n      gfmFootnoteDefinition: exitFootnoteDefinition\n    }\n  }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM footnotes\n * in markdown.\n *\n * @param {ToMarkdownOptions | null | undefined} [options]\n *   Configuration (optional).\n * @returns {ToMarkdownExtension}\n *   Extension for `mdast-util-to-markdown`.\n */\nexport function gfmFootnoteToMarkdown(options) {\n  // To do: next major: change default.\n  let firstLineBlank = false\n\n  if (options && options.firstLineBlank) {\n    firstLineBlank = true\n  }\n\n  return {\n    handlers: {footnoteDefinition, footnoteReference},\n    // This is on by default already.\n    unsafe: [{character: '[', inConstruct: ['label', 'phrasing', 'reference']}]\n  }\n\n  /**\n   * @type {ToMarkdownHandle}\n   * @param {FootnoteDefinition} node\n   */\n  function footnoteDefinition(node, _, state, info) {\n    const tracker = state.createTracker(info)\n    let value = tracker.move('[^')\n    const exit = state.enter('footnoteDefinition')\n    const subexit = state.enter('label')\n    value += tracker.move(\n      state.safe(state.associationId(node), {before: value, after: ']'})\n    )\n    subexit()\n\n    value += tracker.move(']:')\n\n    if (node.children && node.children.length > 0) {\n      tracker.shift(4)\n\n      value += tracker.move(\n        (firstLineBlank ? '\\n' : ' ') +\n          state.indentLines(\n            state.containerFlow(node, tracker.current()),\n            firstLineBlank ? mapAll : mapExceptFirst\n          )\n      )\n    }\n\n    exit()\n\n    return value\n  }\n}\n\n/** @type {Map} */\nfunction mapExceptFirst(line, index, blank) {\n  return index === 0 ? line : mapAll(line, index, blank)\n}\n\n/** @type {Map} */\nfunction mapAll(line, index, blank) {\n  return (blank ? '' : '    ') + line\n}\n","/**\n * @typedef {import('mdast').Delete} Delete\n *\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n *\n * @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n */\n\n/**\n * List of constructs that occur in phrasing (paragraphs, headings), but cannot\n * contain strikethrough.\n * So they sort of cancel each other out.\n * Note: could use a better name.\n *\n * Note: keep in sync with: <https://github.com/syntax-tree/mdast-util-to-markdown/blob/8ce8dbf/lib/unsafe.js#L14>\n *\n * @type {Array<ConstructName>}\n */\nconst constructsWithoutStrikethrough = [\n  'autolink',\n  'destinationLiteral',\n  'destinationRaw',\n  'reference',\n  'titleQuote',\n  'titleApostrophe'\n]\n\nhandleDelete.peek = peekDelete\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM\n * strikethrough in markdown.\n *\n * @returns {FromMarkdownExtension}\n *   Extension for `mdast-util-from-markdown` to enable GFM strikethrough.\n */\nexport function gfmStrikethroughFromMarkdown() {\n  return {\n    canContainEols: ['delete'],\n    enter: {strikethrough: enterStrikethrough},\n    exit: {strikethrough: exitStrikethrough}\n  }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM\n * strikethrough in markdown.\n *\n * @returns {ToMarkdownExtension}\n *   Extension for `mdast-util-to-markdown` to enable GFM strikethrough.\n */\nexport function gfmStrikethroughToMarkdown() {\n  return {\n    unsafe: [\n      {\n        character: '~',\n        inConstruct: 'phrasing',\n        notInConstruct: constructsWithoutStrikethrough\n      }\n    ],\n    handlers: {delete: handleDelete}\n  }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterStrikethrough(token) {\n  this.enter({type: 'delete', children: []}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitStrikethrough(token) {\n  this.exit(token)\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {Delete} node\n */\nfunction handleDelete(node, _, state, info) {\n  const tracker = state.createTracker(info)\n  const exit = state.enter('strikethrough')\n  let value = tracker.move('~~')\n  value += state.containerPhrasing(node, {\n    ...tracker.current(),\n    before: value,\n    after: '~'\n  })\n  value += tracker.move('~~')\n  exit()\n  return value\n}\n\n/** @type {ToMarkdownHandle} */\nfunction peekDelete() {\n  return '~'\n}\n","// To do: next major: remove.\n/**\n * @typedef {Options} MarkdownTableOptions\n *   Configuration.\n */\n\n/**\n * @typedef Options\n *   Configuration.\n * @property {boolean | null | undefined} [alignDelimiters=true]\n *   Whether to align the delimiters (default: `true`);\n *   they are aligned by default:\n *\n *   ```markdown\n *   | Alpha | B     |\n *   | ----- | ----- |\n *   | C     | Delta |\n *   ```\n *\n *   Pass `false` to make them staggered:\n *\n *   ```markdown\n *   | Alpha | B |\n *   | - | - |\n *   | C | Delta |\n *   ```\n * @property {ReadonlyArray<string | null | undefined> | string | null | undefined} [align]\n *   How to align columns (default: `''`);\n *   one style for all columns or styles for their respective columns;\n *   each style is either `'l'` (left), `'r'` (right), or `'c'` (center);\n *   other values are treated as `''`, which doesn’t place the colon in the\n *   alignment row but does align left;\n *   *only the lowercased first character is used, so `Right` is fine.*\n * @property {boolean | null | undefined} [delimiterEnd=true]\n *   Whether to end each row with the delimiter (default: `true`).\n *\n *   > 👉 **Note**: please don’t use this: it could create fragile structures\n *   > that aren’t understandable to some markdown parsers.\n *\n *   When `true`, there are ending delimiters:\n *\n *   ```markdown\n *   | Alpha | B     |\n *   | ----- | ----- |\n *   | C     | Delta |\n *   ```\n *\n *   When `false`, there are no ending delimiters:\n *\n *   ```markdown\n *   | Alpha | B\n *   | ----- | -----\n *   | C     | Delta\n *   ```\n * @property {boolean | null | undefined} [delimiterStart=true]\n *   Whether to begin each row with the delimiter (default: `true`).\n *\n *   > 👉 **Note**: please don’t use this: it could create fragile structures\n *   > that aren’t understandable to some markdown parsers.\n *\n *   When `true`, there are starting delimiters:\n *\n *   ```markdown\n *   | Alpha | B     |\n *   | ----- | ----- |\n *   | C     | Delta |\n *   ```\n *\n *   When `false`, there are no starting delimiters:\n *\n *   ```markdown\n *   Alpha | B     |\n *   ----- | ----- |\n *   C     | Delta |\n *   ```\n * @property {boolean | null | undefined} [padding=true]\n *   Whether to add a space of padding between delimiters and cells\n *   (default: `true`).\n *\n *   When `true`, there is padding:\n *\n *   ```markdown\n *   | Alpha | B     |\n *   | ----- | ----- |\n *   | C     | Delta |\n *   ```\n *\n *   When `false`, there is no padding:\n *\n *   ```markdown\n *   |Alpha|B    |\n *   |-----|-----|\n *   |C    |Delta|\n *   ```\n * @property {((value: string) => number) | null | undefined} [stringLength]\n *   Function to detect the length of table cell content (optional);\n *   this is used when aligning the delimiters (`|`) between table cells;\n *   full-width characters and emoji mess up delimiter alignment when viewing\n *   the markdown source;\n *   to fix this, you can pass this function,\n *   which receives the cell content and returns its “visible” size;\n *   note that what is and isn’t visible depends on where the text is displayed.\n *\n *   Without such a function, the following:\n *\n *   ```js\n *   markdownTable([\n *     ['Alpha', 'Bravo'],\n *     ['中文', 'Charlie'],\n *     ['👩‍❤️‍👩', 'Delta']\n *   ])\n *   ```\n *\n *   Yields:\n *\n *   ```markdown\n *   | Alpha | Bravo |\n *   | - | - |\n *   | 中文 | Charlie |\n *   | 👩‍❤️‍👩 | Delta |\n *   ```\n *\n *   With [`string-width`](https://github.com/sindresorhus/string-width):\n *\n *   ```js\n *   import stringWidth from 'string-width'\n *\n *   markdownTable(\n *     [\n *       ['Alpha', 'Bravo'],\n *       ['中文', 'Charlie'],\n *       ['👩‍❤️‍👩', 'Delta']\n *     ],\n *     {stringLength: stringWidth}\n *   )\n *   ```\n *\n *   Yields:\n *\n *   ```markdown\n *   | Alpha | Bravo   |\n *   | ----- | ------- |\n *   | 中文  | Charlie |\n *   | 👩‍❤️‍👩    | Delta   |\n *   ```\n */\n\n/**\n * @param {string} value\n *   Cell value.\n * @returns {number}\n *   Cell size.\n */\nfunction defaultStringLength(value) {\n  return value.length\n}\n\n/**\n * Generate a markdown\n * ([GFM](https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables))\n * table.\n *\n * @param {ReadonlyArray<ReadonlyArray<string | null | undefined>>} table\n *   Table data (matrix of strings).\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Result.\n */\nexport function markdownTable(table, options) {\n  const settings = options || {}\n  // To do: next major: change to spread.\n  const align = (settings.align || []).concat()\n  const stringLength = settings.stringLength || defaultStringLength\n  /** @type {Array<number>} Character codes as symbols for alignment per column. */\n  const alignments = []\n  /** @type {Array<Array<string>>} Cells per row. */\n  const cellMatrix = []\n  /** @type {Array<Array<number>>} Sizes of each cell per row. */\n  const sizeMatrix = []\n  /** @type {Array<number>} */\n  const longestCellByColumn = []\n  let mostCellsPerRow = 0\n  let rowIndex = -1\n\n  // This is a superfluous loop if we don’t align delimiters, but otherwise we’d\n  // do superfluous work when aligning, so optimize for aligning.\n  while (++rowIndex < table.length) {\n    /** @type {Array<string>} */\n    const row = []\n    /** @type {Array<number>} */\n    const sizes = []\n    let columnIndex = -1\n\n    if (table[rowIndex].length > mostCellsPerRow) {\n      mostCellsPerRow = table[rowIndex].length\n    }\n\n    while (++columnIndex < table[rowIndex].length) {\n      const cell = serialize(table[rowIndex][columnIndex])\n\n      if (settings.alignDelimiters !== false) {\n        const size = stringLength(cell)\n        sizes[columnIndex] = size\n\n        if (\n          longestCellByColumn[columnIndex] === undefined ||\n          size > longestCellByColumn[columnIndex]\n        ) {\n          longestCellByColumn[columnIndex] = size\n        }\n      }\n\n      row.push(cell)\n    }\n\n    cellMatrix[rowIndex] = row\n    sizeMatrix[rowIndex] = sizes\n  }\n\n  // Figure out which alignments to use.\n  let columnIndex = -1\n\n  if (typeof align === 'object' && 'length' in align) {\n    while (++columnIndex < mostCellsPerRow) {\n      alignments[columnIndex] = toAlignment(align[columnIndex])\n    }\n  } else {\n    const code = toAlignment(align)\n\n    while (++columnIndex < mostCellsPerRow) {\n      alignments[columnIndex] = code\n    }\n  }\n\n  // Inject the alignment row.\n  columnIndex = -1\n  /** @type {Array<string>} */\n  const row = []\n  /** @type {Array<number>} */\n  const sizes = []\n\n  while (++columnIndex < mostCellsPerRow) {\n    const code = alignments[columnIndex]\n    let before = ''\n    let after = ''\n\n    if (code === 99 /* `c` */) {\n      before = ':'\n      after = ':'\n    } else if (code === 108 /* `l` */) {\n      before = ':'\n    } else if (code === 114 /* `r` */) {\n      after = ':'\n    }\n\n    // There *must* be at least one hyphen-minus in each alignment cell.\n    let size =\n      settings.alignDelimiters === false\n        ? 1\n        : Math.max(\n            1,\n            longestCellByColumn[columnIndex] - before.length - after.length\n          )\n\n    const cell = before + '-'.repeat(size) + after\n\n    if (settings.alignDelimiters !== false) {\n      size = before.length + size + after.length\n\n      if (size > longestCellByColumn[columnIndex]) {\n        longestCellByColumn[columnIndex] = size\n      }\n\n      sizes[columnIndex] = size\n    }\n\n    row[columnIndex] = cell\n  }\n\n  // Inject the alignment row.\n  cellMatrix.splice(1, 0, row)\n  sizeMatrix.splice(1, 0, sizes)\n\n  rowIndex = -1\n  /** @type {Array<string>} */\n  const lines = []\n\n  while (++rowIndex < cellMatrix.length) {\n    const row = cellMatrix[rowIndex]\n    const sizes = sizeMatrix[rowIndex]\n    columnIndex = -1\n    /** @type {Array<string>} */\n    const line = []\n\n    while (++columnIndex < mostCellsPerRow) {\n      const cell = row[columnIndex] || ''\n      let before = ''\n      let after = ''\n\n      if (settings.alignDelimiters !== false) {\n        const size =\n          longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0)\n        const code = alignments[columnIndex]\n\n        if (code === 114 /* `r` */) {\n          before = ' '.repeat(size)\n        } else if (code === 99 /* `c` */) {\n          if (size % 2) {\n            before = ' '.repeat(size / 2 + 0.5)\n            after = ' '.repeat(size / 2 - 0.5)\n          } else {\n            before = ' '.repeat(size / 2)\n            after = before\n          }\n        } else {\n          after = ' '.repeat(size)\n        }\n      }\n\n      if (settings.delimiterStart !== false && !columnIndex) {\n        line.push('|')\n      }\n\n      if (\n        settings.padding !== false &&\n        // Don’t add the opening space if we’re not aligning and the cell is\n        // empty: there will be a closing space.\n        !(settings.alignDelimiters === false && cell === '') &&\n        (settings.delimiterStart !== false || columnIndex)\n      ) {\n        line.push(' ')\n      }\n\n      if (settings.alignDelimiters !== false) {\n        line.push(before)\n      }\n\n      line.push(cell)\n\n      if (settings.alignDelimiters !== false) {\n        line.push(after)\n      }\n\n      if (settings.padding !== false) {\n        line.push(' ')\n      }\n\n      if (\n        settings.delimiterEnd !== false ||\n        columnIndex !== mostCellsPerRow - 1\n      ) {\n        line.push('|')\n      }\n    }\n\n    lines.push(\n      settings.delimiterEnd === false\n        ? line.join('').replace(/ +$/, '')\n        : line.join('')\n    )\n  }\n\n  return lines.join('\\n')\n}\n\n/**\n * @param {string | null | undefined} [value]\n *   Value to serialize.\n * @returns {string}\n *   Result.\n */\nfunction serialize(value) {\n  return value === null || value === undefined ? '' : String(value)\n}\n\n/**\n * @param {string | null | undefined} value\n *   Value.\n * @returns {number}\n *   Alignment.\n */\nfunction toAlignment(value) {\n  const code = typeof value === 'string' ? value.codePointAt(0) : 0\n\n  return code === 67 /* `C` */ || code === 99 /* `c` */\n    ? 99 /* `c` */\n    : code === 76 /* `L` */ || code === 108 /* `l` */\n      ? 108 /* `l` */\n      : code === 82 /* `R` */ || code === 114 /* `r` */\n        ? 114 /* `r` */\n        : 0\n}\n","/**\n * @import {Blockquote, Parents} from 'mdast'\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Blockquote} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function blockquote(node, _, state, info) {\n  const exit = state.enter('blockquote')\n  const tracker = state.createTracker(info)\n  tracker.move('> ')\n  tracker.shift(2)\n  const value = state.indentLines(\n    state.containerFlow(node, tracker.current()),\n    map\n  )\n  exit()\n  return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n  return '>' + (blank ? '' : ' ') + line\n}\n","/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Array<ConstructName>} stack\n * @param {Unsafe} pattern\n * @returns {boolean}\n */\nexport function patternInScope(stack, pattern) {\n  return (\n    listInScope(stack, pattern.inConstruct, true) &&\n    !listInScope(stack, pattern.notInConstruct, false)\n  )\n}\n\n/**\n * @param {Array<ConstructName>} stack\n * @param {Unsafe['inConstruct']} list\n * @param {boolean} none\n * @returns {boolean}\n */\nfunction listInScope(stack, list, none) {\n  if (typeof list === 'string') {\n    list = [list]\n  }\n\n  if (!list || list.length === 0) {\n    return none\n  }\n\n  let index = -1\n\n  while (++index < list.length) {\n    if (stack.includes(list[index])) {\n      return true\n    }\n  }\n\n  return false\n}\n","/**\n * @import {Break, Parents} from 'mdast'\n * @import {Info, State} from 'mdast-util-to-markdown'\n */\n\nimport {patternInScope} from '../util/pattern-in-scope.js'\n\n/**\n * @param {Break} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function hardBreak(_, _1, state, info) {\n  let index = -1\n\n  while (++index < state.unsafe.length) {\n    // If we can’t put eols in this construct (setext headings, tables), use a\n    // space instead.\n    if (\n      state.unsafe[index].character === '\\n' &&\n      patternInScope(state.stack, state.unsafe[index])\n    ) {\n      return /[ \\t]/.test(info.before) ? '' : ' '\n    }\n  }\n\n  return '\\\\\\n'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Code} from 'mdast'\n */\n\n/**\n * @param {Code} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatCodeAsIndented(node, state) {\n  return Boolean(\n    state.options.fences === false &&\n      node.value &&\n      // If there’s no info…\n      !node.lang &&\n      // And there’s a non-whitespace character…\n      /[^ \\r\\n]/.test(node.value) &&\n      // And the value doesn’t start or end in a blank…\n      !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node.value)\n  )\n}\n","/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {Code, Parents} from 'mdast'\n */\n\nimport {longestStreak} from 'longest-streak'\nimport {formatCodeAsIndented} from '../util/format-code-as-indented.js'\nimport {checkFence} from '../util/check-fence.js'\n\n/**\n * @param {Code} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function code(node, _, state, info) {\n  const marker = checkFence(state)\n  const raw = node.value || ''\n  const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'\n\n  if (formatCodeAsIndented(node, state)) {\n    const exit = state.enter('codeIndented')\n    const value = state.indentLines(raw, map)\n    exit()\n    return value\n  }\n\n  const tracker = state.createTracker(info)\n  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3))\n  const exit = state.enter('codeFenced')\n  let value = tracker.move(sequence)\n\n  if (node.lang) {\n    const subexit = state.enter(`codeFencedLang${suffix}`)\n    value += tracker.move(\n      state.safe(node.lang, {\n        before: value,\n        after: ' ',\n        encode: ['`'],\n        ...tracker.current()\n      })\n    )\n    subexit()\n  }\n\n  if (node.lang && node.meta) {\n    const subexit = state.enter(`codeFencedMeta${suffix}`)\n    value += tracker.move(' ')\n    value += tracker.move(\n      state.safe(node.meta, {\n        before: value,\n        after: '\\n',\n        encode: ['`'],\n        ...tracker.current()\n      })\n    )\n    subexit()\n  }\n\n  value += tracker.move('\\n')\n\n  if (raw) {\n    value += tracker.move(raw + '\\n')\n  }\n\n  value += tracker.move(sequence)\n  exit()\n  return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n  return (blank ? '' : '    ') + line\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['quote'], null | undefined>}\n */\nexport function checkQuote(state) {\n  const marker = state.options.quote || '\"'\n\n  if (marker !== '\"' && marker !== \"'\") {\n    throw new Error(\n      'Cannot serialize title with `' +\n        marker +\n        '` for `options.quote`, expected `\"`, or `\\'`'\n    )\n  }\n\n  return marker\n}\n","/**\n * Encode a code point as a character reference.\n *\n * @param {number} code\n *   Code point to encode.\n * @returns {string}\n *   Encoded character reference.\n */\nexport function encodeCharacterReference(code) {\n  return '&#x' + code.toString(16).toUpperCase() + ';'\n}\n","/**\n * @import {Code} from 'micromark-util-types'\n */\n\nimport { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';\n/**\n * Classify whether a code represents whitespace, punctuation, or something\n * else.\n *\n * Used for attention (emphasis, strong), whose sequences can open or close\n * based on the class of surrounding characters.\n *\n * > 👉 **Note**: eof (`null`) is seen as whitespace.\n *\n * @param {Code} code\n *   Code.\n * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}\n *   Group.\n */\nexport function classifyCharacter(code) {\n  if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n    return 1;\n  }\n  if (unicodePunctuation(code)) {\n    return 2;\n  }\n}","/**\n * @import {EncodeSides} from '../types.js'\n */\n\nimport {classifyCharacter} from 'micromark-util-classify-character'\n\n/**\n * Check whether to encode (as a character reference) the characters\n * surrounding an attention run.\n *\n * Which characters are around an attention run influence whether it works or\n * not.\n *\n * See <https://github.com/orgs/syntax-tree/discussions/60> for more info.\n * See this markdown in a particular renderer to see what works:\n *\n * ```markdown\n * |                         | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |\n * | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |\n * | 1 (letter outside)      | x*y*z             | x*.*z                  | x* *z                 | x**z               |\n * | 2 (punctuation outside) | .*y*.             | .*.*.                  | .* *.                 | .**.               |\n * | 3 (whitespace outside)  | x *y* z           | x *.* z                | x * * z               | x ** z             |\n * | 4 (nothing outside)     | *x*               | *.*                    | * *                   | **                 |\n * ```\n *\n * @param {number} outside\n *   Code point on the outer side of the run.\n * @param {number} inside\n *   Code point on the inner side of the run.\n * @param {'*' | '_'} marker\n *   Marker of the run.\n *   Underscores are handled more strictly (they form less often) than\n *   asterisks.\n * @returns {EncodeSides}\n *   Whether to encode characters.\n */\n// Important: punctuation must never be encoded.\n// Punctuation is solely used by markdown constructs.\n// And by encoding itself.\n// Encoding them will break constructs or double encode things.\nexport function encodeInfo(outside, inside, marker) {\n  const outsideKind = classifyCharacter(outside)\n  const insideKind = classifyCharacter(inside)\n\n  // Letter outside:\n  if (outsideKind === undefined) {\n    return insideKind === undefined\n      ? // Letter inside:\n        // we have to encode *both* letters for `_` as it is looser.\n        // it already forms for `*` (and GFMs `~`).\n        marker === '_'\n        ? {inside: true, outside: true}\n        : {inside: false, outside: false}\n      : insideKind === 1\n        ? // Whitespace inside: encode both (letter, whitespace).\n          {inside: true, outside: true}\n        : // Punctuation inside: encode outer (letter)\n          {inside: false, outside: true}\n  }\n\n  // Whitespace outside:\n  if (outsideKind === 1) {\n    return insideKind === undefined\n      ? // Letter inside: already forms.\n        {inside: false, outside: false}\n      : insideKind === 1\n        ? // Whitespace inside: encode both (whitespace).\n          {inside: true, outside: true}\n        : // Punctuation inside: already forms.\n          {inside: false, outside: false}\n  }\n\n  // Punctuation outside:\n  return insideKind === undefined\n    ? // Letter inside: already forms.\n      {inside: false, outside: false}\n    : insideKind === 1\n      ? // Whitespace inside: encode inner (whitespace).\n        {inside: true, outside: false}\n      : // Punctuation inside: already forms.\n        {inside: false, outside: false}\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Emphasis, Parents} from 'mdast'\n */\n\nimport {checkEmphasis} from '../util/check-emphasis.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nemphasis.peek = emphasisPeek\n\n/**\n * @param {Emphasis} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function emphasis(node, _, state, info) {\n  const marker = checkEmphasis(state)\n  const exit = state.enter('emphasis')\n  const tracker = state.createTracker(info)\n  const before = tracker.move(marker)\n\n  let between = tracker.move(\n    state.containerPhrasing(node, {\n      after: marker,\n      before,\n      ...tracker.current()\n    })\n  )\n  const betweenHead = between.charCodeAt(0)\n  const open = encodeInfo(\n    info.before.charCodeAt(info.before.length - 1),\n    betweenHead,\n    marker\n  )\n\n  if (open.inside) {\n    between = encodeCharacterReference(betweenHead) + between.slice(1)\n  }\n\n  const betweenTail = between.charCodeAt(between.length - 1)\n  const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n  if (close.inside) {\n    between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n  }\n\n  const after = tracker.move(marker)\n\n  exit()\n\n  state.attentionEncodeSurroundingInfo = {\n    after: close.outside,\n    before: open.outside\n  }\n  return before + between + after\n}\n\n/**\n * @param {Emphasis} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction emphasisPeek(_, _1, state) {\n  return state.options.emphasis || '*'\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['emphasis'], null | undefined>}\n */\nexport function checkEmphasis(state) {\n  const marker = state.options.emphasis || '*'\n\n  if (marker !== '*' && marker !== '_') {\n    throw new Error(\n      'Cannot serialize emphasis with `' +\n        marker +\n        '` for `options.emphasis`, expected `*`, or `_`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n *   Test from `unist-util-is`.\n *\n *   Note: we have remove and add `undefined`, because otherwise when generating\n *   automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n *   which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n *   Fn extends (value: any) => value is infer Thing\n *   ? Thing\n *   : Fallback\n * )} Predicate\n *   Get the value of a type guard `Fn`.\n * @template Fn\n *   Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n *   Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n *   Check extends null | undefined // No test.\n *   ? Value\n *   : Value extends {type: Check} // String (type) test.\n *   ? Value\n *   : Value extends Check // Partial test.\n *   ? Value\n *   : Check extends Function // Function test.\n *   ? Predicate<Check, Value> extends Value\n *     ? Predicate<Check, Value>\n *     : never\n *   : never // Some other test?\n * )} MatchesOne\n *   Check whether a node matches a primitive check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n *   Check extends Array<any>\n *   ? MatchesOne<Value, Check[keyof Check]>\n *   : MatchesOne<Value, Check>\n * )} Matches\n *   Check whether a node matches a check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n *   Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n *   Increment a number in the type system.\n * @template {Uint} [I=0]\n *   Index.\n */\n\n/**\n * @typedef {(\n *   Node extends UnistParent\n *   ? Node extends {children: Array<infer Children>}\n *     ? Child extends Children ? Node : never\n *     : never\n *   : never\n * )} InternalParent\n *   Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n *   Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n */\n\n/**\n * @typedef {(\n *   Depth extends Max\n *   ? never\n *   :\n *     | InternalParent<Node, Child>\n *     | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n *   Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n *   All node types in a tree.\n * @template {UnistNode} Child\n *   Node to search for.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @typedef {(\n *   Tree extends UnistParent\n *     ? Depth extends Max\n *       ? Tree\n *       : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n *     : Tree\n * )} InclusiveDescendant\n *   Collect all (inclusive) descendants of `Tree`.\n *\n *   > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n *   > recurse without actually running into an infinite loop, which the\n *   > previous version did.\n *   >\n *   > Practically, a max of `2` is typically enough assuming a `Root` is\n *   > passed, but it doesn’t improve performance.\n *   > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n *   > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n *   Tree type.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n */\n\n/**\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform `parent`.\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of `parent` still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n *   Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n *   Parent of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n *   Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n *   Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch\n *   Build a typed `Visitor` function from a node and all possible parents.\n *\n *   It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n *   Node type.\n * @template {UnistParent} Ancestor\n *   Parent type.\n */\n\n/**\n * @typedef {(\n *   BuildVisitorFromMatch<\n *     Matches<Descendant, Check>,\n *     Extract<Descendant, UnistParent>\n *   >\n * )} BuildVisitorFromDescendants\n *   Build a typed `Visitor` function from a list of descendants and a test.\n *\n *   It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n *   Node type.\n * @template {Test} Check\n *   Test type.\n */\n\n/**\n * @typedef {(\n *   BuildVisitorFromDescendants<\n *     InclusiveDescendant<Tree>,\n *     Check\n *   >\n * )} BuildVisitor\n *   Build a typed `Visitor` function from a tree and a test.\n *\n *   It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n *   Node type.\n * @template {Test} [Check=Test]\n *   Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n *   Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n *   `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n *   Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n *   Nothing.\n *\n * @template {UnistNode} Tree\n *   Node type.\n * @template {Test} Check\n *   `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n  /** @type {boolean | null | undefined} */\n  let reverse\n  /** @type {Test} */\n  let test\n  /** @type {Visitor} */\n  let visitor\n\n  if (\n    typeof testOrVisitor === 'function' &&\n    typeof visitorOrReverse !== 'function'\n  ) {\n    test = undefined\n    visitor = testOrVisitor\n    reverse = visitorOrReverse\n  } else {\n    // @ts-expect-error: assume the overload with test was given.\n    test = testOrVisitor\n    // @ts-expect-error: assume the overload with test was given.\n    visitor = visitorOrReverse\n    reverse = maybeReverse\n  }\n\n  visitParents(tree, test, overload, reverse)\n\n  /**\n   * @param {UnistNode} node\n   * @param {Array<UnistParent>} parents\n   */\n  function overload(node, parents) {\n    const parent = parents[parents.length - 1]\n    const index = parent ? parent.children.indexOf(node) : undefined\n    return visitor(node, index, parent)\n  }\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [includeImageAlt=true]\n *   Whether to use `alt` for `image`s (default: `true`).\n * @property {boolean | null | undefined} [includeHtml=true]\n *   Whether to use `value` of HTML (default: `true`).\n */\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Get the text content of a node or list of nodes.\n *\n * Prefers the node’s plain-text fields, otherwise serializes its children,\n * and if the given value is an array, serialize the nodes in it.\n *\n * @param {unknown} [value]\n *   Thing to serialize, typically `Node`.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Serialized `value`.\n */\nexport function toString(value, options) {\n  const settings = options || emptyOptions\n  const includeImageAlt =\n    typeof settings.includeImageAlt === 'boolean'\n      ? settings.includeImageAlt\n      : true\n  const includeHtml =\n    typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true\n\n  return one(value, includeImageAlt, includeHtml)\n}\n\n/**\n * One node or several nodes.\n *\n * @param {unknown} value\n *   Thing to serialize.\n * @param {boolean} includeImageAlt\n *   Include image `alt`s.\n * @param {boolean} includeHtml\n *   Include HTML.\n * @returns {string}\n *   Serialized node.\n */\nfunction one(value, includeImageAlt, includeHtml) {\n  if (node(value)) {\n    if ('value' in value) {\n      return value.type === 'html' && !includeHtml ? '' : value.value\n    }\n\n    if (includeImageAlt && 'alt' in value && value.alt) {\n      return value.alt\n    }\n\n    if ('children' in value) {\n      return all(value.children, includeImageAlt, includeHtml)\n    }\n  }\n\n  if (Array.isArray(value)) {\n    return all(value, includeImageAlt, includeHtml)\n  }\n\n  return ''\n}\n\n/**\n * Serialize a list of nodes.\n *\n * @param {Array<unknown>} values\n *   Thing to serialize.\n * @param {boolean} includeImageAlt\n *   Include image `alt`s.\n * @param {boolean} includeHtml\n *   Include HTML.\n * @returns {string}\n *   Serialized nodes.\n */\nfunction all(values, includeImageAlt, includeHtml) {\n  /** @type {Array<string>} */\n  const result = []\n  let index = -1\n\n  while (++index < values.length) {\n    result[index] = one(values[index], includeImageAlt, includeHtml)\n  }\n\n  return result.join('')\n}\n\n/**\n * Check if `value` looks like a node.\n *\n * @param {unknown} value\n *   Thing.\n * @returns {value is Nodes}\n *   Whether `value` is a node.\n */\nfunction node(value) {\n  return Boolean(value && typeof value === 'object')\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Heading} from 'mdast'\n */\n\nimport {EXIT, visit} from 'unist-util-visit'\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Heading} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatHeadingAsSetext(node, state) {\n  let literalWithBreak = false\n\n  // Look for literals with a line break.\n  // Note that this also\n  visit(node, function (node) {\n    if (\n      ('value' in node && /\\r?\\n|\\r/.test(node.value)) ||\n      node.type === 'break'\n    ) {\n      literalWithBreak = true\n      return EXIT\n    }\n  })\n\n  return Boolean(\n    (!node.depth || node.depth < 3) &&\n      toString(node) &&\n      (state.options.setext || literalWithBreak)\n  )\n}\n","/**\n * @import {Html} from 'mdast'\n */\n\nhtml.peek = htmlPeek\n\n/**\n * @param {Html} node\n * @returns {string}\n */\nexport function html(node) {\n  return node.value || ''\n}\n\n/**\n * @returns {string}\n */\nfunction htmlPeek() {\n  return '<'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Image, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\nimage.peek = imagePeek\n\n/**\n * @param {Image} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function image(node, _, state, info) {\n  const quote = checkQuote(state)\n  const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n  const exit = state.enter('image')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('![')\n  value += tracker.move(\n    state.safe(node.alt, {before: value, after: ']', ...tracker.current()})\n  )\n  value += tracker.move('](')\n\n  subexit()\n\n  if (\n    // If there’s no url but there is a title…\n    (!node.url && node.title) ||\n    // If there are control characters or whitespace.\n    /[\\0- \\u007F]/.test(node.url)\n  ) {\n    subexit = state.enter('destinationLiteral')\n    value += tracker.move('<')\n    value += tracker.move(\n      state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n    )\n    value += tracker.move('>')\n  } else {\n    // No whitespace, raw is prettier.\n    subexit = state.enter('destinationRaw')\n    value += tracker.move(\n      state.safe(node.url, {\n        before: value,\n        after: node.title ? ' ' : ')',\n        ...tracker.current()\n      })\n    )\n  }\n\n  subexit()\n\n  if (node.title) {\n    subexit = state.enter(`title${suffix}`)\n    value += tracker.move(' ' + quote)\n    value += tracker.move(\n      state.safe(node.title, {\n        before: value,\n        after: quote,\n        ...tracker.current()\n      })\n    )\n    value += tracker.move(quote)\n    subexit()\n  }\n\n  value += tracker.move(')')\n  exit()\n\n  return value\n}\n\n/**\n * @returns {string}\n */\nfunction imagePeek() {\n  return '!'\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {ImageReference, Parents} from 'mdast'\n */\n\nimageReference.peek = imageReferencePeek\n\n/**\n * @param {ImageReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function imageReference(node, _, state, info) {\n  const type = node.referenceType\n  const exit = state.enter('imageReference')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('![')\n  const alt = state.safe(node.alt, {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  value += tracker.move(alt + '][')\n\n  subexit()\n  // Hide the fact that we’re in phrasing, because escapes don’t work.\n  const stack = state.stack\n  state.stack = []\n  subexit = state.enter('reference')\n  // Note: for proper tracking, we should reset the output positions when we end\n  // up making a `shortcut` reference, because then there is no brace output.\n  // Practically, in that case, there is no content, so it doesn’t matter that\n  // we’ve tracked one too many characters.\n  const reference = state.safe(state.associationId(node), {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  subexit()\n  state.stack = stack\n  exit()\n\n  if (type === 'full' || !alt || alt !== reference) {\n    value += tracker.move(reference + ']')\n  } else if (type === 'shortcut') {\n    // Remove the unwanted `[`.\n    value = value.slice(0, -1)\n  } else {\n    value += tracker.move(']')\n  }\n\n  return value\n}\n\n/**\n * @returns {string}\n */\nfunction imageReferencePeek() {\n  return '!'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {InlineCode, Parents} from 'mdast'\n */\n\ninlineCode.peek = inlineCodePeek\n\n/**\n * @param {InlineCode} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nexport function inlineCode(node, _, state) {\n  let value = node.value || ''\n  let sequence = '`'\n  let index = -1\n\n  // If there is a single grave accent on its own in the code, use a fence of\n  // two.\n  // If there are two in a row, use one.\n  while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {\n    sequence += '`'\n  }\n\n  // If this is not just spaces or eols (tabs don’t count), and either the\n  // first or last character are a space, eol, or tick, then pad with spaces.\n  if (\n    /[^ \\r\\n]/.test(value) &&\n    ((/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value)) || /^`|`$/.test(value))\n  ) {\n    value = ' ' + value + ' '\n  }\n\n  // We have a potential problem: certain characters after eols could result in\n  // blocks being seen.\n  // For example, if someone injected the string `'\\n# b'`, then that would\n  // result in an ATX heading.\n  // We can’t escape characters in `inlineCode`, but because eols are\n  // transformed to spaces when going from markdown to HTML anyway, we can swap\n  // them out.\n  while (++index < state.unsafe.length) {\n    const pattern = state.unsafe[index]\n    const expression = state.compilePattern(pattern)\n    /** @type {RegExpExecArray | null} */\n    let match\n\n    // Only look for `atBreak`s.\n    // Btw: note that `atBreak` patterns will always start the regex at LF or\n    // CR.\n    if (!pattern.atBreak) continue\n\n    while ((match = expression.exec(value))) {\n      let position = match.index\n\n      // Support CRLF (patterns only look for one of the characters).\n      if (\n        value.charCodeAt(position) === 10 /* `\\n` */ &&\n        value.charCodeAt(position - 1) === 13 /* `\\r` */\n      ) {\n        position--\n      }\n\n      value = value.slice(0, position) + ' ' + value.slice(match.index + 1)\n    }\n  }\n\n  return sequence + value + sequence\n}\n\n/**\n * @returns {string}\n */\nfunction inlineCodePeek() {\n  return '`'\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Link} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Link} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatLinkAsAutolink(node, state) {\n  const raw = toString(node)\n\n  return Boolean(\n    !state.options.resourceLink &&\n      // If there’s a url…\n      node.url &&\n      // And there’s a no title…\n      !node.title &&\n      // And the content of `node` is a single text node…\n      node.children &&\n      node.children.length === 1 &&\n      node.children[0].type === 'text' &&\n      // And if the url is the same as the content…\n      (raw === node.url || 'mailto:' + raw === node.url) &&\n      // And that starts w/ a protocol…\n      /^[a-z][a-z+.-]+:/i.test(node.url) &&\n      // And that doesn’t contain ASCII control codes (character escapes and\n      // references don’t work), space, or angle brackets…\n      !/[\\0- <>\\u007F]/.test(node.url)\n  )\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Link, Parents} from 'mdast'\n * @import {Exit} from '../types.js'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\nimport {formatLinkAsAutolink} from '../util/format-link-as-autolink.js'\n\nlink.peek = linkPeek\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function link(node, _, state, info) {\n  const quote = checkQuote(state)\n  const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n  const tracker = state.createTracker(info)\n  /** @type {Exit} */\n  let exit\n  /** @type {Exit} */\n  let subexit\n\n  if (formatLinkAsAutolink(node, state)) {\n    // Hide the fact that we’re in phrasing, because escapes don’t work.\n    const stack = state.stack\n    state.stack = []\n    exit = state.enter('autolink')\n    let value = tracker.move('<')\n    value += tracker.move(\n      state.containerPhrasing(node, {\n        before: value,\n        after: '>',\n        ...tracker.current()\n      })\n    )\n    value += tracker.move('>')\n    exit()\n    state.stack = stack\n    return value\n  }\n\n  exit = state.enter('link')\n  subexit = state.enter('label')\n  let value = tracker.move('[')\n  value += tracker.move(\n    state.containerPhrasing(node, {\n      before: value,\n      after: '](',\n      ...tracker.current()\n    })\n  )\n  value += tracker.move('](')\n  subexit()\n\n  if (\n    // If there’s no url but there is a title…\n    (!node.url && node.title) ||\n    // If there are control characters or whitespace.\n    /[\\0- \\u007F]/.test(node.url)\n  ) {\n    subexit = state.enter('destinationLiteral')\n    value += tracker.move('<')\n    value += tracker.move(\n      state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n    )\n    value += tracker.move('>')\n  } else {\n    // No whitespace, raw is prettier.\n    subexit = state.enter('destinationRaw')\n    value += tracker.move(\n      state.safe(node.url, {\n        before: value,\n        after: node.title ? ' ' : ')',\n        ...tracker.current()\n      })\n    )\n  }\n\n  subexit()\n\n  if (node.title) {\n    subexit = state.enter(`title${suffix}`)\n    value += tracker.move(' ' + quote)\n    value += tracker.move(\n      state.safe(node.title, {\n        before: value,\n        after: quote,\n        ...tracker.current()\n      })\n    )\n    value += tracker.move(quote)\n    subexit()\n  }\n\n  value += tracker.move(')')\n\n  exit()\n  return value\n}\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nfunction linkPeek(node, _, state) {\n  return formatLinkAsAutolink(node, state) ? '<' : '['\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {LinkReference, Parents} from 'mdast'\n */\n\nlinkReference.peek = linkReferencePeek\n\n/**\n * @param {LinkReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function linkReference(node, _, state, info) {\n  const type = node.referenceType\n  const exit = state.enter('linkReference')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('[')\n  const text = state.containerPhrasing(node, {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  value += tracker.move(text + '][')\n\n  subexit()\n  // Hide the fact that we’re in phrasing, because escapes don’t work.\n  const stack = state.stack\n  state.stack = []\n  subexit = state.enter('reference')\n  // Note: for proper tracking, we should reset the output positions when we end\n  // up making a `shortcut` reference, because then there is no brace output.\n  // Practically, in that case, there is no content, so it doesn’t matter that\n  // we’ve tracked one too many characters.\n  const reference = state.safe(state.associationId(node), {\n    before: value,\n    after: ']',\n    ...tracker.current()\n  })\n  subexit()\n  state.stack = stack\n  exit()\n\n  if (type === 'full' || !text || text !== reference) {\n    value += tracker.move(reference + ']')\n  } else if (type === 'shortcut') {\n    // Remove the unwanted `[`.\n    value = value.slice(0, -1)\n  } else {\n    value += tracker.move(']')\n  }\n\n  return value\n}\n\n/**\n * @returns {string}\n */\nfunction linkReferencePeek() {\n  return '['\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bullet'], null | undefined>}\n */\nexport function checkBullet(state) {\n  const marker = state.options.bullet || '*'\n\n  if (marker !== '*' && marker !== '+' && marker !== '-') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        marker +\n        '` for `options.bullet`, expected `*`, `+`, or `-`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['rule'], null | undefined>}\n */\nexport function checkRule(state) {\n  const marker = state.options.rule || '*'\n\n  if (marker !== '*' && marker !== '-' && marker !== '_') {\n    throw new Error(\n      'Cannot serialize rules with `' +\n        marker +\n        '` for `options.rule`, expected `*`, `-`, or `_`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @typedef {import('mdast').Html} Html\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Check if the given value is *phrasing content*.\n *\n * > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.\n *\n * @param node\n *   Thing to check, typically `Node`.\n * @returns\n *   Whether `value` is phrasing content.\n */\n\nexport const phrasing =\n  /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */\n  (\n    convert([\n      'break',\n      'delete',\n      'emphasis',\n      // To do: next major: removed since footnotes were added to GFM.\n      'footnote',\n      'footnoteReference',\n      'image',\n      'imageReference',\n      'inlineCode',\n      // Enabled by `mdast-util-math`:\n      'inlineMath',\n      'link',\n      'linkReference',\n      // Enabled by `mdast-util-mdx`:\n      'mdxJsxTextElement',\n      // Enabled by `mdast-util-mdx`:\n      'mdxTextExpression',\n      'strong',\n      'text',\n      // Enabled by `mdast-util-directive`:\n      'textDirective'\n    ])\n  )\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Strong} from 'mdast'\n */\n\nimport {checkStrong} from '../util/check-strong.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nstrong.peek = strongPeek\n\n/**\n * @param {Strong} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function strong(node, _, state, info) {\n  const marker = checkStrong(state)\n  const exit = state.enter('strong')\n  const tracker = state.createTracker(info)\n  const before = tracker.move(marker + marker)\n\n  let between = tracker.move(\n    state.containerPhrasing(node, {\n      after: marker,\n      before,\n      ...tracker.current()\n    })\n  )\n  const betweenHead = between.charCodeAt(0)\n  const open = encodeInfo(\n    info.before.charCodeAt(info.before.length - 1),\n    betweenHead,\n    marker\n  )\n\n  if (open.inside) {\n    between = encodeCharacterReference(betweenHead) + between.slice(1)\n  }\n\n  const betweenTail = between.charCodeAt(between.length - 1)\n  const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n  if (close.inside) {\n    between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n  }\n\n  const after = tracker.move(marker + marker)\n\n  exit()\n\n  state.attentionEncodeSurroundingInfo = {\n    after: close.outside,\n    before: open.outside\n  }\n  return before + between + after\n}\n\n/**\n * @param {Strong} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction strongPeek(_, _1, state) {\n  return state.options.strong || '*'\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['strong'], null | undefined>}\n */\nexport function checkStrong(state) {\n  const marker = state.options.strong || '*'\n\n  if (marker !== '*' && marker !== '_') {\n    throw new Error(\n      'Cannot serialize strong with `' +\n        marker +\n        '` for `options.strong`, expected `*`, or `_`'\n    )\n  }\n\n  return marker\n}\n","import {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {definition} from './definition.js'\nimport {emphasis} from './emphasis.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {image} from './image.js'\nimport {imageReference} from './image-reference.js'\nimport {inlineCode} from './inline-code.js'\nimport {link} from './link.js'\nimport {linkReference} from './link-reference.js'\nimport {list} from './list.js'\nimport {listItem} from './list-item.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default (CommonMark) handlers.\n */\nexport const handle = {\n  blockquote,\n  break: hardBreak,\n  code,\n  definition,\n  emphasis,\n  hardBreak,\n  heading,\n  html,\n  image,\n  imageReference,\n  inlineCode,\n  link,\n  linkReference,\n  list,\n  listItem,\n  paragraph,\n  root,\n  strong,\n  text,\n  thematicBreak\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['fence'], null | undefined>}\n */\nexport function checkFence(state) {\n  const marker = state.options.fence || '`'\n\n  if (marker !== '`' && marker !== '~') {\n    throw new Error(\n      'Cannot serialize code with `' +\n        marker +\n        '` for `options.fence`, expected `` ` `` or `~`'\n    )\n  }\n\n  return marker\n}\n","/**\n * Get the count of the longest repeating streak of `substring` in `value`.\n *\n * @param {string} value\n *   Content to search in.\n * @param {string} substring\n *   Substring to look for, typically one character.\n * @returns {number}\n *   Count of most frequent adjacent `substring`s in `value`.\n */\nexport function longestStreak(value, substring) {\n  const source = String(value)\n  let index = source.indexOf(substring)\n  let expected = index\n  let count = 0\n  let max = 0\n\n  if (typeof substring !== 'string') {\n    throw new TypeError('Expected substring')\n  }\n\n  while (index !== -1) {\n    if (index === expected) {\n      if (++count > max) {\n        max = count\n      }\n    } else {\n      count = 1\n    }\n\n    expected = index + substring.length\n    index = source.indexOf(substring, expected)\n  }\n\n  return max\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Definition, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\n/**\n * @param {Definition} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function definition(node, _, state, info) {\n  const quote = checkQuote(state)\n  const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n  const exit = state.enter('definition')\n  let subexit = state.enter('label')\n  const tracker = state.createTracker(info)\n  let value = tracker.move('[')\n  value += tracker.move(\n    state.safe(state.associationId(node), {\n      before: value,\n      after: ']',\n      ...tracker.current()\n    })\n  )\n  value += tracker.move(']: ')\n\n  subexit()\n\n  if (\n    // If there’s no url, or…\n    !node.url ||\n    // If there are control characters or whitespace.\n    /[\\0- \\u007F]/.test(node.url)\n  ) {\n    subexit = state.enter('destinationLiteral')\n    value += tracker.move('<')\n    value += tracker.move(\n      state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n    )\n    value += tracker.move('>')\n  } else {\n    // No whitespace, raw is prettier.\n    subexit = state.enter('destinationRaw')\n    value += tracker.move(\n      state.safe(node.url, {\n        before: value,\n        after: node.title ? ' ' : '\\n',\n        ...tracker.current()\n      })\n    )\n  }\n\n  subexit()\n\n  if (node.title) {\n    subexit = state.enter(`title${suffix}`)\n    value += tracker.move(' ' + quote)\n    value += tracker.move(\n      state.safe(node.title, {\n        before: value,\n        after: quote,\n        ...tracker.current()\n      })\n    )\n    value += tracker.move(quote)\n    subexit()\n  }\n\n  exit()\n\n  return value\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Heading, Parents} from 'mdast'\n */\n\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {formatHeadingAsSetext} from '../util/format-heading-as-setext.js'\n\n/**\n * @param {Heading} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function heading(node, _, state, info) {\n  const rank = Math.max(Math.min(6, node.depth || 1), 1)\n  const tracker = state.createTracker(info)\n\n  if (formatHeadingAsSetext(node, state)) {\n    const exit = state.enter('headingSetext')\n    const subexit = state.enter('phrasing')\n    const value = state.containerPhrasing(node, {\n      ...tracker.current(),\n      before: '\\n',\n      after: '\\n'\n    })\n    subexit()\n    exit()\n\n    return (\n      value +\n      '\\n' +\n      (rank === 1 ? '=' : '-').repeat(\n        // The whole size…\n        value.length -\n          // Minus the position of the character after the last EOL (or\n          // 0 if there is none)…\n          (Math.max(value.lastIndexOf('\\r'), value.lastIndexOf('\\n')) + 1)\n      )\n    )\n  }\n\n  const sequence = '#'.repeat(rank)\n  const exit = state.enter('headingAtx')\n  const subexit = state.enter('phrasing')\n\n  // Note: for proper tracking, we should reset the output positions when there\n  // is no content returned, because then the space is not output.\n  // Practically, in that case, there is no content, so it doesn’t matter that\n  // we’ve tracked one too many characters.\n  tracker.move(sequence + ' ')\n\n  let value = state.containerPhrasing(node, {\n    before: '# ',\n    after: '\\n',\n    ...tracker.current()\n  })\n\n  if (/^[\\t ]/.test(value)) {\n    // To do: what effect has the character reference on tracking?\n    value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1)\n  }\n\n  value = value ? sequence + ' ' + value : sequence\n\n  if (state.options.closeAtx) {\n    value += ' ' + sequence\n  }\n\n  subexit()\n  exit()\n\n  return value\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {List, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkBulletOther} from '../util/check-bullet-other.js'\nimport {checkBulletOrdered} from '../util/check-bullet-ordered.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {List} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function list(node, parent, state, info) {\n  const exit = state.enter('list')\n  const bulletCurrent = state.bulletCurrent\n  /** @type {string} */\n  let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state)\n  /** @type {string} */\n  const bulletOther = node.ordered\n    ? bullet === '.'\n      ? ')'\n      : '.'\n    : checkBulletOther(state)\n  let useDifferentMarker =\n    parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false\n\n  if (!node.ordered) {\n    const firstListItem = node.children ? node.children[0] : undefined\n\n    // If there’s an empty first list item directly in two list items,\n    // we have to use a different bullet:\n    //\n    // ```markdown\n    // * - *\n    // ```\n    //\n    // …because otherwise it would become one big thematic break.\n    if (\n      // Bullet could be used as a thematic break marker:\n      (bullet === '*' || bullet === '-') &&\n      // Empty first list item:\n      firstListItem &&\n      (!firstListItem.children || !firstListItem.children[0]) &&\n      // Directly in two other list items:\n      state.stack[state.stack.length - 1] === 'list' &&\n      state.stack[state.stack.length - 2] === 'listItem' &&\n      state.stack[state.stack.length - 3] === 'list' &&\n      state.stack[state.stack.length - 4] === 'listItem' &&\n      // That are each the first child.\n      state.indexStack[state.indexStack.length - 1] === 0 &&\n      state.indexStack[state.indexStack.length - 2] === 0 &&\n      state.indexStack[state.indexStack.length - 3] === 0\n    ) {\n      useDifferentMarker = true\n    }\n\n    // If there’s a thematic break at the start of the first list item,\n    // we have to use a different bullet:\n    //\n    // ```markdown\n    // * ---\n    // ```\n    //\n    // …because otherwise it would become one big thematic break.\n    if (checkRule(state) === bullet && firstListItem) {\n      let index = -1\n\n      while (++index < node.children.length) {\n        const item = node.children[index]\n\n        if (\n          item &&\n          item.type === 'listItem' &&\n          item.children &&\n          item.children[0] &&\n          item.children[0].type === 'thematicBreak'\n        ) {\n          useDifferentMarker = true\n          break\n        }\n      }\n    }\n  }\n\n  if (useDifferentMarker) {\n    bullet = bulletOther\n  }\n\n  state.bulletCurrent = bullet\n  const value = state.containerFlow(node, info)\n  state.bulletLastUsed = bullet\n  state.bulletCurrent = bulletCurrent\n  exit()\n  return value\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bulletOrdered'], null | undefined>}\n */\nexport function checkBulletOrdered(state) {\n  const marker = state.options.bulletOrdered || '.'\n\n  if (marker !== '.' && marker !== ')') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        marker +\n        '` for `options.bulletOrdered`, expected `.` or `)`'\n    )\n  }\n\n  return marker\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\nimport {checkBullet} from './check-bullet.js'\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['bullet'], null | undefined>}\n */\nexport function checkBulletOther(state) {\n  const bullet = checkBullet(state)\n  const bulletOther = state.options.bulletOther\n\n  if (!bulletOther) {\n    return bullet === '*' ? '-' : '*'\n  }\n\n  if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        bulletOther +\n        '` for `options.bulletOther`, expected `*`, `+`, or `-`'\n    )\n  }\n\n  if (bulletOther === bullet) {\n    throw new Error(\n      'Expected `bullet` (`' +\n        bullet +\n        '`) and `bulletOther` (`' +\n        bulletOther +\n        '`) to be different'\n    )\n  }\n\n  return bulletOther\n}\n","/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {ListItem, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkListItemIndent} from '../util/check-list-item-indent.js'\n\n/**\n * @param {ListItem} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function listItem(node, parent, state, info) {\n  const listItemIndent = checkListItemIndent(state)\n  let bullet = state.bulletCurrent || checkBullet(state)\n\n  // Add the marker value for ordered lists.\n  if (parent && parent.type === 'list' && parent.ordered) {\n    bullet =\n      (typeof parent.start === 'number' && parent.start > -1\n        ? parent.start\n        : 1) +\n      (state.options.incrementListMarker === false\n        ? 0\n        : parent.children.indexOf(node)) +\n      bullet\n  }\n\n  let size = bullet.length + 1\n\n  if (\n    listItemIndent === 'tab' ||\n    (listItemIndent === 'mixed' &&\n      ((parent && parent.type === 'list' && parent.spread) || node.spread))\n  ) {\n    size = Math.ceil(size / 4) * 4\n  }\n\n  const tracker = state.createTracker(info)\n  tracker.move(bullet + ' '.repeat(size - bullet.length))\n  tracker.shift(size)\n  const exit = state.enter('listItem')\n  const value = state.indentLines(\n    state.containerFlow(node, tracker.current()),\n    map\n  )\n  exit()\n\n  return value\n\n  /** @type {Map} */\n  function map(line, index, blank) {\n    if (index) {\n      return (blank ? '' : ' '.repeat(size)) + line\n    }\n\n    return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line\n  }\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['listItemIndent'], null | undefined>}\n */\nexport function checkListItemIndent(state) {\n  const style = state.options.listItemIndent || 'one'\n\n  if (style !== 'tab' && style !== 'one' && style !== 'mixed') {\n    throw new Error(\n      'Cannot serialize items with `' +\n        style +\n        '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'\n    )\n  }\n\n  return style\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Paragraph, Parents} from 'mdast'\n */\n\n/**\n * @param {Paragraph} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function paragraph(node, _, state, info) {\n  const exit = state.enter('paragraph')\n  const subexit = state.enter('phrasing')\n  const value = state.containerPhrasing(node, info)\n  subexit()\n  exit()\n  return value\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Root} from 'mdast'\n */\n\nimport {phrasing} from 'mdast-util-phrasing'\n\n/**\n * @param {Root} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function root(node, _, state, info) {\n  // Note: `html` nodes are ambiguous.\n  const hasPhrasing = node.children.some(function (d) {\n    return phrasing(d)\n  })\n\n  const container = hasPhrasing ? state.containerPhrasing : state.containerFlow\n  return container.call(state, node, info)\n}\n","/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Text} from 'mdast'\n */\n\n/**\n * @param {Text} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function text(node, _, state, info) {\n  return state.safe(node.value, info)\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Parents, ThematicBreak} from 'mdast'\n */\n\nimport {checkRuleRepetition} from '../util/check-rule-repetition.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {ThematicBreak} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nexport function thematicBreak(_, _1, state) {\n  const value = (\n    checkRule(state) + (state.options.ruleSpaces ? ' ' : '')\n  ).repeat(checkRuleRepetition(state))\n\n  return state.options.ruleSpaces ? value.slice(0, -1) : value\n}\n","/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude<Options['ruleRepetition'], null | undefined>}\n */\nexport function checkRuleRepetition(state) {\n  const repetition = state.options.ruleRepetition || 3\n\n  if (repetition < 3) {\n    throw new Error(\n      'Cannot serialize rules with repetition `' +\n        repetition +\n        '` for `options.ruleRepetition`, expected `3` or more'\n    )\n  }\n\n  return repetition\n}\n","/**\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('mdast').Table} Table\n * @typedef {import('mdast').TableCell} TableCell\n * @typedef {import('mdast').TableRow} TableRow\n *\n * @typedef {import('markdown-table').Options} MarkdownTableOptions\n *\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n *\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').State} State\n * @typedef {import('mdast-util-to-markdown').Info} Info\n */\n\n/**\n * @typedef Options\n *   Configuration.\n * @property {boolean | null | undefined} [tableCellPadding=true]\n *   Whether to add a space of padding between delimiters and cells (default:\n *   `true`).\n * @property {boolean | null | undefined} [tablePipeAlign=true]\n *   Whether to align the delimiters (default: `true`).\n * @property {MarkdownTableOptions['stringLength'] | null | undefined} [stringLength]\n *   Function to detect the length of table cell content, used when aligning\n *   the delimiters between cells (optional).\n */\n\nimport {ok as assert} from 'devlop'\nimport {markdownTable} from 'markdown-table'\nimport {defaultHandlers} from 'mdast-util-to-markdown'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM tables in\n * markdown.\n *\n * @returns {FromMarkdownExtension}\n *   Extension for `mdast-util-from-markdown` to enable GFM tables.\n */\nexport function gfmTableFromMarkdown() {\n  return {\n    enter: {\n      table: enterTable,\n      tableData: enterCell,\n      tableHeader: enterCell,\n      tableRow: enterRow\n    },\n    exit: {\n      codeText: exitCodeText,\n      table: exitTable,\n      tableData: exit,\n      tableHeader: exit,\n      tableRow: exit\n    }\n  }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterTable(token) {\n  const align = token._align\n  assert(align, 'expected `_align` on table')\n  this.enter(\n    {\n      type: 'table',\n      align: align.map(function (d) {\n        return d === 'none' ? null : d\n      }),\n      children: []\n    },\n    token\n  )\n  this.data.inTable = true\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitTable(token) {\n  this.exit(token)\n  this.data.inTable = undefined\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterRow(token) {\n  this.enter({type: 'tableRow', children: []}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exit(token) {\n  this.exit(token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterCell(token) {\n  this.enter({type: 'tableCell', children: []}, token)\n}\n\n// Overwrite the default code text data handler to unescape escaped pipes when\n// they are in tables.\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitCodeText(token) {\n  let value = this.resume()\n\n  if (this.data.inTable) {\n    value = value.replace(/\\\\([\\\\|])/g, replace)\n  }\n\n  const node = this.stack[this.stack.length - 1]\n  assert(node.type === 'inlineCode')\n  node.value = value\n  this.exit(token)\n}\n\n/**\n * @param {string} $0\n * @param {string} $1\n * @returns {string}\n */\nfunction replace($0, $1) {\n  // Pipes work, backslashes don’t (but can’t escape pipes).\n  return $1 === '|' ? $1 : $0\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM tables in\n * markdown.\n *\n * @param {Options | null | undefined} [options]\n *   Configuration.\n * @returns {ToMarkdownExtension}\n *   Extension for `mdast-util-to-markdown` to enable GFM tables.\n */\nexport function gfmTableToMarkdown(options) {\n  const settings = options || {}\n  const padding = settings.tableCellPadding\n  const alignDelimiters = settings.tablePipeAlign\n  const stringLength = settings.stringLength\n  const around = padding ? ' ' : '|'\n\n  return {\n    unsafe: [\n      {character: '\\r', inConstruct: 'tableCell'},\n      {character: '\\n', inConstruct: 'tableCell'},\n      // A pipe, when followed by a tab or space (padding), or a dash or colon\n      // (unpadded delimiter row), could result in a table.\n      {atBreak: true, character: '|', after: '[\\t :-]'},\n      // A pipe in a cell must be encoded.\n      {character: '|', inConstruct: 'tableCell'},\n      // A colon must be followed by a dash, in which case it could start a\n      // delimiter row.\n      {atBreak: true, character: ':', after: '-'},\n      // A delimiter row can also start with a dash, when followed by more\n      // dashes, a colon, or a pipe.\n      // This is a stricter version than the built in check for lists, thematic\n      // breaks, and setex heading underlines though:\n      // <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>\n      {atBreak: true, character: '-', after: '[:|-]'}\n    ],\n    handlers: {\n      inlineCode: inlineCodeWithTable,\n      table: handleTable,\n      tableCell: handleTableCell,\n      tableRow: handleTableRow\n    }\n  }\n\n  /**\n   * @type {ToMarkdownHandle}\n   * @param {Table} node\n   */\n  function handleTable(node, _, state, info) {\n    return serializeData(handleTableAsData(node, state, info), node.align)\n  }\n\n  /**\n   * This function isn’t really used normally, because we handle rows at the\n   * table level.\n   * But, if someone passes in a table row, this ensures we make somewhat sense.\n   *\n   * @type {ToMarkdownHandle}\n   * @param {TableRow} node\n   */\n  function handleTableRow(node, _, state, info) {\n    const row = handleTableRowAsData(node, state, info)\n    const value = serializeData([row])\n    // `markdown-table` will always add an align row\n    return value.slice(0, value.indexOf('\\n'))\n  }\n\n  /**\n   * @type {ToMarkdownHandle}\n   * @param {TableCell} node\n   */\n  function handleTableCell(node, _, state, info) {\n    const exit = state.enter('tableCell')\n    const subexit = state.enter('phrasing')\n    const value = state.containerPhrasing(node, {\n      ...info,\n      before: around,\n      after: around\n    })\n    subexit()\n    exit()\n    return value\n  }\n\n  /**\n   * @param {Array<Array<string>>} matrix\n   * @param {Array<string | null | undefined> | null | undefined} [align]\n   */\n  function serializeData(matrix, align) {\n    return markdownTable(matrix, {\n      align,\n      // @ts-expect-error: `markdown-table` types should support `null`.\n      alignDelimiters,\n      // @ts-expect-error: `markdown-table` types should support `null`.\n      padding,\n      // @ts-expect-error: `markdown-table` types should support `null`.\n      stringLength\n    })\n  }\n\n  /**\n   * @param {Table} node\n   * @param {State} state\n   * @param {Info} info\n   */\n  function handleTableAsData(node, state, info) {\n    const children = node.children\n    let index = -1\n    /** @type {Array<Array<string>>} */\n    const result = []\n    const subexit = state.enter('table')\n\n    while (++index < children.length) {\n      result[index] = handleTableRowAsData(children[index], state, info)\n    }\n\n    subexit()\n\n    return result\n  }\n\n  /**\n   * @param {TableRow} node\n   * @param {State} state\n   * @param {Info} info\n   */\n  function handleTableRowAsData(node, state, info) {\n    const children = node.children\n    let index = -1\n    /** @type {Array<string>} */\n    const result = []\n    const subexit = state.enter('tableRow')\n\n    while (++index < children.length) {\n      // Note: the positional info as used here is incorrect.\n      // Making it correct would be impossible due to aligning cells?\n      // And it would need copy/pasting `markdown-table` into this project.\n      result[index] = handleTableCell(children[index], node, state, info)\n    }\n\n    subexit()\n\n    return result\n  }\n\n  /**\n   * @type {ToMarkdownHandle}\n   * @param {InlineCode} node\n   */\n  function inlineCodeWithTable(node, parent, state) {\n    let value = defaultHandlers.inlineCode(node, parent, state)\n\n    if (state.stack.includes('tableCell')) {\n      value = value.replace(/\\|/g, '\\\\$&')\n    }\n\n    return value\n  }\n}\n","/**\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n */\n\nimport {ok as assert} from 'devlop'\nimport {defaultHandlers} from 'mdast-util-to-markdown'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM task\n * list items in markdown.\n *\n * @returns {FromMarkdownExtension}\n *   Extension for `mdast-util-from-markdown` to enable GFM task list items.\n */\nexport function gfmTaskListItemFromMarkdown() {\n  return {\n    exit: {\n      taskListCheckValueChecked: exitCheck,\n      taskListCheckValueUnchecked: exitCheck,\n      paragraph: exitParagraphWithTaskListItem\n    }\n  }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM task list\n * items in markdown.\n *\n * @returns {ToMarkdownExtension}\n *   Extension for `mdast-util-to-markdown` to enable GFM task list items.\n */\nexport function gfmTaskListItemToMarkdown() {\n  return {\n    unsafe: [{atBreak: true, character: '-', after: '[:|-]'}],\n    handlers: {listItem: listItemWithTaskListItem}\n  }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitCheck(token) {\n  // We’re always in a paragraph, in a list item.\n  const node = this.stack[this.stack.length - 2]\n  assert(node.type === 'listItem')\n  node.checked = token.type === 'taskListCheckValueChecked'\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitParagraphWithTaskListItem(token) {\n  const parent = this.stack[this.stack.length - 2]\n\n  if (\n    parent &&\n    parent.type === 'listItem' &&\n    typeof parent.checked === 'boolean'\n  ) {\n    const node = this.stack[this.stack.length - 1]\n    assert(node.type === 'paragraph')\n    const head = node.children[0]\n\n    if (head && head.type === 'text') {\n      const siblings = parent.children\n      let index = -1\n      /** @type {Paragraph | undefined} */\n      let firstParaghraph\n\n      while (++index < siblings.length) {\n        const sibling = siblings[index]\n        if (sibling.type === 'paragraph') {\n          firstParaghraph = sibling\n          break\n        }\n      }\n\n      if (firstParaghraph === node) {\n        // Must start with a space or a tab.\n        head.value = head.value.slice(1)\n\n        if (head.value.length === 0) {\n          node.children.shift()\n        } else if (\n          node.position &&\n          head.position &&\n          typeof head.position.start.offset === 'number'\n        ) {\n          head.position.start.column++\n          head.position.start.offset++\n          node.position.start = Object.assign({}, head.position.start)\n        }\n      }\n    }\n  }\n\n  this.exit(token)\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {ListItem} node\n */\nfunction listItemWithTaskListItem(node, parent, state, info) {\n  const head = node.children[0]\n  const checkable =\n    typeof node.checked === 'boolean' && head && head.type === 'paragraph'\n  const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '\n  const tracker = state.createTracker(info)\n\n  if (checkable) {\n    tracker.move(checkbox)\n  }\n\n  let value = defaultHandlers.listItem(node, parent, state, {\n    ...info,\n    ...tracker.current()\n  })\n\n  if (checkable) {\n    value = value.replace(/^(?:[*+-]|\\d+\\.)([\\r\\n]| {1,3})/, check)\n  }\n\n  return value\n\n  /**\n   * @param {string} $0\n   * @returns {string}\n   */\n  function check($0) {\n    return $0 + checkbox\n  }\n}\n","/**\n * Like `Array#splice`, but smarter for giant arrays.\n *\n * `Array#splice` takes all items to be inserted as individual argument which\n * causes a stack overflow in V8 when trying to insert 100k items for instance.\n *\n * Otherwise, this does not return the removed items, and takes `items` as an\n * array instead of rest parameters.\n *\n * @template {unknown} T\n *   Item type.\n * @param {Array<T>} list\n *   List to operate on.\n * @param {number} start\n *   Index to remove/insert at (can be negative).\n * @param {number} remove\n *   Number of items to remove.\n * @param {Array<T>} items\n *   Items to inject into `list`.\n * @returns {undefined}\n *   Nothing.\n */\nexport function splice(list, start, remove, items) {\n  const end = list.length;\n  let chunkStart = 0;\n  /** @type {Array<unknown>} */\n  let parameters;\n\n  // Make start between zero and `end` (included).\n  if (start < 0) {\n    start = -start > end ? 0 : end + start;\n  } else {\n    start = start > end ? end : start;\n  }\n  remove = remove > 0 ? remove : 0;\n\n  // No need to chunk the items if there’s only a couple (10k) items.\n  if (items.length < 10000) {\n    parameters = Array.from(items);\n    parameters.unshift(start, remove);\n    // @ts-expect-error Hush, it’s fine.\n    list.splice(...parameters);\n  } else {\n    // Delete `remove` items starting from `start`\n    if (remove) list.splice(start, remove);\n\n    // Insert the items in chunks to not cause stack overflows.\n    while (chunkStart < items.length) {\n      parameters = items.slice(chunkStart, chunkStart + 10000);\n      parameters.unshift(start, 0);\n      // @ts-expect-error Hush, it’s fine.\n      list.splice(...parameters);\n      chunkStart += 10000;\n      start += 10000;\n    }\n  }\n}\n\n/**\n * Append `items` (an array) at the end of `list` (another array).\n * When `list` was empty, returns `items` instead.\n *\n * This prevents a potentially expensive operation when `list` is empty,\n * and adds items in batches to prevent V8 from hanging.\n *\n * @template {unknown} T\n *   Item type.\n * @param {Array<T>} list\n *   List to operate on.\n * @param {Array<T>} items\n *   Items to add to `list`.\n * @returns {Array<T>}\n *   Either `list` or `items`.\n */\nexport function push(list, items) {\n  if (list.length > 0) {\n    splice(list, list.length, 0, items);\n    return list;\n  }\n  return items;\n}","/**\n * @import {\n *   Extension,\n *   Handles,\n *   HtmlExtension,\n *   NormalizedExtension\n * } from 'micromark-util-types'\n */\n\nimport {splice} from 'micromark-util-chunked'\n\nconst hasOwnProperty = {}.hasOwnProperty\n\n/**\n * Combine multiple syntax extensions into one.\n *\n * @param {ReadonlyArray<Extension>} extensions\n *   List of syntax extensions.\n * @returns {NormalizedExtension}\n *   A single combined extension.\n */\nexport function combineExtensions(extensions) {\n  /** @type {NormalizedExtension} */\n  const all = {}\n  let index = -1\n\n  while (++index < extensions.length) {\n    syntaxExtension(all, extensions[index])\n  }\n\n  return all\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {NormalizedExtension} all\n *   Extension to merge into.\n * @param {Extension} extension\n *   Extension to merge.\n * @returns {undefined}\n *   Nothing.\n */\nfunction syntaxExtension(all, extension) {\n  /** @type {keyof Extension} */\n  let hook\n\n  for (hook in extension) {\n    const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n    /** @type {Record<string, unknown>} */\n    const left = maybe || (all[hook] = {})\n    /** @type {Record<string, unknown> | undefined} */\n    const right = extension[hook]\n    /** @type {string} */\n    let code\n\n    if (right) {\n      for (code in right) {\n        if (!hasOwnProperty.call(left, code)) left[code] = []\n        const value = right[code]\n        constructs(\n          // @ts-expect-error Looks like a list.\n          left[code],\n          Array.isArray(value) ? value : value ? [value] : []\n        )\n      }\n    }\n  }\n}\n\n/**\n * Merge `list` into `existing` (both lists of constructs).\n * Mutates `existing`.\n *\n * @param {Array<unknown>} existing\n *   List of constructs to merge into.\n * @param {Array<unknown>} list\n *   List of constructs to merge.\n * @returns {undefined}\n *   Nothing.\n */\nfunction constructs(existing, list) {\n  let index = -1\n  /** @type {Array<unknown>} */\n  const before = []\n\n  while (++index < list.length) {\n    // @ts-expect-error Looks like an object.\n    ;(list[index].add === 'after' ? existing : before).push(list[index])\n  }\n\n  splice(existing, 0, 0, before)\n}\n\n/**\n * Combine multiple HTML extensions into one.\n *\n * @param {ReadonlyArray<HtmlExtension>} htmlExtensions\n *   List of HTML extensions.\n * @returns {HtmlExtension}\n *   Single combined HTML extension.\n */\nexport function combineHtmlExtensions(htmlExtensions) {\n  /** @type {HtmlExtension} */\n  const handlers = {}\n  let index = -1\n\n  while (++index < htmlExtensions.length) {\n    htmlExtension(handlers, htmlExtensions[index])\n  }\n\n  return handlers\n}\n\n/**\n * Merge `extension` into `all`.\n *\n * @param {HtmlExtension} all\n *   Extension to merge into.\n * @param {HtmlExtension} extension\n *   Extension to merge.\n * @returns {undefined}\n *   Nothing.\n */\nfunction htmlExtension(all, extension) {\n  /** @type {keyof HtmlExtension} */\n  let hook\n\n  for (hook in extension) {\n    const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined\n    const left = maybe || (all[hook] = {})\n    const right = extension[hook]\n    /** @type {keyof Handles} */\n    let type\n\n    if (right) {\n      for (type in right) {\n        // @ts-expect-error assume document vs regular handler are managed correctly.\n        left[type] = right[type]\n      }\n    }\n  }\n}\n","/**\n * @import {Code, ConstructRecord, Event, Extension, Previous, State, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { asciiAlpha, asciiAlphanumeric, asciiControl, markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';\nconst wwwPrefix = {\n  tokenize: tokenizeWwwPrefix,\n  partial: true\n};\nconst domain = {\n  tokenize: tokenizeDomain,\n  partial: true\n};\nconst path = {\n  tokenize: tokenizePath,\n  partial: true\n};\nconst trail = {\n  tokenize: tokenizeTrail,\n  partial: true\n};\nconst emailDomainDotTrail = {\n  tokenize: tokenizeEmailDomainDotTrail,\n  partial: true\n};\nconst wwwAutolink = {\n  name: 'wwwAutolink',\n  tokenize: tokenizeWwwAutolink,\n  previous: previousWww\n};\nconst protocolAutolink = {\n  name: 'protocolAutolink',\n  tokenize: tokenizeProtocolAutolink,\n  previous: previousProtocol\n};\nconst emailAutolink = {\n  name: 'emailAutolink',\n  tokenize: tokenizeEmailAutolink,\n  previous: previousEmail\n};\n\n/** @type {ConstructRecord} */\nconst text = {};\n\n/**\n * Create an extension for `micromark` to support GitHub autolink literal\n * syntax.\n *\n * @returns {Extension}\n *   Extension for `micromark` that can be passed in `extensions` to enable GFM\n *   autolink literal syntax.\n */\nexport function gfmAutolinkLiteral() {\n  return {\n    text\n  };\n}\n\n/** @type {Code} */\nlet code = 48;\n\n// Add alphanumerics.\nwhile (code < 123) {\n  text[code] = emailAutolink;\n  code++;\n  if (code === 58) code = 65;else if (code === 91) code = 97;\n}\ntext[43] = emailAutolink;\ntext[45] = emailAutolink;\ntext[46] = emailAutolink;\ntext[95] = emailAutolink;\ntext[72] = [emailAutolink, protocolAutolink];\ntext[104] = [emailAutolink, protocolAutolink];\ntext[87] = [emailAutolink, wwwAutolink];\ntext[119] = [emailAutolink, wwwAutolink];\n\n// To do: perform email autolink literals on events, afterwards.\n// That’s where `markdown-rs` and `cmark-gfm` perform it.\n// It should look for `@`, then for atext backwards, and then for a label\n// forwards.\n// To do: `mailto:`, `xmpp:` protocol as prefix.\n\n/**\n * Email autolink literal.\n *\n * ```markdown\n * > | a contact@example.org b\n *       ^^^^^^^^^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeEmailAutolink(effects, ok, nok) {\n  const self = this;\n  /** @type {boolean | undefined} */\n  let dot;\n  /** @type {boolean} */\n  let data;\n  return start;\n\n  /**\n   * Start of email autolink literal.\n   *\n   * ```markdown\n   * > | a contact@example.org b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (!gfmAtext(code) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {\n      return nok(code);\n    }\n    effects.enter('literalAutolink');\n    effects.enter('literalAutolinkEmail');\n    return atext(code);\n  }\n\n  /**\n   * In email atext.\n   *\n   * ```markdown\n   * > | a contact@example.org b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atext(code) {\n    if (gfmAtext(code)) {\n      effects.consume(code);\n      return atext;\n    }\n    if (code === 64) {\n      effects.consume(code);\n      return emailDomain;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In email domain.\n   *\n   * The reference code is a bit overly complex as it handles the `@`, of which\n   * there may be just one.\n   * Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L318>\n   *\n   * ```markdown\n   * > | a contact@example.org b\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailDomain(code) {\n    // Dot followed by alphanumerical (not `-` or `_`).\n    if (code === 46) {\n      return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code);\n    }\n\n    // Alphanumerical, `-`, and `_`.\n    if (code === 45 || code === 95 || asciiAlphanumeric(code)) {\n      data = true;\n      effects.consume(code);\n      return emailDomain;\n    }\n\n    // To do: `/` if xmpp.\n\n    // Note: normally we’d truncate trailing punctuation from the link.\n    // However, email autolink literals cannot contain any of those markers,\n    // except for `.`, but that can only occur if it isn’t trailing.\n    // So we can ignore truncating!\n    return emailDomainAfter(code);\n  }\n\n  /**\n   * In email domain, on dot that is not a trail.\n   *\n   * ```markdown\n   * > | a contact@example.org b\n   *                      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailDomainDot(code) {\n    effects.consume(code);\n    dot = true;\n    return emailDomain;\n  }\n\n  /**\n   * After email domain.\n   *\n   * ```markdown\n   * > | a contact@example.org b\n   *                          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailDomainAfter(code) {\n    // Domain must not be empty, must include a dot, and must end in alphabetical.\n    // Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L332>.\n    if (data && dot && asciiAlpha(self.previous)) {\n      effects.exit('literalAutolinkEmail');\n      effects.exit('literalAutolink');\n      return ok(code);\n    }\n    return nok(code);\n  }\n}\n\n/**\n * `www` autolink literal.\n *\n * ```markdown\n * > | a www.example.org b\n *       ^^^^^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeWwwAutolink(effects, ok, nok) {\n  const self = this;\n  return wwwStart;\n\n  /**\n   * Start of www autolink literal.\n   *\n   * ```markdown\n   * > | www.example.com/a?b#c\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function wwwStart(code) {\n    if (code !== 87 && code !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {\n      return nok(code);\n    }\n    effects.enter('literalAutolink');\n    effects.enter('literalAutolinkWww');\n    // Note: we *check*, so we can discard the `www.` we parsed.\n    // If it worked, we consider it as a part of the domain.\n    return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code);\n  }\n\n  /**\n   * After a www autolink literal.\n   *\n   * ```markdown\n   * > | www.example.com/a?b#c\n   *                          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function wwwAfter(code) {\n    effects.exit('literalAutolinkWww');\n    effects.exit('literalAutolink');\n    return ok(code);\n  }\n}\n\n/**\n * Protocol autolink literal.\n *\n * ```markdown\n * > | a https://example.org b\n *       ^^^^^^^^^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeProtocolAutolink(effects, ok, nok) {\n  const self = this;\n  let buffer = '';\n  let seen = false;\n  return protocolStart;\n\n  /**\n   * Start of protocol autolink literal.\n   *\n   * ```markdown\n   * > | https://example.com/a?b#c\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function protocolStart(code) {\n    if ((code === 72 || code === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {\n      effects.enter('literalAutolink');\n      effects.enter('literalAutolinkHttp');\n      buffer += String.fromCodePoint(code);\n      effects.consume(code);\n      return protocolPrefixInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In protocol.\n   *\n   * ```markdown\n   * > | https://example.com/a?b#c\n   *     ^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function protocolPrefixInside(code) {\n    // `5` is size of `https`\n    if (asciiAlpha(code) && buffer.length < 5) {\n      // @ts-expect-error: definitely number.\n      buffer += String.fromCodePoint(code);\n      effects.consume(code);\n      return protocolPrefixInside;\n    }\n    if (code === 58) {\n      const protocol = buffer.toLowerCase();\n      if (protocol === 'http' || protocol === 'https') {\n        effects.consume(code);\n        return protocolSlashesInside;\n      }\n    }\n    return nok(code);\n  }\n\n  /**\n   * In slashes.\n   *\n   * ```markdown\n   * > | https://example.com/a?b#c\n   *           ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function protocolSlashesInside(code) {\n    if (code === 47) {\n      effects.consume(code);\n      if (seen) {\n        return afterProtocol;\n      }\n      seen = true;\n      return protocolSlashesInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After protocol, before domain.\n   *\n   * ```markdown\n   * > | https://example.com/a?b#c\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterProtocol(code) {\n    // To do: this is different from `markdown-rs`:\n    // https://github.com/wooorm/markdown-rs/blob/b3a921c761309ae00a51fe348d8a43adbc54b518/src/construct/gfm_autolink_literal.rs#L172-L182\n    return code === null || asciiControl(code) || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || unicodePunctuation(code) ? nok(code) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code);\n  }\n\n  /**\n   * After a protocol autolink literal.\n   *\n   * ```markdown\n   * > | https://example.com/a?b#c\n   *                              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function protocolAfter(code) {\n    effects.exit('literalAutolinkHttp');\n    effects.exit('literalAutolink');\n    return ok(code);\n  }\n}\n\n/**\n * `www` prefix.\n *\n * ```markdown\n * > | a www.example.org b\n *       ^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeWwwPrefix(effects, ok, nok) {\n  let size = 0;\n  return wwwPrefixInside;\n\n  /**\n   * In www prefix.\n   *\n   * ```markdown\n   * > | www.example.com\n   *     ^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function wwwPrefixInside(code) {\n    if ((code === 87 || code === 119) && size < 3) {\n      size++;\n      effects.consume(code);\n      return wwwPrefixInside;\n    }\n    if (code === 46 && size === 3) {\n      effects.consume(code);\n      return wwwPrefixAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After www prefix.\n   *\n   * ```markdown\n   * > | www.example.com\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function wwwPrefixAfter(code) {\n    // If there is *anything*, we can link.\n    return code === null ? nok(code) : ok(code);\n  }\n}\n\n/**\n * Domain.\n *\n * ```markdown\n * > | a https://example.org b\n *               ^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDomain(effects, ok, nok) {\n  /** @type {boolean | undefined} */\n  let underscoreInLastSegment;\n  /** @type {boolean | undefined} */\n  let underscoreInLastLastSegment;\n  /** @type {boolean | undefined} */\n  let seen;\n  return domainInside;\n\n  /**\n   * In domain.\n   *\n   * ```markdown\n   * > | https://example.com/a\n   *             ^^^^^^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function domainInside(code) {\n    // Check whether this marker, which is a trailing punctuation\n    // marker, optionally followed by more trailing markers, and then\n    // followed by an end.\n    if (code === 46 || code === 95) {\n      return effects.check(trail, domainAfter, domainAtPunctuation)(code);\n    }\n\n    // GH documents that only alphanumerics (other than `-`, `.`, and `_`) can\n    // occur, which sounds like ASCII only, but they also support `www.點看.com`,\n    // so that’s Unicode.\n    // Instead of some new production for Unicode alphanumerics, markdown\n    // already has that for Unicode punctuation and whitespace, so use those.\n    // Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L12>.\n    if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || code !== 45 && unicodePunctuation(code)) {\n      return domainAfter(code);\n    }\n    seen = true;\n    effects.consume(code);\n    return domainInside;\n  }\n\n  /**\n   * In domain, at potential trailing punctuation, that was not trailing.\n   *\n   * ```markdown\n   * > | https://example.com\n   *                    ^\n   * ```\n   *\n   * @type {State}\n   */\n  function domainAtPunctuation(code) {\n    // There is an underscore in the last segment of the domain\n    if (code === 95) {\n      underscoreInLastSegment = true;\n    }\n    // Otherwise, it’s a `.`: save the last segment underscore in the\n    // penultimate segment slot.\n    else {\n      underscoreInLastLastSegment = underscoreInLastSegment;\n      underscoreInLastSegment = undefined;\n    }\n    effects.consume(code);\n    return domainInside;\n  }\n\n  /**\n   * After domain.\n   *\n   * ```markdown\n   * > | https://example.com/a\n   *                        ^\n   * ```\n   *\n   * @type {State} */\n  function domainAfter(code) {\n    // Note: that’s GH says a dot is needed, but it’s not true:\n    // <https://github.com/github/cmark-gfm/issues/279>\n    if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {\n      return nok(code);\n    }\n    return ok(code);\n  }\n}\n\n/**\n * Path.\n *\n * ```markdown\n * > | a https://example.org/stuff b\n *                          ^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizePath(effects, ok) {\n  let sizeOpen = 0;\n  let sizeClose = 0;\n  return pathInside;\n\n  /**\n   * In path.\n   *\n   * ```markdown\n   * > | https://example.com/a\n   *                        ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function pathInside(code) {\n    if (code === 40) {\n      sizeOpen++;\n      effects.consume(code);\n      return pathInside;\n    }\n\n    // To do: `markdown-rs` also needs this.\n    // If this is a paren, and there are less closings than openings,\n    // we don’t check for a trail.\n    if (code === 41 && sizeClose < sizeOpen) {\n      return pathAtPunctuation(code);\n    }\n\n    // Check whether this trailing punctuation marker is optionally\n    // followed by more trailing markers, and then followed\n    // by an end.\n    if (code === 33 || code === 34 || code === 38 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 60 || code === 63 || code === 93 || code === 95 || code === 126) {\n      return effects.check(trail, ok, pathAtPunctuation)(code);\n    }\n    if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n      return ok(code);\n    }\n    effects.consume(code);\n    return pathInside;\n  }\n\n  /**\n   * In path, at potential trailing punctuation, that was not trailing.\n   *\n   * ```markdown\n   * > | https://example.com/a\"b\n   *                          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function pathAtPunctuation(code) {\n    // Count closing parens.\n    if (code === 41) {\n      sizeClose++;\n    }\n    effects.consume(code);\n    return pathInside;\n  }\n}\n\n/**\n * Trail.\n *\n * This calls `ok` if this *is* the trail, followed by an end, which means\n * the entire trail is not part of the link.\n * It calls `nok` if this *is* part of the link.\n *\n * ```markdown\n * > | https://example.com\").\n *                        ^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTrail(effects, ok, nok) {\n  return trail;\n\n  /**\n   * In trail of domain or path.\n   *\n   * ```markdown\n   * > | https://example.com\").\n   *                        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function trail(code) {\n    // Regular trailing punctuation.\n    if (code === 33 || code === 34 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 63 || code === 95 || code === 126) {\n      effects.consume(code);\n      return trail;\n    }\n\n    // `&` followed by one or more alphabeticals and then a `;`, is\n    // as a whole considered as trailing punctuation.\n    // In all other cases, it is considered as continuation of the URL.\n    if (code === 38) {\n      effects.consume(code);\n      return trailCharacterReferenceStart;\n    }\n\n    // Needed because we allow literals after `[`, as we fix:\n    // <https://github.com/github/cmark-gfm/issues/278>.\n    // Check that it is not followed by `(` or `[`.\n    if (code === 93) {\n      effects.consume(code);\n      return trailBracketAfter;\n    }\n    if (\n    // `<` is an end.\n    code === 60 ||\n    // So is whitespace.\n    code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n      return ok(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In trail, after `]`.\n   *\n   * > 👉 **Note**: this deviates from `cmark-gfm` to fix a bug.\n   * > See end of <https://github.com/github/cmark-gfm/issues/278> for more.\n   *\n   * ```markdown\n   * > | https://example.com](\n   *                         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function trailBracketAfter(code) {\n    // Whitespace or something that could start a resource or reference is the end.\n    // Switch back to trail otherwise.\n    if (code === null || code === 40 || code === 91 || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n      return ok(code);\n    }\n    return trail(code);\n  }\n\n  /**\n   * In character-reference like trail, after `&`.\n   *\n   * ```markdown\n   * > | https://example.com&amp;).\n   *                         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function trailCharacterReferenceStart(code) {\n    // When non-alpha, it’s not a trail.\n    return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code);\n  }\n\n  /**\n   * In character-reference like trail.\n   *\n   * ```markdown\n   * > | https://example.com&amp;).\n   *                         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function trailCharacterReferenceInside(code) {\n    // Switch back to trail if this is well-formed.\n    if (code === 59) {\n      effects.consume(code);\n      return trail;\n    }\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return trailCharacterReferenceInside;\n    }\n\n    // It’s not a trail.\n    return nok(code);\n  }\n}\n\n/**\n * Dot in email domain trail.\n *\n * This calls `ok` if this *is* the trail, followed by an end, which means\n * the trail is not part of the link.\n * It calls `nok` if this *is* part of the link.\n *\n * ```markdown\n * > | contact@example.org.\n *                        ^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeEmailDomainDotTrail(effects, ok, nok) {\n  return start;\n\n  /**\n   * Dot.\n   *\n   * ```markdown\n   * > | contact@example.org.\n   *                    ^   ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // Must be dot.\n    effects.consume(code);\n    return after;\n  }\n\n  /**\n   * After dot.\n   *\n   * ```markdown\n   * > | contact@example.org.\n   *                     ^   ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    // Not a trail if alphanumeric.\n    return asciiAlphanumeric(code) ? nok(code) : ok(code);\n  }\n}\n\n/**\n * See:\n * <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L156>.\n *\n * @type {Previous}\n */\nfunction previousWww(code) {\n  return code === null || code === 40 || code === 42 || code === 95 || code === 91 || code === 93 || code === 126 || markdownLineEndingOrSpace(code);\n}\n\n/**\n * See:\n * <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L214>.\n *\n * @type {Previous}\n */\nfunction previousProtocol(code) {\n  return !asciiAlpha(code);\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Previous}\n */\nfunction previousEmail(code) {\n  // Do not allow a slash “inside” atext.\n  // The reference code is a bit weird, but that’s what it results in.\n  // Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L307>.\n  // Other than slash, every preceding character is allowed.\n  return !(code === 47 || gfmAtext(code));\n}\n\n/**\n * @param {Code} code\n * @returns {boolean}\n */\nfunction gfmAtext(code) {\n  return code === 43 || code === 45 || code === 46 || code === 95 || asciiAlphanumeric(code);\n}\n\n/**\n * @param {Array<Event>} events\n * @returns {boolean}\n */\nfunction previousUnbalanced(events) {\n  let index = events.length;\n  let result = false;\n  while (index--) {\n    const token = events[index][1];\n    if ((token.type === 'labelLink' || token.type === 'labelImage') && !token._balanced) {\n      result = true;\n      break;\n    }\n\n    // If we’ve seen this token, and it was marked as not having any unbalanced\n    // bracket before it, we can exit.\n    if (token._gfmAutolinkLiteralWalkedInto) {\n      result = false;\n      break;\n    }\n  }\n  if (events.length > 0 && !result) {\n    // Mark the last token as “walked into” w/o finding\n    // anything.\n    events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;\n  }\n  return result;\n}","/**\n * @import {Effects, State, TokenType} from 'micromark-util-types'\n */\n\nimport { markdownSpace } from 'micromark-util-character';\n\n// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.\n\n/**\n * Parse spaces and tabs.\n *\n * There is no `nok` parameter:\n *\n * *   spaces in markdown are often optional, in which case this factory can be\n *     used and `ok` will be switched to whether spaces were found or not\n * *   one line ending or space can be detected with `markdownSpace(code)` right\n *     before using `factorySpace`\n *\n * ###### Examples\n *\n * Where `␉` represents a tab (plus how much it expands) and `␠` represents a\n * single space.\n *\n * ```markdown\n * ␉\n * ␠␠␠␠\n * ␉␠\n * ```\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {TokenType} type\n *   Type (`' \\t'`).\n * @param {number | undefined} [max=Infinity]\n *   Max (exclusive).\n * @returns {State}\n *   Start state.\n */\nexport function factorySpace(effects, ok, type, max) {\n  const limit = max ? max - 1 : Number.POSITIVE_INFINITY;\n  let size = 0;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    if (markdownSpace(code)) {\n      effects.enter(type);\n      return prefix(code);\n    }\n    return ok(code);\n  }\n\n  /** @type {State} */\n  function prefix(code) {\n    if (markdownSpace(code) && size++ < limit) {\n      effects.consume(code);\n      return prefix;\n    }\n    effects.exit(type);\n    return ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const blankLine = {\n  partial: true,\n  tokenize: tokenizeBlankLine\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLine(effects, ok, nok) {\n  return start;\n\n  /**\n   * Start of blank line.\n   *\n   * > 👉 **Note**: `␠` represents a space character.\n   *\n   * ```markdown\n   * > | ␠␠␊\n   *     ^\n   * > | ␊\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    return markdownSpace(code) ? factorySpace(effects, after, \"linePrefix\")(code) : after(code);\n  }\n\n  /**\n   * At eof/eol, after optional whitespace.\n   *\n   * > 👉 **Note**: `␠` represents a space character.\n   *\n   * ```markdown\n   * > | ␠␠␊\n   *       ^\n   * > | ␊\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    return code === null || markdownLineEnding(code) ? ok(code) : nok(code);\n  }\n}","/**\n * @import {Event, Exiter, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { blankLine } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nconst indent = {\n  tokenize: tokenizeIndent,\n  partial: true\n};\n\n// To do: micromark should support a `_hiddenGfmFootnoteSupport`, which only\n// affects label start (image).\n// That will let us drop `tokenizePotentialGfmFootnote*`.\n// It currently has a `_hiddenFootnoteSupport`, which affects that and more.\n// That can be removed when `micromark-extension-footnote` is archived.\n\n/**\n * Create an extension for `micromark` to enable GFM footnote syntax.\n *\n * @returns {Extension}\n *   Extension for `micromark` that can be passed in `extensions` to\n *   enable GFM footnote syntax.\n */\nexport function gfmFootnote() {\n  /** @type {Extension} */\n  return {\n    document: {\n      [91]: {\n        name: 'gfmFootnoteDefinition',\n        tokenize: tokenizeDefinitionStart,\n        continuation: {\n          tokenize: tokenizeDefinitionContinuation\n        },\n        exit: gfmFootnoteDefinitionEnd\n      }\n    },\n    text: {\n      [91]: {\n        name: 'gfmFootnoteCall',\n        tokenize: tokenizeGfmFootnoteCall\n      },\n      [93]: {\n        name: 'gfmPotentialFootnoteCall',\n        add: 'after',\n        tokenize: tokenizePotentialGfmFootnoteCall,\n        resolveTo: resolveToPotentialGfmFootnoteCall\n      }\n    }\n  };\n}\n\n// To do: remove after micromark update.\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizePotentialGfmFootnoteCall(effects, ok, nok) {\n  const self = this;\n  let index = self.events.length;\n  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n  /** @type {Token} */\n  let labelStart;\n\n  // Find an opening.\n  while (index--) {\n    const token = self.events[index][1];\n    if (token.type === \"labelImage\") {\n      labelStart = token;\n      break;\n    }\n\n    // Exit if we’ve walked far enough.\n    if (token.type === 'gfmFootnoteCall' || token.type === \"labelLink\" || token.type === \"label\" || token.type === \"image\" || token.type === \"link\") {\n      break;\n    }\n  }\n  return start;\n\n  /**\n   * @type {State}\n   */\n  function start(code) {\n    if (!labelStart || !labelStart._balanced) {\n      return nok(code);\n    }\n    const id = normalizeIdentifier(self.sliceSerialize({\n      start: labelStart.end,\n      end: self.now()\n    }));\n    if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {\n      return nok(code);\n    }\n    effects.enter('gfmFootnoteCallLabelMarker');\n    effects.consume(code);\n    effects.exit('gfmFootnoteCallLabelMarker');\n    return ok(code);\n  }\n}\n\n// To do: remove after micromark update.\n/** @type {Resolver} */\nfunction resolveToPotentialGfmFootnoteCall(events, context) {\n  let index = events.length;\n  /** @type {Token | undefined} */\n  let labelStart;\n\n  // Find an opening.\n  while (index--) {\n    if (events[index][1].type === \"labelImage\" && events[index][0] === 'enter') {\n      labelStart = events[index][1];\n      break;\n    }\n  }\n  // Change the `labelImageMarker` to a `data`.\n  events[index + 1][1].type = \"data\";\n  events[index + 3][1].type = 'gfmFootnoteCallLabelMarker';\n\n  // The whole (without `!`):\n  /** @type {Token} */\n  const call = {\n    type: 'gfmFootnoteCall',\n    start: Object.assign({}, events[index + 3][1].start),\n    end: Object.assign({}, events[events.length - 1][1].end)\n  };\n  // The `^` marker\n  /** @type {Token} */\n  const marker = {\n    type: 'gfmFootnoteCallMarker',\n    start: Object.assign({}, events[index + 3][1].end),\n    end: Object.assign({}, events[index + 3][1].end)\n  };\n  // Increment the end 1 character.\n  marker.end.column++;\n  marker.end.offset++;\n  marker.end._bufferIndex++;\n  /** @type {Token} */\n  const string = {\n    type: 'gfmFootnoteCallString',\n    start: Object.assign({}, marker.end),\n    end: Object.assign({}, events[events.length - 1][1].start)\n  };\n  /** @type {Token} */\n  const chunk = {\n    type: \"chunkString\",\n    contentType: 'string',\n    start: Object.assign({}, string.start),\n    end: Object.assign({}, string.end)\n  };\n\n  /** @type {Array<Event>} */\n  const replacement = [\n  // Take the `labelImageMarker` (now `data`, the `!`)\n  events[index + 1], events[index + 2], ['enter', call, context],\n  // The `[`\n  events[index + 3], events[index + 4],\n  // The `^`.\n  ['enter', marker, context], ['exit', marker, context],\n  // Everything in between.\n  ['enter', string, context], ['enter', chunk, context], ['exit', chunk, context], ['exit', string, context],\n  // The ending (`]`, properly parsed and labelled).\n  events[events.length - 2], events[events.length - 1], ['exit', call, context]];\n  events.splice(index, events.length - index + 1, ...replacement);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeGfmFootnoteCall(effects, ok, nok) {\n  const self = this;\n  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n  let size = 0;\n  /** @type {boolean} */\n  let data;\n\n  // Note: the implementation of `markdown-rs` is different, because it houses\n  // core *and* extensions in one project.\n  // Therefore, it can include footnote logic inside `label-end`.\n  // We can’t do that, but luckily, we can parse footnotes in a simpler way than\n  // needed for labels.\n  return start;\n\n  /**\n   * Start of footnote label.\n   *\n   * ```markdown\n   * > | a [^b] c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter('gfmFootnoteCall');\n    effects.enter('gfmFootnoteCallLabelMarker');\n    effects.consume(code);\n    effects.exit('gfmFootnoteCallLabelMarker');\n    return callStart;\n  }\n\n  /**\n   * After `[`, at `^`.\n   *\n   * ```markdown\n   * > | a [^b] c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function callStart(code) {\n    if (code !== 94) return nok(code);\n    effects.enter('gfmFootnoteCallMarker');\n    effects.consume(code);\n    effects.exit('gfmFootnoteCallMarker');\n    effects.enter('gfmFootnoteCallString');\n    effects.enter('chunkString').contentType = 'string';\n    return callData;\n  }\n\n  /**\n   * In label.\n   *\n   * ```markdown\n   * > | a [^b] c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function callData(code) {\n    if (\n    // Too long.\n    size > 999 ||\n    // Closing brace with nothing.\n    code === 93 && !data ||\n    // Space or tab is not supported by GFM for some reason.\n    // `\\n` and `[` not being supported makes sense.\n    code === null || code === 91 || markdownLineEndingOrSpace(code)) {\n      return nok(code);\n    }\n    if (code === 93) {\n      effects.exit('chunkString');\n      const token = effects.exit('gfmFootnoteCallString');\n      if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {\n        return nok(code);\n      }\n      effects.enter('gfmFootnoteCallLabelMarker');\n      effects.consume(code);\n      effects.exit('gfmFootnoteCallLabelMarker');\n      effects.exit('gfmFootnoteCall');\n      return ok;\n    }\n    if (!markdownLineEndingOrSpace(code)) {\n      data = true;\n    }\n    size++;\n    effects.consume(code);\n    return code === 92 ? callEscape : callData;\n  }\n\n  /**\n   * On character after escape.\n   *\n   * ```markdown\n   * > | a [^b\\c] d\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function callEscape(code) {\n    if (code === 91 || code === 92 || code === 93) {\n      effects.consume(code);\n      size++;\n      return callData;\n    }\n    return callData(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDefinitionStart(effects, ok, nok) {\n  const self = this;\n  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n  /** @type {string} */\n  let identifier;\n  let size = 0;\n  /** @type {boolean | undefined} */\n  let data;\n  return start;\n\n  /**\n   * Start of GFM footnote definition.\n   *\n   * ```markdown\n   * > | [^a]: b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter('gfmFootnoteDefinition')._container = true;\n    effects.enter('gfmFootnoteDefinitionLabel');\n    effects.enter('gfmFootnoteDefinitionLabelMarker');\n    effects.consume(code);\n    effects.exit('gfmFootnoteDefinitionLabelMarker');\n    return labelAtMarker;\n  }\n\n  /**\n   * In label, at caret.\n   *\n   * ```markdown\n   * > | [^a]: b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelAtMarker(code) {\n    if (code === 94) {\n      effects.enter('gfmFootnoteDefinitionMarker');\n      effects.consume(code);\n      effects.exit('gfmFootnoteDefinitionMarker');\n      effects.enter('gfmFootnoteDefinitionLabelString');\n      effects.enter('chunkString').contentType = 'string';\n      return labelInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In label.\n   *\n   * > 👉 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote\n   * > definition labels.\n   *\n   * ```markdown\n   * > | [^a]: b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelInside(code) {\n    if (\n    // Too long.\n    size > 999 ||\n    // Closing brace with nothing.\n    code === 93 && !data ||\n    // Space or tab is not supported by GFM for some reason.\n    // `\\n` and `[` not being supported makes sense.\n    code === null || code === 91 || markdownLineEndingOrSpace(code)) {\n      return nok(code);\n    }\n    if (code === 93) {\n      effects.exit('chunkString');\n      const token = effects.exit('gfmFootnoteDefinitionLabelString');\n      identifier = normalizeIdentifier(self.sliceSerialize(token));\n      effects.enter('gfmFootnoteDefinitionLabelMarker');\n      effects.consume(code);\n      effects.exit('gfmFootnoteDefinitionLabelMarker');\n      effects.exit('gfmFootnoteDefinitionLabel');\n      return labelAfter;\n    }\n    if (!markdownLineEndingOrSpace(code)) {\n      data = true;\n    }\n    size++;\n    effects.consume(code);\n    return code === 92 ? labelEscape : labelInside;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * > 👉 **Note**: `cmark-gfm` currently does not support escaped brackets:\n   * > <https://github.com/github/cmark-gfm/issues/240>\n   *\n   * ```markdown\n   * > | [^a\\*b]: c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEscape(code) {\n    if (code === 91 || code === 92 || code === 93) {\n      effects.consume(code);\n      size++;\n      return labelInside;\n    }\n    return labelInside(code);\n  }\n\n  /**\n   * After definition label.\n   *\n   * ```markdown\n   * > | [^a]: b\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelAfter(code) {\n    if (code === 58) {\n      effects.enter('definitionMarker');\n      effects.consume(code);\n      effects.exit('definitionMarker');\n      if (!defined.includes(identifier)) {\n        defined.push(identifier);\n      }\n\n      // Any whitespace after the marker is eaten, forming indented code\n      // is not possible.\n      // No space is also fine, just like a block quote marker.\n      return factorySpace(effects, whitespaceAfter, 'gfmFootnoteDefinitionWhitespace');\n    }\n    return nok(code);\n  }\n\n  /**\n   * After definition prefix.\n   *\n   * ```markdown\n   * > | [^a]: b\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function whitespaceAfter(code) {\n    // `markdown-rs` has a wrapping token for the prefix that is closed here.\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDefinitionContinuation(effects, ok, nok) {\n  /// Start of footnote definition continuation.\n  ///\n  /// ```markdown\n  ///   | [^a]: b\n  /// > |     c\n  ///     ^\n  /// ```\n  //\n  // Either a blank line, which is okay, or an indented thing.\n  return effects.check(blankLine, ok, effects.attempt(indent, ok, nok));\n}\n\n/** @type {Exiter} */\nfunction gfmFootnoteDefinitionEnd(effects) {\n  effects.exit('gfmFootnoteDefinition');\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n  const self = this;\n  return factorySpace(effects, afterPrefix, 'gfmFootnoteDefinitionIndent', 4 + 1);\n\n  /**\n   * @type {State}\n   */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === 'gfmFootnoteDefinitionIndent' && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok(code) : nok(code);\n  }\n}","/**\n * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types'\n */\n\n/**\n * Call all `resolveAll`s.\n *\n * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs\n *   List of constructs, optionally with `resolveAll`s.\n * @param {Array<Event>} events\n *   List of events.\n * @param {TokenizeContext} context\n *   Context used by `tokenize`.\n * @returns {Array<Event>}\n *   Changed events.\n */\nexport function resolveAll(constructs, events, context) {\n  /** @type {Array<Resolver>} */\n  const called = []\n  let index = -1\n\n  while (++index < constructs.length) {\n    const resolve = constructs[index].resolveAll\n\n    if (resolve && !called.includes(resolve)) {\n      events = resolve(events, context)\n      called.push(resolve)\n    }\n  }\n\n  return events\n}\n","/**\n * @import {Options} from 'micromark-extension-gfm-strikethrough'\n * @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { splice } from 'micromark-util-chunked';\nimport { classifyCharacter } from 'micromark-util-classify-character';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create an extension for `micromark` to enable GFM strikethrough syntax.\n *\n * @param {Options | null | undefined} [options={}]\n *   Configuration.\n * @returns {Extension}\n *   Extension for `micromark` that can be passed in `extensions`, to\n *   enable GFM strikethrough syntax.\n */\nexport function gfmStrikethrough(options) {\n  const options_ = options || {};\n  let single = options_.singleTilde;\n  const tokenizer = {\n    name: 'strikethrough',\n    tokenize: tokenizeStrikethrough,\n    resolveAll: resolveAllStrikethrough\n  };\n  if (single === null || single === undefined) {\n    single = true;\n  }\n  return {\n    text: {\n      [126]: tokenizer\n    },\n    insideSpan: {\n      null: [tokenizer]\n    },\n    attentionMarkers: {\n      null: [126]\n    }\n  };\n\n  /**\n   * Take events and resolve strikethrough.\n   *\n   * @type {Resolver}\n   */\n  function resolveAllStrikethrough(events, context) {\n    let index = -1;\n\n    // Walk through all events.\n    while (++index < events.length) {\n      // Find a token that can close.\n      if (events[index][0] === 'enter' && events[index][1].type === 'strikethroughSequenceTemporary' && events[index][1]._close) {\n        let open = index;\n\n        // Now walk back to find an opener.\n        while (open--) {\n          // Find a token that can open the closer.\n          if (events[open][0] === 'exit' && events[open][1].type === 'strikethroughSequenceTemporary' && events[open][1]._open &&\n          // If the sizes are the same:\n          events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {\n            events[index][1].type = 'strikethroughSequence';\n            events[open][1].type = 'strikethroughSequence';\n\n            /** @type {Token} */\n            const strikethrough = {\n              type: 'strikethrough',\n              start: Object.assign({}, events[open][1].start),\n              end: Object.assign({}, events[index][1].end)\n            };\n\n            /** @type {Token} */\n            const text = {\n              type: 'strikethroughText',\n              start: Object.assign({}, events[open][1].end),\n              end: Object.assign({}, events[index][1].start)\n            };\n\n            // Opening.\n            /** @type {Array<Event>} */\n            const nextEvents = [['enter', strikethrough, context], ['enter', events[open][1], context], ['exit', events[open][1], context], ['enter', text, context]];\n            const insideSpan = context.parser.constructs.insideSpan.null;\n            if (insideSpan) {\n              // Between.\n              splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));\n            }\n\n            // Closing.\n            splice(nextEvents, nextEvents.length, 0, [['exit', text, context], ['enter', events[index][1], context], ['exit', events[index][1], context], ['exit', strikethrough, context]]);\n            splice(events, open - 1, index - open + 3, nextEvents);\n            index = open + nextEvents.length - 2;\n            break;\n          }\n        }\n      }\n    }\n    index = -1;\n    while (++index < events.length) {\n      if (events[index][1].type === 'strikethroughSequenceTemporary') {\n        events[index][1].type = \"data\";\n      }\n    }\n    return events;\n  }\n\n  /**\n   * @this {TokenizeContext}\n   * @type {Tokenizer}\n   */\n  function tokenizeStrikethrough(effects, ok, nok) {\n    const previous = this.previous;\n    const events = this.events;\n    let size = 0;\n    return start;\n\n    /** @type {State} */\n    function start(code) {\n      if (previous === 126 && events[events.length - 1][1].type !== \"characterEscape\") {\n        return nok(code);\n      }\n      effects.enter('strikethroughSequenceTemporary');\n      return more(code);\n    }\n\n    /** @type {State} */\n    function more(code) {\n      const before = classifyCharacter(previous);\n      if (code === 126) {\n        // If this is the third marker, exit.\n        if (size > 1) return nok(code);\n        effects.consume(code);\n        size++;\n        return more;\n      }\n      if (size < 2 && !single) return nok(code);\n      const token = effects.exit('strikethroughSequenceTemporary');\n      const after = classifyCharacter(code);\n      token._open = !after || after === 2 && Boolean(before);\n      token._close = !before || before === 2 && Boolean(after);\n      return ok(code);\n    }\n  }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\n// Port of `edit_map.rs` from `markdown-rs`.\n// This should move to `markdown-js` later.\n\n// Deal with several changes in events, batching them together.\n//\n// Preferably, changes should be kept to a minimum.\n// Sometimes, it’s needed to change the list of events, because parsing can be\n// messy, and it helps to expose a cleaner interface of events to the compiler\n// and other users.\n// It can also help to merge many adjacent similar events.\n// And, in other cases, it’s needed to parse subcontent: pass some events\n// through another tokenizer and inject the result.\n\n/**\n * @typedef {[number, number, Array<Event>]} Change\n * @typedef {[number, number, number]} Jump\n */\n\n/**\n * Tracks a bunch of edits.\n */\nexport class EditMap {\n  /**\n   * Create a new edit map.\n   */\n  constructor() {\n    /**\n     * Record of changes.\n     *\n     * @type {Array<Change>}\n     */\n    this.map = [];\n  }\n\n  /**\n   * Create an edit: a remove and/or add at a certain place.\n   *\n   * @param {number} index\n   * @param {number} remove\n   * @param {Array<Event>} add\n   * @returns {undefined}\n   */\n  add(index, remove, add) {\n    addImplementation(this, index, remove, add);\n  }\n\n  // To do: add this when moving to `micromark`.\n  // /**\n  //  * Create an edit: but insert `add` before existing additions.\n  //  *\n  //  * @param {number} index\n  //  * @param {number} remove\n  //  * @param {Array<Event>} add\n  //  * @returns {undefined}\n  //  */\n  // addBefore(index, remove, add) {\n  //   addImplementation(this, index, remove, add, true)\n  // }\n\n  /**\n   * Done, change the events.\n   *\n   * @param {Array<Event>} events\n   * @returns {undefined}\n   */\n  consume(events) {\n    this.map.sort(function (a, b) {\n      return a[0] - b[0];\n    });\n\n    /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */\n    if (this.map.length === 0) {\n      return;\n    }\n\n    // To do: if links are added in events, like they are in `markdown-rs`,\n    // this is needed.\n    // // Calculate jumps: where items in the current list move to.\n    // /** @type {Array<Jump>} */\n    // const jumps = []\n    // let index = 0\n    // let addAcc = 0\n    // let removeAcc = 0\n    // while (index < this.map.length) {\n    //   const [at, remove, add] = this.map[index]\n    //   removeAcc += remove\n    //   addAcc += add.length\n    //   jumps.push([at, removeAcc, addAcc])\n    //   index += 1\n    // }\n    //\n    // . shiftLinks(events, jumps)\n\n    let index = this.map.length;\n    /** @type {Array<Array<Event>>} */\n    const vecs = [];\n    while (index > 0) {\n      index -= 1;\n      vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);\n\n      // Truncate rest.\n      events.length = this.map[index][0];\n    }\n    vecs.push(events.slice());\n    events.length = 0;\n    let slice = vecs.pop();\n    while (slice) {\n      for (const element of slice) {\n        events.push(element);\n      }\n      slice = vecs.pop();\n    }\n\n    // Truncate everything.\n    this.map.length = 0;\n  }\n}\n\n/**\n * Create an edit.\n *\n * @param {EditMap} editMap\n * @param {number} at\n * @param {number} remove\n * @param {Array<Event>} add\n * @returns {undefined}\n */\nfunction addImplementation(editMap, at, remove, add) {\n  let index = 0;\n\n  /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */\n  if (remove === 0 && add.length === 0) {\n    return;\n  }\n  while (index < editMap.map.length) {\n    if (editMap.map[index][0] === at) {\n      editMap.map[index][1] += remove;\n\n      // To do: before not used by tables, use when moving to micromark.\n      // if (before) {\n      //   add.push(...editMap.map[index][2])\n      //   editMap.map[index][2] = add\n      // } else {\n      editMap.map[index][2].push(...add);\n      // }\n\n      return;\n    }\n    index += 1;\n  }\n  editMap.map.push([at, remove, add]);\n}\n\n// /**\n//  * Shift `previous` and `next` links according to `jumps`.\n//  *\n//  * This fixes links in case there are events removed or added between them.\n//  *\n//  * @param {Array<Event>} events\n//  * @param {Array<Jump>} jumps\n//  */\n// function shiftLinks(events, jumps) {\n//   let jumpIndex = 0\n//   let index = 0\n//   let add = 0\n//   let rm = 0\n\n//   while (index < events.length) {\n//     const rmCurr = rm\n\n//     while (jumpIndex < jumps.length && jumps[jumpIndex][0] <= index) {\n//       add = jumps[jumpIndex][2]\n//       rm = jumps[jumpIndex][1]\n//       jumpIndex += 1\n//     }\n\n//     // Ignore items that will be removed.\n//     if (rm > rmCurr) {\n//       index += rm - rmCurr\n//     } else {\n//       // ?\n//       // if let Some(link) = &events[index].link {\n//       //     if let Some(next) = link.next {\n//       //         events[next].link.as_mut().unwrap().previous = Some(index + add - rm);\n//       //         while jumpIndex < jumps.len() && jumps[jumpIndex].0 <= next {\n//       //             add = jumps[jumpIndex].2;\n//       //             rm = jumps[jumpIndex].1;\n//       //             jumpIndex += 1;\n//       //         }\n//       //         events[index].link.as_mut().unwrap().next = Some(next + add - rm);\n//       //         index = next;\n//       //         continue;\n//       //     }\n//       // }\n//       index += 1\n//     }\n//   }\n// }","/**\n * @import {Event} from 'micromark-util-types'\n */\n\n/**\n * @typedef {'center' | 'left' | 'none' | 'right'} Align\n */\n\n/**\n * Figure out the alignment of a GFM table.\n *\n * @param {Readonly<Array<Event>>} events\n *   List of events.\n * @param {number} index\n *   Table enter event.\n * @returns {Array<Align>}\n *   List of aligns.\n */\nexport function gfmTableAlign(events, index) {\n  let inDelimiterRow = false;\n  /** @type {Array<Align>} */\n  const align = [];\n  while (index < events.length) {\n    const event = events[index];\n    if (inDelimiterRow) {\n      if (event[0] === 'enter') {\n        // Start of alignment value: set a new column.\n        // To do: `markdown-rs` uses `tableDelimiterCellValue`.\n        if (event[1].type === 'tableContent') {\n          align.push(events[index + 1][1].type === 'tableDelimiterMarker' ? 'left' : 'none');\n        }\n      }\n      // Exits:\n      // End of alignment value: change the column.\n      // To do: `markdown-rs` uses `tableDelimiterCellValue`.\n      else if (event[1].type === 'tableContent') {\n        if (events[index - 1][1].type === 'tableDelimiterMarker') {\n          const alignIndex = align.length - 1;\n          align[alignIndex] = align[alignIndex] === 'left' ? 'center' : 'right';\n        }\n      }\n      // Done!\n      else if (event[1].type === 'tableDelimiterRow') {\n        break;\n      }\n    } else if (event[0] === 'enter' && event[1].type === 'tableDelimiterRow') {\n      inDelimiterRow = true;\n    }\n    index += 1;\n  }\n  return align;\n}","/**\n * @import {Event, Extension, Point, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\n/**\n * @typedef {[number, number, number, number]} Range\n *   Cell info.\n *\n * @typedef {0 | 1 | 2 | 3} RowKind\n *   Where we are: `1` for head row, `2` for delimiter row, `3` for body row.\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character';\nimport { EditMap } from './edit-map.js';\nimport { gfmTableAlign } from './infer.js';\n\n/**\n * Create an HTML extension for `micromark` to support GitHub tables syntax.\n *\n * @returns {Extension}\n *   Extension for `micromark` that can be passed in `extensions` to enable GFM\n *   table syntax.\n */\nexport function gfmTable() {\n  return {\n    flow: {\n      null: {\n        name: 'table',\n        tokenize: tokenizeTable,\n        resolveAll: resolveTable\n      }\n    }\n  };\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTable(effects, ok, nok) {\n  const self = this;\n  let size = 0;\n  let sizeB = 0;\n  /** @type {boolean | undefined} */\n  let seen;\n  return start;\n\n  /**\n   * Start of a GFM table.\n   *\n   * If there is a valid table row or table head before, then we try to parse\n   * another row.\n   * Otherwise, we try to parse a head.\n   *\n   * ```markdown\n   * > | | a |\n   *     ^\n   *   | | - |\n   * > | | b |\n   *     ^\n   * ```\n   * @type {State}\n   */\n  function start(code) {\n    let index = self.events.length - 1;\n    while (index > -1) {\n      const type = self.events[index][1].type;\n      if (type === \"lineEnding\" ||\n      // Note: markdown-rs uses `whitespace` instead of `linePrefix`\n      type === \"linePrefix\") index--;else break;\n    }\n    const tail = index > -1 ? self.events[index][1].type : null;\n    const next = tail === 'tableHead' || tail === 'tableRow' ? bodyRowStart : headRowBefore;\n\n    // Don’t allow lazy body rows.\n    if (next === bodyRowStart && self.parser.lazy[self.now().line]) {\n      return nok(code);\n    }\n    return next(code);\n  }\n\n  /**\n   * Before table head row.\n   *\n   * ```markdown\n   * > | | a |\n   *     ^\n   *   | | - |\n   *   | | b |\n   * ```\n   *\n   * @type {State}\n   */\n  function headRowBefore(code) {\n    effects.enter('tableHead');\n    effects.enter('tableRow');\n    return headRowStart(code);\n  }\n\n  /**\n   * Before table head row, after whitespace.\n   *\n   * ```markdown\n   * > | | a |\n   *     ^\n   *   | | - |\n   *   | | b |\n   * ```\n   *\n   * @type {State}\n   */\n  function headRowStart(code) {\n    if (code === 124) {\n      return headRowBreak(code);\n    }\n\n    // To do: micromark-js should let us parse our own whitespace in extensions,\n    // like `markdown-rs`:\n    //\n    // ```js\n    // // 4+ spaces.\n    // if (markdownSpace(code)) {\n    //   return nok(code)\n    // }\n    // ```\n\n    seen = true;\n    // Count the first character, that isn’t a pipe, double.\n    sizeB += 1;\n    return headRowBreak(code);\n  }\n\n  /**\n   * At break in table head row.\n   *\n   * ```markdown\n   * > | | a |\n   *     ^\n   *       ^\n   *         ^\n   *   | | - |\n   *   | | b |\n   * ```\n   *\n   * @type {State}\n   */\n  function headRowBreak(code) {\n    if (code === null) {\n      // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t.\n      return nok(code);\n    }\n    if (markdownLineEnding(code)) {\n      // If anything other than one pipe (ignoring whitespace) was used, it’s fine.\n      if (sizeB > 1) {\n        sizeB = 0;\n        // To do: check if this works.\n        // Feel free to interrupt:\n        self.interrupt = true;\n        effects.exit('tableRow');\n        effects.enter(\"lineEnding\");\n        effects.consume(code);\n        effects.exit(\"lineEnding\");\n        return headDelimiterStart;\n      }\n\n      // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t.\n      return nok(code);\n    }\n    if (markdownSpace(code)) {\n      // To do: check if this is fine.\n      // effects.attempt(State::Next(StateName::GfmTableHeadRowBreak), State::Nok)\n      // State::Retry(space_or_tab(tokenizer))\n      return factorySpace(effects, headRowBreak, \"whitespace\")(code);\n    }\n    sizeB += 1;\n    if (seen) {\n      seen = false;\n      // Header cell count.\n      size += 1;\n    }\n    if (code === 124) {\n      effects.enter('tableCellDivider');\n      effects.consume(code);\n      effects.exit('tableCellDivider');\n      // Whether a delimiter was seen.\n      seen = true;\n      return headRowBreak;\n    }\n\n    // Anything else is cell data.\n    effects.enter(\"data\");\n    return headRowData(code);\n  }\n\n  /**\n   * In table head row data.\n   *\n   * ```markdown\n   * > | | a |\n   *       ^\n   *   | | - |\n   *   | | b |\n   * ```\n   *\n   * @type {State}\n   */\n  function headRowData(code) {\n    if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {\n      effects.exit(\"data\");\n      return headRowBreak(code);\n    }\n    effects.consume(code);\n    return code === 92 ? headRowEscape : headRowData;\n  }\n\n  /**\n   * In table head row escape.\n   *\n   * ```markdown\n   * > | | a\\-b |\n   *         ^\n   *   | | ---- |\n   *   | | c    |\n   * ```\n   *\n   * @type {State}\n   */\n  function headRowEscape(code) {\n    if (code === 92 || code === 124) {\n      effects.consume(code);\n      return headRowData;\n    }\n    return headRowData(code);\n  }\n\n  /**\n   * Before delimiter row.\n   *\n   * ```markdown\n   *   | | a |\n   * > | | - |\n   *     ^\n   *   | | b |\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterStart(code) {\n    // Reset `interrupt`.\n    self.interrupt = false;\n\n    // Note: in `markdown-rs`, we need to handle piercing here too.\n    if (self.parser.lazy[self.now().line]) {\n      return nok(code);\n    }\n    effects.enter('tableDelimiterRow');\n    // Track if we’ve seen a `:` or `|`.\n    seen = false;\n    if (markdownSpace(code)) {\n      return factorySpace(effects, headDelimiterBefore, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n    }\n    return headDelimiterBefore(code);\n  }\n\n  /**\n   * Before delimiter row, after optional whitespace.\n   *\n   * Reused when a `|` is found later, to parse another cell.\n   *\n   * ```markdown\n   *   | | a |\n   * > | | - |\n   *     ^\n   *   | | b |\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterBefore(code) {\n    if (code === 45 || code === 58) {\n      return headDelimiterValueBefore(code);\n    }\n    if (code === 124) {\n      seen = true;\n      // If we start with a pipe, we open a cell marker.\n      effects.enter('tableCellDivider');\n      effects.consume(code);\n      effects.exit('tableCellDivider');\n      return headDelimiterCellBefore;\n    }\n\n    // More whitespace / empty row not allowed at start.\n    return headDelimiterNok(code);\n  }\n\n  /**\n   * After `|`, before delimiter cell.\n   *\n   * ```markdown\n   *   | | a |\n   * > | | - |\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterCellBefore(code) {\n    if (markdownSpace(code)) {\n      return factorySpace(effects, headDelimiterValueBefore, \"whitespace\")(code);\n    }\n    return headDelimiterValueBefore(code);\n  }\n\n  /**\n   * Before delimiter cell value.\n   *\n   * ```markdown\n   *   | | a |\n   * > | | - |\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterValueBefore(code) {\n    // Align: left.\n    if (code === 58) {\n      sizeB += 1;\n      seen = true;\n      effects.enter('tableDelimiterMarker');\n      effects.consume(code);\n      effects.exit('tableDelimiterMarker');\n      return headDelimiterLeftAlignmentAfter;\n    }\n\n    // Align: none.\n    if (code === 45) {\n      sizeB += 1;\n      // To do: seems weird that this *isn’t* left aligned, but that state is used?\n      return headDelimiterLeftAlignmentAfter(code);\n    }\n    if (code === null || markdownLineEnding(code)) {\n      return headDelimiterCellAfter(code);\n    }\n    return headDelimiterNok(code);\n  }\n\n  /**\n   * After delimiter cell left alignment marker.\n   *\n   * ```markdown\n   *   | | a  |\n   * > | | :- |\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterLeftAlignmentAfter(code) {\n    if (code === 45) {\n      effects.enter('tableDelimiterFiller');\n      return headDelimiterFiller(code);\n    }\n\n    // Anything else is not ok after the left-align colon.\n    return headDelimiterNok(code);\n  }\n\n  /**\n   * In delimiter cell filler.\n   *\n   * ```markdown\n   *   | | a |\n   * > | | - |\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterFiller(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return headDelimiterFiller;\n    }\n\n    // Align is `center` if it was `left`, `right` otherwise.\n    if (code === 58) {\n      seen = true;\n      effects.exit('tableDelimiterFiller');\n      effects.enter('tableDelimiterMarker');\n      effects.consume(code);\n      effects.exit('tableDelimiterMarker');\n      return headDelimiterRightAlignmentAfter;\n    }\n    effects.exit('tableDelimiterFiller');\n    return headDelimiterRightAlignmentAfter(code);\n  }\n\n  /**\n   * After delimiter cell right alignment marker.\n   *\n   * ```markdown\n   *   | |  a |\n   * > | | -: |\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterRightAlignmentAfter(code) {\n    if (markdownSpace(code)) {\n      return factorySpace(effects, headDelimiterCellAfter, \"whitespace\")(code);\n    }\n    return headDelimiterCellAfter(code);\n  }\n\n  /**\n   * After delimiter cell.\n   *\n   * ```markdown\n   *   | |  a |\n   * > | | -: |\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterCellAfter(code) {\n    if (code === 124) {\n      return headDelimiterBefore(code);\n    }\n    if (code === null || markdownLineEnding(code)) {\n      // Exit when:\n      // * there was no `:` or `|` at all (it’s a thematic break or setext\n      //   underline instead)\n      // * the header cell count is not the delimiter cell count\n      if (!seen || size !== sizeB) {\n        return headDelimiterNok(code);\n      }\n\n      // Note: in markdown-rs`, a reset is needed here.\n      effects.exit('tableDelimiterRow');\n      effects.exit('tableHead');\n      // To do: in `markdown-rs`, resolvers need to be registered manually.\n      // effects.register_resolver(ResolveName::GfmTable)\n      return ok(code);\n    }\n    return headDelimiterNok(code);\n  }\n\n  /**\n   * In delimiter row, at a disallowed byte.\n   *\n   * ```markdown\n   *   | | a |\n   * > | | x |\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function headDelimiterNok(code) {\n    // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t.\n    return nok(code);\n  }\n\n  /**\n   * Before table body row.\n   *\n   * ```markdown\n   *   | | a |\n   *   | | - |\n   * > | | b |\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function bodyRowStart(code) {\n    // Note: in `markdown-rs` we need to manually take care of a prefix,\n    // but in `micromark-js` that is done for us, so if we’re here, we’re\n    // never at whitespace.\n    effects.enter('tableRow');\n    return bodyRowBreak(code);\n  }\n\n  /**\n   * At break in table body row.\n   *\n   * ```markdown\n   *   | | a |\n   *   | | - |\n   * > | | b |\n   *     ^\n   *       ^\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function bodyRowBreak(code) {\n    if (code === 124) {\n      effects.enter('tableCellDivider');\n      effects.consume(code);\n      effects.exit('tableCellDivider');\n      return bodyRowBreak;\n    }\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit('tableRow');\n      return ok(code);\n    }\n    if (markdownSpace(code)) {\n      return factorySpace(effects, bodyRowBreak, \"whitespace\")(code);\n    }\n\n    // Anything else is cell content.\n    effects.enter(\"data\");\n    return bodyRowData(code);\n  }\n\n  /**\n   * In table body row data.\n   *\n   * ```markdown\n   *   | | a |\n   *   | | - |\n   * > | | b |\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function bodyRowData(code) {\n    if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {\n      effects.exit(\"data\");\n      return bodyRowBreak(code);\n    }\n    effects.consume(code);\n    return code === 92 ? bodyRowEscape : bodyRowData;\n  }\n\n  /**\n   * In table body row escape.\n   *\n   * ```markdown\n   *   | | a    |\n   *   | | ---- |\n   * > | | b\\-c |\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function bodyRowEscape(code) {\n    if (code === 92 || code === 124) {\n      effects.consume(code);\n      return bodyRowData;\n    }\n    return bodyRowData(code);\n  }\n}\n\n/** @type {Resolver} */\n\nfunction resolveTable(events, context) {\n  let index = -1;\n  let inFirstCellAwaitingPipe = true;\n  /** @type {RowKind} */\n  let rowKind = 0;\n  /** @type {Range} */\n  let lastCell = [0, 0, 0, 0];\n  /** @type {Range} */\n  let cell = [0, 0, 0, 0];\n  let afterHeadAwaitingFirstBodyRow = false;\n  let lastTableEnd = 0;\n  /** @type {Token | undefined} */\n  let currentTable;\n  /** @type {Token | undefined} */\n  let currentBody;\n  /** @type {Token | undefined} */\n  let currentCell;\n  const map = new EditMap();\n  while (++index < events.length) {\n    const event = events[index];\n    const token = event[1];\n    if (event[0] === 'enter') {\n      // Start of head.\n      if (token.type === 'tableHead') {\n        afterHeadAwaitingFirstBodyRow = false;\n\n        // Inject previous (body end and) table end.\n        if (lastTableEnd !== 0) {\n          flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);\n          currentBody = undefined;\n          lastTableEnd = 0;\n        }\n\n        // Inject table start.\n        currentTable = {\n          type: 'table',\n          start: Object.assign({}, token.start),\n          // Note: correct end is set later.\n          end: Object.assign({}, token.end)\n        };\n        map.add(index, 0, [['enter', currentTable, context]]);\n      } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') {\n        inFirstCellAwaitingPipe = true;\n        currentCell = undefined;\n        lastCell = [0, 0, 0, 0];\n        cell = [0, index + 1, 0, 0];\n\n        // Inject table body start.\n        if (afterHeadAwaitingFirstBodyRow) {\n          afterHeadAwaitingFirstBodyRow = false;\n          currentBody = {\n            type: 'tableBody',\n            start: Object.assign({}, token.start),\n            // Note: correct end is set later.\n            end: Object.assign({}, token.end)\n          };\n          map.add(index, 0, [['enter', currentBody, context]]);\n        }\n        rowKind = token.type === 'tableDelimiterRow' ? 2 : currentBody ? 3 : 1;\n      }\n      // Cell data.\n      else if (rowKind && (token.type === \"data\" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) {\n        inFirstCellAwaitingPipe = false;\n\n        // First value in cell.\n        if (cell[2] === 0) {\n          if (lastCell[1] !== 0) {\n            cell[0] = cell[1];\n            currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell);\n            lastCell = [0, 0, 0, 0];\n          }\n          cell[2] = index;\n        }\n      } else if (token.type === 'tableCellDivider') {\n        if (inFirstCellAwaitingPipe) {\n          inFirstCellAwaitingPipe = false;\n        } else {\n          if (lastCell[1] !== 0) {\n            cell[0] = cell[1];\n            currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell);\n          }\n          lastCell = cell;\n          cell = [lastCell[1], index, 0, 0];\n        }\n      }\n    }\n    // Exit events.\n    else if (token.type === 'tableHead') {\n      afterHeadAwaitingFirstBodyRow = true;\n      lastTableEnd = index;\n    } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') {\n      lastTableEnd = index;\n      if (lastCell[1] !== 0) {\n        cell[0] = cell[1];\n        currentCell = flushCell(map, context, lastCell, rowKind, index, currentCell);\n      } else if (cell[1] !== 0) {\n        currentCell = flushCell(map, context, cell, rowKind, index, currentCell);\n      }\n      rowKind = 0;\n    } else if (rowKind && (token.type === \"data\" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) {\n      cell[3] = index;\n    }\n  }\n  if (lastTableEnd !== 0) {\n    flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);\n  }\n  map.consume(context.events);\n\n  // To do: move this into `html`, when events are exposed there.\n  // That’s what `markdown-rs` does.\n  // That needs updates to `mdast-util-gfm-table`.\n  index = -1;\n  while (++index < context.events.length) {\n    const event = context.events[index];\n    if (event[0] === 'enter' && event[1].type === 'table') {\n      event[1]._align = gfmTableAlign(context.events, index);\n    }\n  }\n  return events;\n}\n\n/**\n * Generate a cell.\n *\n * @param {EditMap} map\n * @param {Readonly<TokenizeContext>} context\n * @param {Readonly<Range>} range\n * @param {RowKind} rowKind\n * @param {number | undefined} rowEnd\n * @param {Token | undefined} previousCell\n * @returns {Token | undefined}\n */\n// eslint-disable-next-line max-params\nfunction flushCell(map, context, range, rowKind, rowEnd, previousCell) {\n  // `markdown-rs` uses:\n  // rowKind === 2 ? 'tableDelimiterCell' : 'tableCell'\n  const groupName = rowKind === 1 ? 'tableHeader' : rowKind === 2 ? 'tableDelimiter' : 'tableData';\n  // `markdown-rs` uses:\n  // rowKind === 2 ? 'tableDelimiterCellValue' : 'tableCellText'\n  const valueName = 'tableContent';\n\n  // Insert an exit for the previous cell, if there is one.\n  //\n  // ```markdown\n  // > | | aa | bb | cc |\n  //          ^-- exit\n  //           ^^^^-- this cell\n  // ```\n  if (range[0] !== 0) {\n    previousCell.end = Object.assign({}, getPoint(context.events, range[0]));\n    map.add(range[0], 0, [['exit', previousCell, context]]);\n  }\n\n  // Insert enter of this cell.\n  //\n  // ```markdown\n  // > | | aa | bb | cc |\n  //           ^-- enter\n  //           ^^^^-- this cell\n  // ```\n  const now = getPoint(context.events, range[1]);\n  previousCell = {\n    type: groupName,\n    start: Object.assign({}, now),\n    // Note: correct end is set later.\n    end: Object.assign({}, now)\n  };\n  map.add(range[1], 0, [['enter', previousCell, context]]);\n\n  // Insert text start at first data start and end at last data end, and\n  // remove events between.\n  //\n  // ```markdown\n  // > | | aa | bb | cc |\n  //            ^-- enter\n  //             ^-- exit\n  //           ^^^^-- this cell\n  // ```\n  if (range[2] !== 0) {\n    const relatedStart = getPoint(context.events, range[2]);\n    const relatedEnd = getPoint(context.events, range[3]);\n    /** @type {Token} */\n    const valueToken = {\n      type: valueName,\n      start: Object.assign({}, relatedStart),\n      end: Object.assign({}, relatedEnd)\n    };\n    map.add(range[2], 0, [['enter', valueToken, context]]);\n    if (rowKind !== 2) {\n      // Fix positional info on remaining events\n      const start = context.events[range[2]];\n      const end = context.events[range[3]];\n      start[1].end = Object.assign({}, end[1].end);\n      start[1].type = \"chunkText\";\n      start[1].contentType = \"text\";\n\n      // Remove if needed.\n      if (range[3] > range[2] + 1) {\n        const a = range[2] + 1;\n        const b = range[3] - range[2] - 1;\n        map.add(a, b, []);\n      }\n    }\n    map.add(range[3] + 1, 0, [['exit', valueToken, context]]);\n  }\n\n  // Insert an exit for the last cell, if at the row end.\n  //\n  // ```markdown\n  // > | | aa | bb | cc |\n  //                    ^-- exit\n  //               ^^^^^^-- this cell (the last one contains two “between” parts)\n  // ```\n  if (rowEnd !== undefined) {\n    previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));\n    map.add(rowEnd, 0, [['exit', previousCell, context]]);\n    previousCell = undefined;\n  }\n  return previousCell;\n}\n\n/**\n * Generate table end (and table body end).\n *\n * @param {Readonly<EditMap>} map\n * @param {Readonly<TokenizeContext>} context\n * @param {number} index\n * @param {Token} table\n * @param {Token | undefined} tableBody\n */\n// eslint-disable-next-line max-params\nfunction flushTableEnd(map, context, index, table, tableBody) {\n  /** @type {Array<Event>} */\n  const exits = [];\n  const related = getPoint(context.events, index);\n  if (tableBody) {\n    tableBody.end = Object.assign({}, related);\n    exits.push(['exit', tableBody, context]);\n  }\n  table.end = Object.assign({}, related);\n  exits.push(['exit', table, context]);\n  map.add(index + 1, 0, exits);\n}\n\n/**\n * @param {Readonly<Array<Event>>} events\n * @param {number} index\n * @returns {Readonly<Point>}\n */\nfunction getPoint(events, index) {\n  const event = events[index];\n  const side = event[0] === 'enter' ? 'start' : 'end';\n  return event[1][side];\n}","/**\n * @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character';\nconst tasklistCheck = {\n  name: 'tasklistCheck',\n  tokenize: tokenizeTasklistCheck\n};\n\n/**\n * Create an HTML extension for `micromark` to support GFM task list items\n * syntax.\n *\n * @returns {Extension}\n *   Extension for `micromark` that can be passed in `htmlExtensions` to\n *   support GFM task list items when serializing to HTML.\n */\nexport function gfmTaskListItem() {\n  return {\n    text: {\n      [91]: tasklistCheck\n    }\n  };\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTasklistCheck(effects, ok, nok) {\n  const self = this;\n  return open;\n\n  /**\n   * At start of task list item check.\n   *\n   * ```markdown\n   * > | * [x] y.\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (\n    // Exit if there’s stuff before.\n    self.previous !== null ||\n    // Exit if not in the first content that is the first child of a list\n    // item.\n    !self._gfmTasklistFirstContentOfListItem) {\n      return nok(code);\n    }\n    effects.enter('taskListCheck');\n    effects.enter('taskListCheckMarker');\n    effects.consume(code);\n    effects.exit('taskListCheckMarker');\n    return inside;\n  }\n\n  /**\n   * In task list item check.\n   *\n   * ```markdown\n   * > | * [x] y.\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    // Currently we match how GH works in files.\n    // To match how GH works in comments, use `markdownSpace` (`[\\t ]`) instead\n    // of `markdownLineEndingOrSpace` (`[\\t\\n\\r ]`).\n    if (markdownLineEndingOrSpace(code)) {\n      effects.enter('taskListCheckValueUnchecked');\n      effects.consume(code);\n      effects.exit('taskListCheckValueUnchecked');\n      return close;\n    }\n    if (code === 88 || code === 120) {\n      effects.enter('taskListCheckValueChecked');\n      effects.consume(code);\n      effects.exit('taskListCheckValueChecked');\n      return close;\n    }\n    return nok(code);\n  }\n\n  /**\n   * At close of task list item check.\n   *\n   * ```markdown\n   * > | * [x] y.\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function close(code) {\n    if (code === 93) {\n      effects.enter('taskListCheckMarker');\n      effects.consume(code);\n      effects.exit('taskListCheckMarker');\n      effects.exit('taskListCheck');\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * @type {State}\n   */\n  function after(code) {\n    // EOL in paragraph means there must be something else after it.\n    if (markdownLineEnding(code)) {\n      return ok(code);\n    }\n\n    // Space or tab?\n    // Check what comes after.\n    if (markdownSpace(code)) {\n      return effects.check({\n        tokenize: spaceThenNonSpace\n      }, ok, nok)(code);\n    }\n\n    // EOF, or non-whitespace, both wrong.\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction spaceThenNonSpace(effects, ok, nok) {\n  return factorySpace(effects, after, \"whitespace\");\n\n  /**\n   * After whitespace, after task list item check.\n   *\n   * ```markdown\n   * > | * [x] y.\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    // EOF means there was nothing, so bad.\n    // EOL means there’s content after it, so good.\n    // Impossible to have more spaces.\n    // Anything else is good.\n    return code === null ? nok(code) : ok(code);\n  }\n}","/**\n * @import {Root} from 'mdast'\n * @import {Options} from 'remark-gfm'\n * @import {} from 'remark-parse'\n * @import {} from 'remark-stringify'\n * @import {Processor} from 'unified'\n */\n\nimport {gfmFromMarkdown, gfmToMarkdown} from 'mdast-util-gfm'\nimport {gfm} from 'micromark-extension-gfm'\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Add support GFM (autolink literals, footnotes, strikethrough, tables,\n * tasklists).\n *\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function remarkGfm(options) {\n  // @ts-expect-error: TS is wrong about `this`.\n  // eslint-disable-next-line unicorn/no-this-assignment\n  const self = /** @type {Processor<Root>} */ (this)\n  const settings = options || emptyOptions\n  const data = self.data()\n\n  const micromarkExtensions =\n    data.micromarkExtensions || (data.micromarkExtensions = [])\n  const fromMarkdownExtensions =\n    data.fromMarkdownExtensions || (data.fromMarkdownExtensions = [])\n  const toMarkdownExtensions =\n    data.toMarkdownExtensions || (data.toMarkdownExtensions = [])\n\n  micromarkExtensions.push(gfm(settings))\n  fromMarkdownExtensions.push(gfmFromMarkdown())\n  toMarkdownExtensions.push(gfmToMarkdown(settings))\n}\n","/**\n * @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions\n * @typedef {import('micromark-extension-gfm-strikethrough').Options} Options\n * @typedef {import('micromark-util-types').Extension} Extension\n * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension\n */\n\nimport {\n  combineExtensions,\n  combineHtmlExtensions\n} from 'micromark-util-combine-extensions'\nimport {\n  gfmAutolinkLiteral,\n  gfmAutolinkLiteralHtml\n} from 'micromark-extension-gfm-autolink-literal'\nimport {gfmFootnote, gfmFootnoteHtml} from 'micromark-extension-gfm-footnote'\nimport {\n  gfmStrikethrough,\n  gfmStrikethroughHtml\n} from 'micromark-extension-gfm-strikethrough'\nimport {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table'\nimport {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter'\nimport {\n  gfmTaskListItem,\n  gfmTaskListItemHtml\n} from 'micromark-extension-gfm-task-list-item'\n\n/**\n * Create an extension for `micromark` to enable GFM syntax.\n *\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n *\n *   Passed to `micromark-extens-gfm-strikethrough`.\n * @returns {Extension}\n *   Extension for `micromark` that can be passed in `extensions` to enable GFM\n *   syntax.\n */\nexport function gfm(options) {\n  return combineExtensions([\n    gfmAutolinkLiteral(),\n    gfmFootnote(),\n    gfmStrikethrough(options),\n    gfmTable(),\n    gfmTaskListItem()\n  ])\n}\n\n/**\n * Create an extension for `micromark` to support GFM when serializing to HTML.\n *\n * @param {HtmlOptions | null | undefined} [options]\n *   Configuration (optional).\n *\n *   Passed to `micromark-extens-gfm-footnote`.\n * @returns {HtmlExtension}\n *   Extension for `micromark` that can be passed in `htmlExtensions` to\n *   support GFM when serializing to HTML.\n */\nexport function gfmHtml(options) {\n  return combineHtmlExtensions([\n    gfmAutolinkLiteralHtml(),\n    gfmFootnoteHtml(options),\n    gfmStrikethroughHtml(),\n    gfmTableHtml(),\n    gfmTagfilterHtml(),\n    gfmTaskListItemHtml()\n  ])\n}\n","/**\n * @import {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown'\n * @import {Options} from 'mdast-util-gfm'\n * @import {Options as ToMarkdownExtension} from 'mdast-util-to-markdown'\n */\n\nimport {\n  gfmAutolinkLiteralFromMarkdown,\n  gfmAutolinkLiteralToMarkdown\n} from 'mdast-util-gfm-autolink-literal'\nimport {\n  gfmFootnoteFromMarkdown,\n  gfmFootnoteToMarkdown\n} from 'mdast-util-gfm-footnote'\nimport {\n  gfmStrikethroughFromMarkdown,\n  gfmStrikethroughToMarkdown\n} from 'mdast-util-gfm-strikethrough'\nimport {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table'\nimport {\n  gfmTaskListItemFromMarkdown,\n  gfmTaskListItemToMarkdown\n} from 'mdast-util-gfm-task-list-item'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM (autolink\n * literals, footnotes, strikethrough, tables, tasklists).\n *\n * @returns {Array<FromMarkdownExtension>}\n *   Extension for `mdast-util-from-markdown` to enable GFM (autolink literals,\n *   footnotes, strikethrough, tables, tasklists).\n */\nexport function gfmFromMarkdown() {\n  return [\n    gfmAutolinkLiteralFromMarkdown(),\n    gfmFootnoteFromMarkdown(),\n    gfmStrikethroughFromMarkdown(),\n    gfmTableFromMarkdown(),\n    gfmTaskListItemFromMarkdown()\n  ]\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM (autolink\n * literals, footnotes, strikethrough, tables, tasklists).\n *\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {ToMarkdownExtension}\n *   Extension for `mdast-util-to-markdown` to enable GFM (autolink literals,\n *   footnotes, strikethrough, tables, tasklists).\n */\nexport function gfmToMarkdown(options) {\n  return {\n    extensions: [\n      gfmAutolinkLiteralToMarkdown(),\n      gfmFootnoteToMarkdown(options),\n      gfmStrikethroughToMarkdown(),\n      gfmTableToMarkdown(options),\n      gfmTaskListItemToMarkdown()\n    ]\n  }\n}\n","/**\n * Some of the internal operations of micromark do lots of editing\n * operations on very large arrays. This runs into problems with two\n * properties of most circa-2020 JavaScript interpreters:\n *\n *  - Array-length modifications at the high end of an array (push/pop) are\n *    expected to be common and are implemented in (amortized) time\n *    proportional to the number of elements added or removed, whereas\n *    other operations (shift/unshift and splice) are much less efficient.\n *  - Function arguments are passed on the stack, so adding tens of thousands\n *    of elements to an array with `arr.push(...newElements)` will frequently\n *    cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>)\n *\n * SpliceBuffers are an implementation of gap buffers, which are a\n * generalization of the \"queue made of two stacks\" idea. The splice buffer\n * maintains a cursor, and moving the cursor has cost proportional to the\n * distance the cursor moves, but inserting, deleting, or splicing in\n * new information at the cursor is as efficient as the push/pop operation.\n * This allows for an efficient sequence of splices (or pushes, pops, shifts,\n * or unshifts) as long such edits happen at the same part of the array or\n * generally sweep through the array from the beginning to the end.\n *\n * The interface for splice buffers also supports large numbers of inputs by\n * passing a single array argument rather passing multiple arguments on the\n * function call stack.\n *\n * @template T\n *   Item type.\n */\nexport class SpliceBuffer {\n  /**\n   * @param {ReadonlyArray<T> | null | undefined} [initial]\n   *   Initial items (optional).\n   * @returns\n   *   Splice buffer.\n   */\n  constructor(initial) {\n    /** @type {Array<T>} */\n    this.left = initial ? [...initial] : [];\n    /** @type {Array<T>} */\n    this.right = [];\n  }\n\n  /**\n   * Array access;\n   * does not move the cursor.\n   *\n   * @param {number} index\n   *   Index.\n   * @return {T}\n   *   Item.\n   */\n  get(index) {\n    if (index < 0 || index >= this.left.length + this.right.length) {\n      throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`');\n    }\n    if (index < this.left.length) return this.left[index];\n    return this.right[this.right.length - index + this.left.length - 1];\n  }\n\n  /**\n   * The length of the splice buffer, one greater than the largest index in the\n   * array.\n   */\n  get length() {\n    return this.left.length + this.right.length;\n  }\n\n  /**\n   * Remove and return `list[0]`;\n   * moves the cursor to `0`.\n   *\n   * @returns {T | undefined}\n   *   Item, optional.\n   */\n  shift() {\n    this.setCursor(0);\n    return this.right.pop();\n  }\n\n  /**\n   * Slice the buffer to get an array;\n   * does not move the cursor.\n   *\n   * @param {number} start\n   *   Start.\n   * @param {number | null | undefined} [end]\n   *   End (optional).\n   * @returns {Array<T>}\n   *   Array of items.\n   */\n  slice(start, end) {\n    /** @type {number} */\n    const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end;\n    if (stop < this.left.length) {\n      return this.left.slice(start, stop);\n    }\n    if (start > this.left.length) {\n      return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse();\n    }\n    return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());\n  }\n\n  /**\n   * Mimics the behavior of Array.prototype.splice() except for the change of\n   * interface necessary to avoid segfaults when patching in very large arrays.\n   *\n   * This operation moves cursor is moved to `start` and results in the cursor\n   * placed after any inserted items.\n   *\n   * @param {number} start\n   *   Start;\n   *   zero-based index at which to start changing the array;\n   *   negative numbers count backwards from the end of the array and values\n   *   that are out-of bounds are clamped to the appropriate end of the array.\n   * @param {number | null | undefined} [deleteCount=0]\n   *   Delete count (default: `0`);\n   *   maximum number of elements to delete, starting from start.\n   * @param {Array<T> | null | undefined} [items=[]]\n   *   Items to include in place of the deleted items (default: `[]`).\n   * @return {Array<T>}\n   *   Any removed items.\n   */\n  splice(start, deleteCount, items) {\n    /** @type {number} */\n    const count = deleteCount || 0;\n    this.setCursor(Math.trunc(start));\n    const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);\n    if (items) chunkedPush(this.left, items);\n    return removed.reverse();\n  }\n\n  /**\n   * Remove and return the highest-numbered item in the array, so\n   * `list[list.length - 1]`;\n   * Moves the cursor to `length`.\n   *\n   * @returns {T | undefined}\n   *   Item, optional.\n   */\n  pop() {\n    this.setCursor(Number.POSITIVE_INFINITY);\n    return this.left.pop();\n  }\n\n  /**\n   * Inserts a single item to the high-numbered side of the array;\n   * moves the cursor to `length`.\n   *\n   * @param {T} item\n   *   Item.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  push(item) {\n    this.setCursor(Number.POSITIVE_INFINITY);\n    this.left.push(item);\n  }\n\n  /**\n   * Inserts many items to the high-numbered side of the array.\n   * Moves the cursor to `length`.\n   *\n   * @param {Array<T>} items\n   *   Items.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  pushMany(items) {\n    this.setCursor(Number.POSITIVE_INFINITY);\n    chunkedPush(this.left, items);\n  }\n\n  /**\n   * Inserts a single item to the low-numbered side of the array;\n   * Moves the cursor to `0`.\n   *\n   * @param {T} item\n   *   Item.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  unshift(item) {\n    this.setCursor(0);\n    this.right.push(item);\n  }\n\n  /**\n   * Inserts many items to the low-numbered side of the array;\n   * moves the cursor to `0`.\n   *\n   * @param {Array<T>} items\n   *   Items.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  unshiftMany(items) {\n    this.setCursor(0);\n    chunkedPush(this.right, items.reverse());\n  }\n\n  /**\n   * Move the cursor to a specific position in the array. Requires\n   * time proportional to the distance moved.\n   *\n   * If `n < 0`, the cursor will end up at the beginning.\n   * If `n > length`, the cursor will end up at the end.\n   *\n   * @param {number} n\n   *   Position.\n   * @return {undefined}\n   *   Nothing.\n   */\n  setCursor(n) {\n    if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return;\n    if (n < this.left.length) {\n      // Move cursor to the this.left\n      const removed = this.left.splice(n, Number.POSITIVE_INFINITY);\n      chunkedPush(this.right, removed.reverse());\n    } else {\n      // Move cursor to the this.right\n      const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY);\n      chunkedPush(this.left, removed.reverse());\n    }\n  }\n}\n\n/**\n * Avoid stack overflow by pushing items onto the stack in segments\n *\n * @template T\n *   Item type.\n * @param {Array<T>} list\n *   List to inject into.\n * @param {ReadonlyArray<T>} right\n *   Items to inject.\n * @return {undefined}\n *   Nothing.\n */\nfunction chunkedPush(list, right) {\n  /** @type {number} */\n  let chunkStart = 0;\n  if (right.length < 10000) {\n    list.push(...right);\n  } else {\n    while (chunkStart < right.length) {\n      list.push(...right.slice(chunkStart, chunkStart + 10000));\n      chunkStart += 10000;\n    }\n  }\n}","/**\n * @import {Chunk, Event, Token} from 'micromark-util-types'\n */\n\nimport { splice } from 'micromark-util-chunked';\nimport { SpliceBuffer } from './lib/splice-buffer.js';\n\n// Hidden API exposed for testing.\nexport { SpliceBuffer } from './lib/splice-buffer.js';\n\n/**\n * Tokenize subcontent.\n *\n * @param {Array<Event>} eventsArray\n *   List of events.\n * @returns {boolean}\n *   Whether subtokens were found.\n */\n// eslint-disable-next-line complexity\nexport function subtokenize(eventsArray) {\n  /** @type {Record<string, number>} */\n  const jumps = {};\n  let index = -1;\n  /** @type {Event} */\n  let event;\n  /** @type {number | undefined} */\n  let lineIndex;\n  /** @type {number} */\n  let otherIndex;\n  /** @type {Event} */\n  let otherEvent;\n  /** @type {Array<Event>} */\n  let parameters;\n  /** @type {Array<Event>} */\n  let subevents;\n  /** @type {boolean | undefined} */\n  let more;\n  const events = new SpliceBuffer(eventsArray);\n  while (++index < events.length) {\n    while (index in jumps) {\n      index = jumps[index];\n    }\n    event = events.get(index);\n\n    // Add a hook for the GFM tasklist extension, which needs to know if text\n    // is in the first content of a list item.\n    if (index && event[1].type === \"chunkFlow\" && events.get(index - 1)[1].type === \"listItemPrefix\") {\n      subevents = event[1]._tokenizer.events;\n      otherIndex = 0;\n      if (otherIndex < subevents.length && subevents[otherIndex][1].type === \"lineEndingBlank\") {\n        otherIndex += 2;\n      }\n      if (otherIndex < subevents.length && subevents[otherIndex][1].type === \"content\") {\n        while (++otherIndex < subevents.length) {\n          if (subevents[otherIndex][1].type === \"content\") {\n            break;\n          }\n          if (subevents[otherIndex][1].type === \"chunkText\") {\n            subevents[otherIndex][1]._isInFirstContentOfListItem = true;\n            otherIndex++;\n          }\n        }\n      }\n    }\n\n    // Enter.\n    if (event[0] === 'enter') {\n      if (event[1].contentType) {\n        Object.assign(jumps, subcontent(events, index));\n        index = jumps[index];\n        more = true;\n      }\n    }\n    // Exit.\n    else if (event[1]._container) {\n      otherIndex = index;\n      lineIndex = undefined;\n      while (otherIndex--) {\n        otherEvent = events.get(otherIndex);\n        if (otherEvent[1].type === \"lineEnding\" || otherEvent[1].type === \"lineEndingBlank\") {\n          if (otherEvent[0] === 'enter') {\n            if (lineIndex) {\n              events.get(lineIndex)[1].type = \"lineEndingBlank\";\n            }\n            otherEvent[1].type = \"lineEnding\";\n            lineIndex = otherIndex;\n          }\n        } else if (otherEvent[1].type === \"linePrefix\" || otherEvent[1].type === \"listItemIndent\") {\n          // Move past.\n        } else {\n          break;\n        }\n      }\n      if (lineIndex) {\n        // Fix position.\n        event[1].end = {\n          ...events.get(lineIndex)[1].start\n        };\n\n        // Switch container exit w/ line endings.\n        parameters = events.slice(lineIndex, index);\n        parameters.unshift(event);\n        events.splice(lineIndex, index - lineIndex + 1, parameters);\n      }\n    }\n  }\n\n  // The changes to the `events` buffer must be copied back into the eventsArray\n  splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0));\n  return !more;\n}\n\n/**\n * Tokenize embedded tokens.\n *\n * @param {SpliceBuffer<Event>} events\n *   Events.\n * @param {number} eventIndex\n *   Index.\n * @returns {Record<string, number>}\n *   Gaps.\n */\nfunction subcontent(events, eventIndex) {\n  const token = events.get(eventIndex)[1];\n  const context = events.get(eventIndex)[2];\n  let startPosition = eventIndex - 1;\n  /** @type {Array<number>} */\n  const startPositions = [];\n  let tokenizer = token._tokenizer;\n  if (!tokenizer) {\n    tokenizer = context.parser[token.contentType](token.start);\n    if (token._contentTypeTextTrailing) {\n      tokenizer._contentTypeTextTrailing = true;\n    }\n  }\n  const childEvents = tokenizer.events;\n  /** @type {Array<[number, number]>} */\n  const jumps = [];\n  /** @type {Record<string, number>} */\n  const gaps = {};\n  /** @type {Array<Chunk>} */\n  let stream;\n  /** @type {Token | undefined} */\n  let previous;\n  let index = -1;\n  /** @type {Token | undefined} */\n  let current = token;\n  let adjust = 0;\n  let start = 0;\n  const breaks = [start];\n\n  // Loop forward through the linked tokens to pass them in order to the\n  // subtokenizer.\n  while (current) {\n    // Find the position of the event for this token.\n    while (events.get(++startPosition)[1] !== current) {\n      // Empty.\n    }\n    startPositions.push(startPosition);\n    if (!current._tokenizer) {\n      stream = context.sliceStream(current);\n      if (!current.next) {\n        stream.push(null);\n      }\n      if (previous) {\n        tokenizer.defineSkip(current.start);\n      }\n      if (current._isInFirstContentOfListItem) {\n        tokenizer._gfmTasklistFirstContentOfListItem = true;\n      }\n      tokenizer.write(stream);\n      if (current._isInFirstContentOfListItem) {\n        tokenizer._gfmTasklistFirstContentOfListItem = undefined;\n      }\n    }\n\n    // Unravel the next token.\n    previous = current;\n    current = current.next;\n  }\n\n  // Now, loop back through all events (and linked tokens), to figure out which\n  // parts belong where.\n  current = token;\n  while (++index < childEvents.length) {\n    if (\n    // Find a void token that includes a break.\n    childEvents[index][0] === 'exit' && childEvents[index - 1][0] === 'enter' && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) {\n      start = index + 1;\n      breaks.push(start);\n      // Help GC.\n      current._tokenizer = undefined;\n      current.previous = undefined;\n      current = current.next;\n    }\n  }\n\n  // Help GC.\n  tokenizer.events = [];\n\n  // If there’s one more token (which is the cases for lines that end in an\n  // EOF), that’s perfect: the last point we found starts it.\n  // If there isn’t then make sure any remaining content is added to it.\n  if (current) {\n    // Help GC.\n    current._tokenizer = undefined;\n    current.previous = undefined;\n  } else {\n    breaks.pop();\n  }\n\n  // Now splice the events from the subtokenizer into the current events,\n  // moving back to front so that splice indices aren’t affected.\n  index = breaks.length;\n  while (index--) {\n    const slice = childEvents.slice(breaks[index], breaks[index + 1]);\n    const start = startPositions.pop();\n    jumps.push([start, start + slice.length - 1]);\n    events.splice(start, 2, slice);\n  }\n  jumps.reverse();\n  index = -1;\n  while (++index < jumps.length) {\n    gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];\n    adjust += jumps[index][1] - jumps[index][0] - 1;\n  }\n  return gaps;\n}","/**\n * @import {\n *   InitialConstruct,\n *   Initializer,\n *   State,\n *   TokenizeContext,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const content = {\n  tokenize: initializeContent\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Initializer}\n *   Content.\n */\nfunction initializeContent(effects) {\n  const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);\n  /** @type {Token} */\n  let previous;\n  return contentStart;\n\n  /** @type {State} */\n  function afterContentStartConstruct(code) {\n    if (code === null) {\n      effects.consume(code);\n      return;\n    }\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return factorySpace(effects, contentStart, \"linePrefix\");\n  }\n\n  /** @type {State} */\n  function paragraphInitial(code) {\n    effects.enter(\"paragraph\");\n    return lineStart(code);\n  }\n\n  /** @type {State} */\n  function lineStart(code) {\n    const token = effects.enter(\"chunkText\", {\n      contentType: \"text\",\n      previous\n    });\n    if (previous) {\n      previous.next = token;\n    }\n    previous = token;\n    return data(code);\n  }\n\n  /** @type {State} */\n  function data(code) {\n    if (code === null) {\n      effects.exit(\"chunkText\");\n      effects.exit(\"paragraph\");\n      effects.consume(code);\n      return;\n    }\n    if (markdownLineEnding(code)) {\n      effects.consume(code);\n      effects.exit(\"chunkText\");\n      return lineStart;\n    }\n\n    // Data.\n    effects.consume(code);\n    return data;\n  }\n}","/**\n * @import {\n *   Construct,\n *   ContainerState,\n *   InitialConstruct,\n *   Initializer,\n *   Point,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @typedef {[Construct, ContainerState]} StackItem\n *   Construct and its state.\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { splice } from 'micromark-util-chunked';\n/** @type {InitialConstruct} */\nexport const document = {\n  tokenize: initializeDocument\n};\n\n/** @type {Construct} */\nconst containerConstruct = {\n  tokenize: tokenizeContainer\n};\n\n/**\n * @this {TokenizeContext}\n *   Self.\n * @type {Initializer}\n *   Initializer.\n */\nfunction initializeDocument(effects) {\n  const self = this;\n  /** @type {Array<StackItem>} */\n  const stack = [];\n  let continued = 0;\n  /** @type {TokenizeContext | undefined} */\n  let childFlow;\n  /** @type {Token | undefined} */\n  let childToken;\n  /** @type {number} */\n  let lineStartOffset;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    // First we iterate through the open blocks, starting with the root\n    // document, and descending through last children down to the last open\n    // block.\n    // Each block imposes a condition that the line must satisfy if the block is\n    // to remain open.\n    // For example, a block quote requires a `>` character.\n    // A paragraph requires a non-blank line.\n    // In this phase we may match all or just some of the open blocks.\n    // But we cannot close unmatched blocks yet, because we may have a lazy\n    // continuation line.\n    if (continued < stack.length) {\n      const item = stack[continued];\n      self.containerState = item[1];\n      return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code);\n    }\n\n    // Done.\n    return checkNewContainers(code);\n  }\n\n  /** @type {State} */\n  function documentContinue(code) {\n    continued++;\n\n    // Note: this field is called `_closeFlow` but it also closes containers.\n    // Perhaps a good idea to rename it but it’s already used in the wild by\n    // extensions.\n    if (self.containerState._closeFlow) {\n      self.containerState._closeFlow = undefined;\n      if (childFlow) {\n        closeFlow();\n      }\n\n      // Note: this algorithm for moving events around is similar to the\n      // algorithm when dealing with lazy lines in `writeToChild`.\n      const indexBeforeExits = self.events.length;\n      let indexBeforeFlow = indexBeforeExits;\n      /** @type {Point | undefined} */\n      let point;\n\n      // Find the flow chunk.\n      while (indexBeforeFlow--) {\n        if (self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === \"chunkFlow\") {\n          point = self.events[indexBeforeFlow][1].end;\n          break;\n        }\n      }\n      exitContainers(continued);\n\n      // Fix positions.\n      let index = indexBeforeExits;\n      while (index < self.events.length) {\n        self.events[index][1].end = {\n          ...point\n        };\n        index++;\n      }\n\n      // Inject the exits earlier (they’re still also at the end).\n      splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));\n\n      // Discard the duplicate exits.\n      self.events.length = index;\n      return checkNewContainers(code);\n    }\n    return start(code);\n  }\n\n  /** @type {State} */\n  function checkNewContainers(code) {\n    // Next, after consuming the continuation markers for existing blocks, we\n    // look for new block starts (e.g. `>` for a block quote).\n    // If we encounter a new block start, we close any blocks unmatched in\n    // step 1 before creating the new block as a child of the last matched\n    // block.\n    if (continued === stack.length) {\n      // No need to `check` whether there’s a container, of `exitContainers`\n      // would be moot.\n      // We can instead immediately `attempt` to parse one.\n      if (!childFlow) {\n        return documentContinued(code);\n      }\n\n      // If we have concrete content, such as block HTML or fenced code,\n      // we can’t have containers “pierce” into them, so we can immediately\n      // start.\n      if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {\n        return flowStart(code);\n      }\n\n      // If we do have flow, it could still be a blank line,\n      // but we’d be interrupting it w/ a new container if there’s a current\n      // construct.\n      // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer\n      // needed in micromark-extension-gfm-table@1.0.6).\n      self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);\n    }\n\n    // Check if there is a new container.\n    self.containerState = {};\n    return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);\n  }\n\n  /** @type {State} */\n  function thereIsANewContainer(code) {\n    if (childFlow) closeFlow();\n    exitContainers(continued);\n    return documentContinued(code);\n  }\n\n  /** @type {State} */\n  function thereIsNoNewContainer(code) {\n    self.parser.lazy[self.now().line] = continued !== stack.length;\n    lineStartOffset = self.now().offset;\n    return flowStart(code);\n  }\n\n  /** @type {State} */\n  function documentContinued(code) {\n    // Try new containers.\n    self.containerState = {};\n    return effects.attempt(containerConstruct, containerContinue, flowStart)(code);\n  }\n\n  /** @type {State} */\n  function containerContinue(code) {\n    continued++;\n    stack.push([self.currentConstruct, self.containerState]);\n    // Try another.\n    return documentContinued(code);\n  }\n\n  /** @type {State} */\n  function flowStart(code) {\n    if (code === null) {\n      if (childFlow) closeFlow();\n      exitContainers(0);\n      effects.consume(code);\n      return;\n    }\n    childFlow = childFlow || self.parser.flow(self.now());\n    effects.enter(\"chunkFlow\", {\n      _tokenizer: childFlow,\n      contentType: \"flow\",\n      previous: childToken\n    });\n    return flowContinue(code);\n  }\n\n  /** @type {State} */\n  function flowContinue(code) {\n    if (code === null) {\n      writeToChild(effects.exit(\"chunkFlow\"), true);\n      exitContainers(0);\n      effects.consume(code);\n      return;\n    }\n    if (markdownLineEnding(code)) {\n      effects.consume(code);\n      writeToChild(effects.exit(\"chunkFlow\"));\n      // Get ready for the next line.\n      continued = 0;\n      self.interrupt = undefined;\n      return start;\n    }\n    effects.consume(code);\n    return flowContinue;\n  }\n\n  /**\n   * @param {Token} token\n   *   Token.\n   * @param {boolean | undefined} [endOfFile]\n   *   Whether the token is at the end of the file (default: `false`).\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function writeToChild(token, endOfFile) {\n    const stream = self.sliceStream(token);\n    if (endOfFile) stream.push(null);\n    token.previous = childToken;\n    if (childToken) childToken.next = token;\n    childToken = token;\n    childFlow.defineSkip(token.start);\n    childFlow.write(stream);\n\n    // Alright, so we just added a lazy line:\n    //\n    // ```markdown\n    // > a\n    // b.\n    //\n    // Or:\n    //\n    // > ~~~c\n    // d\n    //\n    // Or:\n    //\n    // > | e |\n    // f\n    // ```\n    //\n    // The construct in the second example (fenced code) does not accept lazy\n    // lines, so it marked itself as done at the end of its first line, and\n    // then the content construct parses `d`.\n    // Most constructs in markdown match on the first line: if the first line\n    // forms a construct, a non-lazy line can’t “unmake” it.\n    //\n    // The construct in the third example is potentially a GFM table, and\n    // those are *weird*.\n    // It *could* be a table, from the first line, if the following line\n    // matches a condition.\n    // In this case, that second line is lazy, which “unmakes” the first line\n    // and turns the whole into one content block.\n    //\n    // We’ve now parsed the non-lazy and the lazy line, and can figure out\n    // whether the lazy line started a new flow block.\n    // If it did, we exit the current containers between the two flow blocks.\n    if (self.parser.lazy[token.start.line]) {\n      let index = childFlow.events.length;\n      while (index--) {\n        if (\n        // The token starts before the line ending…\n        childFlow.events[index][1].start.offset < lineStartOffset && (\n        // …and either is not ended yet…\n        !childFlow.events[index][1].end ||\n        // …or ends after it.\n        childFlow.events[index][1].end.offset > lineStartOffset)) {\n          // Exit: there’s still something open, which means it’s a lazy line\n          // part of something.\n          return;\n        }\n      }\n\n      // Note: this algorithm for moving events around is similar to the\n      // algorithm when closing flow in `documentContinue`.\n      const indexBeforeExits = self.events.length;\n      let indexBeforeFlow = indexBeforeExits;\n      /** @type {boolean | undefined} */\n      let seen;\n      /** @type {Point | undefined} */\n      let point;\n\n      // Find the previous chunk (the one before the lazy line).\n      while (indexBeforeFlow--) {\n        if (self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === \"chunkFlow\") {\n          if (seen) {\n            point = self.events[indexBeforeFlow][1].end;\n            break;\n          }\n          seen = true;\n        }\n      }\n      exitContainers(continued);\n\n      // Fix positions.\n      index = indexBeforeExits;\n      while (index < self.events.length) {\n        self.events[index][1].end = {\n          ...point\n        };\n        index++;\n      }\n\n      // Inject the exits earlier (they’re still also at the end).\n      splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));\n\n      // Discard the duplicate exits.\n      self.events.length = index;\n    }\n  }\n\n  /**\n   * @param {number} size\n   *   Size.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function exitContainers(size) {\n    let index = stack.length;\n\n    // Exit open containers.\n    while (index-- > size) {\n      const entry = stack[index];\n      self.containerState = entry[1];\n      entry[0].exit.call(self, effects);\n    }\n    stack.length = size;\n  }\n  function closeFlow() {\n    childFlow.write([null]);\n    childToken = undefined;\n    childFlow = undefined;\n    self.containerState._closeFlow = undefined;\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n *   Tokenizer.\n */\nfunction tokenizeContainer(effects, ok, nok) {\n  // Always populated by defaults.\n\n  return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), \"linePrefix\", this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4);\n}","/**\n * @import {\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { subtokenize } from 'micromark-util-subtokenize';\n/**\n * No name because it must not be turned off.\n * @type {Construct}\n */\nexport const content = {\n  resolve: resolveContent,\n  tokenize: tokenizeContent\n};\n\n/** @type {Construct} */\nconst continuationConstruct = {\n  partial: true,\n  tokenize: tokenizeContinuation\n};\n\n/**\n * Content is transparent: it’s parsed right now. That way, definitions are also\n * parsed right now: before text in paragraphs (specifically, media) are parsed.\n *\n * @type {Resolver}\n */\nfunction resolveContent(events) {\n  subtokenize(events);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeContent(effects, ok) {\n  /** @type {Token | undefined} */\n  let previous;\n  return chunkStart;\n\n  /**\n   * Before a content chunk.\n   *\n   * ```markdown\n   * > | abc\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function chunkStart(code) {\n    effects.enter(\"content\");\n    previous = effects.enter(\"chunkContent\", {\n      contentType: \"content\"\n    });\n    return chunkInside(code);\n  }\n\n  /**\n   * In a content chunk.\n   *\n   * ```markdown\n   * > | abc\n   *     ^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function chunkInside(code) {\n    if (code === null) {\n      return contentEnd(code);\n    }\n\n    // To do: in `markdown-rs`, each line is parsed on its own, and everything\n    // is stitched together resolving.\n    if (markdownLineEnding(code)) {\n      return effects.check(continuationConstruct, contentContinue, contentEnd)(code);\n    }\n\n    // Data.\n    effects.consume(code);\n    return chunkInside;\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function contentEnd(code) {\n    effects.exit(\"chunkContent\");\n    effects.exit(\"content\");\n    return ok(code);\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function contentContinue(code) {\n    effects.consume(code);\n    effects.exit(\"chunkContent\");\n    previous.next = effects.enter(\"chunkContent\", {\n      contentType: \"content\",\n      previous\n    });\n    previous = previous.next;\n    return chunkInside;\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeContinuation(effects, ok, nok) {\n  const self = this;\n  return startLookahead;\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function startLookahead(code) {\n    effects.exit(\"chunkContent\");\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return factorySpace(effects, prefixed, \"linePrefix\");\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function prefixed(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return nok(code);\n    }\n\n    // Always populated by defaults.\n\n    const tail = self.events[self.events.length - 1];\n    if (!self.parser.constructs.disable.null.includes('codeIndented') && tail && tail[1].type === \"linePrefix\" && tail[2].sliceSerialize(tail[1], true).length >= 4) {\n      return ok(code);\n    }\n    return effects.interrupt(self.parser.constructs.flow, nok, ok)(code);\n  }\n}","/**\n * @import {\n *   InitialConstruct,\n *   Initializer,\n *   State,\n *   TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n  tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n *   Self.\n * @type {Initializer}\n *   Initializer.\n */\nfunction initializeFlow(effects) {\n  const self = this;\n  const initial = effects.attempt(\n  // Try to parse a blank line.\n  blankLine, atBlankEnding,\n  // Try to parse initial flow (essentially, only code).\n  effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n  return initial;\n\n  /** @type {State} */\n  function atBlankEnding(code) {\n    if (code === null) {\n      effects.consume(code);\n      return;\n    }\n    effects.enter(\"lineEndingBlank\");\n    effects.consume(code);\n    effects.exit(\"lineEndingBlank\");\n    self.currentConstruct = undefined;\n    return initial;\n  }\n\n  /** @type {State} */\n  function afterConstruct(code) {\n    if (code === null) {\n      effects.consume(code);\n      return;\n    }\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    self.currentConstruct = undefined;\n    return initial;\n  }\n}","/**\n * @import {\n *   Code,\n *   InitialConstruct,\n *   Initializer,\n *   Resolver,\n *   State,\n *   TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n  resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n *   Field.\n * @returns {InitialConstruct}\n *   Construct.\n */\nfunction initializeFactory(field) {\n  return {\n    resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n    tokenize: initializeText\n  };\n\n  /**\n   * @this {TokenizeContext}\n   *   Context.\n   * @type {Initializer}\n   */\n  function initializeText(effects) {\n    const self = this;\n    const constructs = this.parser.constructs[field];\n    const text = effects.attempt(constructs, start, notText);\n    return start;\n\n    /** @type {State} */\n    function start(code) {\n      return atBreak(code) ? text(code) : notText(code);\n    }\n\n    /** @type {State} */\n    function notText(code) {\n      if (code === null) {\n        effects.consume(code);\n        return;\n      }\n      effects.enter(\"data\");\n      effects.consume(code);\n      return data;\n    }\n\n    /** @type {State} */\n    function data(code) {\n      if (atBreak(code)) {\n        effects.exit(\"data\");\n        return text(code);\n      }\n\n      // Data.\n      effects.consume(code);\n      return data;\n    }\n\n    /**\n     * @param {Code} code\n     *   Code.\n     * @returns {boolean}\n     *   Whether the code is a break.\n     */\n    function atBreak(code) {\n      if (code === null) {\n        return true;\n      }\n      const list = constructs[code];\n      let index = -1;\n      if (list) {\n        // Always populated by defaults.\n\n        while (++index < list.length) {\n          const item = list[index];\n          if (!item.previous || item.previous.call(self, self.previous)) {\n            return true;\n          }\n        }\n      }\n      return false;\n    }\n  }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n *   Resolver.\n * @returns {Resolver}\n *   Resolver.\n */\nfunction createResolver(extraResolver) {\n  return resolveAllText;\n\n  /** @type {Resolver} */\n  function resolveAllText(events, context) {\n    let index = -1;\n    /** @type {number | undefined} */\n    let enter;\n\n    // A rather boring computation (to merge adjacent `data` events) which\n    // improves mm performance by 29%.\n    while (++index <= events.length) {\n      if (enter === undefined) {\n        if (events[index] && events[index][1].type === \"data\") {\n          enter = index;\n          index++;\n        }\n      } else if (!events[index] || events[index][1].type !== \"data\") {\n        // Don’t do anything if there is one data token.\n        if (index !== enter + 2) {\n          events[enter][1].end = events[index - 1][1].end;\n          events.splice(enter + 2, index - enter - 2);\n          index = enter + 2;\n        }\n        enter = undefined;\n      }\n    }\n    return extraResolver ? extraResolver(events, context) : events;\n  }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n  let eventIndex = 0; // Skip first.\n\n  while (++eventIndex <= events.length) {\n    if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n      const data = events[eventIndex - 1][1];\n      const chunks = context.sliceStream(data);\n      let index = chunks.length;\n      let bufferIndex = -1;\n      let size = 0;\n      /** @type {boolean | undefined} */\n      let tabs;\n      while (index--) {\n        const chunk = chunks[index];\n        if (typeof chunk === 'string') {\n          bufferIndex = chunk.length;\n          while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n            size++;\n            bufferIndex--;\n          }\n          if (bufferIndex) break;\n          bufferIndex = -1;\n        }\n        // Number\n        else if (chunk === -2) {\n          tabs = true;\n          size++;\n        } else if (chunk === -1) {\n          // Empty\n        } else {\n          // Replacement character, exit.\n          index++;\n          break;\n        }\n      }\n\n      // Allow final trailing whitespace.\n      if (context._contentTypeTextTrailing && eventIndex === events.length) {\n        size = 0;\n      }\n      if (size) {\n        const token = {\n          type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n          start: {\n            _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n            _index: data.start._index + index,\n            line: data.end.line,\n            column: data.end.column - size,\n            offset: data.end.offset - size\n          },\n          end: {\n            ...data.end\n          }\n        };\n        data.end = {\n          ...token.start\n        };\n        if (data.start.offset === data.end.offset) {\n          Object.assign(data, token);\n        } else {\n          events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n          eventIndex += 2;\n        }\n      }\n      eventIndex++;\n    }\n  }\n  return events;\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n  name: 'thematicBreak',\n  tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n  let size = 0;\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Start of thematic break.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"thematicBreak\");\n    // To do: parse indent like `markdown-rs`.\n    return before(code);\n  }\n\n  /**\n   * After optional whitespace, at marker.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    marker = code;\n    return atBreak(code);\n  }\n\n  /**\n   * After something, before something else.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === marker) {\n      effects.enter(\"thematicBreakSequence\");\n      return sequence(code);\n    }\n    if (size >= 3 && (code === null || markdownLineEnding(code))) {\n      effects.exit(\"thematicBreak\");\n      return ok(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In sequence.\n   *\n   * ```markdown\n   * > | ***\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequence(code) {\n    if (code === marker) {\n      effects.consume(code);\n      size++;\n      return sequence;\n    }\n    effects.exit(\"thematicBreakSequence\");\n    return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   Exiter,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n  continuation: {\n    tokenize: tokenizeListContinuation\n  },\n  exit: tokenizeListEnd,\n  name: 'list',\n  tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n  partial: true,\n  tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n  partial: true,\n  tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n  const self = this;\n  const tail = self.events[self.events.length - 1];\n  let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n  let size = 0;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n    if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n      if (!self.containerState.type) {\n        self.containerState.type = kind;\n        effects.enter(kind, {\n          _container: true\n        });\n      }\n      if (kind === \"listUnordered\") {\n        effects.enter(\"listItemPrefix\");\n        return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n      }\n      if (!self.interrupt || code === 49) {\n        effects.enter(\"listItemPrefix\");\n        effects.enter(\"listItemValue\");\n        return inside(code);\n      }\n    }\n    return nok(code);\n  }\n\n  /** @type {State} */\n  function inside(code) {\n    if (asciiDigit(code) && ++size < 10) {\n      effects.consume(code);\n      return inside;\n    }\n    if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n      effects.exit(\"listItemValue\");\n      return atMarker(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * @type {State}\n   **/\n  function atMarker(code) {\n    effects.enter(\"listItemMarker\");\n    effects.consume(code);\n    effects.exit(\"listItemMarker\");\n    self.containerState.marker = self.containerState.marker || code;\n    return effects.check(blankLine,\n    // Can’t be empty when interrupting.\n    self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n  }\n\n  /** @type {State} */\n  function onBlank(code) {\n    self.containerState.initialBlankLine = true;\n    initialSize++;\n    return endOfPrefix(code);\n  }\n\n  /** @type {State} */\n  function otherPrefix(code) {\n    if (markdownSpace(code)) {\n      effects.enter(\"listItemPrefixWhitespace\");\n      effects.consume(code);\n      effects.exit(\"listItemPrefixWhitespace\");\n      return endOfPrefix;\n    }\n    return nok(code);\n  }\n\n  /** @type {State} */\n  function endOfPrefix(code) {\n    self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n  const self = this;\n  self.containerState._closeFlow = undefined;\n  return effects.check(blankLine, onBlank, notBlank);\n\n  /** @type {State} */\n  function onBlank(code) {\n    self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n    // We have a blank line.\n    // Still, try to consume at most the items size.\n    return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n  }\n\n  /** @type {State} */\n  function notBlank(code) {\n    if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n      self.containerState.furtherBlankLines = undefined;\n      self.containerState.initialBlankLine = undefined;\n      return notInCurrentItem(code);\n    }\n    self.containerState.furtherBlankLines = undefined;\n    self.containerState.initialBlankLine = undefined;\n    return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n  }\n\n  /** @type {State} */\n  function notInCurrentItem(code) {\n    // While we do continue, we signal that the flow should be closed.\n    self.containerState._closeFlow = true;\n    // As we’re closing flow, we’re no longer interrupting.\n    self.interrupt = undefined;\n    // Always populated by defaults.\n\n    return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n  const self = this;\n  return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n  /** @type {State} */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n  effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n  const self = this;\n\n  // Always populated by defaults.\n\n  return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n  /** @type {State} */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Exiter,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const blockQuote = {\n  continuation: {\n    tokenize: tokenizeBlockQuoteContinuation\n  },\n  exit,\n  name: 'blockQuote',\n  tokenize: tokenizeBlockQuoteStart\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlockQuoteStart(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of block quote.\n   *\n   * ```markdown\n   * > | > a\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === 62) {\n      const state = self.containerState;\n      if (!state.open) {\n        effects.enter(\"blockQuote\", {\n          _container: true\n        });\n        state.open = true;\n      }\n      effects.enter(\"blockQuotePrefix\");\n      effects.enter(\"blockQuoteMarker\");\n      effects.consume(code);\n      effects.exit(\"blockQuoteMarker\");\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `>`, before optional whitespace.\n   *\n   * ```markdown\n   * > | > a\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    if (markdownSpace(code)) {\n      effects.enter(\"blockQuotePrefixWhitespace\");\n      effects.consume(code);\n      effects.exit(\"blockQuotePrefixWhitespace\");\n      effects.exit(\"blockQuotePrefix\");\n      return ok;\n    }\n    effects.exit(\"blockQuotePrefix\");\n    return ok(code);\n  }\n}\n\n/**\n * Start of block quote continuation.\n *\n * ```markdown\n *   | > a\n * > | > b\n *     ^\n * ```\n *\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlockQuoteContinuation(effects, ok, nok) {\n  const self = this;\n  return contStart;\n\n  /**\n   * Start of block quote continuation.\n   *\n   * Also used to parse the first block quote opening.\n   *\n   * ```markdown\n   *   | > a\n   * > | > b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function contStart(code) {\n    if (markdownSpace(code)) {\n      // Always populated by defaults.\n\n      return factorySpace(effects, contBefore, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n    }\n    return contBefore(code);\n  }\n\n  /**\n   * At `>`, after optional whitespace.\n   *\n   * Also used to parse the first block quote opening.\n   *\n   * ```markdown\n   *   | > a\n   * > | > b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function contBefore(code) {\n    return effects.attempt(blockQuote, ok, nok)(code);\n  }\n}\n\n/** @type {Exiter} */\nfunction exit(effects) {\n  effects.exit(\"blockQuote\");\n}","/**\n * @import {Effects, State, TokenType} from 'micromark-util-types'\n */\n\nimport { asciiControl, markdownLineEndingOrSpace, markdownLineEnding } from 'micromark-util-character';\n/**\n * Parse destinations.\n *\n * ###### Examples\n *\n * ```markdown\n * <a>\n * <a\\>b>\n * <a b>\n * <a)>\n * a\n * a\\)b\n * a(b)c\n * a(b)\n * ```\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {State} nok\n *   State switched to when unsuccessful.\n * @param {TokenType} type\n *   Type for whole (`<a>` or `b`).\n * @param {TokenType} literalType\n *   Type when enclosed (`<a>`).\n * @param {TokenType} literalMarkerType\n *   Type for enclosing (`<` and `>`).\n * @param {TokenType} rawType\n *   Type when not enclosed (`b`).\n * @param {TokenType} stringType\n *   Type for the value (`a` or `b`).\n * @param {number | undefined} [max=Infinity]\n *   Depth of nested parens (inclusive).\n * @returns {State}\n *   Start state.\n */\nexport function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) {\n  const limit = max || Number.POSITIVE_INFINITY;\n  let balance = 0;\n  return start;\n\n  /**\n   * Start of destination.\n   *\n   * ```markdown\n   * > | <aa>\n   *     ^\n   * > | aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === 60) {\n      effects.enter(type);\n      effects.enter(literalType);\n      effects.enter(literalMarkerType);\n      effects.consume(code);\n      effects.exit(literalMarkerType);\n      return enclosedBefore;\n    }\n\n    // ASCII control, space, closing paren.\n    if (code === null || code === 32 || code === 41 || asciiControl(code)) {\n      return nok(code);\n    }\n    effects.enter(type);\n    effects.enter(rawType);\n    effects.enter(stringType);\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return raw(code);\n  }\n\n  /**\n   * After `<`, at an enclosed destination.\n   *\n   * ```markdown\n   * > | <aa>\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function enclosedBefore(code) {\n    if (code === 62) {\n      effects.enter(literalMarkerType);\n      effects.consume(code);\n      effects.exit(literalMarkerType);\n      effects.exit(literalType);\n      effects.exit(type);\n      return ok;\n    }\n    effects.enter(stringType);\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return enclosed(code);\n  }\n\n  /**\n   * In enclosed destination.\n   *\n   * ```markdown\n   * > | <aa>\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function enclosed(code) {\n    if (code === 62) {\n      effects.exit(\"chunkString\");\n      effects.exit(stringType);\n      return enclosedBefore(code);\n    }\n    if (code === null || code === 60 || markdownLineEnding(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return code === 92 ? enclosedEscape : enclosed;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * ```markdown\n   * > | <a\\*a>\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function enclosedEscape(code) {\n    if (code === 60 || code === 62 || code === 92) {\n      effects.consume(code);\n      return enclosed;\n    }\n    return enclosed(code);\n  }\n\n  /**\n   * In raw destination.\n   *\n   * ```markdown\n   * > | aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function raw(code) {\n    if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) {\n      effects.exit(\"chunkString\");\n      effects.exit(stringType);\n      effects.exit(rawType);\n      effects.exit(type);\n      return ok(code);\n    }\n    if (balance < limit && code === 40) {\n      effects.consume(code);\n      balance++;\n      return raw;\n    }\n    if (code === 41) {\n      effects.consume(code);\n      balance--;\n      return raw;\n    }\n\n    // ASCII control (but *not* `\\0`) and space and `(`.\n    // Note: in `markdown-rs`, `\\0` exists in codes, in `micromark-js` it\n    // doesn’t.\n    if (code === null || code === 32 || code === 40 || asciiControl(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return code === 92 ? rawEscape : raw;\n  }\n\n  /**\n   * After `\\`, at special character.\n   *\n   * ```markdown\n   * > | a\\*a\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function rawEscape(code) {\n    if (code === 40 || code === 41 || code === 92) {\n      effects.consume(code);\n      return raw;\n    }\n    return raw(code);\n  }\n}","/**\n * @import {\n *   Effects,\n *   State,\n *   TokenizeContext,\n *   TokenType\n * } from 'micromark-util-types'\n */\n\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/**\n * Parse labels.\n *\n * > 👉 **Note**: labels in markdown are capped at 999 characters in the string.\n *\n * ###### Examples\n *\n * ```markdown\n * [a]\n * [a\n * b]\n * [a\\]b]\n * ```\n *\n * @this {TokenizeContext}\n *   Tokenize context.\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {State} nok\n *   State switched to when unsuccessful.\n * @param {TokenType} type\n *   Type of the whole label (`[a]`).\n * @param {TokenType} markerType\n *   Type for the markers (`[` and `]`).\n * @param {TokenType} stringType\n *   Type for the identifier (`a`).\n * @returns {State}\n *   Start state.\n */\nexport function factoryLabel(effects, ok, nok, type, markerType, stringType) {\n  const self = this;\n  let size = 0;\n  /** @type {boolean} */\n  let seen;\n  return start;\n\n  /**\n   * Start of label.\n   *\n   * ```markdown\n   * > | [a]\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(type);\n    effects.enter(markerType);\n    effects.consume(code);\n    effects.exit(markerType);\n    effects.enter(stringType);\n    return atBreak;\n  }\n\n  /**\n   * In label, at something, before something else.\n   *\n   * ```markdown\n   * > | [a]\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (size > 999 || code === null || code === 91 || code === 93 && !seen ||\n    // To do: remove in the future once we’ve switched from\n    // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,\n    // which doesn’t need this.\n    // Hidden footnotes hook.\n    /* c8 ignore next 3 */\n    code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) {\n      return nok(code);\n    }\n    if (code === 93) {\n      effects.exit(stringType);\n      effects.enter(markerType);\n      effects.consume(code);\n      effects.exit(markerType);\n      effects.exit(type);\n      return ok;\n    }\n\n    // To do: indent? Link chunks and EOLs together?\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return atBreak;\n    }\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return labelInside(code);\n  }\n\n  /**\n   * In label, in text.\n   *\n   * ```markdown\n   * > | [a]\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelInside(code) {\n    if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) {\n      effects.exit(\"chunkString\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    if (!seen) seen = !markdownSpace(code);\n    return code === 92 ? labelEscape : labelInside;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * ```markdown\n   * > | [a\\*a]\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEscape(code) {\n    if (code === 91 || code === 92 || code === 93) {\n      effects.consume(code);\n      size++;\n      return labelInside;\n    }\n    return labelInside(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Effects,\n *   State,\n *   TokenType\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/**\n * Parse titles.\n *\n * ###### Examples\n *\n * ```markdown\n * \"a\"\n * 'b'\n * (c)\n * \"a\n * b\"\n * 'a\n *     b'\n * (a\\)b)\n * ```\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @param {State} nok\n *   State switched to when unsuccessful.\n * @param {TokenType} type\n *   Type of the whole title (`\"a\"`, `'b'`, `(c)`).\n * @param {TokenType} markerType\n *   Type for the markers (`\"`, `'`, `(`, and `)`).\n * @param {TokenType} stringType\n *   Type for the value (`a`).\n * @returns {State}\n *   Start state.\n */\nexport function factoryTitle(effects, ok, nok, type, markerType, stringType) {\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Start of title.\n   *\n   * ```markdown\n   * > | \"a\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === 34 || code === 39 || code === 40) {\n      effects.enter(type);\n      effects.enter(markerType);\n      effects.consume(code);\n      effects.exit(markerType);\n      marker = code === 40 ? 41 : code;\n      return begin;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After opening marker.\n   *\n   * This is also used at the closing marker.\n   *\n   * ```markdown\n   * > | \"a\"\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function begin(code) {\n    if (code === marker) {\n      effects.enter(markerType);\n      effects.consume(code);\n      effects.exit(markerType);\n      effects.exit(type);\n      return ok;\n    }\n    effects.enter(stringType);\n    return atBreak(code);\n  }\n\n  /**\n   * At something, before something else.\n   *\n   * ```markdown\n   * > | \"a\"\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === marker) {\n      effects.exit(stringType);\n      return begin(marker);\n    }\n    if (code === null) {\n      return nok(code);\n    }\n\n    // Note: blank lines can’t exist in content.\n    if (markdownLineEnding(code)) {\n      // To do: use `space_or_tab_eol_with_options`, connect.\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return factorySpace(effects, atBreak, \"linePrefix\");\n    }\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return inside(code);\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === marker || code === null || markdownLineEnding(code)) {\n      effects.exit(\"chunkString\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    return code === 92 ? escape : inside;\n  }\n\n  /**\n   * After `\\`, at a special character.\n   *\n   * ```markdown\n   * > | \"a\\*b\"\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function escape(code) {\n    if (code === marker || code === 92) {\n      effects.consume(code);\n      return inside;\n    }\n    return inside(code);\n  }\n}","/**\n * @import {Effects, State} from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/**\n * Parse spaces and tabs.\n *\n * There is no `nok` parameter:\n *\n * *   line endings or spaces in markdown are often optional, in which case this\n *     factory can be used and `ok` will be switched to whether spaces were found\n *     or not\n * *   one line ending or space can be detected with\n *     `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace`\n *\n * @param {Effects} effects\n *   Context.\n * @param {State} ok\n *   State switched to when successful.\n * @returns {State}\n *   Start state.\n */\nexport function factoryWhitespace(effects, ok) {\n  /** @type {boolean} */\n  let seen;\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      seen = true;\n      return start;\n    }\n    if (markdownSpace(code)) {\n      return factorySpace(effects, start, seen ? \"linePrefix\" : \"lineSuffix\")(code);\n    }\n    return ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factorySpace } from 'micromark-factory-space';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\n/** @type {Construct} */\nexport const definition = {\n  name: 'definition',\n  tokenize: tokenizeDefinition\n};\n\n/** @type {Construct} */\nconst titleBefore = {\n  partial: true,\n  tokenize: tokenizeTitleBefore\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeDefinition(effects, ok, nok) {\n  const self = this;\n  /** @type {string} */\n  let identifier;\n  return start;\n\n  /**\n   * At start of a definition.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // Do not interrupt paragraphs (but do follow definitions).\n    // To do: do `interrupt` the way `markdown-rs` does.\n    // To do: parse whitespace the way `markdown-rs` does.\n    effects.enter(\"definition\");\n    return before(code);\n  }\n\n  /**\n   * After optional whitespace, at `[`.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    // To do: parse whitespace the way `markdown-rs` does.\n\n    return factoryLabel.call(self, effects, labelAfter,\n    // Note: we don’t need to reset the way `markdown-rs` does.\n    nok, \"definitionLabel\", \"definitionLabelMarker\", \"definitionLabelString\")(code);\n  }\n\n  /**\n   * After label.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelAfter(code) {\n    identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));\n    if (code === 58) {\n      effects.enter(\"definitionMarker\");\n      effects.consume(code);\n      effects.exit(\"definitionMarker\");\n      return markerAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After marker.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function markerAfter(code) {\n    // Note: whitespace is optional.\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code);\n  }\n\n  /**\n   * Before destination.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function destinationBefore(code) {\n    return factoryDestination(effects, destinationAfter,\n    // Note: we don’t need to reset the way `markdown-rs` does.\n    nok, \"definitionDestination\", \"definitionDestinationLiteral\", \"definitionDestinationLiteralMarker\", \"definitionDestinationRaw\", \"definitionDestinationString\")(code);\n  }\n\n  /**\n   * After destination.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function destinationAfter(code) {\n    return effects.attempt(titleBefore, after, after)(code);\n  }\n\n  /**\n   * After definition.\n   *\n   * ```markdown\n   * > | [a]: b\n   *           ^\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    return markdownSpace(code) ? factorySpace(effects, afterWhitespace, \"whitespace\")(code) : afterWhitespace(code);\n  }\n\n  /**\n   * After definition, after optional whitespace.\n   *\n   * ```markdown\n   * > | [a]: b\n   *           ^\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterWhitespace(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"definition\");\n\n      // Note: we don’t care about uniqueness.\n      // It’s likely that that doesn’t happen very frequently.\n      // It is more likely that it wastes precious time.\n      self.parser.defined.push(identifier);\n\n      // To do: `markdown-rs` interrupt.\n      // // You’d be interrupting.\n      // tokenizer.interrupt = true\n      return ok(code);\n    }\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeTitleBefore(effects, ok, nok) {\n  return titleBefore;\n\n  /**\n   * After destination, at whitespace.\n   *\n   * ```markdown\n   * > | [a]: b\n   *           ^\n   * > | [a]: b \"c\"\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function titleBefore(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code);\n  }\n\n  /**\n   * At title.\n   *\n   * ```markdown\n   *   | [a]: b\n   * > | \"c\"\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function beforeMarker(code) {\n    return factoryTitle(effects, titleAfter, nok, \"definitionTitle\", \"definitionTitleMarker\", \"definitionTitleString\")(code);\n  }\n\n  /**\n   * After title.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function titleAfter(code) {\n    return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, \"whitespace\")(code) : titleAfterOptionalWhitespace(code);\n  }\n\n  /**\n   * After title, after optional whitespace.\n   *\n   * ```markdown\n   * > | [a]: b \"c\"\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function titleAfterOptionalWhitespace(code) {\n    return code === null || markdownLineEnding(code) ? ok(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const codeIndented = {\n  name: 'codeIndented',\n  tokenize: tokenizeCodeIndented\n};\n\n/** @type {Construct} */\nconst furtherStart = {\n  partial: true,\n  tokenize: tokenizeFurtherStart\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeIndented(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of code (indented).\n   *\n   * > **Parsing note**: it is not needed to check if this first line is a\n   * > filled line (that it has a non-whitespace character), because blank lines\n   * > are parsed already, so we never run into that.\n   *\n   * ```markdown\n   * > |     aaa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: manually check if interrupting like `markdown-rs`.\n\n    effects.enter(\"codeIndented\");\n    // To do: use an improved `space_or_tab` function like `markdown-rs`,\n    // so that we can drop the next state.\n    return factorySpace(effects, afterPrefix, \"linePrefix\", 4 + 1)(code);\n  }\n\n  /**\n   * At start, after 1 or 4 spaces.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === \"linePrefix\" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code);\n  }\n\n  /**\n   * At a break.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^  ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === null) {\n      return after(code);\n    }\n    if (markdownLineEnding(code)) {\n      return effects.attempt(furtherStart, atBreak, after)(code);\n    }\n    effects.enter(\"codeFlowValue\");\n    return inside(code);\n  }\n\n  /**\n   * In code content.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"codeFlowValue\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    return inside;\n  }\n\n  /** @type {State} */\n  function after(code) {\n    effects.exit(\"codeIndented\");\n    // To do: allow interrupting like `markdown-rs`.\n    // Feel free to interrupt.\n    // tokenizer.interrupt = false\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeFurtherStart(effects, ok, nok) {\n  const self = this;\n  return furtherStart;\n\n  /**\n   * At eol, trying to parse another indent.\n   *\n   * ```markdown\n   * > |     aaa\n   *            ^\n   *   |     bbb\n   * ```\n   *\n   * @type {State}\n   */\n  function furtherStart(code) {\n    // To do: improve `lazy` / `pierce` handling.\n    // If this is a lazy line, it can’t be code.\n    if (self.parser.lazy[self.now().line]) {\n      return nok(code);\n    }\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return furtherStart;\n    }\n\n    // To do: the code here in `micromark-js` is a bit different from\n    // `markdown-rs` because there it can attempt spaces.\n    // We can’t yet.\n    //\n    // To do: use an improved `space_or_tab` function like `markdown-rs`,\n    // so that we can drop the next state.\n    return factorySpace(effects, afterPrefix, \"linePrefix\", 4 + 1)(code);\n  }\n\n  /**\n   * At start, after 1 or 4 spaces.\n   *\n   * ```markdown\n   * > |     aaa\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function afterPrefix(code) {\n    const tail = self.events[self.events.length - 1];\n    return tail && tail[1].type === \"linePrefix\" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\nimport { splice } from 'micromark-util-chunked';\n/** @type {Construct} */\nexport const headingAtx = {\n  name: 'headingAtx',\n  resolve: resolveHeadingAtx,\n  tokenize: tokenizeHeadingAtx\n};\n\n/** @type {Resolver} */\nfunction resolveHeadingAtx(events, context) {\n  let contentEnd = events.length - 2;\n  let contentStart = 3;\n  /** @type {Token} */\n  let content;\n  /** @type {Token} */\n  let text;\n\n  // Prefix whitespace, part of the opening.\n  if (events[contentStart][1].type === \"whitespace\") {\n    contentStart += 2;\n  }\n\n  // Suffix whitespace, part of the closing.\n  if (contentEnd - 2 > contentStart && events[contentEnd][1].type === \"whitespace\") {\n    contentEnd -= 2;\n  }\n  if (events[contentEnd][1].type === \"atxHeadingSequence\" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === \"whitespace\")) {\n    contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;\n  }\n  if (contentEnd > contentStart) {\n    content = {\n      type: \"atxHeadingText\",\n      start: events[contentStart][1].start,\n      end: events[contentEnd][1].end\n    };\n    text = {\n      type: \"chunkText\",\n      start: events[contentStart][1].start,\n      end: events[contentEnd][1].end,\n      contentType: \"text\"\n    };\n    splice(events, contentStart, contentEnd - contentStart + 1, [['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context]]);\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHeadingAtx(effects, ok, nok) {\n  let size = 0;\n  return start;\n\n  /**\n   * Start of a heading (atx).\n   *\n   * ```markdown\n   * > | ## aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: parse indent like `markdown-rs`.\n    effects.enter(\"atxHeading\");\n    return before(code);\n  }\n\n  /**\n   * After optional whitespace, at `#`.\n   *\n   * ```markdown\n   * > | ## aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    effects.enter(\"atxHeadingSequence\");\n    return sequenceOpen(code);\n  }\n\n  /**\n   * In opening sequence.\n   *\n   * ```markdown\n   * > | ## aa\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceOpen(code) {\n    if (code === 35 && size++ < 6) {\n      effects.consume(code);\n      return sequenceOpen;\n    }\n\n    // Always at least one `#`.\n    if (code === null || markdownLineEndingOrSpace(code)) {\n      effects.exit(\"atxHeadingSequence\");\n      return atBreak(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * After something, before something else.\n   *\n   * ```markdown\n   * > | ## aa\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function atBreak(code) {\n    if (code === 35) {\n      effects.enter(\"atxHeadingSequence\");\n      return sequenceFurther(code);\n    }\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"atxHeading\");\n      // To do: interrupt like `markdown-rs`.\n      // // Feel free to interrupt.\n      // tokenizer.interrupt = false\n      return ok(code);\n    }\n    if (markdownSpace(code)) {\n      return factorySpace(effects, atBreak, \"whitespace\")(code);\n    }\n\n    // To do: generate `data` tokens, add the `text` token later.\n    // Needs edit map, see: `markdown.rs`.\n    effects.enter(\"atxHeadingText\");\n    return data(code);\n  }\n\n  /**\n   * In further sequence (after whitespace).\n   *\n   * Could be normal “visible” hashes in the heading or a final sequence.\n   *\n   * ```markdown\n   * > | ## aa ##\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceFurther(code) {\n    if (code === 35) {\n      effects.consume(code);\n      return sequenceFurther;\n    }\n    effects.exit(\"atxHeadingSequence\");\n    return atBreak(code);\n  }\n\n  /**\n   * In text.\n   *\n   * ```markdown\n   * > | ## aa\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function data(code) {\n    if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {\n      effects.exit(\"atxHeadingText\");\n      return atBreak(code);\n    }\n    effects.consume(code);\n    return data;\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n  name: 'setextUnderline',\n  resolveTo: resolveToSetextUnderline,\n  tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n  // To do: resolve like `markdown-rs`.\n  let index = events.length;\n  /** @type {number | undefined} */\n  let content;\n  /** @type {number | undefined} */\n  let text;\n  /** @type {number | undefined} */\n  let definition;\n\n  // Find the opening of the content.\n  // It’ll always exist: we don’t tokenize if it isn’t there.\n  while (index--) {\n    if (events[index][0] === 'enter') {\n      if (events[index][1].type === \"content\") {\n        content = index;\n        break;\n      }\n      if (events[index][1].type === \"paragraph\") {\n        text = index;\n      }\n    }\n    // Exit\n    else {\n      if (events[index][1].type === \"content\") {\n        // Remove the content end (if needed we’ll add it later)\n        events.splice(index, 1);\n      }\n      if (!definition && events[index][1].type === \"definition\") {\n        definition = index;\n      }\n    }\n  }\n  const heading = {\n    type: \"setextHeading\",\n    start: {\n      ...events[content][1].start\n    },\n    end: {\n      ...events[events.length - 1][1].end\n    }\n  };\n\n  // Change the paragraph to setext heading text.\n  events[text][1].type = \"setextHeadingText\";\n\n  // If we have definitions in the content, we’ll keep on having content,\n  // but we need move it.\n  if (definition) {\n    events.splice(text, 0, ['enter', heading, context]);\n    events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n    events[content][1].end = {\n      ...events[definition][1].end\n    };\n  } else {\n    events[content][1] = heading;\n  }\n\n  // Add the heading exit at the end.\n  events.push(['exit', heading, context]);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n  const self = this;\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * At start of heading (setext) underline.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    let index = self.events.length;\n    /** @type {boolean | undefined} */\n    let paragraph;\n    // Find an opening.\n    while (index--) {\n      // Skip enter/exit of line ending, line prefix, and content.\n      // We can now either have a definition or a paragraph.\n      if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n        paragraph = self.events[index][1].type === \"paragraph\";\n        break;\n      }\n    }\n\n    // To do: handle lazy/pierce like `markdown-rs`.\n    // To do: parse indent like `markdown-rs`.\n    if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n      effects.enter(\"setextHeadingLine\");\n      marker = code;\n      return before(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * After optional whitespace, at `-` or `=`.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    effects.enter(\"setextHeadingLineSequence\");\n    return inside(code);\n  }\n\n  /**\n   * In sequence.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === marker) {\n      effects.consume(code);\n      return inside;\n    }\n    effects.exit(\"setextHeadingLineSequence\");\n    return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n  }\n\n  /**\n   * After sequence, after optional whitespace.\n   *\n   * ```markdown\n   *   | aa\n   * > | ==\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"setextHeadingLine\");\n      return ok(code);\n    }\n    return nok(code);\n  }\n}","/**\n * List of lowercase HTML “block” tag names.\n *\n * The list, when parsing HTML (flow), results in more relaxed rules (condition\n * 6).\n * Because they are known blocks, the HTML-like syntax doesn’t have to be\n * strictly parsed.\n * For tag names not in this list, a more strict algorithm (condition 7) is used\n * to detect whether the HTML-like syntax is seen as HTML (flow) or not.\n *\n * This is copied from:\n * <https://spec.commonmark.org/0.30/#html-blocks>.\n *\n * > 👉 **Note**: `search` was added in `CommonMark@0.31`.\n */\nexport const htmlBlockNames = [\n  'address',\n  'article',\n  'aside',\n  'base',\n  'basefont',\n  'blockquote',\n  'body',\n  'caption',\n  'center',\n  'col',\n  'colgroup',\n  'dd',\n  'details',\n  'dialog',\n  'dir',\n  'div',\n  'dl',\n  'dt',\n  'fieldset',\n  'figcaption',\n  'figure',\n  'footer',\n  'form',\n  'frame',\n  'frameset',\n  'h1',\n  'h2',\n  'h3',\n  'h4',\n  'h5',\n  'h6',\n  'head',\n  'header',\n  'hr',\n  'html',\n  'iframe',\n  'legend',\n  'li',\n  'link',\n  'main',\n  'menu',\n  'menuitem',\n  'nav',\n  'noframes',\n  'ol',\n  'optgroup',\n  'option',\n  'p',\n  'param',\n  'search',\n  'section',\n  'summary',\n  'table',\n  'tbody',\n  'td',\n  'tfoot',\n  'th',\n  'thead',\n  'title',\n  'tr',\n  'track',\n  'ul'\n]\n\n/**\n * List of lowercase HTML “raw” tag names.\n *\n * The list, when parsing HTML (flow), results in HTML that can include lines\n * without exiting, until a closing tag also in this list is found (condition\n * 1).\n *\n * This module is copied from:\n * <https://spec.commonmark.org/0.30/#html-blocks>.\n *\n * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.\n */\nexport const htmlRawNames = ['pre', 'script', 'style', 'textarea']\n","/**\n * @import {\n *   Code,\n *   Construct,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\nimport { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name';\nimport { blankLine } from './blank-line.js';\n\n/** @type {Construct} */\nexport const htmlFlow = {\n  concrete: true,\n  name: 'htmlFlow',\n  resolveTo: resolveToHtmlFlow,\n  tokenize: tokenizeHtmlFlow\n};\n\n/** @type {Construct} */\nconst blankLineBefore = {\n  partial: true,\n  tokenize: tokenizeBlankLineBefore\n};\nconst nonLazyContinuationStart = {\n  partial: true,\n  tokenize: tokenizeNonLazyContinuationStart\n};\n\n/** @type {Resolver} */\nfunction resolveToHtmlFlow(events) {\n  let index = events.length;\n  while (index--) {\n    if (events[index][0] === 'enter' && events[index][1].type === \"htmlFlow\") {\n      break;\n    }\n  }\n  if (index > 1 && events[index - 2][1].type === \"linePrefix\") {\n    // Add the prefix start to the HTML token.\n    events[index][1].start = events[index - 2][1].start;\n    // Add the prefix start to the HTML line token.\n    events[index + 1][1].start = events[index - 2][1].start;\n    // Remove the line prefix.\n    events.splice(index - 2, 2);\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlFlow(effects, ok, nok) {\n  const self = this;\n  /** @type {number} */\n  let marker;\n  /** @type {boolean} */\n  let closingTag;\n  /** @type {string} */\n  let buffer;\n  /** @type {number} */\n  let index;\n  /** @type {Code} */\n  let markerB;\n  return start;\n\n  /**\n   * Start of HTML (flow).\n   *\n   * ```markdown\n   * > | <x />\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: parse indent like `markdown-rs`.\n    return before(code);\n  }\n\n  /**\n   * At `<`, after optional whitespace.\n   *\n   * ```markdown\n   * > | <x />\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function before(code) {\n    effects.enter(\"htmlFlow\");\n    effects.enter(\"htmlFlowData\");\n    effects.consume(code);\n    return open;\n  }\n\n  /**\n   * After `<`, at tag name or other stuff.\n   *\n   * ```markdown\n   * > | <x />\n   *      ^\n   * > | <!doctype>\n   *      ^\n   * > | <!--xxx-->\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 33) {\n      effects.consume(code);\n      return declarationOpen;\n    }\n    if (code === 47) {\n      effects.consume(code);\n      closingTag = true;\n      return tagCloseStart;\n    }\n    if (code === 63) {\n      effects.consume(code);\n      marker = 3;\n      // To do:\n      // tokenizer.concrete = true\n      // To do: use `markdown-rs` style interrupt.\n      // While we’re in an instruction instead of a declaration, we’re on a `?`\n      // right now, so we do need to search for `>`, similar to declarations.\n      return self.interrupt ? ok : continuationDeclarationInside;\n    }\n\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      // Always the case.\n      effects.consume(code);\n      buffer = String.fromCharCode(code);\n      return tagName;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<!`, at declaration, comment, or CDATA.\n   *\n   * ```markdown\n   * > | <!doctype>\n   *       ^\n   * > | <!--xxx-->\n   *       ^\n   * > | <![CDATA[>&<]]>\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function declarationOpen(code) {\n    if (code === 45) {\n      effects.consume(code);\n      marker = 2;\n      return commentOpenInside;\n    }\n    if (code === 91) {\n      effects.consume(code);\n      marker = 5;\n      index = 0;\n      return cdataOpenInside;\n    }\n\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      marker = 4;\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return self.interrupt ? ok : continuationDeclarationInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<!-`, inside a comment, at another `-`.\n   *\n   * ```markdown\n   * > | <!--xxx-->\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentOpenInside(code) {\n    if (code === 45) {\n      effects.consume(code);\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return self.interrupt ? ok : continuationDeclarationInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<![`, inside CDATA, expecting `CDATA[`.\n   *\n   * ```markdown\n   * > | <![CDATA[>&<]]>\n   *        ^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataOpenInside(code) {\n    const value = \"CDATA[\";\n    if (code === value.charCodeAt(index++)) {\n      effects.consume(code);\n      if (index === value.length) {\n        // // Do not form containers.\n        // tokenizer.concrete = true\n        return self.interrupt ? ok : continuation;\n      }\n      return cdataOpenInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `</`, in closing tag, at tag name.\n   *\n   * ```markdown\n   * > | </x>\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagCloseStart(code) {\n    if (asciiAlpha(code)) {\n      // Always the case.\n      effects.consume(code);\n      buffer = String.fromCharCode(code);\n      return tagName;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In tag name.\n   *\n   * ```markdown\n   * > | <ab>\n   *      ^^\n   * > | </ab>\n   *       ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagName(code) {\n    if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      const slash = code === 47;\n      const name = buffer.toLowerCase();\n      if (!slash && !closingTag && htmlRawNames.includes(name)) {\n        marker = 1;\n        // // Do not form containers.\n        // tokenizer.concrete = true\n        return self.interrupt ? ok(code) : continuation(code);\n      }\n      if (htmlBlockNames.includes(buffer.toLowerCase())) {\n        marker = 6;\n        if (slash) {\n          effects.consume(code);\n          return basicSelfClosing;\n        }\n\n        // // Do not form containers.\n        // tokenizer.concrete = true\n        return self.interrupt ? ok(code) : continuation(code);\n      }\n      marker = 7;\n      // Do not support complete HTML when interrupting.\n      return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code);\n    }\n\n    // ASCII alphanumerical and `-`.\n    if (code === 45 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      buffer += String.fromCharCode(code);\n      return tagName;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After closing slash of a basic tag name.\n   *\n   * ```markdown\n   * > | <div/>\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function basicSelfClosing(code) {\n    if (code === 62) {\n      effects.consume(code);\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return self.interrupt ? ok : continuation;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After closing slash of a complete tag name.\n   *\n   * ```markdown\n   * > | <x/>\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeClosingTagAfter(code) {\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeClosingTagAfter;\n    }\n    return completeEnd(code);\n  }\n\n  /**\n   * At an attribute name.\n   *\n   * At first, this state is used after a complete tag name, after whitespace,\n   * where it expects optional attributes or the end of the tag.\n   * It is also reused after attributes, when expecting more optional\n   * attributes.\n   *\n   * ```markdown\n   * > | <a />\n   *        ^\n   * > | <a :b>\n   *        ^\n   * > | <a _b>\n   *        ^\n   * > | <a b>\n   *        ^\n   * > | <a >\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeNameBefore(code) {\n    if (code === 47) {\n      effects.consume(code);\n      return completeEnd;\n    }\n\n    // ASCII alphanumerical and `:` and `_`.\n    if (code === 58 || code === 95 || asciiAlpha(code)) {\n      effects.consume(code);\n      return completeAttributeName;\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAttributeNameBefore;\n    }\n    return completeEnd(code);\n  }\n\n  /**\n   * In attribute name.\n   *\n   * ```markdown\n   * > | <a :b>\n   *         ^\n   * > | <a _b>\n   *         ^\n   * > | <a b>\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeName(code) {\n    // ASCII alphanumerical and `-`, `.`, `:`, and `_`.\n    if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return completeAttributeName;\n    }\n    return completeAttributeNameAfter(code);\n  }\n\n  /**\n   * After attribute name, at an optional initializer, the end of the tag, or\n   * whitespace.\n   *\n   * ```markdown\n   * > | <a b>\n   *         ^\n   * > | <a b=c>\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeNameAfter(code) {\n    if (code === 61) {\n      effects.consume(code);\n      return completeAttributeValueBefore;\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAttributeNameAfter;\n    }\n    return completeAttributeNameBefore(code);\n  }\n\n  /**\n   * Before unquoted, double quoted, or single quoted attribute value, allowing\n   * whitespace.\n   *\n   * ```markdown\n   * > | <a b=c>\n   *          ^\n   * > | <a b=\"c\">\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueBefore(code) {\n    if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n      return nok(code);\n    }\n    if (code === 34 || code === 39) {\n      effects.consume(code);\n      markerB = code;\n      return completeAttributeValueQuoted;\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAttributeValueBefore;\n    }\n    return completeAttributeValueUnquoted(code);\n  }\n\n  /**\n   * In double or single quoted attribute value.\n   *\n   * ```markdown\n   * > | <a b=\"c\">\n   *           ^\n   * > | <a b='c'>\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueQuoted(code) {\n    if (code === markerB) {\n      effects.consume(code);\n      markerB = null;\n      return completeAttributeValueQuotedAfter;\n    }\n    if (code === null || markdownLineEnding(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return completeAttributeValueQuoted;\n  }\n\n  /**\n   * In unquoted attribute value.\n   *\n   * ```markdown\n   * > | <a b=c>\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueUnquoted(code) {\n    if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) {\n      return completeAttributeNameAfter(code);\n    }\n    effects.consume(code);\n    return completeAttributeValueUnquoted;\n  }\n\n  /**\n   * After double or single quoted attribute value, before whitespace or the\n   * end of the tag.\n   *\n   * ```markdown\n   * > | <a b=\"c\">\n   *            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAttributeValueQuotedAfter(code) {\n    if (code === 47 || code === 62 || markdownSpace(code)) {\n      return completeAttributeNameBefore(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In certain circumstances of a complete tag where only an `>` is allowed.\n   *\n   * ```markdown\n   * > | <a b=\"c\">\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeEnd(code) {\n    if (code === 62) {\n      effects.consume(code);\n      return completeAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `>` in a complete tag.\n   *\n   * ```markdown\n   * > | <x>\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function completeAfter(code) {\n    if (code === null || markdownLineEnding(code)) {\n      // // Do not form containers.\n      // tokenizer.concrete = true\n      return continuation(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return completeAfter;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In continuation of any HTML kind.\n   *\n   * ```markdown\n   * > | <!--xxx-->\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuation(code) {\n    if (code === 45 && marker === 2) {\n      effects.consume(code);\n      return continuationCommentInside;\n    }\n    if (code === 60 && marker === 1) {\n      effects.consume(code);\n      return continuationRawTagOpen;\n    }\n    if (code === 62 && marker === 4) {\n      effects.consume(code);\n      return continuationClose;\n    }\n    if (code === 63 && marker === 3) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    if (code === 93 && marker === 5) {\n      effects.consume(code);\n      return continuationCdataInside;\n    }\n    if (markdownLineEnding(code) && (marker === 6 || marker === 7)) {\n      effects.exit(\"htmlFlowData\");\n      return effects.check(blankLineBefore, continuationAfter, continuationStart)(code);\n    }\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"htmlFlowData\");\n      return continuationStart(code);\n    }\n    effects.consume(code);\n    return continuation;\n  }\n\n  /**\n   * In continuation, at eol.\n   *\n   * ```markdown\n   * > | <x>\n   *        ^\n   *   | asd\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationStart(code) {\n    return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);\n  }\n\n  /**\n   * In continuation, at eol, before non-lazy content.\n   *\n   * ```markdown\n   * > | <x>\n   *        ^\n   *   | asd\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationStartNonLazy(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return continuationBefore;\n  }\n\n  /**\n   * In continuation, before non-lazy content.\n   *\n   * ```markdown\n   *   | <x>\n   * > | asd\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationBefore(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return continuationStart(code);\n    }\n    effects.enter(\"htmlFlowData\");\n    return continuation(code);\n  }\n\n  /**\n   * In comment continuation, after one `-`, expecting another.\n   *\n   * ```markdown\n   * > | <!--xxx-->\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationCommentInside(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In raw continuation, after `<`, at `/`.\n   *\n   * ```markdown\n   * > | <script>console.log(1)</script>\n   *                            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationRawTagOpen(code) {\n    if (code === 47) {\n      effects.consume(code);\n      buffer = '';\n      return continuationRawEndTag;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In raw continuation, after `</`, in a raw tag name.\n   *\n   * ```markdown\n   * > | <script>console.log(1)</script>\n   *                             ^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationRawEndTag(code) {\n    if (code === 62) {\n      const name = buffer.toLowerCase();\n      if (htmlRawNames.includes(name)) {\n        effects.consume(code);\n        return continuationClose;\n      }\n      return continuation(code);\n    }\n    if (asciiAlpha(code) && buffer.length < 8) {\n      // Always the case.\n      effects.consume(code);\n      buffer += String.fromCharCode(code);\n      return continuationRawEndTag;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In cdata continuation, after `]`, expecting `]>`.\n   *\n   * ```markdown\n   * > | <![CDATA[>&<]]>\n   *                  ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationCdataInside(code) {\n    if (code === 93) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In declaration or instruction continuation, at `>`.\n   *\n   * ```markdown\n   * > | <!-->\n   *         ^\n   * > | <?>\n   *       ^\n   * > | <!q>\n   *        ^\n   * > | <!--ab-->\n   *             ^\n   * > | <![CDATA[>&<]]>\n   *                   ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationDeclarationInside(code) {\n    if (code === 62) {\n      effects.consume(code);\n      return continuationClose;\n    }\n\n    // More dashes.\n    if (code === 45 && marker === 2) {\n      effects.consume(code);\n      return continuationDeclarationInside;\n    }\n    return continuation(code);\n  }\n\n  /**\n   * In closed continuation: everything we get until the eol/eof is part of it.\n   *\n   * ```markdown\n   * > | <!doctype>\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationClose(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"htmlFlowData\");\n      return continuationAfter(code);\n    }\n    effects.consume(code);\n    return continuationClose;\n  }\n\n  /**\n   * Done.\n   *\n   * ```markdown\n   * > | <!doctype>\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function continuationAfter(code) {\n    effects.exit(\"htmlFlow\");\n    // // Feel free to interrupt.\n    // tokenizer.interrupt = false\n    // // No longer concrete.\n    // tokenizer.concrete = false\n    return ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * At eol, before continuation.\n   *\n   * ```markdown\n   * > | * ```js\n   *            ^\n   *   | b\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * A continuation.\n   *\n   * ```markdown\n   *   | * ```js\n   * > | b\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n  return start;\n\n  /**\n   * Before eol, expecting blank line.\n   *\n   * ```markdown\n   * > | <div>\n   *          ^\n   *   |\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return effects.attempt(blankLine, ok, nok);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nconst nonLazyContinuation = {\n  partial: true,\n  tokenize: tokenizeNonLazyContinuation\n};\n\n/** @type {Construct} */\nexport const codeFenced = {\n  concrete: true,\n  name: 'codeFenced',\n  tokenize: tokenizeCodeFenced\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeFenced(effects, ok, nok) {\n  const self = this;\n  /** @type {Construct} */\n  const closeStart = {\n    partial: true,\n    tokenize: tokenizeCloseStart\n  };\n  let initialPrefix = 0;\n  let sizeOpen = 0;\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Start of code.\n   *\n   * ```markdown\n   * > | ~~~js\n   *     ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // To do: parse whitespace like `markdown-rs`.\n    return beforeSequenceOpen(code);\n  }\n\n  /**\n   * In opening fence, after prefix, at sequence.\n   *\n   * ```markdown\n   * > | ~~~js\n   *     ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function beforeSequenceOpen(code) {\n    const tail = self.events[self.events.length - 1];\n    initialPrefix = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n    marker = code;\n    effects.enter(\"codeFenced\");\n    effects.enter(\"codeFencedFence\");\n    effects.enter(\"codeFencedFenceSequence\");\n    return sequenceOpen(code);\n  }\n\n  /**\n   * In opening fence sequence.\n   *\n   * ```markdown\n   * > | ~~~js\n   *      ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceOpen(code) {\n    if (code === marker) {\n      sizeOpen++;\n      effects.consume(code);\n      return sequenceOpen;\n    }\n    if (sizeOpen < 3) {\n      return nok(code);\n    }\n    effects.exit(\"codeFencedFenceSequence\");\n    return markdownSpace(code) ? factorySpace(effects, infoBefore, \"whitespace\")(code) : infoBefore(code);\n  }\n\n  /**\n   * In opening fence, after the sequence (and optional whitespace), before info.\n   *\n   * ```markdown\n   * > | ~~~js\n   *        ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function infoBefore(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"codeFencedFence\");\n      return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code);\n    }\n    effects.enter(\"codeFencedFenceInfo\");\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return info(code);\n  }\n\n  /**\n   * In info.\n   *\n   * ```markdown\n   * > | ~~~js\n   *        ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function info(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"chunkString\");\n      effects.exit(\"codeFencedFenceInfo\");\n      return infoBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.exit(\"chunkString\");\n      effects.exit(\"codeFencedFenceInfo\");\n      return factorySpace(effects, metaBefore, \"whitespace\")(code);\n    }\n    if (code === 96 && code === marker) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return info;\n  }\n\n  /**\n   * In opening fence, after info and whitespace, before meta.\n   *\n   * ```markdown\n   * > | ~~~js eval\n   *           ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function metaBefore(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return infoBefore(code);\n    }\n    effects.enter(\"codeFencedFenceMeta\");\n    effects.enter(\"chunkString\", {\n      contentType: \"string\"\n    });\n    return meta(code);\n  }\n\n  /**\n   * In meta.\n   *\n   * ```markdown\n   * > | ~~~js eval\n   *           ^\n   *   | alert(1)\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function meta(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"chunkString\");\n      effects.exit(\"codeFencedFenceMeta\");\n      return infoBefore(code);\n    }\n    if (code === 96 && code === marker) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return meta;\n  }\n\n  /**\n   * At eol/eof in code, before a non-lazy closing fence or content.\n   *\n   * ```markdown\n   * > | ~~~js\n   *          ^\n   * > | alert(1)\n   *             ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function atNonLazyBreak(code) {\n    return effects.attempt(closeStart, after, contentBefore)(code);\n  }\n\n  /**\n   * Before code content, not a closing fence, at eol.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *             ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function contentBefore(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return contentStart;\n  }\n\n  /**\n   * Before code content, not a closing fence.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *     ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function contentStart(code) {\n    return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, \"linePrefix\", initialPrefix + 1)(code) : beforeContentChunk(code);\n  }\n\n  /**\n   * Before code content, after optional prefix.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *     ^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function beforeContentChunk(code) {\n    if (code === null || markdownLineEnding(code)) {\n      return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code);\n    }\n    effects.enter(\"codeFlowValue\");\n    return contentChunk(code);\n  }\n\n  /**\n   * In code content.\n   *\n   * ```markdown\n   *   | ~~~js\n   * > | alert(1)\n   *     ^^^^^^^^\n   *   | ~~~\n   * ```\n   *\n   * @type {State}\n   */\n  function contentChunk(code) {\n    if (code === null || markdownLineEnding(code)) {\n      effects.exit(\"codeFlowValue\");\n      return beforeContentChunk(code);\n    }\n    effects.consume(code);\n    return contentChunk;\n  }\n\n  /**\n   * After code.\n   *\n   * ```markdown\n   *   | ~~~js\n   *   | alert(1)\n   * > | ~~~\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    effects.exit(\"codeFenced\");\n    return ok(code);\n  }\n\n  /**\n   * @this {TokenizeContext}\n   *   Context.\n   * @type {Tokenizer}\n   */\n  function tokenizeCloseStart(effects, ok, nok) {\n    let size = 0;\n    return startBefore;\n\n    /**\n     *\n     *\n     * @type {State}\n     */\n    function startBefore(code) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return start;\n    }\n\n    /**\n     * Before closing fence, at optional whitespace.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *     ^\n     * ```\n     *\n     * @type {State}\n     */\n    function start(code) {\n      // Always populated by defaults.\n\n      // To do: `enter` here or in next state?\n      effects.enter(\"codeFencedFence\");\n      return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : beforeSequenceClose(code);\n    }\n\n    /**\n     * In closing fence, after optional whitespace, at sequence.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *     ^\n     * ```\n     *\n     * @type {State}\n     */\n    function beforeSequenceClose(code) {\n      if (code === marker) {\n        effects.enter(\"codeFencedFenceSequence\");\n        return sequenceClose(code);\n      }\n      return nok(code);\n    }\n\n    /**\n     * In closing fence sequence.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *     ^\n     * ```\n     *\n     * @type {State}\n     */\n    function sequenceClose(code) {\n      if (code === marker) {\n        size++;\n        effects.consume(code);\n        return sequenceClose;\n      }\n      if (size >= sizeOpen) {\n        effects.exit(\"codeFencedFenceSequence\");\n        return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, \"whitespace\")(code) : sequenceCloseAfter(code);\n      }\n      return nok(code);\n    }\n\n    /**\n     * After closing fence sequence, after optional whitespace.\n     *\n     * ```markdown\n     *   | ~~~js\n     *   | alert(1)\n     * > | ~~~\n     *        ^\n     * ```\n     *\n     * @type {State}\n     */\n    function sequenceCloseAfter(code) {\n      if (code === null || markdownLineEnding(code)) {\n        effects.exit(\"codeFencedFence\");\n        return ok(code);\n      }\n      return nok(code);\n    }\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuation(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function start(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return lineStart;\n  }\n\n  /**\n   *\n   *\n   * @type {State}\n   */\n  function lineStart(code) {\n    return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n  }\n}","/// <reference lib=\"dom\" />\n\n/* global document */\n\nconst element = document.createElement('i')\n\n/**\n * @param {string} value\n * @returns {string | false}\n */\nexport function decodeNamedCharacterReference(value) {\n  const characterReference = '&' + value + ';'\n  element.innerHTML = characterReference\n  const character = element.textContent\n\n  // Some named character references do not require the closing semicolon\n  // (`&not`, for instance), which leads to situations where parsing the assumed\n  // named reference of `&notit;` will result in the string `¬it;`.\n  // When we encounter a trailing semicolon after parsing, and the character\n  // reference to decode was not a semicolon (`&semi;`), we can assume that the\n  // matching was not complete.\n  if (\n    // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n    // yield `null`.\n    character.charCodeAt(character.length - 1) === 59 /* `;` */ &&\n    value !== 'semi'\n  ) {\n    return false\n  }\n\n  // If the decoded string is equal to the input, the character reference was\n  // not valid.\n  // @ts-expect-error: TypeScript is wrong that `textContent` on elements can\n  // yield `null`.\n  return character === characterReference ? false : character\n}\n","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { asciiAlphanumeric, asciiDigit, asciiHexDigit } from 'micromark-util-character';\n/** @type {Construct} */\nexport const characterReference = {\n  name: 'characterReference',\n  tokenize: tokenizeCharacterReference\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCharacterReference(effects, ok, nok) {\n  const self = this;\n  let size = 0;\n  /** @type {number} */\n  let max;\n  /** @type {(code: Code) => boolean} */\n  let test;\n  return start;\n\n  /**\n   * Start of character reference.\n   *\n   * ```markdown\n   * > | a&amp;b\n   *      ^\n   * > | a&#123;b\n   *      ^\n   * > | a&#x9;b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"characterReference\");\n    effects.enter(\"characterReferenceMarker\");\n    effects.consume(code);\n    effects.exit(\"characterReferenceMarker\");\n    return open;\n  }\n\n  /**\n   * After `&`, at `#` for numeric references or alphanumeric for named\n   * references.\n   *\n   * ```markdown\n   * > | a&amp;b\n   *       ^\n   * > | a&#123;b\n   *       ^\n   * > | a&#x9;b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 35) {\n      effects.enter(\"characterReferenceMarkerNumeric\");\n      effects.consume(code);\n      effects.exit(\"characterReferenceMarkerNumeric\");\n      return numeric;\n    }\n    effects.enter(\"characterReferenceValue\");\n    max = 31;\n    test = asciiAlphanumeric;\n    return value(code);\n  }\n\n  /**\n   * After `#`, at `x` for hexadecimals or digit for decimals.\n   *\n   * ```markdown\n   * > | a&#123;b\n   *        ^\n   * > | a&#x9;b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function numeric(code) {\n    if (code === 88 || code === 120) {\n      effects.enter(\"characterReferenceMarkerHexadecimal\");\n      effects.consume(code);\n      effects.exit(\"characterReferenceMarkerHexadecimal\");\n      effects.enter(\"characterReferenceValue\");\n      max = 6;\n      test = asciiHexDigit;\n      return value;\n    }\n    effects.enter(\"characterReferenceValue\");\n    max = 7;\n    test = asciiDigit;\n    return value(code);\n  }\n\n  /**\n   * After markers (`&#x`, `&#`, or `&`), in value, before `;`.\n   *\n   * The character reference kind defines what and how many characters are\n   * allowed.\n   *\n   * ```markdown\n   * > | a&amp;b\n   *       ^^^\n   * > | a&#123;b\n   *        ^^^\n   * > | a&#x9;b\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function value(code) {\n    if (code === 59 && size) {\n      const token = effects.exit(\"characterReferenceValue\");\n      if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) {\n        return nok(code);\n      }\n\n      // To do: `markdown-rs` uses a different name:\n      // `CharacterReferenceMarkerSemi`.\n      effects.enter(\"characterReferenceMarker\");\n      effects.consume(code);\n      effects.exit(\"characterReferenceMarker\");\n      effects.exit(\"characterReference\");\n      return ok;\n    }\n    if (test(code) && size++ < max) {\n      effects.consume(code);\n      return value;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { asciiPunctuation } from 'micromark-util-character';\n/** @type {Construct} */\nexport const characterEscape = {\n  name: 'characterEscape',\n  tokenize: tokenizeCharacterEscape\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCharacterEscape(effects, ok, nok) {\n  return start;\n\n  /**\n   * Start of character escape.\n   *\n   * ```markdown\n   * > | a\\*b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"characterEscape\");\n    effects.enter(\"escapeMarker\");\n    effects.consume(code);\n    effects.exit(\"escapeMarker\");\n    return inside;\n  }\n\n  /**\n   * After `\\`, at punctuation.\n   *\n   * ```markdown\n   * > | a\\*b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    // ASCII punctuation.\n    if (asciiPunctuation(code)) {\n      effects.enter(\"characterEscapeValue\");\n      effects.consume(code);\n      effects.exit(\"characterEscapeValue\");\n      effects.exit(\"characterEscape\");\n      return ok;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n  name: 'lineEnding',\n  tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n  return start;\n\n  /** @type {State} */\n  function start(code) {\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return factorySpace(effects, ok, \"linePrefix\");\n  }\n}","/**\n * @import {\n *   Construct,\n *   Event,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n  name: 'labelEnd',\n  resolveAll: resolveAllLabelEnd,\n  resolveTo: resolveToLabelEnd,\n  tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n  tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n  tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n  tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n  let index = -1;\n  /** @type {Array<Event>} */\n  const newEvents = [];\n  while (++index < events.length) {\n    const token = events[index][1];\n    newEvents.push(events[index]);\n    if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n      // Remove the marker.\n      const offset = token.type === \"labelImage\" ? 4 : 2;\n      token.type = \"data\";\n      index += offset;\n    }\n  }\n\n  // If the events are equal, we don't have to copy newEvents to events\n  if (events.length !== newEvents.length) {\n    splice(events, 0, events.length, newEvents);\n  }\n  return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n  let index = events.length;\n  let offset = 0;\n  /** @type {Token} */\n  let token;\n  /** @type {number | undefined} */\n  let open;\n  /** @type {number | undefined} */\n  let close;\n  /** @type {Array<Event>} */\n  let media;\n\n  // Find an opening.\n  while (index--) {\n    token = events[index][1];\n    if (open) {\n      // If we see another link, or inactive link label, we’ve been here before.\n      if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n        break;\n      }\n\n      // Mark other link openings as inactive, as we can’t have links in\n      // links.\n      if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n        token._inactive = true;\n      }\n    } else if (close) {\n      if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n        open = index;\n        if (token.type !== \"labelLink\") {\n          offset = 2;\n          break;\n        }\n      }\n    } else if (token.type === \"labelEnd\") {\n      close = index;\n    }\n  }\n  const group = {\n    type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n    start: {\n      ...events[open][1].start\n    },\n    end: {\n      ...events[events.length - 1][1].end\n    }\n  };\n  const label = {\n    type: \"label\",\n    start: {\n      ...events[open][1].start\n    },\n    end: {\n      ...events[close][1].end\n    }\n  };\n  const text = {\n    type: \"labelText\",\n    start: {\n      ...events[open + offset + 2][1].end\n    },\n    end: {\n      ...events[close - 2][1].start\n    }\n  };\n  media = [['enter', group, context], ['enter', label, context]];\n\n  // Opening marker.\n  media = push(media, events.slice(open + 1, open + offset + 3));\n\n  // Text open.\n  media = push(media, [['enter', text, context]]);\n\n  // Always populated by defaults.\n\n  // Between.\n  media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n  // Text close, marker close, label close.\n  media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n  // Reference, resource, or so.\n  media = push(media, events.slice(close + 1));\n\n  // Media close.\n  media = push(media, [['exit', group, context]]);\n  splice(events, open, events.length, media);\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n  const self = this;\n  let index = self.events.length;\n  /** @type {Token} */\n  let labelStart;\n  /** @type {boolean} */\n  let defined;\n\n  // Find an opening.\n  while (index--) {\n    if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n      labelStart = self.events[index][1];\n      break;\n    }\n  }\n  return start;\n\n  /**\n   * Start of label end.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *       ^\n   * > | [a][b] c\n   *       ^\n   * > | [a][] b\n   *       ^\n   * > | [a] b\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    // If there is not an okay opening.\n    if (!labelStart) {\n      return nok(code);\n    }\n\n    // If the corresponding label (link) start is marked as inactive,\n    // it means we’d be wrapping a link, like this:\n    //\n    // ```markdown\n    // > | a [b [c](d) e](f) g.\n    //                  ^\n    // ```\n    //\n    // We can’t have that, so it’s just balanced brackets.\n    if (labelStart._inactive) {\n      return labelEndNok(code);\n    }\n    defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n      start: labelStart.end,\n      end: self.now()\n    })));\n    effects.enter(\"labelEnd\");\n    effects.enter(\"labelMarker\");\n    effects.consume(code);\n    effects.exit(\"labelMarker\");\n    effects.exit(\"labelEnd\");\n    return after;\n  }\n\n  /**\n   * After `]`.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *       ^\n   * > | [a][b] c\n   *       ^\n   * > | [a][] b\n   *       ^\n   * > | [a] b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n    // an extension.\n\n    // Resource (`[asd](fgh)`)?\n    if (code === 40) {\n      return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n    }\n\n    // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n    if (code === 91) {\n      return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n    }\n\n    // Shortcut (`[asd]`) reference?\n    return defined ? labelEndOk(code) : labelEndNok(code);\n  }\n\n  /**\n   * After `]`, at `[`, but not at a full reference.\n   *\n   * > 👉 **Note**: we only get here if the label is defined.\n   *\n   * ```markdown\n   * > | [a][] b\n   *        ^\n   * > | [a] b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceNotFull(code) {\n    return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n  }\n\n  /**\n   * Done, we found something.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *           ^\n   * > | [a][b] c\n   *           ^\n   * > | [a][] b\n   *          ^\n   * > | [a] b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEndOk(code) {\n    // Note: `markdown-rs` does a bunch of stuff here.\n    return ok(code);\n  }\n\n  /**\n   * Done, it’s nothing.\n   *\n   * There was an okay opening, but we didn’t match anything.\n   *\n   * ```markdown\n   * > | [a](b c\n   *        ^\n   * > | [a][b c\n   *        ^\n   * > | [a] b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function labelEndNok(code) {\n    labelStart._balanced = true;\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n  return resourceStart;\n\n  /**\n   * At a resource.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceStart(code) {\n    effects.enter(\"resource\");\n    effects.enter(\"resourceMarker\");\n    effects.consume(code);\n    effects.exit(\"resourceMarker\");\n    return resourceBefore;\n  }\n\n  /**\n   * In resource, after `(`, at optional whitespace.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceBefore(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n  }\n\n  /**\n   * In resource, after optional whitespace, at `)` or a destination.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceOpen(code) {\n    if (code === 41) {\n      return resourceEnd(code);\n    }\n    return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n  }\n\n  /**\n   * In resource, after destination, at optional whitespace.\n   *\n   * ```markdown\n   * > | [a](b) c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceDestinationAfter(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n  }\n\n  /**\n   * At invalid destination.\n   *\n   * ```markdown\n   * > | [a](<<) b\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceDestinationMissing(code) {\n    return nok(code);\n  }\n\n  /**\n   * In resource, after destination and whitespace, at `(` or title.\n   *\n   * ```markdown\n   * > | [a](b ) c\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceBetween(code) {\n    if (code === 34 || code === 39 || code === 40) {\n      return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n    }\n    return resourceEnd(code);\n  }\n\n  /**\n   * In resource, after title, at optional whitespace.\n   *\n   * ```markdown\n   * > | [a](b \"c\") d\n   *              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceTitleAfter(code) {\n    return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n  }\n\n  /**\n   * In resource, at `)`.\n   *\n   * ```markdown\n   * > | [a](b) d\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function resourceEnd(code) {\n    if (code === 41) {\n      effects.enter(\"resourceMarker\");\n      effects.consume(code);\n      effects.exit(\"resourceMarker\");\n      effects.exit(\"resource\");\n      return ok;\n    }\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n  const self = this;\n  return referenceFull;\n\n  /**\n   * In a reference (full), at the `[`.\n   *\n   * ```markdown\n   * > | [a][b] d\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceFull(code) {\n    return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n  }\n\n  /**\n   * In a reference (full), after `]`.\n   *\n   * ```markdown\n   * > | [a][b] d\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceFullAfter(code) {\n    return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n  }\n\n  /**\n   * In reference (full) that was missing.\n   *\n   * ```markdown\n   * > | [a][b d\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceFullMissing(code) {\n    return nok(code);\n  }\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n  return referenceCollapsedStart;\n\n  /**\n   * In reference (collapsed), at `[`.\n   *\n   * > 👉 **Note**: we only get here if the label is defined.\n   *\n   * ```markdown\n   * > | [a][] d\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function referenceCollapsedStart(code) {\n    // We only attempt a collapsed label if there’s a `[`.\n\n    effects.enter(\"reference\");\n    effects.enter(\"referenceMarker\");\n    effects.consume(code);\n    effects.exit(\"referenceMarker\");\n    return referenceCollapsedOpen;\n  }\n\n  /**\n   * In reference (collapsed), at `]`.\n   *\n   * > 👉 **Note**: we only get here if the label is defined.\n   *\n   * ```markdown\n   * > | [a][] d\n   *         ^\n   * ```\n   *\n   *  @type {State}\n   */\n  function referenceCollapsedOpen(code) {\n    if (code === 93) {\n      effects.enter(\"referenceMarker\");\n      effects.consume(code);\n      effects.exit(\"referenceMarker\");\n      effects.exit(\"reference\");\n      return ok;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n  name: 'labelStartImage',\n  resolveAll: labelEnd.resolveAll,\n  tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of label (image) start.\n   *\n   * ```markdown\n   * > | a ![b] c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"labelImage\");\n    effects.enter(\"labelImageMarker\");\n    effects.consume(code);\n    effects.exit(\"labelImageMarker\");\n    return open;\n  }\n\n  /**\n   * After `!`, at `[`.\n   *\n   * ```markdown\n   * > | a ![b] c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 91) {\n      effects.enter(\"labelMarker\");\n      effects.consume(code);\n      effects.exit(\"labelMarker\");\n      effects.exit(\"labelImage\");\n      return after;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `![`.\n   *\n   * ```markdown\n   * > | a ![b] c\n   *         ^\n   * ```\n   *\n   * This is needed in because, when GFM footnotes are enabled, images never\n   * form when started with a `^`.\n   * Instead, links form:\n   *\n   * ```markdown\n   * ![^a](b)\n   *\n   * ![^a][b]\n   *\n   * [b]: c\n   * ```\n   *\n   * ```html\n   * <p>!<a href=\\\"b\\\">^a</a></p>\n   * <p>!<a href=\\\"c\\\">^a</a></p>\n   * ```\n   *\n   * @type {State}\n   */\n  function after(code) {\n    // To do: use a new field to do this, this is still needed for\n    // `micromark-extension-gfm-footnote`, but the `label-start-link`\n    // behavior isn’t.\n    // Hidden footnotes hook.\n    /* c8 ignore next 3 */\n    return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   Event,\n *   Point,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { push, splice } from 'micromark-util-chunked';\nimport { classifyCharacter } from 'micromark-util-classify-character';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const attention = {\n  name: 'attention',\n  resolveAll: resolveAllAttention,\n  tokenize: tokenizeAttention\n};\n\n/**\n * Take all events and resolve attention to emphasis or strong.\n *\n * @type {Resolver}\n */\n// eslint-disable-next-line complexity\nfunction resolveAllAttention(events, context) {\n  let index = -1;\n  /** @type {number} */\n  let open;\n  /** @type {Token} */\n  let group;\n  /** @type {Token} */\n  let text;\n  /** @type {Token} */\n  let openingSequence;\n  /** @type {Token} */\n  let closingSequence;\n  /** @type {number} */\n  let use;\n  /** @type {Array<Event>} */\n  let nextEvents;\n  /** @type {number} */\n  let offset;\n\n  // Walk through all events.\n  //\n  // Note: performance of this is fine on an mb of normal markdown, but it’s\n  // a bottleneck for malicious stuff.\n  while (++index < events.length) {\n    // Find a token that can close.\n    if (events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close) {\n      open = index;\n\n      // Now walk back to find an opener.\n      while (open--) {\n        // Find a token that can open the closer.\n        if (events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open &&\n        // If the markers are the same:\n        context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {\n          // If the opening can close or the closing can open,\n          // and the close size *is not* a multiple of three,\n          // but the sum of the opening and closing size *is* multiple of three,\n          // then don’t match.\n          if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {\n            continue;\n          }\n\n          // Number of markers to use from the sequence.\n          use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;\n          const start = {\n            ...events[open][1].end\n          };\n          const end = {\n            ...events[index][1].start\n          };\n          movePoint(start, -use);\n          movePoint(end, use);\n          openingSequence = {\n            type: use > 1 ? \"strongSequence\" : \"emphasisSequence\",\n            start,\n            end: {\n              ...events[open][1].end\n            }\n          };\n          closingSequence = {\n            type: use > 1 ? \"strongSequence\" : \"emphasisSequence\",\n            start: {\n              ...events[index][1].start\n            },\n            end\n          };\n          text = {\n            type: use > 1 ? \"strongText\" : \"emphasisText\",\n            start: {\n              ...events[open][1].end\n            },\n            end: {\n              ...events[index][1].start\n            }\n          };\n          group = {\n            type: use > 1 ? \"strong\" : \"emphasis\",\n            start: {\n              ...openingSequence.start\n            },\n            end: {\n              ...closingSequence.end\n            }\n          };\n          events[open][1].end = {\n            ...openingSequence.start\n          };\n          events[index][1].start = {\n            ...closingSequence.end\n          };\n          nextEvents = [];\n\n          // If there are more markers in the opening, add them before.\n          if (events[open][1].end.offset - events[open][1].start.offset) {\n            nextEvents = push(nextEvents, [['enter', events[open][1], context], ['exit', events[open][1], context]]);\n          }\n\n          // Opening.\n          nextEvents = push(nextEvents, [['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context]]);\n\n          // Always populated by defaults.\n\n          // Between.\n          nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));\n\n          // Closing.\n          nextEvents = push(nextEvents, [['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context]]);\n\n          // If there are more markers in the closing, add them after.\n          if (events[index][1].end.offset - events[index][1].start.offset) {\n            offset = 2;\n            nextEvents = push(nextEvents, [['enter', events[index][1], context], ['exit', events[index][1], context]]);\n          } else {\n            offset = 0;\n          }\n          splice(events, open - 1, index - open + 3, nextEvents);\n          index = open + nextEvents.length - offset - 2;\n          break;\n        }\n      }\n    }\n  }\n\n  // Remove remaining sequences.\n  index = -1;\n  while (++index < events.length) {\n    if (events[index][1].type === 'attentionSequence') {\n      events[index][1].type = 'data';\n    }\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeAttention(effects, ok) {\n  const attentionMarkers = this.parser.constructs.attentionMarkers.null;\n  const previous = this.previous;\n  const before = classifyCharacter(previous);\n\n  /** @type {NonNullable<Code>} */\n  let marker;\n  return start;\n\n  /**\n   * Before a sequence.\n   *\n   * ```markdown\n   * > | **\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    marker = code;\n    effects.enter('attentionSequence');\n    return inside(code);\n  }\n\n  /**\n   * In a sequence.\n   *\n   * ```markdown\n   * > | **\n   *     ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function inside(code) {\n    if (code === marker) {\n      effects.consume(code);\n      return inside;\n    }\n    const token = effects.exit('attentionSequence');\n\n    // To do: next major: move this to resolver, just like `markdown-rs`.\n    const after = classifyCharacter(code);\n\n    // Always populated by defaults.\n\n    const open = !after || after === 2 && before || attentionMarkers.includes(code);\n    const close = !before || before === 2 && after || attentionMarkers.includes(previous);\n    token._open = Boolean(marker === 42 ? open : open && (before || !close));\n    token._close = Boolean(marker === 42 ? close : close && (after || !open));\n    return ok(code);\n  }\n}\n\n/**\n * Move a point a bit.\n *\n * Note: `move` only works inside lines! It’s not possible to move past other\n * chunks (replacement characters, tabs, or line endings).\n *\n * @param {Point} point\n *   Point.\n * @param {number} offset\n *   Amount to move.\n * @returns {undefined}\n *   Nothing.\n */\nfunction movePoint(point, offset) {\n  point.column += offset;\n  point.offset += offset;\n  point._bufferIndex += offset;\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { asciiAlphanumeric, asciiAlpha, asciiAtext, asciiControl } from 'micromark-util-character';\n/** @type {Construct} */\nexport const autolink = {\n  name: 'autolink',\n  tokenize: tokenizeAutolink\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeAutolink(effects, ok, nok) {\n  let size = 0;\n  return start;\n\n  /**\n   * Start of an autolink.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *      ^\n   * > | a<user@example.com>b\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"autolink\");\n    effects.enter(\"autolinkMarker\");\n    effects.consume(code);\n    effects.exit(\"autolinkMarker\");\n    effects.enter(\"autolinkProtocol\");\n    return open;\n  }\n\n  /**\n   * After `<`, at protocol or atext.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *       ^\n   * > | a<user@example.com>b\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return schemeOrEmailAtext;\n    }\n    if (code === 64) {\n      return nok(code);\n    }\n    return emailAtext(code);\n  }\n\n  /**\n   * At second byte of protocol or atext.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *        ^\n   * > | a<user@example.com>b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function schemeOrEmailAtext(code) {\n    // ASCII alphanumeric and `+`, `-`, and `.`.\n    if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {\n      // Count the previous alphabetical from `open` too.\n      size = 1;\n      return schemeInsideOrEmailAtext(code);\n    }\n    return emailAtext(code);\n  }\n\n  /**\n   * In ambiguous protocol or atext.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *        ^\n   * > | a<user@example.com>b\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function schemeInsideOrEmailAtext(code) {\n    if (code === 58) {\n      effects.consume(code);\n      size = 0;\n      return urlInside;\n    }\n\n    // ASCII alphanumeric and `+`, `-`, and `.`.\n    if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {\n      effects.consume(code);\n      return schemeInsideOrEmailAtext;\n    }\n    size = 0;\n    return emailAtext(code);\n  }\n\n  /**\n   * After protocol, in URL.\n   *\n   * ```markdown\n   * > | a<https://example.com>b\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function urlInside(code) {\n    if (code === 62) {\n      effects.exit(\"autolinkProtocol\");\n      effects.enter(\"autolinkMarker\");\n      effects.consume(code);\n      effects.exit(\"autolinkMarker\");\n      effects.exit(\"autolink\");\n      return ok;\n    }\n\n    // ASCII control, space, or `<`.\n    if (code === null || code === 32 || code === 60 || asciiControl(code)) {\n      return nok(code);\n    }\n    effects.consume(code);\n    return urlInside;\n  }\n\n  /**\n   * In email atext.\n   *\n   * ```markdown\n   * > | a<user.name@example.com>b\n   *              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailAtext(code) {\n    if (code === 64) {\n      effects.consume(code);\n      return emailAtSignOrDot;\n    }\n    if (asciiAtext(code)) {\n      effects.consume(code);\n      return emailAtext;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In label, after at-sign or dot.\n   *\n   * ```markdown\n   * > | a<user.name@example.com>b\n   *                 ^       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailAtSignOrDot(code) {\n    return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);\n  }\n\n  /**\n   * In label, where `.` and `>` are allowed.\n   *\n   * ```markdown\n   * > | a<user.name@example.com>b\n   *                   ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailLabel(code) {\n    if (code === 46) {\n      effects.consume(code);\n      size = 0;\n      return emailAtSignOrDot;\n    }\n    if (code === 62) {\n      // Exit, then change the token type.\n      effects.exit(\"autolinkProtocol\").type = \"autolinkEmail\";\n      effects.enter(\"autolinkMarker\");\n      effects.consume(code);\n      effects.exit(\"autolinkMarker\");\n      effects.exit(\"autolink\");\n      return ok;\n    }\n    return emailValue(code);\n  }\n\n  /**\n   * In label, where `.` and `>` are *not* allowed.\n   *\n   * Though, this is also used in `emailLabel` to parse other values.\n   *\n   * ```markdown\n   * > | a<user.name@ex-ample.com>b\n   *                    ^\n   * ```\n   *\n   * @type {State}\n   */\n  function emailValue(code) {\n    // ASCII alphanumeric or `-`.\n    if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {\n      const next = code === 45 ? emailValue : emailLabel;\n      effects.consume(code);\n      return next;\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Code,\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n  name: 'htmlText',\n  tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n  const self = this;\n  /** @type {NonNullable<Code> | undefined} */\n  let marker;\n  /** @type {number} */\n  let index;\n  /** @type {State} */\n  let returnState;\n  return start;\n\n  /**\n   * Start of HTML (text).\n   *\n   * ```markdown\n   * > | a <b> c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"htmlText\");\n    effects.enter(\"htmlTextData\");\n    effects.consume(code);\n    return open;\n  }\n\n  /**\n   * After `<`, at tag name or other stuff.\n   *\n   * ```markdown\n   * > | a <b> c\n   *        ^\n   * > | a <!doctype> c\n   *        ^\n   * > | a <!--b--> c\n   *        ^\n   * ```\n   *\n   * @type {State}\n   */\n  function open(code) {\n    if (code === 33) {\n      effects.consume(code);\n      return declarationOpen;\n    }\n    if (code === 47) {\n      effects.consume(code);\n      return tagCloseStart;\n    }\n    if (code === 63) {\n      effects.consume(code);\n      return instruction;\n    }\n\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return tagOpen;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `<!`, at declaration, comment, or CDATA.\n   *\n   * ```markdown\n   * > | a <!doctype> c\n   *         ^\n   * > | a <!--b--> c\n   *         ^\n   * > | a <![CDATA[>&<]]> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function declarationOpen(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return commentOpenInside;\n    }\n    if (code === 91) {\n      effects.consume(code);\n      index = 0;\n      return cdataOpenInside;\n    }\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return declaration;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In a comment, after `<!-`, at another `-`.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentOpenInside(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return commentEnd;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In comment.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function comment(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    if (code === 45) {\n      effects.consume(code);\n      return commentClose;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = comment;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return comment;\n  }\n\n  /**\n   * In comment, after `-`.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentClose(code) {\n    if (code === 45) {\n      effects.consume(code);\n      return commentEnd;\n    }\n    return comment(code);\n  }\n\n  /**\n   * In comment, after `--`.\n   *\n   * ```markdown\n   * > | a <!--b--> c\n   *              ^\n   * ```\n   *\n   * @type {State}\n   */\n  function commentEnd(code) {\n    return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n  }\n\n  /**\n   * After `<![`, in CDATA, expecting `CDATA[`.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *          ^^^^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataOpenInside(code) {\n    const value = \"CDATA[\";\n    if (code === value.charCodeAt(index++)) {\n      effects.consume(code);\n      return index === value.length ? cdata : cdataOpenInside;\n    }\n    return nok(code);\n  }\n\n  /**\n   * In CDATA.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *                ^^^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdata(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    if (code === 93) {\n      effects.consume(code);\n      return cdataClose;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = cdata;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return cdata;\n  }\n\n  /**\n   * In CDATA, after `]`, at another `]`.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *                    ^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataClose(code) {\n    if (code === 93) {\n      effects.consume(code);\n      return cdataEnd;\n    }\n    return cdata(code);\n  }\n\n  /**\n   * In CDATA, after `]]`, at `>`.\n   *\n   * ```markdown\n   * > | a <![CDATA[>&<]]> b\n   *                     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function cdataEnd(code) {\n    if (code === 62) {\n      return end(code);\n    }\n    if (code === 93) {\n      effects.consume(code);\n      return cdataEnd;\n    }\n    return cdata(code);\n  }\n\n  /**\n   * In declaration.\n   *\n   * ```markdown\n   * > | a <!b> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function declaration(code) {\n    if (code === null || code === 62) {\n      return end(code);\n    }\n    if (markdownLineEnding(code)) {\n      returnState = declaration;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return declaration;\n  }\n\n  /**\n   * In instruction.\n   *\n   * ```markdown\n   * > | a <?b?> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function instruction(code) {\n    if (code === null) {\n      return nok(code);\n    }\n    if (code === 63) {\n      effects.consume(code);\n      return instructionClose;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = instruction;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return instruction;\n  }\n\n  /**\n   * In instruction, after `?`, at `>`.\n   *\n   * ```markdown\n   * > | a <?b?> c\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function instructionClose(code) {\n    return code === 62 ? end(code) : instruction(code);\n  }\n\n  /**\n   * After `</`, in closing tag, at tag name.\n   *\n   * ```markdown\n   * > | a </b> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagCloseStart(code) {\n    // ASCII alphabetical.\n    if (asciiAlpha(code)) {\n      effects.consume(code);\n      return tagClose;\n    }\n    return nok(code);\n  }\n\n  /**\n   * After `</x`, in a tag name.\n   *\n   * ```markdown\n   * > | a </b> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagClose(code) {\n    // ASCII alphanumerical and `-`.\n    if (code === 45 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return tagClose;\n    }\n    return tagCloseBetween(code);\n  }\n\n  /**\n   * In closing tag, after tag name.\n   *\n   * ```markdown\n   * > | a </b> c\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagCloseBetween(code) {\n    if (markdownLineEnding(code)) {\n      returnState = tagCloseBetween;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagCloseBetween;\n    }\n    return end(code);\n  }\n\n  /**\n   * After `<x`, in opening tag name.\n   *\n   * ```markdown\n   * > | a <b> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpen(code) {\n    // ASCII alphanumerical and `-`.\n    if (code === 45 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return tagOpen;\n    }\n    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      return tagOpenBetween(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In opening tag, after tag name.\n   *\n   * ```markdown\n   * > | a <b> c\n   *         ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenBetween(code) {\n    if (code === 47) {\n      effects.consume(code);\n      return end;\n    }\n\n    // ASCII alphabetical and `:` and `_`.\n    if (code === 58 || code === 95 || asciiAlpha(code)) {\n      effects.consume(code);\n      return tagOpenAttributeName;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenBetween;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagOpenBetween;\n    }\n    return end(code);\n  }\n\n  /**\n   * In attribute name.\n   *\n   * ```markdown\n   * > | a <b c> d\n   *          ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeName(code) {\n    // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n    if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n      effects.consume(code);\n      return tagOpenAttributeName;\n    }\n    return tagOpenAttributeNameAfter(code);\n  }\n\n  /**\n   * After attribute name, before initializer, the end of the tag, or\n   * whitespace.\n   *\n   * ```markdown\n   * > | a <b c> d\n   *           ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeNameAfter(code) {\n    if (code === 61) {\n      effects.consume(code);\n      return tagOpenAttributeValueBefore;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenAttributeNameAfter;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagOpenAttributeNameAfter;\n    }\n    return tagOpenBetween(code);\n  }\n\n  /**\n   * Before unquoted, double quoted, or single quoted attribute value, allowing\n   * whitespace.\n   *\n   * ```markdown\n   * > | a <b c=d> e\n   *            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueBefore(code) {\n    if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n      return nok(code);\n    }\n    if (code === 34 || code === 39) {\n      effects.consume(code);\n      marker = code;\n      return tagOpenAttributeValueQuoted;\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenAttributeValueBefore;\n      return lineEndingBefore(code);\n    }\n    if (markdownSpace(code)) {\n      effects.consume(code);\n      return tagOpenAttributeValueBefore;\n    }\n    effects.consume(code);\n    return tagOpenAttributeValueUnquoted;\n  }\n\n  /**\n   * In double or single quoted attribute value.\n   *\n   * ```markdown\n   * > | a <b c=\"d\"> e\n   *             ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueQuoted(code) {\n    if (code === marker) {\n      effects.consume(code);\n      marker = undefined;\n      return tagOpenAttributeValueQuotedAfter;\n    }\n    if (code === null) {\n      return nok(code);\n    }\n    if (markdownLineEnding(code)) {\n      returnState = tagOpenAttributeValueQuoted;\n      return lineEndingBefore(code);\n    }\n    effects.consume(code);\n    return tagOpenAttributeValueQuoted;\n  }\n\n  /**\n   * In unquoted attribute value.\n   *\n   * ```markdown\n   * > | a <b c=d> e\n   *            ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueUnquoted(code) {\n    if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n      return nok(code);\n    }\n    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      return tagOpenBetween(code);\n    }\n    effects.consume(code);\n    return tagOpenAttributeValueUnquoted;\n  }\n\n  /**\n   * After double or single quoted attribute value, before whitespace or the end\n   * of the tag.\n   *\n   * ```markdown\n   * > | a <b c=\"d\"> e\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function tagOpenAttributeValueQuotedAfter(code) {\n    if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n      return tagOpenBetween(code);\n    }\n    return nok(code);\n  }\n\n  /**\n   * In certain circumstances of a tag where only an `>` is allowed.\n   *\n   * ```markdown\n   * > | a <b c=\"d\"> e\n   *               ^\n   * ```\n   *\n   * @type {State}\n   */\n  function end(code) {\n    if (code === 62) {\n      effects.consume(code);\n      effects.exit(\"htmlTextData\");\n      effects.exit(\"htmlText\");\n      return ok;\n    }\n    return nok(code);\n  }\n\n  /**\n   * At eol.\n   *\n   * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n   * > empty tokens.\n   *\n   * ```markdown\n   * > | a <!--a\n   *            ^\n   *   | b-->\n   * ```\n   *\n   * @type {State}\n   */\n  function lineEndingBefore(code) {\n    effects.exit(\"htmlTextData\");\n    effects.enter(\"lineEnding\");\n    effects.consume(code);\n    effects.exit(\"lineEnding\");\n    return lineEndingAfter;\n  }\n\n  /**\n   * After eol, at optional whitespace.\n   *\n   * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n   * > empty tokens.\n   *\n   * ```markdown\n   *   | a <!--a\n   * > | b-->\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function lineEndingAfter(code) {\n    // Always populated by defaults.\n\n    return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n  }\n\n  /**\n   * After eol, after optional whitespace.\n   *\n   * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n   * > empty tokens.\n   *\n   * ```markdown\n   *   | a <!--a\n   * > | b-->\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function lineEndingAfterPrefix(code) {\n    effects.enter(\"htmlTextData\");\n    return returnState(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n  name: 'labelStartLink',\n  resolveAll: labelEnd.resolveAll,\n  tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n  const self = this;\n  return start;\n\n  /**\n   * Start of label (link) start.\n   *\n   * ```markdown\n   * > | a [b] c\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"labelLink\");\n    effects.enter(\"labelMarker\");\n    effects.consume(code);\n    effects.exit(\"labelMarker\");\n    effects.exit(\"labelLink\");\n    return after;\n  }\n\n  /** @type {State} */\n  function after(code) {\n    // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n    // remove.\n    // Hidden footnotes hook.\n    /* c8 ignore next 3 */\n    return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   State,\n *   TokenizeContext,\n *   Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const hardBreakEscape = {\n  name: 'hardBreakEscape',\n  tokenize: tokenizeHardBreakEscape\n};\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHardBreakEscape(effects, ok, nok) {\n  return start;\n\n  /**\n   * Start of a hard break (escape).\n   *\n   * ```markdown\n   * > | a\\\n   *      ^\n   *   | b\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"hardBreakEscape\");\n    effects.consume(code);\n    return after;\n  }\n\n  /**\n   * After `\\`, at eol.\n   *\n   * ```markdown\n   * > | a\\\n   *       ^\n   *   | b\n   * ```\n   *\n   *  @type {State}\n   */\n  function after(code) {\n    if (markdownLineEnding(code)) {\n      effects.exit(\"hardBreakEscape\");\n      return ok(code);\n    }\n    return nok(code);\n  }\n}","/**\n * @import {\n *   Construct,\n *   Previous,\n *   Resolver,\n *   State,\n *   TokenizeContext,\n *   Tokenizer,\n *   Token\n * } from 'micromark-util-types'\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const codeText = {\n  name: 'codeText',\n  previous,\n  resolve: resolveCodeText,\n  tokenize: tokenizeCodeText\n};\n\n// To do: next major: don’t resolve, like `markdown-rs`.\n/** @type {Resolver} */\nfunction resolveCodeText(events) {\n  let tailExitIndex = events.length - 4;\n  let headEnterIndex = 3;\n  /** @type {number} */\n  let index;\n  /** @type {number | undefined} */\n  let enter;\n\n  // If we start and end with an EOL or a space.\n  if ((events[headEnterIndex][1].type === \"lineEnding\" || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === \"lineEnding\" || events[tailExitIndex][1].type === 'space')) {\n    index = headEnterIndex;\n\n    // And we have data.\n    while (++index < tailExitIndex) {\n      if (events[index][1].type === \"codeTextData\") {\n        // Then we have padding.\n        events[headEnterIndex][1].type = \"codeTextPadding\";\n        events[tailExitIndex][1].type = \"codeTextPadding\";\n        headEnterIndex += 2;\n        tailExitIndex -= 2;\n        break;\n      }\n    }\n  }\n\n  // Merge adjacent spaces and data.\n  index = headEnterIndex - 1;\n  tailExitIndex++;\n  while (++index <= tailExitIndex) {\n    if (enter === undefined) {\n      if (index !== tailExitIndex && events[index][1].type !== \"lineEnding\") {\n        enter = index;\n      }\n    } else if (index === tailExitIndex || events[index][1].type === \"lineEnding\") {\n      events[enter][1].type = \"codeTextData\";\n      if (index !== enter + 2) {\n        events[enter][1].end = events[index - 1][1].end;\n        events.splice(enter + 2, index - enter - 2);\n        tailExitIndex -= index - enter - 2;\n        index = enter + 2;\n      }\n      enter = undefined;\n    }\n  }\n  return events;\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Previous}\n */\nfunction previous(code) {\n  // If there is a previous code, there will always be a tail.\n  return code !== 96 || this.events[this.events.length - 1][1].type === \"characterEscape\";\n}\n\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeText(effects, ok, nok) {\n  const self = this;\n  let sizeOpen = 0;\n  /** @type {number} */\n  let size;\n  /** @type {Token} */\n  let token;\n  return start;\n\n  /**\n   * Start of code (text).\n   *\n   * ```markdown\n   * > | `a`\n   *     ^\n   * > | \\`a`\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function start(code) {\n    effects.enter(\"codeText\");\n    effects.enter(\"codeTextSequence\");\n    return sequenceOpen(code);\n  }\n\n  /**\n   * In opening sequence.\n   *\n   * ```markdown\n   * > | `a`\n   *     ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceOpen(code) {\n    if (code === 96) {\n      effects.consume(code);\n      sizeOpen++;\n      return sequenceOpen;\n    }\n    effects.exit(\"codeTextSequence\");\n    return between(code);\n  }\n\n  /**\n   * Between something and something else.\n   *\n   * ```markdown\n   * > | `a`\n   *      ^^\n   * ```\n   *\n   * @type {State}\n   */\n  function between(code) {\n    // EOF.\n    if (code === null) {\n      return nok(code);\n    }\n\n    // To do: next major: don’t do spaces in resolve, but when compiling,\n    // like `markdown-rs`.\n    // Tabs don’t work, and virtual spaces don’t make sense.\n    if (code === 32) {\n      effects.enter('space');\n      effects.consume(code);\n      effects.exit('space');\n      return between;\n    }\n\n    // Closing fence? Could also be data.\n    if (code === 96) {\n      token = effects.enter(\"codeTextSequence\");\n      size = 0;\n      return sequenceClose(code);\n    }\n    if (markdownLineEnding(code)) {\n      effects.enter(\"lineEnding\");\n      effects.consume(code);\n      effects.exit(\"lineEnding\");\n      return between;\n    }\n\n    // Data.\n    effects.enter(\"codeTextData\");\n    return data(code);\n  }\n\n  /**\n   * In data.\n   *\n   * ```markdown\n   * > | `a`\n   *      ^\n   * ```\n   *\n   * @type {State}\n   */\n  function data(code) {\n    if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) {\n      effects.exit(\"codeTextData\");\n      return between(code);\n    }\n    effects.consume(code);\n    return data;\n  }\n\n  /**\n   * In closing sequence.\n   *\n   * ```markdown\n   * > | `a`\n   *       ^\n   * ```\n   *\n   * @type {State}\n   */\n  function sequenceClose(code) {\n    // More.\n    if (code === 96) {\n      effects.consume(code);\n      size++;\n      return sequenceClose;\n    }\n\n    // Done!\n    if (size === sizeOpen) {\n      effects.exit(\"codeTextSequence\");\n      effects.exit(\"codeText\");\n      return ok(code);\n    }\n\n    // More or less accents: mark as data.\n    token.type = \"codeTextData\";\n    return data(code);\n  }\n}","/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n  [42]: list,\n  [43]: list,\n  [45]: list,\n  [48]: list,\n  [49]: list,\n  [50]: list,\n  [51]: list,\n  [52]: list,\n  [53]: list,\n  [54]: list,\n  [55]: list,\n  [56]: list,\n  [57]: list,\n  [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n  [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n  [-2]: codeIndented,\n  [-1]: codeIndented,\n  [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n  [35]: headingAtx,\n  [42]: thematicBreak,\n  [45]: [setextUnderline, thematicBreak],\n  [60]: htmlFlow,\n  [61]: setextUnderline,\n  [95]: thematicBreak,\n  [96]: codeFenced,\n  [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n  [38]: characterReference,\n  [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n  [-5]: lineEnding,\n  [-4]: lineEnding,\n  [-3]: lineEnding,\n  [33]: labelStartImage,\n  [38]: characterReference,\n  [42]: attention,\n  [60]: [autolink, htmlText],\n  [91]: labelStartLink,\n  [92]: [hardBreakEscape, characterEscape],\n  [93]: labelEnd,\n  [95]: attention,\n  [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n  null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n  null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n  null: []\n};","/**\n * @import {\n *   Chunk,\n *   Code,\n *   ConstructRecord,\n *   Construct,\n *   Effects,\n *   InitialConstruct,\n *   ParseContext,\n *   Point,\n *   State,\n *   TokenizeContext,\n *   Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n *   Restore the state.\n * @returns {undefined}\n *   Nothing.\n *\n * @typedef Info\n *   Info.\n * @property {Restore} restore\n *   Restore.\n * @property {number} from\n *   From.\n *\n * @callback ReturnHandle\n *   Handle a successful run.\n * @param {Construct} construct\n *   Construct.\n * @param {Info} info\n *   Info.\n * @returns {undefined}\n *   Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n *   Parser.\n * @param {InitialConstruct} initialize\n *   Construct.\n * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from]\n *   Point (optional).\n * @returns {TokenizeContext}\n *   Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n  /** @type {Point} */\n  let point = {\n    _bufferIndex: -1,\n    _index: 0,\n    line: from && from.line || 1,\n    column: from && from.column || 1,\n    offset: from && from.offset || 0\n  };\n  /** @type {Record<string, number>} */\n  const columnStart = {};\n  /** @type {Array<Construct>} */\n  const resolveAllConstructs = [];\n  /** @type {Array<Chunk>} */\n  let chunks = [];\n  /** @type {Array<Token>} */\n  let stack = [];\n  /** @type {boolean | undefined} */\n  let consumed = true;\n\n  /**\n   * Tools used for tokenizing.\n   *\n   * @type {Effects}\n   */\n  const effects = {\n    attempt: constructFactory(onsuccessfulconstruct),\n    check: constructFactory(onsuccessfulcheck),\n    consume,\n    enter,\n    exit,\n    interrupt: constructFactory(onsuccessfulcheck, {\n      interrupt: true\n    })\n  };\n\n  /**\n   * State and tools for resolving and serializing.\n   *\n   * @type {TokenizeContext}\n   */\n  const context = {\n    code: null,\n    containerState: {},\n    defineSkip,\n    events: [],\n    now,\n    parser,\n    previous: null,\n    sliceSerialize,\n    sliceStream,\n    write\n  };\n\n  /**\n   * The state function.\n   *\n   * @type {State | undefined}\n   */\n  let state = initialize.tokenize.call(context, effects);\n\n  /**\n   * Track which character we expect to be consumed, to catch bugs.\n   *\n   * @type {Code}\n   */\n  let expectedCode;\n  if (initialize.resolveAll) {\n    resolveAllConstructs.push(initialize);\n  }\n  return context;\n\n  /** @type {TokenizeContext['write']} */\n  function write(slice) {\n    chunks = push(chunks, slice);\n    main();\n\n    // Exit if we’re not done, resolve might change stuff.\n    if (chunks[chunks.length - 1] !== null) {\n      return [];\n    }\n    addResult(initialize, 0);\n\n    // Otherwise, resolve, and exit.\n    context.events = resolveAll(resolveAllConstructs, context.events, context);\n    return context.events;\n  }\n\n  //\n  // Tools.\n  //\n\n  /** @type {TokenizeContext['sliceSerialize']} */\n  function sliceSerialize(token, expandTabs) {\n    return serializeChunks(sliceStream(token), expandTabs);\n  }\n\n  /** @type {TokenizeContext['sliceStream']} */\n  function sliceStream(token) {\n    return sliceChunks(chunks, token);\n  }\n\n  /** @type {TokenizeContext['now']} */\n  function now() {\n    // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n    const {\n      _bufferIndex,\n      _index,\n      line,\n      column,\n      offset\n    } = point;\n    return {\n      _bufferIndex,\n      _index,\n      line,\n      column,\n      offset\n    };\n  }\n\n  /** @type {TokenizeContext['defineSkip']} */\n  function defineSkip(value) {\n    columnStart[value.line] = value.column;\n    accountForPotentialSkip();\n  }\n\n  //\n  // State management.\n  //\n\n  /**\n   * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n   * `consume`).\n   * Here is where we walk through the chunks, which either include strings of\n   * several characters, or numerical character codes.\n   * The reason to do this in a loop instead of a call is so the stack can\n   * drain.\n   *\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function main() {\n    /** @type {number} */\n    let chunkIndex;\n    while (point._index < chunks.length) {\n      const chunk = chunks[point._index];\n\n      // If we’re in a buffer chunk, loop through it.\n      if (typeof chunk === 'string') {\n        chunkIndex = point._index;\n        if (point._bufferIndex < 0) {\n          point._bufferIndex = 0;\n        }\n        while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n          go(chunk.charCodeAt(point._bufferIndex));\n        }\n      } else {\n        go(chunk);\n      }\n    }\n  }\n\n  /**\n   * Deal with one code.\n   *\n   * @param {Code} code\n   *   Code.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function go(code) {\n    consumed = undefined;\n    expectedCode = code;\n    state = state(code);\n  }\n\n  /** @type {Effects['consume']} */\n  function consume(code) {\n    if (markdownLineEnding(code)) {\n      point.line++;\n      point.column = 1;\n      point.offset += code === -3 ? 2 : 1;\n      accountForPotentialSkip();\n    } else if (code !== -1) {\n      point.column++;\n      point.offset++;\n    }\n\n    // Not in a string chunk.\n    if (point._bufferIndex < 0) {\n      point._index++;\n    } else {\n      point._bufferIndex++;\n\n      // At end of string chunk.\n      if (point._bufferIndex ===\n      // Points w/ non-negative `_bufferIndex` reference\n      // strings.\n      /** @type {string} */\n      chunks[point._index].length) {\n        point._bufferIndex = -1;\n        point._index++;\n      }\n    }\n\n    // Expose the previous character.\n    context.previous = code;\n\n    // Mark as consumed.\n    consumed = true;\n  }\n\n  /** @type {Effects['enter']} */\n  function enter(type, fields) {\n    /** @type {Token} */\n    // @ts-expect-error Patch instead of assign required fields to help GC.\n    const token = fields || {};\n    token.type = type;\n    token.start = now();\n    context.events.push(['enter', token, context]);\n    stack.push(token);\n    return token;\n  }\n\n  /** @type {Effects['exit']} */\n  function exit(type) {\n    const token = stack.pop();\n    token.end = now();\n    context.events.push(['exit', token, context]);\n    return token;\n  }\n\n  /**\n   * Use results.\n   *\n   * @type {ReturnHandle}\n   */\n  function onsuccessfulconstruct(construct, info) {\n    addResult(construct, info.from);\n  }\n\n  /**\n   * Discard results.\n   *\n   * @type {ReturnHandle}\n   */\n  function onsuccessfulcheck(_, info) {\n    info.restore();\n  }\n\n  /**\n   * Factory to attempt/check/interrupt.\n   *\n   * @param {ReturnHandle} onreturn\n   *   Callback.\n   * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n   *   Fields.\n   */\n  function constructFactory(onreturn, fields) {\n    return hook;\n\n    /**\n     * Handle either an object mapping codes to constructs, a list of\n     * constructs, or a single construct.\n     *\n     * @param {Array<Construct> | ConstructRecord | Construct} constructs\n     *   Constructs.\n     * @param {State} returnState\n     *   State.\n     * @param {State | undefined} [bogusState]\n     *   State.\n     * @returns {State}\n     *   State.\n     */\n    function hook(constructs, returnState, bogusState) {\n      /** @type {ReadonlyArray<Construct>} */\n      let listOfConstructs;\n      /** @type {number} */\n      let constructIndex;\n      /** @type {Construct} */\n      let currentConstruct;\n      /** @type {Info} */\n      let info;\n      return Array.isArray(constructs) ? /* c8 ignore next 1 */\n      handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n      // Looks like a construct.\n      handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n      /**\n       * Handle a list of construct.\n       *\n       * @param {ConstructRecord} map\n       *   Constructs.\n       * @returns {State}\n       *   State.\n       */\n      function handleMapOfConstructs(map) {\n        return start;\n\n        /** @type {State} */\n        function start(code) {\n          const left = code !== null && map[code];\n          const all = code !== null && map.null;\n          const list = [\n          // To do: add more extension tests.\n          /* c8 ignore next 2 */\n          ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n          return handleListOfConstructs(list)(code);\n        }\n      }\n\n      /**\n       * Handle a list of construct.\n       *\n       * @param {ReadonlyArray<Construct>} list\n       *   Constructs.\n       * @returns {State}\n       *   State.\n       */\n      function handleListOfConstructs(list) {\n        listOfConstructs = list;\n        constructIndex = 0;\n        if (list.length === 0) {\n          return bogusState;\n        }\n        return handleConstruct(list[constructIndex]);\n      }\n\n      /**\n       * Handle a single construct.\n       *\n       * @param {Construct} construct\n       *   Construct.\n       * @returns {State}\n       *   State.\n       */\n      function handleConstruct(construct) {\n        return start;\n\n        /** @type {State} */\n        function start(code) {\n          // To do: not needed to store if there is no bogus state, probably?\n          // Currently doesn’t work because `inspect` in document does a check\n          // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n          // by not storing.\n          info = store();\n          currentConstruct = construct;\n          if (!construct.partial) {\n            context.currentConstruct = construct;\n          }\n\n          // Always populated by defaults.\n\n          if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n            return nok(code);\n          }\n          return construct.tokenize.call(\n          // If we do have fields, create an object w/ `context` as its\n          // prototype.\n          // This allows a “live binding”, which is needed for `interrupt`.\n          fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n        }\n      }\n\n      /** @type {State} */\n      function ok(code) {\n        consumed = true;\n        onreturn(currentConstruct, info);\n        return returnState;\n      }\n\n      /** @type {State} */\n      function nok(code) {\n        consumed = true;\n        info.restore();\n        if (++constructIndex < listOfConstructs.length) {\n          return handleConstruct(listOfConstructs[constructIndex]);\n        }\n        return bogusState;\n      }\n    }\n  }\n\n  /**\n   * @param {Construct} construct\n   *   Construct.\n   * @param {number} from\n   *   From.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function addResult(construct, from) {\n    if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n      resolveAllConstructs.push(construct);\n    }\n    if (construct.resolve) {\n      splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n    }\n    if (construct.resolveTo) {\n      context.events = construct.resolveTo(context.events, context);\n    }\n  }\n\n  /**\n   * Store state.\n   *\n   * @returns {Info}\n   *   Info.\n   */\n  function store() {\n    const startPoint = now();\n    const startPrevious = context.previous;\n    const startCurrentConstruct = context.currentConstruct;\n    const startEventsIndex = context.events.length;\n    const startStack = Array.from(stack);\n    return {\n      from: startEventsIndex,\n      restore\n    };\n\n    /**\n     * Restore state.\n     *\n     * @returns {undefined}\n     *   Nothing.\n     */\n    function restore() {\n      point = startPoint;\n      context.previous = startPrevious;\n      context.currentConstruct = startCurrentConstruct;\n      context.events.length = startEventsIndex;\n      stack = startStack;\n      accountForPotentialSkip();\n    }\n  }\n\n  /**\n   * Move the current point a bit forward in the line when it’s on a column\n   * skip.\n   *\n   * @returns {undefined}\n   *   Nothing.\n   */\n  function accountForPotentialSkip() {\n    if (point.line in columnStart && point.column < 2) {\n      point.column = columnStart[point.line];\n      point.offset += columnStart[point.line] - 1;\n    }\n  }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray<Chunk>} chunks\n *   Chunks.\n * @param {Pick<Token, 'end' | 'start'>} token\n *   Token.\n * @returns {Array<Chunk>}\n *   Chunks.\n */\nfunction sliceChunks(chunks, token) {\n  const startIndex = token.start._index;\n  const startBufferIndex = token.start._bufferIndex;\n  const endIndex = token.end._index;\n  const endBufferIndex = token.end._bufferIndex;\n  /** @type {Array<Chunk>} */\n  let view;\n  if (startIndex === endIndex) {\n    // @ts-expect-error `_bufferIndex` is used on string chunks.\n    view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n  } else {\n    view = chunks.slice(startIndex, endIndex);\n    if (startBufferIndex > -1) {\n      const head = view[0];\n      if (typeof head === 'string') {\n        view[0] = head.slice(startBufferIndex);\n        /* c8 ignore next 4 -- used to be used, no longer */\n      } else {\n        view.shift();\n      }\n    }\n    if (endBufferIndex > 0) {\n      // @ts-expect-error `_bufferIndex` is used on string chunks.\n      view.push(chunks[endIndex].slice(0, endBufferIndex));\n    }\n  }\n  return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray<Chunk>} chunks\n *   Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n *   Whether to expand tabs (default: `false`).\n * @returns {string}\n *   Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n  let index = -1;\n  /** @type {Array<string>} */\n  const result = [];\n  /** @type {boolean | undefined} */\n  let atTab;\n  while (++index < chunks.length) {\n    const chunk = chunks[index];\n    /** @type {string} */\n    let value;\n    if (typeof chunk === 'string') {\n      value = chunk;\n    } else switch (chunk) {\n      case -5:\n        {\n          value = \"\\r\";\n          break;\n        }\n      case -4:\n        {\n          value = \"\\n\";\n          break;\n        }\n      case -3:\n        {\n          value = \"\\r\" + \"\\n\";\n          break;\n        }\n      case -2:\n        {\n          value = expandTabs ? \" \" : \"\\t\";\n          break;\n        }\n      case -1:\n        {\n          if (!expandTabs && atTab) continue;\n          value = \" \";\n          break;\n        }\n      default:\n        {\n          // Currently only replacement character.\n          value = String.fromCharCode(chunk);\n        }\n    }\n    atTab = chunk === -2;\n    result.push(value);\n  }\n  return result.join('');\n}","/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n *   Preprocess a value.\n * @param {Value} value\n *   Value.\n * @param {Encoding | null | undefined} [encoding]\n *   Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n *   Whether this is the last chunk (default: `false`).\n * @returns {Array<Chunk>}\n *   Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n *   Preprocess a value.\n */\nexport function preprocess() {\n  let column = 1;\n  let buffer = '';\n  /** @type {boolean | undefined} */\n  let start = true;\n  /** @type {boolean | undefined} */\n  let atCarriageReturn;\n  return preprocessor;\n\n  /** @type {Preprocessor} */\n  // eslint-disable-next-line complexity\n  function preprocessor(value, encoding, end) {\n    /** @type {Array<Chunk>} */\n    const chunks = [];\n    /** @type {RegExpMatchArray | null} */\n    let match;\n    /** @type {number} */\n    let next;\n    /** @type {number} */\n    let startPosition;\n    /** @type {number} */\n    let endPosition;\n    /** @type {Code} */\n    let code;\n    value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n    startPosition = 0;\n    buffer = '';\n    if (start) {\n      // To do: `markdown-rs` actually parses BOMs (byte order mark).\n      if (value.charCodeAt(0) === 65279) {\n        startPosition++;\n      }\n      start = undefined;\n    }\n    while (startPosition < value.length) {\n      search.lastIndex = startPosition;\n      match = search.exec(value);\n      endPosition = match && match.index !== undefined ? match.index : value.length;\n      code = value.charCodeAt(endPosition);\n      if (!match) {\n        buffer = value.slice(startPosition);\n        break;\n      }\n      if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n        chunks.push(-3);\n        atCarriageReturn = undefined;\n      } else {\n        if (atCarriageReturn) {\n          chunks.push(-5);\n          atCarriageReturn = undefined;\n        }\n        if (startPosition < endPosition) {\n          chunks.push(value.slice(startPosition, endPosition));\n          column += endPosition - startPosition;\n        }\n        switch (code) {\n          case 0:\n            {\n              chunks.push(65533);\n              column++;\n              break;\n            }\n          case 9:\n            {\n              next = Math.ceil(column / 4) * 4;\n              chunks.push(-2);\n              while (column++ < next) chunks.push(-1);\n              break;\n            }\n          case 10:\n            {\n              chunks.push(-4);\n              column = 1;\n              break;\n            }\n          default:\n            {\n              atCarriageReturn = true;\n              column = 1;\n            }\n        }\n      }\n      startPosition = endPosition + 1;\n    }\n    if (end) {\n      if (atCarriageReturn) chunks.push(-5);\n      if (buffer) chunks.push(buffer);\n      chunks.push(null);\n    }\n    return chunks;\n  }\n}","/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes\n * non-characters and control characters safe.\n *\n * @param {string} value\n *   Value to decode.\n * @param {number} base\n *   Numeric base.\n * @returns {string}\n *   Character.\n */\nexport function decodeNumericCharacterReference(value, base) {\n  const code = Number.parseInt(value, base);\n  if (\n  // C0 except for HT, LF, FF, CR, space.\n  code < 9 || code === 11 || code > 13 && code < 32 ||\n  // Control character (DEL) of C0, and C1 controls.\n  code > 126 && code < 160 ||\n  // Lone high surrogates and low surrogates.\n  code > 55_295 && code < 57_344 ||\n  // Noncharacters.\n  code > 64_975 && code < 65_008 || /* eslint-disable no-bitwise */\n  (code & 65_535) === 65_535 || (code & 65_535) === 65_534 || /* eslint-enable no-bitwise */\n  // Out of range\n  code > 1_114_111) {\n    return \"\\uFFFD\";\n  }\n  return String.fromCodePoint(code);\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n *   Value to decode.\n * @returns {string}\n *   Decoded value.\n */\nexport function decodeString(value) {\n  return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n *   Match.\n * @param {string} $1\n *   Character escape.\n * @param {string} $2\n *   Character reference.\n * @returns {string}\n *   Decoded value\n */\nfunction decode($0, $1, $2) {\n  if ($1) {\n    // Escape.\n    return $1;\n  }\n\n  // Reference.\n  const head = $2.charCodeAt(0);\n  if (head === 35) {\n    const head = $2.charCodeAt(1);\n    const hex = head === 120 || head === 88;\n    return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n  }\n  return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @import {\n *   Break,\n *   Blockquote,\n *   Code,\n *   Definition,\n *   Emphasis,\n *   Heading,\n *   Html,\n *   Image,\n *   InlineCode,\n *   Link,\n *   ListItem,\n *   List,\n *   Nodes,\n *   Paragraph,\n *   PhrasingContent,\n *   ReferenceType,\n *   Root,\n *   Strong,\n *   Text,\n *   ThematicBreak\n * } from 'mdast'\n * @import {\n *   Encoding,\n *   Event,\n *   Token,\n *   Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n *   CompileContext,\n *   CompileData,\n *   Config,\n *   Extension,\n *   Handle,\n *   OnEnterError,\n *   Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n *   Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n *   Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n *   Configuration.\n * @returns {Root}\n *   mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n  if (typeof encoding !== 'string') {\n    options = encoding;\n    encoding = undefined;\n  }\n  return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n  /** @type {Config} */\n  const config = {\n    transforms: [],\n    canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n    enter: {\n      autolink: opener(link),\n      autolinkProtocol: onenterdata,\n      autolinkEmail: onenterdata,\n      atxHeading: opener(heading),\n      blockQuote: opener(blockQuote),\n      characterEscape: onenterdata,\n      characterReference: onenterdata,\n      codeFenced: opener(codeFlow),\n      codeFencedFenceInfo: buffer,\n      codeFencedFenceMeta: buffer,\n      codeIndented: opener(codeFlow, buffer),\n      codeText: opener(codeText, buffer),\n      codeTextData: onenterdata,\n      data: onenterdata,\n      codeFlowValue: onenterdata,\n      definition: opener(definition),\n      definitionDestinationString: buffer,\n      definitionLabelString: buffer,\n      definitionTitleString: buffer,\n      emphasis: opener(emphasis),\n      hardBreakEscape: opener(hardBreak),\n      hardBreakTrailing: opener(hardBreak),\n      htmlFlow: opener(html, buffer),\n      htmlFlowData: onenterdata,\n      htmlText: opener(html, buffer),\n      htmlTextData: onenterdata,\n      image: opener(image),\n      label: buffer,\n      link: opener(link),\n      listItem: opener(listItem),\n      listItemValue: onenterlistitemvalue,\n      listOrdered: opener(list, onenterlistordered),\n      listUnordered: opener(list),\n      paragraph: opener(paragraph),\n      reference: onenterreference,\n      referenceString: buffer,\n      resourceDestinationString: buffer,\n      resourceTitleString: buffer,\n      setextHeading: opener(heading),\n      strong: opener(strong),\n      thematicBreak: opener(thematicBreak)\n    },\n    exit: {\n      atxHeading: closer(),\n      atxHeadingSequence: onexitatxheadingsequence,\n      autolink: closer(),\n      autolinkEmail: onexitautolinkemail,\n      autolinkProtocol: onexitautolinkprotocol,\n      blockQuote: closer(),\n      characterEscapeValue: onexitdata,\n      characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n      characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n      characterReferenceValue: onexitcharacterreferencevalue,\n      characterReference: onexitcharacterreference,\n      codeFenced: closer(onexitcodefenced),\n      codeFencedFence: onexitcodefencedfence,\n      codeFencedFenceInfo: onexitcodefencedfenceinfo,\n      codeFencedFenceMeta: onexitcodefencedfencemeta,\n      codeFlowValue: onexitdata,\n      codeIndented: closer(onexitcodeindented),\n      codeText: closer(onexitcodetext),\n      codeTextData: onexitdata,\n      data: onexitdata,\n      definition: closer(),\n      definitionDestinationString: onexitdefinitiondestinationstring,\n      definitionLabelString: onexitdefinitionlabelstring,\n      definitionTitleString: onexitdefinitiontitlestring,\n      emphasis: closer(),\n      hardBreakEscape: closer(onexithardbreak),\n      hardBreakTrailing: closer(onexithardbreak),\n      htmlFlow: closer(onexithtmlflow),\n      htmlFlowData: onexitdata,\n      htmlText: closer(onexithtmltext),\n      htmlTextData: onexitdata,\n      image: closer(onexitimage),\n      label: onexitlabel,\n      labelText: onexitlabeltext,\n      lineEnding: onexitlineending,\n      link: closer(onexitlink),\n      listItem: closer(),\n      listOrdered: closer(),\n      listUnordered: closer(),\n      paragraph: closer(),\n      referenceString: onexitreferencestring,\n      resourceDestinationString: onexitresourcedestinationstring,\n      resourceTitleString: onexitresourcetitlestring,\n      resource: onexitresource,\n      setextHeading: closer(onexitsetextheading),\n      setextHeadingLineSequence: onexitsetextheadinglinesequence,\n      setextHeadingText: onexitsetextheadingtext,\n      strong: closer(),\n      thematicBreak: closer()\n    }\n  };\n  configure(config, (options || {}).mdastExtensions || []);\n\n  /** @type {CompileData} */\n  const data = {};\n  return compile;\n\n  /**\n   * Turn micromark events into an mdast tree.\n   *\n   * @param {Array<Event>} events\n   *   Events.\n   * @returns {Root}\n   *   mdast tree.\n   */\n  function compile(events) {\n    /** @type {Root} */\n    let tree = {\n      type: 'root',\n      children: []\n    };\n    /** @type {Omit<CompileContext, 'sliceSerialize'>} */\n    const context = {\n      stack: [tree],\n      tokenStack: [],\n      config,\n      enter,\n      exit,\n      buffer,\n      resume,\n      data\n    };\n    /** @type {Array<number>} */\n    const listStack = [];\n    let index = -1;\n    while (++index < events.length) {\n      // We preprocess lists to add `listItem` tokens, and to infer whether\n      // items the list itself are spread out.\n      if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n        if (events[index][0] === 'enter') {\n          listStack.push(index);\n        } else {\n          const tail = listStack.pop();\n          index = prepareList(events, tail, index);\n        }\n      }\n    }\n    index = -1;\n    while (++index < events.length) {\n      const handler = config[events[index][0]];\n      if (own.call(handler, events[index][1].type)) {\n        handler[events[index][1].type].call(Object.assign({\n          sliceSerialize: events[index][2].sliceSerialize\n        }, context), events[index][1]);\n      }\n    }\n\n    // Handle tokens still being open.\n    if (context.tokenStack.length > 0) {\n      const tail = context.tokenStack[context.tokenStack.length - 1];\n      const handler = tail[1] || defaultOnError;\n      handler.call(context, undefined, tail[0]);\n    }\n\n    // Figure out `root` position.\n    tree.position = {\n      start: point(events.length > 0 ? events[0][1].start : {\n        line: 1,\n        column: 1,\n        offset: 0\n      }),\n      end: point(events.length > 0 ? events[events.length - 2][1].end : {\n        line: 1,\n        column: 1,\n        offset: 0\n      })\n    };\n\n    // Call transforms.\n    index = -1;\n    while (++index < config.transforms.length) {\n      tree = config.transforms[index](tree) || tree;\n    }\n    return tree;\n  }\n\n  /**\n   * @param {Array<Event>} events\n   * @param {number} start\n   * @param {number} length\n   * @returns {number}\n   */\n  function prepareList(events, start, length) {\n    let index = start - 1;\n    let containerBalance = -1;\n    let listSpread = false;\n    /** @type {Token | undefined} */\n    let listItem;\n    /** @type {number | undefined} */\n    let lineIndex;\n    /** @type {number | undefined} */\n    let firstBlankLineIndex;\n    /** @type {boolean | undefined} */\n    let atMarker;\n    while (++index <= length) {\n      const event = events[index];\n      switch (event[1].type) {\n        case \"listUnordered\":\n        case \"listOrdered\":\n        case \"blockQuote\":\n          {\n            if (event[0] === 'enter') {\n              containerBalance++;\n            } else {\n              containerBalance--;\n            }\n            atMarker = undefined;\n            break;\n          }\n        case \"lineEndingBlank\":\n          {\n            if (event[0] === 'enter') {\n              if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n                firstBlankLineIndex = index;\n              }\n              atMarker = undefined;\n            }\n            break;\n          }\n        case \"linePrefix\":\n        case \"listItemValue\":\n        case \"listItemMarker\":\n        case \"listItemPrefix\":\n        case \"listItemPrefixWhitespace\":\n          {\n            // Empty.\n\n            break;\n          }\n        default:\n          {\n            atMarker = undefined;\n          }\n      }\n      if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n        if (listItem) {\n          let tailIndex = index;\n          lineIndex = undefined;\n          while (tailIndex--) {\n            const tailEvent = events[tailIndex];\n            if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n              if (tailEvent[0] === 'exit') continue;\n              if (lineIndex) {\n                events[lineIndex][1].type = \"lineEndingBlank\";\n                listSpread = true;\n              }\n              tailEvent[1].type = \"lineEnding\";\n              lineIndex = tailIndex;\n            } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n              // Empty\n            } else {\n              break;\n            }\n          }\n          if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n            listItem._spread = true;\n          }\n\n          // Fix position.\n          listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n          events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n          index++;\n          length++;\n        }\n\n        // Create a new list item.\n        if (event[1].type === \"listItemPrefix\") {\n          /** @type {Token} */\n          const item = {\n            type: 'listItem',\n            _spread: false,\n            start: Object.assign({}, event[1].start),\n            // @ts-expect-error: we’ll add `end` in a second.\n            end: undefined\n          };\n          listItem = item;\n          events.splice(index, 0, ['enter', item, event[2]]);\n          index++;\n          length++;\n          firstBlankLineIndex = undefined;\n          atMarker = true;\n        }\n      }\n    }\n    events[start][1]._spread = listSpread;\n    return length;\n  }\n\n  /**\n   * Create an opener handle.\n   *\n   * @param {(token: Token) => Nodes} create\n   *   Create a node.\n   * @param {Handle | undefined} [and]\n   *   Optional function to also run.\n   * @returns {Handle}\n   *   Handle.\n   */\n  function opener(create, and) {\n    return open;\n\n    /**\n     * @this {CompileContext}\n     * @param {Token} token\n     * @returns {undefined}\n     */\n    function open(token) {\n      enter.call(this, create(token), token);\n      if (and) and.call(this, token);\n    }\n  }\n\n  /**\n   * @type {CompileContext['buffer']}\n   */\n  function buffer() {\n    this.stack.push({\n      type: 'fragment',\n      children: []\n    });\n  }\n\n  /**\n   * @type {CompileContext['enter']}\n   */\n  function enter(node, token, errorHandler) {\n    const parent = this.stack[this.stack.length - 1];\n    /** @type {Array<Nodes>} */\n    const siblings = parent.children;\n    siblings.push(node);\n    this.stack.push(node);\n    this.tokenStack.push([token, errorHandler || undefined]);\n    node.position = {\n      start: point(token.start),\n      // @ts-expect-error: `end` will be patched later.\n      end: undefined\n    };\n  }\n\n  /**\n   * Create a closer handle.\n   *\n   * @param {Handle | undefined} [and]\n   *   Optional function to also run.\n   * @returns {Handle}\n   *   Handle.\n   */\n  function closer(and) {\n    return close;\n\n    /**\n     * @this {CompileContext}\n     * @param {Token} token\n     * @returns {undefined}\n     */\n    function close(token) {\n      if (and) and.call(this, token);\n      exit.call(this, token);\n    }\n  }\n\n  /**\n   * @type {CompileContext['exit']}\n   */\n  function exit(token, onExitError) {\n    const node = this.stack.pop();\n    const open = this.tokenStack.pop();\n    if (!open) {\n      throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n        start: token.start,\n        end: token.end\n      }) + '): it’s not open');\n    } else if (open[0].type !== token.type) {\n      if (onExitError) {\n        onExitError.call(this, token, open[0]);\n      } else {\n        const handler = open[1] || defaultOnError;\n        handler.call(this, token, open[0]);\n      }\n    }\n    node.position.end = point(token.end);\n  }\n\n  /**\n   * @type {CompileContext['resume']}\n   */\n  function resume() {\n    return toString(this.stack.pop());\n  }\n\n  //\n  // Handlers.\n  //\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onenterlistordered() {\n    this.data.expectingFirstListItemValue = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onenterlistitemvalue(token) {\n    if (this.data.expectingFirstListItemValue) {\n      const ancestor = this.stack[this.stack.length - 2];\n      ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n      this.data.expectingFirstListItemValue = undefined;\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefencedfenceinfo() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.lang = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefencedfencemeta() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.meta = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefencedfence() {\n    // Exit if this is the closing fence.\n    if (this.data.flowCodeInside) return;\n    this.buffer();\n    this.data.flowCodeInside = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodefenced() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n    this.data.flowCodeInside = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcodeindented() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitdefinitionlabelstring(token) {\n    const label = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.label = label;\n    node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitdefinitiontitlestring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.title = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitdefinitiondestinationstring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.url = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitatxheadingsequence(token) {\n    const node = this.stack[this.stack.length - 1];\n    if (!node.depth) {\n      const depth = this.sliceSerialize(token).length;\n      node.depth = depth;\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitsetextheadingtext() {\n    this.data.setextHeadingSlurpLineEnding = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitsetextheadinglinesequence(token) {\n    const node = this.stack[this.stack.length - 1];\n    node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitsetextheading() {\n    this.data.setextHeadingSlurpLineEnding = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onenterdata(token) {\n    const node = this.stack[this.stack.length - 1];\n    /** @type {Array<Nodes>} */\n    const siblings = node.children;\n    let tail = siblings[siblings.length - 1];\n    if (!tail || tail.type !== 'text') {\n      // Add a new text node.\n      tail = text();\n      tail.position = {\n        start: point(token.start),\n        // @ts-expect-error: we’ll add `end` later.\n        end: undefined\n      };\n      siblings.push(tail);\n    }\n    this.stack.push(tail);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitdata(token) {\n    const tail = this.stack.pop();\n    tail.value += this.sliceSerialize(token);\n    tail.position.end = point(token.end);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlineending(token) {\n    const context = this.stack[this.stack.length - 1];\n    // If we’re at a hard break, include the line ending in there.\n    if (this.data.atHardBreak) {\n      const tail = context.children[context.children.length - 1];\n      tail.position.end = point(token.end);\n      this.data.atHardBreak = undefined;\n      return;\n    }\n    if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n      onenterdata.call(this, token);\n      onexitdata.call(this, token);\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexithardbreak() {\n    this.data.atHardBreak = true;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexithtmlflow() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexithtmltext() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitcodetext() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.value = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlink() {\n    const node = this.stack[this.stack.length - 1];\n    // Note: there are also `identifier` and `label` fields on this link node!\n    // These are used / cleaned here.\n\n    // To do: clean.\n    if (this.data.inReference) {\n      /** @type {ReferenceType} */\n      const referenceType = this.data.referenceType || 'shortcut';\n      node.type += 'Reference';\n      // @ts-expect-error: mutate.\n      node.referenceType = referenceType;\n      // @ts-expect-error: mutate.\n      delete node.url;\n      delete node.title;\n    } else {\n      // @ts-expect-error: mutate.\n      delete node.identifier;\n      // @ts-expect-error: mutate.\n      delete node.label;\n    }\n    this.data.referenceType = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitimage() {\n    const node = this.stack[this.stack.length - 1];\n    // Note: there are also `identifier` and `label` fields on this link node!\n    // These are used / cleaned here.\n\n    // To do: clean.\n    if (this.data.inReference) {\n      /** @type {ReferenceType} */\n      const referenceType = this.data.referenceType || 'shortcut';\n      node.type += 'Reference';\n      // @ts-expect-error: mutate.\n      node.referenceType = referenceType;\n      // @ts-expect-error: mutate.\n      delete node.url;\n      delete node.title;\n    } else {\n      // @ts-expect-error: mutate.\n      delete node.identifier;\n      // @ts-expect-error: mutate.\n      delete node.label;\n    }\n    this.data.referenceType = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlabeltext(token) {\n    const string = this.sliceSerialize(token);\n    const ancestor = this.stack[this.stack.length - 2];\n    // @ts-expect-error: stash this on the node, as it might become a reference\n    // later.\n    ancestor.label = decodeString(string);\n    // @ts-expect-error: same as above.\n    ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitlabel() {\n    const fragment = this.stack[this.stack.length - 1];\n    const value = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    // Assume a reference.\n    this.data.inReference = true;\n    if (node.type === 'link') {\n      /** @type {Array<PhrasingContent>} */\n      const children = fragment.children;\n      node.children = children;\n    } else {\n      node.alt = value;\n    }\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitresourcedestinationstring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.url = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitresourcetitlestring() {\n    const data = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    node.title = data;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitresource() {\n    this.data.inReference = undefined;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onenterreference() {\n    this.data.referenceType = 'collapsed';\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitreferencestring(token) {\n    const label = this.resume();\n    const node = this.stack[this.stack.length - 1];\n    // @ts-expect-error: stash this on the node, as it might become a reference\n    // later.\n    node.label = label;\n    // @ts-expect-error: same as above.\n    node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n    this.data.referenceType = 'full';\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n\n  function onexitcharacterreferencemarker(token) {\n    this.data.characterReferenceType = token.type;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcharacterreferencevalue(token) {\n    const data = this.sliceSerialize(token);\n    const type = this.data.characterReferenceType;\n    /** @type {string} */\n    let value;\n    if (type) {\n      value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n      this.data.characterReferenceType = undefined;\n    } else {\n      const result = decodeNamedCharacterReference(data);\n      value = result;\n    }\n    const tail = this.stack[this.stack.length - 1];\n    tail.value += value;\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitcharacterreference(token) {\n    const tail = this.stack.pop();\n    tail.position.end = point(token.end);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitautolinkprotocol(token) {\n    onexitdata.call(this, token);\n    const node = this.stack[this.stack.length - 1];\n    node.url = this.sliceSerialize(token);\n  }\n\n  /**\n   * @this {CompileContext}\n   * @type {Handle}\n   */\n  function onexitautolinkemail(token) {\n    onexitdata.call(this, token);\n    const node = this.stack[this.stack.length - 1];\n    node.url = 'mailto:' + this.sliceSerialize(token);\n  }\n\n  //\n  // Creaters.\n  //\n\n  /** @returns {Blockquote} */\n  function blockQuote() {\n    return {\n      type: 'blockquote',\n      children: []\n    };\n  }\n\n  /** @returns {Code} */\n  function codeFlow() {\n    return {\n      type: 'code',\n      lang: null,\n      meta: null,\n      value: ''\n    };\n  }\n\n  /** @returns {InlineCode} */\n  function codeText() {\n    return {\n      type: 'inlineCode',\n      value: ''\n    };\n  }\n\n  /** @returns {Definition} */\n  function definition() {\n    return {\n      type: 'definition',\n      identifier: '',\n      label: null,\n      title: null,\n      url: ''\n    };\n  }\n\n  /** @returns {Emphasis} */\n  function emphasis() {\n    return {\n      type: 'emphasis',\n      children: []\n    };\n  }\n\n  /** @returns {Heading} */\n  function heading() {\n    return {\n      type: 'heading',\n      // @ts-expect-error `depth` will be set later.\n      depth: 0,\n      children: []\n    };\n  }\n\n  /** @returns {Break} */\n  function hardBreak() {\n    return {\n      type: 'break'\n    };\n  }\n\n  /** @returns {Html} */\n  function html() {\n    return {\n      type: 'html',\n      value: ''\n    };\n  }\n\n  /** @returns {Image} */\n  function image() {\n    return {\n      type: 'image',\n      title: null,\n      url: '',\n      alt: null\n    };\n  }\n\n  /** @returns {Link} */\n  function link() {\n    return {\n      type: 'link',\n      title: null,\n      url: '',\n      children: []\n    };\n  }\n\n  /**\n   * @param {Token} token\n   * @returns {List}\n   */\n  function list(token) {\n    return {\n      type: 'list',\n      ordered: token.type === 'listOrdered',\n      start: null,\n      spread: token._spread,\n      children: []\n    };\n  }\n\n  /**\n   * @param {Token} token\n   * @returns {ListItem}\n   */\n  function listItem(token) {\n    return {\n      type: 'listItem',\n      spread: token._spread,\n      checked: null,\n      children: []\n    };\n  }\n\n  /** @returns {Paragraph} */\n  function paragraph() {\n    return {\n      type: 'paragraph',\n      children: []\n    };\n  }\n\n  /** @returns {Strong} */\n  function strong() {\n    return {\n      type: 'strong',\n      children: []\n    };\n  }\n\n  /** @returns {Text} */\n  function text() {\n    return {\n      type: 'text',\n      value: ''\n    };\n  }\n\n  /** @returns {ThematicBreak} */\n  function thematicBreak() {\n    return {\n      type: 'thematicBreak'\n    };\n  }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n *   Point-like value.\n * @returns {Point}\n *   unist point.\n */\nfunction point(d) {\n  return {\n    line: d.line,\n    column: d.column,\n    offset: d.offset\n  };\n}\n\n/**\n * @param {Config} combined\n * @param {Array<Array<Extension> | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n  let index = -1;\n  while (++index < extensions.length) {\n    const value = extensions[index];\n    if (Array.isArray(value)) {\n      configure(combined, value);\n    } else {\n      extension(combined, value);\n    }\n  }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n  /** @type {keyof Extension} */\n  let key;\n  for (key in extension) {\n    if (own.call(extension, key)) {\n      switch (key) {\n        case 'canContainEols':\n          {\n            const right = extension[key];\n            if (right) {\n              combined[key].push(...right);\n            }\n            break;\n          }\n        case 'transforms':\n          {\n            const right = extension[key];\n            if (right) {\n              combined[key].push(...right);\n            }\n            break;\n          }\n        case 'enter':\n        case 'exit':\n          {\n            const right = extension[key];\n            if (right) {\n              Object.assign(combined[key], right);\n            }\n            break;\n          }\n        // No default\n      }\n    }\n  }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n  if (left) {\n    throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n      start: left.start,\n      end: left.end\n    }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n      start: right.start,\n      end: right.end\n    }) + ') is open');\n  } else {\n    throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n      start: right.start,\n      end: right.end\n    }) + ') is still open');\n  }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array<Event>} events\n *   Events.\n * @returns {Array<Event>}\n *   Events.\n */\nexport function postprocess(events) {\n  while (!subtokenize(events)) {\n    // Empty\n  }\n  return events;\n}","/**\n * @import {\n *   Create,\n *   FullNormalizedExtension,\n *   InitialConstruct,\n *   ParseContext,\n *   ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n *   Configuration (optional).\n * @returns {ParseContext}\n *   Parser.\n */\nexport function parse(options) {\n  const settings = options || {};\n  const constructs = /** @type {FullNormalizedExtension} */\n  combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n  /** @type {ParseContext} */\n  const parser = {\n    constructs,\n    content: create(content),\n    defined: [],\n    document: create(document),\n    flow: create(flow),\n    lazy: {},\n    string: create(string),\n    text: create(text)\n  };\n  return parser;\n\n  /**\n   * @param {InitialConstruct} initial\n   *   Construct to start with.\n   * @returns {Create}\n   *   Create a tokenizer.\n   */\n  function create(initial) {\n    return creator;\n    /** @type {Create} */\n    function creator(from) {\n      return createTokenizer(parser, initial, from);\n    }\n  }\n}","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser<Root>} Parser\n * @typedef {import('unified').Processor<Root>} Processor\n */\n\n/**\n * @typedef {Omit<FromMarkdownOptions, 'extensions' | 'mdastExtensions'>} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function remarkParse(options) {\n  /** @type {Processor} */\n  // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n  const self = this\n\n  self.parser = parser\n\n  /**\n   * @type {Parser}\n   */\n  function parser(doc) {\n    return fromMarkdown(doc, {\n      ...self.data('settings'),\n      ...options,\n      // Note: these options are not in the readme.\n      // The goal is for them to be set by plugins on `data` instead of being\n      // passed by users.\n      extensions: self.data('micromarkExtensions') || [],\n      mdastExtensions: self.data('fromMarkdownExtensions') || []\n    })\n  }\n}\n","export const VOID       = -1;\nexport const PRIMITIVE  = 0;\nexport const ARRAY      = 1;\nexport const OBJECT     = 2;\nexport const DATE       = 3;\nexport const REGEXP     = 4;\nexport const MAP        = 5;\nexport const SET        = 6;\nexport const ERROR      = 7;\nexport const BIGINT     = 8;\n// export const SYMBOL = 9;\n","import {\n  VOID, PRIMITIVE,\n  ARRAY, OBJECT,\n  DATE, REGEXP, MAP, SET,\n  ERROR, BIGINT\n} from './types.js';\n\nconst env = typeof self === 'object' ? self : globalThis;\n\nconst deserializer = ($, _) => {\n  const as = (out, index) => {\n    $.set(index, out);\n    return out;\n  };\n\n  const unpair = index => {\n    if ($.has(index))\n      return $.get(index);\n\n    const [type, value] = _[index];\n    switch (type) {\n      case PRIMITIVE:\n      case VOID:\n        return as(value, index);\n      case ARRAY: {\n        const arr = as([], index);\n        for (const index of value)\n          arr.push(unpair(index));\n        return arr;\n      }\n      case OBJECT: {\n        const object = as({}, index);\n        for (const [key, index] of value)\n          object[unpair(key)] = unpair(index);\n        return object;\n      }\n      case DATE:\n        return as(new Date(value), index);\n      case REGEXP: {\n        const {source, flags} = value;\n        return as(new RegExp(source, flags), index);\n      }\n      case MAP: {\n        const map = as(new Map, index);\n        for (const [key, index] of value)\n          map.set(unpair(key), unpair(index));\n        return map;\n      }\n      case SET: {\n        const set = as(new Set, index);\n        for (const index of value)\n          set.add(unpair(index));\n        return set;\n      }\n      case ERROR: {\n        const {name, message} = value;\n        return as(new env[name](message), index);\n      }\n      case BIGINT:\n        return as(BigInt(value), index);\n      case 'BigInt':\n        return as(Object(BigInt(value)), index);\n      case 'ArrayBuffer':\n        return as(new Uint8Array(value).buffer, value);\n      case 'DataView': {\n        const { buffer } = new Uint8Array(value);\n        return as(new DataView(buffer), value);\n      }\n    }\n    return as(new env[type](value), index);\n  };\n\n  return unpair;\n};\n\n/**\n * @typedef {Array<string,any>} Record a type representation\n */\n\n/**\n * Returns a deserialized value from a serialized array of Records.\n * @param {Record[]} serialized a previously serialized value.\n * @returns {any}\n */\nexport const deserialize = serialized => deserializer(new Map, serialized)(0);\n","import {\n  VOID, PRIMITIVE,\n  ARRAY, OBJECT,\n  DATE, REGEXP, MAP, SET,\n  ERROR, BIGINT\n} from './types.js';\n\nconst EMPTY = '';\n\nconst {toString} = {};\nconst {keys} = Object;\n\nconst typeOf = value => {\n  const type = typeof value;\n  if (type !== 'object' || !value)\n    return [PRIMITIVE, type];\n\n  const asString = toString.call(value).slice(8, -1);\n  switch (asString) {\n    case 'Array':\n      return [ARRAY, EMPTY];\n    case 'Object':\n      return [OBJECT, EMPTY];\n    case 'Date':\n      return [DATE, EMPTY];\n    case 'RegExp':\n      return [REGEXP, EMPTY];\n    case 'Map':\n      return [MAP, EMPTY];\n    case 'Set':\n      return [SET, EMPTY];\n    case 'DataView':\n      return [ARRAY, asString];\n  }\n\n  if (asString.includes('Array'))\n    return [ARRAY, asString];\n\n  if (asString.includes('Error'))\n    return [ERROR, asString];\n\n  return [OBJECT, asString];\n};\n\nconst shouldSkip = ([TYPE, type]) => (\n  TYPE === PRIMITIVE &&\n  (type === 'function' || type === 'symbol')\n);\n\nconst serializer = (strict, json, $, _) => {\n\n  const as = (out, value) => {\n    const index = _.push(out) - 1;\n    $.set(value, index);\n    return index;\n  };\n\n  const pair = value => {\n    if ($.has(value))\n      return $.get(value);\n\n    let [TYPE, type] = typeOf(value);\n    switch (TYPE) {\n      case PRIMITIVE: {\n        let entry = value;\n        switch (type) {\n          case 'bigint':\n            TYPE = BIGINT;\n            entry = value.toString();\n            break;\n          case 'function':\n          case 'symbol':\n            if (strict)\n              throw new TypeError('unable to serialize ' + type);\n            entry = null;\n            break;\n          case 'undefined':\n            return as([VOID], value);\n        }\n        return as([TYPE, entry], value);\n      }\n      case ARRAY: {\n        if (type) {\n          let spread = value;\n          if (type === 'DataView') {\n            spread = new Uint8Array(value.buffer);\n          }\n          else if (type === 'ArrayBuffer') {\n            spread = new Uint8Array(value);\n          }\n          return as([type, [...spread]], value);\n        }\n\n        const arr = [];\n        const index = as([TYPE, arr], value);\n        for (const entry of value)\n          arr.push(pair(entry));\n        return index;\n      }\n      case OBJECT: {\n        if (type) {\n          switch (type) {\n            case 'BigInt':\n              return as([type, value.toString()], value);\n            case 'Boolean':\n            case 'Number':\n            case 'String':\n              return as([type, value.valueOf()], value);\n          }\n        }\n\n        if (json && ('toJSON' in value))\n          return pair(value.toJSON());\n\n        const entries = [];\n        const index = as([TYPE, entries], value);\n        for (const key of keys(value)) {\n          if (strict || !shouldSkip(typeOf(value[key])))\n            entries.push([pair(key), pair(value[key])]);\n        }\n        return index;\n      }\n      case DATE:\n        return as([TYPE, value.toISOString()], value);\n      case REGEXP: {\n        const {source, flags} = value;\n        return as([TYPE, {source, flags}], value);\n      }\n      case MAP: {\n        const entries = [];\n        const index = as([TYPE, entries], value);\n        for (const [key, entry] of value) {\n          if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))\n            entries.push([pair(key), pair(entry)]);\n        }\n        return index;\n      }\n      case SET: {\n        const entries = [];\n        const index = as([TYPE, entries], value);\n        for (const entry of value) {\n          if (strict || !shouldSkip(typeOf(entry)))\n            entries.push(pair(entry));\n        }\n        return index;\n      }\n    }\n\n    const {message} = value;\n    return as([TYPE, {name: type, message}], value);\n  };\n\n  return pair;\n};\n\n/**\n * @typedef {Array<string,any>} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} value a serializable value.\n * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that,\n *  if `true`, will not throw errors on incompatible types, and behave more\n *  like JSON stringify would behave. Symbol and Function will be discarded.\n * @returns {Record[]}\n */\n export const serialize = (value, {json, lossy} = {}) => {\n  const _ = [];\n  return serializer(!(json || lossy), !!json, new Map, _)(value), _;\n};\n","import {deserialize} from './deserialize.js';\nimport {serialize} from './serialize.js';\n\n/**\n * @typedef {Array<string,any>} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} any a serializable value.\n * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with\n * a transfer option (ignored when polyfilled) and/or non standard fields that\n * fallback to the polyfill if present.\n * @returns {Record[]}\n */\nexport default typeof structuredClone === \"function\" ?\n  /* c8 ignore start */\n  (any, options) => (\n    options && ('json' in options || 'lossy' in options) ?\n      deserialize(serialize(any, options)) : structuredClone(any)\n  ) :\n  (any, options) => deserialize(serialize(any, options));\n  /* c8 ignore stop */\n\nexport {deserialize, serialize};\n","import { asciiAlphanumeric } from 'micromark-util-character';\nimport { encode } from 'micromark-util-encode';\n/**\n * Make a value safe for injection as a URL.\n *\n * This encodes unsafe characters with percent-encoding and skips already\n * encoded sequences (see `normalizeUri`).\n * Further unsafe characters are encoded as character references (see\n * `micromark-util-encode`).\n *\n * A regex of allowed protocols can be given, in which case the URL is\n * sanitized.\n * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or\n * `/^https?$/i` for `img[src]` (this is what `github.com` allows).\n * If the URL includes an unknown protocol (one not matched by `protocol`, such\n * as a dangerous example, `javascript:`), the value is ignored.\n *\n * @param {string | null | undefined} url\n *   URI to sanitize.\n * @param {RegExp | null | undefined} [protocol]\n *   Allowed protocols.\n * @returns {string}\n *   Sanitized URI.\n */\nexport function sanitizeUri(url, protocol) {\n  const value = encode(normalizeUri(url || ''));\n  if (!protocol) {\n    return value;\n  }\n  const colon = value.indexOf(':');\n  const questionMark = value.indexOf('?');\n  const numberSign = value.indexOf('#');\n  const slash = value.indexOf('/');\n  if (\n  // If there is no protocol, it’s relative.\n  colon < 0 ||\n  // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.\n  slash > -1 && colon > slash || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign ||\n  // It is a protocol, it should be allowed.\n  protocol.test(value.slice(0, colon))) {\n    return value;\n  }\n  return '';\n}\n\n/**\n * Normalize a URL.\n *\n * Encode unsafe characters with percent-encoding, skipping already encoded\n * sequences.\n *\n * @param {string} value\n *   URI to normalize.\n * @returns {string}\n *   Normalized URI.\n */\nexport function normalizeUri(value) {\n  /** @type {Array<string>} */\n  const result = [];\n  let index = -1;\n  let start = 0;\n  let skip = 0;\n  while (++index < value.length) {\n    const code = value.charCodeAt(index);\n    /** @type {string} */\n    let replace = '';\n\n    // A correct percent encoded value.\n    if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) {\n      skip = 2;\n    }\n    // ASCII.\n    else if (code < 128) {\n      if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {\n        replace = String.fromCharCode(code);\n      }\n    }\n    // Astral.\n    else if (code > 55_295 && code < 57_344) {\n      const next = value.charCodeAt(index + 1);\n\n      // A correct surrogate pair.\n      if (code < 56_320 && next > 56_319 && next < 57_344) {\n        replace = String.fromCharCode(code, next);\n        skip = 1;\n      }\n      // Lone surrogate.\n      else {\n        replace = \"\\uFFFD\";\n      }\n    }\n    // Unicode.\n    else {\n      replace = String.fromCharCode(code);\n    }\n    if (replace) {\n      result.push(value.slice(start, index), encodeURIComponent(replace));\n      start = index + skip + 1;\n      replace = '';\n    }\n    if (skip) {\n      index += skip;\n      skip = 0;\n    }\n  }\n  return result.join('') + value.slice(start);\n}","/**\n * @import {ElementContent, Element} from 'hast'\n * @import {State} from './state.js'\n */\n\n/**\n * @callback FootnoteBackContentTemplate\n *   Generate content for the backreference dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array<ElementContent> | ElementContent | string}\n *   Content for the backreference when linking back from definitions to their\n *   reference.\n *\n * @callback FootnoteBackLabelTemplate\n *   Generate a back label dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Back label to use when linking back from definitions to their reference.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Generate the default content that GitHub uses on backreferences.\n *\n * @param {number} _\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array<ElementContent>}\n *   Content.\n */\nexport function defaultFootnoteBackContent(_, rereferenceIndex) {\n  /** @type {Array<ElementContent>} */\n  const result = [{type: 'text', value: '↩'}]\n\n  if (rereferenceIndex > 1) {\n    result.push({\n      type: 'element',\n      tagName: 'sup',\n      properties: {},\n      children: [{type: 'text', value: String(rereferenceIndex)}]\n    })\n  }\n\n  return result\n}\n\n/**\n * Generate the default label that GitHub uses on backreferences.\n *\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Label.\n */\nexport function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n  return (\n    'Back to reference ' +\n    (referenceIndex + 1) +\n    (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n  )\n}\n\n/**\n * Generate a hast footer for called footnote definitions.\n *\n * @param {State} state\n *   Info passed around.\n * @returns {Element | undefined}\n *   `section` element or `undefined`.\n */\n// eslint-disable-next-line complexity\nexport function footer(state) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const footnoteBackContent =\n    state.options.footnoteBackContent || defaultFootnoteBackContent\n  const footnoteBackLabel =\n    state.options.footnoteBackLabel || defaultFootnoteBackLabel\n  const footnoteLabel = state.options.footnoteLabel || 'Footnotes'\n  const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'\n  const footnoteLabelProperties = state.options.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  /** @type {Array<ElementContent>} */\n  const listItems = []\n  let referenceIndex = -1\n\n  while (++referenceIndex < state.footnoteOrder.length) {\n    const definition = state.footnoteById.get(\n      state.footnoteOrder[referenceIndex]\n    )\n\n    if (!definition) {\n      continue\n    }\n\n    const content = state.all(definition)\n    const id = String(definition.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let rereferenceIndex = 0\n    /** @type {Array<ElementContent>} */\n    const backReferences = []\n    const counts = state.footnoteCounts.get(id)\n\n    // eslint-disable-next-line no-unmodified-loop-condition\n    while (counts !== undefined && ++rereferenceIndex <= counts) {\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      let children =\n        typeof footnoteBackContent === 'string'\n          ? footnoteBackContent\n          : footnoteBackContent(referenceIndex, rereferenceIndex)\n\n      if (typeof children === 'string') {\n        children = {type: 'text', value: children}\n      }\n\n      backReferences.push({\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            clobberPrefix +\n            'fnref-' +\n            safeId +\n            (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),\n          dataFootnoteBackref: '',\n          ariaLabel:\n            typeof footnoteBackLabel === 'string'\n              ? footnoteBackLabel\n              : footnoteBackLabel(referenceIndex, rereferenceIndex),\n          className: ['data-footnote-backref']\n        },\n        children: Array.isArray(children) ? children : [children]\n      })\n    }\n\n    const tail = content[content.length - 1]\n\n    if (tail && tail.type === 'element' && tail.tagName === 'p') {\n      const tailTail = tail.children[tail.children.length - 1]\n      if (tailTail && tailTail.type === 'text') {\n        tailTail.value += ' '\n      } else {\n        tail.children.push({type: 'text', value: ' '})\n      }\n\n      tail.children.push(...backReferences)\n    } else {\n      content.push(...backReferences)\n    }\n\n    /** @type {Element} */\n    const listItem = {\n      type: 'element',\n      tagName: 'li',\n      properties: {id: clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(definition, listItem)\n\n    listItems.push(listItem)\n  }\n\n  if (listItems.length === 0) {\n    return\n  }\n\n  return {\n    type: 'element',\n    tagName: 'section',\n    properties: {dataFootnotes: true, className: ['footnotes']},\n    children: [\n      {\n        type: 'element',\n        tagName: footnoteLabelTagName,\n        properties: {\n          ...structuredClone(footnoteLabelProperties),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: footnoteLabel}]\n      },\n      {type: 'text', value: '\\n'},\n      {\n        type: 'element',\n        tagName: 'ol',\n        properties: {},\n        children: state.wrap(listItems, true)\n      },\n      {type: 'text', value: '\\n'}\n    ]\n  }\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Get the ending point of `node`.\n *\n * @param node\n *   Node.\n * @returns\n *   Point.\n */\nexport const pointEnd = point('end')\n\n/**\n * Get the starting point of `node`.\n *\n * @param node\n *   Node.\n * @returns\n *   Point.\n */\nexport const pointStart = point('start')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'end' | 'start'} type\n *   Side.\n * @returns\n *   Getter.\n */\nfunction point(type) {\n  return point\n\n  /**\n   * Get the point info of `node` at a bound side.\n   *\n   * @param {Node | NodeLike | null | undefined} [node]\n   * @returns {Point | undefined}\n   */\n  function point(node) {\n    const point = (node && node.position && node.position[type]) || {}\n\n    if (\n      typeof point.line === 'number' &&\n      point.line > 0 &&\n      typeof point.column === 'number' &&\n      point.column > 0\n    ) {\n      return {\n        line: point.line,\n        column: point.column,\n        offset:\n          typeof point.offset === 'number' && point.offset > -1\n            ? point.offset\n            : undefined\n      }\n    }\n  }\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {Node | NodeLike | null | undefined} [node]\n *   Node.\n * @returns {Position | undefined}\n *   Position.\n */\nexport function position(node) {\n  const start = pointStart(node)\n  const end = pointEnd(node)\n\n  if (start && end) {\n    return {start, end}\n  }\n}\n","/**\n * @import {ElementContent} from 'hast'\n * @import {Reference, Nodes} from 'mdast'\n * @import {State} from './state.js'\n */\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Extract<Nodes, Reference>} node\n *   Reference node (image, link).\n * @returns {Array<ElementContent>}\n *   hast content.\n */\nexport function revert(state, node) {\n  const subtype = node.referenceType\n  let suffix = ']'\n\n  if (subtype === 'collapsed') {\n    suffix += '[]'\n  } else if (subtype === 'full') {\n    suffix += '[' + (node.label || node.identifier) + ']'\n  }\n\n  if (node.type === 'imageReference') {\n    return [{type: 'text', value: '![' + node.alt + suffix}]\n  }\n\n  const contents = state.all(node)\n  const head = contents[0]\n\n  if (head && head.type === 'text') {\n    head.value = '[' + head.value\n  } else {\n    contents.unshift({type: 'text', value: '['})\n  }\n\n  const tail = contents[contents.length - 1]\n\n  if (tail && tail.type === 'text') {\n    tail.value += suffix\n  } else {\n    contents.push({type: 'text', value: suffix})\n  }\n\n  return contents\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ListItem, Parents} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `listItem` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ListItem} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function listItem(state, node, parent) {\n  const results = state.all(node)\n  const loose = parent ? listLoose(parent) : listItemLoose(node)\n  /** @type {Properties} */\n  const properties = {}\n  /** @type {Array<ElementContent>} */\n  const children = []\n\n  if (typeof node.checked === 'boolean') {\n    const head = results[0]\n    /** @type {Element} */\n    let paragraph\n\n    if (head && head.type === 'element' && head.tagName === 'p') {\n      paragraph = head\n    } else {\n      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}\n      results.unshift(paragraph)\n    }\n\n    if (paragraph.children.length > 0) {\n      paragraph.children.unshift({type: 'text', value: ' '})\n    }\n\n    paragraph.children.unshift({\n      type: 'element',\n      tagName: 'input',\n      properties: {type: 'checkbox', checked: node.checked, disabled: true},\n      children: []\n    })\n\n    // According to github-markdown-css, this class hides bullet.\n    // See: <https://github.com/sindresorhus/github-markdown-css>.\n    properties.className = ['task-list-item']\n  }\n\n  let index = -1\n\n  while (++index < results.length) {\n    const child = results[index]\n\n    // Add eols before nodes, except if this is a loose, first paragraph.\n    if (\n      loose ||\n      index !== 0 ||\n      child.type !== 'element' ||\n      child.tagName !== 'p'\n    ) {\n      children.push({type: 'text', value: '\\n'})\n    }\n\n    if (child.type === 'element' && child.tagName === 'p' && !loose) {\n      children.push(...child.children)\n    } else {\n      children.push(child)\n    }\n  }\n\n  const tail = results[results.length - 1]\n\n  // Add a final eol.\n  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {\n    children.push({type: 'text', value: '\\n'})\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'li', properties, children}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * @param {Parents} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n  let loose = false\n  if (node.type === 'list') {\n    loose = node.spread || false\n    const children = node.children\n    let index = -1\n\n    while (!loose && ++index < children.length) {\n      loose = listItemLoose(children[index])\n    }\n  }\n\n  return loose\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n  const spread = node.spread\n\n  return spread === null || spread === undefined\n    ? node.children.length > 1\n    : spread\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Trimmed value.\n */\nexport function trimLines(value) {\n  const source = String(value)\n  const search = /\\r?\\n|\\r/g\n  let match = search.exec(source)\n  let last = 0\n  /** @type {Array<string>} */\n  const lines = []\n\n  while (match) {\n    lines.push(\n      trimLine(source.slice(last, match.index), last > 0, true),\n      match[0]\n    )\n\n    last = match.index + match[0].length\n    match = search.exec(source)\n  }\n\n  lines.push(trimLine(source.slice(last), last > 0, false))\n\n  return lines.join('')\n}\n\n/**\n * @param {string} value\n *   Line to trim.\n * @param {boolean} start\n *   Whether to trim the start of the line.\n * @param {boolean} end\n *   Whether to trim the end of the line.\n * @returns {string}\n *   Trimmed line.\n */\nfunction trimLine(value, start, end) {\n  let startIndex = 0\n  let endIndex = value.length\n\n  if (start) {\n    let code = value.codePointAt(startIndex)\n\n    while (code === tab || code === space) {\n      startIndex++\n      code = value.codePointAt(startIndex)\n    }\n  }\n\n  if (end) {\n    let code = value.codePointAt(endIndex - 1)\n\n    while (code === tab || code === space) {\n      endIndex--\n      code = value.codePointAt(endIndex - 1)\n    }\n  }\n\n  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","/**\n * @import {Handlers} from '../state.js'\n */\n\nimport {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {tableRow} from './table-row.js'\nimport {tableCell} from './table-cell.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default handlers for nodes.\n *\n * @satisfies {Handlers}\n */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\n  // @ts-expect-error: root is different, but hard to type.\n  root,\n  strong,\n  table,\n  tableCell,\n  tableRow,\n  text,\n  thematicBreak,\n  toml: ignore,\n  yaml: ignore,\n  definition: ignore,\n  footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n  return undefined\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `blockquote` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Blockquote} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function blockquote(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'blockquote',\n    properties: {},\n    children: state.wrap(state.all(node), true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {Break} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `break` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Break} node\n *   mdast node.\n * @returns {Array<Element | Text>}\n *   hast element content.\n */\nexport function hardBreak(state, node) {\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'br', properties: {}, children: []}\n  state.patch(node, result)\n  return [state.applyData(node, result), {type: 'text', value: '\\n'}]\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Code} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `code` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Code} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function code(state, node) {\n  const value = node.value ? node.value + '\\n' : ''\n  /** @type {Properties} */\n  const properties = {}\n  // Someone can write `js&#x20;python&#x9;ruby`.\n  const language = node.lang ? node.lang.split(/\\s+/) : []\n\n  // GH/CM still drop the non-first languages.\n  if (language.length > 0) {\n    properties.className = ['language-' + language[0]]\n  }\n\n  // Create `<code>`.\n  /** @type {Element} */\n  let result = {\n    type: 'element',\n    tagName: 'code',\n    properties,\n    children: [{type: 'text', value}]\n  }\n\n  if (node.meta) {\n    result.data = {meta: node.meta}\n  }\n\n  state.patch(node, result)\n  result = state.applyData(node, result)\n\n  // Create `<pre>`.\n  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Delete} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `delete` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Delete} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strikethrough(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'del',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Emphasis} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `emphasis` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Emphasis} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function emphasis(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'em',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {FootnoteReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `footnoteReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {FootnoteReference} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnoteReference(state, node) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const id = String(node.identifier).toUpperCase()\n  const safeId = normalizeUri(id.toLowerCase())\n  const index = state.footnoteOrder.indexOf(id)\n  /** @type {number} */\n  let counter\n\n  let reuseCounter = state.footnoteCounts.get(id)\n\n  if (reuseCounter === undefined) {\n    reuseCounter = 0\n    state.footnoteOrder.push(id)\n    counter = state.footnoteOrder.length\n  } else {\n    counter = index + 1\n  }\n\n  reuseCounter += 1\n  state.footnoteCounts.set(id, reuseCounter)\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + clobberPrefix + 'fn-' + safeId,\n      id:\n        clobberPrefix +\n        'fnref-' +\n        safeId +\n        (reuseCounter > 1 ? '-' + reuseCounter : ''),\n      dataFootnoteRef: true,\n      ariaDescribedBy: ['footnote-label']\n    },\n    children: [{type: 'text', value: String(counter)}]\n  }\n  state.patch(node, link)\n\n  /** @type {Element} */\n  const sup = {\n    type: 'element',\n    tagName: 'sup',\n    properties: {},\n    children: [link]\n  }\n  state.patch(node, sup)\n  return state.applyData(node, sup)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Heading} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `heading` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Heading} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function heading(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'h' + node.depth,\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Html} from 'mdast'\n * @import {State} from '../state.js'\n * @import {Raw} from '../../index.js'\n */\n\n/**\n * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise\n * nothing).\n *\n * @param {State} state\n *   Info passed around.\n * @param {Html} node\n *   mdast node.\n * @returns {Element | Raw | undefined}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.options.allowDangerousHtml) {\n    /** @type {Raw} */\n    const result = {type: 'raw', value: node.value}\n    state.patch(node, result)\n    return state.applyData(node, result)\n  }\n\n  return undefined\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ImageReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `imageReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ImageReference} node\n *   mdast node.\n * @returns {Array<ElementContent> | ElementContent}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Image} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `image` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Image} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function image(state, node) {\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(node.url)}\n\n  if (node.alt !== null && node.alt !== undefined) {\n    properties.alt = node.alt\n  }\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {InlineCode} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `inlineCode` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {InlineCode} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {Text} */\n  const text = {type: 'text', value: node.value.replace(/\\r?\\n|\\r/g, ' ')}\n  state.patch(node, text)\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'code',\n    properties: {},\n    children: [text]\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {LinkReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `linkReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {LinkReference} node\n *   mdast node.\n * @returns {Array<ElementContent> | ElementContent}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(definition.url || '')}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Link} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `link` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Link} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function link(state, node) {\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(node.url)}\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {List} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `list` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {List} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function list(state, node) {\n  /** @type {Properties} */\n  const properties = {}\n  const results = state.all(node)\n  let index = -1\n\n  if (typeof node.start === 'number' && node.start !== 1) {\n    properties.start = node.start\n  }\n\n  // Like GitHub, add a class for custom styling.\n  while (++index < results.length) {\n    const child = results[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'li' &&\n      child.properties &&\n      Array.isArray(child.properties.className) &&\n      child.properties.className.includes('task-list-item')\n    ) {\n      properties.className = ['contains-task-list']\n      break\n    }\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: node.ordered ? 'ol' : 'ul',\n    properties,\n    children: state.wrap(results, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Paragraph} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `paragraph` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Paragraph} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function paragraph(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'p',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Parents as HastParents, Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `root` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastRoot} node\n *   mdast node.\n * @returns {HastParents}\n *   hast node.\n */\nexport function root(state, node) {\n  /** @type {HastRoot} */\n  const result = {type: 'root', children: state.wrap(state.all(node))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Strong} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `strong` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Strong} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strong(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'strong',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Table} from 'mdast'\n * @import {Element} from 'hast'\n * @import {State} from '../state.js'\n */\n\nimport {pointEnd, pointStart} from 'unist-util-position'\n\n/**\n * Turn an mdast `table` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Table} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function table(state, node) {\n  const rows = state.all(node)\n  const firstRow = rows.shift()\n  /** @type {Array<Element>} */\n  const tableContent = []\n\n  if (firstRow) {\n    /** @type {Element} */\n    const head = {\n      type: 'element',\n      tagName: 'thead',\n      properties: {},\n      children: state.wrap([firstRow], true)\n    }\n    state.patch(node.children[0], head)\n    tableContent.push(head)\n  }\n\n  if (rows.length > 0) {\n    /** @type {Element} */\n    const body = {\n      type: 'element',\n      tagName: 'tbody',\n      properties: {},\n      children: state.wrap(rows, true)\n    }\n\n    const start = pointStart(node.children[1])\n    const end = pointEnd(node.children[node.children.length - 1])\n    if (start && end) body.position = {start, end}\n    tableContent.push(body)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'table',\n    properties: {},\n    children: state.wrap(tableContent, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {TableCell} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableCell` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableCell} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function tableCell(state, node) {\n  // Note: this function is normally not called: see `table-row` for how rows\n  // and their cells are compiled.\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'td', // Assume body cell.\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, ElementContent, Properties} from 'hast'\n * @import {Parents, TableRow} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableRow` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableRow} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function tableRow(state, node, parent) {\n  const siblings = parent ? parent.children : undefined\n  // Generate a body row when without parent.\n  const rowIndex = siblings ? siblings.indexOf(node) : 1\n  const tagName = rowIndex === 0 ? 'th' : 'td'\n  // To do: option to use `style`?\n  const align = parent && parent.type === 'table' ? parent.align : undefined\n  const length = align ? align.length : node.children.length\n  let cellIndex = -1\n  /** @type {Array<ElementContent>} */\n  const cells = []\n\n  while (++cellIndex < length) {\n    // Note: can also be undefined.\n    const cell = node.children[cellIndex]\n    /** @type {Properties} */\n    const properties = {}\n    const alignValue = align ? align[cellIndex] : undefined\n\n    if (alignValue) {\n      properties.align = alignValue\n    }\n\n    /** @type {Element} */\n    let result = {type: 'element', tagName, properties, children: []}\n\n    if (cell) {\n      result.children = state.all(cell)\n      state.patch(cell, result)\n      result = state.applyData(cell, result)\n    }\n\n    cells.push(result)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'tr',\n    properties: {},\n    children: state.wrap(cells, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element as HastElement, Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {trimLines} from 'trim-lines'\n\n/**\n * Turn an mdast `text` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastText} node\n *   mdast node.\n * @returns {HastElement | HastText}\n *   hast node.\n */\nexport function text(state, node) {\n  /** @type {HastText} */\n  const result = {type: 'text', value: trimLines(String(node.value))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `thematicBreak` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ThematicBreak} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function thematicBreak(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'hr',\n    properties: {},\n    children: []\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {\n *   ElementContent as HastElementContent,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Text as HastText\n * } from 'hast'\n * @import {\n *   Definition as MdastDefinition,\n *   FootnoteDefinition as MdastFootnoteDefinition,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents\n * } from 'mdast'\n * @import {VFile} from 'vfile'\n * @import {\n *   FootnoteBackContentTemplate,\n *   FootnoteBackLabelTemplate\n * } from './footer.js'\n */\n\n/**\n * @callback Handler\n *   Handle a node.\n * @param {State} state\n *   Info passed around.\n * @param {any} node\n *   mdast node to handle.\n * @param {MdastParents | undefined} parent\n *   Parent of `node`.\n * @returns {Array<HastElementContent> | HastElementContent | undefined}\n *   hast node.\n *\n * @typedef {Partial<Record<MdastNodes['type'], Handler>>} Handlers\n *   Handle nodes.\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Whether to persist raw HTML in markdown in the hast tree (default:\n *   `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` property on footnotes to prevent them from\n *   *clobbering* (default: `'user-content-'`).\n *\n *   Pass `''` for trusted markdown and when you are careful with\n *   polyfilling.\n *   You could pass a different prefix.\n *\n *   DOM clobbering is this:\n *\n *   ```html\n *   <p id=\"x\"></p>\n *   <script>alert(x) // `x` now refers to the `p#x` DOM element</script>\n *   ```\n *\n *   The above example shows that elements are made available by browsers, by\n *   their ID, on the `window` object.\n *   This is a security risk because you might be expecting some other variable\n *   at that place.\n *   It can also break polyfills.\n *   Using a prefix solves these problems.\n * @property {VFile | null | undefined} [file]\n *   Corresponding virtual file representing the input document (optional).\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n *   Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n *   The default value is:\n *\n *   ```js\n *   function defaultFootnoteBackContent(_, rereferenceIndex) {\n *     const result = [{type: 'text', value: '↩'}]\n *\n *     if (rereferenceIndex > 1) {\n *       result.push({\n *         type: 'element',\n *         tagName: 'sup',\n *         properties: {},\n *         children: [{type: 'text', value: String(rereferenceIndex)}]\n *       })\n *     }\n *\n *     return result\n *   }\n *   ```\n *\n *   This content is used in the `a` element of each backreference (the `↩`\n *   links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n *   Label to describe the backreference back to references (default:\n *   `defaultFootnoteBackLabel`).\n *\n *   The default value is:\n *\n *   ```js\n *   function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n *    return (\n *      'Back to reference ' +\n *      (referenceIndex + 1) +\n *      (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n *    )\n *   }\n *   ```\n *\n *   Change it when the markdown is not in English.\n *\n *   This label is used in the `ariaLabel` property on each backreference\n *   (the `↩` links).\n *   It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n *   Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n *   Change it when the markdown is not in English.\n *\n *   This label is typically hidden visually (assuming a `sr-only` CSS class\n *   is defined that does that) and so affects screen readers only.\n *   If you do have such a class, but want to show this section to everyone,\n *   pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n *   Properties to use on the footnote label (default: `{className:\n *   ['sr-only']}`).\n *\n *   Change it to show the label and add other properties.\n *\n *   This label is typically hidden visually (assuming an `sr-only` CSS class\n *   is defined that does that) and so affects screen readers only.\n *   If you do have such a class, but want to show this section to everyone,\n *   pass an empty string.\n *   You can also add different properties.\n *\n *   > **Note**: `id: 'footnote-label'` is always added, because footnote\n *   > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n *   HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n *   Change it to match your document structure.\n *\n *   This label is typically hidden visually (assuming a `sr-only` CSS class\n *   is defined that does that) and so affects screen readers only.\n *   If you do have such a class, but want to show this section to everyone,\n *   pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n *   Extra handlers for nodes (optional).\n * @property {Array<MdastNodes['type']> | null | undefined} [passThrough]\n *   List of custom mdast node types to pass through (keep) in hast (note that\n *   the node itself is passed, but eventual children are transformed)\n *   (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n *   Handler for all unknown nodes (optional).\n *\n * @typedef State\n *   Info passed around.\n * @property {(node: MdastNodes) => Array<HastElementContent>} all\n *   Transform the children of an mdast parent to hast.\n * @property {<Type extends HastNodes>(from: MdastNodes, to: Type) => HastElement | Type} applyData\n *   Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map<string, MdastDefinition>} definitionById\n *   Definitions by their identifier.\n * @property {Map<string, MdastFootnoteDefinition>} footnoteById\n *   Footnote definitions by their identifier.\n * @property {Map<string, number>} footnoteCounts\n *   Counts for how often the same footnote was called.\n * @property {Array<string>} footnoteOrder\n *   Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n *   Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array<HastElementContent> | HastElementContent | undefined} one\n *   Transform an mdast node to hast.\n * @property {Options} options\n *   Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n *   Copy a node’s positional info.\n * @property {<Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined) => Array<HastText | Type>} wrap\n *   Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {visit} from 'unist-util-visit'\nimport {position} from 'unist-util-position'\nimport {handlers as defaultHandlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n *   mdast node to transform.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {State}\n *   `state` function.\n */\nexport function createState(tree, options) {\n  const settings = options || emptyOptions\n  /** @type {Map<string, MdastDefinition>} */\n  const definitionById = new Map()\n  /** @type {Map<string, MdastFootnoteDefinition>} */\n  const footnoteById = new Map()\n  /** @type {Map<string, number>} */\n  const footnoteCounts = new Map()\n  /** @type {Handlers} */\n  // @ts-expect-error: the root handler returns a root.\n  // Hard to type.\n  const handlers = {...defaultHandlers, ...settings.handlers}\n\n  /** @type {State} */\n  const state = {\n    all,\n    applyData,\n    definitionById,\n    footnoteById,\n    footnoteCounts,\n    footnoteOrder: [],\n    handlers,\n    one,\n    options: settings,\n    patch,\n    wrap\n  }\n\n  visit(tree, function (node) {\n    if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n      const map = node.type === 'definition' ? definitionById : footnoteById\n      const id = String(node.identifier).toUpperCase()\n\n      // Mimick CM behavior of link definitions.\n      // See: <https://github.com/syntax-tree/mdast-util-definitions/blob/9032189/lib/index.js#L20-L21>.\n      if (!map.has(id)) {\n        // @ts-expect-error: node type matches map.\n        map.set(id, node)\n      }\n    }\n  })\n\n  return state\n\n  /**\n   * Transform an mdast node into a hast node.\n   *\n   * @param {MdastNodes} node\n   *   mdast node.\n   * @param {MdastParents | undefined} [parent]\n   *   Parent of `node`.\n   * @returns {Array<HastElementContent> | HastElementContent | undefined}\n   *   Resulting hast node.\n   */\n  function one(node, parent) {\n    const type = node.type\n    const handle = state.handlers[type]\n\n    if (own.call(state.handlers, type) && handle) {\n      return handle(state, node, parent)\n    }\n\n    if (state.options.passThrough && state.options.passThrough.includes(type)) {\n      if ('children' in node) {\n        const {children, ...shallow} = node\n        const result = structuredClone(shallow)\n        // @ts-expect-error: TS doesn’t understand…\n        result.children = state.all(node)\n        // @ts-expect-error: TS doesn’t understand…\n        return result\n      }\n\n      // @ts-expect-error: it’s custom.\n      return structuredClone(node)\n    }\n\n    const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n    return unknown(state, node, parent)\n  }\n\n  /**\n   * Transform the children of an mdast node into hast nodes.\n   *\n   * @param {MdastNodes} parent\n   *   mdast node to compile\n   * @returns {Array<HastElementContent>}\n   *   Resulting hast nodes.\n   */\n  function all(parent) {\n    /** @type {Array<HastElementContent>} */\n    const values = []\n\n    if ('children' in parent) {\n      const nodes = parent.children\n      let index = -1\n      while (++index < nodes.length) {\n        const result = state.one(nodes[index], parent)\n\n        // To do: see if we van clean this? Can we merge texts?\n        if (result) {\n          if (index && nodes[index - 1].type === 'break') {\n            if (!Array.isArray(result) && result.type === 'text') {\n              result.value = trimMarkdownSpaceStart(result.value)\n            }\n\n            if (!Array.isArray(result) && result.type === 'element') {\n              const head = result.children[0]\n\n              if (head && head.type === 'text') {\n                head.value = trimMarkdownSpaceStart(head.value)\n              }\n            }\n          }\n\n          if (Array.isArray(result)) {\n            values.push(...result)\n          } else {\n            values.push(result)\n          }\n        }\n      }\n    }\n\n    return values\n  }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {MdastNodes} from\n *   mdast node to copy from.\n * @param {HastNodes} to\n *   hast node to copy into.\n * @returns {undefined}\n *   Nothing.\n */\nfunction patch(from, to) {\n  if (from.position) to.position = position(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n *   Node type.\n * @param {MdastNodes} from\n *   mdast node to use data from.\n * @param {Type} to\n *   hast node to change.\n * @returns {HastElement | Type}\n *   Nothing.\n */\nfunction applyData(from, to) {\n  /** @type {HastElement | Type} */\n  let result = to\n\n  // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n  if (from && from.data) {\n    const hName = from.data.hName\n    const hChildren = from.data.hChildren\n    const hProperties = from.data.hProperties\n\n    if (typeof hName === 'string') {\n      // Transforming the node resulted in an element with a different name\n      // than wanted:\n      if (result.type === 'element') {\n        result.tagName = hName\n      }\n      // Transforming the node resulted in a non-element, which happens for\n      // raw, text, and root nodes (unless custom handlers are passed).\n      // The intent of `hName` is to create an element, but likely also to keep\n      // the content around (otherwise: pass `hChildren`).\n      else {\n        /** @type {Array<HastElementContent>} */\n        // @ts-expect-error: assume no doctypes in `root`.\n        const children = 'children' in result ? result.children : [result]\n        result = {type: 'element', tagName: hName, properties: {}, children}\n      }\n    }\n\n    if (result.type === 'element' && hProperties) {\n      Object.assign(result.properties, structuredClone(hProperties))\n    }\n\n    if (\n      'children' in result &&\n      result.children &&\n      hChildren !== null &&\n      hChildren !== undefined\n    ) {\n      result.children = hChildren\n    }\n  }\n\n  return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} node\n *   Unknown mdast node.\n * @returns {HastElement | HastText}\n *   Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n  const data = node.data || {}\n  /** @type {HastElement | HastText} */\n  const result =\n    'value' in node &&\n    !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n      ? {type: 'text', value: node.value}\n      : {\n          type: 'element',\n          tagName: 'div',\n          properties: {},\n          children: state.all(node)\n        }\n\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n *   Node type.\n * @param {Array<Type>} nodes\n *   List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n *   Whether to add line endings at start and end (default: `false`).\n * @returns {Array<HastText | Type>}\n *   Wrapped nodes.\n */\nexport function wrap(nodes, loose) {\n  /** @type {Array<HastText | Type>} */\n  const result = []\n  let index = -1\n\n  if (loose) {\n    result.push({type: 'text', value: '\\n'})\n  }\n\n  while (++index < nodes.length) {\n    if (index) result.push({type: 'text', value: '\\n'})\n    result.push(nodes[index])\n  }\n\n  if (loose && nodes.length > 0) {\n    result.push({type: 'text', value: '\\n'})\n  }\n\n  return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n  let index = 0\n  let code = value.charCodeAt(index)\n\n  while (code === 9 || code === 32) {\n    index++\n    code = value.charCodeAt(index)\n  }\n\n  return value.slice(index)\n}\n","/**\n * @import {Nodes as HastNodes} from 'hast'\n * @import {Nodes as MdastNodes} from 'mdast'\n * @import {Options} from './state.js'\n */\n\nimport {ok as assert} from 'devlop'\nimport {footer} from './footer.js'\nimport {createState} from './state.js'\n\n/**\n * Transform mdast to hast.\n *\n * ##### Notes\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most utilities ignore `raw` nodes but two notable ones don’t:\n *\n * *   `hast-util-to-html` also has an option `allowDangerousHtml` which will\n *     output the raw HTML.\n *     This is typically discouraged as noted by the option name but is useful\n *     if you completely trust authors\n * *   `hast-util-raw` can handle the raw embedded HTML strings by parsing them\n *     into standard hast nodes (`element`, `text`, etc).\n *     This is a heavy task as it needs a full HTML parser, but it is the only\n *     way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark, which we follow by default.\n * They are supported by GitHub, so footnotes can be enabled in markdown with\n * `mdast-util-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes, which is hidden for sighted users but shown to\n * assistive technology.\n * When your page is not in English, you must define translated values.\n *\n * Back references use ARIA attributes, but the section label itself uses a\n * heading that is hidden with an `sr-only` class.\n * To show it to sighted users, define different attributes in\n * `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem, as it links footnote calls to footnote\n * definitions on the page through `id` attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n * <p id=x></p>\n * <script>alert(x) // `x` now refers to the DOM `p#x` element</script>\n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * *   when the node has a `value` (and doesn’t have `data.hName`,\n *     `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n *     node\n * *   otherwise, create a `<div>` element (which could be changed with\n *     `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n *   mdast tree.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {HastNodes}\n *   hast tree.\n */\nexport function toHast(tree, options) {\n  const state = createState(tree, options)\n  const node = state.one(tree, undefined)\n  const foot = footer(state)\n  /** @type {HastNodes} */\n  const result = Array.isArray(node)\n    ? {type: 'root', children: node}\n    : node || {type: 'root', children: []}\n\n  if (foot) {\n    // If there’s a footer, there were definitions, meaning block\n    // content.\n    // So `result` is a parent node.\n    assert('children' in result)\n    result.children.push({type: 'text', value: '\\n'}, foot)\n  }\n\n  return result\n}\n","/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Options as ToHastOptions} from 'mdast-util-to-hast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {Omit<ToHastOptions, 'file'>} Options\n *\n * @callback TransformBridge\n *   Bridge-mode.\n *\n *   Runs the destination with the new hast tree.\n *   Discards result.\n * @param {MdastRoot} tree\n *   Tree.\n * @param {VFile} file\n *   File.\n * @returns {Promise<undefined>}\n *   Nothing.\n *\n * @callback TransformMutate\n *  Mutate-mode.\n *\n *  Further transformers run on the hast tree.\n * @param {MdastRoot} tree\n *   Tree.\n * @param {VFile} file\n *   File.\n * @returns {HastRoot}\n *   Tree (hast).\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n/**\n * Turn markdown into HTML.\n *\n * ##### Notes\n *\n * ###### Signature\n *\n * * if a processor is given,\n *   runs the (rehype) plugins used on it with a hast tree,\n *   then discards the result (*bridge mode*)\n * * otherwise,\n *   returns a hast tree,\n *   the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)\n *\n * > 👉 **Note**:\n * > It’s highly unlikely that you want to pass a `processor`.\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most plugins ignore `raw` nodes but two notable ones don’t:\n *\n * * `rehype-stringify` also has an option `allowDangerousHtml` which will\n *   output the raw HTML.\n *   This is typically discouraged as noted by the option name but is useful if\n *   you completely trust authors\n * * `rehype-raw` can handle the raw embedded HTML strings by parsing them\n *   into standard hast nodes (`element`, `text`, etc);\n *   this is a heavy task as it needs a full HTML parser,\n *   but it is the only way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark,\n * which we follow by default.\n * They are supported by GitHub,\n * so footnotes can be enabled in markdown with `remark-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes,\n * which is hidden for sighted users but shown to assistive technology.\n * When your page is not in English,\n * you must define translated values.\n *\n * Back references use ARIA attributes,\n * but the section label itself uses a heading that is hidden with an\n * `sr-only` class.\n * To show it to sighted users,\n * define different attributes in `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem,\n * as it links footnote calls to footnote definitions on the page through `id`\n * attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n * <p id=x></p>\n * <script>alert(x) // `x` now refers to the DOM `p#x` element</script>\n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value`\n *   (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`,\n *   see later),\n *   create a hast `text` node\n * * otherwise,\n *   create a `<div>` element (which could be changed with `data.hName`),\n *   with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly<Options> | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly<Options> | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Readonly<Options> | Processor | null | undefined} [destination]\n * @param {Readonly<Options> | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Readonly<Options> | Processor | null | undefined} [destination]\n *   Processor or configuration (optional).\n * @param {Readonly<Options> | null | undefined} [options]\n *   When a processor was given,\n *   configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n *   Transform.\n */\nexport default function remarkRehype(destination, options) {\n  if (destination && 'run' in destination) {\n    /**\n     * @type {TransformBridge}\n     */\n    return async function (tree, file) {\n      // Cast because root in -> root out.\n      const hastTree = /** @type {HastRoot} */ (\n        toHast(tree, {file, ...options})\n      )\n      await destination.run(hastTree, file)\n    }\n  }\n\n  /**\n   * @type {TransformMutate}\n   */\n  return function (tree, file) {\n    // Cast because root in -> root out.\n    // To do: in the future, disallow ` || options` fallback.\n    // With `unified-engine`, `destination` can be `undefined` but\n    // `options` will be the file set.\n    // We should not pass that as `options`.\n    return /** @type {HastRoot} */ (\n      toHast(tree, {file, ...(destination || options)})\n    )\n  }\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction\n */\n\nimport {findAndReplace} from 'mdast-util-find-and-replace'\n\n/**\n * Turn normal line endings into hard breaks.\n *\n * @param {Nodes} tree\n *   Tree to change.\n * @returns {undefined}\n *   Nothing.\n */\nexport function newlineToBreak(tree) {\n  findAndReplace(tree, [/\\r?\\n|\\r/g, replace])\n}\n\n/**\n * Replace line endings.\n *\n * @type {ReplaceFunction}\n */\nfunction replace() {\n  return {type: 'break'}\n}\n","/**\n * @typedef {import('mdast').Root} Root\n */\n\nimport {newlineToBreak} from 'mdast-util-newline-to-break'\n\n/**\n * Support hard breaks without needing spaces or escapes (turns enters into\n * `<br>`s).\n *\n * @returns\n *   Transform.\n */\nexport default function remarkBreaks() {\n  /**\n   * Transform.\n   *\n   * @param {Root} tree\n   *   Tree.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  return function (tree) {\n    newlineToBreak(tree)\n  }\n}\n","/**\n * @import {Schema as SchemaType, Space} from 'property-information'\n */\n\n/** @type {SchemaType} */\nexport class Schema {\n  /**\n   * @param {SchemaType['property']} property\n   *   Property.\n   * @param {SchemaType['normal']} normal\n   *   Normal.\n   * @param {Space | undefined} [space]\n   *   Space.\n   * @returns\n   *   Schema.\n   */\n  constructor(property, normal, space) {\n    this.normal = normal\n    this.property = property\n\n    if (space) {\n      this.space = space\n    }\n  }\n}\n\nSchema.prototype.normal = {}\nSchema.prototype.property = {}\nSchema.prototype.space = undefined\n","/**\n * @import {Info, Space} from 'property-information'\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {ReadonlyArray<Schema>} definitions\n *   Definitions.\n * @param {Space | undefined} [space]\n *   Space.\n * @returns {Schema}\n *   Schema.\n */\nexport function merge(definitions, space) {\n  /** @type {Record<string, Info>} */\n  const property = {}\n  /** @type {Record<string, string>} */\n  const normal = {}\n\n  for (const definition of definitions) {\n    Object.assign(property, definition.property)\n    Object.assign(normal, definition.normal)\n  }\n\n  return new Schema(property, normal, space)\n}\n","/**\n * Get the cleaned case insensitive form of an attribute or property.\n *\n * @param {string} value\n *   An attribute-like or property-like name.\n * @returns {string}\n *   Value that can be used to look up the properly cased property on a\n *   `Schema`.\n */\nexport function normalize(value) {\n  return value.toLowerCase()\n}\n","/**\n * @import {Info as InfoType} from 'property-information'\n */\n\n/** @type {InfoType} */\nexport class Info {\n  /**\n   * @param {string} property\n   *   Property.\n   * @param {string} attribute\n   *   Attribute.\n   * @returns\n   *   Info.\n   */\n  constructor(property, attribute) {\n    this.attribute = attribute\n    this.property = property\n  }\n}\n\nInfo.prototype.attribute = ''\nInfo.prototype.booleanish = false\nInfo.prototype.boolean = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.defined = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.number = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.property = ''\nInfo.prototype.spaceSeparated = false\nInfo.prototype.space = undefined\n","let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n  return 2 ** ++powers\n}\n","/**\n * @import {Space} from 'property-information'\n */\n\nimport {Info} from './info.js'\nimport * as types from './types.js'\n\nconst checks = /** @type {ReadonlyArray<keyof typeof types>} */ (\n  Object.keys(types)\n)\n\nexport class DefinedInfo extends Info {\n  /**\n   * @constructor\n   * @param {string} property\n   *   Property.\n   * @param {string} attribute\n   *   Attribute.\n   * @param {number | null | undefined} [mask]\n   *   Mask.\n   * @param {Space | undefined} [space]\n   *   Space.\n   * @returns\n   *   Info.\n   */\n  constructor(property, attribute, mask, space) {\n    let index = -1\n\n    super(property, attribute)\n\n    mark(this, 'space', space)\n\n    if (typeof mask === 'number') {\n      while (++index < checks.length) {\n        const check = checks[index]\n        mark(this, checks[index], (mask & types[check]) === types[check])\n      }\n    }\n  }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @template {keyof DefinedInfo} Key\n *   Key type.\n * @param {DefinedInfo} values\n *   Info.\n * @param {Key} key\n *   Key.\n * @param {DefinedInfo[Key]} value\n *   Value.\n * @returns {undefined}\n *   Nothing.\n */\nfunction mark(values, key, value) {\n  if (value) {\n    values[key] = value\n  }\n}\n","/**\n * @import {Info, Space} from 'property-information'\n */\n\n/**\n * @typedef Definition\n *   Definition of a schema.\n * @property {Record<string, string> | undefined} [attributes]\n *   Normalzed names to special attribute case.\n * @property {ReadonlyArray<string> | undefined} [mustUseProperty]\n *   Normalized names that must be set as properties.\n * @property {Record<string, number | null>} properties\n *   Property names to their types.\n * @property {Space | undefined} [space]\n *   Space.\n * @property {Transform} transform\n *   Transform a property name.\n */\n\n/**\n * @callback Transform\n *   Transform.\n * @param {Record<string, string>} attributes\n *   Attributes.\n * @param {string} property\n *   Property.\n * @returns {string}\n *   Attribute.\n */\n\nimport {normalize} from '../normalize.js'\nimport {DefinedInfo} from './defined-info.js'\nimport {Schema} from './schema.js'\n\n/**\n * @param {Definition} definition\n *   Definition.\n * @returns {Schema}\n *   Schema.\n */\nexport function create(definition) {\n  /** @type {Record<string, Info>} */\n  const properties = {}\n  /** @type {Record<string, string>} */\n  const normals = {}\n\n  for (const [property, value] of Object.entries(definition.properties)) {\n    const info = new DefinedInfo(\n      property,\n      definition.transform(definition.attributes || {}, property),\n      value,\n      definition.space\n    )\n\n    if (\n      definition.mustUseProperty &&\n      definition.mustUseProperty.includes(property)\n    ) {\n      info.mustUseProperty = true\n    }\n\n    properties[property] = info\n\n    normals[normalize(property)] = property\n    normals[normalize(info.attribute)] = property\n  }\n\n  return new Schema(properties, normals, definition.space)\n}\n","import {create} from './util/create.js'\nimport {booleanish, number, spaceSeparated} from './util/types.js'\n\nexport const aria = create({\n  properties: {\n    ariaActiveDescendant: null,\n    ariaAtomic: booleanish,\n    ariaAutoComplete: null,\n    ariaBusy: booleanish,\n    ariaChecked: booleanish,\n    ariaColCount: number,\n    ariaColIndex: number,\n    ariaColSpan: number,\n    ariaControls: spaceSeparated,\n    ariaCurrent: null,\n    ariaDescribedBy: spaceSeparated,\n    ariaDetails: null,\n    ariaDisabled: booleanish,\n    ariaDropEffect: spaceSeparated,\n    ariaErrorMessage: null,\n    ariaExpanded: booleanish,\n    ariaFlowTo: spaceSeparated,\n    ariaGrabbed: booleanish,\n    ariaHasPopup: null,\n    ariaHidden: booleanish,\n    ariaInvalid: null,\n    ariaKeyShortcuts: null,\n    ariaLabel: null,\n    ariaLabelledBy: spaceSeparated,\n    ariaLevel: number,\n    ariaLive: null,\n    ariaModal: booleanish,\n    ariaMultiLine: booleanish,\n    ariaMultiSelectable: booleanish,\n    ariaOrientation: null,\n    ariaOwns: spaceSeparated,\n    ariaPlaceholder: null,\n    ariaPosInSet: number,\n    ariaPressed: booleanish,\n    ariaReadOnly: booleanish,\n    ariaRelevant: null,\n    ariaRequired: booleanish,\n    ariaRoleDescription: spaceSeparated,\n    ariaRowCount: number,\n    ariaRowIndex: number,\n    ariaRowSpan: number,\n    ariaSelected: booleanish,\n    ariaSetSize: number,\n    ariaSort: null,\n    ariaValueMax: number,\n    ariaValueMin: number,\n    ariaValueNow: number,\n    ariaValueText: null,\n    role: null\n  },\n  transform(_, property) {\n    return property === 'role'\n      ? property\n      : 'aria-' + property.slice(4).toLowerCase()\n  }\n})\n","/**\n * @param {Record<string, string>} attributes\n *   Attributes.\n * @param {string} attribute\n *   Attribute.\n * @returns {string}\n *   Transformed attribute.\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n  return attribute in attributes ? attributes[attribute] : attribute\n}\n","import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record<string, string>} attributes\n *   Attributes.\n * @param {string} property\n *   Property.\n * @returns {string}\n *   Transformed property.\n */\nexport function caseInsensitiveTransform(attributes, property) {\n  return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n","import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\nimport {create} from './util/create.js'\nimport {\n  booleanish,\n  boolean,\n  commaSeparated,\n  number,\n  overloadedBoolean,\n  spaceSeparated\n} from './util/types.js'\n\nexport const html = create({\n  attributes: {\n    acceptcharset: 'accept-charset',\n    classname: 'class',\n    htmlfor: 'for',\n    httpequiv: 'http-equiv'\n  },\n  mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n  properties: {\n    // Standard Properties.\n    abbr: null,\n    accept: commaSeparated,\n    acceptCharset: spaceSeparated,\n    accessKey: spaceSeparated,\n    action: null,\n    allow: null,\n    allowFullScreen: boolean,\n    allowPaymentRequest: boolean,\n    allowUserMedia: boolean,\n    alt: null,\n    as: null,\n    async: boolean,\n    autoCapitalize: null,\n    autoComplete: spaceSeparated,\n    autoFocus: boolean,\n    autoPlay: boolean,\n    blocking: spaceSeparated,\n    capture: null,\n    charSet: null,\n    checked: boolean,\n    cite: null,\n    className: spaceSeparated,\n    cols: number,\n    colSpan: null,\n    content: null,\n    contentEditable: booleanish,\n    controls: boolean,\n    controlsList: spaceSeparated,\n    coords: number | commaSeparated,\n    crossOrigin: null,\n    data: null,\n    dateTime: null,\n    decoding: null,\n    default: boolean,\n    defer: boolean,\n    dir: null,\n    dirName: null,\n    disabled: boolean,\n    download: overloadedBoolean,\n    draggable: booleanish,\n    encType: null,\n    enterKeyHint: null,\n    fetchPriority: null,\n    form: null,\n    formAction: null,\n    formEncType: null,\n    formMethod: null,\n    formNoValidate: boolean,\n    formTarget: null,\n    headers: spaceSeparated,\n    height: number,\n    hidden: overloadedBoolean,\n    high: number,\n    href: null,\n    hrefLang: null,\n    htmlFor: spaceSeparated,\n    httpEquiv: spaceSeparated,\n    id: null,\n    imageSizes: null,\n    imageSrcSet: null,\n    inert: boolean,\n    inputMode: null,\n    integrity: null,\n    is: null,\n    isMap: boolean,\n    itemId: null,\n    itemProp: spaceSeparated,\n    itemRef: spaceSeparated,\n    itemScope: boolean,\n    itemType: spaceSeparated,\n    kind: null,\n    label: null,\n    lang: null,\n    language: null,\n    list: null,\n    loading: null,\n    loop: boolean,\n    low: number,\n    manifest: null,\n    max: null,\n    maxLength: number,\n    media: null,\n    method: null,\n    min: null,\n    minLength: number,\n    multiple: boolean,\n    muted: boolean,\n    name: null,\n    nonce: null,\n    noModule: boolean,\n    noValidate: boolean,\n    onAbort: null,\n    onAfterPrint: null,\n    onAuxClick: null,\n    onBeforeMatch: null,\n    onBeforePrint: null,\n    onBeforeToggle: null,\n    onBeforeUnload: null,\n    onBlur: null,\n    onCancel: null,\n    onCanPlay: null,\n    onCanPlayThrough: null,\n    onChange: null,\n    onClick: null,\n    onClose: null,\n    onContextLost: null,\n    onContextMenu: null,\n    onContextRestored: null,\n    onCopy: null,\n    onCueChange: null,\n    onCut: null,\n    onDblClick: null,\n    onDrag: null,\n    onDragEnd: null,\n    onDragEnter: null,\n    onDragExit: null,\n    onDragLeave: null,\n    onDragOver: null,\n    onDragStart: null,\n    onDrop: null,\n    onDurationChange: null,\n    onEmptied: null,\n    onEnded: null,\n    onError: null,\n    onFocus: null,\n    onFormData: null,\n    onHashChange: null,\n    onInput: null,\n    onInvalid: null,\n    onKeyDown: null,\n    onKeyPress: null,\n    onKeyUp: null,\n    onLanguageChange: null,\n    onLoad: null,\n    onLoadedData: null,\n    onLoadedMetadata: null,\n    onLoadEnd: null,\n    onLoadStart: null,\n    onMessage: null,\n    onMessageError: null,\n    onMouseDown: null,\n    onMouseEnter: null,\n    onMouseLeave: null,\n    onMouseMove: null,\n    onMouseOut: null,\n    onMouseOver: null,\n    onMouseUp: null,\n    onOffline: null,\n    onOnline: null,\n    onPageHide: null,\n    onPageShow: null,\n    onPaste: null,\n    onPause: null,\n    onPlay: null,\n    onPlaying: null,\n    onPopState: null,\n    onProgress: null,\n    onRateChange: null,\n    onRejectionHandled: null,\n    onReset: null,\n    onResize: null,\n    onScroll: null,\n    onScrollEnd: null,\n    onSecurityPolicyViolation: null,\n    onSeeked: null,\n    onSeeking: null,\n    onSelect: null,\n    onSlotChange: null,\n    onStalled: null,\n    onStorage: null,\n    onSubmit: null,\n    onSuspend: null,\n    onTimeUpdate: null,\n    onToggle: null,\n    onUnhandledRejection: null,\n    onUnload: null,\n    onVolumeChange: null,\n    onWaiting: null,\n    onWheel: null,\n    open: boolean,\n    optimum: number,\n    pattern: null,\n    ping: spaceSeparated,\n    placeholder: null,\n    playsInline: boolean,\n    popover: null,\n    popoverTarget: null,\n    popoverTargetAction: null,\n    poster: null,\n    preload: null,\n    readOnly: boolean,\n    referrerPolicy: null,\n    rel: spaceSeparated,\n    required: boolean,\n    reversed: boolean,\n    rows: number,\n    rowSpan: number,\n    sandbox: spaceSeparated,\n    scope: null,\n    scoped: boolean,\n    seamless: boolean,\n    selected: boolean,\n    shadowRootClonable: boolean,\n    shadowRootDelegatesFocus: boolean,\n    shadowRootMode: null,\n    shape: null,\n    size: number,\n    sizes: null,\n    slot: null,\n    span: number,\n    spellCheck: booleanish,\n    src: null,\n    srcDoc: null,\n    srcLang: null,\n    srcSet: null,\n    start: number,\n    step: null,\n    style: null,\n    tabIndex: number,\n    target: null,\n    title: null,\n    translate: null,\n    type: null,\n    typeMustMatch: boolean,\n    useMap: null,\n    value: booleanish,\n    width: number,\n    wrap: null,\n    writingSuggestions: null,\n\n    // Legacy.\n    // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n    align: null, // Several. Use CSS `text-align` instead,\n    aLink: null, // `<body>`. Use CSS `a:active {color}` instead\n    archive: spaceSeparated, // `<object>`. List of URIs to archives\n    axis: null, // `<td>` and `<th>`. Use `scope` on `<th>`\n    background: null, // `<body>`. Use CSS `background-image` instead\n    bgColor: null, // `<body>` and table elements. Use CSS `background-color` instead\n    border: number, // `<table>`. Use CSS `border-width` instead,\n    borderColor: null, // `<table>`. Use CSS `border-color` instead,\n    bottomMargin: number, // `<body>`\n    cellPadding: null, // `<table>`\n    cellSpacing: null, // `<table>`\n    char: null, // Several table elements. When `align=char`, sets the character to align on\n    charOff: null, // Several table elements. When `char`, offsets the alignment\n    classId: null, // `<object>`\n    clear: null, // `<br>`. Use CSS `clear` instead\n    code: null, // `<object>`\n    codeBase: null, // `<object>`\n    codeType: null, // `<object>`\n    color: null, // `<font>` and `<hr>`. Use CSS instead\n    compact: boolean, // Lists. Use CSS to reduce space between items instead\n    declare: boolean, // `<object>`\n    event: null, // `<script>`\n    face: null, // `<font>`. Use CSS instead\n    frame: null, // `<table>`\n    frameBorder: null, // `<iframe>`. Use CSS `border` instead\n    hSpace: number, // `<img>` and `<object>`\n    leftMargin: number, // `<body>`\n    link: null, // `<body>`. Use CSS `a:link {color: *}` instead\n    longDesc: null, // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`\n    lowSrc: null, // `<img>`. Use a `<picture>`\n    marginHeight: number, // `<body>`\n    marginWidth: number, // `<body>`\n    noResize: boolean, // `<frame>`\n    noHref: boolean, // `<area>`. Use no href instead of an explicit `nohref`\n    noShade: boolean, // `<hr>`. Use background-color and height instead of borders\n    noWrap: boolean, // `<td>` and `<th>`\n    object: null, // `<applet>`\n    profile: null, // `<head>`\n    prompt: null, // `<isindex>`\n    rev: null, // `<link>`\n    rightMargin: number, // `<body>`\n    rules: null, // `<table>`\n    scheme: null, // `<meta>`\n    scrolling: booleanish, // `<frame>`. Use overflow in the child context\n    standby: null, // `<object>`\n    summary: null, // `<table>`\n    text: null, // `<body>`. Use CSS `color` instead\n    topMargin: number, // `<body>`\n    valueType: null, // `<param>`\n    version: null, // `<html>`. Use a doctype.\n    vAlign: null, // Several. Use CSS `vertical-align` instead\n    vLink: null, // `<body>`. Use CSS `a:visited {color}` instead\n    vSpace: number, // `<img>` and `<object>`\n\n    // Non-standard Properties.\n    allowTransparency: null,\n    autoCorrect: null,\n    autoSave: null,\n    disablePictureInPicture: boolean,\n    disableRemotePlayback: boolean,\n    prefix: null,\n    property: null,\n    results: number,\n    security: null,\n    unselectable: null\n  },\n  space: 'html',\n  transform: caseInsensitiveTransform\n})\n","import {caseSensitiveTransform} from './util/case-sensitive-transform.js'\nimport {create} from './util/create.js'\nimport {\n  boolean,\n  commaOrSpaceSeparated,\n  commaSeparated,\n  number,\n  spaceSeparated\n} from './util/types.js'\n\nexport const svg = create({\n  attributes: {\n    accentHeight: 'accent-height',\n    alignmentBaseline: 'alignment-baseline',\n    arabicForm: 'arabic-form',\n    baselineShift: 'baseline-shift',\n    capHeight: 'cap-height',\n    className: 'class',\n    clipPath: 'clip-path',\n    clipRule: 'clip-rule',\n    colorInterpolation: 'color-interpolation',\n    colorInterpolationFilters: 'color-interpolation-filters',\n    colorProfile: 'color-profile',\n    colorRendering: 'color-rendering',\n    crossOrigin: 'crossorigin',\n    dataType: 'datatype',\n    dominantBaseline: 'dominant-baseline',\n    enableBackground: 'enable-background',\n    fillOpacity: 'fill-opacity',\n    fillRule: 'fill-rule',\n    floodColor: 'flood-color',\n    floodOpacity: 'flood-opacity',\n    fontFamily: 'font-family',\n    fontSize: 'font-size',\n    fontSizeAdjust: 'font-size-adjust',\n    fontStretch: 'font-stretch',\n    fontStyle: 'font-style',\n    fontVariant: 'font-variant',\n    fontWeight: 'font-weight',\n    glyphName: 'glyph-name',\n    glyphOrientationHorizontal: 'glyph-orientation-horizontal',\n    glyphOrientationVertical: 'glyph-orientation-vertical',\n    hrefLang: 'hreflang',\n    horizAdvX: 'horiz-adv-x',\n    horizOriginX: 'horiz-origin-x',\n    horizOriginY: 'horiz-origin-y',\n    imageRendering: 'image-rendering',\n    letterSpacing: 'letter-spacing',\n    lightingColor: 'lighting-color',\n    markerEnd: 'marker-end',\n    markerMid: 'marker-mid',\n    markerStart: 'marker-start',\n    navDown: 'nav-down',\n    navDownLeft: 'nav-down-left',\n    navDownRight: 'nav-down-right',\n    navLeft: 'nav-left',\n    navNext: 'nav-next',\n    navPrev: 'nav-prev',\n    navRight: 'nav-right',\n    navUp: 'nav-up',\n    navUpLeft: 'nav-up-left',\n    navUpRight: 'nav-up-right',\n    onAbort: 'onabort',\n    onActivate: 'onactivate',\n    onAfterPrint: 'onafterprint',\n    onBeforePrint: 'onbeforeprint',\n    onBegin: 'onbegin',\n    onCancel: 'oncancel',\n    onCanPlay: 'oncanplay',\n    onCanPlayThrough: 'oncanplaythrough',\n    onChange: 'onchange',\n    onClick: 'onclick',\n    onClose: 'onclose',\n    onCopy: 'oncopy',\n    onCueChange: 'oncuechange',\n    onCut: 'oncut',\n    onDblClick: 'ondblclick',\n    onDrag: 'ondrag',\n    onDragEnd: 'ondragend',\n    onDragEnter: 'ondragenter',\n    onDragExit: 'ondragexit',\n    onDragLeave: 'ondragleave',\n    onDragOver: 'ondragover',\n    onDragStart: 'ondragstart',\n    onDrop: 'ondrop',\n    onDurationChange: 'ondurationchange',\n    onEmptied: 'onemptied',\n    onEnd: 'onend',\n    onEnded: 'onended',\n    onError: 'onerror',\n    onFocus: 'onfocus',\n    onFocusIn: 'onfocusin',\n    onFocusOut: 'onfocusout',\n    onHashChange: 'onhashchange',\n    onInput: 'oninput',\n    onInvalid: 'oninvalid',\n    onKeyDown: 'onkeydown',\n    onKeyPress: 'onkeypress',\n    onKeyUp: 'onkeyup',\n    onLoad: 'onload',\n    onLoadedData: 'onloadeddata',\n    onLoadedMetadata: 'onloadedmetadata',\n    onLoadStart: 'onloadstart',\n    onMessage: 'onmessage',\n    onMouseDown: 'onmousedown',\n    onMouseEnter: 'onmouseenter',\n    onMouseLeave: 'onmouseleave',\n    onMouseMove: 'onmousemove',\n    onMouseOut: 'onmouseout',\n    onMouseOver: 'onmouseover',\n    onMouseUp: 'onmouseup',\n    onMouseWheel: 'onmousewheel',\n    onOffline: 'onoffline',\n    onOnline: 'ononline',\n    onPageHide: 'onpagehide',\n    onPageShow: 'onpageshow',\n    onPaste: 'onpaste',\n    onPause: 'onpause',\n    onPlay: 'onplay',\n    onPlaying: 'onplaying',\n    onPopState: 'onpopstate',\n    onProgress: 'onprogress',\n    onRateChange: 'onratechange',\n    onRepeat: 'onrepeat',\n    onReset: 'onreset',\n    onResize: 'onresize',\n    onScroll: 'onscroll',\n    onSeeked: 'onseeked',\n    onSeeking: 'onseeking',\n    onSelect: 'onselect',\n    onShow: 'onshow',\n    onStalled: 'onstalled',\n    onStorage: 'onstorage',\n    onSubmit: 'onsubmit',\n    onSuspend: 'onsuspend',\n    onTimeUpdate: 'ontimeupdate',\n    onToggle: 'ontoggle',\n    onUnload: 'onunload',\n    onVolumeChange: 'onvolumechange',\n    onWaiting: 'onwaiting',\n    onZoom: 'onzoom',\n    overlinePosition: 'overline-position',\n    overlineThickness: 'overline-thickness',\n    paintOrder: 'paint-order',\n    panose1: 'panose-1',\n    pointerEvents: 'pointer-events',\n    referrerPolicy: 'referrerpolicy',\n    renderingIntent: 'rendering-intent',\n    shapeRendering: 'shape-rendering',\n    stopColor: 'stop-color',\n    stopOpacity: 'stop-opacity',\n    strikethroughPosition: 'strikethrough-position',\n    strikethroughThickness: 'strikethrough-thickness',\n    strokeDashArray: 'stroke-dasharray',\n    strokeDashOffset: 'stroke-dashoffset',\n    strokeLineCap: 'stroke-linecap',\n    strokeLineJoin: 'stroke-linejoin',\n    strokeMiterLimit: 'stroke-miterlimit',\n    strokeOpacity: 'stroke-opacity',\n    strokeWidth: 'stroke-width',\n    tabIndex: 'tabindex',\n    textAnchor: 'text-anchor',\n    textDecoration: 'text-decoration',\n    textRendering: 'text-rendering',\n    transformOrigin: 'transform-origin',\n    typeOf: 'typeof',\n    underlinePosition: 'underline-position',\n    underlineThickness: 'underline-thickness',\n    unicodeBidi: 'unicode-bidi',\n    unicodeRange: 'unicode-range',\n    unitsPerEm: 'units-per-em',\n    vAlphabetic: 'v-alphabetic',\n    vHanging: 'v-hanging',\n    vIdeographic: 'v-ideographic',\n    vMathematical: 'v-mathematical',\n    vectorEffect: 'vector-effect',\n    vertAdvY: 'vert-adv-y',\n    vertOriginX: 'vert-origin-x',\n    vertOriginY: 'vert-origin-y',\n    wordSpacing: 'word-spacing',\n    writingMode: 'writing-mode',\n    xHeight: 'x-height',\n    // These were camelcased in Tiny. Now lowercased in SVG 2\n    playbackOrder: 'playbackorder',\n    timelineBegin: 'timelinebegin'\n  },\n  properties: {\n    about: commaOrSpaceSeparated,\n    accentHeight: number,\n    accumulate: null,\n    additive: null,\n    alignmentBaseline: null,\n    alphabetic: number,\n    amplitude: number,\n    arabicForm: null,\n    ascent: number,\n    attributeName: null,\n    attributeType: null,\n    azimuth: number,\n    bandwidth: null,\n    baselineShift: null,\n    baseFrequency: null,\n    baseProfile: null,\n    bbox: null,\n    begin: null,\n    bias: number,\n    by: null,\n    calcMode: null,\n    capHeight: number,\n    className: spaceSeparated,\n    clip: null,\n    clipPath: null,\n    clipPathUnits: null,\n    clipRule: null,\n    color: null,\n    colorInterpolation: null,\n    colorInterpolationFilters: null,\n    colorProfile: null,\n    colorRendering: null,\n    content: null,\n    contentScriptType: null,\n    contentStyleType: null,\n    crossOrigin: null,\n    cursor: null,\n    cx: null,\n    cy: null,\n    d: null,\n    dataType: null,\n    defaultAction: null,\n    descent: number,\n    diffuseConstant: number,\n    direction: null,\n    display: null,\n    dur: null,\n    divisor: number,\n    dominantBaseline: null,\n    download: boolean,\n    dx: null,\n    dy: null,\n    edgeMode: null,\n    editable: null,\n    elevation: number,\n    enableBackground: null,\n    end: null,\n    event: null,\n    exponent: number,\n    externalResourcesRequired: null,\n    fill: null,\n    fillOpacity: number,\n    fillRule: null,\n    filter: null,\n    filterRes: null,\n    filterUnits: null,\n    floodColor: null,\n    floodOpacity: null,\n    focusable: null,\n    focusHighlight: null,\n    fontFamily: null,\n    fontSize: null,\n    fontSizeAdjust: null,\n    fontStretch: null,\n    fontStyle: null,\n    fontVariant: null,\n    fontWeight: null,\n    format: null,\n    fr: null,\n    from: null,\n    fx: null,\n    fy: null,\n    g1: commaSeparated,\n    g2: commaSeparated,\n    glyphName: commaSeparated,\n    glyphOrientationHorizontal: null,\n    glyphOrientationVertical: null,\n    glyphRef: null,\n    gradientTransform: null,\n    gradientUnits: null,\n    handler: null,\n    hanging: number,\n    hatchContentUnits: null,\n    hatchUnits: null,\n    height: null,\n    href: null,\n    hrefLang: null,\n    horizAdvX: number,\n    horizOriginX: number,\n    horizOriginY: number,\n    id: null,\n    ideographic: number,\n    imageRendering: null,\n    initialVisibility: null,\n    in: null,\n    in2: null,\n    intercept: number,\n    k: number,\n    k1: number,\n    k2: number,\n    k3: number,\n    k4: number,\n    kernelMatrix: commaOrSpaceSeparated,\n    kernelUnitLength: null,\n    keyPoints: null, // SEMI_COLON_SEPARATED\n    keySplines: null, // SEMI_COLON_SEPARATED\n    keyTimes: null, // SEMI_COLON_SEPARATED\n    kerning: null,\n    lang: null,\n    lengthAdjust: null,\n    letterSpacing: null,\n    lightingColor: null,\n    limitingConeAngle: number,\n    local: null,\n    markerEnd: null,\n    markerMid: null,\n    markerStart: null,\n    markerHeight: null,\n    markerUnits: null,\n    markerWidth: null,\n    mask: null,\n    maskContentUnits: null,\n    maskUnits: null,\n    mathematical: null,\n    max: null,\n    media: null,\n    mediaCharacterEncoding: null,\n    mediaContentEncodings: null,\n    mediaSize: number,\n    mediaTime: null,\n    method: null,\n    min: null,\n    mode: null,\n    name: null,\n    navDown: null,\n    navDownLeft: null,\n    navDownRight: null,\n    navLeft: null,\n    navNext: null,\n    navPrev: null,\n    navRight: null,\n    navUp: null,\n    navUpLeft: null,\n    navUpRight: null,\n    numOctaves: null,\n    observer: null,\n    offset: null,\n    onAbort: null,\n    onActivate: null,\n    onAfterPrint: null,\n    onBeforePrint: null,\n    onBegin: null,\n    onCancel: null,\n    onCanPlay: null,\n    onCanPlayThrough: null,\n    onChange: null,\n    onClick: null,\n    onClose: null,\n    onCopy: null,\n    onCueChange: null,\n    onCut: null,\n    onDblClick: null,\n    onDrag: null,\n    onDragEnd: null,\n    onDragEnter: null,\n    onDragExit: null,\n    onDragLeave: null,\n    onDragOver: null,\n    onDragStart: null,\n    onDrop: null,\n    onDurationChange: null,\n    onEmptied: null,\n    onEnd: null,\n    onEnded: null,\n    onError: null,\n    onFocus: null,\n    onFocusIn: null,\n    onFocusOut: null,\n    onHashChange: null,\n    onInput: null,\n    onInvalid: null,\n    onKeyDown: null,\n    onKeyPress: null,\n    onKeyUp: null,\n    onLoad: null,\n    onLoadedData: null,\n    onLoadedMetadata: null,\n    onLoadStart: null,\n    onMessage: null,\n    onMouseDown: null,\n    onMouseEnter: null,\n    onMouseLeave: null,\n    onMouseMove: null,\n    onMouseOut: null,\n    onMouseOver: null,\n    onMouseUp: null,\n    onMouseWheel: null,\n    onOffline: null,\n    onOnline: null,\n    onPageHide: null,\n    onPageShow: null,\n    onPaste: null,\n    onPause: null,\n    onPlay: null,\n    onPlaying: null,\n    onPopState: null,\n    onProgress: null,\n    onRateChange: null,\n    onRepeat: null,\n    onReset: null,\n    onResize: null,\n    onScroll: null,\n    onSeeked: null,\n    onSeeking: null,\n    onSelect: null,\n    onShow: null,\n    onStalled: null,\n    onStorage: null,\n    onSubmit: null,\n    onSuspend: null,\n    onTimeUpdate: null,\n    onToggle: null,\n    onUnload: null,\n    onVolumeChange: null,\n    onWaiting: null,\n    onZoom: null,\n    opacity: null,\n    operator: null,\n    order: null,\n    orient: null,\n    orientation: null,\n    origin: null,\n    overflow: null,\n    overlay: null,\n    overlinePosition: number,\n    overlineThickness: number,\n    paintOrder: null,\n    panose1: null,\n    path: null,\n    pathLength: number,\n    patternContentUnits: null,\n    patternTransform: null,\n    patternUnits: null,\n    phase: null,\n    ping: spaceSeparated,\n    pitch: null,\n    playbackOrder: null,\n    pointerEvents: null,\n    points: null,\n    pointsAtX: number,\n    pointsAtY: number,\n    pointsAtZ: number,\n    preserveAlpha: null,\n    preserveAspectRatio: null,\n    primitiveUnits: null,\n    propagate: null,\n    property: commaOrSpaceSeparated,\n    r: null,\n    radius: null,\n    referrerPolicy: null,\n    refX: null,\n    refY: null,\n    rel: commaOrSpaceSeparated,\n    rev: commaOrSpaceSeparated,\n    renderingIntent: null,\n    repeatCount: null,\n    repeatDur: null,\n    requiredExtensions: commaOrSpaceSeparated,\n    requiredFeatures: commaOrSpaceSeparated,\n    requiredFonts: commaOrSpaceSeparated,\n    requiredFormats: commaOrSpaceSeparated,\n    resource: null,\n    restart: null,\n    result: null,\n    rotate: null,\n    rx: null,\n    ry: null,\n    scale: null,\n    seed: null,\n    shapeRendering: null,\n    side: null,\n    slope: null,\n    snapshotTime: null,\n    specularConstant: number,\n    specularExponent: number,\n    spreadMethod: null,\n    spacing: null,\n    startOffset: null,\n    stdDeviation: null,\n    stemh: null,\n    stemv: null,\n    stitchTiles: null,\n    stopColor: null,\n    stopOpacity: null,\n    strikethroughPosition: number,\n    strikethroughThickness: number,\n    string: null,\n    stroke: null,\n    strokeDashArray: commaOrSpaceSeparated,\n    strokeDashOffset: null,\n    strokeLineCap: null,\n    strokeLineJoin: null,\n    strokeMiterLimit: number,\n    strokeOpacity: number,\n    strokeWidth: null,\n    style: null,\n    surfaceScale: number,\n    syncBehavior: null,\n    syncBehaviorDefault: null,\n    syncMaster: null,\n    syncTolerance: null,\n    syncToleranceDefault: null,\n    systemLanguage: commaOrSpaceSeparated,\n    tabIndex: number,\n    tableValues: null,\n    target: null,\n    targetX: number,\n    targetY: number,\n    textAnchor: null,\n    textDecoration: null,\n    textRendering: null,\n    textLength: null,\n    timelineBegin: null,\n    title: null,\n    transformBehavior: null,\n    type: null,\n    typeOf: commaOrSpaceSeparated,\n    to: null,\n    transform: null,\n    transformOrigin: null,\n    u1: null,\n    u2: null,\n    underlinePosition: number,\n    underlineThickness: number,\n    unicode: null,\n    unicodeBidi: null,\n    unicodeRange: null,\n    unitsPerEm: number,\n    values: null,\n    vAlphabetic: number,\n    vMathematical: number,\n    vectorEffect: null,\n    vHanging: number,\n    vIdeographic: number,\n    version: null,\n    vertAdvY: number,\n    vertOriginX: number,\n    vertOriginY: number,\n    viewBox: null,\n    viewTarget: null,\n    visibility: null,\n    width: null,\n    widths: null,\n    wordSpacing: null,\n    writingMode: null,\n    x: null,\n    x1: null,\n    x2: null,\n    xChannelSelector: null,\n    xHeight: number,\n    y: null,\n    y1: null,\n    y2: null,\n    yChannelSelector: null,\n    z: null,\n    zoomAndPan: null\n  },\n  space: 'svg',\n  transform: caseSensitiveTransform\n})\n","import {create} from './util/create.js'\n\nexport const xlink = create({\n  properties: {\n    xLinkActuate: null,\n    xLinkArcRole: null,\n    xLinkHref: null,\n    xLinkRole: null,\n    xLinkShow: null,\n    xLinkTitle: null,\n    xLinkType: null\n  },\n  space: 'xlink',\n  transform(_, property) {\n    return 'xlink:' + property.slice(5).toLowerCase()\n  }\n})\n","import {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const xmlns = create({\n  attributes: {xmlnsxlink: 'xmlns:xlink'},\n  properties: {xmlnsXLink: null, xmlns: null},\n  space: 'xmlns',\n  transform: caseInsensitiveTransform\n})\n","import {create} from './util/create.js'\n\nexport const xml = create({\n  properties: {xmlBase: null, xmlLang: null, xmlSpace: null},\n  space: 'xml',\n  transform(_, property) {\n    return 'xml:' + property.slice(3).toLowerCase()\n  }\n})\n","// Note: types exposed from `index.d.ts`.\nimport {merge} from './lib/util/merge.js'\nimport {aria} from './lib/aria.js'\nimport {html as htmlBase} from './lib/html.js'\nimport {svg as svgBase} from './lib/svg.js'\nimport {xlink} from './lib/xlink.js'\nimport {xmlns} from './lib/xmlns.js'\nimport {xml} from './lib/xml.js'\n\nexport {hastToReact} from './lib/hast-to-react.js'\n\nexport const html = merge([aria, htmlBase, xlink, xmlns, xml], 'html')\n\nexport {find} from './lib/find.js'\nexport {normalize} from './lib/normalize.js'\n\nexport const svg = merge([aria, svgBase, xlink, xmlns, xml], 'svg')\n","/**\n * @import {Schema} from 'property-information'\n */\n\nimport {DefinedInfo} from './util/defined-info.js'\nimport {Info} from './util/info.js'\nimport {normalize} from './normalize.js'\n\nconst cap = /[A-Z]/g\nconst dash = /-[a-z]/g\nconst valid = /^data[-\\w.:]+$/i\n\n/**\n * Look up info on a property.\n *\n * In most cases the given `schema` contains info on the property.\n * All standard,\n * most legacy,\n * and some non-standard properties are supported.\n * For these cases,\n * the returned `Info` has hints about the value of the property.\n *\n * `name` can also be a valid data attribute or property,\n * in which case an `Info` object with the correctly cased `attribute` and\n * `property` is returned.\n *\n * `name` can be an unknown attribute,\n * in which case an `Info` object with `attribute` and `property` set to the\n * given name is returned.\n * It is not recommended to provide unsupported legacy or recently specced\n * properties.\n *\n *\n * @param {Schema} schema\n *   Schema;\n *   either the `html` or `svg` export.\n * @param {string} value\n *   An attribute-like or property-like name;\n *   it will be passed through `normalize` to hopefully find the correct info.\n * @returns {Info}\n *   Info.\n */\nexport function find(schema, value) {\n  const normal = normalize(value)\n  let property = value\n  let Type = Info\n\n  if (normal in schema.normal) {\n    return schema.property[schema.normal[normal]]\n  }\n\n  if (normal.length > 4 && normal.slice(0, 4) === 'data' && valid.test(value)) {\n    // Attribute or property.\n    if (value.charAt(4) === '-') {\n      // Turn it into a property.\n      const rest = value.slice(5).replace(dash, camelcase)\n      property = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1)\n    } else {\n      // Turn it into an attribute.\n      const rest = value.slice(4)\n\n      if (!dash.test(rest)) {\n        let dashes = rest.replace(cap, kebab)\n\n        if (dashes.charAt(0) !== '-') {\n          dashes = '-' + dashes\n        }\n\n        value = 'data' + dashes\n      }\n    }\n\n    Type = DefinedInfo\n  }\n\n  return new Type(property, value)\n}\n\n/**\n * @param {string} $0\n *   Value.\n * @returns {string}\n *   Kebab.\n */\nfunction kebab($0) {\n  return '-' + $0.toLowerCase()\n}\n\n/**\n * @param {string} $0\n *   Value.\n * @returns {string}\n *   Camel.\n */\nfunction camelcase($0) {\n  return $0.charAt(1).toUpperCase()\n}\n","/**\n * Map of web namespaces.\n *\n * @type {Record<string, string>}\n */\nexport const webNamespaces = {\n  html: 'http://www.w3.org/1999/xhtml',\n  mathml: 'http://www.w3.org/1998/Math/MathML',\n  svg: 'http://www.w3.org/2000/svg',\n  xlink: 'http://www.w3.org/1999/xlink',\n  xml: 'http://www.w3.org/XML/1998/namespace',\n  xmlns: 'http://www.w3.org/2000/xmlns/'\n}\n","/**\n * @import {\n *   Comment as HastComment,\n *   Doctype as HastDoctype,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Root as HastRoot,\n *   Text as HastText\n * } from 'hast'\n * @import {Schema} from 'property-information'\n */\n\n/**\n * @callback AfterTransform\n *   Callback called when each node is transformed.\n * @param {HastNodes} hastNode\n *   hast node that was handled.\n * @param {Node} domNode\n *   Corresponding DOM node.\n * @returns {undefined | void}\n *   Nothing.\n *\n *   Note: `void` included until TS infers `undefined` fine.\n *\n * @typedef Options\n *   Configuration.\n * @property {AfterTransform | null | undefined} [afterTransform]\n *   Callback called when each node is transformed (optional).\n * @property {Document | null | undefined} [document]\n *   Document interface to use (default: `globalThis.document`).\n * @property {boolean | null | undefined} [fragment=false]\n *   Whether to return a DOM fragment (`true`) or a whole document (`false`)\n *   (default: `false`).\n * @property {string | null | undefined} [namespace]\n *   Namespace to use to create elements (optional).\n *\n * @typedef State\n *   Info passed around about the current state.\n * @property {Document} doc\n *   Document interface to use.\n * @property {boolean} fragment\n *   Whether a fragment (`true`) or whole document (`false`) is built.\n * @property {string | undefined} namespace\n *   Explicit namespace to use.\n * @property {string | undefined} impliedNamespace\n *   Namespace.\n * @property {AfterTransform | undefined} afterTransform\n *   Callback called after each hast node is transformed.\n */\n\n/* eslint-env browser */\n\nimport {html, find, svg} from 'property-information'\nimport {webNamespaces} from 'web-namespaces'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Transform a hast tree to a DOM tree\n *\n * @param {HastNodes} tree\n *   Tree to transform.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {Comment | Document | DocumentFragment | DocumentType | Element | Text}\n *   Equivalent DOM node.\n */\nexport function toDom(tree, options) {\n  const config = options || {}\n  return transform(tree, {\n    doc: config.document || document,\n    fragment: config.fragment || false,\n    namespace: config.namespace || undefined,\n    impliedNamespace: undefined,\n    afterTransform: config.afterTransform || undefined\n  })\n}\n\n/**\n * @param {HastNodes} node\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {Comment | Document | DocumentFragment | DocumentType | Element | Text}\n *   Equivalent DOM node.\n */\nfunction transform(node, state) {\n  const transformed = one(node, state)\n  if (state.afterTransform) state.afterTransform(node, transformed)\n  return transformed\n}\n\n/**\n * Transform any hast node.\n *\n * @param {HastNodes} node\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {Comment | Document | DocumentFragment | DocumentType | Element | Text}\n *   Equivalent DOM node.\n */\nfunction one(node, state) {\n  switch (node.type) {\n    case 'root': {\n      return root(node, state)\n    }\n\n    case 'text': {\n      return text(node, state)\n    }\n\n    case 'doctype': {\n      return doctype(node, state)\n    }\n\n    case 'comment': {\n      return comment(node, state)\n    }\n\n    default: {\n      // Important: unknown nodes are passed to `element`.\n      return element(node, state)\n    }\n  }\n}\n\n/**\n * Create a document.\n *\n * @param {HastRoot} node\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {Document | DocumentFragment | HTMLHtmlElement}\n *   Equivalent DOM node.\n */\nfunction root(node, state) {\n  const children = node.children || []\n  let rootIsDocument = children.length === 0\n  let index = -1\n  /** @type {string | undefined} */\n  let foundNamespace\n\n  while (++index < children.length) {\n    const child = children[index]\n\n    if (child.type === 'element' && child.tagName === 'html') {\n      // If we have a root HTML node, we don’t need to render as a fragment.\n      rootIsDocument = true\n\n      // Take namespace.\n      foundNamespace =\n        String((child.properties && child.properties.xmlns) || '') ||\n        webNamespaces.html\n\n      break\n    }\n  }\n\n  const namespace = state.namespace || foundNamespace\n  // The root node will be `Document`, `DocumentFragment`, or `HTMLElement`.\n  /** @type {Document | DocumentFragment | HTMLHtmlElement} */\n  let result\n\n  if (rootIsDocument) {\n    result = state.doc.implementation.createDocument(\n      // Note: `null` is different from `undefined`.\n      namespace || null,\n      ''\n    )\n  } else if (state.fragment) {\n    result = state.doc.createDocumentFragment()\n  } else {\n    result = state.doc.createElement('html')\n  }\n\n  appendAll(result, children, {\n    ...state,\n    namespace,\n    impliedNamespace: namespace\n  })\n\n  return result\n}\n\n/**\n * Create a `doctype`.\n *\n * @param {HastDoctype} _\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {DocumentType}\n *   DOM document type.\n */\nfunction doctype(_, state) {\n  return state.doc.implementation.createDocumentType('html', '', '')\n}\n\n/**\n * Create a `text`.\n *\n * @param {HastText} node\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {Text}\n *   DOM text.\n */\nfunction text(node, state) {\n  return state.doc.createTextNode(node.value)\n}\n\n/**\n * Create a `comment`.\n *\n * @param {HastComment} node\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {Comment}\n *   DOM comment.\n */\nfunction comment(node, state) {\n  return state.doc.createComment(node.value)\n}\n\n/**\n * Create an `element`.\n *\n * @param {HastElement} node\n *   Node to transform.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {Element}\n *   DOM element.\n */\nfunction element(node, state) {\n  let impliedNamespace = state.impliedNamespace || state.namespace\n  // Important: unknown nodes are passed to `element`.\n  const tagName =\n    node.tagName || (impliedNamespace === webNamespaces.svg ? 'g' : 'div')\n  const properties = node.properties || {}\n  const children = node.children || []\n\n  // Switch automatically from HTML to SVG on `<svg>`.\n  if (\n    (impliedNamespace === undefined ||\n      impliedNamespace === webNamespaces.html) &&\n    tagName === 'svg'\n  ) {\n    impliedNamespace = webNamespaces.svg\n  }\n\n  const result = impliedNamespace\n    ? state.doc.createElementNS(impliedNamespace, tagName)\n    : state.doc.createElement(tagName)\n\n  addProperties(\n    result,\n    properties,\n    impliedNamespace === webNamespaces.svg ? svg : html\n  )\n\n  const currentImpliedNamespace = state.impliedNamespace\n  state.impliedNamespace = impliedNamespace\n  appendAll(result, children, state)\n  state.impliedNamespace = currentImpliedNamespace\n\n  return result\n}\n\n/**\n * Add all properties.\n *\n * @param {Element} result\n *   Element.\n * @param {HastProperties} properties\n *   Properties from hast element.\n * @param {Schema} schema\n *   Schema from `property-information`.\n * @returns {undefined}\n *   Nothing.\n */\nfunction addProperties(result, properties, schema) {\n  /** @type {string} */\n  let key\n\n  for (key in properties) {\n    if (own.call(properties, key)) {\n      const info = find(schema, key)\n      let value = properties[key]\n\n      if (Array.isArray(value)) {\n        value = value.join(info.commaSeparated ? ', ' : ' ')\n      }\n\n      if (info.mustUseProperty) {\n        // @ts-expect-error: setting the property is fine, according to\n        // `property-information`.\n        result[info.property] = value\n      }\n\n      if (\n        info.boolean ||\n        (info.overloadedBoolean && typeof value === 'boolean')\n      ) {\n        if (value) {\n          result.setAttribute(info.attribute, '')\n        }\n      } else if (info.booleanish) {\n        result.setAttribute(info.attribute, String(value))\n      } else if (value === true) {\n        result.setAttribute(info.attribute, '')\n      } else if (value || value === 0 || value === '') {\n        result.setAttribute(info.attribute, String(value))\n      }\n    }\n  }\n}\n\n/**\n * Add all children.\n *\n * @param {Document | DocumentFragment | Element} node\n *   DOM node to append to.\n * @param {Array<HastRootContent>} children\n *   hast children.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {undefined}\n *   Nothing.\n */\nfunction appendAll(node, children, state) {\n  let index = -1\n\n  while (++index < children.length) {\n    node.append(transform(children[index], state))\n  }\n}\n","/**\n * @import {Root} from 'hast'\n * @import {Options} from 'rehype-dom-stringify'\n * @import {Compiler, Processor} from 'unified'\n */\n\nimport {toDom} from 'hast-util-to-dom'\n\n/**\n * Add support for serializing as HTML with DOM APIs.\n *\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function stringify(options) {\n  /** @type {Processor<undefined, undefined, undefined, Root, string>} */\n  // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n  const self = this\n  const settings = {...self.data('settings'), ...options}\n\n  if (settings.fragment !== false) {\n    settings.fragment = true\n  }\n\n  self.compiler = compiler\n\n  /** @type {Compiler<Root, string>} */\n  function compiler(tree) {\n    return serialize(toDom(tree, settings))\n  }\n}\n\n/**\n * Serialize DOM nodes.\n *\n * @param {Comment | DocumentFragment | DocumentType | Element | Text | XMLDocument} node\n *   DOM node.\n * @returns {string}\n *   HTML.\n */\nfunction serialize(node) {\n  // Document.\n  if ('doctype' in node) {\n    const doctype = node.doctype ? serialize(node.doctype) : ''\n    const docelem = node.documentElement ? serialize(node.documentElement) : ''\n    return doctype + docelem\n  }\n\n  // Doctype.\n  if ('publicId' in node) {\n    // We don’t support non-HTML doctypes.\n    return '<DOCTYPE html>'\n  }\n\n  // Comment, element, fragment, text.\n  const template = document.createElement('template')\n  template.content.append(node)\n  return template.innerHTML\n}\n","/**\n * List of HTML void tag names.\n *\n * @type {Array<string>}\n */\nexport const htmlVoidElements = [\n  'area',\n  'base',\n  'basefont',\n  'bgsound',\n  'br',\n  'col',\n  'command',\n  'embed',\n  'frame',\n  'hr',\n  'image',\n  'img',\n  'input',\n  'keygen',\n  'link',\n  'meta',\n  'param',\n  'source',\n  'track',\n  'wbr'\n]\n","/**\n * @callback Handler\n *   Handle a value, with a certain ID field set to a certain value.\n *   The ID field is passed to `zwitch`, and it’s value is this function’s\n *   place on the `handlers` record.\n * @param {...any} parameters\n *   Arbitrary parameters passed to the zwitch.\n *   The first will be an object with a certain ID field set to a certain value.\n * @returns {any}\n *   Anything!\n */\n\n/**\n * @callback UnknownHandler\n *   Handle values that do have a certain ID field, but it’s set to a value\n *   that is not listed in the `handlers` record.\n * @param {unknown} value\n *   An object with a certain ID field set to an unknown value.\n * @param {...any} rest\n *   Arbitrary parameters passed to the zwitch.\n * @returns {any}\n *   Anything!\n */\n\n/**\n * @callback InvalidHandler\n *   Handle values that do not have a certain ID field.\n * @param {unknown} value\n *   Any unknown value.\n * @param {...any} rest\n *   Arbitrary parameters passed to the zwitch.\n * @returns {void|null|undefined|never}\n *   This should crash or return nothing.\n */\n\n/**\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @typedef Options\n *   Configuration (required).\n * @property {Invalid} [invalid]\n *   Handler to use for invalid values.\n * @property {Unknown} [unknown]\n *   Handler to use for unknown values.\n * @property {Handlers} [handlers]\n *   Handlers to use.\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Handle values based on a field.\n *\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @param {string} key\n *   Field to switch on.\n * @param {Options<Invalid, Unknown, Handlers>} [options]\n *   Configuration (required).\n * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}}\n */\nexport function zwitch(key, options) {\n  const settings = options || {}\n\n  /**\n   * Handle one value.\n   *\n   * Based on the bound `key`, a respective handler will be called.\n   * If `value` is not an object, or doesn’t have a `key` property, the special\n   * “invalid” handler will be called.\n   * If `value` has an unknown `key`, the special “unknown” handler will be\n   * called.\n   *\n   * All arguments, and the context object, are passed through to the handler,\n   * and it’s result is returned.\n   *\n   * @this {unknown}\n   *   Any context object.\n   * @param {unknown} [value]\n   *   Any value.\n   * @param {...unknown} parameters\n   *   Arbitrary parameters passed to the zwitch.\n   * @property {Handler} invalid\n   *   Handle for values that do not have a certain ID field.\n   * @property {Handler} unknown\n   *   Handle values that do have a certain ID field, but it’s set to a value\n   *   that is not listed in the `handlers` record.\n   * @property {Handlers} handlers\n   *   Record of handlers.\n   * @returns {unknown}\n   *   Anything.\n   */\n  function one(value, ...parameters) {\n    /** @type {Handler|undefined} */\n    let fn = one.invalid\n    const handlers = one.handlers\n\n    if (value && own.call(value, key)) {\n      // @ts-expect-error Indexable.\n      const id = String(value[key])\n      // @ts-expect-error Indexable.\n      fn = own.call(handlers, id) ? handlers[id] : one.unknown\n    }\n\n    if (fn) {\n      return fn.call(this, value, ...parameters)\n    }\n  }\n\n  one.handlers = settings.handlers || {}\n  one.invalid = settings.invalid\n  one.unknown = settings.unknown\n\n  // @ts-expect-error: matches!\n  return one\n}\n","/**\n * @typedef CoreOptions\n * @property {ReadonlyArray<string>} [subset=[]]\n *   Whether to only escape the given subset of characters.\n * @property {boolean} [escapeOnly=false]\n *   Whether to only escape possibly dangerous characters.\n *   Those characters are `\"`, `&`, `'`, `<`, `>`, and `` ` ``.\n *\n * @typedef FormatOptions\n * @property {(code: number, next: number, options: CoreWithFormatOptions) => string} format\n *   Format strategy.\n *\n * @typedef {CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions} CoreWithFormatOptions\n */\n\nconst defaultSubsetRegex = /[\"&'<>`]/g\nconst surrogatePairsRegex = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g\nconst controlCharactersRegex =\n  // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape\n  /[\\x01-\\t\\v\\f\\x0E-\\x1F\\x7F\\x81\\x8D\\x8F\\x90\\x9D\\xA0-\\uFFFF]/g\nconst regexEscapeRegex = /[|\\\\{}()[\\]^$+*?.]/g\n\n/** @type {WeakMap<ReadonlyArray<string>, RegExp>} */\nconst subsetToRegexCache = new WeakMap()\n\n/**\n * Encode certain characters in `value`.\n *\n * @param {string} value\n * @param {CoreWithFormatOptions} options\n * @returns {string}\n */\nexport function core(value, options) {\n  value = value.replace(\n    options.subset\n      ? charactersToExpressionCached(options.subset)\n      : defaultSubsetRegex,\n    basic\n  )\n\n  if (options.subset || options.escapeOnly) {\n    return value\n  }\n\n  return (\n    value\n      // Surrogate pairs.\n      .replace(surrogatePairsRegex, surrogate)\n      // BMP control characters (C0 except for LF, CR, SP; DEL; and some more\n      // non-ASCII ones).\n      .replace(controlCharactersRegex, basic)\n  )\n\n  /**\n   * @param {string} pair\n   * @param {number} index\n   * @param {string} all\n   */\n  function surrogate(pair, index, all) {\n    return options.format(\n      (pair.charCodeAt(0) - 0xd800) * 0x400 +\n        pair.charCodeAt(1) -\n        0xdc00 +\n        0x10000,\n      all.charCodeAt(index + 2),\n      options\n    )\n  }\n\n  /**\n   * @param {string} character\n   * @param {number} index\n   * @param {string} all\n   */\n  function basic(character, index, all) {\n    return options.format(\n      character.charCodeAt(0),\n      all.charCodeAt(index + 1),\n      options\n    )\n  }\n}\n\n/**\n * A wrapper function that caches the result of `charactersToExpression` with a WeakMap.\n * This can improve performance when tooling calls `charactersToExpression` repeatedly\n * with the same subset.\n *\n * @param {ReadonlyArray<string>} subset\n * @returns {RegExp}\n */\nfunction charactersToExpressionCached(subset) {\n  let cached = subsetToRegexCache.get(subset)\n\n  if (!cached) {\n    cached = charactersToExpression(subset)\n    subsetToRegexCache.set(subset, cached)\n  }\n\n  return cached\n}\n\n/**\n * @param {ReadonlyArray<string>} subset\n * @returns {RegExp}\n */\nfunction charactersToExpression(subset) {\n  /** @type {Array<string>} */\n  const groups = []\n  let index = -1\n\n  while (++index < subset.length) {\n    groups.push(subset[index].replace(regexEscapeRegex, '\\\\$&'))\n  }\n\n  return new RegExp('(?:' + groups.join('|') + ')', 'g')\n}\n","const hexadecimalRegex = /[\\dA-Fa-f]/\n\n/**\n * Configurable ways to encode characters as hexadecimal references.\n *\n * @param {number} code\n * @param {number} next\n * @param {boolean|undefined} omit\n * @returns {string}\n */\nexport function toHexadecimal(code, next, omit) {\n  const value = '&#x' + code.toString(16).toUpperCase()\n  return omit && next && !hexadecimalRegex.test(String.fromCharCode(next))\n    ? value\n    : value + ';'\n}\n","const decimalRegex = /\\d/\n\n/**\n * Configurable ways to encode characters as decimal references.\n *\n * @param {number} code\n * @param {number} next\n * @param {boolean|undefined} omit\n * @returns {string}\n */\nexport function toDecimal(code, next, omit) {\n  const value = '&#' + String(code)\n  return omit && next && !decimalRegex.test(String.fromCharCode(next))\n    ? value\n    : value + ';'\n}\n","/**\n * List of legacy HTML named character references that don’t need a trailing semicolon.\n *\n * @type {Array<string>}\n */\nexport const characterEntitiesLegacy = [\n  'AElig',\n  'AMP',\n  'Aacute',\n  'Acirc',\n  'Agrave',\n  'Aring',\n  'Atilde',\n  'Auml',\n  'COPY',\n  'Ccedil',\n  'ETH',\n  'Eacute',\n  'Ecirc',\n  'Egrave',\n  'Euml',\n  'GT',\n  'Iacute',\n  'Icirc',\n  'Igrave',\n  'Iuml',\n  'LT',\n  'Ntilde',\n  'Oacute',\n  'Ocirc',\n  'Ograve',\n  'Oslash',\n  'Otilde',\n  'Ouml',\n  'QUOT',\n  'REG',\n  'THORN',\n  'Uacute',\n  'Ucirc',\n  'Ugrave',\n  'Uuml',\n  'Yacute',\n  'aacute',\n  'acirc',\n  'acute',\n  'aelig',\n  'agrave',\n  'amp',\n  'aring',\n  'atilde',\n  'auml',\n  'brvbar',\n  'ccedil',\n  'cedil',\n  'cent',\n  'copy',\n  'curren',\n  'deg',\n  'divide',\n  'eacute',\n  'ecirc',\n  'egrave',\n  'eth',\n  'euml',\n  'frac12',\n  'frac14',\n  'frac34',\n  'gt',\n  'iacute',\n  'icirc',\n  'iexcl',\n  'igrave',\n  'iquest',\n  'iuml',\n  'laquo',\n  'lt',\n  'macr',\n  'micro',\n  'middot',\n  'nbsp',\n  'not',\n  'ntilde',\n  'oacute',\n  'ocirc',\n  'ograve',\n  'ordf',\n  'ordm',\n  'oslash',\n  'otilde',\n  'ouml',\n  'para',\n  'plusmn',\n  'pound',\n  'quot',\n  'raquo',\n  'reg',\n  'sect',\n  'shy',\n  'sup1',\n  'sup2',\n  'sup3',\n  'szlig',\n  'thorn',\n  'times',\n  'uacute',\n  'ucirc',\n  'ugrave',\n  'uml',\n  'uuml',\n  'yacute',\n  'yen',\n  'yuml'\n]\n","/**\n * Map of named character references from HTML 4.\n *\n * @type {Record<string, string>}\n */\nexport const characterEntitiesHtml4 = {\n  nbsp: ' ',\n  iexcl: '¡',\n  cent: '¢',\n  pound: '£',\n  curren: '¤',\n  yen: '¥',\n  brvbar: '¦',\n  sect: '§',\n  uml: '¨',\n  copy: '©',\n  ordf: 'ª',\n  laquo: '«',\n  not: '¬',\n  shy: '­',\n  reg: '®',\n  macr: '¯',\n  deg: '°',\n  plusmn: '±',\n  sup2: '²',\n  sup3: '³',\n  acute: '´',\n  micro: 'µ',\n  para: '¶',\n  middot: '·',\n  cedil: '¸',\n  sup1: '¹',\n  ordm: 'º',\n  raquo: '»',\n  frac14: '¼',\n  frac12: '½',\n  frac34: '¾',\n  iquest: '¿',\n  Agrave: 'À',\n  Aacute: 'Á',\n  Acirc: 'Â',\n  Atilde: 'Ã',\n  Auml: 'Ä',\n  Aring: 'Å',\n  AElig: 'Æ',\n  Ccedil: 'Ç',\n  Egrave: 'È',\n  Eacute: 'É',\n  Ecirc: 'Ê',\n  Euml: 'Ë',\n  Igrave: 'Ì',\n  Iacute: 'Í',\n  Icirc: 'Î',\n  Iuml: 'Ï',\n  ETH: 'Ð',\n  Ntilde: 'Ñ',\n  Ograve: 'Ò',\n  Oacute: 'Ó',\n  Ocirc: 'Ô',\n  Otilde: 'Õ',\n  Ouml: 'Ö',\n  times: '×',\n  Oslash: 'Ø',\n  Ugrave: 'Ù',\n  Uacute: 'Ú',\n  Ucirc: 'Û',\n  Uuml: 'Ü',\n  Yacute: 'Ý',\n  THORN: 'Þ',\n  szlig: 'ß',\n  agrave: 'à',\n  aacute: 'á',\n  acirc: 'â',\n  atilde: 'ã',\n  auml: 'ä',\n  aring: 'å',\n  aelig: 'æ',\n  ccedil: 'ç',\n  egrave: 'è',\n  eacute: 'é',\n  ecirc: 'ê',\n  euml: 'ë',\n  igrave: 'ì',\n  iacute: 'í',\n  icirc: 'î',\n  iuml: 'ï',\n  eth: 'ð',\n  ntilde: 'ñ',\n  ograve: 'ò',\n  oacute: 'ó',\n  ocirc: 'ô',\n  otilde: 'õ',\n  ouml: 'ö',\n  divide: '÷',\n  oslash: 'ø',\n  ugrave: 'ù',\n  uacute: 'ú',\n  ucirc: 'û',\n  uuml: 'ü',\n  yacute: 'ý',\n  thorn: 'þ',\n  yuml: 'ÿ',\n  fnof: 'ƒ',\n  Alpha: 'Α',\n  Beta: 'Β',\n  Gamma: 'Γ',\n  Delta: 'Δ',\n  Epsilon: 'Ε',\n  Zeta: 'Ζ',\n  Eta: 'Η',\n  Theta: 'Θ',\n  Iota: 'Ι',\n  Kappa: 'Κ',\n  Lambda: 'Λ',\n  Mu: 'Μ',\n  Nu: 'Ν',\n  Xi: 'Ξ',\n  Omicron: 'Ο',\n  Pi: 'Π',\n  Rho: 'Ρ',\n  Sigma: 'Σ',\n  Tau: 'Τ',\n  Upsilon: 'Υ',\n  Phi: 'Φ',\n  Chi: 'Χ',\n  Psi: 'Ψ',\n  Omega: 'Ω',\n  alpha: 'α',\n  beta: 'β',\n  gamma: 'γ',\n  delta: 'δ',\n  epsilon: 'ε',\n  zeta: 'ζ',\n  eta: 'η',\n  theta: 'θ',\n  iota: 'ι',\n  kappa: 'κ',\n  lambda: 'λ',\n  mu: 'μ',\n  nu: 'ν',\n  xi: 'ξ',\n  omicron: 'ο',\n  pi: 'π',\n  rho: 'ρ',\n  sigmaf: 'ς',\n  sigma: 'σ',\n  tau: 'τ',\n  upsilon: 'υ',\n  phi: 'φ',\n  chi: 'χ',\n  psi: 'ψ',\n  omega: 'ω',\n  thetasym: 'ϑ',\n  upsih: 'ϒ',\n  piv: 'ϖ',\n  bull: '•',\n  hellip: '…',\n  prime: '′',\n  Prime: '″',\n  oline: '‾',\n  frasl: '⁄',\n  weierp: '℘',\n  image: 'ℑ',\n  real: 'ℜ',\n  trade: '™',\n  alefsym: 'ℵ',\n  larr: '←',\n  uarr: '↑',\n  rarr: '→',\n  darr: '↓',\n  harr: '↔',\n  crarr: '↵',\n  lArr: '⇐',\n  uArr: '⇑',\n  rArr: '⇒',\n  dArr: '⇓',\n  hArr: '⇔',\n  forall: '∀',\n  part: '∂',\n  exist: '∃',\n  empty: '∅',\n  nabla: '∇',\n  isin: '∈',\n  notin: '∉',\n  ni: '∋',\n  prod: '∏',\n  sum: '∑',\n  minus: '−',\n  lowast: '∗',\n  radic: '√',\n  prop: '∝',\n  infin: '∞',\n  ang: '∠',\n  and: '∧',\n  or: '∨',\n  cap: '∩',\n  cup: '∪',\n  int: '∫',\n  there4: '∴',\n  sim: '∼',\n  cong: '≅',\n  asymp: '≈',\n  ne: '≠',\n  equiv: '≡',\n  le: '≤',\n  ge: '≥',\n  sub: '⊂',\n  sup: '⊃',\n  nsub: '⊄',\n  sube: '⊆',\n  supe: '⊇',\n  oplus: '⊕',\n  otimes: '⊗',\n  perp: '⊥',\n  sdot: '⋅',\n  lceil: '⌈',\n  rceil: '⌉',\n  lfloor: '⌊',\n  rfloor: '⌋',\n  lang: '〈',\n  rang: '〉',\n  loz: '◊',\n  spades: '♠',\n  clubs: '♣',\n  hearts: '♥',\n  diams: '♦',\n  quot: '\"',\n  amp: '&',\n  lt: '<',\n  gt: '>',\n  OElig: 'Œ',\n  oelig: 'œ',\n  Scaron: 'Š',\n  scaron: 'š',\n  Yuml: 'Ÿ',\n  circ: 'ˆ',\n  tilde: '˜',\n  ensp: ' ',\n  emsp: ' ',\n  thinsp: ' ',\n  zwnj: '‌',\n  zwj: '‍',\n  lrm: '‎',\n  rlm: '‏',\n  ndash: '–',\n  mdash: '—',\n  lsquo: '‘',\n  rsquo: '’',\n  sbquo: '‚',\n  ldquo: '“',\n  rdquo: '”',\n  bdquo: '„',\n  dagger: '†',\n  Dagger: '‡',\n  permil: '‰',\n  lsaquo: '‹',\n  rsaquo: '›',\n  euro: '€'\n}\n","/**\n * List of legacy (that don’t need a trailing `;`) named references which could,\n * depending on what follows them, turn into a different meaning\n *\n * @type {Array<string>}\n */\nexport const dangerous = [\n  'cent',\n  'copy',\n  'divide',\n  'gt',\n  'lt',\n  'not',\n  'para',\n  'times'\n]\n","import {characterEntitiesLegacy} from 'character-entities-legacy'\nimport {characterEntitiesHtml4} from 'character-entities-html4'\nimport {dangerous} from '../constant/dangerous.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * `characterEntitiesHtml4` but inverted.\n *\n * @type {Record<string, string>}\n */\nconst characters = {}\n\n/** @type {string} */\nlet key\n\nfor (key in characterEntitiesHtml4) {\n  if (own.call(characterEntitiesHtml4, key)) {\n    characters[characterEntitiesHtml4[key]] = key\n  }\n}\n\nconst notAlphanumericRegex = /[^\\dA-Za-z]/\n\n/**\n * Configurable ways to encode characters as named references.\n *\n * @param {number} code\n * @param {number} next\n * @param {boolean|undefined} omit\n * @param {boolean|undefined} attribute\n * @returns {string}\n */\nexport function toNamed(code, next, omit, attribute) {\n  const character = String.fromCharCode(code)\n\n  if (own.call(characters, character)) {\n    const name = characters[character]\n    const value = '&' + name\n\n    if (\n      omit &&\n      characterEntitiesLegacy.includes(name) &&\n      !dangerous.includes(name) &&\n      (!attribute ||\n        (next &&\n          next !== 61 /* `=` */ &&\n          notAlphanumericRegex.test(String.fromCharCode(next))))\n    ) {\n      return value\n    }\n\n    return value + ';'\n  }\n\n  return ''\n}\n","/**\n * @typedef FormatSmartOptions\n * @property {boolean} [useNamedReferences=false]\n *   Prefer named character references (`&amp;`) where possible.\n * @property {boolean} [useShortestReferences=false]\n *   Prefer the shortest possible reference, if that results in less bytes.\n *   **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.\n * @property {boolean} [omitOptionalSemicolons=false]\n *   Whether to omit semicolons when possible.\n *   **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.\n *   Omitting semicolons is possible for certain named and numeric references in some cases.\n * @property {boolean} [attribute=false]\n *   Create character references which don’t fail in attributes.\n *   **Note**: `attribute` only applies when operating dangerously with\n *   `omitOptionalSemicolons: true`.\n */\n\nimport {toHexadecimal} from './to-hexadecimal.js'\nimport {toDecimal} from './to-decimal.js'\nimport {toNamed} from './to-named.js'\n\n/**\n * Configurable ways to encode a character yielding pretty or small results.\n *\n * @param {number} code\n * @param {number} next\n * @param {FormatSmartOptions} options\n * @returns {string}\n */\nexport function formatSmart(code, next, options) {\n  let numeric = toHexadecimal(code, next, options.omitOptionalSemicolons)\n  /** @type {string|undefined} */\n  let named\n\n  if (options.useNamedReferences || options.useShortestReferences) {\n    named = toNamed(\n      code,\n      next,\n      options.omitOptionalSemicolons,\n      options.attribute\n    )\n  }\n\n  // Use the shortest numeric reference when requested.\n  // A simple algorithm would use decimal for all code points under 100, as\n  // those are shorter than hexadecimal:\n  //\n  // * `&#99;` vs `&#x63;` (decimal shorter)\n  // * `&#100;` vs `&#x64;` (equal)\n  //\n  // However, because we take `next` into consideration when `omit` is used,\n  // And it would be possible that decimals are shorter on bigger values as\n  // well if `next` is hexadecimal but not decimal, we instead compare both.\n  if (\n    (options.useShortestReferences || !named) &&\n    options.useShortestReferences\n  ) {\n    const decimal = toDecimal(code, next, options.omitOptionalSemicolons)\n\n    if (decimal.length < numeric.length) {\n      numeric = decimal\n    }\n  }\n\n  return named &&\n    (!options.useShortestReferences || named.length < numeric.length)\n    ? named\n    : numeric\n}\n","/**\n * @typedef {import('./core.js').CoreOptions & import('./util/format-smart.js').FormatSmartOptions} Options\n * @typedef {import('./core.js').CoreOptions} LightOptions\n */\n\nimport {core} from './core.js'\nimport {formatSmart} from './util/format-smart.js'\nimport {formatBasic} from './util/format-basic.js'\n\n/**\n * Encode special characters in `value`.\n *\n * @param {string} value\n *   Value to encode.\n * @param {Options} [options]\n *   Configuration.\n * @returns {string}\n *   Encoded value.\n */\nexport function stringifyEntities(value, options) {\n  return core(value, Object.assign({format: formatSmart}, options))\n}\n\n/**\n * Encode special characters in `value` as hexadecimals.\n *\n * @param {string} value\n *   Value to encode.\n * @param {LightOptions} [options]\n *   Configuration.\n * @returns {string}\n *   Encoded value.\n */\nexport function stringifyEntitiesLight(value, options) {\n  return core(value, Object.assign({format: formatBasic}, options))\n}\n","/**\n * @import {Comment, Parents} from 'hast'\n * @import {State} from '../index.js'\n */\n\nimport {stringifyEntities} from 'stringify-entities'\n\nconst htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g\n\n// Declare arrays as variables so it can be cached by `stringifyEntities`\nconst bogusCommentEntitySubset = ['>']\nconst commentEntitySubset = ['<', '>']\n\n/**\n * Serialize a comment.\n *\n * @param {Comment} node\n *   Node to handle.\n * @param {number | undefined} _1\n *   Index of `node` in `parent.\n * @param {Parents | undefined} _2\n *   Parent of `node`.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {string}\n *   Serialized node.\n */\nexport function comment(node, _1, _2, state) {\n  // See: <https://html.spec.whatwg.org/multipage/syntax.html#comments>\n  return state.settings.bogusComments\n    ? '<?' +\n        stringifyEntities(\n          node.value,\n          Object.assign({}, state.settings.characterReferences, {\n            subset: bogusCommentEntitySubset\n          })\n        ) +\n        '>'\n    : '<!--' + node.value.replace(htmlCommentRegex, encode) + '-->'\n\n  /**\n   * @param {string} $0\n   */\n  function encode($0) {\n    return stringifyEntities(\n      $0,\n      Object.assign({}, state.settings.characterReferences, {\n        subset: commentEntitySubset\n      })\n    )\n  }\n}\n","/**\n * @typedef Options\n *   Configuration for `stringify`.\n * @property {boolean} [padLeft=true]\n *   Whether to pad a space before a token.\n * @property {boolean} [padRight=false]\n *   Whether to pad a space after a token.\n */\n\n/**\n * @typedef {Options} StringifyOptions\n *   Please use `StringifyOptions` instead.\n */\n\n/**\n * Parse comma-separated tokens to an array.\n *\n * @param {string} value\n *   Comma-separated tokens.\n * @returns {Array<string>}\n *   List of tokens.\n */\nexport function parse(value) {\n  /** @type {Array<string>} */\n  const tokens = []\n  const input = String(value || '')\n  let index = input.indexOf(',')\n  let start = 0\n  /** @type {boolean} */\n  let end = false\n\n  while (!end) {\n    if (index === -1) {\n      index = input.length\n      end = true\n    }\n\n    const token = input.slice(start, index).trim()\n\n    if (token || !end) {\n      tokens.push(token)\n    }\n\n    start = index + 1\n    index = input.indexOf(',', start)\n  }\n\n  return tokens\n}\n\n/**\n * Serialize an array of strings or numbers to comma-separated tokens.\n *\n * @param {Array<string|number>} values\n *   List of tokens.\n * @param {Options} [options]\n *   Configuration for `stringify` (optional).\n * @returns {string}\n *   Comma-separated tokens.\n */\nexport function stringify(values, options) {\n  const settings = options || {}\n\n  // Ensure the last empty entry is seen.\n  const input = values[values.length - 1] === '' ? [...values, ''] : values\n\n  return input\n    .join(\n      (settings.padRight ? ' ' : '') +\n        ',' +\n        (settings.padLeft === false ? '' : ' ')\n    )\n    .trim()\n}\n","/**\n * Parse space-separated tokens to an array of strings.\n *\n * @param {string} value\n *   Space-separated tokens.\n * @returns {Array<string>}\n *   List of tokens.\n */\nexport function parse(value) {\n  const input = String(value || '').trim()\n  return input ? input.split(/[ \\t\\n\\r\\f]+/g) : []\n}\n\n/**\n * Serialize an array of strings as space separated-tokens.\n *\n * @param {Array<string|number>} values\n *   List of tokens.\n * @returns {string}\n *   Space-separated tokens.\n */\nexport function stringify(values) {\n  return values.join(' ').trim()\n}\n","/**\n * @typedef {import('hast').Nodes} Nodes\n */\n\n// HTML whitespace expression.\n// See <https://infra.spec.whatwg.org/#ascii-whitespace>.\nconst re = /[ \\t\\n\\f\\r]/g\n\n/**\n * Check if the given value is *inter-element whitespace*.\n *\n * @param {Nodes | string} thing\n *   Thing to check (`Node` or `string`).\n * @returns {boolean}\n *   Whether the `value` is inter-element whitespace (`boolean`): consisting of\n *   zero or more of space, tab (`\\t`), line feed (`\\n`), carriage return\n *   (`\\r`), or form feed (`\\f`); if a node is passed it must be a `Text` node,\n *   whose `value` field is checked.\n */\nexport function whitespace(thing) {\n  return typeof thing === 'object'\n    ? thing.type === 'text'\n      ? empty(thing.value)\n      : false\n    : empty(thing)\n}\n\n/**\n * @param {string} value\n * @returns {boolean}\n */\nfunction empty(value) {\n  return value.replace(re, '') === ''\n}\n","/**\n * @import {Parents, RootContent} from 'hast'\n */\n\nimport {whitespace} from 'hast-util-whitespace'\n\nexport const siblingAfter = siblings(1)\nexport const siblingBefore = siblings(-1)\n\n/** @type {Array<RootContent>} */\nconst emptyChildren = []\n\n/**\n * Factory to check siblings in a direction.\n *\n * @param {number} increment\n */\nfunction siblings(increment) {\n  return sibling\n\n  /**\n   * Find applicable siblings in a direction.\n   *\n   * @template {Parents} Parent\n   *   Parent type.\n   * @param {Parent | undefined} parent\n   *   Parent.\n   * @param {number | undefined} index\n   *   Index of child in `parent`.\n   * @param {boolean | undefined} [includeWhitespace=false]\n   *   Whether to include whitespace (default: `false`).\n   * @returns {Parent extends {children: Array<infer Child>} ? Child | undefined : never}\n   *   Child of parent.\n   */\n  function sibling(parent, index, includeWhitespace) {\n    const siblings = parent ? parent.children : emptyChildren\n    let offset = (index || 0) + increment\n    let next = siblings[offset]\n\n    if (!includeWhitespace) {\n      while (next && whitespace(next)) {\n        offset += increment\n        next = siblings[offset]\n      }\n    }\n\n    // @ts-expect-error: it’s a correct child.\n    return next\n  }\n}\n","/**\n * @import {Element, Parents} from 'hast'\n */\n\n/**\n * @callback OmitHandle\n *   Check if a tag can be omitted.\n * @param {Element} element\n *   Element to check.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether to omit a tag.\n *\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Factory to check if a given node can have a tag omitted.\n *\n * @param {Record<string, OmitHandle>} handlers\n *   Omission handlers, where each key is a tag name, and each value is the\n *   corresponding handler.\n * @returns {OmitHandle}\n *   Whether to omit a tag of an element.\n */\nexport function omission(handlers) {\n  return omit\n\n  /**\n   * Check if a given node can have a tag omitted.\n   *\n   * @type {OmitHandle}\n   */\n  function omit(node, index, parent) {\n    return (\n      own.call(handlers, node.tagName) &&\n      handlers[node.tagName](node, index, parent)\n    )\n  }\n}\n","/**\n * @import {Element, Parents} from 'hast'\n */\n\nimport {whitespace} from 'hast-util-whitespace'\nimport {siblingAfter} from './util/siblings.js'\nimport {omission} from './omission.js'\n\nexport const closing = omission({\n  body,\n  caption: headOrColgroupOrCaption,\n  colgroup: headOrColgroupOrCaption,\n  dd,\n  dt,\n  head: headOrColgroupOrCaption,\n  html,\n  li,\n  optgroup,\n  option,\n  p,\n  rp: rubyElement,\n  rt: rubyElement,\n  tbody,\n  td: cells,\n  tfoot,\n  th: cells,\n  thead,\n  tr\n})\n\n/**\n * Macro for `</head>`, `</colgroup>`, and `</caption>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction headOrColgroupOrCaption(_, index, parent) {\n  const next = siblingAfter(parent, index, true)\n  return (\n    !next ||\n    (next.type !== 'comment' &&\n      !(next.type === 'text' && whitespace(next.value.charAt(0))))\n  )\n}\n\n/**\n * Whether to omit `</html>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction html(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return !next || next.type !== 'comment'\n}\n\n/**\n * Whether to omit `</body>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction body(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return !next || next.type !== 'comment'\n}\n\n/**\n * Whether to omit `</p>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction p(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return next\n    ? next.type === 'element' &&\n        (next.tagName === 'address' ||\n          next.tagName === 'article' ||\n          next.tagName === 'aside' ||\n          next.tagName === 'blockquote' ||\n          next.tagName === 'details' ||\n          next.tagName === 'div' ||\n          next.tagName === 'dl' ||\n          next.tagName === 'fieldset' ||\n          next.tagName === 'figcaption' ||\n          next.tagName === 'figure' ||\n          next.tagName === 'footer' ||\n          next.tagName === 'form' ||\n          next.tagName === 'h1' ||\n          next.tagName === 'h2' ||\n          next.tagName === 'h3' ||\n          next.tagName === 'h4' ||\n          next.tagName === 'h5' ||\n          next.tagName === 'h6' ||\n          next.tagName === 'header' ||\n          next.tagName === 'hgroup' ||\n          next.tagName === 'hr' ||\n          next.tagName === 'main' ||\n          next.tagName === 'menu' ||\n          next.tagName === 'nav' ||\n          next.tagName === 'ol' ||\n          next.tagName === 'p' ||\n          next.tagName === 'pre' ||\n          next.tagName === 'section' ||\n          next.tagName === 'table' ||\n          next.tagName === 'ul')\n    : !parent ||\n        // Confusing parent.\n        !(\n          parent.type === 'element' &&\n          (parent.tagName === 'a' ||\n            parent.tagName === 'audio' ||\n            parent.tagName === 'del' ||\n            parent.tagName === 'ins' ||\n            parent.tagName === 'map' ||\n            parent.tagName === 'noscript' ||\n            parent.tagName === 'video')\n        )\n}\n\n/**\n * Whether to omit `</li>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction li(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return !next || (next.type === 'element' && next.tagName === 'li')\n}\n\n/**\n * Whether to omit `</dt>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction dt(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return Boolean(\n    next &&\n      next.type === 'element' &&\n      (next.tagName === 'dt' || next.tagName === 'dd')\n  )\n}\n\n/**\n * Whether to omit `</dd>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction dd(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return (\n    !next ||\n    (next.type === 'element' &&\n      (next.tagName === 'dt' || next.tagName === 'dd'))\n  )\n}\n\n/**\n * Whether to omit `</rt>` or `</rp>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction rubyElement(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return (\n    !next ||\n    (next.type === 'element' &&\n      (next.tagName === 'rp' || next.tagName === 'rt'))\n  )\n}\n\n/**\n * Whether to omit `</optgroup>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction optgroup(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return !next || (next.type === 'element' && next.tagName === 'optgroup')\n}\n\n/**\n * Whether to omit `</option>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction option(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return (\n    !next ||\n    (next.type === 'element' &&\n      (next.tagName === 'option' || next.tagName === 'optgroup'))\n  )\n}\n\n/**\n * Whether to omit `</thead>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction thead(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return Boolean(\n    next &&\n      next.type === 'element' &&\n      (next.tagName === 'tbody' || next.tagName === 'tfoot')\n  )\n}\n\n/**\n * Whether to omit `</tbody>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction tbody(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return (\n    !next ||\n    (next.type === 'element' &&\n      (next.tagName === 'tbody' || next.tagName === 'tfoot'))\n  )\n}\n\n/**\n * Whether to omit `</tfoot>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction tfoot(_, index, parent) {\n  return !siblingAfter(parent, index)\n}\n\n/**\n * Whether to omit `</tr>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction tr(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return !next || (next.type === 'element' && next.tagName === 'tr')\n}\n\n/**\n * Whether to omit `</td>` or `</th>`.\n *\n * @param {Element} _\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the closing tag can be omitted.\n */\nfunction cells(_, index, parent) {\n  const next = siblingAfter(parent, index)\n  return (\n    !next ||\n    (next.type === 'element' &&\n      (next.tagName === 'td' || next.tagName === 'th'))\n  )\n}\n","/**\n * @import {Element, Parents} from 'hast'\n */\n\nimport {whitespace} from 'hast-util-whitespace'\nimport {siblingAfter, siblingBefore} from './util/siblings.js'\nimport {closing} from './closing.js'\nimport {omission} from './omission.js'\n\nexport const opening = omission({\n  body,\n  colgroup,\n  head,\n  html,\n  tbody\n})\n\n/**\n * Whether to omit `<html>`.\n *\n * @param {Element} node\n *   Element.\n * @returns {boolean}\n *   Whether the opening tag can be omitted.\n */\nfunction html(node) {\n  const head = siblingAfter(node, -1)\n  return !head || head.type !== 'comment'\n}\n\n/**\n * Whether to omit `<head>`.\n *\n * @param {Element} node\n *   Element.\n * @returns {boolean}\n *   Whether the opening tag can be omitted.\n */\nfunction head(node) {\n  /** @type {Set<string>} */\n  const seen = new Set()\n\n  // Whether `srcdoc` or not,\n  // make sure the content model at least doesn’t have too many `base`s/`title`s.\n  for (const child of node.children) {\n    if (\n      child.type === 'element' &&\n      (child.tagName === 'base' || child.tagName === 'title')\n    ) {\n      if (seen.has(child.tagName)) return false\n      seen.add(child.tagName)\n    }\n  }\n\n  // “May be omitted if the element is empty,\n  // or if the first thing inside the head element is an element.”\n  const child = node.children[0]\n  return !child || child.type === 'element'\n}\n\n/**\n * Whether to omit `<body>`.\n *\n * @param {Element} node\n *   Element.\n * @returns {boolean}\n *   Whether the opening tag can be omitted.\n */\nfunction body(node) {\n  const head = siblingAfter(node, -1, true)\n\n  return (\n    !head ||\n    (head.type !== 'comment' &&\n      !(head.type === 'text' && whitespace(head.value.charAt(0))) &&\n      !(\n        head.type === 'element' &&\n        (head.tagName === 'meta' ||\n          head.tagName === 'link' ||\n          head.tagName === 'script' ||\n          head.tagName === 'style' ||\n          head.tagName === 'template')\n      ))\n  )\n}\n\n/**\n * Whether to omit `<colgroup>`.\n * The spec describes some logic for the opening tag, but it’s easier to\n * implement in the closing tag, to the same effect, so we handle it there\n * instead.\n *\n * @param {Element} node\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the opening tag can be omitted.\n */\nfunction colgroup(node, index, parent) {\n  const previous = siblingBefore(parent, index)\n  const head = siblingAfter(node, -1, true)\n\n  // Previous colgroup was already omitted.\n  if (\n    parent &&\n    previous &&\n    previous.type === 'element' &&\n    previous.tagName === 'colgroup' &&\n    closing(previous, parent.children.indexOf(previous), parent)\n  ) {\n    return false\n  }\n\n  return Boolean(head && head.type === 'element' && head.tagName === 'col')\n}\n\n/**\n * Whether to omit `<tbody>`.\n *\n * @param {Element} node\n *   Element.\n * @param {number | undefined} index\n *   Index of element in parent.\n * @param {Parents | undefined} parent\n *   Parent of element.\n * @returns {boolean}\n *   Whether the opening tag can be omitted.\n */\nfunction tbody(node, index, parent) {\n  const previous = siblingBefore(parent, index)\n  const head = siblingAfter(node, -1)\n\n  // Previous table section was already omitted.\n  if (\n    parent &&\n    previous &&\n    previous.type === 'element' &&\n    (previous.tagName === 'thead' || previous.tagName === 'tbody') &&\n    closing(previous, parent.children.indexOf(previous), parent)\n  ) {\n    return false\n  }\n\n  return Boolean(head && head.type === 'element' && head.tagName === 'tr')\n}\n","/**\n * @import {Element, Parents, Properties} from 'hast'\n * @import {State} from '../index.js'\n */\n\nimport {ccount} from 'ccount'\nimport {stringify as commas} from 'comma-separated-tokens'\nimport {find, svg} from 'property-information'\nimport {stringify as spaces} from 'space-separated-tokens'\nimport {stringifyEntities} from 'stringify-entities'\nimport {closing} from '../omission/closing.js'\nimport {opening} from '../omission/opening.js'\n\n/**\n * Maps of subsets.\n *\n * Each value is a matrix of tuples.\n * The value at `0` causes parse errors, the value at `1` is valid.\n * Of both, the value at `0` is unsafe, and the value at `1` is safe.\n *\n * @type {Record<'double' | 'name' | 'single' | 'unquoted', Array<[Array<string>, Array<string>]>>}\n */\nconst constants = {\n  // See: <https://html.spec.whatwg.org/#attribute-name-state>.\n  name: [\n    ['\\t\\n\\f\\r &/=>'.split(''), '\\t\\n\\f\\r \"&\\'/=>`'.split('')],\n    ['\\0\\t\\n\\f\\r \"&\\'/<=>'.split(''), '\\0\\t\\n\\f\\r \"&\\'/<=>`'.split('')]\n  ],\n  // See: <https://html.spec.whatwg.org/#attribute-value-(unquoted)-state>.\n  unquoted: [\n    ['\\t\\n\\f\\r &>'.split(''), '\\0\\t\\n\\f\\r \"&\\'<=>`'.split('')],\n    ['\\0\\t\\n\\f\\r \"&\\'<=>`'.split(''), '\\0\\t\\n\\f\\r \"&\\'<=>`'.split('')]\n  ],\n  // See: <https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state>.\n  single: [\n    [\"&'\".split(''), '\"&\\'`'.split('')],\n    [\"\\0&'\".split(''), '\\0\"&\\'`'.split('')]\n  ],\n  // See: <https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state>.\n  double: [\n    ['\"&'.split(''), '\"&\\'`'.split('')],\n    ['\\0\"&'.split(''), '\\0\"&\\'`'.split('')]\n  ]\n}\n\n/**\n * Serialize an element node.\n *\n * @param {Element} node\n *   Node to handle.\n * @param {number | undefined} index\n *   Index of `node` in `parent.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {string}\n *   Serialized node.\n */\nexport function element(node, index, parent, state) {\n  const schema = state.schema\n  const omit = schema.space === 'svg' ? false : state.settings.omitOptionalTags\n  let selfClosing =\n    schema.space === 'svg'\n      ? state.settings.closeEmptyElements\n      : state.settings.voids.includes(node.tagName.toLowerCase())\n  /** @type {Array<string>} */\n  const parts = []\n  /** @type {string} */\n  let last\n\n  if (schema.space === 'html' && node.tagName === 'svg') {\n    state.schema = svg\n  }\n\n  const attributes = serializeAttributes(state, node.properties)\n\n  const content = state.all(\n    schema.space === 'html' && node.tagName === 'template' ? node.content : node\n  )\n\n  state.schema = schema\n\n  // If the node is categorised as void, but it has children, remove the\n  // categorisation.\n  // This enables for example `menuitem`s, which are void in W3C HTML but not\n  // void in WHATWG HTML, to be stringified properly.\n  // Note: `menuitem` has since been removed from the HTML spec, and so is no\n  // longer void.\n  if (content) selfClosing = false\n\n  if (attributes || !omit || !opening(node, index, parent)) {\n    parts.push('<', node.tagName, attributes ? ' ' + attributes : '')\n\n    if (\n      selfClosing &&\n      (schema.space === 'svg' || state.settings.closeSelfClosing)\n    ) {\n      last = attributes.charAt(attributes.length - 1)\n      if (\n        !state.settings.tightSelfClosing ||\n        last === '/' ||\n        (last && last !== '\"' && last !== \"'\")\n      ) {\n        parts.push(' ')\n      }\n\n      parts.push('/')\n    }\n\n    parts.push('>')\n  }\n\n  parts.push(content)\n\n  if (!selfClosing && (!omit || !closing(node, index, parent))) {\n    parts.push('</' + node.tagName + '>')\n  }\n\n  return parts.join('')\n}\n\n/**\n * @param {State} state\n * @param {Properties | null | undefined} properties\n * @returns {string}\n */\nfunction serializeAttributes(state, properties) {\n  /** @type {Array<string>} */\n  const values = []\n  let index = -1\n  /** @type {string} */\n  let key\n\n  if (properties) {\n    for (key in properties) {\n      if (properties[key] !== null && properties[key] !== undefined) {\n        const value = serializeAttribute(state, key, properties[key])\n        if (value) values.push(value)\n      }\n    }\n  }\n\n  while (++index < values.length) {\n    const last = state.settings.tightAttributes\n      ? values[index].charAt(values[index].length - 1)\n      : undefined\n\n    // In tight mode, don’t add a space after quoted attributes.\n    if (index !== values.length - 1 && last !== '\"' && last !== \"'\") {\n      values[index] += ' '\n    }\n  }\n\n  return values.join('')\n}\n\n/**\n * @param {State} state\n * @param {string} key\n * @param {Properties[keyof Properties]} value\n * @returns {string}\n */\nfunction serializeAttribute(state, key, value) {\n  const info = find(state.schema, key)\n  const x =\n    state.settings.allowParseErrors && state.schema.space === 'html' ? 0 : 1\n  const y = state.settings.allowDangerousCharacters ? 0 : 1\n  let quote = state.quote\n  /** @type {string | undefined} */\n  let result\n\n  if (info.overloadedBoolean && (value === info.attribute || value === '')) {\n    value = true\n  } else if (\n    (info.boolean || info.overloadedBoolean) &&\n    (typeof value !== 'string' || value === info.attribute || value === '')\n  ) {\n    value = Boolean(value)\n  }\n\n  if (\n    value === null ||\n    value === undefined ||\n    value === false ||\n    (typeof value === 'number' && Number.isNaN(value))\n  ) {\n    return ''\n  }\n\n  const name = stringifyEntities(\n    info.attribute,\n    Object.assign({}, state.settings.characterReferences, {\n      // Always encode without parse errors in non-HTML.\n      subset: constants.name[x][y]\n    })\n  )\n\n  // No value.\n  // There is currently only one boolean property in SVG: `[download]` on\n  // `<a>`.\n  // This property does not seem to work in browsers (Firefox, Safari, Chrome),\n  // so I can’t test if dropping the value works.\n  // But I assume that it should:\n  //\n  // ```html\n  // <!doctype html>\n  // <svg viewBox=\"0 0 100 100\">\n  //   <a href=https://example.com download>\n  //     <circle cx=50 cy=40 r=35 />\n  //   </a>\n  // </svg>\n  // ```\n  //\n  // See: <https://github.com/wooorm/property-information/blob/main/lib/svg.js>\n  if (value === true) return name\n\n  // `spaces` doesn’t accept a second argument, but it’s given here just to\n  // keep the code cleaner.\n  value = Array.isArray(value)\n    ? (info.commaSeparated ? commas : spaces)(value, {\n        padLeft: !state.settings.tightCommaSeparatedLists\n      })\n    : String(value)\n\n  if (state.settings.collapseEmptyAttributes && !value) return name\n\n  // Check unquoted value.\n  if (state.settings.preferUnquoted) {\n    result = stringifyEntities(\n      value,\n      Object.assign({}, state.settings.characterReferences, {\n        attribute: true,\n        subset: constants.unquoted[x][y]\n      })\n    )\n  }\n\n  // If we don’t want unquoted, or if `value` contains character references when\n  // unquoted…\n  if (result !== value) {\n    // If the alternative is less common than `quote`, switch.\n    if (\n      state.settings.quoteSmart &&\n      ccount(value, quote) > ccount(value, state.alternative)\n    ) {\n      quote = state.alternative\n    }\n\n    result =\n      quote +\n      stringifyEntities(\n        value,\n        Object.assign({}, state.settings.characterReferences, {\n          // Always encode without parse errors in non-HTML.\n          subset: (quote === \"'\" ? constants.single : constants.double)[x][y],\n          attribute: true\n        })\n      ) +\n      quote\n  }\n\n  // Don’t add a `=` for unquoted empties.\n  return name + (result ? '=' + result : result)\n}\n","/**\n * @import {Parents, Text} from 'hast'\n * @import {Raw} from 'mdast-util-to-hast'\n * @import {State} from '../index.js'\n */\n\nimport {stringifyEntities} from 'stringify-entities'\n\n// Declare array as variable so it can be cached by `stringifyEntities`\nconst textEntitySubset = ['<', '&']\n\n/**\n * Serialize a text node.\n *\n * @param {Raw | Text} node\n *   Node to handle.\n * @param {number | undefined} _\n *   Index of `node` in `parent.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {string}\n *   Serialized node.\n */\nexport function text(node, _, parent, state) {\n  // Check if content of `node` should be escaped.\n  return parent &&\n    parent.type === 'element' &&\n    (parent.tagName === 'script' || parent.tagName === 'style')\n    ? node.value\n    : stringifyEntities(\n        node.value,\n        Object.assign({}, state.settings.characterReferences, {\n          subset: textEntitySubset\n        })\n      )\n}\n","/**\n * @import {Nodes, Parents} from 'hast'\n * @import {State} from '../index.js'\n */\n\nimport {zwitch} from 'zwitch'\nimport {comment} from './comment.js'\nimport {doctype} from './doctype.js'\nimport {element} from './element.js'\nimport {raw} from './raw.js'\nimport {root} from './root.js'\nimport {text} from './text.js'\n\n/**\n * @type {(node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string}\n */\nexport const handle = zwitch('type', {\n  invalid,\n  unknown,\n  handlers: {comment, doctype, element, raw, root, text}\n})\n\n/**\n * Fail when a non-node is found in the tree.\n *\n * @param {unknown} node\n *   Unknown value.\n * @returns {never}\n *   Never.\n */\nfunction invalid(node) {\n  throw new Error('Expected node, not `' + node + '`')\n}\n\n/**\n * Fail when a node with an unknown type is found in the tree.\n *\n * @param {unknown} node_\n *  Unknown node.\n * @returns {never}\n *   Never.\n */\nfunction unknown(node_) {\n  // `type` is guaranteed by runtime JS.\n  const node = /** @type {Nodes} */ (node_)\n  throw new Error('Cannot compile unknown node `' + node.type + '`')\n}\n","/**\n * @import {Doctype, Parents} from 'hast'\n * @import {State} from '../index.js'\n */\n\n/**\n * Serialize a doctype.\n *\n * @param {Doctype} _1\n *   Node to handle.\n * @param {number | undefined} _2\n *   Index of `node` in `parent.\n * @param {Parents | undefined} _3\n *   Parent of `node`.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {string}\n *   Serialized node.\n */\nexport function doctype(_1, _2, _3, state) {\n  return (\n    '<!' +\n    (state.settings.upperDoctype ? 'DOCTYPE' : 'doctype') +\n    (state.settings.tightDoctype ? '' : ' ') +\n    'html>'\n  )\n}\n","/**\n * @import {Parents} from 'hast'\n * @import {Raw} from 'mdast-util-to-hast'\n * @import {State} from '../index.js'\n */\n\nimport {text} from './text.js'\n\n/**\n * Serialize a raw node.\n *\n * @param {Raw} node\n *   Node to handle.\n * @param {number | undefined} index\n *   Index of `node` in `parent.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {string}\n *   Serialized node.\n */\nexport function raw(node, index, parent, state) {\n  return state.settings.allowDangerousHtml\n    ? node.value\n    : text(node, index, parent, state)\n}\n","/**\n * @import {Parents, Root} from 'hast'\n * @import {State} from '../index.js'\n */\n\n/**\n * Serialize a root.\n *\n * @param {Root} node\n *   Node to handle.\n * @param {number | undefined} _1\n *   Index of `node` in `parent.\n * @param {Parents | undefined} _2\n *   Parent of `node`.\n * @param {State} state\n *   Info passed around about the current state.\n * @returns {string}\n *   Serialized node.\n */\nexport function root(node, _1, _2, state) {\n  return state.all(node)\n}\n","/**\n * @import {Nodes, Parents, RootContent} from 'hast'\n * @import {Schema} from 'property-information'\n * @import {Options as StringifyEntitiesOptions} from 'stringify-entities'\n */\n\n/**\n * @typedef {Omit<StringifyEntitiesOptions, 'attribute' | 'escapeOnly' | 'subset'>} CharacterReferences\n *\n * @typedef Options\n *   Configuration.\n * @property {boolean | null | undefined} [allowDangerousCharacters=false]\n *   Do not encode some characters which cause XSS vulnerabilities in older\n *   browsers (default: `false`).\n *\n *   > ⚠️ **Danger**: only set this if you completely trust the content.\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Allow `raw` nodes and insert them as raw HTML (default: `false`).\n *\n *   When `false`, `Raw` nodes are encoded.\n *\n *   > ⚠️ **Danger**: only set this if you completely trust the content.\n * @property {boolean | null | undefined} [allowParseErrors=false]\n *   Do not encode characters which cause parse errors (even though they work),\n *   to save bytes (default: `false`).\n *\n *   Not used in the SVG space.\n *\n *   > 👉 **Note**: intentionally creates parse errors in markup (how parse\n *   > errors are handled is well defined, so this works but isn’t pretty).\n * @property {boolean | null | undefined} [bogusComments=false]\n *   Use “bogus comments” instead of comments to save byes: `<?charlie>`\n *   instead of `<!--charlie-->` (default: `false`).\n *\n *   > 👉 **Note**: intentionally creates parse errors in markup (how parse\n *   > errors are handled is well defined, so this works but isn’t pretty).\n * @property {CharacterReferences | null | undefined} [characterReferences]\n *   Configure how to serialize character references (optional).\n * @property {boolean | null | undefined} [closeEmptyElements=false]\n *   Close SVG elements without any content with slash (`/`) on the opening tag\n *   instead of an end tag: `<circle />` instead of `<circle></circle>`\n *   (default: `false`).\n *\n *   See `tightSelfClosing` to control whether a space is used before the\n *   slash.\n *\n *   Not used in the HTML space.\n * @property {boolean | null | undefined} [closeSelfClosing=false]\n *   Close self-closing nodes with an extra slash (`/`): `<img />` instead of\n *   `<img>` (default: `false`).\n *\n *   See `tightSelfClosing` to control whether a space is used before the\n *   slash.\n *\n *   Not used in the SVG space.\n * @property {boolean | null | undefined} [collapseEmptyAttributes=false]\n *   Collapse empty attributes: get `class` instead of `class=\"\"` (default:\n *   `false`).\n *\n *   Not used in the SVG space.\n *\n *   > 👉 **Note**: boolean attributes (such as `hidden`) are always collapsed.\n * @property {boolean | null | undefined} [omitOptionalTags=false]\n *   Omit optional opening and closing tags (default: `false`).\n *\n *   For example, in `<ol><li>one</li><li>two</li></ol>`, both `</li>` closing\n *   tags can be omitted.\n *   The first because it’s followed by another `li`, the last because it’s\n *   followed by nothing.\n *\n *   Not used in the SVG space.\n * @property {boolean | null | undefined} [preferUnquoted=false]\n *   Leave attributes unquoted if that results in less bytes (default: `false`).\n *\n *   Not used in the SVG space.\n * @property {boolean | null | undefined} [quoteSmart=false]\n *   Use the other quote if that results in less bytes (default: `false`).\n * @property {Quote | null | undefined} [quote='\"']\n *   Preferred quote to use (default: `'\"'`).\n * @property {Space | null | undefined} [space='html']\n *   When an `<svg>` element is found in the HTML space, this package already\n *   automatically switches to and from the SVG space when entering and exiting\n *   it (default: `'html'`).\n *\n *   > 👉 **Note**: hast is not XML.\n *   > It supports SVG as embedded in HTML.\n *   > It does not support the features available in XML.\n *   > Passing SVG might break but fragments of modern SVG should be fine.\n *   > Use [`xast`][xast] if you need to support SVG as XML.\n * @property {boolean | null | undefined} [tightAttributes=false]\n *   Join attributes together, without whitespace, if possible: get\n *   `class=\"a b\"title=\"c d\"` instead of `class=\"a b\" title=\"c d\"` to save\n *   bytes (default: `false`).\n *\n *   Not used in the SVG space.\n *\n *   > 👉 **Note**: intentionally creates parse errors in markup (how parse\n *   > errors are handled is well defined, so this works but isn’t pretty).\n * @property {boolean | null | undefined} [tightCommaSeparatedLists=false]\n *   Join known comma-separated attribute values with just a comma (`,`),\n *   instead of padding them on the right as well (`,␠`, where `␠` represents a\n *   space) (default: `false`).\n * @property {boolean | null | undefined} [tightDoctype=false]\n *   Drop unneeded spaces in doctypes: `<!doctypehtml>` instead of\n *   `<!doctype html>` to save bytes (default: `false`).\n *\n *   > 👉 **Note**: intentionally creates parse errors in markup (how parse\n *   > errors are handled is well defined, so this works but isn’t pretty).\n * @property {boolean | null | undefined} [tightSelfClosing=false]\n *   Do not use an extra space when closing self-closing elements: `<img/>`\n *   instead of `<img />` (default: `false`).\n *\n *   > 👉 **Note**: only used if `closeSelfClosing: true` or\n *   > `closeEmptyElements: true`.\n * @property {boolean | null | undefined} [upperDoctype=false]\n *   Use a `<!DOCTYPE…` instead of `<!doctype…` (default: `false`).\n *\n *   Useless except for XHTML.\n * @property {ReadonlyArray<string> | null | undefined} [voids]\n *   Tag names of elements to serialize without closing tag (default: `html-void-elements`).\n *\n *   Not used in the SVG space.\n *\n *   > 👉 **Note**: It’s highly unlikely that you want to pass this, because\n *   > hast is not for XML, and HTML will not add more void elements.\n *\n * @typedef {'\"' | \"'\"} Quote\n *   HTML quotes for attribute values.\n *\n * @typedef {Omit<Required<{[key in keyof Options]: Exclude<Options[key], null | undefined>}>, 'space' | 'quote'>} Settings\n *\n * @typedef {'html' | 'svg'} Space\n *   Namespace.\n *\n * @typedef State\n *   Info passed around about the current state.\n * @property {(node: Parents | undefined) => string} all\n *   Serialize the children of a parent node.\n * @property {Quote} alternative\n *   Alternative quote.\n * @property {(node: Nodes, index: number | undefined, parent: Parents | undefined) => string} one\n *   Serialize one node.\n * @property {Quote} quote\n *   Preferred quote.\n * @property {Schema} schema\n *   Current schema.\n * @property {Settings} settings\n *   User configuration.\n */\n\nimport {htmlVoidElements} from 'html-void-elements'\nimport {html, svg} from 'property-information'\nimport {handle} from './handle/index.js'\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/** @type {CharacterReferences} */\nconst emptyCharacterReferences = {}\n\n/** @type {Array<never>} */\nconst emptyChildren = []\n\n/**\n * Serialize hast as HTML.\n *\n * @param {Array<RootContent> | Nodes} tree\n *   Tree to serialize.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Serialized HTML.\n */\nexport function toHtml(tree, options) {\n  const options_ = options || emptyOptions\n  const quote = options_.quote || '\"'\n  const alternative = quote === '\"' ? \"'\" : '\"'\n\n  if (quote !== '\"' && quote !== \"'\") {\n    throw new Error('Invalid quote `' + quote + '`, expected `\\'` or `\"`')\n  }\n\n  /** @type {State} */\n  const state = {\n    one,\n    all,\n    settings: {\n      omitOptionalTags: options_.omitOptionalTags || false,\n      allowParseErrors: options_.allowParseErrors || false,\n      allowDangerousCharacters: options_.allowDangerousCharacters || false,\n      quoteSmart: options_.quoteSmart || false,\n      preferUnquoted: options_.preferUnquoted || false,\n      tightAttributes: options_.tightAttributes || false,\n      upperDoctype: options_.upperDoctype || false,\n      tightDoctype: options_.tightDoctype || false,\n      bogusComments: options_.bogusComments || false,\n      tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false,\n      tightSelfClosing: options_.tightSelfClosing || false,\n      collapseEmptyAttributes: options_.collapseEmptyAttributes || false,\n      allowDangerousHtml: options_.allowDangerousHtml || false,\n      voids: options_.voids || htmlVoidElements,\n      characterReferences:\n        options_.characterReferences || emptyCharacterReferences,\n      closeSelfClosing: options_.closeSelfClosing || false,\n      closeEmptyElements: options_.closeEmptyElements || false\n    },\n    schema: options_.space === 'svg' ? svg : html,\n    quote,\n    alternative\n  }\n\n  return state.one(\n    Array.isArray(tree) ? {type: 'root', children: tree} : tree,\n    undefined,\n    undefined\n  )\n}\n\n/**\n * Serialize a node.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {Nodes} node\n *   Node to handle.\n * @param {number | undefined} index\n *   Index of `node` in `parent.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {string}\n *   Serialized node.\n */\nfunction one(node, index, parent) {\n  return handle(node, index, parent, this)\n}\n\n/**\n * Serialize all children of `parent`.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {Parents | undefined} parent\n *   Parent whose children to serialize.\n * @returns {string}\n */\nexport function all(parent) {\n  /** @type {Array<string>} */\n  const results = []\n  const children = (parent && parent.children) || emptyChildren\n  let index = -1\n\n  while (++index < children.length) {\n    results[index] = this.one(children[index], index, parent)\n  }\n\n  return results.join('')\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n */\n\n/**\n * @template {string} SimpleSelector\n *   Selector type.\n * @template {string} DefaultTagName\n *   Default tag name.\n * @typedef {(\n *   SimpleSelector extends ''\n *     ? DefaultTagName\n *     : SimpleSelector extends `${infer TagName}.${infer Rest}`\n *     ? ExtractTagName<TagName, DefaultTagName>\n *     : SimpleSelector extends `${infer TagName}#${infer Rest}`\n *     ? ExtractTagName<TagName, DefaultTagName>\n *     : SimpleSelector extends string\n *     ? SimpleSelector\n *     : DefaultTagName\n * )} ExtractTagName\n *   Extract tag name from a simple selector.\n */\n\nconst search = /[#.]/g\n\n/**\n * Create a hast element from a simple CSS selector.\n *\n * @template {string} Selector\n *   Type of selector.\n * @template {string} [DefaultTagName='div']\n *   Type of default tag name (default: `'div'`).\n * @param {Selector | null | undefined} [selector]\n *   Simple CSS selector (optional).\n *\n *   Can contain a tag name (`foo`), classes (`.bar`), and an ID (`#baz`).\n *   Multiple classes are allowed.\n *   Uses the last ID if multiple IDs are found.\n * @param {DefaultTagName | null | undefined} [defaultTagName='div']\n *   Tag name to use if `selector` does not specify one (default: `'div'`).\n * @returns {Element & {tagName: ExtractTagName<Selector, DefaultTagName>}}\n *   Built element.\n */\nexport function parseSelector(selector, defaultTagName) {\n  const value = selector || ''\n  /** @type {Properties} */\n  const props = {}\n  let start = 0\n  /** @type {string | undefined} */\n  let previous\n  /** @type {string | undefined} */\n  let tagName\n\n  while (start < value.length) {\n    search.lastIndex = start\n    const match = search.exec(value)\n    const subvalue = value.slice(start, match ? match.index : value.length)\n\n    if (subvalue) {\n      if (!previous) {\n        tagName = subvalue\n      } else if (previous === '#') {\n        props.id = subvalue\n      } else if (Array.isArray(props.className)) {\n        props.className.push(subvalue)\n      } else {\n        props.className = [subvalue]\n      }\n\n      start += subvalue.length\n    }\n\n    if (match) {\n      previous = match[0]\n      start++\n    }\n  }\n\n  return {\n    type: 'element',\n    // @ts-expect-error: tag name is parsed.\n    tagName: tagName || defaultTagName || 'div',\n    properties: props,\n    children: []\n  }\n}\n","/**\n * @import {Element, Nodes, RootContent, Root} from 'hast'\n * @import {Info, Schema} from 'property-information'\n */\n\n/**\n * @typedef {Array<Nodes | PrimitiveChild>} ArrayChildNested\n *   List of children (deep).\n */\n\n/**\n * @typedef {Array<ArrayChildNested | Nodes | PrimitiveChild>} ArrayChild\n *   List of children.\n */\n\n/**\n * @typedef {Array<number | string>} ArrayValue\n *   List of property values for space- or comma separated values (such as `className`).\n */\n\n/**\n * @typedef {ArrayChild | Nodes | PrimitiveChild} Child\n *   Acceptable child value.\n */\n\n/**\n * @typedef {number | string | null | undefined} PrimitiveChild\n *   Primitive children, either ignored (nullish), or turned into text nodes.\n */\n\n/**\n * @typedef {boolean | number | string | null | undefined} PrimitiveValue\n *   Primitive property value.\n */\n\n/**\n * @typedef {Record<string, PropertyValue | Style>} Properties\n *   Acceptable value for element properties.\n */\n\n/**\n * @typedef {ArrayValue | PrimitiveValue} PropertyValue\n *   Primitive value or list value.\n */\n\n/**\n * @typedef {Element | Root} Result\n *   Result from a `h` (or `s`) call.\n */\n\n/**\n * @typedef {number | string} StyleValue\n *   Value for a CSS style field.\n */\n\n/**\n * @typedef {Record<string, StyleValue>} Style\n *   Supported value of a `style` prop.\n */\n\nimport {parse as parseCommas} from 'comma-separated-tokens'\nimport {parseSelector} from 'hast-util-parse-selector'\nimport {find, normalize} from 'property-information'\nimport {parse as parseSpaces} from 'space-separated-tokens'\n\n/**\n * @param {Schema} schema\n *   Schema to use.\n * @param {string} defaultTagName\n *   Default tag name.\n * @param {ReadonlyArray<string> | undefined} [caseSensitive]\n *   Case-sensitive tag names (default: `undefined`).\n * @returns\n *   `h`.\n */\nexport function createH(schema, defaultTagName, caseSensitive) {\n  const adjust = caseSensitive ? createAdjustMap(caseSensitive) : undefined\n\n  /**\n   * Hyperscript compatible DSL for creating virtual hast trees.\n   *\n   * @overload\n   * @param {null | undefined} [selector]\n   * @param {...Child} children\n   * @returns {Root}\n   *\n   * @overload\n   * @param {string} selector\n   * @param {Properties} properties\n   * @param {...Child} children\n   * @returns {Element}\n   *\n   * @overload\n   * @param {string} selector\n   * @param {...Child} children\n   * @returns {Element}\n   *\n   * @param {string | null | undefined} [selector]\n   *   Selector.\n   * @param {Child | Properties | null | undefined} [properties]\n   *   Properties (or first child) (default: `undefined`).\n   * @param {...Child} children\n   *   Children.\n   * @returns {Result}\n   *   Result.\n   */\n  function h(selector, properties, ...children) {\n    /** @type {Result} */\n    let node\n\n    if (selector === null || selector === undefined) {\n      node = {type: 'root', children: []}\n      // Properties are not supported for roots.\n      const child = /** @type {Child} */ (properties)\n      children.unshift(child)\n    } else {\n      node = parseSelector(selector, defaultTagName)\n      // Normalize the name.\n      const lower = node.tagName.toLowerCase()\n      const adjusted = adjust ? adjust.get(lower) : undefined\n      node.tagName = adjusted || lower\n\n      // Handle properties.\n      if (isChild(properties)) {\n        children.unshift(properties)\n      } else {\n        for (const [key, value] of Object.entries(properties)) {\n          addProperty(schema, node.properties, key, value)\n        }\n      }\n    }\n\n    // Handle children.\n    for (const child of children) {\n      addChild(node.children, child)\n    }\n\n    if (node.type === 'element' && node.tagName === 'template') {\n      node.content = {type: 'root', children: node.children}\n      node.children = []\n    }\n\n    return node\n  }\n\n  return h\n}\n\n/**\n * Check if something is properties or a child.\n *\n * @param {Child | Properties} value\n *   Value to check.\n * @returns {value is Child}\n *   Whether `value` is definitely a child.\n */\nfunction isChild(value) {\n  // Never properties if not an object.\n  if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n    return true\n  }\n\n  // Never node without `type`; that’s the main discriminator.\n  if (typeof value.type !== 'string') return false\n\n  // Slower check: never property value if object or array with\n  // non-number/strings.\n  const record = /** @type {Record<string, unknown>} */ (value)\n  const keys = Object.keys(value)\n\n  for (const key of keys) {\n    const value = record[key]\n\n    if (value && typeof value === 'object') {\n      if (!Array.isArray(value)) return true\n\n      const list = /** @type {ReadonlyArray<unknown>} */ (value)\n\n      for (const item of list) {\n        if (typeof item !== 'number' && typeof item !== 'string') {\n          return true\n        }\n      }\n    }\n  }\n\n  // Also see empty `children` as a node.\n  if ('children' in value && Array.isArray(value.children)) {\n    return true\n  }\n\n  // Default to properties, someone can always pass an empty object,\n  // put `data: {}` in a node,\n  // or wrap it in an array.\n  return false\n}\n\n/**\n * @param {Schema} schema\n *   Schema.\n * @param {Properties} properties\n *   Properties object.\n * @param {string} key\n *   Property name.\n * @param {PropertyValue | Style} value\n *   Property value.\n * @returns {undefined}\n *   Nothing.\n */\nfunction addProperty(schema, properties, key, value) {\n  const info = find(schema, key)\n  /** @type {PropertyValue} */\n  let result\n\n  // Ignore nullish and NaN values.\n  if (value === null || value === undefined) return\n\n  if (typeof value === 'number') {\n    // Ignore NaN.\n    if (Number.isNaN(value)) return\n\n    result = value\n  }\n  // Booleans.\n  else if (typeof value === 'boolean') {\n    result = value\n  }\n  // Handle list values.\n  else if (typeof value === 'string') {\n    if (info.spaceSeparated) {\n      result = parseSpaces(value)\n    } else if (info.commaSeparated) {\n      result = parseCommas(value)\n    } else if (info.commaOrSpaceSeparated) {\n      result = parseSpaces(parseCommas(value).join(' '))\n    } else {\n      result = parsePrimitive(info, info.property, value)\n    }\n  } else if (Array.isArray(value)) {\n    result = [...value]\n  } else {\n    result = info.property === 'style' ? style(value) : String(value)\n  }\n\n  if (Array.isArray(result)) {\n    /** @type {Array<number | string>} */\n    const finalResult = []\n\n    for (const item of result) {\n      // Assume no booleans in array.\n      finalResult.push(\n        /** @type {number | string} */ (\n          parsePrimitive(info, info.property, item)\n        )\n      )\n    }\n\n    result = finalResult\n  }\n\n  // Class names (which can be added both on the `selector` and here).\n  if (info.property === 'className' && Array.isArray(properties.className)) {\n    // Assume no booleans in `className`.\n    result = properties.className.concat(\n      /** @type {Array<number | string> | number | string} */ (result)\n    )\n  }\n\n  properties[info.property] = result\n}\n\n/**\n * @param {Array<RootContent>} nodes\n *   Children.\n * @param {Child} value\n *   Child.\n * @returns {undefined}\n *   Nothing.\n */\nfunction addChild(nodes, value) {\n  if (value === null || value === undefined) {\n    // Empty.\n  } else if (typeof value === 'number' || typeof value === 'string') {\n    nodes.push({type: 'text', value: String(value)})\n  } else if (Array.isArray(value)) {\n    for (const child of value) {\n      addChild(nodes, child)\n    }\n  } else if (typeof value === 'object' && 'type' in value) {\n    if (value.type === 'root') {\n      addChild(nodes, value.children)\n    } else {\n      nodes.push(value)\n    }\n  } else {\n    throw new Error('Expected node, nodes, or string, got `' + value + '`')\n  }\n}\n\n/**\n * Parse a single primitives.\n *\n * @param {Info} info\n *   Property information.\n * @param {string} name\n *   Property name.\n * @param {PrimitiveValue} value\n *   Property value.\n * @returns {PrimitiveValue}\n *   Property value.\n */\nfunction parsePrimitive(info, name, value) {\n  if (typeof value === 'string') {\n    if (info.number && value && !Number.isNaN(Number(value))) {\n      return Number(value)\n    }\n\n    if (\n      (info.boolean || info.overloadedBoolean) &&\n      (value === '' || normalize(value) === normalize(name))\n    ) {\n      return true\n    }\n  }\n\n  return value\n}\n\n/**\n * Serialize a `style` object as a string.\n *\n * @param {Style} styles\n *   Style object.\n * @returns {string}\n *   CSS string.\n */\nfunction style(styles) {\n  /** @type {Array<string>} */\n  const result = []\n\n  for (const [key, value] of Object.entries(styles)) {\n    result.push([key, value].join(': '))\n  }\n\n  return result.join('; ')\n}\n\n/**\n * Create a map to adjust casing.\n *\n * @param {ReadonlyArray<string>} values\n *   List of properly cased keys.\n * @returns {Map<string, string>}\n *   Map of lowercase keys to uppercase keys.\n */\nfunction createAdjustMap(values) {\n  /** @type {Map<string, string>} */\n  const result = new Map()\n\n  for (const value of values) {\n    result.set(value.toLowerCase(), value)\n  }\n\n  return result\n}\n","/**\n * List of case-sensitive SVG tag names.\n *\n * @type {ReadonlyArray<string>}\n */\nexport const svgCaseSensitiveTagNames = [\n  'altGlyph',\n  'altGlyphDef',\n  'altGlyphItem',\n  'animateColor',\n  'animateMotion',\n  'animateTransform',\n  'clipPath',\n  'feBlend',\n  'feColorMatrix',\n  'feComponentTransfer',\n  'feComposite',\n  'feConvolveMatrix',\n  'feDiffuseLighting',\n  'feDisplacementMap',\n  'feDistantLight',\n  'feDropShadow',\n  'feFlood',\n  'feFuncA',\n  'feFuncB',\n  'feFuncG',\n  'feFuncR',\n  'feGaussianBlur',\n  'feImage',\n  'feMerge',\n  'feMergeNode',\n  'feMorphology',\n  'feOffset',\n  'fePointLight',\n  'feSpecularLighting',\n  'feSpotLight',\n  'feTile',\n  'feTurbulence',\n  'foreignObject',\n  'glyphRef',\n  'linearGradient',\n  'radialGradient',\n  'solidColor',\n  'textArea',\n  'textPath'\n]\n","// Register the JSX namespace on `h`.\n/**\n * @typedef {import('./jsx-classic.js').Element} h.JSX.Element\n * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute\n * @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes\n * @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements\n */\n\n// Register the JSX namespace on `s`.\n/**\n * @typedef {import('./jsx-classic.js').Element} s.JSX.Element\n * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute\n * @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes\n * @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements\n */\n\nimport {html, svg} from 'property-information'\nimport {createH} from './create-h.js'\nimport {svgCaseSensitiveTagNames} from './svg-case-sensitive-tag-names.js'\n\n// Note: this explicit type is needed, otherwise TS creates broken types.\n/** @type {ReturnType<createH>} */\nexport const h = createH(html, 'div')\n\n// Note: this explicit type is needed, otherwise TS creates broken types.\n/** @type {ReturnType<createH>} */\nexport const s = createH(svg, 'g', svgCaseSensitiveTagNames)\n","/**\n * @import {\n *   Comment as HastComment,\n *   Doctype as HastDoctype,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   RootContent as HastRootContent,\n *   Root as HastRoot,\n *   Text as HastText,\n * } from 'hast'\n */\n\n/**\n * @callback AfterTransform\n *   Callback called when each node is transformed.\n * @param {Node} domNode\n *   DOM node that was handled.\n * @param {HastNodes} hastNode\n *   Corresponding hast node.\n * @returns {undefined | void}\n *   Nothing.\n *\n *   Note: `void` included until TS infers `undefined` nicely.\n *\n * @typedef Options\n *   Configuration.\n * @property {AfterTransform | null | undefined} [afterTransform]\n *   Callback called when each node is transformed (optional).\n */\n\nimport {h, s} from 'hastscript'\nimport {webNamespaces} from 'web-namespaces'\n\n/**\n * Transform a DOM tree to a hast tree.\n *\n * @param {Node} tree\n *   DOM tree to transform.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {HastNodes}\n *   Equivalent hast node.\n */\nexport function fromDom(tree, options) {\n  return transform(tree, options || {}) || {type: 'root', children: []}\n}\n\n/**\n * @param {Node} node\n *   DOM node to transform.\n * @param {Options} options\n *   Configuration.\n * @returns {HastNodes | undefined}\n *   Equivalent hast node.\n *\n *   Note that certain legacy DOM nodes (i.e., Attr nodes (2),  CDATA, processing instructions)\n */\nfunction transform(node, options) {\n  const transformed = one(node, options)\n  if (transformed && options.afterTransform)\n    options.afterTransform(node, transformed)\n  return transformed\n}\n\n/**\n * @param {Node} node\n *   DOM node to transform.\n * @param {Options} options\n *   Configuration.\n * @returns {HastNodes | undefined}\n *   Equivalent hast node.\n */\nfunction one(node, options) {\n  switch (node.nodeType) {\n    case 1 /* Element */: {\n      const domNode = /** @type {Element} */ (node)\n      return element(domNode, options)\n    }\n\n    // Ignore: Attr (2).\n\n    case 3 /* Text */: {\n      const domNode = /** @type {Text} */ (node)\n      return text(domNode)\n    }\n\n    // Ignore: CDATA (4).\n    // Removed: Entity reference (5)\n    // Removed: Entity (6)\n    // Ignore: Processing instruction (7).\n\n    case 8 /* Comment */: {\n      const domNode = /** @type {Comment} */ (node)\n      return comment(domNode)\n    }\n\n    case 9 /* Document */: {\n      const domNode = /** @type {Document} */ (node)\n      return root(domNode, options)\n    }\n\n    case 10 /* Document type */: {\n      return doctype()\n    }\n\n    case 11 /* Document fragment */: {\n      const domNode = /** @type {DocumentFragment} */ (node)\n      return root(domNode, options)\n    }\n\n    default: {\n      return undefined\n    }\n  }\n}\n\n/**\n * Transform a document.\n *\n * @param {Document | DocumentFragment} node\n *   DOM node to transform.\n * @param {Options} options\n *   Configuration.\n * @returns {HastRoot}\n *   Equivalent hast node.\n */\nfunction root(node, options) {\n  return {type: 'root', children: all(node, options)}\n}\n\n/**\n * Transform a doctype.\n *\n * @returns {HastDoctype}\n *   Equivalent hast node.\n */\nfunction doctype() {\n  return {type: 'doctype'}\n}\n\n/**\n * Transform a text.\n *\n * @param {Text} node\n *   DOM node to transform.\n * @returns {HastText}\n *   Equivalent hast node.\n */\nfunction text(node) {\n  return {type: 'text', value: node.nodeValue || ''}\n}\n\n/**\n * Transform a comment.\n *\n * @param {Comment} node\n *   DOM node to transform.\n * @returns {HastComment}\n *   Equivalent hast node.\n */\nfunction comment(node) {\n  return {type: 'comment', value: node.nodeValue || ''}\n}\n\n/**\n * Transform an element.\n *\n * @param {Element} node\n *   DOM node to transform.\n * @param {Options} options\n *   Configuration.\n * @returns {HastElement}\n *   Equivalent hast node.\n */\nfunction element(node, options) {\n  const space = node.namespaceURI\n  const x = space === webNamespaces.svg ? s : h\n  const tagName =\n    space === webNamespaces.html ? node.tagName.toLowerCase() : node.tagName\n  /** @type {DocumentFragment | Element} */\n  const content =\n    // @ts-expect-error: DOM types are wrong, content can exist.\n    space === webNamespaces.html && tagName === 'template' ? node.content : node\n  const attributes = node.getAttributeNames()\n  /** @type {Record<string, string>} */\n  const properties = {}\n  let index = -1\n\n  while (++index < attributes.length) {\n    properties[attributes[index]] = node.getAttribute(attributes[index]) || ''\n  }\n\n  return x(tagName, properties, all(content, options))\n}\n\n/**\n * Transform child nodes in a parent.\n *\n * @param {Document | DocumentFragment | Element} node\n *   DOM node to transform.\n * @param {Options} options\n *   Configuration.\n * @returns {Array<HastRootContent>}\n *   Equivalent hast nodes.\n */\nfunction all(node, options) {\n  const nodes = node.childNodes\n  /** @type {Array<HastRootContent>} */\n  const children = []\n  let index = -1\n\n  while (++index < nodes.length) {\n    const child = transform(nodes[index], options)\n\n    if (child !== undefined) {\n      // @ts-expect-error Assume no document inside document.\n      children.push(child)\n    }\n  }\n\n  return children\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module markdown-gfm/markdown2html/markdown2html\n */\nimport { unified } from 'unified';\nimport remarkGfm from 'remark-gfm';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkBreaks from 'remark-breaks';\nimport rehypeStringify from 'rehype-dom-stringify';\nimport { visit } from 'unist-util-visit';\nimport { toHtml } from 'hast-util-to-html';\nimport { fromDom } from 'hast-util-from-dom';\n/**\n * This is a helper class used by the {@link module:markdown-gfm/markdown Markdown feature} to convert Markdown to HTML.\n */\nexport class MarkdownGfmMdToHtml {\n    _processor;\n    constructor() {\n        this._processor = unified()\n            // Parses Markdown to an abstract syntax tree (AST).\n            .use(remarkParse)\n            // Adds support for GitHub Flavored Markdown (GFM).\n            .use(remarkGfm, { singleTilde: true })\n            // Replaces line breaks with `<br>` tags.\n            .use(remarkBreaks)\n            // Turns markdown syntax tree to HTML syntax tree, ignoring embedded HTML.\n            .use(remarkRehype, { allowDangerousHtml: true })\n            // Handles HTML embedded in Markdown.\n            .use(rehypeDomRaw)\n            // Removes classes from list elements.\n            .use(deleteClassesFromToDoLists)\n            // Serializes HTML syntax tree to HTML string.\n            .use(rehypeStringify);\n    }\n    parse(markdown) {\n        return this._processor\n            .processSync(markdown)\n            .toString()\n            .replaceAll('\\n</code>', '</code>');\n    }\n}\n/**\n * Rehype plugin that improves handling of the To-do lists by removing:\n *  * default classes added to `<ul>`, `<ol>`, and `<li>` elements.\n *  * bogus space after <input type=\"checkbox\"> because it would be preserved by ViewDomConverter as it's next to an inline object.\n */\nfunction deleteClassesFromToDoLists() {\n    return (tree) => {\n        visit(tree, 'element', (node) => {\n            if (node.tagName === 'ul' || node.tagName === 'ol' || node.tagName === 'li') {\n                node.children = node.children.filter(child => child.type !== 'text' || !!child.value.trim());\n                delete node.properties.className;\n            }\n        });\n    };\n}\n/**\n * Rehype plugin to parse raw HTML nodes inside Markdown. This plugin is used instead of `rehype-raw` or `rehype-stringify`,\n * because those plugins rely on `parse5` DOM parser which is heavy and redundant in the browser environment where we can\n * use the native DOM APIs.\n *\n * This plugins finds any node (root or element) whose children include `raw` nodes and reparses them like so:\n * 1. Serializes its children to an HTML string.\n * 2. Reparses the HTML string using a `<template>` element.\n * 3. Converts each parsed DOM node back into HAST nodes.\n * 4. Replaces the original children with the newly created HAST nodes.\n */\nfunction rehypeDomRaw() {\n    return (tree) => {\n        visit(tree, ['root', 'element'], (node) => {\n            /* istanbul ignore next -- @preserve */\n            if (!isNodeRootOrElement(node)) {\n                return;\n            }\n            // Only act on nodes with at least one raw child.\n            if (!node.children.some(child => child.type === 'raw')) {\n                return;\n            }\n            const template = document.createElement('template');\n            // Serialize all children to an HTML fragment.\n            template.innerHTML = toHtml({ type: 'root', children: node.children }, { allowDangerousHtml: true });\n            // Convert each parsed DOM node back into HAST and replace the original children.\n            node.children = Array\n                .from(template.content.childNodes)\n                .map(domNode => fromDom(domNode));\n        });\n    };\n}\n/**\n * Only needed for the type guard.\n */\nfunction isNodeRootOrElement(node) {\n    return (node.type === 'root' || node.type === 'element') && node.children;\n}\n","/**\n * @import {Root} from 'hast'\n * @import {Options} from 'rehype-dom-parse'\n * @import {Processor} from 'unified'\n */\n\nimport {fromDom} from 'hast-util-from-dom'\n\n/**\n * Add support for parsing from HTML with DOM APIs.\n *\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function parse(options) {\n  /** @type {Processor<Root>} */\n  // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n  const self = this\n  const settings = {...self.data('settings'), ...options}\n\n  self.parser = parser\n\n  /**\n   * @param {string} value\n   *   Value to parse.\n   * @returns {Root}\n   *   Tree.\n   */\n  function parser(value) {\n    const create = settings.fragment === false ? parseDocument : parseFragment\n    // Assume document/fragment in -> root out.\n    return /** @type {Root} */ (fromDom(create(value)))\n  }\n}\n\n/**\n * Create a document.\n *\n * @param {string} value\n *   Value to parse.\n * @returns {Document}\n *   Document.\n */\nfunction parseDocument(value) {\n  return new DOMParser().parseFromString(value, 'text/html')\n}\n\n/**\n * Parse as a fragment.\n *\n * @param {string} value\n *   Value to parse.\n * @returns {DocumentFragment}\n *   Document fragment.\n */\nfunction parseFragment(value) {\n  const template = document.createElement('template')\n  template.innerHTML = value\n  return template.content\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Parents} Parents\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n *   Check that an arbitrary value is an element.\n * @param {unknown} this\n *   Context object (`this`) to call `test` with\n * @param {unknown} [element]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   Position of `element` in its parent.\n * @param {Parents | null | undefined} [parent]\n *   Parent of `element`.\n * @returns {boolean}\n *   Whether this is an element and passes a test.\n *\n * @typedef {Array<TestFunction | string> | TestFunction | string | null | undefined} Test\n *   Check for an arbitrary element.\n *\n *   * when `string`, checks that the element has that tag name\n *   * when `function`, see `TestFunction`\n *   * when `Array`, checks if one of the subtests pass\n *\n * @callback TestFunction\n *   Check if an element passes a test.\n * @param {unknown} this\n *   The given context.\n * @param {Element} element\n *   An element.\n * @param {number | undefined} [index]\n *   Position of `element` in its parent.\n * @param {Parents | undefined} [parent]\n *   Parent of `element`.\n * @returns {boolean | undefined | void}\n *   Whether this element passes the test.\n *\n *   Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `element` is an `Element` and whether it passes the given test.\n *\n * @param element\n *   Thing to check, typically `element`.\n * @param test\n *   Check for a specific element.\n * @param index\n *   Position of `element` in its parent.\n * @param parent\n *   Parent of `element`.\n * @param context\n *   Context object (`this`) to call `test` with.\n * @returns\n *   Whether `element` is an `Element` and passes a test.\n * @throws\n *   When an incorrect `test`, `index`, or `parent` is given; there is no error\n *   thrown when `element` is not a node or not an element.\n */\nexport const isElement =\n  // Note: overloads in JSDoc can’t yet use different `@template`s.\n  /**\n   * @type {(\n   *   (<Condition extends TestFunction>(element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) &\n   *   (<Condition extends string>(element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n   *   ((element?: null | undefined) => false) &\n   *   ((element: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n   *   ((element: unknown, test?: Test, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => boolean)\n   * )}\n   */\n  (\n    /**\n     * @param {unknown} [element]\n     * @param {Test | undefined} [test]\n     * @param {number | null | undefined} [index]\n     * @param {Parents | null | undefined} [parent]\n     * @param {unknown} [context]\n     * @returns {boolean}\n     */\n    // eslint-disable-next-line max-params\n    function (element, test, index, parent, context) {\n      const check = convertElement(test)\n\n      if (\n        index !== null &&\n        index !== undefined &&\n        (typeof index !== 'number' ||\n          index < 0 ||\n          index === Number.POSITIVE_INFINITY)\n      ) {\n        throw new Error('Expected positive finite `index`')\n      }\n\n      if (\n        parent !== null &&\n        parent !== undefined &&\n        (!parent.type || !parent.children)\n      ) {\n        throw new Error('Expected valid `parent`')\n      }\n\n      if (\n        (index === null || index === undefined) !==\n        (parent === null || parent === undefined)\n      ) {\n        throw new Error('Expected both `index` and `parent`')\n      }\n\n      return looksLikeAnElement(element)\n        ? check.call(context, element, index, parent)\n        : false\n    }\n  )\n\n/**\n * Generate a check from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * an `element`, `index`, and `parent`.\n *\n * @param test\n *   A test for a specific element.\n * @returns\n *   A check.\n */\nexport const convertElement =\n  // Note: overloads in JSDoc can’t yet use different `@template`s.\n  /**\n   * @type {(\n   *   (<Condition extends TestFunction>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) &\n   *   (<Condition extends string>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n   *   ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n   *   ((test?: Test) => Check)\n   * )}\n   */\n  (\n    /**\n     * @param {Test | null | undefined} [test]\n     * @returns {Check}\n     */\n    function (test) {\n      if (test === null || test === undefined) {\n        return element\n      }\n\n      if (typeof test === 'string') {\n        return tagNameFactory(test)\n      }\n\n      // Assume array.\n      if (typeof test === 'object') {\n        return anyFactory(test)\n      }\n\n      if (typeof test === 'function') {\n        return castFactory(test)\n      }\n\n      throw new Error('Expected function, string, or array as `test`')\n    }\n  )\n\n/**\n * Handle multiple tests.\n *\n * @param {Array<TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n  /** @type {Array<Check>} */\n  const checks = []\n  let index = -1\n\n  while (++index < tests.length) {\n    checks[index] = convertElement(tests[index])\n  }\n\n  return castFactory(any)\n\n  /**\n   * @this {unknown}\n   * @type {TestFunction}\n   */\n  function any(...parameters) {\n    let index = -1\n\n    while (++index < checks.length) {\n      if (checks[index].apply(this, parameters)) return true\n    }\n\n    return false\n  }\n}\n\n/**\n * Turn a string into a test for an element with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction tagNameFactory(check) {\n  return castFactory(tagName)\n\n  /**\n   * @param {Element} element\n   * @returns {boolean}\n   */\n  function tagName(element) {\n    return element.tagName === check\n  }\n}\n\n/**\n * Turn a custom test into a test for an element that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n  return check\n\n  /**\n   * @this {unknown}\n   * @type {Check}\n   */\n  function check(value, index, parent) {\n    return Boolean(\n      looksLikeAnElement(value) &&\n        testFunction.call(\n          this,\n          value,\n          typeof index === 'number' ? index : undefined,\n          parent || undefined\n        )\n    )\n  }\n}\n\n/**\n * Make sure something is an element.\n *\n * @param {unknown} element\n * @returns {element is Element}\n */\nfunction element(element) {\n  return Boolean(\n    element &&\n      typeof element === 'object' &&\n      'type' in element &&\n      element.type === 'element' &&\n      'tagName' in element &&\n      typeof element.tagName === 'string'\n  )\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Element}\n */\nfunction looksLikeAnElement(value) {\n  return (\n    value !== null &&\n    typeof value === 'object' &&\n    'type' in value &&\n    'tagName' in value\n  )\n}\n","import {convertElement} from 'hast-util-is-element'\n\n/**\n * Check if a node is a *embedded content*.\n *\n * @param value\n *   Thing to check (typically `Node`).\n * @returns\n *   Whether `value` is an element considered embedded content.\n *\n *   The elements `audio`, `canvas`, `embed`, `iframe`, `img`, `math`,\n *   `object`, `picture`, `svg`, and `video` are embedded content.\n */\nexport const embedded = convertElement(\n  /**\n   * @param element\n   * @returns {element is {tagName: 'audio' | 'canvas' | 'embed' | 'iframe' | 'img' | 'math' | 'object' | 'picture' | 'svg' | 'video'}}\n   */\n  function (element) {\n    return (\n      element.tagName === 'audio' ||\n      element.tagName === 'canvas' ||\n      element.tagName === 'embed' ||\n      element.tagName === 'iframe' ||\n      element.tagName === 'img' ||\n      element.tagName === 'math' ||\n      element.tagName === 'object' ||\n      element.tagName === 'picture' ||\n      element.tagName === 'svg' ||\n      element.tagName === 'video'\n    )\n  }\n)\n","// See: <https://html.spec.whatwg.org/#the-css-user-agent-style-sheet-and-presentational-hints>\nexport const blocks = [\n  'address', // Flow content.\n  'article', // Sections and headings.\n  'aside', // Sections and headings.\n  'blockquote', // Flow content.\n  'body', // Page.\n  'br', // Contribute whitespace intrinsically.\n  'caption', // Similar to block.\n  'center', // Flow content, legacy.\n  'col', // Similar to block.\n  'colgroup', // Similar to block.\n  'dd', // Lists.\n  'dialog', // Flow content.\n  'dir', // Lists, legacy.\n  'div', // Flow content.\n  'dl', // Lists.\n  'dt', // Lists.\n  'figcaption', // Flow content.\n  'figure', // Flow content.\n  'footer', // Flow content.\n  'form', // Flow content.\n  'h1', // Sections and headings.\n  'h2', // Sections and headings.\n  'h3', // Sections and headings.\n  'h4', // Sections and headings.\n  'h5', // Sections and headings.\n  'h6', // Sections and headings.\n  'head', // Page.\n  'header', // Flow content.\n  'hgroup', // Sections and headings.\n  'hr', // Flow content.\n  'html', // Page.\n  'legend', // Flow content.\n  'li', // Block-like.\n  'li', // Similar to block.\n  'listing', // Flow content, legacy\n  'main', // Flow content.\n  'menu', // Lists.\n  'nav', // Sections and headings.\n  'ol', // Lists.\n  'optgroup', // Similar to block.\n  'option', // Similar to block.\n  'p', // Flow content.\n  'plaintext', // Flow content, legacy\n  'pre', // Flow content.\n  'section', // Sections and headings.\n  'summary', // Similar to block.\n  'table', // Similar to block.\n  'tbody', // Similar to block.\n  'td', // Block-like.\n  'td', // Similar to block.\n  'tfoot', // Similar to block.\n  'th', // Block-like.\n  'th', // Similar to block.\n  'thead', // Similar to block.\n  'tr', // Similar to block.\n  'ul', // Lists.\n  'wbr', // Contribute whitespace intrinsically.\n  'xmp' // Flow content, legacy\n]\n","export const content = [\n  // Form.\n  'button',\n  'input',\n  'select',\n  'textarea'\n]\n","export const skippable = [\n  'area',\n  'base',\n  'basefont',\n  'dialog',\n  'datalist',\n  'head',\n  'link',\n  'meta',\n  'noembed',\n  'noframes',\n  'param',\n  'rp',\n  'script',\n  'source',\n  'style',\n  'template',\n  'track',\n  'title'\n]\n","/**\n * @import {Nodes, Parents, Text} from 'hast'\n */\n\n/**\n * @callback Collapse\n *   Collapse a string.\n * @param {string} value\n *   Value to collapse.\n * @returns {string}\n *   Collapsed value.\n *\n * @typedef Options\n *   Configuration.\n * @property {boolean | null | undefined} [newlines=false]\n *   Collapse whitespace containing newlines to `'\\n'` instead of `' '`\n *   (default: `false`); the default is to collapse to a single space.\n *\n * @typedef Result\n *   Result.\n * @property {boolean} remove\n *   Whether to remove.\n * @property {boolean} ignore\n *   Whether to ignore.\n * @property {boolean} stripAtStart\n *   Whether to strip at the start.\n *\n * @typedef State\n *   Info passed around.\n * @property {Collapse} collapse\n *   Collapse.\n * @property {Whitespace} whitespace\n *   Current whitespace.\n * @property {boolean | undefined} [before]\n *   Whether there is a break before (default: `false`).\n * @property {boolean | undefined} [after]\n *   Whether there is a break after (default: `false`).\n *\n * @typedef {'normal' | 'nowrap' | 'pre' | 'pre-wrap'} Whitespace\n *   Whitespace setting.\n */\n\nimport {embedded} from 'hast-util-embedded'\nimport {isElement} from 'hast-util-is-element'\nimport {whitespace} from 'hast-util-whitespace'\nimport {convert} from 'unist-util-is'\nimport {blocks} from './block.js'\nimport {content as contents} from './content.js'\nimport {skippable as skippables} from './skippable.js'\n\n/** @type {Options} */\nconst emptyOptions = {}\nconst ignorableNode = convert(['comment', 'doctype'])\n\n/**\n * Minify whitespace.\n *\n * @param {Nodes} tree\n *   Tree.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport function minifyWhitespace(tree, options) {\n  const settings = options || emptyOptions\n\n  minify(tree, {\n    collapse: collapseFactory(\n      settings.newlines ? replaceNewlines : replaceWhitespace\n    ),\n    whitespace: 'normal'\n  })\n}\n\n/**\n * @param {Nodes} node\n *   Node.\n * @param {State} state\n *   Info passed around.\n * @returns {Result}\n *   Result.\n */\nfunction minify(node, state) {\n  if ('children' in node) {\n    const settings = {...state}\n\n    if (node.type === 'root' || blocklike(node)) {\n      settings.before = true\n      settings.after = true\n    }\n\n    settings.whitespace = inferWhiteSpace(node, state)\n\n    return all(node, settings)\n  }\n\n  if (node.type === 'text') {\n    if (state.whitespace === 'normal') {\n      return minifyText(node, state)\n    }\n\n    // Naïve collapse, but no trimming:\n    if (state.whitespace === 'nowrap') {\n      node.value = state.collapse(node.value)\n    }\n\n    // The `pre-wrap` or `pre` whitespace settings are neither collapsed nor\n    // trimmed.\n  }\n\n  return {ignore: ignorableNode(node), stripAtStart: false, remove: false}\n}\n\n/**\n * @param {Text} node\n *   Node.\n * @param {State} state\n *   Info passed around.\n * @returns {Result}\n *   Result.\n */\nfunction minifyText(node, state) {\n  const value = state.collapse(node.value)\n  const result = {ignore: false, stripAtStart: false, remove: false}\n  let start = 0\n  let end = value.length\n\n  if (state.before && removable(value.charAt(0))) {\n    start++\n  }\n\n  if (start !== end && removable(value.charAt(end - 1))) {\n    if (state.after) {\n      end--\n    } else {\n      result.stripAtStart = true\n    }\n  }\n\n  if (start === end) {\n    result.remove = true\n  } else {\n    node.value = value.slice(start, end)\n  }\n\n  return result\n}\n\n/**\n * @param {Parents} parent\n *   Node.\n * @param {State} state\n *   Info passed around.\n * @returns {Result}\n *   Result.\n */\nfunction all(parent, state) {\n  let before = state.before\n  const after = state.after\n  const children = parent.children\n  let length = children.length\n  let index = -1\n\n  while (++index < length) {\n    const result = minify(children[index], {\n      ...state,\n      after: collapsableAfter(children, index, after),\n      before\n    })\n\n    if (result.remove) {\n      children.splice(index, 1)\n      index--\n      length--\n    } else if (!result.ignore) {\n      before = result.stripAtStart\n    }\n\n    // If this element, such as a `<select>` or `<img>`, contributes content\n    // somehow, allow whitespace again.\n    if (content(children[index])) {\n      before = false\n    }\n  }\n\n  return {ignore: false, stripAtStart: Boolean(before || after), remove: false}\n}\n\n/**\n * @param {Array<Nodes>} nodes\n *   Nodes.\n * @param {number} index\n *   Index.\n * @param {boolean | undefined} [after]\n *   Whether there is a break after `nodes` (default: `false`).\n * @returns {boolean | undefined}\n *   Whether there is a break after the node at `index`.\n */\nfunction collapsableAfter(nodes, index, after) {\n  while (++index < nodes.length) {\n    const node = nodes[index]\n    let result = inferBoundary(node)\n\n    if (result === undefined && 'children' in node && !skippable(node)) {\n      result = collapsableAfter(node.children, -1)\n    }\n\n    if (typeof result === 'boolean') {\n      return result\n    }\n  }\n\n  return after\n}\n\n/**\n * Infer two types of boundaries:\n *\n * 1. `true` — boundary for which whitespace around it does not contribute\n *    anything\n * 2. `false` — boundary for which whitespace around it *does* contribute\n *\n * No result (`undefined`) is returned if it is unknown.\n *\n * @param {Nodes} node\n *   Node.\n * @returns {boolean | undefined}\n *   Boundary.\n */\nfunction inferBoundary(node) {\n  if (node.type === 'element') {\n    if (content(node)) {\n      return false\n    }\n\n    if (blocklike(node)) {\n      return true\n    }\n\n    // Unknown: either depends on siblings if embedded or metadata, or on\n    // children.\n  } else if (node.type === 'text') {\n    if (!whitespace(node)) {\n      return false\n    }\n  } else if (!ignorableNode(node)) {\n    return false\n  }\n}\n\n/**\n * Infer whether a node is skippable.\n *\n * @param {Nodes} node\n *   Node.\n * @returns {boolean}\n *   Whether `node` is skippable.\n */\nfunction content(node) {\n  return embedded(node) || isElement(node, contents)\n}\n\n/**\n * See: <https://html.spec.whatwg.org/#the-css-user-agent-style-sheet-and-presentational-hints>\n *\n * @param {Nodes} node\n *   Node.\n * @returns {boolean}\n *   Whether `node` is block-like.\n */\nfunction blocklike(node) {\n  return isElement(node, blocks)\n}\n\n/**\n * @param {Parents} node\n *   Node.\n * @returns {boolean}\n *   Whether `node` is skippable.\n */\nfunction skippable(node) {\n  return (\n    Boolean(node.type === 'element' && node.properties.hidden) ||\n    ignorableNode(node) ||\n    isElement(node, skippables)\n  )\n}\n\n/**\n * @param {string} character\n *   Character.\n * @returns {boolean}\n *   Whether `character` is removable.\n */\nfunction removable(character) {\n  return character === ' ' || character === '\\n'\n}\n\n/**\n * @type {Collapse}\n */\nfunction replaceNewlines(value) {\n  const match = /\\r?\\n|\\r/.exec(value)\n  return match ? match[0] : ' '\n}\n\n/**\n * @type {Collapse}\n */\nfunction replaceWhitespace() {\n  return ' '\n}\n\n/**\n * @param {Collapse} replace\n * @returns {Collapse}\n *   Collapse.\n */\nfunction collapseFactory(replace) {\n  return collapse\n\n  /**\n   * @type {Collapse}\n   */\n  function collapse(value) {\n    return String(value).replace(/[\\t\\n\\v\\f\\r ]+/g, replace)\n  }\n}\n\n/**\n * We don’t need to support void elements here (so `nobr wbr` -> `normal` is\n * ignored).\n *\n * @param {Parents} node\n *   Node.\n * @param {State} state\n *   Info passed around.\n * @returns {Whitespace}\n *   Whitespace.\n */\nfunction inferWhiteSpace(node, state) {\n  if ('tagName' in node && node.properties) {\n    switch (node.tagName) {\n      // Whitespace in script/style, while not displayed by CSS as significant,\n      // could have some meaning in JS/CSS, so we can’t touch them.\n      case 'listing':\n      case 'plaintext':\n      case 'script':\n      case 'style':\n      case 'xmp': {\n        return 'pre'\n      }\n\n      case 'nobr': {\n        return 'nowrap'\n      }\n\n      case 'pre': {\n        return node.properties.wrap ? 'pre-wrap' : 'pre'\n      }\n\n      case 'td':\n      case 'th': {\n        return node.properties.noWrap ? 'nowrap' : state.whitespace\n      }\n\n      case 'textarea': {\n        return 'pre-wrap'\n      }\n\n      default:\n    }\n  }\n\n  return state.whitespace\n}\n","/**\n * @import {Options} from 'hast-util-minify-whitespace'\n * @import {Root} from 'hast'\n */\n\nimport {minifyWhitespace} from 'hast-util-minify-whitespace'\n\n/**\n * Minify whitespace.\n *\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns\n *   Transform.\n */\nexport default function rehypeMinifyWhitespace(options) {\n  /**\n   * @param {Root} tree\n   *   Tree.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  return function (tree) {\n    minifyWhitespace(tree, options)\n  }\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n *   Test from `unist-util-is`.\n *\n *   Note: we have remove and add `undefined`, because otherwise when generating\n *   automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n *   which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n *   Fn extends (value: any) => value is infer Thing\n *   ? Thing\n *   : Fallback\n * )} Predicate\n *   Get the value of a type guard `Fn`.\n * @template Fn\n *   Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n *   Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n *   Check extends null | undefined // No test.\n *   ? Value\n *   : Value extends {type: Check} // String (type) test.\n *   ? Value\n *   : Value extends Check // Partial test.\n *   ? Value\n *   : Check extends Function // Function test.\n *   ? Predicate<Check, Value> extends Value\n *     ? Predicate<Check, Value>\n *     : never\n *   : never // Some other test?\n * )} MatchesOne\n *   Check whether a node matches a primitive check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n *   Check extends Array<any>\n *   ? MatchesOne<Value, Check[keyof Check]>\n *   : MatchesOne<Value, Check>\n * )} Matches\n *   Check whether a node matches a check in the type system.\n * @template Value\n *   Value; typically unist `Node`.\n * @template Check\n *   Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {(\n *   Kind extends {children: Array<infer Child>}\n *   ? Child\n *   : never\n * )} Child\n *   Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Kind\n *   All node types.\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Find the first node in `parent` after another `node` or after an index,\n * that passes `test`.\n *\n * @param parent\n *   Parent node.\n * @param index\n *   Child node or index.\n * @param [test=undefined]\n *   Test for child to look for (optional).\n * @returns\n *   A child (matching `test`, if given) or `undefined`.\n */\nexport const findAfter =\n  // Note: overloads like this are needed to support optional generics.\n  /**\n   * @type {(\n   *   (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) &\n   *   (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined)\n   * )}\n   */\n  (\n    /**\n     * @param {UnistParent} parent\n     * @param {UnistNode | number} index\n     * @param {Test} [test]\n     * @returns {UnistNode | undefined}\n     */\n    function (parent, index, test) {\n      const is = convert(test)\n\n      if (!parent || !parent.type || !parent.children) {\n        throw new Error('Expected parent node')\n      }\n\n      if (typeof index === 'number') {\n        if (index < 0 || index === Number.POSITIVE_INFINITY) {\n          throw new Error('Expected positive finite number as index')\n        }\n      } else {\n        index = parent.children.indexOf(index)\n\n        if (index < 0) {\n          throw new Error('Expected child node or index')\n        }\n      }\n\n      while (++index < parent.children.length) {\n        if (is(parent.children[index], index, parent)) {\n          return parent.children[index]\n        }\n      }\n\n      return undefined\n    }\n  )\n","/**\n * @typedef {import('hast').Comment} Comment\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Nodes} Nodes\n * @typedef {import('hast').Parents} Parents\n * @typedef {import('hast').Text} Text\n * @typedef {import('hast-util-is-element').TestFunction} TestFunction\n */\n\n/**\n * @typedef {'normal' | 'nowrap' | 'pre' | 'pre-wrap'} Whitespace\n *   Valid and useful whitespace values (from CSS).\n *\n * @typedef {0 | 1 | 2} BreakNumber\n *   Specific break:\n *\n *   *   `0` — space\n *   *   `1` — line ending\n *   *   `2` — blank line\n *\n * @typedef {'\\n'} BreakForce\n *   Forced break.\n *\n * @typedef {boolean} BreakValue\n *   Whether there was a break.\n *\n * @typedef {BreakNumber | BreakValue | undefined} BreakBefore\n *   Any value for a break before.\n *\n * @typedef {BreakForce | BreakNumber | BreakValue | undefined} BreakAfter\n *   Any value for a break after.\n *\n * @typedef CollectionInfo\n *   Info on current collection.\n * @property {BreakAfter} breakAfter\n *   Whether there was a break after.\n * @property {BreakBefore} breakBefore\n *   Whether there was a break before.\n * @property {Whitespace} whitespace\n *   Current whitespace setting.\n *\n * @typedef Options\n *   Configuration.\n * @property {Whitespace | null | undefined} [whitespace='normal']\n *   Initial CSS whitespace setting to use (default: `'normal'`).\n */\n\nimport {findAfter} from 'unist-util-find-after'\nimport {convertElement} from 'hast-util-is-element'\n\nconst searchLineFeeds = /\\n/g\nconst searchTabOrSpaces = /[\\t ]+/g\n\nconst br = convertElement('br')\nconst cell = convertElement(isCell)\nconst p = convertElement('p')\nconst row = convertElement('tr')\n\n// Note that we don’t need to include void elements here as they don’t have text.\n// See: <https://github.com/wooorm/html-void-elements>\nconst notRendered = convertElement([\n  // List from: <https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements>\n  'datalist',\n  'head',\n  'noembed',\n  'noframes',\n  'noscript', // Act as if we support scripting.\n  'rp',\n  'script',\n  'style',\n  'template',\n  'title',\n  // Hidden attribute.\n  hidden,\n  // From: <https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3>\n  closedDialog\n])\n\n// See: <https://html.spec.whatwg.org/multipage/rendering.html#the-css-user-agent-style-sheet-and-presentational-hints>\nconst blockOrCaption = convertElement([\n  'address', // Flow content\n  'article', // Sections and headings\n  'aside', // Sections and headings\n  'blockquote', // Flow content\n  'body', // Page\n  'caption', // `table-caption`\n  'center', // Flow content (legacy)\n  'dd', // Lists\n  'dialog', // Flow content\n  'dir', // Lists (legacy)\n  'dl', // Lists\n  'dt', // Lists\n  'div', // Flow content\n  'figure', // Flow content\n  'figcaption', // Flow content\n  'footer', // Flow content\n  'form,', // Flow content\n  'h1', // Sections and headings\n  'h2', // Sections and headings\n  'h3', // Sections and headings\n  'h4', // Sections and headings\n  'h5', // Sections and headings\n  'h6', // Sections and headings\n  'header', // Flow content\n  'hgroup', // Sections and headings\n  'hr', // Flow content\n  'html', // Page\n  'legend', // Flow content\n  'li', // Lists (as `display: list-item`)\n  'listing', // Flow content (legacy)\n  'main', // Flow content\n  'menu', // Lists\n  'nav', // Sections and headings\n  'ol', // Lists\n  'p', // Flow content\n  'plaintext', // Flow content (legacy)\n  'pre', // Flow content\n  'section', // Sections and headings\n  'ul', // Lists\n  'xmp' // Flow content (legacy)\n])\n\n/**\n * Get the plain-text value of a node.\n *\n * ###### Algorithm\n *\n * *   if `tree` is a comment, returns its `value`\n * *   if `tree` is a text, applies normal whitespace collapsing to its\n *     `value`, as defined by the CSS Text spec\n * *   if `tree` is a root or element, applies an algorithm similar to the\n *     `innerText` getter as defined by HTML\n *\n * ###### Notes\n *\n * > 👉 **Note**: the algorithm acts as if `tree` is being rendered, and as if\n * > we’re a CSS-supporting user agent, with scripting enabled.\n *\n * *   if `tree` is an element that is not displayed (such as a `head`), we’ll\n *     still use the `innerText` algorithm instead of switching to `textContent`\n * *   if descendants of `tree` are elements that are not displayed, they are\n *     ignored\n * *   CSS is not considered, except for the default user agent style sheet\n * *   a line feed is collapsed instead of ignored in cases where Fullwidth, Wide,\n *     or Halfwidth East Asian Width characters are used, the same goes for a case\n *     with Chinese, Japanese, or Yi writing systems\n * *   replaced elements (such as `audio`) are treated like non-replaced elements\n *\n * @param {Nodes} tree\n *   Tree to turn into text.\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Serialized `tree`.\n */\nexport function toText(tree, options) {\n  const options_ = options || {}\n  const children = 'children' in tree ? tree.children : []\n  const block = blockOrCaption(tree)\n  const whitespace = inferWhitespace(tree, {\n    whitespace: options_.whitespace || 'normal',\n    breakBefore: false,\n    breakAfter: false\n  })\n\n  /** @type {Array<BreakNumber | string>} */\n  const results = []\n\n  // Treat `text` and `comment` as having normal white-space.\n  // This deviates from the spec as in the DOM the node’s `.data` has to be\n  // returned.\n  // If you want that behavior use `hast-util-to-string`.\n  // All other nodes are later handled as if they are `element`s (so the\n  // algorithm also works on a `root`).\n  // Nodes without children are treated as a void element, so `doctype` is thus\n  // ignored.\n  if (tree.type === 'text' || tree.type === 'comment') {\n    results.push(\n      ...collectText(tree, {\n        whitespace,\n        breakBefore: true,\n        breakAfter: true\n      })\n    )\n  }\n\n  // 1.  If this element is not being rendered, or if the user agent is a\n  //     non-CSS user agent, then return the same value as the textContent IDL\n  //     attribute on this element.\n  //\n  //     Note: we’re not supporting stylesheets so we’re acting as if the node\n  //     is rendered.\n  //\n  //     If you want that behavior use `hast-util-to-string`.\n  //     Important: we’ll have to account for this later though.\n\n  // 2.  Let results be a new empty list.\n  let index = -1\n\n  // 3.  For each child node node of this element:\n  while (++index < children.length) {\n    // 3.1. Let current be the list resulting in running the inner text\n    //      collection steps with node.\n    //      Each item in results will either be a JavaScript string or a\n    //      positive integer (a required line break count).\n    // 3.2. For each item item in current, append item to results.\n    results.push(\n      ...renderedTextCollection(\n        children[index],\n        // @ts-expect-error: `tree` is a parent if we’re here.\n        tree,\n        {\n          whitespace,\n          breakBefore: index ? undefined : block,\n          breakAfter:\n            index < children.length - 1 ? br(children[index + 1]) : block\n        }\n      )\n    )\n  }\n\n  // 4.  Remove any items from results that are the empty string.\n  // 5.  Remove any runs of consecutive required line break count items at the\n  //     start or end of results.\n  // 6.  Replace each remaining run of consecutive required line break count\n  //     items with a string consisting of as many U+000A LINE FEED (LF)\n  //     characters as the maximum of the values in the required line break\n  //     count items.\n  /** @type {Array<string>} */\n  const result = []\n  /** @type {number | undefined} */\n  let count\n\n  index = -1\n\n  while (++index < results.length) {\n    const value = results[index]\n\n    if (typeof value === 'number') {\n      if (count !== undefined && value > count) count = value\n    } else if (value) {\n      if (count !== undefined && count > -1) {\n        result.push('\\n'.repeat(count) || ' ')\n      }\n\n      count = -1\n      result.push(value)\n    }\n  }\n\n  // 7.  Return the concatenation of the string items in results.\n  return result.join('')\n}\n\n/**\n * <https://html.spec.whatwg.org/multipage/dom.html#rendered-text-collection-steps>\n *\n * @param {Nodes} node\n * @param {Parents} parent\n * @param {CollectionInfo} info\n * @returns {Array<BreakNumber | string>}\n */\nfunction renderedTextCollection(node, parent, info) {\n  if (node.type === 'element') {\n    return collectElement(node, parent, info)\n  }\n\n  if (node.type === 'text') {\n    return info.whitespace === 'normal'\n      ? collectText(node, info)\n      : collectPreText(node)\n  }\n\n  return []\n}\n\n/**\n * Collect an element.\n *\n * @param {Element} node\n *   Element node.\n * @param {Parents} parent\n * @param {CollectionInfo} info\n *   Info on current collection.\n * @returns {Array<BreakNumber | string>}\n */\nfunction collectElement(node, parent, info) {\n  // First we infer the `white-space` property.\n  const whitespace = inferWhitespace(node, info)\n  const children = node.children || []\n  let index = -1\n  /** @type {Array<BreakNumber | string>} */\n  let items = []\n\n  // We’re ignoring point 3, and exiting without any content here, because we\n  // deviated from the spec in `toText` at step 3.\n  if (notRendered(node)) {\n    return items\n  }\n\n  /** @type {BreakNumber | undefined} */\n  let prefix\n  /** @type {BreakForce | BreakNumber | undefined} */\n  let suffix\n  // Note: we first detect if there is going to be a break before or after the\n  // contents, as that changes the white-space handling.\n\n  // 2.  If node’s computed value of `visibility` is not `visible`, then return\n  //     items.\n  //\n  //     Note: Ignored, as everything is visible by default user agent styles.\n\n  // 3.  If node is not being rendered, then return items. [...]\n  //\n  //     Note: We already did this above.\n\n  // See `collectText` for step 4.\n\n  // 5.  If node is a `<br>` element, then append a string containing a single\n  //     U+000A LINE FEED (LF) character to items.\n  if (br(node)) {\n    suffix = '\\n'\n  }\n\n  // 7.  If node’s computed value of `display` is `table-row`, and node’s CSS\n  //     box is not the last `table-row` box of the nearest ancestor `table`\n  //     box, then append a string containing a single U+000A LINE FEED (LF)\n  //     character to items.\n  //\n  //     See: <https://html.spec.whatwg.org/multipage/rendering.html#tables-2>\n  //     Note: needs further investigation as this does not account for implicit\n  //     rows.\n  else if (\n    row(node) &&\n    // @ts-expect-error: something up with types of parents.\n    findAfter(parent, node, row)\n  ) {\n    suffix = '\\n'\n  }\n\n  // 8.  If node is a `<p>` element, then append 2 (a required line break count)\n  //     at the beginning and end of items.\n  else if (p(node)) {\n    prefix = 2\n    suffix = 2\n  }\n\n  // 9.  If node’s used value of `display` is block-level or `table-caption`,\n  //     then append 1 (a required line break count) at the beginning and end of\n  //     items.\n  else if (blockOrCaption(node)) {\n    prefix = 1\n    suffix = 1\n  }\n\n  // 1.  Let items be the result of running the inner text collection steps with\n  //     each child node of node in tree order, and then concatenating the\n  //     results to a single list.\n  while (++index < children.length) {\n    items = items.concat(\n      renderedTextCollection(children[index], node, {\n        whitespace,\n        breakBefore: index ? undefined : prefix,\n        breakAfter:\n          index < children.length - 1 ? br(children[index + 1]) : suffix\n      })\n    )\n  }\n\n  // 6.  If node’s computed value of `display` is `table-cell`, and node’s CSS\n  //     box is not the last `table-cell` box of its enclosing `table-row` box,\n  //     then append a string containing a single U+0009 CHARACTER TABULATION\n  //     (tab) character to items.\n  //\n  //     See: <https://html.spec.whatwg.org/multipage/rendering.html#tables-2>\n  if (\n    cell(node) &&\n    // @ts-expect-error: something up with types of parents.\n    findAfter(parent, node, cell)\n  ) {\n    items.push('\\t')\n  }\n\n  // Add the pre- and suffix.\n  if (prefix) items.unshift(prefix)\n  if (suffix) items.push(suffix)\n\n  return items\n}\n\n/**\n * 4.  If node is a Text node, then for each CSS text box produced by node,\n *     in content order, compute the text of the box after application of the\n *     CSS `white-space` processing rules and `text-transform` rules, set\n *     items to the list of the resulting strings, and return items.\n *     The CSS `white-space` processing rules are slightly modified:\n *     collapsible spaces at the end of lines are always collapsed, but they\n *     are only removed if the line is the last line of the block, or it ends\n *     with a br element.\n *     Soft hyphens should be preserved.\n *\n *     Note: See `collectText` and `collectPreText`.\n *     Note: we don’t deal with `text-transform`, no element has that by\n *     default.\n *\n * See: <https://drafts.csswg.org/css-text/#white-space-phase-1>\n *\n * @param {Comment | Text} node\n *   Text node.\n * @param {CollectionInfo} info\n *   Info on current collection.\n * @returns {Array<BreakNumber | string>}\n *   Result.\n */\nfunction collectText(node, info) {\n  const value = String(node.value)\n  /** @type {Array<string>} */\n  const lines = []\n  /** @type {Array<BreakNumber | string>} */\n  const result = []\n  let start = 0\n\n  while (start <= value.length) {\n    searchLineFeeds.lastIndex = start\n\n    const match = searchLineFeeds.exec(value)\n    const end = match && 'index' in match ? match.index : value.length\n\n    lines.push(\n      // Any sequence of collapsible spaces and tabs immediately preceding or\n      // following a segment break is removed.\n      trimAndCollapseSpacesAndTabs(\n        // […] ignoring bidi formatting characters (characters with the\n        // Bidi_Control property [UAX9]: ALM, LTR, RTL, LRE-RLO, LRI-PDI) as if\n        // they were not there.\n        value\n          .slice(start, end)\n          .replace(/[\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]/g, ''),\n        start === 0 ? info.breakBefore : true,\n        end === value.length ? info.breakAfter : true\n      )\n    )\n\n    start = end + 1\n  }\n\n  // Collapsible segment breaks are transformed for rendering according to the\n  // segment break transformation rules.\n  // So here we jump to 4.1.2 of [CSSTEXT]:\n  // Any collapsible segment break immediately following another collapsible\n  // segment break is removed\n  let index = -1\n  /** @type {BreakNumber | undefined} */\n  let join\n\n  while (++index < lines.length) {\n    // *   If the character immediately before or immediately after the segment\n    //     break is the zero-width space character (U+200B), then the break is\n    //     removed, leaving behind the zero-width space.\n    if (\n      lines[index].charCodeAt(lines[index].length - 1) === 0x20_0b /* ZWSP */ ||\n      (index < lines.length - 1 &&\n        lines[index + 1].charCodeAt(0) === 0x20_0b) /* ZWSP */\n    ) {\n      result.push(lines[index])\n      join = undefined\n    }\n\n    // *   Otherwise, if the East Asian Width property [UAX11] of both the\n    //     character before and after the segment break is Fullwidth, Wide, or\n    //     Halfwidth (not Ambiguous), and neither side is Hangul, then the\n    //     segment break is removed.\n    //\n    //     Note: ignored.\n    // *   Otherwise, if the writing system of the segment break is Chinese,\n    //     Japanese, or Yi, and the character before or after the segment break\n    //     is punctuation or a symbol (Unicode general category P* or S*) and\n    //     has an East Asian Width property of Ambiguous, and the character on\n    //     the other side of the segment break is Fullwidth, Wide, or Halfwidth,\n    //     and not Hangul, then the segment break is removed.\n    //\n    //     Note: ignored.\n\n    // *   Otherwise, the segment break is converted to a space (U+0020).\n    else if (lines[index]) {\n      if (typeof join === 'number') result.push(join)\n      result.push(lines[index])\n      join = 0\n    } else if (index === 0 || index === lines.length - 1) {\n      // If this line is empty, and it’s the first or last, add a space.\n      // Note that this function is only called in normal whitespace, so we\n      // don’t worry about `pre`.\n      result.push(0)\n    }\n  }\n\n  return result\n}\n\n/**\n * Collect a text node as “pre” whitespace.\n *\n * @param {Text} node\n *   Text node.\n * @returns {Array<BreakNumber | string>}\n *   Result.\n */\nfunction collectPreText(node) {\n  return [String(node.value)]\n}\n\n/**\n * 3.  Every collapsible tab is converted to a collapsible space (U+0020).\n * 4.  Any collapsible space immediately following another collapsible\n *     space—even one outside the boundary of the inline containing that\n *     space, provided both spaces are within the same inline formatting\n *     context—is collapsed to have zero advance width. (It is invisible,\n *     but retains its soft wrap opportunity, if any.)\n *\n * @param {string} value\n *   Value to collapse.\n * @param {BreakBefore} breakBefore\n *   Whether there was a break before.\n * @param {BreakAfter} breakAfter\n *   Whether there was a break after.\n * @returns {string}\n *   Result.\n */\nfunction trimAndCollapseSpacesAndTabs(value, breakBefore, breakAfter) {\n  /** @type {Array<string>} */\n  const result = []\n  let start = 0\n  /** @type {number | undefined} */\n  let end\n\n  while (start < value.length) {\n    searchTabOrSpaces.lastIndex = start\n    const match = searchTabOrSpaces.exec(value)\n    end = match ? match.index : value.length\n\n    // If we’re not directly after a segment break, but there was white space,\n    // add an empty value that will be turned into a space.\n    if (!start && !end && match && !breakBefore) {\n      result.push('')\n    }\n\n    if (start !== end) {\n      result.push(value.slice(start, end))\n    }\n\n    start = match ? end + match[0].length : end\n  }\n\n  // If we reached the end, there was trailing white space, and there’s no\n  // segment break after this node, add an empty value that will be turned\n  // into a space.\n  if (start !== end && !breakAfter) {\n    result.push('')\n  }\n\n  return result.join(' ')\n}\n\n/**\n * Figure out the whitespace of a node.\n *\n * We don’t support void elements here (so `nobr wbr` -> `normal` is ignored).\n *\n * @param {Nodes} node\n *   Node (typically `Element`).\n * @param {CollectionInfo} info\n *   Info on current collection.\n * @returns {Whitespace}\n *   Applied whitespace.\n */\nfunction inferWhitespace(node, info) {\n  if (node.type === 'element') {\n    const properties = node.properties || {}\n    switch (node.tagName) {\n      case 'listing':\n      case 'plaintext':\n      case 'xmp': {\n        return 'pre'\n      }\n\n      case 'nobr': {\n        return 'nowrap'\n      }\n\n      case 'pre': {\n        return properties.wrap ? 'pre-wrap' : 'pre'\n      }\n\n      case 'td':\n      case 'th': {\n        return properties.noWrap ? 'nowrap' : info.whitespace\n      }\n\n      case 'textarea': {\n        return 'pre-wrap'\n      }\n\n      default:\n    }\n  }\n\n  return info.whitespace\n}\n\n/**\n * @type {TestFunction}\n * @param {Element} node\n * @returns {node is {properties: {hidden: true}}}\n */\nfunction hidden(node) {\n  return Boolean((node.properties || {}).hidden)\n}\n\n/**\n * @type {TestFunction}\n * @param {Element} node\n * @returns {node is {tagName: 'td' | 'th'}}\n */\nfunction isCell(node) {\n  return node.tagName === 'td' || node.tagName === 'th'\n}\n\n/**\n * @type {TestFunction}\n */\nfunction closedDialog(node) {\n  return node.tagName === 'dialog' && !(node.properties || {}).open\n}\n","/**\n * Remove final line endings from `value`\n *\n * @param {unknown} value\n *   Value with trailing line endings, coerced to string.\n * @return {string}\n *   Value without trailing line endings.\n */\nexport function trimTrailingLines(value) {\n  const input = String(value)\n  let end = input.length\n\n  while (end > 0) {\n    const code = input.codePointAt(end - 1)\n    if (code !== undefined && (code === 10 || code === 13)) {\n      end--\n    } else {\n      break\n    }\n  }\n\n  return input.slice(0, end)\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Code} from 'mdast'\n */\n\nimport {toText} from 'hast-util-to-text'\nimport {trimTrailingLines} from 'trim-trailing-lines'\n\nconst prefix = 'language-'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Code}\n *   mdast node.\n */\nexport function code(state, node) {\n  const children = node.children\n  let index = -1\n  /** @type {Array<number | string> | undefined} */\n  let classList\n  /** @type {string | undefined} */\n  let lang\n\n  if (node.tagName === 'pre') {\n    while (++index < children.length) {\n      const child = children[index]\n\n      if (\n        child.type === 'element' &&\n        child.tagName === 'code' &&\n        child.properties &&\n        child.properties.className &&\n        Array.isArray(child.properties.className)\n      ) {\n        classList = child.properties.className\n        break\n      }\n    }\n  }\n\n  if (classList) {\n    index = -1\n\n    while (++index < classList.length) {\n      if (String(classList[index]).slice(0, prefix.length) === prefix) {\n        lang = String(classList[index]).slice(prefix.length)\n        break\n      }\n    }\n  }\n\n  /** @type {Code} */\n  const result = {\n    type: 'code',\n    lang: lang || null,\n    meta: null,\n    value: trimTrailingLines(toText(node))\n  }\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Delete, PhrasingContent} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Delete}\n *   mdast node.\n */\nexport function del(state, node) {\n  // Allow potentially “invalid” nodes, they might be unknown.\n  // We also support straddling later.\n  const children = /** @type {Array<PhrasingContent>} */ (state.all(node))\n  /** @type {Delete} */\n  const result = {type: 'delete', children}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {ListContent} from 'mdast'\n */\n\n/**\n * Infer whether list items are spread.\n *\n * @param {Readonly<Array<Readonly<ListContent>>>} children\n *   List items.\n * @returns {boolean}\n *   Whether one or more list items are spread.\n */\nexport function listItemsSpread(children) {\n  let index = -1\n\n  if (children.length > 1) {\n    while (++index < children.length) {\n      if (children[index].spread) {\n        return true\n      }\n    }\n  }\n\n  return false\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {ElementContent, Element} from 'hast'\n * @import {BlockContent, DefinitionContent, ListContent, ListItem, List} from 'mdast'\n */\n\n/**\n * @typedef Group\n *   Title/definition group.\n * @property {Array<Element>} titles\n *   One or more titles.\n * @property {Array<ElementContent>} definitions\n *   One or more definitions.\n */\n\nimport {listItemsSpread} from '../util/list-items-spread.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {List | undefined}\n *   mdast node.\n */\nexport function dl(state, node) {\n  /** @type {Array<ElementContent>} */\n  const clean = []\n  /** @type {Array<Group>} */\n  const groups = []\n  let index = -1\n\n  // Unwrap `<div>`s\n  while (++index < node.children.length) {\n    const child = node.children[index]\n\n    if (child.type === 'element' && child.tagName === 'div') {\n      clean.push(...child.children)\n    } else {\n      clean.push(child)\n    }\n  }\n\n  /** @type {Group} */\n  let group = {definitions: [], titles: []}\n  index = -1\n\n  // Group titles and definitions.\n  while (++index < clean.length) {\n    const child = clean[index]\n\n    if (child.type === 'element' && child.tagName === 'dt') {\n      const previous = clean[index - 1]\n\n      if (\n        previous &&\n        previous.type === 'element' &&\n        previous.tagName === 'dd'\n      ) {\n        groups.push(group)\n        group = {definitions: [], titles: []}\n      }\n\n      group.titles.push(child)\n    } else {\n      group.definitions.push(child)\n    }\n  }\n\n  groups.push(group)\n\n  // Create items.\n  index = -1\n  /** @type {Array<ListContent>} */\n  const content = []\n\n  while (++index < groups.length) {\n    const result = [\n      ...handle(state, groups[index].titles),\n      ...handle(state, groups[index].definitions)\n    ]\n\n    if (result.length > 0) {\n      content.push({\n        type: 'listItem',\n        spread: result.length > 1,\n        checked: null,\n        children: result\n      })\n    }\n  }\n\n  // Create a list if there are items.\n  if (content.length > 0) {\n    /** @type {List} */\n    const result = {\n      type: 'list',\n      ordered: false,\n      start: null,\n      spread: listItemsSpread(content),\n      children: content\n    }\n    state.patch(node, result)\n    return result\n  }\n}\n\n/**\n * @param {State} state\n *   State.\n * @param {Array<ElementContent>} children\n *   hast element children to transform.\n * @returns {Array<BlockContent | DefinitionContent>}\n *   mdast nodes.\n */\nfunction handle(state, children) {\n  const nodes = state.all({type: 'root', children})\n  const listItems = state.toSpecificContent(nodes, create)\n\n  if (listItems.length === 0) {\n    return []\n  }\n\n  if (listItems.length === 1) {\n    return listItems[0].children\n  }\n\n  return [\n    {\n      type: 'list',\n      ordered: false,\n      start: null,\n      spread: listItemsSpread(listItems),\n      children: listItems\n    }\n  ]\n}\n\n/**\n * @returns {ListItem}\n */\nfunction create() {\n  return {type: 'listItem', spread: false, checked: null, children: []}\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Emphasis, PhrasingContent} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Emphasis}\n *   mdast node.\n */\nexport function em(state, node) {\n  // Allow potentially “invalid” nodes, they might be unknown.\n  // We also support straddling later.\n  const children = /** @type {Array<PhrasingContent>} */ (state.all(node))\n\n  /** @type {Emphasis} */\n  const result = {type: 'emphasis', children}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Nodes} from 'mdast'\n */\n\n/**\n * Drop trailing initial and final `br`s.\n *\n * @template {Nodes} Node\n *   Node type.\n * @param {Array<Node>} nodes\n *   List of nodes.\n * @returns {Array<Node>}\n *   List of nodes w/o `break`s.\n */\nexport function dropSurroundingBreaks(nodes) {\n  let start = 0\n  let end = nodes.length\n\n  while (start < end && nodes[start].type === 'break') start++\n  while (end > start && nodes[end - 1].type === 'break') end--\n\n  return start === 0 && end === nodes.length ? nodes : nodes.slice(start, end)\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Heading, PhrasingContent} from 'mdast'\n */\n\nimport {dropSurroundingBreaks} from '../util/drop-surrounding-breaks.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Heading}\n *   mdast node.\n */\nexport function heading(state, node) {\n  const depth = /** @type {Heading['depth']} */ (\n    /* c8 ignore next */\n    Number(node.tagName.charAt(1)) || 1\n  )\n  const children = dropSurroundingBreaks(\n    /** @type {Array<PhrasingContent>} */ (state.all(node))\n  )\n\n  /** @type {Heading} */\n  const result = {type: 'heading', depth, children}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Image} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Image}\n *   mdast node.\n */\nexport function img(state, node) {\n  const properties = node.properties || {}\n\n  /** @type {Image} */\n  const result = {\n    type: 'image',\n    url: state.resolve(String(properties.src || '') || null),\n    title: properties.title ? String(properties.title) : null,\n    alt: properties.alt ? String(properties.alt) : ''\n  }\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {InlineCode} from 'mdast'\n */\n\nimport {toText} from 'hast-util-to-text'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {InlineCode}\n *   mdast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {InlineCode} */\n  const result = {type: 'inlineCode', value: toText(node)}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element, Properties} from 'hast'\n */\n\n/**\n * @typedef {[string, Value]} Option\n *   Option, where the item at `0` is the label, the item at `1` the value.\n *\n * @typedef {Array<Option>} Options\n *   List of options.\n *\n * @typedef {string | undefined} Value\n *   `value` field of option.\n */\n\nimport {toText} from 'hast-util-to-text'\n\n/**\n * @param {Readonly<Element>} node\n *   hast element to inspect.\n * @param {Properties | undefined} [explicitProperties]\n *   Properties to use, normally taken from `node`, but can be changed.\n * @returns {Options}\n *   Options.\n */\nexport function findSelectedOptions(node, explicitProperties) {\n  /** @type {Array<Element>} */\n  const selectedOptions = []\n  /** @type {Options} */\n  const values = []\n  const properties = explicitProperties || node.properties || {}\n  const options = findOptions(node)\n  const size =\n    Math.min(Number.parseInt(String(properties.size), 10), 0) ||\n    (properties.multiple ? 4 : 1)\n  let index = -1\n\n  while (++index < options.length) {\n    const option = options[index]\n\n    if (option && option.properties && option.properties.selected) {\n      selectedOptions.push(option)\n    }\n  }\n\n  const list = selectedOptions.length > 0 ? selectedOptions : options\n  const max = Math.min(list.length, size)\n  index = -1\n\n  while (++index < max) {\n    const option = list[index]\n    const properties = option.properties || {}\n    const content = toText(option)\n    const label = content || String(properties.label || '')\n    const value = String(properties.value || '') || content\n    values.push([value, label === value ? undefined : label])\n  }\n\n  return values\n}\n\n/**\n * @param {Element} node\n *   Parent to find in.\n * @returns {Array<Element>}\n *   Option elements.\n */\nfunction findOptions(node) {\n  /** @type {Array<Element>} */\n  const results = []\n  let index = -1\n\n  while (++index < node.children.length) {\n    const child = node.children[index]\n\n    if ('children' in child && Array.isArray(child.children)) {\n      results.push(...findOptions(child))\n    }\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'option' &&\n      (!child.properties || !child.properties.disabled)\n    ) {\n      results.push(child)\n    }\n  }\n\n  return results\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Nodes} Nodes\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Check if `node` is an element and has a `name` property.\n *\n * @template {string} Key\n *   Type of key.\n * @param {Nodes} node\n *   Node to check (typically `Element`).\n * @param {Key} name\n *   Property name to check.\n * @returns {node is Element & {properties: Record<Key, Array<number | string> | number | string | true>}}}\n *   Whether `node` is an element that has a `name` property.\n *\n *   Note: see <https://github.com/DefinitelyTyped/DefinitelyTyped/blob/27c9274/types/hast/index.d.ts#L37C29-L37C98>.\n */\nexport function hasProperty(node, name) {\n  const value =\n    node.type === 'element' &&\n    own.call(node.properties, name) &&\n    node.properties[name]\n\n  return value !== null && value !== undefined && value !== false\n}\n","/**\n * @import {Nodes} from 'hast'\n */\n\nconst list = new Set(['pingback', 'prefetch', 'stylesheet'])\n\n/**\n * Checks whether a node is a “body OK” link.\n *\n * @param {Nodes} node\n *   Node to check.\n * @returns {boolean}\n *   Whether `node` is a “body OK” link.\n */\nexport function isBodyOkLink(node) {\n  if (node.type !== 'element' || node.tagName !== 'link') {\n    return false\n  }\n\n  if (node.properties.itemProp) {\n    return true\n  }\n\n  const value = node.properties.rel\n  let index = -1\n\n  if (!Array.isArray(value) || value.length === 0) {\n    return false\n  }\n\n  while (++index < value.length) {\n    if (!list.has(String(value[index]))) {\n      return false\n    }\n  }\n\n  return true\n}\n","/**\n * @typedef {import('hast').Nodes} Nodes\n */\n\nimport {embedded} from 'hast-util-embedded'\nimport {hasProperty} from 'hast-util-has-property'\nimport {isBodyOkLink} from 'hast-util-is-body-ok-link'\nimport {convertElement} from 'hast-util-is-element'\n\nconst basic = convertElement([\n  'a',\n  'abbr',\n  // `area` is in fact only phrasing if it is inside a `map` element.\n  // However, since `area`s are required to be inside a `map` element, and it’s\n  // a rather involved check, it’s ignored here for now.\n  'area',\n  'b',\n  'bdi',\n  'bdo',\n  'br',\n  'button',\n  'cite',\n  'code',\n  'data',\n  'datalist',\n  'del',\n  'dfn',\n  'em',\n  'i',\n  'input',\n  'ins',\n  'kbd',\n  'keygen',\n  'label',\n  'map',\n  'mark',\n  'meter',\n  'noscript',\n  'output',\n  'progress',\n  'q',\n  'ruby',\n  's',\n  'samp',\n  'script',\n  'select',\n  'small',\n  'span',\n  'strong',\n  'sub',\n  'sup',\n  'template',\n  'textarea',\n  'time',\n  'u',\n  'var',\n  'wbr'\n])\n\nconst meta = convertElement('meta')\n\n/**\n * Check if the given value is *phrasing* content.\n *\n * @param {Nodes} value\n *   Node to check.\n * @returns {boolean}\n *   Whether `value` is phrasing content.\n */\nexport function phrasing(value) {\n  return Boolean(\n    value.type === 'text' ||\n      basic(value) ||\n      embedded(value) ||\n      isBodyOkLink(value) ||\n      (meta(value) && hasProperty(value, 'itemProp'))\n  )\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {ListItem} from 'mdast'\n */\n\n/**\n * @typedef ExtractResult\n *   Result of extracting a leading checkbox.\n * @property {Element | undefined} checkbox\n *   The checkbox that was removed, if any.\n * @property {Element} rest\n *   If there was a leading checkbox, a deep clone of the node w/o the leading\n *   checkbox; otherwise a reference to the given, untouched, node.\n */\n\nimport {phrasing} from 'hast-util-phrasing'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {ListItem}\n *   mdast node.\n */\nexport function li(state, node) {\n  // If the list item starts with a checkbox, remove the checkbox and mark the\n  // list item as a GFM task list item.\n  const {rest, checkbox} = extractLeadingCheckbox(node)\n  const checked = checkbox ? Boolean(checkbox.properties.checked) : null\n  const spread = spreadout(rest)\n  const children = state.toFlow(state.all(rest))\n\n  /** @type {ListItem} */\n  const result = {type: 'listItem', spread, checked, children}\n  state.patch(node, result)\n  return result\n}\n\n/**\n * Check if an element should spread out.\n *\n * The reason to spread out a markdown list item is primarily whether writing\n * the equivalent in markdown, would yield a spread out item.\n *\n * A spread out item results in `<p>` and `</p>` tags.\n * Otherwise, the phrasing would be output directly.\n * We can check for that: if there’s a `<p>` element, spread it out.\n *\n * But what if there are no paragraphs?\n * In that case, we can also assume that if two “block” things were written in\n * an item, that it is spread out, because blocks are typically joined by blank\n * lines, which also means a spread item.\n *\n * Lastly, because in HTML things can be wrapped in a `<div>` or similar, we\n * delve into non-phrasing elements here to figure out if they themselves\n * contain paragraphs or 2 or more flow non-phrasing elements.\n *\n * @param {Readonly<Element>} node\n * @returns {boolean}\n */\nfunction spreadout(node) {\n  let index = -1\n  let seenFlow = false\n\n  while (++index < node.children.length) {\n    const child = node.children[index]\n\n    if (child.type === 'element') {\n      if (phrasing(child)) continue\n\n      if (child.tagName === 'p' || seenFlow || spreadout(child)) {\n        return true\n      }\n\n      seenFlow = true\n    }\n  }\n\n  return false\n}\n\n/**\n * Extract a leading checkbox from a list item.\n *\n * If there was a leading checkbox, makes a deep clone of the node w/o the\n * leading checkbox; otherwise a reference to the given, untouched, node is\n * given back.\n *\n * So for example:\n *\n * ```html\n * <li><input type=\"checkbox\">Text</li>\n * ```\n *\n * …becomes:\n *\n * ```html\n * <li>Text</li>\n * ```\n *\n * ```html\n * <li><p><input type=\"checkbox\">Text</p></li>\n * ```\n *\n * …becomes:\n *\n * ```html\n * <li><p>Text</p></li>\n * ```\n *\n * @param {Readonly<Element>} node\n * @returns {ExtractResult}\n */\nfunction extractLeadingCheckbox(node) {\n  const head = node.children[0]\n\n  if (\n    head &&\n    head.type === 'element' &&\n    head.tagName === 'input' &&\n    head.properties &&\n    (head.properties.type === 'checkbox' || head.properties.type === 'radio')\n  ) {\n    const rest = {...node, children: node.children.slice(1)}\n    return {checkbox: head, rest}\n  }\n\n  // The checkbox may be nested in another element.\n  // If the first element has children, look for a leading checkbox inside it.\n  //\n  // This only handles nesting in `<p>` elements, which is most common.\n  // It’s possible a leading checkbox might be nested in other types of flow or\n  // phrasing elements (and *deeply* nested, which is not possible with `<p>`).\n  // Limiting things to `<p>` elements keeps this simpler for now.\n  if (head && head.type === 'element' && head.tagName === 'p') {\n    const {checkbox, rest: restHead} = extractLeadingCheckbox(head)\n\n    if (checkbox) {\n      const rest = {...node, children: [restHead, ...node.children.slice(1)]}\n      return {checkbox, rest}\n    }\n  }\n\n  return {checkbox: undefined, rest: node}\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {ListItem, List} from 'mdast'\n */\n\nimport {listItemsSpread} from '../util/list-items-spread.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {List}\n *   mdast node.\n */\nexport function list(state, node) {\n  const ordered = node.tagName === 'ol'\n  const children = state.toSpecificContent(state.all(node), create)\n  /** @type {number | null} */\n  let start = null\n\n  if (ordered) {\n    start =\n      node.properties && node.properties.start\n        ? Number.parseInt(String(node.properties.start), 10)\n        : 1\n  }\n\n  /** @type {List} */\n  const result = {\n    type: 'list',\n    ordered,\n    start,\n    spread: listItemsSpread(children),\n    children\n  }\n  state.patch(node, result)\n  return result\n}\n\n/**\n * @returns {ListItem}\n */\nfunction create() {\n  return {type: 'listItem', spread: false, checked: null, children: []}\n}\n","/**\n * @import {} from 'mdast-util-to-hast'\n * @import {\n *   BlockContent,\n *   Delete,\n *   Link,\n *   Nodes,\n *   Paragraph,\n *   Parents,\n *   PhrasingContent,\n *   RootContent\n * } from 'mdast'\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {phrasing as hastPhrasing} from 'hast-util-phrasing'\nimport {whitespace} from 'hast-util-whitespace'\nimport {phrasing as mdastPhrasing} from 'mdast-util-phrasing'\nimport {dropSurroundingBreaks} from './drop-surrounding-breaks.js'\n\n/**\n * Check if there are phrasing mdast nodes.\n *\n * This is needed if a fragment is given, which could just be a sentence, and\n * doesn’t need a wrapper paragraph.\n *\n * @param {Array<Nodes>} nodes\n * @returns {boolean}\n */\nexport function wrapNeeded(nodes) {\n  let index = -1\n\n  while (++index < nodes.length) {\n    const node = nodes[index]\n\n    if (!phrasing(node) || ('children' in node && wrapNeeded(node.children))) {\n      return true\n    }\n  }\n\n  return false\n}\n\n/**\n * Wrap runs of phrasing content into paragraphs, leaving the non-phrasing\n * content as-is.\n *\n * @param {Array<RootContent>} nodes\n *   Content.\n * @returns {Array<BlockContent>}\n *   Content where phrasing is wrapped in paragraphs.\n */\nexport function wrap(nodes) {\n  return runs(nodes, onphrasing, function (d) {\n    return d\n  })\n\n  /**\n   * @param {Array<PhrasingContent>} nodes\n   * @returns {Array<Paragraph>}\n   */\n  function onphrasing(nodes) {\n    return nodes.every(function (d) {\n      return d.type === 'text' ? whitespace(d.value) : false\n    })\n      ? []\n      : [{type: 'paragraph', children: dropSurroundingBreaks(nodes)}]\n  }\n}\n\n/**\n * @param {Delete | Link} node\n * @returns {Array<BlockContent>}\n */\nfunction split(node) {\n  return runs(node.children, onphrasing, onnonphrasing)\n\n  /**\n   * Use `parent`, put the phrasing run inside it.\n   *\n   * @param {Array<PhrasingContent>} nodes\n   * @returns {Array<BlockContent>}\n   */\n  function onphrasing(nodes) {\n    const newParent = cloneWithoutChildren(node)\n    newParent.children = nodes\n    // @ts-expect-error Assume fine.\n    return [newParent]\n  }\n\n  /**\n   * Use `child`, add `parent` as its first child, put the original children\n   * into `parent`.\n   * If `child` is not a parent, `parent` will not be added.\n   *\n   * @param {BlockContent} child\n   * @returns {BlockContent}\n   */\n  function onnonphrasing(child) {\n    if ('children' in child && 'children' in node) {\n      const newParent = cloneWithoutChildren(node)\n      const newChild = cloneWithoutChildren(child)\n      // @ts-expect-error Assume fine.\n      newParent.children = child.children\n      // @ts-expect-error Assume fine.\n      newChild.children.push(newParent)\n      return newChild\n    }\n\n    return {...child}\n  }\n}\n\n/**\n * Wrap all runs of mdast phrasing content in `paragraph` nodes.\n *\n * @param {Array<RootContent>} nodes\n *   List of input nodes.\n * @param {(nodes: Array<PhrasingContent>) => Array<BlockContent>} onphrasing\n *   Turn phrasing content into block content.\n * @param {(node: BlockContent) => BlockContent} onnonphrasing\n *   Map block content (defaults to keeping them as-is).\n * @returns {Array<BlockContent>}\n */\nfunction runs(nodes, onphrasing, onnonphrasing) {\n  const flattened = flatten(nodes)\n  /** @type {Array<BlockContent>} */\n  const result = []\n  /** @type {Array<PhrasingContent>} */\n  let queue = []\n  let index = -1\n\n  while (++index < flattened.length) {\n    const node = flattened[index]\n\n    if (phrasing(node)) {\n      queue.push(node)\n    } else {\n      if (queue.length > 0) {\n        result.push(...onphrasing(queue))\n        queue = []\n      }\n\n      // @ts-expect-error Assume non-phrasing.\n      result.push(onnonphrasing(node))\n    }\n  }\n\n  if (queue.length > 0) {\n    result.push(...onphrasing(queue))\n    queue = []\n  }\n\n  return result\n}\n\n/**\n * Flatten a list of nodes.\n *\n * @param {Array<RootContent>} nodes\n *   List of nodes, will unravel `delete` and `link`.\n * @returns {Array<RootContent>}\n *   Unraveled nodes.\n */\nfunction flatten(nodes) {\n  /** @type {Array<RootContent>} */\n  const flattened = []\n  let index = -1\n\n  while (++index < nodes.length) {\n    const node = nodes[index]\n\n    // Straddling: some elements are *weird*.\n    // Namely: `map`, `ins`, `del`, and `a`, as they are hybrid elements.\n    // See: <https://html.spec.whatwg.org/#paragraphs>.\n    // Paragraphs are the weirdest of them all.\n    // See the straddling fixture for more info!\n    // `ins` is ignored in mdast, so we don’t need to worry about that.\n    // `map` maps to its content, so we don’t need to worry about that either.\n    // `del` maps to `delete` and `a` to `link`, so we do handle those.\n    // What we’ll do is split `node` over each of its children.\n    if (\n      (node.type === 'delete' || node.type === 'link') &&\n      wrapNeeded(node.children)\n    ) {\n      flattened.push(...split(node))\n    } else {\n      flattened.push(node)\n    }\n  }\n\n  return flattened\n}\n\n/**\n * Check if an mdast node is phrasing.\n *\n * Also supports checking embedded hast fields.\n *\n * @param {Nodes} node\n *   mdast node to check.\n * @returns {node is PhrasingContent}\n *   Whether `node` is phrasing content (includes nodes with `hName` fields\n *   set to phrasing hast element names).\n */\nfunction phrasing(node) {\n  const tagName = node.data && node.data.hName\n  return tagName\n    ? hastPhrasing({type: 'element', tagName, properties: {}, children: []})\n    : mdastPhrasing(node)\n}\n\n/**\n * @template {Parents} ParentType\n *   Parent type.\n * @param {ParentType} node\n *   Node to clone.\n * @returns {ParentType}\n *   Cloned node, without children.\n */\nfunction cloneWithoutChildren(node) {\n  return structuredClone({...node, children: []})\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Image, Link, PhrasingContent, RootContent as MdastRootContent, Root} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\nimport {EXIT, visit} from 'unist-util-visit'\nimport {wrapNeeded} from '../util/wrap.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Array<MdastRootContent> | Link}\n *   mdast node.\n */\nexport function media(state, node) {\n  const properties = node.properties || {}\n  const poster = node.tagName === 'video' ? String(properties.poster || '') : ''\n  let source = String(properties.src || '')\n  let index = -1\n  let linkInFallbackContent = false\n  let nodes = state.all(node)\n\n  /** @type {Root} */\n  const fragment = {type: 'root', children: nodes}\n\n  visit(fragment, function (node) {\n    if (node.type === 'link') {\n      linkInFallbackContent = true\n      return EXIT\n    }\n  })\n\n  // If the content links to something, or if it’s not phrasing…\n  if (linkInFallbackContent || wrapNeeded(nodes)) {\n    return nodes\n  }\n\n  // Find the source.\n  while (!source && ++index < node.children.length) {\n    const child = node.children[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'source' &&\n      child.properties\n    ) {\n      source = String(child.properties.src || '')\n    }\n  }\n\n  // If there’s a poster defined on the video, create an image.\n  if (poster) {\n    /** @type {Image} */\n    const image = {\n      type: 'image',\n      title: null,\n      url: state.resolve(poster),\n      alt: toString(nodes)\n    }\n    state.patch(node, image)\n    nodes = [image]\n  }\n\n  // Allow potentially “invalid” nodes, they might be unknown.\n  // We also support straddling later.\n  const children = /** @type {Array<PhrasingContent>} */ (nodes)\n\n  // Link to the media resource.\n  /** @type {Link} */\n  const result = {\n    type: 'link',\n    title: properties.title ? String(properties.title) : null,\n    url: state.resolve(source),\n    children\n  }\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Paragraph, PhrasingContent} from 'mdast'\n */\n\nimport {dropSurroundingBreaks} from '../util/drop-surrounding-breaks.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Paragraph | undefined}\n *   mdast node.\n */\nexport function p(state, node) {\n  const children = dropSurroundingBreaks(\n    // Allow potentially “invalid” nodes, they might be unknown.\n    // We also support straddling later.\n    /** @type {Array<PhrasingContent>} */ (state.all(node))\n  )\n\n  if (children.length > 0) {\n    /** @type {Paragraph} */\n    const result = {type: 'paragraph', children}\n    state.patch(node, result)\n    return result\n  }\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {RootContent as MdastRootContent} from 'mdast'\n */\n\nconst defaultQuotes = ['\"']\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Array<MdastRootContent>}\n *   mdast nodes.\n */\nexport function q(state, node) {\n  const quotes = state.options.quotes || defaultQuotes\n\n  state.qNesting++\n  const contents = state.all(node)\n  state.qNesting--\n\n  const quote = quotes[state.qNesting % quotes.length]\n  const head = contents[0]\n  const tail = contents[contents.length - 1]\n  const open = quote.charAt(0)\n  const close = quote.length > 1 ? quote.charAt(1) : quote\n\n  if (head && head.type === 'text') {\n    head.value = open + head.value\n  } else {\n    contents.unshift({type: 'text', value: open})\n  }\n\n  if (tail && tail.type === 'text') {\n    tail.value += close\n  } else {\n    contents.push({type: 'text', value: close})\n  }\n\n  return contents\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {PhrasingContent, Strong} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Strong}\n *   mdast node.\n */\nexport function strong(state, node) {\n  // Allow potentially “invalid” nodes, they might be unknown.\n  // We also support straddling later.\n  const children = /** @type {Array<PhrasingContent>} */ (state.all(node))\n\n  /** @type {Strong} */\n  const result = {type: 'strong', children}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {PhrasingContent, TableCell} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {TableCell}\n *   mdast node.\n */\nexport function tableCell(state, node) {\n  // Allow potentially “invalid” nodes, they might be unknown.\n  // We also support straddling later.\n  const children = /** @type {Array<PhrasingContent>} */ (state.all(node))\n\n  /** @type {TableCell} */\n  const result = {type: 'tableCell', children}\n  state.patch(node, result)\n\n  if (node.properties) {\n    const rowSpan = node.properties.rowSpan\n    const colSpan = node.properties.colSpan\n\n    if (rowSpan || colSpan) {\n      const data = /** @type {Record<string, unknown>} */ (\n        result.data || (result.data = {})\n      )\n      if (rowSpan) data.hastUtilToMdastTemporaryRowSpan = rowSpan\n      if (colSpan) data.hastUtilToMdastTemporaryColSpan = colSpan\n    }\n  }\n\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {RowContent, TableRow} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {TableRow}\n *   mdast node.\n */\nexport function tableRow(state, node) {\n  const children = state.toSpecificContent(state.all(node), create)\n\n  /** @type {TableRow} */\n  const result = {type: 'tableRow', children}\n  state.patch(node, result)\n  return result\n}\n\n/**\n * @returns {RowContent}\n */\nfunction create() {\n  return {type: 'tableCell', children: []}\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {AlignType, RowContent, TableContent, Table, Text} from 'mdast'\n */\n\n/**\n * @typedef Info\n *   Inferred info on a table.\n * @property {Array<AlignType>} align\n *   Alignment.\n * @property {boolean} headless\n *   Whether a `thead` is missing.\n */\n\nimport {toText} from 'hast-util-to-text'\nimport {SKIP, visit} from 'unist-util-visit'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Table | Text}\n *   mdast node.\n */\n// eslint-disable-next-line complexity\nexport function table(state, node) {\n  // Ignore nested tables.\n  if (state.inTable) {\n    /** @type {Text} */\n    const result = {type: 'text', value: toText(node)}\n    state.patch(node, result)\n    return result\n  }\n\n  state.inTable = true\n\n  const {align, headless} = inspect(node)\n  const rows = state.toSpecificContent(state.all(node), createRow)\n\n  // Add an empty header row.\n  if (headless) {\n    rows.unshift(createRow())\n  }\n\n  let rowIndex = -1\n\n  while (++rowIndex < rows.length) {\n    const row = rows[rowIndex]\n    const cells = state.toSpecificContent(row.children, createCell)\n    row.children = cells\n  }\n\n  let columns = 1\n  rowIndex = -1\n\n  while (++rowIndex < rows.length) {\n    const cells = rows[rowIndex].children\n    let cellIndex = -1\n\n    while (++cellIndex < cells.length) {\n      const cell = cells[cellIndex]\n\n      if (cell.data) {\n        const data = /** @type {Record<string, unknown>} */ (cell.data)\n        const colSpan =\n          Number.parseInt(String(data.hastUtilToMdastTemporaryColSpan), 10) || 1\n        const rowSpan =\n          Number.parseInt(String(data.hastUtilToMdastTemporaryRowSpan), 10) || 1\n\n        if (colSpan > 1 || rowSpan > 1) {\n          let otherRowIndex = rowIndex - 1\n\n          while (++otherRowIndex < rowIndex + rowSpan) {\n            let colIndex = cellIndex - 1\n\n            while (++colIndex < cellIndex + colSpan) {\n              if (!rows[otherRowIndex]) {\n                // Don’t add rows that don’t exist.\n                // Browsers don’t render them either.\n                break\n              }\n\n              /** @type {Array<RowContent>} */\n              const newCells = []\n\n              if (otherRowIndex !== rowIndex || colIndex !== cellIndex) {\n                newCells.push({type: 'tableCell', children: []})\n              }\n\n              rows[otherRowIndex].children.splice(colIndex, 0, ...newCells)\n            }\n          }\n        }\n\n        // Clean the data fields.\n        if ('hastUtilToMdastTemporaryColSpan' in cell.data)\n          delete cell.data.hastUtilToMdastTemporaryColSpan\n        if ('hastUtilToMdastTemporaryRowSpan' in cell.data)\n          delete cell.data.hastUtilToMdastTemporaryRowSpan\n        if (Object.keys(cell.data).length === 0) delete cell.data\n      }\n    }\n\n    if (cells.length > columns) columns = cells.length\n  }\n\n  // Add extra empty cells.\n  rowIndex = -1\n\n  while (++rowIndex < rows.length) {\n    const cells = rows[rowIndex].children\n    let cellIndex = cells.length - 1\n    while (++cellIndex < columns) {\n      cells.push({type: 'tableCell', children: []})\n    }\n  }\n\n  let alignIndex = align.length - 1\n  while (++alignIndex < columns) {\n    align.push(null)\n  }\n\n  state.inTable = false\n\n  /** @type {Table} */\n  const result = {type: 'table', align, children: rows}\n  state.patch(node, result)\n  return result\n}\n\n/**\n * Infer whether the HTML table has a head and how it aligns.\n *\n * @param {Readonly<Element>} node\n *   Table element to check.\n * @returns {Info}\n *   Info.\n */\nfunction inspect(node) {\n  /** @type {Info} */\n  const info = {align: [null], headless: true}\n  let rowIndex = 0\n  let cellIndex = 0\n\n  visit(node, function (child) {\n    if (child.type === 'element') {\n      // Don’t enter nested tables.\n      if (child.tagName === 'table' && node !== child) {\n        return SKIP\n      }\n\n      if (\n        (child.tagName === 'th' || child.tagName === 'td') &&\n        child.properties\n      ) {\n        if (!info.align[cellIndex]) {\n          const value = String(child.properties.align || '') || null\n\n          if (\n            value === 'center' ||\n            value === 'left' ||\n            value === 'right' ||\n            value === null\n          ) {\n            info.align[cellIndex] = value\n          }\n        }\n\n        // If there is a `th` in the first row, assume there is a header row.\n        if (info.headless && rowIndex < 2 && child.tagName === 'th') {\n          info.headless = false\n        }\n\n        cellIndex++\n      }\n      // If there is a `thead`, assume there is a header row.\n      else if (child.tagName === 'thead') {\n        info.headless = false\n      } else if (child.tagName === 'tr') {\n        rowIndex++\n        cellIndex = 0\n      }\n    }\n  })\n\n  return info\n}\n\n/**\n * @returns {RowContent}\n */\nfunction createCell() {\n  return {type: 'tableCell', children: []}\n}\n\n/**\n * @returns {TableContent}\n */\nfunction createRow() {\n  return {type: 'tableRow', children: []}\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Parents} from 'hast'\n */\n\nimport {a} from './a.js'\nimport {base} from './base.js'\nimport {blockquote} from './blockquote.js'\nimport {br} from './br.js'\nimport {code} from './code.js'\nimport {comment} from './comment.js'\nimport {del} from './del.js'\nimport {dl} from './dl.js'\nimport {em} from './em.js'\nimport {heading} from './heading.js'\nimport {hr} from './hr.js'\nimport {iframe} from './iframe.js'\nimport {img} from './img.js'\nimport {inlineCode} from './inline-code.js'\nimport {input} from './input.js'\nimport {li} from './li.js'\nimport {list} from './list.js'\nimport {media} from './media.js'\nimport {p} from './p.js'\nimport {q} from './q.js'\nimport {root} from './root.js'\nimport {select} from './select.js'\nimport {strong} from './strong.js'\nimport {tableCell} from './table-cell.js'\nimport {tableRow} from './table-row.js'\nimport {table} from './table.js'\nimport {text} from './text.js'\nimport {textarea} from './textarea.js'\nimport {wbr} from './wbr.js'\n\n/**\n * Default handlers for nodes.\n *\n * Each key is a node type, each value is a `NodeHandler`.\n */\nexport const nodeHandlers = {\n  comment,\n  doctype: ignore,\n  root,\n  text\n}\n\n/**\n * Default handlers for elements.\n *\n * Each key is an element name, each value is a `Handler`.\n */\nexport const handlers = {\n  // Ignore:\n  applet: ignore,\n  area: ignore,\n  basefont: ignore,\n  bgsound: ignore,\n  caption: ignore,\n  col: ignore,\n  colgroup: ignore,\n  command: ignore,\n  content: ignore,\n  datalist: ignore,\n  dialog: ignore,\n  element: ignore,\n  embed: ignore,\n  frame: ignore,\n  frameset: ignore,\n  isindex: ignore,\n  keygen: ignore,\n  link: ignore,\n  math: ignore,\n  menu: ignore,\n  menuitem: ignore,\n  meta: ignore,\n  nextid: ignore,\n  noembed: ignore,\n  noframes: ignore,\n  optgroup: ignore,\n  option: ignore,\n  param: ignore,\n  script: ignore,\n  shadow: ignore,\n  source: ignore,\n  spacer: ignore,\n  style: ignore,\n  svg: ignore,\n  template: ignore,\n  title: ignore,\n  track: ignore,\n\n  // Use children:\n  abbr: all,\n  acronym: all,\n  bdi: all,\n  bdo: all,\n  big: all,\n  blink: all,\n  button: all,\n  canvas: all,\n  cite: all,\n  data: all,\n  details: all,\n  dfn: all,\n  font: all,\n  ins: all,\n  label: all,\n  map: all,\n  marquee: all,\n  meter: all,\n  nobr: all,\n  noscript: all,\n  object: all,\n  output: all,\n  progress: all,\n  rb: all,\n  rbc: all,\n  rp: all,\n  rt: all,\n  rtc: all,\n  ruby: all,\n  slot: all,\n  small: all,\n  span: all,\n  sup: all,\n  sub: all,\n  tbody: all,\n  tfoot: all,\n  thead: all,\n  time: all,\n\n  // Use children as flow.\n  address: flow,\n  article: flow,\n  aside: flow,\n  body: flow,\n  center: flow,\n  div: flow,\n  fieldset: flow,\n  figcaption: flow,\n  figure: flow,\n  form: flow,\n  footer: flow,\n  header: flow,\n  hgroup: flow,\n  html: flow,\n  legend: flow,\n  main: flow,\n  multicol: flow,\n  nav: flow,\n  picture: flow,\n  section: flow,\n\n  // Handle.\n  a,\n  audio: media,\n  b: strong,\n  base,\n  blockquote,\n  br,\n  code: inlineCode,\n  dir: list,\n  dl,\n  dt: li,\n  dd: li,\n  del,\n  em,\n  h1: heading,\n  h2: heading,\n  h3: heading,\n  h4: heading,\n  h5: heading,\n  h6: heading,\n  hr,\n  i: em,\n  iframe,\n  img,\n  image: img,\n  input,\n  kbd: inlineCode,\n  li,\n  listing: code,\n  mark: em,\n  ol: list,\n  p,\n  plaintext: code,\n  pre: code,\n  q,\n  s: del,\n  samp: inlineCode,\n  select,\n  strike: del,\n  strong,\n  summary: p,\n  table,\n  td: tableCell,\n  textarea,\n  th: tableCell,\n  tr: tableRow,\n  tt: inlineCode,\n  u: em,\n  ul: list,\n  var: inlineCode,\n  video: media,\n  wbr,\n  xmp: code\n}\n\n/**\n * @param {State} state\n *   State.\n * @param {Parents} node\n *   Parent to transform.\n */\nfunction all(state, node) {\n  return state.all(node)\n}\n\n/**\n * @param {State} state\n *   State.\n * @param {Parents} node\n *   Parent to transform.\n */\nfunction flow(state, node) {\n  return state.toFlow(state.all(node))\n}\n\n/**\n * @returns {undefined}\n */\nfunction ignore() {}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Comment} from 'hast'\n * @import {Html} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Comment>} node\n *   hast element to transform.\n * @returns {Html}\n *   mdast node.\n */\nexport function comment(state, node) {\n  /** @type {Html} */\n  const result = {\n    type: 'html',\n    value: '<!--' + node.value + '-->'\n  }\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n */\n\nimport {wrap, wrapNeeded} from '../util/wrap.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<HastRoot>} node\n *   hast root to transform.\n * @returns {MdastRoot}\n *   mdast node.\n */\nexport function root(state, node) {\n  let children = state.all(node)\n\n  if (state.options.document || wrapNeeded(children)) {\n    children = wrap(children)\n  }\n\n  /** @type {MdastRoot} */\n  const result = {type: 'root', children}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<HastText>} node\n *   hast element to transform.\n * @returns {MdastText}\n *   mdast node.\n */\nexport function text(state, node) {\n  /** @type {MdastText} */\n  const result = {type: 'text', value: node.value}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Link, PhrasingContent} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Link}\n *   mdast node.\n */\nexport function a(state, node) {\n  const properties = node.properties || {}\n  // Allow potentially “invalid” nodes, they might be unknown.\n  // We also support straddling later.\n  const children = /** @type {Array<PhrasingContent>} */ (state.all(node))\n\n  /** @type {Link} */\n  const result = {\n    type: 'link',\n    url: state.resolve(String(properties.href || '') || null),\n    title: properties.title ? String(properties.title) : null,\n    children\n  }\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {undefined}\n *   Nothing.\n */\nexport function base(state, node) {\n  if (!state.baseFound) {\n    state.frozenBaseUrl =\n      String((node.properties && node.properties.href) || '') || undefined\n    state.baseFound = true\n  }\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Blockquote}\n *   mdast node.\n */\nexport function blockquote(state, node) {\n  /** @type {Blockquote} */\n  const result = {type: 'blockquote', children: state.toFlow(state.all(node))}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Break} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Break}\n *   mdast node.\n */\nexport function br(state, node) {\n  /** @type {Break} */\n  const result = {type: 'break'}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {ThematicBreak}\n *   mdast node.\n */\nexport function hr(state, node) {\n  /** @type {ThematicBreak} */\n  const result = {type: 'thematicBreak'}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Link} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Link | undefined}\n *   mdast node.\n */\nexport function iframe(state, node) {\n  const properties = node.properties || {}\n  const source = String(properties.src || '')\n  const title = String(properties.title || '')\n\n  // Only create a link if there is a title.\n  // We can’t use the content of the frame because conforming HTML parsers treat\n  // it as text, whereas legacy parsers treat it as HTML, so it will likely\n  // contain tags that will show up in text.\n  if (source && title) {\n    /** @type {Link} */\n    const result = {\n      type: 'link',\n      title: null,\n      url: state.resolve(source),\n      children: [{type: 'text', value: title}]\n    }\n    state.patch(node, result)\n    return result\n  }\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Image, Link, Text} from 'mdast'\n * @import {Options} from '../util/find-selected-options.js'\n */\n\nimport {findSelectedOptions} from '../util/find-selected-options.js'\n\nconst defaultChecked = '[x]'\nconst defaultUnchecked = '[ ]'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Array<Link | Text> | Image | Text | undefined}\n *   mdast node.\n */\n// eslint-disable-next-line complexity\nexport function input(state, node) {\n  const properties = node.properties || {}\n  const value = String(properties.value || properties.placeholder || '')\n\n  if (\n    properties.disabled ||\n    properties.type === 'hidden' ||\n    properties.type === 'file'\n  ) {\n    return\n  }\n\n  if (properties.type === 'checkbox' || properties.type === 'radio') {\n    /** @type {Text} */\n    const result = {\n      type: 'text',\n      value: properties.checked\n        ? state.options.checked || defaultChecked\n        : state.options.unchecked || defaultUnchecked\n    }\n    state.patch(node, result)\n    return result\n  }\n\n  if (properties.type === 'image') {\n    const alt = properties.alt || value\n\n    if (alt) {\n      /** @type {Image} */\n      const result = {\n        type: 'image',\n        url: state.resolve(String(properties.src || '') || null),\n        title: String(properties.title || '') || null,\n        alt: String(alt)\n      }\n      state.patch(node, result)\n      return result\n    }\n\n    return\n  }\n\n  /** @type {Options} */\n  let values = []\n\n  if (value) {\n    values = [[value, undefined]]\n  } else if (\n    // `list` is not supported on these types:\n    properties.type !== 'button' &&\n    properties.type !== 'file' &&\n    properties.type !== 'password' &&\n    properties.type !== 'reset' &&\n    properties.type !== 'submit' &&\n    properties.list\n  ) {\n    const list = String(properties.list)\n    const datalist = state.elementById.get(list)\n\n    if (datalist && datalist.tagName === 'datalist') {\n      values = findSelectedOptions(datalist, properties)\n    }\n  }\n\n  if (values.length === 0) {\n    return\n  }\n\n  // Hide password value.\n  if (properties.type === 'password') {\n    // Passwords don’t support `list`.\n    values[0] = ['•'.repeat(values[0][0].length), undefined]\n  }\n\n  if (properties.type === 'email' || properties.type === 'url') {\n    /** @type {Array<Link | Text>} */\n    const results = []\n    let index = -1\n\n    while (++index < values.length) {\n      const value = state.resolve(values[index][0])\n      /** @type {Link} */\n      const result = {\n        type: 'link',\n        title: null,\n        url: properties.type === 'email' ? 'mailto:' + value : value,\n        children: [{type: 'text', value: values[index][1] || value}]\n      }\n\n      results.push(result)\n\n      if (index !== values.length - 1) {\n        results.push({type: 'text', value: ', '})\n      }\n    }\n\n    return results\n  }\n\n  /** @type {Array<string>} */\n  const texts = []\n  let index = -1\n\n  while (++index < values.length) {\n    texts.push(\n      values[index][1]\n        ? values[index][1] + ' (' + values[index][0] + ')'\n        : values[index][0]\n    )\n  }\n\n  /** @type {Text} */\n  const result = {type: 'text', value: texts.join(', ')}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Text} from 'mdast'\n */\n\nimport {findSelectedOptions} from '../util/find-selected-options.js'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Text | undefined}\n *   mdast node.\n */\nexport function select(state, node) {\n  const values = findSelectedOptions(node)\n  let index = -1\n  /** @type {Array<string>} */\n  const results = []\n\n  while (++index < values.length) {\n    const value = values[index]\n    results.push(value[1] ? value[1] + ' (' + value[0] + ')' : value[0])\n  }\n\n  if (results.length > 0) {\n    /** @type {Text} */\n    const result = {type: 'text', value: results.join(', ')}\n    state.patch(node, result)\n    return result\n  }\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Text} from 'mdast'\n */\n\nimport {toText} from 'hast-util-to-text'\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Text}\n *   mdast node.\n */\nexport function textarea(state, node) {\n  /** @type {Text} */\n  const result = {type: 'text', value: toText(node)}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {State} from 'hast-util-to-mdast'\n * @import {Element} from 'hast'\n * @import {Text} from 'mdast'\n */\n\n/**\n * @param {State} state\n *   State.\n * @param {Readonly<Element>} node\n *   hast element to transform.\n * @returns {Text}\n *   mdast node.\n */\nexport function wbr(state, node) {\n  /** @type {Text} */\n  const result = {type: 'text', value: '\\u200B'}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element, Nodes, Parents} from 'hast'\n * @import {\n *   BlockContent as MdastBlockContent,\n *   DefinitionContent as MdastDefinitionContent,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents,\n *   RootContent as MdastRootContent\n * } from 'mdast'\n */\n\n/**\n * @typedef {MdastBlockContent | MdastDefinitionContent} MdastFlowContent\n */\n\n/**\n * @callback All\n *   Transform the children of a hast parent to mdast.\n * @param {Parents} parent\n *   Parent.\n * @returns {Array<MdastRootContent>}\n *   mdast children.\n *\n * @callback Handle\n *   Handle a particular element.\n * @param {State} state\n *   Info passed around about the current state.\n * @param {Element} element\n *   Element to transform.\n * @param {Parents | undefined} parent\n *   Parent of `element`.\n * @returns {Array<MdastNodes> | MdastNodes | undefined | void}\n *   mdast node or nodes.\n *\n *   Note: `void` is included until TS nicely infers `undefined`.\n *\n * @callback NodeHandle\n *   Handle a particular node.\n * @param {State} state\n *   Info passed around about the current state.\n * @param {any} node\n *   Node to transform.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Array<MdastNodes> | MdastNodes | undefined | void}\n *   mdast node or nodes.\n *\n *   Note: `void` is included until TS nicely infers `undefined`.\n *\n * @callback One\n *   Transform a hast node to mdast.\n * @param {Nodes} node\n *   Expected hast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Array<MdastNodes> | MdastNodes | undefined}\n *   mdast result.\n *\n * @typedef Options\n *   Configuration.\n * @property {string | null | undefined} [checked='[x]']\n *   Value to use for a checked checkbox or radio input (default: `'[x]'`)\n * @property {boolean | null | undefined} [document]\n *   Whether the given tree represents a complete document (optional).\n *\n *   Applies when the `tree` is a `root` node.\n *   When the tree represents a complete document, then things are wrapped in\n *   paragraphs when needed, and otherwise they’re left as-is.\n *   The default checks for whether there’s mixed content: some phrasing nodes\n *   *and* some non-phrasing nodes.\n * @property {Record<string, Handle | null | undefined> | null | undefined} [handlers]\n *   Object mapping tag names to functions handling the corresponding elements\n *   (optional).\n *\n *   Merged into the defaults.\n * @property {boolean | null | undefined} [newlines=false]\n *   Keep line endings when collapsing whitespace (default: `false`).\n *\n *   The default collapses to a single space.\n * @property {Record<string, NodeHandle | null | undefined> | null | undefined} [nodeHandlers]\n *   Object mapping node types to functions handling the corresponding nodes\n *   (optional).\n *\n *   Merged into the defaults.\n * @property {Array<string> | null | undefined} [quotes=['\"']]\n *   List of quotes to use (default: `['\"']`).\n *\n *   Each value can be one or two characters.\n *   When two, the first character determines the opening quote and the second\n *   the closing quote at that level.\n *   When one, both the opening and closing quote are that character.\n *\n *   The order in which the preferred quotes appear determines which quotes to\n *   use at which level of nesting.\n *   So, to prefer `‘’` at the first level of nesting, and `“”` at the second,\n *   pass `['‘’', '“”']`.\n *   If `<q>`s are nested deeper than the given amount of quotes, the markers\n *   wrap around: a third level of nesting when using `['«»', '‹›']` should\n *   have double guillemets, a fourth single, a fifth double again, etc.\n * @property {string | null | undefined} [unchecked='[ ]']\n *   Value to use for an unchecked checkbox or radio input (default: `'[ ]'`).\n *\n * @callback Patch\n *   Copy a node’s positional info.\n * @param {Nodes} from\n *   hast node to copy from.\n * @param {MdastNodes} to\n *   mdast node to copy into.\n * @returns {undefined}\n *   Nothing.\n *\n * @callback Resolve\n *   Resolve a URL relative to a base.\n * @param {string | null | undefined} url\n *   Possible URL value.\n * @returns {string}\n *   URL, resolved to a `base` element, if any.\n *\n * @typedef State\n *   Info passed around about the current state.\n * @property {All} all\n *   Transform the children of a hast parent to mdast.\n * @property {boolean} baseFound\n *   Whether a `<base>` element was seen.\n * @property {Map<string, Element>} elementById\n *   Elements by their `id`.\n * @property {string | undefined} frozenBaseUrl\n *   `href` of `<base>`, if any.\n * @property {Record<string, Handle>} handlers\n *   Applied element handlers.\n * @property {boolean} inTable\n *   Whether we’re in a table.\n * @property {Record<string, NodeHandle>} nodeHandlers\n *   Applied node handlers.\n * @property {One} one\n *   Transform a hast node to mdast.\n * @property {Options} options\n *   User configuration.\n * @property {Patch} patch\n *   Copy a node’s positional info.\n * @property {number} qNesting\n *   Non-negative finite integer representing how deep we’re in `<q>`s.\n * @property {Resolve} resolve\n *   Resolve a URL relative to a base.\n * @property {ToFlow} toFlow\n *   Transform a list of mdast nodes to flow.\n * @property {<ChildType extends MdastNodes, ParentType extends MdastParents & {'children': Array<ChildType>}>(nodes: Array<MdastRootContent>, build: (() => ParentType)) => Array<ParentType>} toSpecificContent\n *   Turn arbitrary content into a list of a particular node type.\n *\n *   This is useful for example for lists, which must have list items as\n *   content.\n *   in this example, when non-items are found, they will be queued, and\n *   inserted into an adjacent item.\n *   When no actual items exist, one will be made with `build`.\n *\n * @callback ToFlow\n *   Transform a list of mdast nodes to flow.\n * @param {Array<MdastRootContent>} nodes\n *   mdast nodes.\n * @returns {Array<MdastFlowContent>}\n *   mdast flow children.\n */\n\nimport {position} from 'unist-util-position'\nimport {handlers, nodeHandlers} from './handlers/index.js'\nimport {wrap} from './util/wrap.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Create a state.\n *\n * @param {Readonly<Options>} options\n *   User configuration.\n * @returns {State}\n *   State.\n */\nexport function createState(options) {\n  return {\n    all,\n    baseFound: false,\n    elementById: new Map(),\n    frozenBaseUrl: undefined,\n    handlers: {...handlers, ...options.handlers},\n    inTable: false,\n    nodeHandlers: {...nodeHandlers, ...options.nodeHandlers},\n    one,\n    options,\n    patch,\n    qNesting: 0,\n    resolve,\n    toFlow,\n    toSpecificContent\n  }\n}\n\n/**\n * Transform the children of a hast parent to mdast.\n *\n * You might want to combine this with `toFlow` or `toSpecificContent`.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {Parents} parent\n *   Parent.\n * @returns {Array<MdastRootContent>}\n *   mdast children.\n */\nfunction all(parent) {\n  const children = parent.children || []\n  /** @type {Array<MdastRootContent>} */\n  const results = []\n  let index = -1\n\n  while (++index < children.length) {\n    const child = children[index]\n    // Content -> content.\n    const result =\n      /** @type {Array<MdastRootContent> | MdastRootContent | undefined} */ (\n        this.one(child, parent)\n      )\n\n    if (Array.isArray(result)) {\n      results.push(...result)\n    } else if (result) {\n      results.push(result)\n    }\n  }\n\n  return results\n}\n\n/**\n * Transform a hast node to mdast.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {Nodes} node\n *   hast node to transform.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Array<MdastNodes> | MdastNodes | undefined}\n *   mdast result.\n */\nfunction one(node, parent) {\n  if (node.type === 'element') {\n    if (node.properties && node.properties.dataMdast === 'ignore') {\n      return\n    }\n\n    if (own.call(this.handlers, node.tagName)) {\n      return this.handlers[node.tagName](this, node, parent) || undefined\n    }\n  } else if (own.call(this.nodeHandlers, node.type)) {\n    return this.nodeHandlers[node.type](this, node, parent) || undefined\n  }\n\n  // Unknown literal.\n  if ('value' in node && typeof node.value === 'string') {\n    /** @type {MdastRootContent} */\n    const result = {type: 'text', value: node.value}\n    this.patch(node, result)\n    return result\n  }\n\n  // Unknown parent.\n  if ('children' in node) {\n    return this.all(node)\n  }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {Nodes} origin\n *   hast node to copy from.\n * @param {MdastNodes} node\n *   mdast node to copy into.\n * @returns {undefined}\n *   Nothing.\n */\nfunction patch(origin, node) {\n  if (origin.position) node.position = position(origin)\n}\n\n/**\n * @this {State}\n *   Info passed around about the current state.\n * @param {string | null | undefined} url\n *   Possible URL value.\n * @returns {string}\n *   URL, resolved to a `base` element, if any.\n */\nfunction resolve(url) {\n  const base = this.frozenBaseUrl\n\n  if (url === null || url === undefined) {\n    return ''\n  }\n\n  if (base) {\n    return String(new URL(url, base))\n  }\n\n  return url\n}\n\n/**\n * Transform a list of mdast nodes to flow.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {Array<MdastRootContent>} nodes\n *   Parent.\n * @returns {Array<MdastFlowContent>}\n *   mdast flow children.\n */\nfunction toFlow(nodes) {\n  return wrap(nodes)\n}\n\n/**\n * Turn arbitrary content into a particular node type.\n *\n * This is useful for example for lists, which must have list items as content.\n * in this example, when non-items are found, they will be queued, and\n * inserted into an adjacent item.\n * When no actual items exist, one will be made with `build`.\n *\n * @template {MdastNodes} ChildType\n *   Node type of children.\n * @template {MdastParents & {'children': Array<ChildType>}} ParentType\n *   Node type of parent.\n * @param {Array<MdastRootContent>} nodes\n *   Nodes, which are either `ParentType`, or will be wrapped in one.\n * @param {() => ParentType} build\n *   Build a parent if needed (must have empty `children`).\n * @returns {Array<ParentType>}\n *   List of parents.\n */\nfunction toSpecificContent(nodes, build) {\n  const reference = build()\n  /** @type {Array<ParentType>} */\n  const results = []\n  /** @type {Array<ChildType>} */\n  let queue = []\n  let index = -1\n\n  while (++index < nodes.length) {\n    const node = nodes[index]\n\n    if (expectedParent(node)) {\n      if (queue.length > 0) {\n        node.children.unshift(...queue)\n        queue = []\n      }\n\n      results.push(node)\n    } else {\n      // Assume `node` can be a child of `ParentType`.\n      // If we start checking nodes, we’d run into problems with unknown nodes,\n      // which we do want to support.\n      const child = /** @type {ChildType} */ (node)\n      queue.push(child)\n    }\n  }\n\n  if (queue.length > 0) {\n    let node = results[results.length - 1]\n\n    if (!node) {\n      node = build()\n      results.push(node)\n    }\n\n    node.children.push(...queue)\n    queue = []\n  }\n\n  return results\n\n  /**\n   * @param {MdastNodes} node\n   * @returns {node is ParentType}\n   */\n  function expectedParent(node) {\n    return node.type === reference.type\n  }\n}\n","/**\n * @import {Options} from 'hast-util-to-mdast'\n * @import {Nodes} from 'hast'\n * @import {Nodes as MdastNodes, RootContent as MdastRootContent} from 'mdast'\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport rehypeMinifyWhitespace from 'rehype-minify-whitespace'\nimport {visit} from 'unist-util-visit'\nimport {createState} from './state.js'\n\n/** @type {Readonly<Options>} */\nconst emptyOptions = {}\n\n/**\n * Transform hast to mdast.\n *\n * @param {Readonly<Nodes>} tree\n *   hast tree to transform.\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {MdastNodes}\n *   mdast tree.\n */\nexport function toMdast(tree, options) {\n  // We have to clone, cause we’ll use `rehype-minify-whitespace` on the tree,\n  // which modifies.\n  const cleanTree = structuredClone(tree)\n  const settings = options || emptyOptions\n  const transformWhitespace = rehypeMinifyWhitespace({\n    newlines: settings.newlines === true\n  })\n  const state = createState(settings)\n  /** @type {MdastNodes} */\n  let mdast\n\n  // @ts-expect-error: fine to pass an arbitrary node.\n  transformWhitespace(cleanTree)\n\n  visit(cleanTree, function (node) {\n    if (node && node.type === 'element' && node.properties) {\n      const id = String(node.properties.id || '') || undefined\n\n      if (id && !state.elementById.has(id)) {\n        state.elementById.set(id, node)\n      }\n    }\n  })\n\n  const result = state.one(cleanTree, undefined)\n\n  if (!result) {\n    mdast = {type: 'root', children: []}\n  } else if (Array.isArray(result)) {\n    // Assume content.\n    const children = /** @type {Array<MdastRootContent>} */ (result)\n    mdast = {type: 'root', children}\n  } else {\n    mdast = result\n  }\n\n  // Collapse text nodes, and fix whitespace.\n  //\n  // Most of this is taken care of by `rehype-minify-whitespace`, but\n  // we’re generating some whitespace too, and some nodes are in the end\n  // ignored.\n  // So clean up.\n  visit(mdast, function (node, index, parent) {\n    if (node.type === 'text' && index !== undefined && parent) {\n      const previous = parent.children[index - 1]\n\n      if (previous && previous.type === node.type) {\n        previous.value += node.value\n        parent.children.splice(index, 1)\n\n        if (previous.position && node.position) {\n          previous.position.end = node.position.end\n        }\n\n        // Iterate over the previous node again, to handle its total value.\n        return index - 1\n      }\n\n      node.value = node.value.replace(/[\\t ]*(\\r?\\n|\\r)[\\t ]*/, '$1')\n\n      // We don’t care about other phrasing nodes in between (e.g., `[ asd ]()`),\n      // as there the whitespace matters.\n      if (\n        parent &&\n        (parent.type === 'heading' ||\n          parent.type === 'paragraph' ||\n          parent.type === 'root')\n      ) {\n        if (!index) {\n          node.value = node.value.replace(/^[\\t ]+/, '')\n        }\n\n        if (index === parent.children.length - 1) {\n          node.value = node.value.replace(/[\\t ]+$/, '')\n        }\n      }\n\n      if (!node.value) {\n        parent.children.splice(index, 1)\n        return index\n      }\n    }\n  })\n\n  return mdast\n}\n","/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Options} from 'hast-util-to-mdast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @callback TransformBridge\n *   Bridge-mode.\n *\n *   Runs the destination with the new mdast tree.\n *   Discards result.\n * @param {HastRoot} tree\n *   Tree.\n * @param {VFile} file\n *   File.\n * @returns {Promise<undefined>}\n *   Nothing.\n *\n * @callback TransformMutate\n *  Mutate-mode.\n *\n *  Further transformers run on the mdast tree.\n * @param {HastRoot} tree\n *   Tree.\n * @param {VFile} file\n *   File.\n * @returns {MdastRoot}\n *   Tree (mdast).\n */\n\nimport {toMdast} from 'hast-util-to-mdast'\n\n/** @satisfies {Options} */\nconst defaults = {document: true}\n\n/**\n * Turn HTML into markdown.\n *\n * ###### Notes\n *\n * *   if a processor is given, runs the (remark) plugins used on it with an\n *     mdast tree, then discards the result (*bridge mode*)\n * *   otherwise, returns an mdast tree, the plugins used after `rehypeRemark`\n *     are remark plugins (*mutate mode*)\n *\n * > 👉 **Note**: It’s highly unlikely that you want to pass a `processor`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Options | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Options | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Options | Processor | null | undefined} [destination]\n * @param {Options | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Options | Processor | null | undefined} [destination]\n *   Processor or configuration (optional).\n * @param {Options | null | undefined} [options]\n *   When a processor was given, configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n *   Transform.\n */\nexport default function rehypeRemark(destination, options) {\n  if (destination && 'run' in destination) {\n    /**\n     * @type {TransformBridge}\n     */\n    return async function (tree, file) {\n      const mdastTree = toMdast(tree, {...defaults, ...options})\n      await destination.run(mdastTree, file)\n    }\n  }\n\n  /**\n   * @type {TransformMutate}\n   */\n  return function (tree) {\n    return /** @type {MdastRoot} */ (\n      toMdast(tree, {...defaults, ...destination})\n    )\n  }\n}\n","/**\n * @import {Options, State} from './types.js'\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {State} base\n * @param {Options} extension\n * @returns {State}\n */\nexport function configure(base, extension) {\n  let index = -1\n  /** @type {keyof Options} */\n  let key\n\n  // First do subextensions.\n  if (extension.extensions) {\n    while (++index < extension.extensions.length) {\n      configure(base, extension.extensions[index])\n    }\n  }\n\n  for (key in extension) {\n    if (own.call(extension, key)) {\n      switch (key) {\n        case 'extensions': {\n          // Empty.\n          break\n        }\n\n        /* c8 ignore next 4 */\n        case 'unsafe': {\n          list(base[key], extension[key])\n          break\n        }\n\n        case 'join': {\n          list(base[key], extension[key])\n          break\n        }\n\n        case 'handlers': {\n          map(base[key], extension[key])\n          break\n        }\n\n        default: {\n          // @ts-expect-error: matches.\n          base.options[key] = extension[key]\n        }\n      }\n    }\n  }\n\n  return base\n}\n\n/**\n * @template T\n * @param {Array<T>} left\n * @param {Array<T> | null | undefined} right\n */\nfunction list(left, right) {\n  if (right) {\n    left.push(...right)\n  }\n}\n\n/**\n * @template T\n * @param {Record<string, T>} left\n * @param {Record<string, T> | null | undefined} right\n */\nfunction map(left, right) {\n  if (right) {\n    Object.assign(left, right)\n  }\n}\n","/**\n * @import {Join} from 'mdast-util-to-markdown'\n */\n\nimport {formatCodeAsIndented} from './util/format-code-as-indented.js'\nimport {formatHeadingAsSetext} from './util/format-heading-as-setext.js'\n\n/** @type {Array<Join>} */\nexport const join = [joinDefaults]\n\n/** @type {Join} */\nfunction joinDefaults(left, right, parent, state) {\n  // Indented code after list or another indented code.\n  if (\n    right.type === 'code' &&\n    formatCodeAsIndented(right, state) &&\n    (left.type === 'list' ||\n      (left.type === right.type && formatCodeAsIndented(left, state)))\n  ) {\n    return false\n  }\n\n  // Join children of a list or an item.\n  // In which case, `parent` has a `spread` field.\n  if ('spread' in parent && typeof parent.spread === 'boolean') {\n    if (\n      left.type === 'paragraph' &&\n      // Two paragraphs.\n      (left.type === right.type ||\n        right.type === 'definition' ||\n        // Paragraph followed by a setext heading.\n        (right.type === 'heading' && formatHeadingAsSetext(right, state)))\n    ) {\n      return\n    }\n\n    return parent.spread ? 1 : 0\n  }\n}\n","/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * List of constructs that occur in phrasing (paragraphs, headings), but cannot\n * contain things like attention (emphasis, strong), images, or links.\n * So they sort of cancel each other out.\n * Note: could use a better name.\n *\n * @type {Array<ConstructName>}\n */\nconst fullPhrasingSpans = [\n  'autolink',\n  'destinationLiteral',\n  'destinationRaw',\n  'reference',\n  'titleQuote',\n  'titleApostrophe'\n]\n\n/** @type {Array<Unsafe>} */\nexport const unsafe = [\n  {character: '\\t', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {character: '\\t', before: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {\n    character: '\\t',\n    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']\n  },\n  {\n    character: '\\r',\n    inConstruct: [\n      'codeFencedLangGraveAccent',\n      'codeFencedLangTilde',\n      'codeFencedMetaGraveAccent',\n      'codeFencedMetaTilde',\n      'destinationLiteral',\n      'headingAtx'\n    ]\n  },\n  {\n    character: '\\n',\n    inConstruct: [\n      'codeFencedLangGraveAccent',\n      'codeFencedLangTilde',\n      'codeFencedMetaGraveAccent',\n      'codeFencedMetaTilde',\n      'destinationLiteral',\n      'headingAtx'\n    ]\n  },\n  {character: ' ', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {character: ' ', before: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  {\n    character: ' ',\n    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']\n  },\n  // An exclamation mark can start an image, if it is followed by a link or\n  // a link reference.\n  {\n    character: '!',\n    after: '\\\\[',\n    inConstruct: 'phrasing',\n    notInConstruct: fullPhrasingSpans\n  },\n  // A quote can break out of a title.\n  {character: '\"', inConstruct: 'titleQuote'},\n  // A number sign could start an ATX heading if it starts a line.\n  {atBreak: true, character: '#'},\n  {character: '#', inConstruct: 'headingAtx', after: '(?:[\\r\\n]|$)'},\n  // Dollar sign and percentage are not used in markdown.\n  // An ampersand could start a character reference.\n  {character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'},\n  // An apostrophe can break out of a title.\n  {character: \"'\", inConstruct: 'titleApostrophe'},\n  // A left paren could break out of a destination raw.\n  {character: '(', inConstruct: 'destinationRaw'},\n  // A left paren followed by `]` could make something into a link or image.\n  {\n    before: '\\\\]',\n    character: '(',\n    inConstruct: 'phrasing',\n    notInConstruct: fullPhrasingSpans\n  },\n  // A right paren could start a list item or break out of a destination\n  // raw.\n  {atBreak: true, before: '\\\\d+', character: ')'},\n  {character: ')', inConstruct: 'destinationRaw'},\n  // An asterisk can start thematic breaks, list items, emphasis, strong.\n  {atBreak: true, character: '*', after: '(?:[ \\t\\r\\n*])'},\n  {character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  // A plus sign could start a list item.\n  {atBreak: true, character: '+', after: '(?:[ \\t\\r\\n])'},\n  // A dash can start thematic breaks, list items, and setext heading\n  // underlines.\n  {atBreak: true, character: '-', after: '(?:[ \\t\\r\\n-])'},\n  // A dot could start a list item.\n  {atBreak: true, before: '\\\\d+', character: '.', after: '(?:[ \\t\\r\\n]|$)'},\n  // Slash, colon, and semicolon are not used in markdown for constructs.\n  // A less than can start html (flow or text) or an autolink.\n  // HTML could start with an exclamation mark (declaration, cdata, comment),\n  // slash (closing tag), question mark (instruction), or a letter (tag).\n  // An autolink also starts with a letter.\n  // Finally, it could break out of a destination literal.\n  {atBreak: true, character: '<', after: '[!/?A-Za-z]'},\n  {\n    character: '<',\n    after: '[!/?A-Za-z]',\n    inConstruct: 'phrasing',\n    notInConstruct: fullPhrasingSpans\n  },\n  {character: '<', inConstruct: 'destinationLiteral'},\n  // An equals to can start setext heading underlines.\n  {atBreak: true, character: '='},\n  // A greater than can start block quotes and it can break out of a\n  // destination literal.\n  {atBreak: true, character: '>'},\n  {character: '>', inConstruct: 'destinationLiteral'},\n  // Question mark and at sign are not used in markdown for constructs.\n  // A left bracket can start definitions, references, labels,\n  {atBreak: true, character: '['},\n  {character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  {character: '[', inConstruct: ['label', 'reference']},\n  // A backslash can start an escape (when followed by punctuation) or a\n  // hard break (when followed by an eol).\n  // Note: typical escapes are handled in `safe`!\n  {character: '\\\\', after: '[\\\\r\\\\n]', inConstruct: 'phrasing'},\n  // A right bracket can exit labels.\n  {character: ']', inConstruct: ['label', 'reference']},\n  // Caret is not used in markdown for constructs.\n  // An underscore can start emphasis, strong, or a thematic break.\n  {atBreak: true, character: '_'},\n  {character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  // A grave accent can start code (fenced or text), or it can break out of\n  // a grave accent code fence.\n  {atBreak: true, character: '`'},\n  {\n    character: '`',\n    inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent']\n  },\n  {character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},\n  // Left brace, vertical bar, right brace are not used in markdown for\n  // constructs.\n  // A tilde can start code (fenced).\n  {atBreak: true, character: '~'}\n]\n","/**\n * @import {AssociationId} from '../types.js'\n */\n\nimport {decodeString} from 'micromark-util-decode-string'\n\n/**\n * Get an identifier from an association to match it to others.\n *\n * Associations are nodes that match to something else through an ID:\n * <https://github.com/syntax-tree/mdast#association>.\n *\n * The `label` of an association is the string value: character escapes and\n * references work, and casing is intact.\n * The `identifier` is used to match one association to another:\n * controversially, character escapes and references don’t work in this\n * matching: `&copy;` does not match `©`, and `\\+` does not match `+`.\n *\n * But casing is ignored (and whitespace) is trimmed and collapsed: ` A\\nb`\n * matches `a b`.\n * So, we do prefer the label when figuring out how we’re going to serialize:\n * it has whitespace, casing, and we can ignore most useless character\n * escapes and all character references.\n *\n * @type {AssociationId}\n */\nexport function association(node) {\n  if (node.label || !node.identifier) {\n    return node.label || ''\n  }\n\n  return decodeString(node.identifier)\n}\n","/**\n * @import {CompilePattern} from '../types.js'\n */\n\n/**\n * @type {CompilePattern}\n */\nexport function compilePattern(pattern) {\n  if (!pattern._compiled) {\n    const before =\n      (pattern.atBreak ? '[\\\\r\\\\n][\\\\t ]*' : '') +\n      (pattern.before ? '(?:' + pattern.before + ')' : '')\n\n    pattern._compiled = new RegExp(\n      (before ? '(' + before + ')' : '') +\n        (/[|\\\\{}()[\\]^$+*?.-]/.test(pattern.character) ? '\\\\' : '') +\n        pattern.character +\n        (pattern.after ? '(?:' + pattern.after + ')' : ''),\n      'g'\n    )\n  }\n\n  return pattern._compiled\n}\n","/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {FlowChildren, FlowParents, TrackFields} from '../types.js'\n */\n\n/**\n * @param {FlowParents} parent\n *   Parent of flow nodes.\n * @param {State} state\n *   Info passed around about the current state.\n * @param {TrackFields} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined by (blank) lines.\n */\nexport function containerFlow(parent, state, info) {\n  const indexStack = state.indexStack\n  const children = parent.children || []\n  const tracker = state.createTracker(info)\n  /** @type {Array<string>} */\n  const results = []\n  let index = -1\n\n  indexStack.push(-1)\n\n  while (++index < children.length) {\n    const child = children[index]\n\n    indexStack[indexStack.length - 1] = index\n\n    results.push(\n      tracker.move(\n        state.handle(child, parent, state, {\n          before: '\\n',\n          after: '\\n',\n          ...tracker.current()\n        })\n      )\n    )\n\n    if (child.type !== 'list') {\n      state.bulletLastUsed = undefined\n    }\n\n    if (index < children.length - 1) {\n      results.push(\n        tracker.move(between(child, children[index + 1], parent, state))\n      )\n    }\n  }\n\n  indexStack.pop()\n\n  return results.join('')\n}\n\n/**\n * @param {FlowChildren} left\n * @param {FlowChildren} right\n * @param {FlowParents} parent\n * @param {State} state\n * @returns {string}\n */\nfunction between(left, right, parent, state) {\n  let index = state.join.length\n\n  while (index--) {\n    const result = state.join[index](left, right, parent, state)\n\n    if (result === true || result === 1) {\n      break\n    }\n\n    if (typeof result === 'number') {\n      return '\\n'.repeat(1 + result)\n    }\n\n    if (result === false) {\n      return '\\n\\n<!---->\\n\\n'\n    }\n  }\n\n  return '\\n\\n'\n}\n","/**\n * @import {IndentLines} from '../types.js'\n */\n\nconst eol = /\\r?\\n|\\r/g\n\n/**\n * @type {IndentLines}\n */\nexport function indentLines(value, map) {\n  /** @type {Array<string>} */\n  const result = []\n  let start = 0\n  let line = 0\n  /** @type {RegExpExecArray | null} */\n  let match\n\n  while ((match = eol.exec(value))) {\n    one(value.slice(start, match.index))\n    result.push(match[0])\n    start = match.index + match[0].length\n    line++\n  }\n\n  one(value.slice(start))\n\n  return result.join('')\n\n  /**\n   * @param {string} value\n   */\n  function one(value) {\n    result.push(map(value, line, !value))\n  }\n}\n","/**\n * @import {SafeConfig, State} from 'mdast-util-to-markdown'\n */\n\nimport {encodeCharacterReference} from './encode-character-reference.js'\nimport {patternInScope} from './pattern-in-scope.js'\n\n/**\n * Make a string safe for embedding in markdown constructs.\n *\n * In markdown, almost all punctuation characters can, in certain cases,\n * result in something.\n * Whether they do is highly subjective to where they happen and in what\n * they happen.\n *\n * To solve this, `mdast-util-to-markdown` tracks:\n *\n * * Characters before and after something;\n * * What “constructs” we are in.\n *\n * This information is then used by this function to escape or encode\n * special characters.\n *\n * @param {State} state\n *   Info passed around about the current state.\n * @param {string | null | undefined} input\n *   Raw value to make safe.\n * @param {SafeConfig} config\n *   Configuration.\n * @returns {string}\n *   Serialized markdown safe for embedding.\n */\nexport function safe(state, input, config) {\n  const value = (config.before || '') + (input || '') + (config.after || '')\n  /** @type {Array<number>} */\n  const positions = []\n  /** @type {Array<string>} */\n  const result = []\n  /** @type {Record<number, {before: boolean, after: boolean}>} */\n  const infos = {}\n  let index = -1\n\n  while (++index < state.unsafe.length) {\n    const pattern = state.unsafe[index]\n\n    if (!patternInScope(state.stack, pattern)) {\n      continue\n    }\n\n    const expression = state.compilePattern(pattern)\n    /** @type {RegExpExecArray | null} */\n    let match\n\n    while ((match = expression.exec(value))) {\n      const before = 'before' in pattern || Boolean(pattern.atBreak)\n      const after = 'after' in pattern\n      const position = match.index + (before ? match[1].length : 0)\n\n      if (positions.includes(position)) {\n        if (infos[position].before && !before) {\n          infos[position].before = false\n        }\n\n        if (infos[position].after && !after) {\n          infos[position].after = false\n        }\n      } else {\n        positions.push(position)\n        infos[position] = {before, after}\n      }\n    }\n  }\n\n  positions.sort(numerical)\n\n  let start = config.before ? config.before.length : 0\n  const end = value.length - (config.after ? config.after.length : 0)\n  index = -1\n\n  while (++index < positions.length) {\n    const position = positions[index]\n\n    // Character before or after matched:\n    if (position < start || position >= end) {\n      continue\n    }\n\n    // If this character is supposed to be escaped because it has a condition on\n    // the next character, and the next character is definitly being escaped,\n    // then skip this escape.\n    if (\n      (position + 1 < end &&\n        positions[index + 1] === position + 1 &&\n        infos[position].after &&\n        !infos[position + 1].before &&\n        !infos[position + 1].after) ||\n      (positions[index - 1] === position - 1 &&\n        infos[position].before &&\n        !infos[position - 1].before &&\n        !infos[position - 1].after)\n    ) {\n      continue\n    }\n\n    if (start !== position) {\n      // If we have to use a character reference, an ampersand would be more\n      // correct, but as backslashes only care about punctuation, either will\n      // do the trick\n      result.push(escapeBackslashes(value.slice(start, position), '\\\\'))\n    }\n\n    start = position\n\n    if (\n      /[!-/:-@[-`{-~]/.test(value.charAt(position)) &&\n      (!config.encode || !config.encode.includes(value.charAt(position)))\n    ) {\n      // Character escape.\n      result.push('\\\\')\n    } else {\n      // Character reference.\n      result.push(encodeCharacterReference(value.charCodeAt(position)))\n      start++\n    }\n  }\n\n  result.push(escapeBackslashes(value.slice(start, end), config.after))\n\n  return result.join('')\n}\n\n/**\n * @param {number} a\n * @param {number} b\n * @returns {number}\n */\nfunction numerical(a, b) {\n  return a - b\n}\n\n/**\n * @param {string} value\n * @param {string} after\n * @returns {string}\n */\nfunction escapeBackslashes(value, after) {\n  const expression = /\\\\(?=[!-/:-@[-`{-~])/g\n  /** @type {Array<number>} */\n  const positions = []\n  /** @type {Array<string>} */\n  const results = []\n  const whole = value + after\n  let index = -1\n  let start = 0\n  /** @type {RegExpExecArray | null} */\n  let match\n\n  while ((match = expression.exec(whole))) {\n    positions.push(match.index)\n  }\n\n  while (++index < positions.length) {\n    if (start !== positions[index]) {\n      results.push(value.slice(start, positions[index]))\n    }\n\n    results.push('\\\\')\n    start = positions[index]\n  }\n\n  results.push(value.slice(start))\n\n  return results.join('')\n}\n","/**\n * @import {CreateTracker, TrackCurrent, TrackMove, TrackShift} from '../types.js'\n */\n\n/**\n * Track positional info in the output.\n *\n * @type {CreateTracker}\n */\nexport function track(config) {\n  // Defaults are used to prevent crashes when older utilities somehow activate\n  // this code.\n  /* c8 ignore next 5 */\n  const options = config || {}\n  const now = options.now || {}\n  let lineShift = options.lineShift || 0\n  let line = now.line || 1\n  let column = now.column || 1\n\n  return {move, current, shift}\n\n  /**\n   * Get the current tracked info.\n   *\n   * @type {TrackCurrent}\n   */\n  function current() {\n    return {now: {line, column}, lineShift}\n  }\n\n  /**\n   * Define an increased line shift (the typical indent for lines).\n   *\n   * @type {TrackShift}\n   */\n  function shift(value) {\n    lineShift += value\n  }\n\n  /**\n   * Move past some generated markdown.\n   *\n   * @type {TrackMove}\n   */\n  function move(input) {\n    // eslint-disable-next-line unicorn/prefer-default-parameters\n    const value = input || ''\n    const chunks = value.split(/\\r?\\n|\\r/g)\n    const tail = chunks[chunks.length - 1]\n    line += chunks.length - 1\n    column =\n      chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift\n    return value\n  }\n}\n","/**\n * @import {Info, Join, Options, SafeConfig, State} from 'mdast-util-to-markdown'\n * @import {Nodes} from 'mdast'\n * @import {Enter, FlowParents, PhrasingParents, TrackFields} from './types.js'\n */\n\nimport {zwitch} from 'zwitch'\nimport {configure} from './configure.js'\nimport {handle as handlers} from './handle/index.js'\nimport {join} from './join.js'\nimport {unsafe} from './unsafe.js'\nimport {association} from './util/association.js'\nimport {compilePattern} from './util/compile-pattern.js'\nimport {containerPhrasing} from './util/container-phrasing.js'\nimport {containerFlow} from './util/container-flow.js'\nimport {indentLines} from './util/indent-lines.js'\nimport {safe} from './util/safe.js'\nimport {track} from './util/track.js'\n\n/**\n * Turn an mdast syntax tree into markdown.\n *\n * @param {Nodes} tree\n *   Tree to serialize.\n * @param {Options | null | undefined} [options]\n *   Configuration (optional).\n * @returns {string}\n *   Serialized markdown representing `tree`.\n */\nexport function toMarkdown(tree, options) {\n  const settings = options || {}\n  /** @type {State} */\n  const state = {\n    associationId: association,\n    containerPhrasing: containerPhrasingBound,\n    containerFlow: containerFlowBound,\n    createTracker: track,\n    compilePattern,\n    enter,\n    // @ts-expect-error: GFM / frontmatter are typed in `mdast` but not defined\n    // here.\n    handlers: {...handlers},\n    // @ts-expect-error: add `handle` in a second.\n    handle: undefined,\n    indentLines,\n    indexStack: [],\n    join: [...join],\n    options: {},\n    safe: safeBound,\n    stack: [],\n    unsafe: [...unsafe]\n  }\n\n  configure(state, settings)\n\n  if (state.options.tightDefinitions) {\n    state.join.push(joinDefinition)\n  }\n\n  state.handle = zwitch('type', {\n    invalid,\n    unknown,\n    handlers: state.handlers\n  })\n\n  let result = state.handle(tree, undefined, state, {\n    before: '\\n',\n    after: '\\n',\n    now: {line: 1, column: 1},\n    lineShift: 0\n  })\n\n  if (\n    result &&\n    result.charCodeAt(result.length - 1) !== 10 &&\n    result.charCodeAt(result.length - 1) !== 13\n  ) {\n    result += '\\n'\n  }\n\n  return result\n\n  /** @type {Enter} */\n  function enter(name) {\n    state.stack.push(name)\n    return exit\n\n    /**\n     * @returns {undefined}\n     */\n    function exit() {\n      state.stack.pop()\n    }\n  }\n}\n\n/**\n * @param {unknown} value\n * @returns {never}\n */\nfunction invalid(value) {\n  throw new Error('Cannot handle value `' + value + '`, expected node')\n}\n\n/**\n * @param {unknown} value\n * @returns {never}\n */\nfunction unknown(value) {\n  // Always a node.\n  const node = /** @type {Nodes} */ (value)\n  throw new Error('Cannot handle unknown node `' + node.type + '`')\n}\n\n/** @type {Join} */\nfunction joinDefinition(left, right) {\n  // No blank line between adjacent definitions.\n  if (left.type === 'definition' && left.type === right.type) {\n    return 0\n  }\n}\n\n/**\n * Serialize the children of a parent that contains phrasing children.\n *\n * These children will be joined flush together.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {PhrasingParents} parent\n *   Parent of flow nodes.\n * @param {Info} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined together.\n */\nfunction containerPhrasingBound(parent, info) {\n  return containerPhrasing(parent, this, info)\n}\n\n/**\n * Serialize the children of a parent that contains flow children.\n *\n * These children will typically be joined by blank lines.\n * What they are joined by exactly is defined by `Join` functions.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {FlowParents} parent\n *   Parent of flow nodes.\n * @param {TrackFields} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined by (blank) lines.\n */\nfunction containerFlowBound(parent, info) {\n  return containerFlow(parent, this, info)\n}\n\n/**\n * Make a string safe for embedding in markdown constructs.\n *\n * In markdown, almost all punctuation characters can, in certain cases,\n * result in something.\n * Whether they do is highly subjective to where they happen and in what\n * they happen.\n *\n * To solve this, `mdast-util-to-markdown` tracks:\n *\n * * Characters before and after something;\n * * What “constructs” we are in.\n *\n * This information is then used by this function to escape or encode\n * special characters.\n *\n * @this {State}\n *   Info passed around about the current state.\n * @param {string | null | undefined} value\n *   Raw value to make safe.\n * @param {SafeConfig} config\n *   Configuration.\n * @returns {string}\n *   Serialized markdown safe for embedding.\n */\nfunction safeBound(value, config) {\n  return safe(this, value, config)\n}\n","/**\n * @import {Handle, Info, State} from 'mdast-util-to-markdown'\n * @import {PhrasingParents} from '../types.js'\n */\n\nimport {encodeCharacterReference} from './encode-character-reference.js'\n\n/**\n * Serialize the children of a parent that contains phrasing children.\n *\n * These children will be joined flush together.\n *\n * @param {PhrasingParents} parent\n *   Parent of flow nodes.\n * @param {State} state\n *   Info passed around about the current state.\n * @param {Info} info\n *   Info on where we are in the document we are generating.\n * @returns {string}\n *   Serialized children, joined together.\n */\nexport function containerPhrasing(parent, state, info) {\n  const indexStack = state.indexStack\n  const children = parent.children || []\n  /** @type {Array<string>} */\n  const results = []\n  let index = -1\n  let before = info.before\n  /** @type {string | undefined} */\n  let encodeAfter\n\n  indexStack.push(-1)\n  let tracker = state.createTracker(info)\n\n  while (++index < children.length) {\n    const child = children[index]\n    /** @type {string} */\n    let after\n\n    indexStack[indexStack.length - 1] = index\n\n    if (index + 1 < children.length) {\n      /** @type {Handle} */\n      // @ts-expect-error: hush, it’s actually a `zwitch`.\n      let handle = state.handle.handlers[children[index + 1].type]\n      /** @type {Handle} */\n      // @ts-expect-error: hush, it’s actually a `zwitch`.\n      if (handle && handle.peek) handle = handle.peek\n      after = handle\n        ? handle(children[index + 1], parent, state, {\n            before: '',\n            after: '',\n            ...tracker.current()\n          }).charAt(0)\n        : ''\n    } else {\n      after = info.after\n    }\n\n    // In some cases, html (text) can be found in phrasing right after an eol.\n    // When we’d serialize that, in most cases that would be seen as html\n    // (flow).\n    // As we can’t escape or so to prevent it from happening, we take a somewhat\n    // reasonable approach: replace that eol with a space.\n    // See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>\n    if (\n      results.length > 0 &&\n      (before === '\\r' || before === '\\n') &&\n      child.type === 'html'\n    ) {\n      results[results.length - 1] = results[results.length - 1].replace(\n        /(\\r?\\n|\\r)$/,\n        ' '\n      )\n      before = ' '\n\n      // To do: does this work to reset tracker?\n      tracker = state.createTracker(info)\n      tracker.move(results.join(''))\n    }\n\n    let value = state.handle(child, parent, state, {\n      ...tracker.current(),\n      after,\n      before\n    })\n\n    // If we had to encode the first character after the previous node and it’s\n    // still the same character,\n    // encode it.\n    if (encodeAfter && encodeAfter === value.slice(0, 1)) {\n      value =\n        encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1)\n    }\n\n    const encodingInfo = state.attentionEncodeSurroundingInfo\n    state.attentionEncodeSurroundingInfo = undefined\n    encodeAfter = undefined\n\n    // If we have to encode the first character before the current node and\n    // it’s still the same character,\n    // encode it.\n    if (encodingInfo) {\n      if (\n        results.length > 0 &&\n        encodingInfo.before &&\n        before === results[results.length - 1].slice(-1)\n      ) {\n        results[results.length - 1] =\n          results[results.length - 1].slice(0, -1) +\n          encodeCharacterReference(before.charCodeAt(0))\n      }\n\n      if (encodingInfo.after) encodeAfter = after\n    }\n\n    tracker.move(value)\n    results.push(value)\n    before = value.slice(-1)\n  }\n\n  indexStack.pop()\n\n  return results.join('')\n}\n","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownOptions\n * @typedef {import('unified').Compiler<Root, string>} Compiler\n * @typedef {import('unified').Processor<undefined, undefined, undefined, Root, string>} Processor\n */\n\n/**\n * @typedef {Omit<ToMarkdownOptions, 'extensions'>} Options\n */\n\nimport {toMarkdown} from 'mdast-util-to-markdown'\n\n/**\n * Add support for serializing to markdown.\n *\n * @param {Readonly<Options> | null | undefined} [options]\n *   Configuration (optional).\n * @returns {undefined}\n *   Nothing.\n */\nexport default function remarkStringify(options) {\n  /** @type {Processor} */\n  // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n  const self = this\n\n  self.compiler = compiler\n\n  /**\n   * @type {Compiler}\n   */\n  function compiler(tree) {\n    return toMarkdown(tree, {\n      ...self.data('settings'),\n      ...options,\n      // Note: this option is not in the readme.\n      // The goal is for it to be set by plugins on `data` instead of being\n      // passed by users.\n      extensions: self.data('toMarkdownExtensions') || []\n    })\n  }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module markdown-gfm/html2markdown/html2markdown\n */\nimport { unified } from 'unified';\nimport rehypeParse from 'rehype-dom-parse';\nimport rehypeRemark from 'rehype-remark';\nimport remarkBreaks from 'remark-breaks';\nimport remarkGfm from 'remark-gfm';\nimport remarkStringify from 'remark-stringify';\nimport { visit } from 'unist-util-visit';\nimport { h } from 'hastscript';\nimport { toHtml } from 'hast-util-to-html';\nexport class MarkdownGfmHtmlToMd {\n    _processor;\n    _keepRawTags = [];\n    constructor() {\n        this._buildProcessor();\n    }\n    keep(tagName) {\n        this._keepRawTags.push(tagName.toLowerCase());\n        this._buildProcessor();\n    }\n    parse(html) {\n        return this._processor\n            .processSync(html)\n            .toString()\n            .trim();\n    }\n    /**\n     * Returns handlers for raw HTML tags that should be kept in the Markdown output.\n     */\n    _getRawTagsHandlers() {\n        return this._keepRawTags.reduce((handlers, tagName) => {\n            handlers[tagName] = (state, node) => {\n                const tag = toHtml(h(node.tagName, node.properties), {\n                    allowDangerousHtml: true,\n                    closeSelfClosing: true\n                });\n                const endOfOpeningTagIndex = tag.indexOf('>');\n                const openingTag = tag.slice(0, endOfOpeningTagIndex + 1);\n                const closingTag = tag.slice(endOfOpeningTagIndex + 1);\n                return [\n                    { type: 'html', value: openingTag },\n                    ...state.all(node),\n                    { type: 'html', value: closingTag }\n                ];\n            };\n            return handlers;\n        }, {});\n    }\n    _buildProcessor() {\n        this._processor = unified()\n            // Parse HTML to an abstract syntax tree (AST).\n            .use(rehypeParse)\n            // Removes `<label>` element from TODO lists.\n            .use(removeLabelFromCheckboxes)\n            // Turns HTML syntax tree into Markdown syntax tree.\n            .use(rehypeRemark, {\n            // Keeps allowed HTML tags.\n            handlers: this._getRawTagsHandlers()\n        })\n            // Adds support for GitHub Flavored Markdown (GFM).\n            .use(remarkGfm, {\n            singleTilde: true\n        })\n            // Replaces line breaks with `<br>` tags.\n            .use(remarkBreaks)\n            // Serializes Markdown syntax tree to Markdown string.\n            .use(remarkStringify, {\n            resourceLink: true,\n            emphasis: '_',\n            rule: '-',\n            handlers: {\n                break: () => '\\n'\n            },\n            unsafe: [\n                { character: '<' }\n            ]\n        });\n    }\n}\n/**\n * Removes `<label>` element from TODO lists, so that `<input>` and `text` are direct children of `<li>`.\n */\nfunction removeLabelFromCheckboxes() {\n    return function (tree) {\n        visit(tree, 'element', (node, index, parent) => {\n            if (index !== null && node.tagName === 'label' && parent.type === 'element' && parent.tagName === 'li') {\n                parent.children.splice(index, 1, ...node.children);\n            }\n        });\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module markdown-gfm/gfmdataprocessor\n */\nimport { HtmlDataProcessor } from 'ckeditor5/src/engine.js';\nimport { MarkdownGfmMdToHtml } from './markdown2html/markdown2html.js';\nimport { MarkdownGfmHtmlToMd } from './html2markdown/html2markdown.js';\n/**\n * This data processor implementation uses GitHub Flavored Markdown as input/output data.\n *\n * See the {@glink features/markdown Markdown output} guide to learn more on how to enable it.\n */\nexport class MarkdownGfmDataProcessor {\n    /**\n     * HTML data processor used to process HTML produced by the Markdown-to-HTML converter and the other way.\n     */\n    _htmlDP;\n    /**\n     * Helper for converting Markdown to HTML.\n     */\n    _markdown2html;\n    /**\n     * Helper for converting HTML to Markdown.\n     */\n    _html2markdown;\n    /**\n     * Creates a new instance of the Markdown data processor class.\n     */\n    constructor(document) {\n        this._htmlDP = new HtmlDataProcessor(document);\n        this._markdown2html = new MarkdownGfmMdToHtml();\n        this._html2markdown = new MarkdownGfmHtmlToMd();\n    }\n    /**\n     * Keeps the specified element in the output as HTML. This is useful if the editor contains\n     * features producing HTML that is not a part of the Markdown standard.\n     *\n     * By default, all HTML tags are removed.\n     *\n     * @param element The element name to be kept.\n     */\n    keepHtml(element) {\n        this._html2markdown.keep(element);\n    }\n    /**\n     * Converts the provided Markdown string to a view tree.\n     *\n     * @param data A Markdown string.\n     * @returns The converted view element.\n     */\n    toView(data) {\n        const html = this._markdown2html.parse(data);\n        return this._htmlDP.toView(html);\n    }\n    /**\n     * Converts the provided {@link module:engine/view/documentfragment~ViewDocumentFragment} to data format &ndash; in this\n     * case to a Markdown string.\n     *\n     * @returns Markdown string.\n     */\n    toData(viewFragment) {\n        const html = this._htmlDP.toData(viewFragment);\n        return this._html2markdown.parse(html);\n    }\n    /**\n     * Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data\n     * and not processed during the conversion from Markdown to view elements.\n     *\n     * The raw data can be later accessed by a\n     * {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `\"$rawContent\"`.\n     *\n     * @param pattern The pattern matching all view elements whose content should\n     * be treated as raw data.\n     */\n    registerRawContentMatcher(pattern) {\n        this._htmlDP.registerRawContentMatcher(pattern);\n    }\n    /**\n     * This method does not have any effect on the data processor result. It exists for compatibility with the\n     * {@link module:engine/dataprocessor/dataprocessor~DataProcessor `DataProcessor` interface}.\n     */\n    useFillerType() { }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module page-break/pagebreakcommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { findOptimalInsertionRange } from 'ckeditor5/src/widget.js';\n/**\n * The page break command.\n *\n * The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.\n *\n * To insert a page break at the current selection, execute the command:\n *\n *\t\teditor.execute( 'pageBreak' );\n */\nexport class PageBreakCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selection = model.document.selection;\n        this.isEnabled = isPageBreakAllowedInParent(selection, schema, model);\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     */\n    execute() {\n        const model = this.editor.model;\n        model.change(writer => {\n            const pageBreakElement = writer.createElement('pageBreak');\n            model.insertObject(pageBreakElement, null, null, {\n                setSelection: 'after'\n            });\n        });\n    }\n}\n/**\n * Checks if a page break is allowed by the schema in the optimal insertion parent.\n */\nfunction isPageBreakAllowedInParent(selection, schema, model) {\n    const parent = getInsertPageBreakParent(selection, model);\n    return schema.checkChild(parent, 'pageBreak');\n}\n/**\n * Returns a node that will be used to insert a page break with `model.insertContent` to check if the page break can be placed there.\n */\nfunction getInsertPageBreakParent(selection, model) {\n    const insertionRange = findOptimalInsertionRange(selection, model);\n    const parent = insertionRange.start.parent;\n    if (parent.isEmpty && !parent.is('element', '$root')) {\n        return parent.parent;\n    }\n    return parent;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module page-break/pagebreakediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { toWidget } from 'ckeditor5/src/widget.js';\nimport { PageBreakCommand } from './pagebreakcommand.js';\nimport '../theme/pagebreak.css';\n/**\n * The page break editing feature.\n */\nexport class PageBreakEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'PageBreakEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'PB';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const t = editor.t;\n        const conversion = editor.conversion;\n        schema.register('pageBreak', {\n            inheritAllFrom: '$blockObject'\n        });\n        conversion.for('dataDowncast').elementToStructure({\n            model: 'pageBreak',\n            view: (modelElement, { writer }) => {\n                const divElement = writer.createContainerElement('div', {\n                    class: 'page-break',\n                    // If user has no `.ck-content` styles, it should always break a page during print.\n                    style: 'page-break-after: always'\n                }, \n                // For a rationale of using span inside a div see:\n                // https://github.com/ckeditor/ckeditor5-page-break/pull/1#discussion_r328934062.\n                writer.createContainerElement('span', {\n                    style: 'display: none'\n                }));\n                return divElement;\n            }\n        });\n        conversion.for('editingDowncast').elementToStructure({\n            model: 'pageBreak',\n            view: (modelElement, { writer }) => {\n                const label = t('Page break');\n                const viewWrapper = writer.createContainerElement('div');\n                const viewLabelElement = writer.createRawElement('span', { class: 'page-break__label' }, function (domElement) {\n                    domElement.innerText = t('Page break');\n                });\n                writer.addClass('page-break', viewWrapper);\n                writer.insert(writer.createPositionAt(viewWrapper, 0), viewLabelElement);\n                return toPageBreakWidget(viewWrapper, writer, label);\n            }\n        });\n        conversion.for('upcast')\n            .elementToElement({\n            view: element => {\n                // For upcast conversion it's enough if we check for element style and verify if it's empty\n                // or contains only hidden span element.\n                const hasPageBreakBefore = element.getStyle('page-break-before') == 'always';\n                const hasPageBreakAfter = element.getStyle('page-break-after') == 'always';\n                if (!hasPageBreakBefore && !hasPageBreakAfter) {\n                    return null;\n                }\n                // The \"page break\" div accepts only single child or no child at all.\n                if (element.childCount == 1) {\n                    const viewSpan = element.getChild(0);\n                    // The child must be the \"span\" element that is not displayed.\n                    if (!viewSpan.is('element', 'span') || viewSpan.getStyle('display') != 'none') {\n                        return null;\n                    }\n                }\n                else if (element.childCount > 1) {\n                    return null;\n                }\n                return {\n                    name: true,\n                    styles: [\n                        ...(hasPageBreakBefore ? ['page-break-before'] : []),\n                        ...(hasPageBreakAfter ? ['page-break-after'] : [])\n                    ],\n                    ...element.hasClass('page-break') && {\n                        classes: ['page-break']\n                    }\n                };\n            },\n            model: 'pageBreak',\n            // This conversion must be checked before <br> conversion because some editors use\n            // <br style=\"page-break-before:always\"> as a page break marker.\n            converterPriority: 'high'\n        });\n        editor.commands.add('pageBreak', new PageBreakCommand(editor));\n    }\n}\n/**\n * Converts a given {@link module:engine/view/element~ViewElement} to a page break widget:\n * * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property} allowing to\n *   recognize the page break widget element.\n * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.\n */\nfunction toPageBreakWidget(viewElement, writer, label) {\n    writer.setCustomProperty('pageBreak', true, viewElement);\n    return toWidget(viewElement, writer, { label });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module page-break/pagebreakui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconPageBreak } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\n/**\n * The page break UI plugin.\n */\nexport class PageBreakUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'PageBreakUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Add pageBreak button to feature components.\n        editor.ui.componentFactory.add('pageBreak', () => {\n            const view = this._createButton(ButtonView);\n            view.set({\n                tooltip: true\n            });\n            return view;\n        });\n        editor.ui.componentFactory.add('menuBar:pageBreak', () => this._createButton(MenuBarMenuListItemButtonView));\n    }\n    /**\n     * Creates a button for page break command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('pageBreak');\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            label: t('Page break'),\n            icon: IconPageBreak\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute('pageBreak');\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z\\\"/><path d=\\\"M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z\\\"/><path d=\\\"M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ButtonView, View } from 'ckeditor5/src/ui.js';\n/**\n * A class representing an individual button (style) in the grid. Renders a rich preview of the style.\n *\n * @internal\n */\nexport class StyleGridButtonView extends ButtonView {\n    /**\n     * Definition of the style the button will apply when executed.\n     */\n    styleDefinition;\n    /**\n     * The view rendering the preview of the style.\n     */\n    previewView;\n    /**\n     * Creates an instance of the {@link module:style/ui/stylegridbuttonview~StyleGridButtonView} class.\n     *\n     * @param locale The localization services instance.\n     * @param styleDefinition Definition of the style.\n     */\n    constructor(locale, styleDefinition) {\n        super(locale);\n        this.styleDefinition = styleDefinition;\n        this.previewView = this._createPreview();\n        this.set({\n            label: styleDefinition.name,\n            class: 'ck-style-grid__button',\n            withText: true\n        });\n        this.extendTemplate({\n            attributes: {\n                role: 'option'\n            }\n        });\n        this.children.add(this.previewView, 0);\n    }\n    /**\n     * Creates the view representing the preview of the style.\n     */\n    _createPreview() {\n        const previewView = new View(this.locale);\n        previewView.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-reset_all-excluded',\n                    'ck-style-grid__button__preview',\n                    'ck-content'\n                ],\n                // The preview \"AaBbCcDdEeFfGgHhIiJj\" should not be read by screen readers because it is purely presentational.\n                'aria-hidden': 'true'\n            },\n            children: [\n                this.styleDefinition.previewTemplate\n            ]\n        });\n        return previewView;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/ui/stylegridview\n */\nimport { View, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { StyleGridButtonView } from './stylegridbuttonview.js';\nimport '../../theme/stylegrid.css';\n/**\n * A class representing a grid of styles ({@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}).\n * Allows users to select a style.\n *\n * @internal\n */\nexport class StyleGridView extends View {\n    /**\n     * Tracks information about the DOM focus in the view.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of style {@link module:style/ui/stylegridbuttonview~StyleGridButtonView buttons}.\n     */\n    children;\n    /**\n     * Creates an instance of the {@link module:style/ui/stylegridview~StyleGridView} class.\n     *\n     * @param locale The localization services instance.\n     * @param styleDefinitions Definitions of the styles.\n     */\n    constructor(locale, styleDefinitions) {\n        super(locale);\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.set('activeStyles', []);\n        this.set('enabledStyles', []);\n        this.children = this.createCollection();\n        this.children.delegate('execute').to(this);\n        for (const definition of styleDefinitions) {\n            const gridTileView = new StyleGridButtonView(locale, definition);\n            this.children.add(gridTileView);\n        }\n        this.on('change:activeStyles', () => {\n            for (const child of this.children) {\n                child.isOn = this.activeStyles.includes(child.styleDefinition.name);\n            }\n        });\n        this.on('change:enabledStyles', () => {\n            for (const child of this.children) {\n                child.isEnabled = this.enabledStyles.includes(child.styleDefinition.name);\n            }\n        });\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-style-grid'\n                ],\n                role: 'listbox'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        for (const child of this.children) {\n            this.focusTracker.add(child.element);\n        }\n        addKeyboardHandlingForGrid({\n            keystrokeHandler: this.keystrokes,\n            focusTracker: this.focusTracker,\n            gridItems: this.children,\n            numberOfColumns: 3,\n            uiLanguageDirection: this.locale && this.locale.uiLanguageDirection\n        });\n        // Start listening for the keystrokes coming from the grid view.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * Focuses the first style button in the grid.\n     */\n    focus() {\n        this.children.first.focus();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/ui/stylegroupview\n */\nimport { LabelView, View } from 'ckeditor5/src/ui.js';\nimport { StyleGridView } from './stylegridview.js';\nimport '../../theme/stylegroup.css';\n/**\n * A class representing a group of styles (e.g. \"block\" or \"inline\").\n *\n * Renders a {@link module:style/ui/stylegridview~StyleGridView style grid} and a label.\n *\n * @internal\n */\nexport class StyleGroupView extends View {\n    /**\n     * The styles grid of the group.\n     */\n    gridView;\n    /**\n     * The label of the group.\n     */\n    labelView;\n    /**\n     * Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.\n     *\n     * @param locale The localization services instance.\n     * @param label The localized label of the group.\n     * @param styleDefinitions Definitions of the styles in the group.\n     */\n    constructor(locale, label, styleDefinitions) {\n        super(locale);\n        this.labelView = new LabelView(locale);\n        this.labelView.text = label;\n        this.gridView = new StyleGridView(locale, styleDefinitions);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-style-panel__style-group'\n                ],\n                role: 'group',\n                'aria-labelledby': this.labelView.id\n            },\n            children: [\n                this.labelView,\n                this.gridView\n            ]\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/ui/stylepanelview\n */\nimport { FocusCycler, View, ViewCollection } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\nimport { StyleGroupView } from './stylegroupview.js';\nimport '../../theme/stylepanel.css';\n/**\n * A class representing a panel with available content styles. It renders styles in button grids, grouped\n * in categories.\n *\n * @internal\n */\nexport class StylePanelView extends View {\n    /**\n     * Tracks information about DOM focus in the panel.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * A collection of panel children.\n     */\n    children;\n    /**\n     * A view representing block styles group.\n     */\n    blockStylesGroupView;\n    /**\n     * A view representing inline styles group\n     */\n    inlineStylesGroupView;\n    /**\n     * A collection of views that can be focused in the panel.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the panel.\n     */\n    _focusCycler;\n    /**\n     * Creates an instance of the {@link module:style/ui/stylegroupview~StyleGroupView} class.\n     *\n     * @param locale The localization services instance.\n     * @param styleDefinitions Normalized definitions of the styles.\n     */\n    constructor(locale, styleDefinitions) {\n        super(locale);\n        const t = locale.t;\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this.children = this.createCollection();\n        this.blockStylesGroupView = new StyleGroupView(locale, t('Block styles'), styleDefinitions.block);\n        this.inlineStylesGroupView = new StyleGroupView(locale, t('Text styles'), styleDefinitions.inline);\n        this.set('activeStyles', []);\n        this.set('enabledStyles', []);\n        this._focusables = new ViewCollection();\n        this._focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                // Navigate style groups backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.\n                focusPrevious: ['shift + tab'],\n                // Navigate style groups forward using the <kbd>Tab</kbd> key.\n                focusNext: ['tab']\n            }\n        });\n        if (styleDefinitions.block.length) {\n            this.children.add(this.blockStylesGroupView);\n        }\n        if (styleDefinitions.inline.length) {\n            this.children.add(this.inlineStylesGroupView);\n        }\n        this.blockStylesGroupView.gridView.delegate('execute').to(this);\n        this.inlineStylesGroupView.gridView.delegate('execute').to(this);\n        this.blockStylesGroupView.gridView\n            .bind('activeStyles', 'enabledStyles')\n            .to(this, 'activeStyles', 'enabledStyles');\n        this.inlineStylesGroupView.gridView\n            .bind('activeStyles', 'enabledStyles')\n            .to(this, 'activeStyles', 'enabledStyles');\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-style-panel'\n                ]\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        // Register the views as focusable.\n        this._focusables.add(this.blockStylesGroupView.gridView);\n        this._focusables.add(this.inlineStylesGroupView.gridView);\n        // Register the views in the focus tracker.\n        this.focusTracker.add(this.blockStylesGroupView.gridView.element);\n        this.focusTracker.add(this.inlineStylesGroupView.gridView.element);\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * Focuses the first focusable element in the panel.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n    /**\n     * Focuses the last focusable element in the panel.\n     */\n    focusLast() {\n        this._focusCycler.focusLast();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/styleutils\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { isObject } from 'es-toolkit/compat';\n// These are intermediate element names that can't be rendered as style preview because they don't make sense standalone.\nconst NON_PREVIEWABLE_ELEMENT_NAMES = [\n    'caption', 'colgroup', 'dd', 'dt', 'figcaption', 'legend', 'li', 'optgroup', 'option', 'rp',\n    'rt', 'summary', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'\n];\nexport class StyleUtils extends Plugin {\n    _htmlSupport;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'StyleUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this.decorate('isStyleEnabledForBlock');\n        this.decorate('isStyleActiveForBlock');\n        this.decorate('getAffectedBlocks');\n        this.decorate('isStyleEnabledForInlineSelection');\n        this.decorate('isStyleActiveForInlineSelection');\n        this.decorate('getAffectedInlineSelectable');\n        this.decorate('getStylePreview');\n        this.decorate('configureGHSDataFilter');\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this._htmlSupport = this.editor.plugins.get('GeneralHtmlSupport');\n    }\n    /**\n     * Normalizes {@link module:style/styleconfig~StyleConfig#definitions} in the configuration of the styles feature.\n     * The structure of normalized styles looks as follows:\n     *\n     * ```ts\n     * {\n     * \tblock: [\n     * \t\t<module:style/style~StyleDefinition>,\n     * \t\t<module:style/style~StyleDefinition>,\n     * \t\t...\n     * \t],\n     * \tinline: [\n     * \t\t<module:style/style~StyleDefinition>,\n     * \t\t<module:style/style~StyleDefinition>,\n     * \t\t...\n     * \t]\n     * }\n     * ```\n     *\n     * @returns An object with normalized style definitions grouped into `block` and `inline` categories (arrays).\n     */\n    normalizeConfig(dataSchema, styleDefinitions = []) {\n        const normalizedDefinitions = {\n            block: [],\n            inline: []\n        };\n        for (const definition of styleDefinitions) {\n            const modelElements = [];\n            const ghsAttributes = [];\n            for (const ghsDefinition of dataSchema.getDefinitionsForView(definition.element)) {\n                const appliesToBlock = 'appliesToBlock' in ghsDefinition ? ghsDefinition.appliesToBlock : false;\n                if (ghsDefinition.isBlock || appliesToBlock) {\n                    if (typeof appliesToBlock == 'string') {\n                        modelElements.push(appliesToBlock);\n                    }\n                    else if (ghsDefinition.isBlock) {\n                        const ghsBlockDefinition = ghsDefinition;\n                        modelElements.push(ghsDefinition.model);\n                        if (ghsBlockDefinition.paragraphLikeModel) {\n                            modelElements.push(ghsBlockDefinition.paragraphLikeModel);\n                        }\n                    }\n                }\n                else {\n                    ghsAttributes.push(ghsDefinition.model);\n                }\n            }\n            const previewTemplate = this.getStylePreview(definition, [\n                { text: 'AaBbCcDdEeFfGgHhIiJj' }\n            ]);\n            if (modelElements.length) {\n                normalizedDefinitions.block.push({\n                    ...definition,\n                    previewTemplate,\n                    modelElements,\n                    isBlock: true\n                });\n            }\n            else {\n                normalizedDefinitions.inline.push({\n                    ...definition,\n                    previewTemplate,\n                    ghsAttributes\n                });\n            }\n        }\n        return normalizedDefinitions;\n    }\n    /**\n     * Verifies if the given style is applicable to the provided block element.\n     *\n     * @internal\n     */\n    isStyleEnabledForBlock(definition, block) {\n        const model = this.editor.model;\n        const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);\n        if (!model.schema.checkAttribute(block, attributeName)) {\n            return false;\n        }\n        return definition.modelElements.includes(block.name);\n    }\n    /**\n     * Returns true if the given style is applied to the specified block element.\n     *\n     * @internal\n     */\n    isStyleActiveForBlock(definition, block) {\n        const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);\n        const ghsAttributeValue = block.getAttribute(attributeName);\n        return this.hasAllClasses(ghsAttributeValue, definition.classes);\n    }\n    /**\n     * Returns an array of block elements that style should be applied to.\n     *\n     * @internal\n     */\n    getAffectedBlocks(definition, block) {\n        if (definition.modelElements.includes(block.name)) {\n            return [block];\n        }\n        return null;\n    }\n    /**\n     * Verifies if the given style is applicable to the provided document selection.\n     *\n     * @internal\n     */\n    isStyleEnabledForInlineSelection(definition, selection) {\n        const model = this.editor.model;\n        for (const ghsAttributeName of definition.ghsAttributes) {\n            if (model.schema.checkAttributeInSelection(selection, ghsAttributeName)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    /**\n     * Returns true if the given style is applied to the specified document selection.\n     *\n     * @internal\n     */\n    isStyleActiveForInlineSelection(definition, selection) {\n        for (const ghsAttributeName of definition.ghsAttributes) {\n            const ghsAttributeValue = this._getValueFromFirstAllowedNode(selection, ghsAttributeName);\n            if (this.hasAllClasses(ghsAttributeValue, definition.classes)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    /**\n     * Returns a selectable that given style should be applied to.\n     *\n     * @internal\n     */\n    getAffectedInlineSelectable(definition, selection) {\n        return selection;\n    }\n    /**\n     * Returns the `TemplateDefinition` used by styles dropdown to render style preview.\n     *\n     * @internal\n     */\n    getStylePreview(definition, children) {\n        const { element, classes } = definition;\n        return {\n            tag: isPreviewable(element) ? element : 'div',\n            attributes: {\n                class: classes\n            },\n            children\n        };\n    }\n    /**\n     * Verifies if all classes are present in the given GHS attribute.\n     *\n     * @internal\n     */\n    hasAllClasses(ghsAttributeValue, classes) {\n        return isObject(ghsAttributeValue) &&\n            hasClassesProperty(ghsAttributeValue) &&\n            classes.every(className => ghsAttributeValue.classes.includes(className));\n    }\n    /**\n     * This is where the styles feature configures the GHS feature. This method translates normalized\n     * {@link module:style/styleconfig~StyleDefinition style definitions} to\n     * {@link module:engine/view/matcher~MatcherObjectPattern matcher patterns} and feeds them to the GHS\n     * {@link module:html-support/datafilter~DataFilter} plugin.\n     *\n     * @internal\n     */\n    configureGHSDataFilter({ block, inline }) {\n        const ghsDataFilter = this.editor.plugins.get('DataFilter');\n        ghsDataFilter.loadAllowedConfig(block.map(normalizedStyleDefinitionToMatcherPattern));\n        ghsDataFilter.loadAllowedConfig(inline.map(normalizedStyleDefinitionToMatcherPattern));\n    }\n    /**\n     * Checks the attribute value of the first node in the selection that allows the attribute.\n     * For the collapsed selection, returns the selection attribute.\n     *\n     * @param selection The document selection.\n     * @param attributeName Name of the GHS attribute.\n     * @returns The attribute value.\n     */\n    _getValueFromFirstAllowedNode(selection, attributeName) {\n        const model = this.editor.model;\n        const schema = model.schema;\n        if (selection.isCollapsed) {\n            return selection.getAttribute(attributeName);\n        }\n        for (const range of selection.getRanges()) {\n            for (const item of range.getItems()) {\n                if (schema.checkAttribute(item, attributeName)) {\n                    return item.getAttribute(attributeName);\n                }\n            }\n        }\n        return null;\n    }\n}\n/**\n * Checks if given object has `classes` property which is an array.\n *\n * @param obj Object to check.\n */\nfunction hasClassesProperty(obj) {\n    return Boolean(obj.classes) && Array.isArray(obj.classes);\n}\n/**\n * Decides whether an element should be created in the preview or a substitute `<div>` should\n * be used instead. This avoids previewing a standalone `<td>`, `<li>`, etc. without a parent.\n *\n * @param elementName Name of the element\n * @returns Boolean indicating whether the element can be rendered.\n */\nfunction isPreviewable(elementName) {\n    return !NON_PREVIEWABLE_ELEMENT_NAMES.includes(elementName);\n}\n/**\n * Translates a normalized style definition to a view matcher pattern.\n */\nfunction normalizedStyleDefinitionToMatcherPattern({ element, classes }) {\n    return {\n        name: element,\n        classes\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/styleui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { createDropdown } from 'ckeditor5/src/ui.js';\nimport { StylePanelView } from './ui/stylepanelview.js';\nimport { StyleUtils } from './styleutils.js';\nimport '../theme/style.css';\n/**\n * The UI plugin of the style feature .\n *\n * It registers the `'style'` UI dropdown in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}\n * that displays a grid of styles and allows changing styles of the content.\n */\nexport class StyleUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'StyleUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [StyleUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const dataSchema = editor.plugins.get('DataSchema');\n        const styleUtils = editor.plugins.get('StyleUtils');\n        const styleDefinitions = editor.config.get('style.definitions');\n        const normalizedStyleDefinitions = styleUtils.normalizeConfig(dataSchema, styleDefinitions);\n        // Add the dropdown to the component factory.\n        editor.ui.componentFactory.add('style', locale => {\n            const t = locale.t;\n            const dropdown = createDropdown(locale);\n            const styleCommand = editor.commands.get('style');\n            dropdown.once('change:isOpen', () => {\n                const panelView = new StylePanelView(locale, normalizedStyleDefinitions);\n                // Put the styles panel is the dropdown.\n                dropdown.panelView.children.add(panelView);\n                // Close the dropdown when a style is selected in the styles panel.\n                panelView.delegate('execute').to(dropdown);\n                // Bind the state of the styles panel to the command.\n                panelView.bind('activeStyles').to(styleCommand, 'value');\n                panelView.bind('enabledStyles').to(styleCommand, 'enabledStyles');\n            });\n            // The entire dropdown will be disabled together with the command (e.g. when the editor goes read-only).\n            dropdown.bind('isEnabled').to(styleCommand);\n            // This dropdown has no icon. It displays text label depending on the selection.\n            dropdown.buttonView.withText = true;\n            // The label of the dropdown is dynamic and depends on how many styles are active at a time.\n            dropdown.buttonView.bind('label').to(styleCommand, 'value', value => {\n                if (value.length > 1) {\n                    return t('Multiple styles');\n                }\n                else if (value.length === 1) {\n                    return value[0];\n                }\n                else {\n                    return t('Styles');\n                }\n            });\n            // The dropdown has a static CSS class for easy customization. There's another CSS class\n            // that gets displayed when multiple styles are active at a time allowing visual customization of\n            // the label.\n            dropdown.bind('class').to(styleCommand, 'value', value => {\n                const classes = [\n                    'ck-style-dropdown'\n                ];\n                if (value.length > 1) {\n                    classes.push('ck-style-dropdown_multiple-active');\n                }\n                return classes.join(' ');\n            });\n            // Execute the command when a style is selected in the styles panel.\n            // Also focus the editable after executing the command.\n            // It overrides a default behaviour where the focus is moved to the dropdown button (#12125).\n            dropdown.on('execute', evt => {\n                editor.execute('style', { styleName: evt.source.styleDefinition.name });\n                editor.editing.view.focus();\n            });\n            return dropdown;\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { logWarning, first } from 'ckeditor5/src/utils.js';\nimport { StyleUtils } from './styleutils.js';\n/**\n * Style command.\n *\n * Applies and removes styles from selection and elements.\n */\nexport class StyleCommand extends Command {\n    /**\n     * Normalized definitions of the styles.\n     */\n    _styleDefinitions;\n    /**\n     * The StyleUtils plugin.\n     */\n    _styleUtils;\n    /**\n     * Creates an instance of the command.\n     *\n     * @param editor Editor on which this command will be used.\n     * @param styleDefinitions Normalized definitions of the styles.\n     */\n    constructor(editor, styleDefinitions) {\n        super(editor);\n        this.set('value', []);\n        this.set('enabledStyles', []);\n        this._styleDefinitions = styleDefinitions;\n        this._styleUtils = this.editor.plugins.get(StyleUtils);\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const value = new Set();\n        const enabledStyles = new Set();\n        // Inline styles.\n        for (const definition of this._styleDefinitions.inline) {\n            // Check if this inline style is enabled.\n            if (this._styleUtils.isStyleEnabledForInlineSelection(definition, selection)) {\n                enabledStyles.add(definition.name);\n            }\n            // Check if this inline style is active.\n            if (this._styleUtils.isStyleActiveForInlineSelection(definition, selection)) {\n                value.add(definition.name);\n            }\n        }\n        // Block styles.\n        const firstBlock = first(selection.getSelectedBlocks()) || selection.getFirstPosition().parent;\n        if (firstBlock) {\n            const ancestorBlocks = firstBlock.getAncestors({ includeSelf: true, parentFirst: true });\n            for (const block of ancestorBlocks) {\n                if (block.is('rootElement')) {\n                    break;\n                }\n                for (const definition of this._styleDefinitions.block) {\n                    // Check if this block style is enabled.\n                    if (!this._styleUtils.isStyleEnabledForBlock(definition, block)) {\n                        continue;\n                    }\n                    enabledStyles.add(definition.name);\n                    // Check if this block style is active.\n                    if (this._styleUtils.isStyleActiveForBlock(definition, block)) {\n                        value.add(definition.name);\n                    }\n                }\n                // E.g. reached a model table when the selection is in a cell. The command should not modify\n                // ancestors of a table.\n                if (model.schema.isObject(block)) {\n                    break;\n                }\n            }\n        }\n        this.enabledStyles = Array.from(enabledStyles).sort();\n        this.isEnabled = this.enabledStyles.length > 0;\n        this.value = this.isEnabled ? Array.from(value).sort() : [];\n    }\n    /**\n     * Executes the command &ndash; applies the style classes to the selection or removes it from the selection.\n     *\n     * If the command value already contains the requested style, it will remove the style classes. Otherwise, it will set it.\n     *\n     * The execution result differs, depending on the {@link module:engine/model/document~ModelDocument#selection} and the\n     * style type (inline or block):\n     *\n     * * When applying inline styles:\n     *   * If the selection is on a range, the command applies the style classes to all nodes in that range.\n     *   * If the selection is collapsed in a non-empty node, the command applies the style classes to the\n     * {@link module:engine/model/document~ModelDocument#selection}.\n     *\n     * * When applying block styles:\n     *   * If the selection is on a range, the command applies the style classes to the nearest block parent element.\n     *\n     * @fires execute\n     * @param options Command options.\n     * @param options.styleName Style name matching the one defined in the\n     * {@link module:style/styleconfig~StyleConfig#definitions configuration}.\n     * @param options.forceValue Whether the command should add given style (`true`) or remove it (`false`) from the selection.\n     * If not set (default), the command will toggle the style basing on the first selected node. Note, that this will not force\n     * setting a style on an element that cannot receive given style.\n     */\n    execute({ styleName, forceValue }) {\n        if (!this.enabledStyles.includes(styleName)) {\n            /**\n             * Style command can be executed only with a correct style name.\n             *\n             * This warning may be caused by:\n             *\n             * * passing a name that is not specified in the {@link module:style/styleconfig~StyleConfig#definitions configuration}\n             * (e.g. a CSS class name),\n             * * when trying to apply a style that is not allowed on a given element.\n             *\n             * @error style-command-executed-with-incorrect-style-name\n             */\n            logWarning('style-command-executed-with-incorrect-style-name');\n            return;\n        }\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        const htmlSupport = this.editor.plugins.get('GeneralHtmlSupport');\n        const allDefinitions = [\n            ...this._styleDefinitions.inline,\n            ...this._styleDefinitions.block\n        ];\n        const activeDefinitions = allDefinitions.filter(({ name }) => this.value.includes(name));\n        const definition = allDefinitions.find(({ name }) => name == styleName);\n        const shouldAddStyle = forceValue === undefined ? !this.value.includes(definition.name) : forceValue;\n        model.change(() => {\n            let selectables;\n            if (isBlockStyleDefinition(definition)) {\n                selectables = this._findAffectedBlocks(getBlocksFromSelection(selection), definition);\n            }\n            else {\n                selectables = [this._styleUtils.getAffectedInlineSelectable(definition, selection)];\n            }\n            for (const selectable of selectables) {\n                if (shouldAddStyle) {\n                    htmlSupport.addModelHtmlClass(definition.element, definition.classes, selectable);\n                }\n                else {\n                    htmlSupport.removeModelHtmlClass(definition.element, getDefinitionExclusiveClasses(activeDefinitions, definition), selectable);\n                }\n            }\n        });\n    }\n    /**\n     * Returns a set of elements that should be affected by the block-style change.\n     */\n    _findAffectedBlocks(selectedBlocks, definition) {\n        const blocks = new Set();\n        for (const selectedBlock of selectedBlocks) {\n            const ancestorBlocks = selectedBlock.getAncestors({ includeSelf: true, parentFirst: true });\n            for (const block of ancestorBlocks) {\n                if (block.is('rootElement')) {\n                    break;\n                }\n                const affectedBlocks = this._styleUtils.getAffectedBlocks(definition, block);\n                if (affectedBlocks) {\n                    for (const affectedBlock of affectedBlocks) {\n                        blocks.add(affectedBlock);\n                    }\n                    break;\n                }\n            }\n        }\n        return blocks;\n    }\n}\n/**\n * Returns classes that are defined only in the supplied definition and not in any other active definition. It's used\n * to ensure that classes used by other definitions are preserved when a style is removed. See #11748.\n *\n * @param activeDefinitions All currently active definitions affecting selected element(s).\n * @param definition Definition whose classes will be compared with all other active definition classes.\n * @returns Array of classes exclusive to the supplied definition.\n */\nfunction getDefinitionExclusiveClasses(activeDefinitions, definition) {\n    return activeDefinitions.reduce((classes, currentDefinition) => {\n        if (currentDefinition.name === definition.name) {\n            return classes;\n        }\n        return classes.filter(className => !currentDefinition.classes.includes(className));\n    }, definition.classes);\n}\n/**\n * Checks if provided style definition is of type block.\n */\nfunction isBlockStyleDefinition(definition) {\n    return 'isBlock' in definition;\n}\n/**\n * Gets block elements from selection. If there are none, returns first selected element.\n * @param selection Current document's selection.\n * @returns Selected blocks if there are any, first selected element otherwise.\n */\nfunction getBlocksFromSelection(selection) {\n    const blocks = Array.from(selection.getSelectedBlocks());\n    if (blocks.length) {\n        return blocks;\n    }\n    return [selection.getFirstPosition().parent];\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/integrations/list\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { StyleUtils } from '../styleutils.js';\nexport class ListStyleSupport extends Plugin {\n    _listUtils;\n    _styleUtils;\n    _htmlSupport;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListStyleSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [StyleUtils, 'GeneralHtmlSupport'];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('ListEditing')) {\n            return;\n        }\n        this._styleUtils = editor.plugins.get(StyleUtils);\n        this._listUtils = this.editor.plugins.get('ListUtils');\n        this._htmlSupport = this.editor.plugins.get('GeneralHtmlSupport');\n        this.listenTo(this._styleUtils, 'isStyleEnabledForBlock', (evt, [definition, block]) => {\n            if (this._isStyleEnabledForBlock(definition, block)) {\n                evt.return = true;\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'isStyleActiveForBlock', (evt, [definition, block]) => {\n            if (this._isStyleActiveForBlock(definition, block)) {\n                evt.return = true;\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'getAffectedBlocks', (evt, [definition, block]) => {\n            const blocks = this._getAffectedBlocks(definition, block);\n            if (blocks) {\n                evt.return = blocks;\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'getStylePreview', (evt, [definition, children]) => {\n            const templateDefinition = this._getStylePreview(definition, children);\n            if (templateDefinition) {\n                evt.return = templateDefinition;\n                evt.stop();\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * Verifies if the given style is applicable to the provided block element.\n     */\n    _isStyleEnabledForBlock(definition, block) {\n        const model = this.editor.model;\n        if (!['ol', 'ul', 'li'].includes(definition.element)) {\n            return false;\n        }\n        if (!this._listUtils.isListItemBlock(block)) {\n            return false;\n        }\n        const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);\n        if (definition.element == 'ol' || definition.element == 'ul') {\n            if (!model.schema.checkAttribute(block, attributeName)) {\n                return false;\n            }\n            const isNumbered = this._listUtils.isNumberedListType(block.getAttribute('listType'));\n            const viewElementName = isNumbered ? 'ol' : 'ul';\n            return definition.element == viewElementName;\n        }\n        else {\n            return model.schema.checkAttribute(block, attributeName);\n        }\n    }\n    /**\n     * Returns true if the given style is applied to the specified block element.\n     */\n    _isStyleActiveForBlock(definition, block) {\n        const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);\n        const ghsAttributeValue = block.getAttribute(attributeName);\n        return this._styleUtils.hasAllClasses(ghsAttributeValue, definition.classes);\n    }\n    /**\n     * Returns an array of block elements that style should be applied to.\n     */\n    _getAffectedBlocks(definition, block) {\n        if (!this._isStyleEnabledForBlock(definition, block)) {\n            return null;\n        }\n        if (definition.element == 'li') {\n            return this._listUtils.expandListBlocksToCompleteItems(block, { withNested: false });\n        }\n        else {\n            return this._listUtils.expandListBlocksToCompleteList(block);\n        }\n    }\n    /**\n     * Returns a view template definition for the style preview.\n     */\n    _getStylePreview(definition, children) {\n        const { element, classes } = definition;\n        if (element == 'ol' || element == 'ul') {\n            return {\n                tag: element,\n                attributes: {\n                    class: classes\n                },\n                children: [\n                    {\n                        tag: 'li',\n                        children\n                    }\n                ]\n            };\n        }\n        else if (element == 'li') {\n            return {\n                tag: 'ol',\n                children: [\n                    {\n                        tag: element,\n                        attributes: {\n                            class: classes\n                        },\n                        children\n                    }\n                ]\n            };\n        }\n        return null;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/integrations/table\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { StyleUtils } from '../styleutils.js';\nexport class TableStyleSupport extends Plugin {\n    _tableUtils;\n    _styleUtils;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableStyleSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [StyleUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('TableEditing')) {\n            return;\n        }\n        this._styleUtils = editor.plugins.get(StyleUtils);\n        this._tableUtils = this.editor.plugins.get('TableUtils');\n        this.listenTo(this._styleUtils, 'isStyleEnabledForBlock', (evt, [definition, block]) => {\n            if (this._isApplicable(definition, block)) {\n                evt.return = this._isStyleEnabledForBlock(definition, block);\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'getAffectedBlocks', (evt, [definition, block]) => {\n            if (this._isApplicable(definition, block)) {\n                evt.return = this._getAffectedBlocks(definition, block);\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'configureGHSDataFilter', (evt, [{ block }]) => {\n            const ghsDataFilter = this.editor.plugins.get('DataFilter');\n            ghsDataFilter.loadAllowedConfig(block\n                .filter(definition => definition.element == 'figcaption')\n                .map(definition => ({ name: 'caption', classes: definition.classes })));\n        });\n    }\n    /**\n     * Checks if this plugin's custom logic should be applied for defintion-block pair.\n     *\n     * @param definition Style definition that is being considered.\n     * @param block Block element to check if should be styled.\n     * @returns True if the defintion-block pair meet the plugin criteria, false otherwise.\n     */\n    _isApplicable(definition, block) {\n        if (['td', 'th'].includes(definition.element)) {\n            return block.name == 'tableCell';\n        }\n        if (['thead', 'tbody'].includes(definition.element)) {\n            return block.name == 'table';\n        }\n        return false;\n    }\n    /**\n     * Checks if the style definition should be applied to selected block.\n     *\n     * @param definition Style definition that is being considered.\n     * @param block Block element to check if should be styled.\n     * @returns True if the block should be style with the style description, false otherwise.\n     */\n    _isStyleEnabledForBlock(definition, block) {\n        if (['td', 'th'].includes(definition.element)) {\n            const location = this._tableUtils.getCellLocation(block);\n            const tableRow = block.parent;\n            const table = tableRow.parent;\n            const headingRows = table.getAttribute('headingRows') || 0;\n            const headingColumns = table.getAttribute('headingColumns') || 0;\n            const isHeadingCell = location.row < headingRows || location.column < headingColumns;\n            if (definition.element == 'th') {\n                return isHeadingCell;\n            }\n            else {\n                return !isHeadingCell;\n            }\n        }\n        if (['thead', 'tbody'].includes(definition.element)) {\n            const headingRows = block.getAttribute('headingRows') || 0;\n            if (definition.element == 'thead') {\n                return headingRows > 0;\n            }\n            else {\n                return headingRows < this._tableUtils.getRows(block);\n            }\n        }\n        /* istanbul ignore next -- @preserve */\n        return false;\n    }\n    /**\n     * Gets all blocks that the style should be applied to.\n     *\n     * @param definition Style definition that is being considered.\n     * @param block A block element from selection.\n     * @returns An array with the block that was passed as an argument if meets the criteria, null otherwise.\n     */\n    _getAffectedBlocks(definition, block) {\n        if (!this._isStyleEnabledForBlock(definition, block)) {\n            return null;\n        }\n        return [block];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/integrations/link\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { findAttributeRange, findAttributeRangeBound } from 'ckeditor5/src/typing.js';\nimport { StyleUtils } from '../styleutils.js';\nexport class LinkStyleSupport extends Plugin {\n    _styleUtils;\n    _htmlSupport;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'LinkStyleSupport';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [StyleUtils, 'GeneralHtmlSupport'];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        if (!editor.plugins.has('LinkEditing')) {\n            return;\n        }\n        this._styleUtils = editor.plugins.get(StyleUtils);\n        this._htmlSupport = this.editor.plugins.get('GeneralHtmlSupport');\n        this.listenTo(this._styleUtils, 'isStyleEnabledForInlineSelection', (evt, [definition, selection]) => {\n            if (definition.element == 'a') {\n                evt.return = this._isStyleEnabled(definition, selection);\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'isStyleActiveForInlineSelection', (evt, [definition, selection]) => {\n            if (definition.element == 'a') {\n                evt.return = this._isStyleActive(definition, selection);\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this.listenTo(this._styleUtils, 'getAffectedInlineSelectable', (evt, [definition, selection]) => {\n            if (definition.element != 'a') {\n                return;\n            }\n            const selectable = this._getAffectedSelectable(definition, selection);\n            if (selectable) {\n                evt.return = selectable;\n                evt.stop();\n            }\n        }, { priority: 'high' });\n    }\n    /**\n     * Verifies if the given style is applicable to the provided document selection.\n     */\n    _isStyleEnabled(definition, selection) {\n        const model = this.editor.model;\n        // Handle collapsed selection.\n        if (selection.isCollapsed) {\n            return selection.hasAttribute('linkHref');\n        }\n        // Non-collapsed selection.\n        for (const range of selection.getRanges()) {\n            for (const item of range.getItems()) {\n                if ((item.is('$textProxy') || model.schema.isInline(item)) && item.hasAttribute('linkHref')) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n    /**\n     * Returns true if the given style is applied to the specified document selection.\n     */\n    _isStyleActive(definition, selection) {\n        const model = this.editor.model;\n        const attributeName = this._htmlSupport.getGhsAttributeNameForElement(definition.element);\n        // Handle collapsed selection.\n        if (selection.isCollapsed) {\n            if (selection.hasAttribute('linkHref')) {\n                const ghsAttributeValue = selection.getAttribute(attributeName);\n                if (this._styleUtils.hasAllClasses(ghsAttributeValue, definition.classes)) {\n                    return true;\n                }\n            }\n            return false;\n        }\n        // Non-collapsed selection.\n        for (const range of selection.getRanges()) {\n            for (const item of range.getItems()) {\n                if ((item.is('$textProxy') || model.schema.isInline(item)) && item.hasAttribute('linkHref')) {\n                    const ghsAttributeValue = item.getAttribute(attributeName);\n                    return this._styleUtils.hasAllClasses(ghsAttributeValue, definition.classes);\n                }\n            }\n        }\n        return false;\n    }\n    /**\n     * Returns a selectable that given style should be applied to.\n     */\n    _getAffectedSelectable(definition, selection) {\n        const model = this.editor.model;\n        // Handle collapsed selection.\n        if (selection.isCollapsed) {\n            const linkHref = selection.getAttribute('linkHref');\n            return findAttributeRange(selection.getFirstPosition(), 'linkHref', linkHref, model);\n        }\n        // Non-collapsed selection.\n        const ranges = [];\n        for (const range of selection.getRanges()) {\n            // First expand range to include the whole link.\n            const expandedRange = model.createRange(expandAttributePosition(range.start, 'linkHref', true, model), expandAttributePosition(range.end, 'linkHref', false, model));\n            // Pick only ranges on links.\n            for (const item of expandedRange.getItems()) {\n                if ((item.is('$textProxy') || model.schema.isInline(item)) && item.hasAttribute('linkHref')) {\n                    ranges.push(this.editor.model.createRangeOn(item));\n                }\n            }\n        }\n        // Make sure that we have a continuous range on a link\n        // (not split between text nodes with mixed attributes like bold etc.)\n        return normalizeRanges(ranges);\n    }\n}\n/**\n * Walks forward or backward (depends on the `lookBack` flag), node by node, as long as they have the same attribute value\n * and returns a position just before or after (depends on the `lookBack` flag) the last matched node.\n */\nfunction expandAttributePosition(position, attributeName, lookBack, model) {\n    const referenceNode = position.textNode || (lookBack ? position.nodeAfter : position.nodeBefore);\n    if (!referenceNode || !referenceNode.hasAttribute(attributeName)) {\n        return position;\n    }\n    const attributeValue = referenceNode.getAttribute(attributeName);\n    return findAttributeRangeBound(position, attributeName, attributeValue, lookBack, model);\n}\n/**\n * Normalizes list of ranges by joining intersecting or \"touching\" ranges.\n *\n * Note: It assumes that ranges are sorted.\n */\nfunction normalizeRanges(ranges) {\n    for (let i = 1; i < ranges.length; i++) {\n        const joinedRange = ranges[i - 1].getJoined(ranges[i]);\n        if (joinedRange) {\n            // Replace the ranges on the list with the new joined range.\n            ranges.splice(--i, 2, joinedRange);\n        }\n    }\n    return ranges;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/styleediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { StyleCommand } from './stylecommand.js';\nimport { StyleUtils } from './styleutils.js';\nimport { ListStyleSupport } from './integrations/list.js';\nimport { TableStyleSupport } from './integrations/table.js';\nimport { LinkStyleSupport } from './integrations/link.js';\n/**\n * The style engine feature.\n *\n * It configures the {@glink features/html/general-html-support General HTML Support feature} based on\n * {@link module:style/styleconfig~StyleConfig#definitions configured style definitions} and introduces the\n * {@link module:style/stylecommand~StyleCommand style command} that applies styles to the content of the document.\n */\nexport class StyleEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'StyleEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return ['GeneralHtmlSupport', StyleUtils, ListStyleSupport, TableStyleSupport, LinkStyleSupport];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const dataSchema = editor.plugins.get('DataSchema');\n        const styleUtils = editor.plugins.get('StyleUtils');\n        const styleDefinitions = editor.config.get('style.definitions');\n        const normalizedStyleDefinitions = styleUtils.normalizeConfig(dataSchema, styleDefinitions);\n        editor.commands.add('style', new StyleCommand(editor, normalizedStyleDefinitions));\n        styleUtils.configureGHSDataFilter(normalizedStyleDefinitions);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { findOptimalInsertionRange } from 'ckeditor5/src/widget.js';\n/**\n * The horizontal line command.\n *\n * The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.\n *\n * To insert a horizontal line at the current selection, execute the command:\n *\n * ```ts\n * editor.execute( 'horizontalLine' );\n * ```\n */\nexport class HorizontalLineCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selection = model.document.selection;\n        this.isEnabled = isHorizontalLineAllowedInParent(selection, schema, model);\n    }\n    /**\n     * Executes the command.\n     *\n     * @fires execute\n     */\n    execute() {\n        const model = this.editor.model;\n        model.change(writer => {\n            const horizontalElement = writer.createElement('horizontalLine');\n            model.insertObject(horizontalElement, null, null, { setSelection: 'after' });\n        });\n    }\n}\n/**\n * Checks if a horizontal line is allowed by the schema in the optimal insertion parent.\n *\n * @param model Model instance.\n */\nfunction isHorizontalLineAllowedInParent(selection, schema, model) {\n    const parent = getInsertHorizontalLineParent(selection, model);\n    return schema.checkChild(parent, 'horizontalLine');\n}\n/**\n * Returns a node that will be used to insert a horizontal line with `model.insertContent` to check if the horizontal line can be\n * placed there.\n *\n * @param model Model instance.\n */\nfunction getInsertHorizontalLineParent(selection, model) {\n    const insertionRange = findOptimalInsertionRange(selection, model);\n    const parent = insertionRange.start.parent;\n    if (parent.isEmpty && !parent.is('element', '$root')) {\n        return parent.parent;\n    }\n    return parent;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module horizontal-line/horizontallineediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { toWidget } from 'ckeditor5/src/widget.js';\nimport { HorizontalLineCommand } from './horizontallinecommand.js';\nimport '../theme/horizontalline.css';\n/**\n * The horizontal line editing feature.\n */\nexport class HorizontalLineEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HorizontalLineEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        const t = editor.t;\n        const conversion = editor.conversion;\n        schema.register('horizontalLine', {\n            inheritAllFrom: '$blockObject'\n        });\n        conversion.for('dataDowncast').elementToElement({\n            model: 'horizontalLine',\n            view: (modelElement, { writer }) => {\n                return writer.createEmptyElement('hr');\n            }\n        });\n        conversion.for('editingDowncast').elementToStructure({\n            model: 'horizontalLine',\n            view: (modelElement, { writer }) => {\n                const label = t('Horizontal line');\n                const viewWrapper = writer.createContainerElement('div', null, writer.createEmptyElement('hr'));\n                writer.addClass('ck-horizontal-line', viewWrapper);\n                writer.setCustomProperty('hr', true, viewWrapper);\n                return toHorizontalLineWidget(viewWrapper, writer, label);\n            }\n        });\n        conversion.for('upcast').elementToElement({ view: 'hr', model: 'horizontalLine' });\n        editor.commands.add('horizontalLine', new HorizontalLineCommand(editor));\n    }\n}\n/**\n * Converts a given {@link module:engine/view/element~ViewElement} to a horizontal line widget:\n * * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property} allowing to\n *   recognize the horizontal line widget element.\n * * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.\n *\n * @param writer An instance of the view writer.\n */\nfunction toHorizontalLineWidget(viewElement, writer, label) {\n    writer.setCustomProperty('horizontalLine', true, viewElement);\n    return toWidget(viewElement, writer, { label });\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module horizontal-line/horizontallineui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconHorizontalLine } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\n/**\n * The horizontal line UI plugin.\n */\nexport class HorizontalLineUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HorizontalLineUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        // Add the `horizontalLine` button to feature components.\n        editor.ui.componentFactory.add('horizontalLine', () => {\n            const buttonView = this._createButton(ButtonView);\n            buttonView.set({\n                tooltip: true\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:horizontalLine', () => {\n            return this._createButton(MenuBarMenuListItemButtonView);\n        });\n    }\n    /**\n     * Creates a button for horizontal line command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('horizontalLine');\n        const view = new ButtonClass(editor.locale);\n        const t = locale.t;\n        view.set({\n            label: t('Horizontal line'),\n            icon: IconHorizontalLine\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute('horizontalLine');\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M2 9h16v2H2z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/linkimageediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Matcher } from 'ckeditor5/src/engine.js';\nimport { toMap } from 'ckeditor5/src/utils.js';\nimport { LinkEditing } from './linkediting.js';\n/**\n * The link image engine feature.\n *\n * It accepts the `linkHref=\"url\"` attribute in the model for the {@link module:image/image~Image `<imageBlock>`} element\n * which allows linking images.\n */\nexport class LinkImageEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return ['ImageEditing', 'ImageUtils', LinkEditing];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'LinkImageEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        if (editor.plugins.has('ImageBlockEditing')) {\n            schema.extend('imageBlock', { allowAttributes: ['linkHref'] });\n        }\n        editor.conversion.for('upcast').add(upcastLink(editor));\n        editor.conversion.for('downcast').add(downcastImageLink(editor));\n        // Definitions for decorators are provided by the `link` command and the `LinkEditing` plugin.\n        this._enableAutomaticDecorators();\n        this._enableManualDecorators();\n    }\n    /**\n     * Processes {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators} definitions and\n     * attaches proper converters that will work when linking an image.`\n     */\n    _enableAutomaticDecorators() {\n        const editor = this.editor;\n        const command = editor.commands.get('link');\n        const automaticDecorators = command.automaticDecorators;\n        if (automaticDecorators.length) {\n            editor.conversion.for('downcast').add(automaticDecorators.getDispatcherForLinkedImage());\n        }\n    }\n    /**\n     * Processes transformed {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and attaches proper converters\n     * that will work when linking an image.\n     */\n    _enableManualDecorators() {\n        const editor = this.editor;\n        const command = editor.commands.get('link');\n        for (const decorator of command.manualDecorators) {\n            if (editor.plugins.has('ImageBlockEditing')) {\n                editor.model.schema.extend('imageBlock', { allowAttributes: decorator.id });\n            }\n            if (editor.plugins.has('ImageInlineEditing')) {\n                editor.model.schema.extend('imageInline', { allowAttributes: decorator.id });\n            }\n            editor.conversion.for('downcast').add(downcastImageLinkManualDecorator(decorator));\n            editor.conversion.for('upcast').add(upcastImageLinkManualDecorator(editor, decorator));\n        }\n    }\n}\n/**\n * Returns a converter for linked block images that consumes the \"href\" attribute\n * if a link contains an image.\n *\n * @param editor The editor instance.\n */\nfunction upcastLink(editor) {\n    const isImageInlinePluginLoaded = editor.plugins.has('ImageInlineEditing');\n    const imageUtils = editor.plugins.get('ImageUtils');\n    return dispatcher => {\n        dispatcher.on('element:a', (evt, data, conversionApi) => {\n            const viewLink = data.viewItem;\n            const imageInLink = imageUtils.findViewImgElement(viewLink);\n            if (!imageInLink) {\n                return;\n            }\n            const blockImageView = imageInLink.findAncestor(element => imageUtils.isBlockImageView(element));\n            // There are four possible cases to consider here\n            //\n            // 1. A \"root > ... > figure.image > a > img\" structure.\n            // 2. A \"root > ... > figure.image > a > picture > img\" structure.\n            // 3. A \"root > ... > block > a > img\" structure.\n            // 4. A \"root > ... > block > a > picture > img\" structure.\n            //\n            // but the last 2 cases should only be considered by this converter when the inline image plugin\n            // is NOT loaded in the editor (because otherwise, that would be a plain, linked inline image).\n            if (isImageInlinePluginLoaded && !blockImageView) {\n                return;\n            }\n            // There's an image inside an <a> element - we consume it so it won't be picked up by the Link plugin.\n            const consumableAttributes = { attributes: ['href'] };\n            // Consume the `href` attribute so the default one will not convert it to $text attribute.\n            if (!conversionApi.consumable.consume(viewLink, consumableAttributes)) {\n                // Might be consumed by something else - i.e. other converter with priority=highest - a standard check.\n                return;\n            }\n            const linkHref = viewLink.getAttribute('href');\n            // Missing the 'href' attribute.\n            if (!linkHref) {\n                return;\n            }\n            // A full definition of the image feature.\n            // figure > a > img: parent of the view link element is an image element (figure).\n            let modelElement = data.modelCursor.parent;\n            if (!modelElement.is('element', 'imageBlock')) {\n                // a > img: parent of the view link is not the image (figure) element. We need to convert it manually.\n                const conversionResult = conversionApi.convertItem(imageInLink, data.modelCursor);\n                // Set image range as conversion result.\n                data.modelRange = conversionResult.modelRange;\n                // Continue conversion where image conversion ends.\n                data.modelCursor = conversionResult.modelCursor;\n                modelElement = data.modelCursor.nodeBefore;\n            }\n            if (modelElement && modelElement.is('element', 'imageBlock')) {\n                // Set the linkHref attribute from link element on model image element.\n                conversionApi.writer.setAttribute('linkHref', linkHref, modelElement);\n            }\n        }, { priority: 'high' });\n        // Using the same priority that `upcastImageLinkManualDecorator()` converter guarantees\n        // that manual decorators will decorate the proper element.\n    };\n}\n/**\n * Creates a converter that adds `<a>` to linked block image view elements.\n */\nfunction downcastImageLink(editor) {\n    const imageUtils = editor.plugins.get('ImageUtils');\n    return dispatcher => {\n        dispatcher.on('attribute:linkHref:imageBlock', (evt, data, conversionApi) => {\n            if (!conversionApi.consumable.consume(data.item, evt.name)) {\n                return;\n            }\n            // The image will be already converted - so it will be present in the view.\n            const viewFigure = conversionApi.mapper.toViewElement(data.item);\n            const writer = conversionApi.writer;\n            // But we need to check whether the link element exists.\n            const linkInImage = Array.from(viewFigure.getChildren())\n                .find((child) => child.is('element', 'a'));\n            const viewImage = imageUtils.findViewImgElement(viewFigure);\n            // <picture>...<img/></picture> or <img/>\n            const viewImgOrPicture = viewImage.parent.is('element', 'picture') ? viewImage.parent : viewImage;\n            // If so, update the attribute if it's defined or remove the entire link if the attribute is empty.\n            if (linkInImage) {\n                if (data.attributeNewValue) {\n                    writer.setAttribute('href', data.attributeNewValue, linkInImage);\n                }\n                else {\n                    writer.move(writer.createRangeOn(viewImgOrPicture), writer.createPositionAt(viewFigure, 0));\n                    writer.remove(linkInImage);\n                }\n            }\n            else {\n                // But if it does not exist. Let's wrap already converted image by newly created link element.\n                // 1. Create an empty link element.\n                const linkElement = writer.createContainerElement('a', { href: data.attributeNewValue });\n                // 2. Insert link inside the associated image.\n                writer.insert(writer.createPositionAt(viewFigure, 0), linkElement);\n                // 3. Move the image to the link.\n                writer.move(writer.createRangeOn(viewImgOrPicture), writer.createPositionAt(linkElement, 0));\n            }\n        }, { priority: 'high' });\n    };\n}\n/**\n * Returns a converter that decorates the `<a>` element when the image is the link label.\n */\nfunction downcastImageLinkManualDecorator(decorator) {\n    return dispatcher => {\n        dispatcher.on(`attribute:${decorator.id}:imageBlock`, (evt, data, conversionApi) => {\n            const viewFigure = conversionApi.mapper.toViewElement(data.item);\n            const linkInImage = Array.from(viewFigure.getChildren())\n                .find((child) => child.is('element', 'a'));\n            // The <a> element was removed by the time this converter is executed.\n            // It may happen when the base `linkHref` and decorator attributes are removed\n            // at the same time (see #8401).\n            if (!linkInImage) {\n                return;\n            }\n            // Handle deactivated manual decorator.\n            if (data.attributeOldValue) {\n                for (const key in decorator.attributes) {\n                    conversionApi.writer.removeAttribute(key, linkInImage);\n                }\n                if (decorator.classes) {\n                    conversionApi.writer.removeClass(decorator.classes, linkInImage);\n                }\n                for (const key in decorator.styles) {\n                    conversionApi.writer.removeStyle(key, linkInImage);\n                }\n            }\n            // Handle activated manual decorator.\n            if (data.attributeNewValue) {\n                for (const [key, val] of toMap(decorator.attributes)) {\n                    conversionApi.writer.setAttribute(key, val, linkInImage);\n                }\n                if (decorator.classes) {\n                    conversionApi.writer.addClass(decorator.classes, linkInImage);\n                }\n                for (const key in decorator.styles) {\n                    conversionApi.writer.setStyle(key, decorator.styles[key], linkInImage);\n                }\n            }\n        });\n    };\n}\n/**\n * Returns a converter that checks whether manual decorators should be applied to the link.\n */\nfunction upcastImageLinkManualDecorator(editor, decorator) {\n    const isImageInlinePluginLoaded = editor.plugins.has('ImageInlineEditing');\n    const imageUtils = editor.plugins.get('ImageUtils');\n    return dispatcher => {\n        dispatcher.on('element:a', (evt, data, conversionApi) => {\n            const viewLink = data.viewItem;\n            const imageInLink = imageUtils.findViewImgElement(viewLink);\n            // We need to check whether an image is inside a link because the converter handles\n            // only manual decorators for linked images. See #7975.\n            if (!imageInLink) {\n                return;\n            }\n            const blockImageView = imageInLink.findAncestor(element => imageUtils.isBlockImageView(element));\n            if (isImageInlinePluginLoaded && !blockImageView) {\n                return;\n            }\n            const matcher = new Matcher(decorator._createPattern());\n            const result = matcher.match(viewLink);\n            // The link element does not have required attributes or/and proper values.\n            if (!result) {\n                return;\n            }\n            // Check whether we can consume those attributes.\n            if (!conversionApi.consumable.consume(viewLink, result.match)) {\n                return;\n            }\n            // At this stage we can assume that we have the `<imageBlock>` element.\n            // `nodeBefore` comes after conversion: `<a><img></a>`.\n            // `parent` comes with full image definition: `<figure><a><img></a></figure>.\n            // See the body of the `upcastLink()` function.\n            const modelElement = data.modelCursor.nodeBefore || data.modelCursor.parent;\n            conversionApi.writer.setAttribute(decorator.id, true, modelElement);\n        }, { priority: 'high' });\n        // Using the same priority that `upcastLink()` converter guarantees that the linked image was properly converted.\n    };\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/linkimageui\n */\nimport { ButtonView } from 'ckeditor5/src/ui.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconLink } from 'ckeditor5/src/icons.js';\nimport { LinkUI } from './linkui.js';\nimport { LinkEditing } from './linkediting.js';\nimport { LINK_KEYSTROKE } from './utils.js';\n/**\n * The link image UI plugin.\n *\n * This plugin provides the `'linkImage'` button that can be displayed in the {@link module:image/imagetoolbar~ImageToolbar}.\n * It can be used to wrap images in links.\n */\nexport class LinkImageUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [LinkEditing, LinkUI, 'ImageBlockEditing'];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'LinkImageUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const viewDocument = editor.editing.view.document;\n        this.listenTo(viewDocument, 'click', (evt, data) => {\n            if (this._isSelectedLinkedImage(editor.model.document.selection)) {\n                // Prevent browser navigation when clicking a linked image.\n                data.preventDefault();\n                // Block the `LinkUI` plugin when an image was clicked.\n                // In such a case, we'd like to display the image toolbar.\n                evt.stop();\n            }\n        }, { priority: 'high' });\n        this._createToolbarLinkImageButton();\n    }\n    /**\n     * Creates a `LinkImageUI` button view.\n     *\n     * Clicking this button shows a {@link module:link/linkui~LinkUI#_balloon} attached to the selection.\n     * When an image is already linked, the view shows {@link module:link/linkui~LinkUI#toolbarView} or\n     * {@link module:link/linkui~LinkUI#formView} if it is not.\n     */\n    _createToolbarLinkImageButton() {\n        const editor = this.editor;\n        const t = editor.t;\n        editor.ui.componentFactory.add('linkImage', locale => {\n            const button = new ButtonView(locale);\n            const plugin = editor.plugins.get('LinkUI');\n            const linkCommand = editor.commands.get('link');\n            button.set({\n                isEnabled: true,\n                label: t('Link image'),\n                icon: IconLink,\n                keystroke: LINK_KEYSTROKE,\n                tooltip: true,\n                isToggleable: true\n            });\n            // Bind button to the command.\n            button.bind('isEnabled').to(linkCommand, 'isEnabled');\n            button.bind('isOn').to(linkCommand, 'value', value => !!value);\n            // Show the actionsView or formView (both from LinkUI) on button click depending on whether the image is linked already.\n            this.listenTo(button, 'execute', () => {\n                if (this._isSelectedLinkedImage(editor.model.document.selection)) {\n                    plugin._addToolbarView();\n                }\n                else {\n                    plugin._showUI(true);\n                }\n            });\n            return button;\n        });\n    }\n    /**\n     * Returns true if a linked image (either block or inline) is the only selected element\n     * in the model document.\n     */\n    _isSelectedLinkedImage(selection) {\n        const selectedModelElement = selection.getSelectedElement();\n        const imageUtils = this.editor.plugins.get('ImageUtils');\n        return imageUtils.isImage(selectedModelElement) && selectedModelElement.hasAttribute('linkHref');\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Command } from 'ckeditor5/src/core.js';\nimport { findOptimalInsertionRange } from 'ckeditor5/src/widget.js';\n/**\n * The insert HTML embed element command.\n *\n * The command is registered by {@link module:html-embed/htmlembedediting~HtmlEmbedEditing} as `'htmlEmbed'`.\n *\n * To insert an empty HTML embed element at the current selection, execute the command:\n *\n * ```ts\n * editor.execute( 'htmlEmbed' );\n * ```\n *\n * You can specify the initial content of a new HTML embed in the argument:\n *\n * ```ts\n * editor.execute( 'htmlEmbed', '<b>Initial content.</b>' );\n * ```\n *\n * To update the content of the HTML embed, select it in the model and pass the content in the argument:\n *\n * ```ts\n * editor.execute( 'htmlEmbed', '<b>New content of an existing embed.</b>' );\n * ```\n */\nexport class HtmlEmbedCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        const model = this.editor.model;\n        const schema = model.schema;\n        const selection = model.document.selection;\n        const selectedRawHtmlElement = getSelectedRawHtmlModelWidget(selection);\n        this.isEnabled = isHtmlEmbedAllowedInParent(selection, schema, model);\n        this.value = selectedRawHtmlElement ? selectedRawHtmlElement.getAttribute('value') || '' : null;\n    }\n    /**\n     * Executes the command, which either:\n     *\n     * * creates and inserts a new HTML embed element if none was selected,\n     * * updates the content of the HTML embed if one was selected.\n     *\n     * @fires execute\n     * @param value When passed, the value (content) will be set on a new embed or a selected one.\n     */\n    execute(value) {\n        const model = this.editor.model;\n        const selection = model.document.selection;\n        model.change(writer => {\n            let htmlEmbedElement;\n            // If the command has a non-null value, there must be some HTML embed selected in the model.\n            if (this.value !== null) {\n                htmlEmbedElement = getSelectedRawHtmlModelWidget(selection);\n            }\n            else {\n                htmlEmbedElement = writer.createElement('rawHtml');\n                model.insertObject(htmlEmbedElement, null, null, { setSelection: 'on' });\n            }\n            writer.setAttribute('value', value, htmlEmbedElement);\n        });\n    }\n}\n/**\n * Checks if an HTML embed is allowed by the schema in the optimal insertion parent.\n */\nfunction isHtmlEmbedAllowedInParent(selection, schema, model) {\n    const parent = getInsertHtmlEmbedParent(selection, model);\n    return schema.checkChild(parent, 'rawHtml');\n}\n/**\n * Returns a node that will be used to insert a html embed with `model.insertContent` to check if a html embed element can be placed there.\n */\nfunction getInsertHtmlEmbedParent(selection, model) {\n    const insertionRange = findOptimalInsertionRange(selection, model);\n    const parent = insertionRange.start.parent;\n    if (parent.isEmpty && !parent.is('rootElement')) {\n        return parent.parent;\n    }\n    return parent;\n}\n/**\n * Returns the selected HTML embed element in the model, if any.\n */\nfunction getSelectedRawHtmlModelWidget(selection) {\n    const selectedElement = selection.getSelectedElement();\n    if (selectedElement && selectedElement.is('element', 'rawHtml')) {\n        return selectedElement;\n    }\n    return null;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-embed/htmlembedediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ButtonView } from 'ckeditor5/src/ui.js';\nimport { toWidget } from 'ckeditor5/src/widget.js';\nimport { logWarning, createElement } from 'ckeditor5/src/utils.js';\nimport { IconCancel, IconCheck, IconPencil } from 'ckeditor5/src/icons.js';\nimport { HtmlEmbedCommand } from './htmlembedcommand.js';\nimport '../theme/htmlembed.css';\n/**\n * The HTML embed editing feature.\n */\nexport class HtmlEmbedEditing extends Plugin {\n    /**\n     * Keeps references to {@link module:ui/button/buttonview~ButtonView edit, save, and cancel} button instances created for\n     * each widget so they can be destroyed if they are no longer in DOM after the editing view was re-rendered.\n     */\n    _widgetButtonViewReferences = new Set();\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HtmlEmbedEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'HE';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('htmlEmbed', {\n            showPreviews: false,\n            sanitizeHtml: rawHtml => {\n                /**\n                 * When using the HTML embed feature with the `config.htmlEmbed.showPreviews` set to `true`, it is strongly recommended to\n                 * define a sanitize function that will clean up the input HTML in order to avoid XSS vulnerability.\n                 *\n                 * For a detailed overview, check the {@glink features/html/html-embed HTML embed feature} documentation.\n                 *\n                 * @error html-embed-provide-sanitize-function\n                 */\n                logWarning('html-embed-provide-sanitize-function');\n                return {\n                    html: rawHtml,\n                    hasChanged: false\n                };\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const schema = editor.model.schema;\n        schema.register('rawHtml', {\n            inheritAllFrom: '$blockObject',\n            allowAttributes: ['value']\n        });\n        editor.commands.add('htmlEmbed', new HtmlEmbedCommand(editor));\n        this._setupConversion();\n    }\n    /**\n     * Prepares converters for the feature.\n     */\n    _setupConversion() {\n        const editor = this.editor;\n        const t = editor.t;\n        const view = editor.editing.view;\n        const widgetButtonViewReferences = this._widgetButtonViewReferences;\n        const htmlEmbedConfig = editor.config.get('htmlEmbed');\n        // Destroy UI buttons created for widgets that have been removed from the view document (e.g. in the previous conversion).\n        // This prevents unexpected memory leaks from UI views.\n        this.editor.editing.view.on('render', () => {\n            for (const buttonView of widgetButtonViewReferences) {\n                if (buttonView.element && buttonView.element.isConnected) {\n                    return;\n                }\n                buttonView.destroy();\n                widgetButtonViewReferences.delete(buttonView);\n            }\n        }, { priority: 'lowest' });\n        // Register div.raw-html-embed as a raw content element so all of it's content will be provided\n        // as a view element's custom property while data upcasting.\n        editor.data.registerRawContentMatcher({\n            name: 'div',\n            classes: 'raw-html-embed'\n        });\n        editor.conversion.for('upcast').elementToElement({\n            view: {\n                name: 'div',\n                classes: 'raw-html-embed'\n            },\n            model: (viewElement, { writer }) => {\n                // The div.raw-html-embed is registered as a raw content element,\n                // so all it's content is available in a custom property.\n                return writer.createElement('rawHtml', {\n                    value: viewElement.getCustomProperty('$rawContent')\n                });\n            }\n        });\n        editor.conversion.for('dataDowncast').elementToElement({\n            model: 'rawHtml',\n            view: (modelElement, { writer }) => {\n                return writer.createRawElement('div', { class: 'raw-html-embed' }, function (domElement) {\n                    domElement.innerHTML = modelElement.getAttribute('value') || '';\n                });\n            }\n        });\n        editor.conversion.for('editingDowncast').elementToStructure({\n            model: { name: 'rawHtml', attributes: ['value'] },\n            view: (modelElement, { writer }) => {\n                let domContentWrapper;\n                let state;\n                let props;\n                const viewContentWrapper = writer.createRawElement('div', {\n                    class: 'raw-html-embed__content-wrapper'\n                }, function (domElement) {\n                    domContentWrapper = domElement;\n                    renderContent({ editor, domElement, state, props });\n                    // Since there is a `data-cke-ignore-events` attribute set on the wrapper element in the editable mode,\n                    // the explicit `mousedown` handler on the `capture` phase is needed to move the selection onto the whole\n                    // HTML embed widget.\n                    domContentWrapper.addEventListener('mousedown', () => {\n                        if (state.isEditable) {\n                            const model = editor.model;\n                            const selectedElement = model.document.selection.getSelectedElement();\n                            // Move the selection onto the whole HTML embed widget if it's currently not selected.\n                            if (selectedElement !== modelElement) {\n                                model.change(writer => writer.setSelection(modelElement, 'on'));\n                            }\n                        }\n                    }, true);\n                });\n                // API exposed on each raw HTML embed widget so other features can control a particular widget.\n                const rawHtmlApi = {\n                    makeEditable() {\n                        state = Object.assign({}, state, {\n                            isEditable: true\n                        });\n                        renderContent({ domElement: domContentWrapper, editor, state, props });\n                        view.change(writer => {\n                            writer.setAttribute('data-cke-ignore-events', 'true', viewContentWrapper);\n                        });\n                        // This could be potentially pulled to a separate method called focusTextarea().\n                        domContentWrapper.querySelector('textarea').focus();\n                    },\n                    save(newValue) {\n                        // If the value didn't change, we just cancel. If it changed,\n                        // it's enough to update the model – the entire widget will be reconverted.\n                        if (newValue !== state.getRawHtmlValue()) {\n                            editor.execute('htmlEmbed', newValue);\n                            editor.editing.view.focus();\n                        }\n                        else {\n                            this.cancel();\n                        }\n                    },\n                    cancel() {\n                        state = Object.assign({}, state, {\n                            isEditable: false\n                        });\n                        renderContent({ domElement: domContentWrapper, editor, state, props });\n                        editor.editing.view.focus();\n                        view.change(writer => {\n                            writer.removeAttribute('data-cke-ignore-events', viewContentWrapper);\n                        });\n                    }\n                };\n                state = {\n                    showPreviews: htmlEmbedConfig.showPreviews,\n                    isEditable: false,\n                    getRawHtmlValue: () => modelElement.getAttribute('value') || ''\n                };\n                props = {\n                    sanitizeHtml: htmlEmbedConfig.sanitizeHtml,\n                    textareaPlaceholder: t('Paste raw HTML here...'),\n                    onEditClick() {\n                        rawHtmlApi.makeEditable();\n                    },\n                    onSaveClick(newValue) {\n                        rawHtmlApi.save(newValue);\n                    },\n                    onCancelClick() {\n                        rawHtmlApi.cancel();\n                    }\n                };\n                const viewContainer = writer.createContainerElement('div', {\n                    class: 'raw-html-embed',\n                    'data-html-embed-label': t('HTML snippet'),\n                    dir: editor.locale.uiLanguageDirection\n                }, viewContentWrapper);\n                writer.setCustomProperty('rawHtmlApi', rawHtmlApi, viewContainer);\n                writer.setCustomProperty('rawHtml', true, viewContainer);\n                return toWidget(viewContainer, writer, {\n                    label: t('HTML snippet'),\n                    hasSelectionHandle: true\n                });\n            }\n        });\n        function renderContent({ editor, domElement, state, props }) {\n            // Remove all children;\n            domElement.textContent = '';\n            const domDocument = domElement.ownerDocument;\n            let domTextarea;\n            if (state.isEditable) {\n                const textareaProps = {\n                    isDisabled: false,\n                    placeholder: props.textareaPlaceholder\n                };\n                domTextarea = createDomTextarea({ domDocument, state, props: textareaProps });\n                domElement.append(domTextarea);\n            }\n            else if (state.showPreviews) {\n                const previewContainerProps = {\n                    sanitizeHtml: props.sanitizeHtml\n                };\n                domElement.append(createPreviewContainer({ domDocument, state, props: previewContainerProps, editor }));\n            }\n            else {\n                const textareaProps = {\n                    isDisabled: true,\n                    placeholder: props.textareaPlaceholder\n                };\n                domElement.append(createDomTextarea({ domDocument, state, props: textareaProps }));\n            }\n            const buttonsWrapperProps = {\n                onEditClick: props.onEditClick,\n                onSaveClick: () => {\n                    props.onSaveClick(domTextarea.value);\n                },\n                onCancelClick: props.onCancelClick\n            };\n            domElement.prepend(createDomButtonsWrapper({ editor, domDocument, state, props: buttonsWrapperProps }));\n        }\n        function createDomButtonsWrapper({ editor, domDocument, state, props }) {\n            const domButtonsWrapper = createElement(domDocument, 'div', {\n                class: 'raw-html-embed__buttons-wrapper'\n            });\n            if (state.isEditable) {\n                const saveButtonView = createUIButton(editor, 'save', props.onSaveClick);\n                const cancelButtonView = createUIButton(editor, 'cancel', props.onCancelClick);\n                domButtonsWrapper.append(saveButtonView.element, cancelButtonView.element);\n                widgetButtonViewReferences.add(saveButtonView).add(cancelButtonView);\n            }\n            else {\n                const editButtonView = createUIButton(editor, 'edit', props.onEditClick);\n                domButtonsWrapper.append(editButtonView.element);\n                widgetButtonViewReferences.add(editButtonView);\n            }\n            return domButtonsWrapper;\n        }\n        function createDomTextarea({ domDocument, state, props }) {\n            const domTextarea = createElement(domDocument, 'textarea', {\n                placeholder: props.placeholder,\n                class: 'ck ck-reset ck-input ck-input-text raw-html-embed__source'\n            });\n            domTextarea.disabled = props.isDisabled;\n            domTextarea.value = state.getRawHtmlValue();\n            return domTextarea;\n        }\n        function createPreviewContainer({ editor, domDocument, state, props }) {\n            const sanitizedOutput = props.sanitizeHtml(state.getRawHtmlValue());\n            const placeholderText = state.getRawHtmlValue().length > 0 ?\n                t('No preview available') :\n                t('Empty snippet content');\n            const domPreviewPlaceholder = createElement(domDocument, 'div', {\n                class: 'ck ck-reset_all raw-html-embed__preview-placeholder'\n            }, placeholderText);\n            const domPreviewContent = createElement(domDocument, 'div', {\n                class: 'raw-html-embed__preview-content',\n                dir: editor.locale.contentLanguageDirection\n            });\n            // Creating a contextual document fragment allows executing scripts when inserting into the preview element.\n            // See: #8326.\n            const domRange = domDocument.createRange();\n            const domDocumentFragment = domRange.createContextualFragment(sanitizedOutput.html);\n            domPreviewContent.appendChild(domDocumentFragment);\n            const domPreviewContainer = createElement(domDocument, 'div', {\n                class: 'raw-html-embed__preview'\n            }, [\n                domPreviewPlaceholder, domPreviewContent\n            ]);\n            return domPreviewContainer;\n        }\n    }\n}\n/**\n * Returns a UI button view that can be used in conversion.\n */\nfunction createUIButton(editor, type, onClick) {\n    const { t } = editor.locale;\n    const buttonView = new ButtonView(editor.locale);\n    const command = editor.commands.get('htmlEmbed');\n    buttonView.set({\n        class: `raw-html-embed__${type}-button`,\n        icon: IconPencil,\n        tooltip: true,\n        tooltipPosition: editor.locale.uiLanguageDirection === 'rtl' ? 'e' : 'w'\n    });\n    buttonView.render();\n    if (type === 'edit') {\n        buttonView.set({\n            icon: IconPencil,\n            label: t('Edit source')\n        });\n        buttonView.bind('isEnabled').to(command);\n    }\n    else if (type === 'save') {\n        buttonView.set({\n            icon: IconCheck,\n            label: t('Save changes')\n        });\n        buttonView.bind('isEnabled').to(command);\n    }\n    else {\n        buttonView.set({\n            icon: IconCancel,\n            label: t('Cancel')\n        });\n    }\n    buttonView.on('execute', onClick);\n    return buttonView;\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-embed/htmlembedui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconHtml } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\n/**\n * The HTML embed UI plugin.\n */\nexport class HtmlEmbedUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HtmlEmbedUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const t = locale.t;\n        // Add the `htmlEmbed` button to feature components.\n        editor.ui.componentFactory.add('htmlEmbed', () => {\n            const buttonView = this._createButton(ButtonView);\n            buttonView.set({\n                tooltip: true,\n                label: t('Insert HTML')\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:htmlEmbed', () => {\n            const buttonView = this._createButton(MenuBarMenuListItemButtonView);\n            buttonView.set({\n                label: t('HTML snippet')\n            });\n            return buttonView;\n        });\n    }\n    /**\n     * Creates a button for html embed command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const command = editor.commands.get('htmlEmbed');\n        const view = new ButtonClass(editor.locale);\n        view.set({\n            icon: IconHtml\n        });\n        view.bind('isEnabled').to(command, 'isEnabled');\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute('htmlEmbed');\n            editor.editing.view.focus();\n            const rawHtmlApi = editor.editing.view.document.selection\n                .getSelectedElement()\n                .getCustomProperty('rawHtmlApi');\n            rawHtmlApi.makeEditable();\n        });\n        return view;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965zM2 10H1v5h1v-2h2v2h1v-5H4v2H2zm7 0H6v1h1v4h1v-4h1zm8 0h-1v5h3v-1h-2zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5M10 7v1H4V7zm3-2v1H4V5zm-3-2v1H4V3z\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/htmlpagedataprocessor\n */\nimport { HtmlDataProcessor, ViewUpcastWriter } from 'ckeditor5/src/engine.js';\n/**\n * The full page HTML data processor class.\n * This data processor implementation uses HTML as input and output data.\n */\nexport class HtmlPageDataProcessor extends HtmlDataProcessor {\n    /**\n     * @inheritDoc\n     */\n    toView(data) {\n        // Ignore content that is not a full page source.\n        if (!/<(?:html|body|head|meta)(?:\\s[^>]*)?>/i.test(data.trim().slice(0, 10000))) {\n            return super.toView(data);\n        }\n        // Store doctype and xml declaration in a separate properties as they can't be stringified later.\n        let docType = '';\n        let xmlDeclaration = '';\n        data = data.trim().replace(/<\\?xml\\s[^?]*\\?>/i, match => {\n            xmlDeclaration = match;\n            return '';\n        });\n        data = data.trim().replace(/^<!DOCTYPE\\s[^>]*?>/i, match => {\n            docType = match;\n            return '';\n        });\n        // Convert input HTML data to DOM DocumentFragment.\n        const domFragment = this._toDom(data);\n        // Convert DOM DocumentFragment to view DocumentFragment.\n        const viewFragment = this.domConverter.domToView(domFragment, { skipComments: this.skipComments });\n        const writer = new ViewUpcastWriter(viewFragment.document);\n        // Using the DOM document with body content extracted as a skeleton of the page.\n        writer.setCustomProperty('$fullPageDocument', domFragment.ownerDocument.documentElement.outerHTML, viewFragment);\n        // List of `<style>` elements extracted from document's `<head>` element.\n        const headStylesElements = Array.from(domFragment.ownerDocument.querySelectorAll('head style'));\n        writer.setCustomProperty('$fullPageHeadStyles', headStylesElements, viewFragment);\n        if (docType) {\n            writer.setCustomProperty('$fullPageDocType', docType, viewFragment);\n        }\n        if (xmlDeclaration) {\n            writer.setCustomProperty('$fullPageXmlDeclaration', xmlDeclaration, viewFragment);\n        }\n        return viewFragment;\n    }\n    /**\n     * @inheritDoc\n     */\n    toData(viewFragment) {\n        let data = super.toData(viewFragment);\n        const page = viewFragment.getCustomProperty('$fullPageDocument');\n        const docType = viewFragment.getCustomProperty('$fullPageDocType');\n        const xmlDeclaration = viewFragment.getCustomProperty('$fullPageXmlDeclaration');\n        if (page) {\n            data = page.replace(/<\\/body\\s*>/, data + '$&');\n            if (docType) {\n                data = docType + '\\n' + data;\n            }\n            if (xmlDeclaration) {\n                data = xmlDeclaration + '\\n' + data;\n            }\n        }\n        return data;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-support/fullpage\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { logWarning, global } from 'ckeditor5/src/utils.js';\nimport { ViewUpcastWriter } from 'ckeditor5/src/engine.js';\nimport { HtmlPageDataProcessor } from './htmlpagedataprocessor.js';\n/**\n * The full page editing feature. It preserves the whole HTML page in the editor data.\n */\nexport class FullPage extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FullPage';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'FPH';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('htmlSupport.fullPage', {\n            allowRenderStylesFromHead: false,\n            sanitizeCss: rawCss => {\n                /**\n                 * When using the Full page with the `config.htmlSupport.fullPage.allowRenderStylesFromHead` set to `true`,\n                 * it is strongly recommended to define a sanitize function that will clean up the CSS\n                 * which is present in the `<head>` in editors content in order to avoid XSS vulnerability.\n                 *\n                 * For a detailed overview, check the {@glink features/html/full-page-html Full page HTML feature} documentation.\n                 *\n                 * @error css-full-page-provide-sanitize-function\n                 */\n                logWarning('css-full-page-provide-sanitize-function');\n                return {\n                    css: rawCss,\n                    hasChanged: false\n                };\n            }\n        });\n        editor.data.processor = new HtmlPageDataProcessor(editor.data.viewDocument);\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const properties = ['$fullPageDocument', '$fullPageDocType', '$fullPageXmlDeclaration', '$fullPageHeadStyles'];\n        editor.model.schema.extend('$root', {\n            allowAttributes: properties\n        });\n        // Apply custom properties from view document fragment to the model root attributes.\n        editor.data.on('toModel', (evt, [viewElementOrFragment]) => {\n            const root = editor.model.document.getRoot();\n            editor.model.change(writer => {\n                for (const name of properties) {\n                    const value = viewElementOrFragment.getCustomProperty(name);\n                    if (value) {\n                        writer.setAttribute(name, value, root);\n                    }\n                }\n            });\n            if (isAllowedRenderStylesFromHead(editor)) {\n                this._renderStylesFromHead(root);\n            }\n        }, { priority: 'low' });\n        // Apply root attributes to the view document fragment.\n        editor.data.on('toView', (evt, [modelElementOrFragment]) => {\n            if (!modelElementOrFragment.is('rootElement')) {\n                return;\n            }\n            const root = modelElementOrFragment;\n            const viewFragment = evt.return;\n            if (!root.hasAttribute('$fullPageDocument')) {\n                return;\n            }\n            const writer = new ViewUpcastWriter(viewFragment.document);\n            for (const name of properties) {\n                const value = root.getAttribute(name);\n                if (value) {\n                    writer.setCustomProperty(name, value, viewFragment);\n                }\n            }\n        }, { priority: 'low' });\n        // Clear root attributes related to full page editing on editor content reset.\n        editor.data.on('set', () => {\n            const root = editor.model.document.getRoot();\n            editor.model.change(writer => {\n                for (const name of properties) {\n                    if (root.hasAttribute(name)) {\n                        writer.removeAttribute(name, root);\n                    }\n                }\n            });\n        }, { priority: 'high' });\n        // Make sure that document is returned even if there is no content in the page body.\n        editor.data.on('get', (evt, args) => {\n            if (!args[0]) {\n                args[0] = {};\n            }\n            args[0].trim = false;\n        }, { priority: 'high' });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        if (isAllowedRenderStylesFromHead(this.editor)) {\n            this._removeStyleElementsFromDom();\n        }\n    }\n    /**\n     * Checks if in the document exists any `<style>` elements injected by the plugin and removes them,\n     * so these could be re-rendered later.\n     * There is used `data-full-page-style-id` attribute to recognize styles injected by the feature.\n     */\n    _removeStyleElementsFromDom() {\n        const existingStyleElements = Array.from(global.document.querySelectorAll(`[data-full-page-style-id=\"${this.editor.id}\"]`));\n        for (const style of existingStyleElements) {\n            style.remove();\n        }\n    }\n    /**\n     * Extracts `<style>` elements from the full page data and renders them in the main document `<head>`.\n     * CSS content is sanitized before rendering.\n     */\n    _renderStyleElementsInDom(root) {\n        const editor = this.editor;\n        // Get `<style>` elements list from the `<head>` from the full page data.\n        const styleElements = root.getAttribute('$fullPageHeadStyles');\n        if (!styleElements) {\n            return;\n        }\n        const sanitizeCss = editor.config.get('htmlSupport.fullPage.sanitizeCss');\n        // Add `data-full-page-style-id` attribute to the `<style>` element and render it in `<head>` in the main document.\n        for (const style of styleElements) {\n            style.setAttribute('data-full-page-style-id', editor.id);\n            // Sanitize the CSS content before rendering it in the editor.\n            const sanitizedCss = sanitizeCss(style.innerText);\n            if (sanitizedCss.hasChanged) {\n                style.innerText = sanitizedCss.css;\n            }\n            global.document.head.append(style);\n        }\n    }\n    /**\n     * Removes existing `<style>` elements injected by the plugin and renders new ones from the full page data.\n     */\n    _renderStylesFromHead(root) {\n        this._removeStyleElementsFromDom();\n        this._renderStyleElementsInDom(root);\n    }\n}\n/**\n * Normalize the Full page configuration option `allowRenderStylesFromHead`.\n */\nfunction isAllowedRenderStylesFromHead(editor) {\n    return editor.config.get('htmlSupport.fullPage.allowRenderStylesFromHead');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/ui/charactergridview\n */\nimport { View, ButtonView, addKeyboardHandlingForGrid } from 'ckeditor5/src/ui.js';\nimport { KeystrokeHandler, FocusTracker, global } from 'ckeditor5/src/utils.js';\nimport '../../theme/charactergrid.css';\n/**\n * A grid of character tiles. It allows browsing special characters and selecting the character to\n * be inserted into the content.\n *\n * @internal\n */\nexport class CharacterGridView extends View {\n    /**\n     * A collection of the child tile views. Each tile represents a particular character.\n     */\n    tiles;\n    /**\n     * Tracks information about the DOM focus in the grid.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * Creates an instance of a character grid containing tiles representing special characters.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        this.tiles = this.createCollection();\n        this.setTemplate({\n            tag: 'div',\n            children: [\n                {\n                    tag: 'div',\n                    attributes: {\n                        class: [\n                            'ck',\n                            'ck-character-grid__tiles'\n                        ]\n                    },\n                    children: this.tiles\n                }\n            ],\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-character-grid'\n                ]\n            }\n        });\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        addKeyboardHandlingForGrid({\n            keystrokeHandler: this.keystrokes,\n            focusTracker: this.focusTracker,\n            gridItems: this.tiles,\n            numberOfColumns: () => global.window\n                .getComputedStyle(this.element.firstChild) // Responsive .ck-character-grid__tiles\n                .getPropertyValue('grid-template-columns')\n                .split(' ')\n                .length,\n            uiLanguageDirection: this.locale && this.locale.uiLanguageDirection\n        });\n    }\n    /**\n     * Creates a new tile for the grid.\n     *\n     * @param character A human-readable character displayed as the label (e.g. \"ε\").\n     * @param name The name of the character (e.g. \"greek small letter epsilon\").\n     */\n    createTile(character, name) {\n        const tile = new ButtonView(this.locale);\n        tile.set({\n            label: character,\n            withText: true,\n            class: 'ck-character-grid__tile'\n        });\n        // Labels are vital for the users to understand what character they're looking at.\n        // For now we're using native title attribute for that, see #5817.\n        tile.extendTemplate({\n            attributes: {\n                title: name\n            },\n            on: {\n                mouseover: tile.bindTemplate.to('mouseover'),\n                focus: tile.bindTemplate.to('focus')\n            }\n        });\n        tile.on('mouseover', () => {\n            this.fire('tileHover', { name, character });\n        });\n        tile.on('focus', () => {\n            this.fire('tileFocus', { name, character });\n        });\n        tile.on('execute', () => {\n            this.fire('execute', { name, character });\n        });\n        return tile;\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        for (const item of this.tiles) {\n            this.focusTracker.add(item.element);\n        }\n        this.tiles.on('change', (eventInfo, { added, removed }) => {\n            if (added.length > 0) {\n                for (const item of added) {\n                    this.focusTracker.add(item.element);\n                }\n            }\n            if (removed.length > 0) {\n                for (const item of removed) {\n                    this.focusTracker.remove(item.element);\n                }\n            }\n        });\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the first focusable in {@link ~CharacterGridView#tiles}.\n     */\n    focus() {\n        this.tiles.first.focus();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { View } from 'ckeditor5/src/ui.js';\nimport '../../theme/characterinfo.css';\n/**\n * The view displaying detailed information about a special character glyph, e.g. upon\n * hovering it with a mouse.\n *\n * @internal\n */\nexport class CharacterInfoView extends View {\n    constructor(locale) {\n        super(locale);\n        const bind = this.bindTemplate;\n        this.set('character', null);\n        this.set('name', null);\n        this.bind('code').to(this, 'character', characterToUnicodeString);\n        this.setTemplate({\n            tag: 'div',\n            children: [\n                {\n                    tag: 'span',\n                    attributes: {\n                        class: [\n                            'ck-character-info__name'\n                        ]\n                    },\n                    children: [\n                        {\n                            // Note: ZWSP to prevent vertical collapsing.\n                            text: bind.to('name', name => name ? name : '\\u200B')\n                        }\n                    ]\n                },\n                {\n                    tag: 'span',\n                    attributes: {\n                        class: [\n                            'ck-character-info__code'\n                        ]\n                    },\n                    children: [\n                        {\n                            text: bind.to('code')\n                        }\n                    ]\n                }\n            ],\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-character-info'\n                ]\n            }\n        });\n    }\n}\n/**\n * Converts a character into a \"Unicode string\", for instance:\n *\n * \"$\" -> \"U+0024\"\n *\n * Returns an empty string when the character is `null`.\n */\nfunction characterToUnicodeString(character) {\n    if (character === null) {\n        return '';\n    }\n    const hexCode = character.codePointAt(0).toString(16);\n    return 'U+' + ('0000' + hexCode).slice(-4);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/ui/specialcharactersview\n */\nimport { View, FocusCycler } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';\n/**\n * A view that glues pieces of the special characters dropdown panel together:\n *\n * * the navigation view (allows selecting the category),\n * * the grid view (displays characters as a grid),\n * * and the info view (displays detailed info about a specific character).\n *\n * @internal\n */\nexport class SpecialCharactersView extends View {\n    /**\n     * A collection of the focusable children of the view.\n     */\n    items;\n    /**\n     * Tracks information about the DOM focus in the view.\n     */\n    focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    keystrokes;\n    /**\n     * Helps cycling over focusable {@link #items} in the view.\n     */\n    _focusCycler;\n    /**\n     * An instance of the `SpecialCharactersCategoriesView`.\n     */\n    categoriesView;\n    /**\n     * An instance of the `CharacterGridView`.\n     */\n    gridView;\n    /**\n     * An instance of the `CharacterInfoView`.\n     */\n    infoView;\n    /**\n     * Creates an instance of the `SpecialCharactersView`.\n     */\n    constructor(locale, categoriesView, gridView, infoView) {\n        super(locale);\n        this.categoriesView = categoriesView;\n        this.gridView = gridView;\n        this.infoView = infoView;\n        this.items = this.createCollection();\n        this.focusTracker = new FocusTracker();\n        this.keystrokes = new KeystrokeHandler();\n        this._focusCycler = new FocusCycler({\n            focusables: this.items,\n            focusTracker: this.focusTracker,\n            keystrokeHandler: this.keystrokes,\n            actions: {\n                focusPrevious: 'shift + tab',\n                focusNext: 'tab'\n            }\n        });\n        this.setTemplate({\n            tag: 'div',\n            children: [\n                this.categoriesView,\n                this.gridView,\n                this.infoView\n            ],\n            attributes: {\n                // Avoid focus loss when the user clicks the area of the grid that is not a button.\n                // https://github.com/ckeditor/ckeditor5/pull/12319#issuecomment-1231779819\n                tabindex: '-1'\n            }\n        });\n        this.items.add(this.categoriesView);\n        this.items.add(this.gridView);\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this.focusTracker.add(this.categoriesView.element);\n        this.focusTracker.add(this.gridView.element);\n        // Start listening for the keystrokes coming from #element.\n        this.keystrokes.listenTo(this.element);\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this.focusTracker.destroy();\n        this.keystrokes.destroy();\n    }\n    /**\n     * Focuses the first focusable in {@link #items}.\n     */\n    focus() {\n        this._focusCycler.focusFirst();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/ui/specialcharacterscategoriesview\n */\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { addListToDropdown, createLabeledDropdown, LabeledFieldView, View, UIModel } from 'ckeditor5/src/ui.js';\n/**\n * A class representing the navigation part of the special characters UI. It is responsible\n * for describing the feature and allowing the user to select a particular character group.\n *\n * @internal\n */\nexport class SpecialCharactersCategoriesView extends View {\n    _groupNames;\n    _dropdownView;\n    /**\n     * Creates an instance of the {@link module:special-characters/ui/specialcharacterscategoriesview~SpecialCharactersCategoriesView}\n     * class.\n     *\n     * @param locale The localization services instance.\n     * @param groupNames The names of the character groups.\n     */\n    constructor(locale, groupNames) {\n        super(locale);\n        this.set('currentGroupName', Array.from(groupNames.entries())[0][0]);\n        this._groupNames = groupNames;\n        this._dropdownView = new LabeledFieldView(locale, createLabeledDropdown);\n        this.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-character-categories']\n            },\n            children: [\n                this._dropdownView\n            ]\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        this._setupDropdown();\n    }\n    /**\n     * @inheritDoc\n     */\n    focus() {\n        this._dropdownView.focus();\n    }\n    /**\n     * Creates dropdown item list, sets up bindings and fills properties.\n     */\n    _setupDropdown() {\n        const items = new Collection();\n        for (const [name, label] of this._groupNames) {\n            const item = {\n                type: 'button',\n                model: new UIModel({\n                    name,\n                    label,\n                    role: 'menuitemradio',\n                    withText: true\n                })\n            };\n            item.model.bind('isOn').to(this, 'currentGroupName', value => {\n                return value === name;\n            });\n            items.add(item);\n        }\n        const t = this.locale.t;\n        const accessibleLabel = t('Category');\n        this._dropdownView.set({\n            label: accessibleLabel,\n            isEmpty: false\n        });\n        this._dropdownView.fieldView.panelPosition = this.locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';\n        this._dropdownView.fieldView.buttonView.set({\n            withText: true,\n            tooltip: accessibleLabel,\n            ariaLabel: accessibleLabel,\n            ariaLabelledBy: undefined,\n            isOn: false\n        });\n        this._dropdownView.fieldView.buttonView.bind('label')\n            .to(this, 'currentGroupName', value => this._groupNames.get(value));\n        this._dropdownView.fieldView.on('execute', ({ source }) => {\n            this.currentGroupName = source.name;\n        });\n        addListToDropdown(this._dropdownView.fieldView, items, {\n            ariaLabel: accessibleLabel,\n            role: 'menu'\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharacters\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Typing } from 'ckeditor5/src/typing.js';\nimport { IconSpecialCharacters } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView, DialogViewPosition, Dialog } from 'ckeditor5/src/ui.js';\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\nimport { CharacterGridView } from './ui/charactergridview.js';\nimport { CharacterInfoView } from './ui/characterinfoview.js';\nimport { SpecialCharactersView } from './ui/specialcharactersview.js';\nimport '../theme/specialcharacters.css';\nimport { SpecialCharactersCategoriesView } from './ui/specialcharacterscategoriesview.js';\nconst ALL_SPECIAL_CHARACTERS_GROUP = 'All';\n/**\n * The special characters feature.\n *\n * Introduces the `'specialCharacters'` dropdown.\n */\nexport class SpecialCharacters extends Plugin {\n    /**\n     * Registered characters. A pair of a character name and its symbol.\n     */\n    _characters;\n    /**\n     * Registered groups. Each group contains a displayed label and a collection with symbol names.\n     */\n    _groups;\n    /**\n     * A label describing the \"All\" special characters category.\n     */\n    _allSpecialCharactersGroupLabel;\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Typing, Dialog];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharacters';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'SCH';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        const t = editor.t;\n        this._characters = new Map();\n        this._groups = new Map();\n        this._allSpecialCharactersGroupLabel = t('All');\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('specialCharacters', () => {\n            const button = this._createDialogButton(ButtonView);\n            button.set({\n                tooltip: true\n            });\n            return button;\n        });\n        editor.ui.componentFactory.add('menuBar:specialCharacters', () => {\n            return this._createDialogButton(MenuBarMenuListItemButtonView);\n        });\n    }\n    /**\n     * Adds a collection of special characters to the specified group. The title of a special character must be unique.\n     *\n     * **Note:** The \"All\" category name is reserved by the plugin and cannot be used as a new name for a special\n     * characters category.\n     */\n    addItems(groupName, items, options = { label: groupName }) {\n        if (groupName === ALL_SPECIAL_CHARACTERS_GROUP) {\n            /**\n             * The name \"All\" for a special category group cannot be used because it is a special category that displays all\n             * available special characters.\n             *\n             * @error special-character-invalid-group-name\n             */\n            throw new CKEditorError('special-character-invalid-group-name', null);\n        }\n        const group = this._getGroup(groupName, options.label);\n        for (const item of items) {\n            group.items.add(item.title);\n            this._characters.set(item.title, item.character);\n        }\n    }\n    /**\n     * Returns special character groups in an order determined based on configuration and registration sequence.\n     */\n    getGroups() {\n        const groups = Array.from(this._groups.keys());\n        const order = this.editor.config.get('specialCharacters.order') || [];\n        const invalidGroup = order.find(item => !groups.includes(item));\n        if (invalidGroup) {\n            /**\n             * One of the special character groups in the \"specialCharacters.order\" configuration doesn't exist.\n             *\n             * @error special-character-invalid-order-group-name\n             */\n            throw new CKEditorError('special-character-invalid-order-group-name', null, { invalidGroup });\n        }\n        return new Set([\n            ...order,\n            ...groups\n        ]);\n    }\n    /**\n     * Returns a collection of special characters symbol names (titles).\n     */\n    getCharactersForGroup(groupName) {\n        if (groupName === ALL_SPECIAL_CHARACTERS_GROUP) {\n            return new Set(this._characters.keys());\n        }\n        const group = this._groups.get(groupName);\n        if (group) {\n            return group.items;\n        }\n    }\n    /**\n     * Returns the symbol of a special character for the specified name. If the special character could not be found, `undefined`\n     * is returned.\n     *\n     * @param title The title of a special character.\n     */\n    getCharacter(title) {\n        return this._characters.get(title);\n    }\n    /**\n     * Returns a group of special characters. If the group with the specified name does not exist, it will be created.\n     *\n     * @param groupName The name of the group to create.\n     * @param label The label describing the new group.\n     */\n    _getGroup(groupName, label) {\n        if (!this._groups.has(groupName)) {\n            this._groups.set(groupName, {\n                items: new Set(),\n                label\n            });\n        }\n        return this._groups.get(groupName);\n    }\n    /**\n     * Updates the symbol grid depending on the currently selected character group.\n     */\n    _updateGrid(currentGroupName, gridView) {\n        // Updating the grid starts with removing all tiles belonging to the old group.\n        gridView.tiles.clear();\n        const characterTitles = this.getCharactersForGroup(currentGroupName);\n        for (const title of characterTitles) {\n            const character = this.getCharacter(title);\n            gridView.tiles.add(gridView.createTile(character, title));\n        }\n    }\n    /**\n     * Initializes the dropdown, used for lazy loading.\n     *\n     * @returns An object with `categoriesView`, `gridView` and `infoView` properties, containing UI parts.\n     */\n    _createDropdownPanelContent(locale) {\n        const groupEntries = Array\n            .from(this.getGroups())\n            .map(name => ([name, this._groups.get(name).label]));\n        // The map contains a name of category (an identifier) and its label (a translational string).\n        const specialCharsGroups = new Map([\n            // Add a special group that shows all available special characters.\n            [ALL_SPECIAL_CHARACTERS_GROUP, this._allSpecialCharactersGroupLabel],\n            ...groupEntries\n        ]);\n        const categoriesView = new SpecialCharactersCategoriesView(locale, specialCharsGroups);\n        const gridView = new CharacterGridView(locale);\n        const infoView = new CharacterInfoView(locale);\n        gridView.on('tileHover', (evt, data) => {\n            infoView.set(data);\n        });\n        gridView.on('tileFocus', (evt, data) => {\n            infoView.set(data);\n        });\n        // Update the grid of special characters when a user changed the character group.\n        categoriesView.on('change:currentGroupName', (evt, propertyName, newValue) => {\n            this._updateGrid(newValue, gridView);\n        });\n        // Set the initial content of the special characters grid.\n        this._updateGrid(categoriesView.currentGroupName, gridView);\n        return { categoriesView, gridView, infoView };\n    }\n    /**\n     * Creates a button for toolbar and menu bar that will show special characters dialog.\n     */\n    _createDialogButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const buttonView = new ButtonClass(editor.locale);\n        const command = editor.commands.get('insertText');\n        const t = locale.t;\n        const dialogPlugin = this.editor.plugins.get('Dialog');\n        buttonView.set({\n            label: t('Special characters'),\n            icon: IconSpecialCharacters,\n            isToggleable: true\n        });\n        buttonView.bind('isOn').to(dialogPlugin, 'id', id => id === 'specialCharacters');\n        buttonView.bind('isEnabled').to(command, 'isEnabled');\n        buttonView.on('execute', () => {\n            if (dialogPlugin.id === 'specialCharacters') {\n                dialogPlugin.hide();\n                return;\n            }\n            this._showDialog();\n        });\n        return buttonView;\n    }\n    _showDialog() {\n        const editor = this.editor;\n        const dialog = editor.plugins.get('Dialog');\n        const locale = editor.locale;\n        const t = locale.t;\n        const { categoriesView, gridView, infoView } = this._createDropdownPanelContent(locale);\n        const content = new SpecialCharactersView(locale, categoriesView, gridView, infoView);\n        gridView.on('execute', (evt, data) => {\n            editor.execute('insertText', { text: data.character });\n        });\n        dialog.show({\n            id: 'specialCharacters',\n            title: t('Special characters'),\n            className: 'ck-special-characters',\n            content,\n            position: DialogViewPosition.EDITOR_TOP_SIDE\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharactersarrows\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\n/**\n * A plugin that provides special characters for the \"Arrows\" category.\n *\n * ```ts\n * ClassicEditor\n *   .create( {\n *     plugins: [ ..., SpecialCharacters, SpecialCharactersArrows ],\n *   } )\n *   .then( ... )\n *   .catch( ... );\n * ```\n */\nexport class SpecialCharactersArrows extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharactersArrows';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const plugin = editor.plugins.get('SpecialCharacters');\n        plugin.addItems('Arrows', [\n            { title: t('leftwards simple arrow'), character: '←' },\n            { title: t('rightwards simple arrow'), character: '→' },\n            { title: t('upwards simple arrow'), character: '↑' },\n            { title: t('downwards simple arrow'), character: '↓' },\n            { title: t('leftwards double arrow'), character: '⇐' },\n            { title: t('rightwards double arrow'), character: '⇒' },\n            { title: t('upwards double arrow'), character: '⇑' },\n            { title: t('downwards double arrow'), character: '⇓' },\n            { title: t('leftwards dashed arrow'), character: '⇠' },\n            { title: t('rightwards dashed arrow'), character: '⇢' },\n            { title: t('upwards dashed arrow'), character: '⇡' },\n            { title: t('downwards dashed arrow'), character: '⇣' },\n            { title: t('leftwards arrow to bar'), character: '⇤' },\n            { title: t('rightwards arrow to bar'), character: '⇥' },\n            { title: t('upwards arrow to bar'), character: '⤒' },\n            { title: t('downwards arrow to bar'), character: '⤓' },\n            { title: t('up down arrow with base'), character: '↨' },\n            { title: t('back with leftwards arrow above'), character: '🔙' },\n            { title: t('end with leftwards arrow above'), character: '🔚' },\n            { title: t('on with exclamation mark with left right arrow above'), character: '🔛' },\n            { title: t('soon with rightwards arrow above'), character: '🔜' },\n            { title: t('top with upwards arrow above'), character: '🔝' }\n        ], { label: t('Arrows') });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharacterstext\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\n/**\n * A plugin that provides special characters for the \"Text\" category.\n *\n * ```ts\n * ClassicEditor\n *   .create( {\n *     plugins: [ ..., SpecialCharacters, SpecialCharactersText ],\n *   } )\n *   .then( ... )\n *   .catch( ... );\n * ```\n */\nexport class SpecialCharactersText extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharactersText';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const plugin = editor.plugins.get('SpecialCharacters');\n        plugin.addItems('Text', [\n            { character: '‹', title: t('Single left-pointing angle quotation mark') },\n            { character: '›', title: t('Single right-pointing angle quotation mark') },\n            { character: '«', title: t('Left-pointing double angle quotation mark') },\n            { character: '»', title: t('Right-pointing double angle quotation mark') },\n            { character: '‘', title: t('Left single quotation mark') },\n            { character: '’', title: t('Right single quotation mark') },\n            { character: '“', title: t('Left double quotation mark') },\n            { character: '”', title: t('Right double quotation mark') },\n            { character: '‚', title: t('Single low-9 quotation mark') },\n            { character: '„', title: t('Double low-9 quotation mark') },\n            { character: '¡', title: t('Inverted exclamation mark') },\n            { character: '¿', title: t('Inverted question mark') },\n            { character: '‥', title: t('Two dot leader') },\n            { character: '…', title: t('Horizontal ellipsis') },\n            { character: '‡', title: t('Double dagger') },\n            { character: '‰', title: t('Per mille sign') },\n            { character: '‱', title: t('Per ten thousand sign') },\n            { character: '‼', title: t('Double exclamation mark') },\n            { character: '⁈', title: t('Question exclamation mark') },\n            { character: '⁉', title: t('Exclamation question mark') },\n            { character: '⁇', title: t('Double question mark') },\n            { character: '©', title: t('Copyright sign') },\n            { character: '®', title: t('Registered sign') },\n            { character: '™', title: t('Trade mark sign') },\n            { character: '§', title: t('Section sign') },\n            { character: '¶', title: t('Paragraph sign') },\n            { character: '⁋', title: t('Reversed paragraph sign') }\n        ], { label: t('Text') });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharactersmathematical\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\n/**\n * A plugin that provides special characters for the \"Mathematical\" category.\n *\n * ```ts\n * ClassicEditor\n *   .create( {\n *     plugins: [ ..., SpecialCharacters, SpecialCharactersMathematical ],\n *   } )\n *   .then( ... )\n *   .catch( ... );\n * ```\n */\nexport class SpecialCharactersMathematical extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharactersMathematical';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const plugin = editor.plugins.get('SpecialCharacters');\n        plugin.addItems('Mathematical', [\n            { character: '<', title: t('Less-than sign') },\n            { character: '>', title: t('Greater-than sign') },\n            { character: '≤', title: t('Less-than or equal to') },\n            { character: '≥', title: t('Greater-than or equal to') },\n            { character: '–', title: t('En dash') },\n            { character: '—', title: t('Em dash') },\n            { character: '¯', title: t('Macron') },\n            { character: '‾', title: t('Overline') },\n            { character: '°', title: t('Degree sign') },\n            { character: '−', title: t('Minus sign') },\n            { character: '±', title: t('Plus-minus sign') },\n            { character: '÷', title: t('Division sign') },\n            { character: '⁄', title: t('Fraction slash') },\n            { character: '×', title: t('Multiplication sign') },\n            { character: 'ƒ', title: t('Latin small letter f with hook') },\n            { character: '∫', title: t('Integral') },\n            { character: '∑', title: t('N-ary summation') },\n            { character: '∞', title: t('Infinity') },\n            { character: '√', title: t('Square root') },\n            { character: '∼', title: t('Tilde operator') },\n            { character: '≅', title: t('Approximately equal to') },\n            { character: '≈', title: t('Almost equal to') },\n            { character: '≠', title: t('Not equal to') },\n            { character: '≡', title: t('Identical to') },\n            { character: '∈', title: t('Element of') },\n            { character: '∉', title: t('Not an element of') },\n            { character: '∋', title: t('Contains as member') },\n            { character: '∏', title: t('N-ary product') },\n            { character: '∧', title: t('Logical and') },\n            { character: '∨', title: t('Logical or') },\n            { character: '¬', title: t('Not sign') },\n            { character: '∩', title: t('Intersection') },\n            { character: '∪', title: t('Union') },\n            { character: '∂', title: t('Partial differential') },\n            { character: '∀', title: t('For all') },\n            { character: '∃', title: t('There exists') },\n            { character: '∅', title: t('Empty set') },\n            { character: '∇', title: t('Nabla') },\n            { character: '∗', title: t('Asterisk operator') },\n            { character: '∝', title: t('Proportional to') },\n            { character: '∠', title: t('Angle') },\n            { character: '¼', title: t('Vulgar fraction one quarter') },\n            { character: '½', title: t('Vulgar fraction one half') },\n            { character: '¾', title: t('Vulgar fraction three quarters') }\n        ], { label: t('Mathematical') });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharacterslatin\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\n/**\n * A plugin that provides special characters for the \"Latin\" category.\n *\n * ```ts\n * ClassicEditor\n *   .create( {\n *     plugins: [ ..., SpecialCharacters, SpecialCharactersLatin ],\n *   } )\n *   .then( ... )\n *   .catch( ... );\n * ```\n */\nexport class SpecialCharactersLatin extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharactersLatin';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const plugin = editor.plugins.get('SpecialCharacters');\n        plugin.addItems('Latin', [\n            { character: 'Ā', title: t('Latin capital letter a with macron') },\n            { character: 'ā', title: t('Latin small letter a with macron') },\n            { character: 'Ă', title: t('Latin capital letter a with breve') },\n            { character: 'ă', title: t('Latin small letter a with breve') },\n            { character: 'Ą', title: t('Latin capital letter a with ogonek') },\n            { character: 'ą', title: t('Latin small letter a with ogonek') },\n            { character: 'Ć', title: t('Latin capital letter c with acute') },\n            { character: 'ć', title: t('Latin small letter c with acute') },\n            { character: 'Ĉ', title: t('Latin capital letter c with circumflex') },\n            { character: 'ĉ', title: t('Latin small letter c with circumflex') },\n            { character: 'Ċ', title: t('Latin capital letter c with dot above') },\n            { character: 'ċ', title: t('Latin small letter c with dot above') },\n            { character: 'Č', title: t('Latin capital letter c with caron') },\n            { character: 'č', title: t('Latin small letter c with caron') },\n            { character: 'Ď', title: t('Latin capital letter d with caron') },\n            { character: 'ď', title: t('Latin small letter d with caron') },\n            { character: 'Đ', title: t('Latin capital letter d with stroke') },\n            { character: 'đ', title: t('Latin small letter d with stroke') },\n            { character: 'Ē', title: t('Latin capital letter e with macron') },\n            { character: 'ē', title: t('Latin small letter e with macron') },\n            { character: 'Ĕ', title: t('Latin capital letter e with breve') },\n            { character: 'ĕ', title: t('Latin small letter e with breve') },\n            { character: 'Ė', title: t('Latin capital letter e with dot above') },\n            { character: 'ė', title: t('Latin small letter e with dot above') },\n            { character: 'Ę', title: t('Latin capital letter e with ogonek') },\n            { character: 'ę', title: t('Latin small letter e with ogonek') },\n            { character: 'Ě', title: t('Latin capital letter e with caron') },\n            { character: 'ě', title: t('Latin small letter e with caron') },\n            { character: 'Ĝ', title: t('Latin capital letter g with circumflex') },\n            { character: 'ĝ', title: t('Latin small letter g with circumflex') },\n            { character: 'Ğ', title: t('Latin capital letter g with breve') },\n            { character: 'ğ', title: t('Latin small letter g with breve') },\n            { character: 'Ġ', title: t('Latin capital letter g with dot above') },\n            { character: 'ġ', title: t('Latin small letter g with dot above') },\n            { character: 'Ģ', title: t('Latin capital letter g with cedilla') },\n            { character: 'ģ', title: t('Latin small letter g with cedilla') },\n            { character: 'Ĥ', title: t('Latin capital letter h with circumflex') },\n            { character: 'ĥ', title: t('Latin small letter h with circumflex') },\n            { character: 'Ħ', title: t('Latin capital letter h with stroke') },\n            { character: 'ħ', title: t('Latin small letter h with stroke') },\n            { character: 'Ĩ', title: t('Latin capital letter i with tilde') },\n            { character: 'ĩ', title: t('Latin small letter i with tilde') },\n            { character: 'Ī', title: t('Latin capital letter i with macron') },\n            { character: 'ī', title: t('Latin small letter i with macron') },\n            { character: 'Ĭ', title: t('Latin capital letter i with breve') },\n            { character: 'ĭ', title: t('Latin small letter i with breve') },\n            { character: 'Į', title: t('Latin capital letter i with ogonek') },\n            { character: 'į', title: t('Latin small letter i with ogonek') },\n            { character: 'İ', title: t('Latin capital letter i with dot above') },\n            { character: 'ı', title: t('Latin small letter dotless i') },\n            { character: 'Ĳ', title: t('Latin capital ligature ij') },\n            { character: 'ĳ', title: t('Latin small ligature ij') },\n            { character: 'Ĵ', title: t('Latin capital letter j with circumflex') },\n            { character: 'ĵ', title: t('Latin small letter j with circumflex') },\n            { character: 'Ķ', title: t('Latin capital letter k with cedilla') },\n            { character: 'ķ', title: t('Latin small letter k with cedilla') },\n            { character: 'ĸ', title: t('Latin small letter kra') },\n            { character: 'Ĺ', title: t('Latin capital letter l with acute') },\n            { character: 'ĺ', title: t('Latin small letter l with acute') },\n            { character: 'Ļ', title: t('Latin capital letter l with cedilla') },\n            { character: 'ļ', title: t('Latin small letter l with cedilla') },\n            { character: 'Ľ', title: t('Latin capital letter l with caron') },\n            { character: 'ľ', title: t('Latin small letter l with caron') },\n            { character: 'Ŀ', title: t('Latin capital letter l with middle dot') },\n            { character: 'ŀ', title: t('Latin small letter l with middle dot') },\n            { character: 'Ł', title: t('Latin capital letter l with stroke') },\n            { character: 'ł', title: t('Latin small letter l with stroke') },\n            { character: 'Ń', title: t('Latin capital letter n with acute') },\n            { character: 'ń', title: t('Latin small letter n with acute') },\n            { character: 'Ņ', title: t('Latin capital letter n with cedilla') },\n            { character: 'ņ', title: t('Latin small letter n with cedilla') },\n            { character: 'Ň', title: t('Latin capital letter n with caron') },\n            { character: 'ň', title: t('Latin small letter n with caron') },\n            { character: 'ŉ', title: t('Latin small letter n preceded by apostrophe') },\n            { character: 'Ŋ', title: t('Latin capital letter eng') },\n            { character: 'ŋ', title: t('Latin small letter eng') },\n            { character: 'Ō', title: t('Latin capital letter o with macron') },\n            { character: 'ō', title: t('Latin small letter o with macron') },\n            { character: 'Ŏ', title: t('Latin capital letter o with breve') },\n            { character: 'ŏ', title: t('Latin small letter o with breve') },\n            { character: 'Ő', title: t('Latin capital letter o with double acute') },\n            { character: 'ő', title: t('Latin small letter o with double acute') },\n            { character: 'Œ', title: t('Latin capital ligature oe') },\n            { character: 'œ', title: t('Latin small ligature oe') },\n            { character: 'Ŕ', title: t('Latin capital letter r with acute') },\n            { character: 'ŕ', title: t('Latin small letter r with acute') },\n            { character: 'Ŗ', title: t('Latin capital letter r with cedilla') },\n            { character: 'ŗ', title: t('Latin small letter r with cedilla') },\n            { character: 'Ř', title: t('Latin capital letter r with caron') },\n            { character: 'ř', title: t('Latin small letter r with caron') },\n            { character: 'Ś', title: t('Latin capital letter s with acute') },\n            { character: 'ś', title: t('Latin small letter s with acute') },\n            { character: 'Ŝ', title: t('Latin capital letter s with circumflex') },\n            { character: 'ŝ', title: t('Latin small letter s with circumflex') },\n            { character: 'Ş', title: t('Latin capital letter s with cedilla') },\n            { character: 'ş', title: t('Latin small letter s with cedilla') },\n            { character: 'Š', title: t('Latin capital letter s with caron') },\n            { character: 'š', title: t('Latin small letter s with caron') },\n            { character: 'Ţ', title: t('Latin capital letter t with cedilla') },\n            { character: 'ţ', title: t('Latin small letter t with cedilla') },\n            { character: 'Ť', title: t('Latin capital letter t with caron') },\n            { character: 'ť', title: t('Latin small letter t with caron') },\n            { character: 'Ŧ', title: t('Latin capital letter t with stroke') },\n            { character: 'ŧ', title: t('Latin small letter t with stroke') },\n            { character: 'Ũ', title: t('Latin capital letter u with tilde') },\n            { character: 'ũ', title: t('Latin small letter u with tilde') },\n            { character: 'Ū', title: t('Latin capital letter u with macron') },\n            { character: 'ū', title: t('Latin small letter u with macron') },\n            { character: 'Ŭ', title: t('Latin capital letter u with breve') },\n            { character: 'ŭ', title: t('Latin small letter u with breve') },\n            { character: 'Ů', title: t('Latin capital letter u with ring above') },\n            { character: 'ů', title: t('Latin small letter u with ring above') },\n            { character: 'Ű', title: t('Latin capital letter u with double acute') },\n            { character: 'ű', title: t('Latin small letter u with double acute') },\n            { character: 'Ų', title: t('Latin capital letter u with ogonek') },\n            { character: 'ų', title: t('Latin small letter u with ogonek') },\n            { character: 'Ŵ', title: t('Latin capital letter w with circumflex') },\n            { character: 'ŵ', title: t('Latin small letter w with circumflex') },\n            { character: 'Ŷ', title: t('Latin capital letter y with circumflex') },\n            { character: 'ŷ', title: t('Latin small letter y with circumflex') },\n            { character: 'Ÿ', title: t('Latin capital letter y with diaeresis') },\n            { character: 'Ź', title: t('Latin capital letter z with acute') },\n            { character: 'ź', title: t('Latin small letter z with acute') },\n            { character: 'Ż', title: t('Latin capital letter z with dot above') },\n            { character: 'ż', title: t('Latin small letter z with dot above') },\n            { character: 'Ž', title: t('Latin capital letter z with caron') },\n            { character: 'ž', title: t('Latin small letter z with caron') },\n            { character: 'ſ', title: t('Latin small letter long s') }\n        ], { label: t('Latin') });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharacterscurrency\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\n/**\n * A plugin that provides special characters for the \"Currency\" category.\n *\n * ```ts\n * ClassicEditor\n *   .create( {\n *     plugins: [ ..., SpecialCharacters, SpecialCharactersCurrency ],\n *   } )\n *   .then( ... )\n *   .catch( ... );\n * ```\n */\nexport class SpecialCharactersCurrency extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharactersCurrency';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const t = editor.t;\n        const plugin = editor.plugins.get('SpecialCharacters');\n        plugin.addItems('Currency', [\n            { character: '$', title: t('Dollar sign') },\n            { character: '€', title: t('Euro sign') },\n            { character: '¥', title: t('Yen sign') },\n            { character: '£', title: t('Pound sign') },\n            { character: '¢', title: t('Cent sign') },\n            { character: '₠', title: t('Euro-currency sign') },\n            { character: '₡', title: t('Colon sign') },\n            { character: '₢', title: t('Cruzeiro sign') },\n            { character: '₣', title: t('French franc sign') },\n            { character: '₤', title: t('Lira sign') },\n            { character: '¤', title: t('Currency sign') },\n            { character: '₿', title: t('Bitcoin sign') },\n            { character: '₥', title: t('Mill sign') },\n            { character: '₦', title: t('Naira sign') },\n            { character: '₧', title: t('Peseta sign') },\n            { character: '₨', title: t('Rupee sign') },\n            { character: '₩', title: t('Won sign') },\n            { character: '₪', title: t('New sheqel sign') },\n            { character: '₫', title: t('Dong sign') },\n            { character: '₭', title: t('Kip sign') },\n            { character: '₮', title: t('Tugrik sign') },\n            { character: '₯', title: t('Drachma sign') },\n            { character: '₰', title: t('German penny sign') },\n            { character: '₱', title: t('Peso sign') },\n            { character: '₲', title: t('Guarani sign') },\n            { character: '₳', title: t('Austral sign') },\n            { character: '₴', title: t('Hryvnia sign') },\n            { character: '₵', title: t('Cedi sign') },\n            { character: '₶', title: t('Livre tournois sign') },\n            { character: '₷', title: t('Spesmilo sign') },\n            { character: '₸', title: t('Tenge sign') },\n            { character: '₹', title: t('Indian rupee sign') },\n            { character: '₺', title: t('Turkish lira sign') },\n            { character: '₻', title: t('Nordic mark sign') },\n            { character: '₼', title: t('Manat sign') },\n            { character: '₽', title: t('Ruble sign') }\n        ], { label: t('Currency') });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module show-blocks/showblockscommand\n */\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The show blocks command.\n *\n * Displays the HTML element names for content blocks.\n */\nexport class ShowBlocksCommand extends Command {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        // It does not affect data so should be enabled in read-only mode.\n        this.affectsData = false;\n        this.value = false;\n    }\n    /**\n     * Toggles the visibility of content blocks.\n     */\n    execute() {\n        const CLASS_NAME = 'ck-show-blocks';\n        const view = this.editor.editing.view;\n        view.change(writer => {\n            // Multiroot support.\n            for (const root of view.document.roots) {\n                if (!root.hasClass(CLASS_NAME)) {\n                    writer.addClass(CLASS_NAME, root);\n                    this.value = true;\n                }\n                else {\n                    writer.removeClass(CLASS_NAME, root);\n                    this.value = false;\n                }\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module show-blocks/showblocksediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ShowBlocksCommand } from './showblockscommand.js';\n/**\n * The show blocks editing plugin.\n */\nexport class ShowBlocksEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ShowBlocksEditing';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const { editor } = this;\n        editor.commands.add('showBlocks', new ShowBlocksCommand(editor));\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module show-blocks/showblocksui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconShowBlocks } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';\nimport '../theme/showblocks.css';\n/**\n * The UI plugin of the show blocks feature.\n *\n * It registers the `'showBlocks'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}\n * that toggles the visibility of the HTML element names of content blocks.\n */\nexport class ShowBlocksUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ShowBlocksUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.ui.componentFactory.add('showBlocks', () => {\n            const buttonView = this._createButton(ButtonView);\n            buttonView.set({\n                tooltip: true,\n                icon: IconShowBlocks\n            });\n            return buttonView;\n        });\n        editor.ui.componentFactory.add('menuBar:showBlocks', () => {\n            return this._createButton(MenuBarMenuListItemButtonView);\n        });\n    }\n    /**\n     * Creates a button for show blocks command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const locale = editor.locale;\n        const command = editor.commands.get('showBlocks');\n        const view = new ButtonClass(locale);\n        const t = locale.t;\n        view.set({\n            label: t('Show blocks'),\n            isToggleable: true,\n            role: 'menuitemcheckbox'\n        });\n        view.bind('isEnabled').to(command);\n        view.bind('isOn').to(command, 'value', command, 'isEnabled', (value, isEnabled) => value && isEnabled);\n        // Execute the command.\n        this.listenTo(view, 'execute', () => {\n            editor.execute('showBlocks');\n            editor.editing.view.focus();\n        });\n        return view;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m6.395 9.196 2.545-.007V6.498a.6.6 0 0 1 .598-.598h.299a.6.6 0 0 1 .598.598v6.877a.6.6 0 0 1-.598.598h-.299a.6.6 0 0 1-.598-.598v-2.691l-2.545.007v2.691a.6.6 0 0 1-.598.598h-.299a.6.6 0 0 1-.598-.598V6.505a.6.6 0 0 1 .598-.598h.299a.6.6 0 0 1 .598.598zm8.699 4.221V6.462a.56.56 0 0 0-.562-.562h-.782a1 1 0 0 0-.39.08l-1.017.43a.56.56 0 0 0-.343.517v.197c0 .4.406.67.775.519l.819-.337v6.111c0 .31.251.562.561.562h.377c.31 0 .562-.251.562-.562M0 15.417v1.5h1.5v-1.5zm18.5 0v1.5H20v-1.5zm0-3.084v1.5H20v-1.5zm0-3.083v1.5H20v-1.5zm0-3.083v1.5H20v-1.5zM0 18.5v.5a1 1 0 0 0 1 1h.5v-1.5zm3.083 0V20h1.5v-1.5zm3.084 0V20h1.5v-1.5zm3.083 0V20h1.5v-1.5zm3.083 0V20h1.5v-1.5zm3.084 0V20h1.5v-1.5zm3.083 0V20h.5a1 1 0 0 0 1-1v-.5z\\\"/><path d=\\\"M0 1a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v3.583h-1.5V1.5h-17v12.333H0z\\\" clip-rule=\\\"evenodd\\\"/></svg>\";","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286z\\\"/><path d=\\\"M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306m-3.4-5.715c.562.305.742 1.106.354 1.494s-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.5 6.5 0 0 1 3.1.784\\\"/><path d=\\\"M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0m11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/ui/findandreplaceformview\n */\nimport { View, ButtonView, LabeledFieldView, FocusCycler, createLabeledInputText, submitHandler, ViewCollection, SwitchButtonView, CollapsibleView } from 'ckeditor5/src/ui.js';\nimport { FocusTracker, KeystrokeHandler, Rect, isVisible } from 'ckeditor5/src/utils.js';\n// See: #8833.\n// eslint-disable-next-line ckeditor5-rules/ckeditor-imports\nimport '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';\nimport '../../theme/findandreplaceform.css';\nimport { IconPreviousArrow } from 'ckeditor5/src/icons.js';\n/**\n * The find and replace form view class.\n *\n * See {@link module:find-and-replace/ui/findandreplaceformview~FindAndReplaceFormView}.\n */\nexport class FindAndReplaceFormView extends View {\n    /**\n     * A collection of child views.\n     */\n    children;\n    /**\n     * The find in text input view that stores the searched string.\n     *\n     * @internal\n     */\n    _findInputView;\n    /**\n     * The replace input view.\n     */\n    _replaceInputView;\n    /**\n     * The find button view that initializes the search process.\n     */\n    _findButtonView;\n    /**\n     * The find previous button view.\n     */\n    _findPrevButtonView;\n    /**\n     * The find next button view.\n     */\n    _findNextButtonView;\n    /**\n     * A collapsible view aggregating the advanced search options.\n     */\n    _advancedOptionsCollapsibleView;\n    /**\n     * A switch button view controlling the \"Match case\" option.\n     */\n    _matchCaseSwitchView;\n    /**\n     * A switch button view controlling the \"Whole words only\" option.\n     */\n    _wholeWordsOnlySwitchView;\n    /**\n     * The replace button view.\n     */\n    _replaceButtonView;\n    /**\n     * The replace all button view.\n     */\n    _replaceAllButtonView;\n    /**\n     * The `div` aggregating the inputs.\n     */\n    _inputsDivView;\n    /**\n     * The `div` aggregating the action buttons.\n     */\n    _actionButtonsDivView;\n    /**\n     * Tracks information about the DOM focus in the form.\n     */\n    _focusTracker;\n    /**\n     * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.\n     */\n    _keystrokes;\n    /**\n     * A collection of views that can be focused in the form.\n     */\n    _focusables;\n    /**\n     * Helps cycling over {@link #_focusables} in the form.\n     */\n    focusCycler;\n    /**\n     * Creates a view of find and replace form.\n     *\n     * @param locale The localization services instance.\n     */\n    constructor(locale) {\n        super(locale);\n        const t = locale.t;\n        this.children = this.createCollection();\n        this.set('matchCount', 0);\n        this.set('highlightOffset', 0);\n        this.set('isDirty', false);\n        this.set('_areCommandsEnabled', {});\n        this.set('_resultsCounterText', '');\n        this.set('_matchCase', false);\n        this.set('_wholeWordsOnly', false);\n        this.bind('_searchResultsFound').to(this, 'matchCount', this, 'isDirty', (matchCount, isDirty) => {\n            return matchCount > 0 && !isDirty;\n        });\n        this._findInputView = this._createInputField(t('Find in text…'));\n        this._findPrevButtonView = this._createButton({\n            label: t('Previous result'),\n            class: 'ck-button-prev',\n            icon: IconPreviousArrow,\n            keystroke: 'Shift+F3',\n            tooltip: true\n        });\n        this._findNextButtonView = this._createButton({\n            label: t('Next result'),\n            class: 'ck-button-next',\n            icon: IconPreviousArrow,\n            keystroke: 'F3',\n            tooltip: true\n        });\n        this._replaceInputView = this._createInputField(t('Replace with…'), 'ck-labeled-field-replace');\n        this._inputsDivView = this._createInputsDiv();\n        this._matchCaseSwitchView = this._createMatchCaseSwitch();\n        this._wholeWordsOnlySwitchView = this._createWholeWordsOnlySwitch();\n        this._advancedOptionsCollapsibleView = this._createAdvancedOptionsCollapsible();\n        this._replaceAllButtonView = this._createButton({\n            label: t('Replace all'),\n            class: 'ck-button-replaceall',\n            withText: true\n        });\n        this._replaceButtonView = this._createButton({\n            label: t('Replace'),\n            class: 'ck-button-replace',\n            withText: true\n        });\n        this._findButtonView = this._createButton({\n            label: t('Find'),\n            class: 'ck-button-find ck-button-action',\n            withText: true\n        });\n        this._actionButtonsDivView = this._createActionButtonsDiv();\n        this._focusTracker = new FocusTracker();\n        this._keystrokes = new KeystrokeHandler();\n        this._focusables = new ViewCollection();\n        this.focusCycler = new FocusCycler({\n            focusables: this._focusables,\n            focusTracker: this._focusTracker,\n            keystrokeHandler: this._keystrokes,\n            actions: {\n                // Navigate form fields backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.\n                focusPrevious: 'shift + tab',\n                // Navigate form fields forwards using the <kbd>Tab</kbd> key.\n                focusNext: 'tab'\n            }\n        });\n        this.children.addMany([\n            this._inputsDivView,\n            this._advancedOptionsCollapsibleView,\n            this._actionButtonsDivView\n        ]);\n        this.setTemplate({\n            tag: 'form',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-find-and-replace-form'\n                ],\n                tabindex: '-1'\n            },\n            children: this.children\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    render() {\n        super.render();\n        submitHandler({ view: this });\n        this._initFocusCycling();\n        this._initKeystrokeHandling();\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        super.destroy();\n        this._focusTracker.destroy();\n        this._keystrokes.destroy();\n    }\n    /**\n     * @inheritDoc\n     */\n    focus(direction) {\n        if (direction === -1) {\n            this.focusCycler.focusLast();\n        }\n        else {\n            this.focusCycler.focusFirst();\n        }\n    }\n    /**\n     * Resets the form before re-appearing.\n     *\n     * It clears error messages, hides the match counter and disables the replace feature\n     * until the next hit of the \"Find\" button.\n     *\n     * **Note**: It does not reset inputs and options, though. This way the form works better in editors with\n     * disappearing toolbar (e.g. BalloonEditor): hiding the toolbar by accident (together with the find and replace UI)\n     * does not require filling the entire form again.\n     */\n    reset() {\n        this._findInputView.errorText = null;\n        this.isDirty = true;\n    }\n    /**\n     * Returns the value of the find input.\n     */\n    get _textToFind() {\n        return this._findInputView.fieldView.element.value;\n    }\n    /**\n     * Returns the value of the replace input.\n     */\n    get _textToReplace() {\n        return this._replaceInputView.fieldView.element.value;\n    }\n    /**\n     * Configures and returns the `<div>` aggregating all form inputs.\n     */\n    _createInputsDiv() {\n        const locale = this.locale;\n        const t = locale.t;\n        const inputsDivView = new View(locale);\n        // Typing in the find field invalidates all previous results (the form is \"dirty\").\n        this._findInputView.fieldView.on('input', () => {\n            this.isDirty = true;\n        });\n        // Pressing prev/next buttons fires related event on the form.\n        this._findPrevButtonView.delegate('execute').to(this, 'findPrevious');\n        this._findNextButtonView.delegate('execute').to(this, 'findNext');\n        // Prev/next buttons will be disabled when related editor command gets disabled.\n        this._findPrevButtonView.bind('isEnabled').to(this, '_areCommandsEnabled', ({ findPrevious }) => findPrevious);\n        this._findNextButtonView.bind('isEnabled').to(this, '_areCommandsEnabled', ({ findNext }) => findNext);\n        this._injectFindResultsCounter();\n        this._replaceInputView.bind('isEnabled').to(this, '_areCommandsEnabled', this, '_searchResultsFound', ({ replace }, resultsFound) => replace && resultsFound);\n        this._replaceInputView.bind('infoText').to(this._replaceInputView, 'isEnabled', this._replaceInputView, 'isFocused', (isEnabled, isFocused) => {\n            if (isEnabled || !isFocused) {\n                return '';\n            }\n            return t('Tip: Find some text first in order to replace it.');\n        });\n        inputsDivView.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-find-and-replace-form__inputs']\n            },\n            children: [\n                this._findInputView,\n                this._findPrevButtonView,\n                this._findNextButtonView,\n                this._replaceInputView\n            ]\n        });\n        return inputsDivView;\n    }\n    /**\n     * The action performed when the {@link #_findButtonView} is pressed.\n     */\n    _onFindButtonExecute() {\n        // When hitting \"Find\" in an empty input, an error should be displayed.\n        // Also, if the form was \"dirty\", it should remain so.\n        if (!this._textToFind) {\n            const t = this.t;\n            this._findInputView.errorText = t('Text to find must not be empty.');\n            return;\n        }\n        // Hitting \"Find\" automatically clears the dirty state.\n        this.isDirty = false;\n        this.fire('findNext', {\n            searchText: this._textToFind,\n            matchCase: this._matchCase,\n            wholeWords: this._wholeWordsOnly\n        });\n    }\n    /**\n     * Configures an injects the find results counter displaying a \"N of M\" label of the {@link #_findInputView}.\n     */\n    _injectFindResultsCounter() {\n        const locale = this.locale;\n        const t = locale.t;\n        const bind = this.bindTemplate;\n        const resultsCounterView = new View(this.locale);\n        this.bind('_resultsCounterText').to(this, 'highlightOffset', this, 'matchCount', (highlightOffset, matchCount) => t('%0 of %1', [highlightOffset, matchCount]));\n        resultsCounterView.setTemplate({\n            tag: 'span',\n            attributes: {\n                class: [\n                    'ck',\n                    'ck-results-counter',\n                    // The counter only makes sense when the field text corresponds to search results in the editing.\n                    bind.if('isDirty', 'ck-hidden')\n                ]\n            },\n            children: [\n                {\n                    text: bind.to('_resultsCounterText')\n                }\n            ]\n        });\n        // The whole idea is that when the text of the counter changes, its width also increases/decreases and\n        // it consumes more or less space over the input. The input, on the other hand, should adjust it's right\n        // padding so its *entire* text always remains visible and available to the user.\n        const updateFindInputPadding = () => {\n            const inputElement = this._findInputView.fieldView.element;\n            // Don't adjust the padding if the input (also: counter) were not rendered or not inserted into DOM yet.\n            if (!inputElement || !isVisible(inputElement)) {\n                return;\n            }\n            const counterWidth = new Rect(resultsCounterView.element).width;\n            const paddingPropertyName = locale.uiLanguageDirection === 'ltr' ? 'paddingRight' : 'paddingLeft';\n            if (!counterWidth) {\n                inputElement.style[paddingPropertyName] = '';\n            }\n            else {\n                inputElement.style[paddingPropertyName] = `calc( 2 * var(--ck-spacing-standard) + ${counterWidth}px )`;\n            }\n        };\n        // Adjust the input padding when the text of the counter changes, for instance \"1 of 200\" is narrower than \"123 of 200\".\n        // Using \"low\" priority to let the text be set by the template binding first.\n        this.on('change:_resultsCounterText', updateFindInputPadding, { priority: 'low' });\n        // Adjust the input padding when the counter shows or hides. When hidden, there should be no padding. When it shows, the\n        // padding should be set according to the text of the counter.\n        // Using \"low\" priority to let the text be set by the template binding first.\n        this.on('change:isDirty', updateFindInputPadding, { priority: 'low' });\n        // Put the counter element next to the <input> in the find field.\n        this._findInputView.template.children[0].children.push(resultsCounterView);\n    }\n    /**\n     * Creates the collapsible view aggregating the advanced search options.\n     */\n    _createAdvancedOptionsCollapsible() {\n        const t = this.locale.t;\n        const collapsible = new CollapsibleView(this.locale, [\n            this._matchCaseSwitchView,\n            this._wholeWordsOnlySwitchView\n        ]);\n        collapsible.set({\n            label: t('Advanced options'),\n            isCollapsed: true\n        });\n        return collapsible;\n    }\n    /**\n     * Configures and returns the `<div>` element aggregating all form action buttons.\n     */\n    _createActionButtonsDiv() {\n        const actionsDivView = new View(this.locale);\n        this._replaceButtonView.bind('isEnabled').to(this, '_areCommandsEnabled', this, '_searchResultsFound', ({ replace }, resultsFound) => replace && resultsFound);\n        this._replaceAllButtonView.bind('isEnabled').to(this, '_areCommandsEnabled', this, '_searchResultsFound', ({ replaceAll }, resultsFound) => replaceAll && resultsFound);\n        this._replaceButtonView.on('execute', () => {\n            this.fire('replace', {\n                searchText: this._textToFind,\n                replaceText: this._textToReplace\n            });\n        });\n        this._replaceAllButtonView.on('execute', () => {\n            this.fire('replaceAll', {\n                searchText: this._textToFind,\n                replaceText: this._textToReplace\n            });\n            this.focus();\n        });\n        this._findButtonView.on('execute', this._onFindButtonExecute.bind(this));\n        actionsDivView.setTemplate({\n            tag: 'div',\n            attributes: {\n                class: ['ck', 'ck-find-and-replace-form__actions']\n            },\n            children: [\n                this._replaceAllButtonView,\n                this._replaceButtonView,\n                this._findButtonView\n            ]\n        });\n        return actionsDivView;\n    }\n    /**\n     * Creates, configures and returns and instance of a dropdown allowing users to narrow\n     * the search criteria down. The dropdown has a list with switch buttons for each option.\n     */\n    _createMatchCaseSwitch() {\n        const t = this.locale.t;\n        const matchCaseSwitchButton = new SwitchButtonView(this.locale);\n        matchCaseSwitchButton.set({\n            label: t('Match case'),\n            withText: true\n        });\n        // Let the switch be controlled by form's observable property.\n        matchCaseSwitchButton.bind('isOn').to(this, '_matchCase');\n        // // Update the state of the form when a switch is toggled.\n        matchCaseSwitchButton.on('execute', () => {\n            this._matchCase = !this._matchCase;\n            // Toggling a switch makes the form dirty because this changes search criteria\n            // just like typing text of the find input.\n            this.isDirty = true;\n        });\n        return matchCaseSwitchButton;\n    }\n    /**\n     * Creates, configures and returns and instance of a dropdown allowing users to narrow\n     * the search criteria down. The dropdown has a list with switch buttons for each option.\n     */\n    _createWholeWordsOnlySwitch() {\n        const t = this.locale.t;\n        const wholeWordsOnlySwitchButton = new SwitchButtonView(this.locale);\n        wholeWordsOnlySwitchButton.set({\n            label: t('Whole words only'),\n            withText: true\n        });\n        // Let the switch be controlled by form's observable property.\n        wholeWordsOnlySwitchButton.bind('isOn').to(this, '_wholeWordsOnly');\n        // // Update the state of the form when a switch is toggled.\n        wholeWordsOnlySwitchButton.on('execute', () => {\n            this._wholeWordsOnly = !this._wholeWordsOnly;\n            // Toggling a switch makes the form dirty because this changes search criteria\n            // just like typing text of the find input.\n            this.isDirty = true;\n        });\n        return wholeWordsOnlySwitchButton;\n    }\n    /**\n     * Initializes the {@link #_focusables} and {@link #_focusTracker} to allow navigation\n     * using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keystrokes in the right order.\n     */\n    _initFocusCycling() {\n        const childViews = [\n            this._findInputView,\n            this._findPrevButtonView,\n            this._findNextButtonView,\n            this._replaceInputView,\n            this._advancedOptionsCollapsibleView.buttonView,\n            this._matchCaseSwitchView,\n            this._wholeWordsOnlySwitchView,\n            this._replaceAllButtonView,\n            this._replaceButtonView,\n            this._findButtonView\n        ];\n        childViews.forEach(v => {\n            // Register the view as focusable.\n            this._focusables.add(v);\n            // Register the view in the focus tracker.\n            this._focusTracker.add(v.element);\n        });\n    }\n    /**\n     * Initializes the keystroke handling in the form.\n     */\n    _initKeystrokeHandling() {\n        const stopPropagation = (data) => data.stopPropagation();\n        const stopPropagationAndPreventDefault = (data) => {\n            data.stopPropagation();\n            data.preventDefault();\n        };\n        // Start listening for the keystrokes coming from #element.\n        this._keystrokes.listenTo(this.element);\n        // Find the next result upon F3.\n        this._keystrokes.set('f3', event => {\n            stopPropagationAndPreventDefault(event);\n            this._findNextButtonView.fire('execute');\n        });\n        // Find the previous result upon F3.\n        this._keystrokes.set('shift+f3', event => {\n            stopPropagationAndPreventDefault(event);\n            this._findPrevButtonView.fire('execute');\n        });\n        // Find or replace upon pressing Enter in the find and replace fields.\n        this._keystrokes.set('enter', event => {\n            const target = event.target;\n            if (target === this._findInputView.fieldView.element) {\n                if (this._areCommandsEnabled.findNext) {\n                    this._findNextButtonView.fire('execute');\n                }\n                else {\n                    this._findButtonView.fire('execute');\n                }\n                stopPropagationAndPreventDefault(event);\n            }\n            else if (target === this._replaceInputView.fieldView.element && !this.isDirty) {\n                this._replaceButtonView.fire('execute');\n                stopPropagationAndPreventDefault(event);\n            }\n        });\n        // Find previous upon pressing Shift+Enter in the find field.\n        this._keystrokes.set('shift+enter', event => {\n            const target = event.target;\n            if (target !== this._findInputView.fieldView.element) {\n                return;\n            }\n            if (this._areCommandsEnabled.findPrevious) {\n                this._findPrevButtonView.fire('execute');\n            }\n            else {\n                this._findButtonView.fire('execute');\n            }\n            stopPropagationAndPreventDefault(event);\n        });\n        // Since the form is in the dropdown panel which is a child of the toolbar, the toolbar's\n        // keystroke handler would take over the key management in the URL input.\n        // We need to prevent this ASAP. Otherwise, the basic caret movement using the arrow keys will be impossible.\n        this._keystrokes.set('arrowright', stopPropagation);\n        this._keystrokes.set('arrowleft', stopPropagation);\n        this._keystrokes.set('arrowup', stopPropagation);\n        this._keystrokes.set('arrowdown', stopPropagation);\n    }\n    /**\n     * Creates a button view.\n     *\n     * @param options The properties of the `ButtonView`.\n     * @returns The button view instance.\n     */\n    _createButton(options) {\n        const button = new ButtonView(this.locale);\n        button.set(options);\n        return button;\n    }\n    /**\n     * Creates a labeled input view.\n     *\n     * @param label The input label.\n     * @returns The labeled input view instance.\n     */\n    _createInputField(label, className) {\n        const labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);\n        labeledInput.label = label;\n        labeledInput.class = className;\n        return labeledInput;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/findandreplaceui\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IconFindReplace } from 'ckeditor5/src/icons.js';\nimport { ButtonView, MenuBarMenuListItemButtonView, Dialog, DialogViewPosition, createDropdown, DropdownView, FormHeaderView, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';\nimport { FindAndReplaceFormView } from './ui/findandreplaceformview.js';\n/**\n * The default find and replace UI.\n *\n * It registers the `'findAndReplace'` UI button in the editor's {@link module:ui/componentfactory~ComponentFactory component factory}.\n * that uses the {@link module:find-and-replace/findandreplace~FindAndReplace FindAndReplace} plugin API.\n */\nexport class FindAndReplaceUI extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [Dialog];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FindAndReplaceUI';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * A reference to the find and replace form view.\n     */\n    formView;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.config.define('findAndReplace.uiType', 'dialog');\n        this.formView = null;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const isUiUsingDropdown = editor.config.get('findAndReplace.uiType') === 'dropdown';\n        const findCommand = editor.commands.get('find');\n        const t = this.editor.t;\n        // Register the toolbar component: dropdown or button (that opens a dialog).\n        editor.ui.componentFactory.add('findAndReplace', () => {\n            let view;\n            if (isUiUsingDropdown) {\n                view = this._createDropdown();\n                // Button should be disabled when in source editing mode. See #10001.\n                view.bind('isEnabled').to(findCommand);\n            }\n            else {\n                view = this._createDialogButtonForToolbar();\n            }\n            editor.keystrokes.set('Ctrl+F', (data, cancelEvent) => {\n                if (!findCommand.isEnabled) {\n                    return;\n                }\n                if (view instanceof DropdownView) {\n                    const dropdownButtonView = view.buttonView;\n                    if (!dropdownButtonView.isOn) {\n                        dropdownButtonView.fire('execute');\n                    }\n                }\n                else {\n                    if (view.isOn) {\n                        // If the dialog is open, do not close it. Instead focus it.\n                        // Unfortunately we can't simply use:\n                        // \tthis.formView!.focus();\n                        // because it would always move focus to the first input field, which we don't want.\n                        editor.plugins.get('Dialog').view.focus();\n                    }\n                    else {\n                        view.fire('execute');\n                    }\n                }\n                cancelEvent();\n            });\n            return view;\n        });\n        if (!isUiUsingDropdown) {\n            editor.ui.componentFactory.add('menuBar:findAndReplace', () => {\n                return this._createDialogButtonForMenuBar();\n            });\n        }\n        // Add the information about the keystroke to the accessibility database.\n        editor.accessibility.addKeystrokeInfos({\n            keystrokes: [\n                {\n                    label: t('Find in the document'),\n                    keystroke: 'CTRL+F'\n                }\n            ]\n        });\n    }\n    /**\n     * Creates a dropdown containing the find and replace form.\n     */\n    _createDropdown() {\n        const editor = this.editor;\n        const t = editor.locale.t;\n        const dropdownView = createDropdown(editor.locale);\n        dropdownView.once('change:isOpen', () => {\n            this.formView = this._createFormView();\n            this.formView.children.add(new FormHeaderView(editor.locale, {\n                label: t('Find and replace')\n            }), 0);\n            dropdownView.panelView.children.add(this.formView);\n        });\n        // Every time a dropdown is opened, the search text field should get focused and selected for better UX.\n        // Note: Using the low priority here to make sure the following listener starts working after\n        // the default action of the drop-down is executed (i.e. the panel showed up). Otherwise,\n        // the invisible form/input cannot be focused/selected.\n        //\n        // Each time a dropdown is closed, move the focus back to the find and replace toolbar button\n        // and let the find and replace editing feature know that all search results can be invalidated\n        // and no longer should be marked in the content.\n        dropdownView.on('change:isOpen', (event, name, isOpen) => {\n            if (isOpen) {\n                this._setupFormView();\n            }\n            else {\n                this.fire('searchReseted');\n            }\n        }, { priority: 'low' });\n        dropdownView.buttonView.set({\n            icon: IconFindReplace,\n            label: t('Find and replace'),\n            keystroke: 'CTRL+F',\n            tooltip: true\n        });\n        return dropdownView;\n    }\n    /**\n     * Creates a button that opens a dialog with the find and replace form.\n     */\n    _createDialogButtonForToolbar() {\n        const editor = this.editor;\n        const buttonView = this._createButton(ButtonView);\n        const dialog = editor.plugins.get('Dialog');\n        buttonView.set({\n            tooltip: true\n        });\n        // Button should be on when the find and replace dialog is opened.\n        buttonView.bind('isOn').to(dialog, 'id', id => id === 'findAndReplace');\n        // Every time a dialog is opened, the search text field should get focused and selected for better UX.\n        // Each time a dialog is closed, move the focus back to the find and replace toolbar button\n        // and let the find and replace editing feature know that all search results can be invalidated\n        // and no longer should be marked in the content.\n        buttonView.on('execute', () => {\n            if (buttonView.isOn) {\n                dialog.hide();\n            }\n            else {\n                this._showDialog();\n            }\n        });\n        return buttonView;\n    }\n    /**\n     * Creates a button for for menu bar that will show find and replace dialog.\n     */\n    _createDialogButtonForMenuBar() {\n        const buttonView = this._createButton(MenuBarMenuListItemButtonView);\n        const dialogPlugin = this.editor.plugins.get('Dialog');\n        const dialog = this.editor.plugins.get('Dialog');\n        buttonView.set({\n            role: 'menuitemcheckbox',\n            isToggleable: true\n        });\n        // Button should be on when the find and replace dialog is opened.\n        buttonView.bind('isOn').to(dialog, 'id', id => id === 'findAndReplace');\n        buttonView.on('execute', () => {\n            if (dialogPlugin.id === 'findAndReplace') {\n                dialogPlugin.hide();\n                return;\n            }\n            this._showDialog();\n        });\n        return buttonView;\n    }\n    /**\n     * Creates a button for find and replace command to use either in toolbar or in menu bar.\n     */\n    _createButton(ButtonClass) {\n        const editor = this.editor;\n        const findCommand = editor.commands.get('find');\n        const buttonView = new ButtonClass(editor.locale);\n        const t = editor.locale.t;\n        // Button should be disabled when in source editing mode. See #10001.\n        buttonView.bind('isEnabled').to(findCommand);\n        buttonView.set({\n            icon: IconFindReplace,\n            label: t('Find and replace'),\n            keystroke: 'CTRL+F'\n        });\n        return buttonView;\n    }\n    /**\n     * Shows the find and replace dialog.\n     */\n    _showDialog() {\n        const editor = this.editor;\n        const dialog = editor.plugins.get('Dialog');\n        const t = editor.locale.t;\n        if (!this.formView) {\n            this.formView = this._createFormView();\n        }\n        dialog.show({\n            id: 'findAndReplace',\n            title: t('Find and replace'),\n            content: this.formView,\n            position: DialogViewPosition.EDITOR_TOP_SIDE,\n            onShow: () => {\n                this._setupFormView();\n            },\n            onHide: () => {\n                this.fire('searchReseted');\n            }\n        });\n    }\n    /**\n     * Sets up the form view for the findN and replace.\n     */\n    _createFormView() {\n        const editor = this.editor;\n        const formView = new (CssTransitionDisablerMixin(FindAndReplaceFormView))(editor.locale);\n        const commands = editor.commands;\n        const findAndReplaceEditing = this.editor.plugins.get('FindAndReplaceEditing');\n        const editingState = findAndReplaceEditing.state;\n        formView.bind('highlightOffset').to(editingState, 'highlightedOffset');\n        // Let the form know how many results were found in total.\n        formView.listenTo(editingState.results, 'change', () => {\n            formView.matchCount = editingState.results.length;\n        });\n        // Command states are used to enable/disable individual form controls.\n        // To keep things simple, instead of binding 4 individual observables, there's only one that combines every\n        // commands' isEnabled state. Yes, it will change more often but this simplifies the structure of the form.\n        const findNextCommand = commands.get('findNext');\n        const findPreviousCommand = commands.get('findPrevious');\n        const replaceCommand = commands.get('replace');\n        const replaceAllCommand = commands.get('replaceAll');\n        formView.bind('_areCommandsEnabled').to(findNextCommand, 'isEnabled', findPreviousCommand, 'isEnabled', replaceCommand, 'isEnabled', replaceAllCommand, 'isEnabled', (findNext, findPrevious, replace, replaceAll) => ({ findNext, findPrevious, replace, replaceAll }));\n        // The UI plugin works as an interface between the form and the editing part of the feature.\n        formView.delegate('findNext', 'findPrevious', 'replace', 'replaceAll').to(this);\n        // Let the feature know that search results are no longer relevant because the user changed the searched phrase\n        // (or options) but didn't hit the \"Find\" button yet (e.g. still typing).\n        formView.on('change:isDirty', (evt, data, isDirty) => {\n            if (isDirty) {\n                this.fire('searchReseted');\n            }\n        });\n        return formView;\n    }\n    /**\n     * Clears the find and replace form and focuses the search text field.\n     */\n    _setupFormView() {\n        this.formView.disableCssTransitions();\n        this.formView.reset();\n        this.formView._findInputView.fieldView.select();\n        this.formView.enableCssTransitions();\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/findcommand\n*/\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The find command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.\n */\nexport class FindCommand extends Command {\n    /**\n     * The find and replace state object used for command operations.\n     */\n    _state;\n    /**\n     * Creates a new `FindCommand` instance.\n     *\n     * @param editor The editor on which this command will be used.\n     * @param state An object to hold plugin state.\n     */\n    constructor(editor, state) {\n        super(editor);\n        // The find command is always enabled.\n        this.isEnabled = true;\n        // It does not affect data so should be enabled in read-only mode.\n        this.affectsData = false;\n        this._state = state;\n    }\n    /**\n     * Executes the command.\n     *\n     * @param callbackOrText\n     * @param options Options object.\n     * @param options.matchCase If set to `true`, the letter case will be matched.\n     * @param options.wholeWords If set to `true`, only whole words that match `callbackOrText` will be matched.\n     *\n     * @fires execute\n     */\n    execute(callbackOrText, { matchCase, wholeWords } = {}) {\n        const { editor } = this;\n        const { model } = editor;\n        const findAndReplaceUtils = editor.plugins.get('FindAndReplaceUtils');\n        let findCallback;\n        let callbackSearchText = '';\n        // Allow to execute `find()` on a plugin with a keyword only.\n        if (typeof callbackOrText === 'string') {\n            findCallback = (...args) => ({\n                results: findAndReplaceUtils.findByTextCallback(callbackOrText, { matchCase, wholeWords })(...args),\n                searchText: callbackOrText\n            });\n        }\n        else {\n            findCallback = callbackOrText;\n        }\n        // Wrap the callback to get the search text that will be assigned to the state.\n        const oldCallback = findCallback;\n        findCallback = (...args) => {\n            const result = oldCallback(...args);\n            if (result && 'searchText' in result) {\n                callbackSearchText = result.searchText;\n            }\n            return result;\n        };\n        // Initial search is done on all nodes in all roots inside the content.\n        const results = model.document.getRootNames()\n            .reduce(((currentResults, rootName) => findAndReplaceUtils.updateFindResultFromRange(model.createRangeIn(model.document.getRoot(rootName)), model, findCallback, currentResults)), null);\n        this._state.clear(model);\n        this._state.results.addMany(results);\n        this._state.highlightedResult = results.get(0);\n        this._state.searchText = callbackSearchText;\n        if (findCallback) {\n            this._state.lastSearchCallback = findCallback;\n        }\n        this._state.matchCase = !!matchCase;\n        this._state.matchWholeWords = !!wholeWords;\n        return {\n            results,\n            findCallback\n        };\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { ObservableMixin, Collection } from 'ckeditor5/src/utils.js';\n/**\n * The object storing find and replace plugin state for a given editor instance.\n */\nexport class FindAndReplaceState extends /* #__PURE__ */ ObservableMixin() {\n    /**\n     * Creates an instance of the state.\n     */\n    constructor(model) {\n        super();\n        this.set('results', new Collection());\n        this.set('highlightedResult', null);\n        this.set('highlightedOffset', 0);\n        this.set('searchText', '');\n        this.set('replaceText', '');\n        this.set('lastSearchCallback', null);\n        this.set('matchCase', false);\n        this.set('matchWholeWords', false);\n        this.results.on('change', (eventInfo, { removed, index }) => {\n            if (Array.from(removed).length) {\n                let highlightedResultRemoved = false;\n                model.change(writer => {\n                    for (const removedResult of removed) {\n                        if (this.highlightedResult === removedResult) {\n                            highlightedResultRemoved = true;\n                        }\n                        if (model.markers.has(removedResult.marker.name)) {\n                            writer.removeMarker(removedResult.marker);\n                        }\n                    }\n                });\n                if (highlightedResultRemoved) {\n                    const nextHighlightedIndex = index >= this.results.length ? 0 : index;\n                    this.highlightedResult = this.results.get(nextHighlightedIndex);\n                }\n            }\n        });\n        this.on('change:highlightedResult', () => {\n            this.refreshHighlightOffset(model);\n        });\n    }\n    /**\n     * Cleans the state up and removes markers from the model.\n     */\n    clear(model) {\n        this.searchText = '';\n        model.change(writer => {\n            if (this.highlightedResult) {\n                const oldMatchId = this.highlightedResult.marker.name.split(':')[1];\n                const oldMarker = model.markers.get(`findResultHighlighted:${oldMatchId}`);\n                if (oldMarker) {\n                    writer.removeMarker(oldMarker);\n                }\n            }\n            [...this.results].forEach(({ marker }) => {\n                writer.removeMarker(marker);\n            });\n        });\n        this.results.clear();\n    }\n    /**\n     * Refreshes the highlight result offset based on it's index within the result list.\n     */\n    refreshHighlightOffset(model) {\n        const { highlightedResult, results } = this;\n        if (highlightedResult) {\n            this.highlightedOffset = sortSearchResultsByMarkerPositions(model, [...results]).indexOf(highlightedResult) + 1;\n        }\n        else {\n            this.highlightedOffset = 0;\n        }\n    }\n}\n/**\n * Sorts search results by marker positions. Make sure that the results are sorted in the same order as they appear in the document\n * to avoid issues with the `find next` command. Apparently, the order of the results in the state might be different than the order\n * of the markers in the model.\n *\n * @internal\n */\nexport function sortSearchResultsByMarkerPositions(model, results) {\n    const sortMapping = { before: -1, same: 0, after: 1, different: 1 };\n    // `compareWith` doesn't play well with multi-root documents, so we need to sort results by root name first\n    // and then sort them within each root. It prevents \"random\" order of results when the document has multiple roots.\n    // See more: https://github.com/ckeditor/ckeditor5/pull/17292#issuecomment-2442084549\n    return model.document.getRootNames().flatMap(rootName => results\n        .filter(result => result.marker.getStart().root.rootName === rootName)\n        .sort((a, b) => sortMapping[a.marker.getStart().compareWith(b.marker.getStart())]));\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/replacecommandbase\n*/\nimport { Command } from 'ckeditor5/src/core.js';\nexport class FindReplaceCommandBase extends Command {\n    /**\n     * The find and replace state object used for command operations.\n     */\n    _state;\n    /**\n     * Creates a new `ReplaceCommand` instance.\n     *\n     * @param editor Editor on which this command will be used.\n     * @param state An object to hold plugin state.\n     */\n    constructor(editor, state) {\n        super(editor);\n        // The replace command is always enabled.\n        this.isEnabled = true;\n        this._state = state;\n        // Since this command executes on particular result independent of selection, it should be checked directly in execute block.\n        this._isEnabledBasedOnSelection = false;\n    }\n    /**\n     * Common logic for both `replace` commands.\n     * Replace a given find result by a string or a callback.\n     *\n     * @param result A single result from the find command.\n     */\n    _replace(replacementText, result) {\n        const { model } = this.editor;\n        const range = result.marker.getRange();\n        // Don't replace a result that is in non-editable place.\n        if (!model.canEditAt(range)) {\n            return;\n        }\n        model.change(writer => {\n            // Don't replace a result (marker) that found its way into the $graveyard (e.g. removed by collaborators).\n            if (range.root.rootName === '$graveyard') {\n                this._state.results.remove(result);\n                return;\n            }\n            let textAttributes = {};\n            for (const item of range.getItems()) {\n                if (item.is('$text') || item.is('$textProxy')) {\n                    textAttributes = item.getAttributes();\n                    break;\n                }\n            }\n            model.insertContent(writer.createText(replacementText, textAttributes), range);\n            if (this._state.results.has(result)) {\n                this._state.results.remove(result);\n            }\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { sortSearchResultsByMarkerPositions } from './findandreplacestate.js';\nimport { FindReplaceCommandBase } from './replacecommandbase.js';\n/**\n * The replace command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.\n */\nexport class ReplaceCommand extends FindReplaceCommandBase {\n    /**\n     * Replace a given find result by a string or a callback.\n     *\n     * @param result A single result from the find command.\n     *\n     * @fires execute\n     */\n    execute(replacementText, result) {\n        // We save highlight offset here, as the information about the highlighted result will be lost after the changes.\n        //\n        // It happens because result list is partially regenerated if the result is removed from the paragraph.\n        // Partially means that all sibling result items that are placed in the same paragraph are removed and added again,\n        // which causes the highlighted result to be malformed (usually it's set to first but it's not guaranteed).\n        //\n        // While this saving can be done in editing state, it's better to keep it here, as it's a part of the command logic\n        // and might be super tricky to implement in multi-root documents.\n        //\n        // Keep in mind that the highlighted offset is indexed from 1, as it's displayed to the user. It's why we subtract 1 here.\n        //\n        // More info: https://github.com/ckeditor/ckeditor5/issues/16648\n        const oldHighlightOffset = Math.max(this._state.highlightedOffset - 1, 0);\n        this._replace(replacementText, result);\n        // Let's revert the highlight offset to the previous value.\n        if (this._state.results.length) {\n            // Highlight offset operates on sorted array, so we need to sort the results first.\n            // It's not guaranteed that items in state results are sorted, usually they are, but it's not guaranteed when\n            // the result is removed from the paragraph with other highlighted results.\n            const sortedResults = sortSearchResultsByMarkerPositions(this.editor.model, [...this._state.results]);\n            // Just make sure that we don't overflow the results array, so use modulo.\n            this._state.highlightedResult = sortedResults[oldHighlightOffset % sortedResults.length];\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/replaceallcommand\n */\nimport { Collection } from 'ckeditor5/src/utils.js';\nimport { FindReplaceCommandBase } from './replacecommandbase.js';\n/**\n * The replace all command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.\n */\nexport class ReplaceAllCommand extends FindReplaceCommandBase {\n    /**\n     * Replaces all the occurrences of `textToReplace` with a given `newText` string.\n     *\n     * ```ts\n     *\treplaceAllCommand.execute( 'replaceAll', 'new text replacement', 'text to replace' );\n     * ```\n     *\n     * Alternatively you can call it from editor instance:\n     *\n     * ```ts\n     *\teditor.execute( 'replaceAll', 'new text', 'old text' );\n     * ```\n     *\n     * @param newText Text that will be inserted to the editor for each match.\n     * @param textToReplace Text to be replaced or a collection of matches\n     * as returned by the find command.\n     *\n     * @fires module:core/command~Command#event:execute\n     */\n    execute(newText, textToReplace) {\n        const { editor } = this;\n        const { model } = editor;\n        const findAndReplaceUtils = editor.plugins.get('FindAndReplaceUtils');\n        const results = textToReplace instanceof Collection ?\n            textToReplace : model.document.getRootNames()\n            .reduce(((currentResults, rootName) => findAndReplaceUtils.updateFindResultFromRange(model.createRangeIn(model.document.getRoot(rootName)), model, findAndReplaceUtils.findByTextCallback(textToReplace, this._state), currentResults)), null);\n        if (results.length) {\n            // Wrapped in single change will batch it into one transaction.\n            model.change(() => {\n                [...results].forEach(searchResult => {\n                    // Just reuse logic from the replace command to replace a single match.\n                    this._replace(newText, searchResult);\n                });\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/findnextcommand\n*/\nimport { Command } from 'ckeditor5/src/core.js';\n/**\n * The find next command. Moves the highlight to the next search result.\n *\n * It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.\n */\nexport class FindNextCommand extends Command {\n    /**\n     * The find and replace state object used for command operations.\n     */\n    _state;\n    /**\n     * Creates a new `FindNextCommand` instance.\n     *\n     * @param editor The editor on which this command will be used.\n     * @param state An object to hold plugin state.\n     */\n    constructor(editor, state) {\n        super(editor);\n        // It does not affect data so should be enabled in read-only mode.\n        this.affectsData = false;\n        this._state = state;\n        this.isEnabled = false;\n        this.listenTo(this._state.results, 'change', () => {\n            this.isEnabled = this._state.results.length > 1;\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    refresh() {\n        this.isEnabled = this._state.results.length > 1;\n    }\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const results = this._state.results;\n        const currentIndex = results.getIndex(this._state.highlightedResult);\n        const nextIndex = currentIndex + 1 >= results.length ?\n            0 : currentIndex + 1;\n        this._state.highlightedResult = this._state.results.get(nextIndex);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/findpreviouscommand\n*/\nimport { FindNextCommand } from './findnextcommand.js';\n/**\n * The find previous command. Moves the highlight to the previous search result.\n *\n * It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.\n */\nexport class FindPreviousCommand extends FindNextCommand {\n    /**\n     * @inheritDoc\n     */\n    execute() {\n        const results = this._state.results;\n        const currentIndex = results.getIndex(this._state.highlightedResult);\n        const previousIndex = currentIndex - 1 < 0 ?\n            this._state.results.length - 1 : currentIndex - 1;\n        this._state.highlightedResult = this._state.results.get(previousIndex);\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Collection, uid } from 'ckeditor5/src/utils.js';\nimport { escapeRegExp } from 'es-toolkit/compat';\n/**\n * A set of helpers related to find and replace.\n */\nexport class FindAndReplaceUtils extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FindAndReplaceUtils';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * Executes findCallback and updates search results list.\n     *\n     * @param range The model range to scan for matches.\n     * @param model The model.\n     * @param findCallback The callback that should return `true` if provided text matches the search term.\n     * @param startResults An optional collection of find matches that the function should\n     * start with. This would be a collection returned by a previous `updateFindResultFromRange()` call.\n     * @returns A collection of objects describing find match.\n     *\n     * An example structure:\n     *\n     * ```js\n     * {\n     *\tid: resultId,\n     *\tlabel: foundItem.label,\n     *\tmarker\n     *\t}\n     * ```\n     */\n    updateFindResultFromRange(range, model, findCallback, startResults) {\n        const results = startResults || new Collection();\n        const checkIfResultAlreadyOnList = (marker) => results.find(markerItem => {\n            const { marker: resultsMarker } = markerItem;\n            const resultRange = resultsMarker.getRange();\n            const markerRange = marker.getRange();\n            return resultRange.isEqual(markerRange);\n        });\n        model.change(writer => {\n            [...range].forEach(({ type, item }) => {\n                if (type === 'elementStart') {\n                    if (model.schema.checkChild(item, '$text')) {\n                        let foundItems = findCallback({\n                            item,\n                            text: this.rangeToText(model.createRangeIn(item))\n                        });\n                        if (!foundItems) {\n                            return;\n                        }\n                        if ('results' in foundItems) {\n                            foundItems = foundItems.results;\n                        }\n                        foundItems.forEach(foundItem => {\n                            const resultId = `findResult:${uid()}`;\n                            const marker = writer.addMarker(resultId, {\n                                usingOperation: false,\n                                affectsData: false,\n                                range: writer.createRange(writer.createPositionAt(item, foundItem.start), writer.createPositionAt(item, foundItem.end))\n                            });\n                            const index = findInsertIndex(results, marker);\n                            if (!checkIfResultAlreadyOnList(marker)) {\n                                results.add({\n                                    id: resultId,\n                                    label: foundItem.label,\n                                    marker\n                                }, index);\n                            }\n                        });\n                    }\n                }\n            });\n        });\n        return results;\n    }\n    /**\n     * Returns text representation of a range. The returned text length should be the same as range length.\n     * In order to achieve this, this function will replace inline elements (text-line) as new line character (\"\\n\").\n     *\n     * @param range The model range.\n     * @returns The text content of the provided range.\n     */\n    rangeToText(range) {\n        return Array.from(range.getItems({ shallow: true })).reduce((rangeText, node) => {\n            // Trim text to a last occurrence of an inline element and update range start.\n            if (!(node.is('$text') || node.is('$textProxy'))) {\n                // Editor has only one inline element defined in schema: `<softBreak>` which is treated as new line character in blocks.\n                // Special handling might be needed for other inline elements (inline widgets).\n                return `${rangeText}\\n`;\n            }\n            return rangeText + node.data;\n        }, '');\n    }\n    /**\n     * Creates a text matching callback for a specified search term and matching options.\n     *\n     * @param searchTerm The search term.\n     * @param options Matching options.\n     * \t- options.matchCase=false If set to `true` letter casing will be ignored.\n     * \t- options.wholeWords=false If set to `true` only whole words that match `callbackOrText` will be matched.\n     */\n    findByTextCallback(searchTerm, options) {\n        let flags = 'gu';\n        if (!options.matchCase) {\n            flags += 'i';\n        }\n        let regExpQuery = `(${escapeRegExp(searchTerm)})`;\n        if (options.wholeWords) {\n            const nonLetterGroup = '[^a-zA-Z\\u00C0-\\u024F\\u1E00-\\u1EFF]';\n            if (!new RegExp('^' + nonLetterGroup).test(searchTerm)) {\n                regExpQuery = `(^|${nonLetterGroup}|_)${regExpQuery}`;\n            }\n            if (!new RegExp(nonLetterGroup + '$').test(searchTerm)) {\n                regExpQuery = `${regExpQuery}(?=_|${nonLetterGroup}|$)`;\n            }\n        }\n        const regExp = new RegExp(regExpQuery, flags);\n        function findCallback({ text }) {\n            const matches = [...text.matchAll(regExp)];\n            return matches.map(regexpMatchToFindResult);\n        }\n        return findCallback;\n    }\n}\n// Finds the appropriate index in the resultsList Collection.\nfunction findInsertIndex(resultsList, markerToInsert) {\n    const result = resultsList.find(({ marker }) => {\n        return markerToInsert.getStart().isBefore(marker.getStart());\n    });\n    return result ? resultsList.getIndex(result) : resultsList.length;\n}\n/**\n *  Maps RegExp match result to find result.\n */\nfunction regexpMatchToFindResult(matchResult) {\n    const lastGroupIndex = matchResult.length - 1;\n    let startOffset = matchResult.index;\n    // Searches with match all flag have an extra matching group with empty string or white space matched before the word.\n    // If the search term starts with the space already, there is no extra group even with match all flag on.\n    if (matchResult.length === 3) {\n        startOffset += matchResult[1].length;\n    }\n    return {\n        label: matchResult[lastGroupIndex],\n        start: startOffset,\n        end: startOffset + matchResult[lastGroupIndex].length\n    };\n}\n","import { escapeRegExp as escapeRegExp$1 } from '../../string/escapeRegExp.mjs';\nimport { toString } from '../util/toString.mjs';\n\nfunction escapeRegExp(str) {\n    return escapeRegExp$1(toString(str));\n}\n\nexport { escapeRegExp };\n","function escapeRegExp(str) {\n    return str.replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&');\n}\n\nexport { escapeRegExp };\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/findandreplaceediting\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { scrollViewportToShowTarget } from 'ckeditor5/src/utils.js';\nimport { FindCommand } from './findcommand.js';\nimport { ReplaceCommand } from './replacecommand.js';\nimport { ReplaceAllCommand } from './replaceallcommand.js';\nimport { FindNextCommand } from './findnextcommand.js';\nimport { FindPreviousCommand } from './findpreviouscommand.js';\nimport { FindAndReplaceState } from './findandreplacestate.js';\nimport { FindAndReplaceUtils } from './findandreplaceutils.js';\nimport { debounce } from 'es-toolkit/compat';\nimport '../theme/findandreplace.css';\nconst HIGHLIGHT_CLASS = 'ck-find-result_selected';\n/**\n * Implements the editing part for find and replace plugin. For example conversion, commands etc.\n */\nexport class FindAndReplaceEditing extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FindAndReplaceUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FindAndReplaceEditing';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'FAR';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * An object storing the find and replace state within a given editor instance.\n     */\n    state;\n    /**\n     * @inheritDoc\n     */\n    init() {\n        this.state = new FindAndReplaceState(this.editor.model);\n        this.set('_isSearchActive', false);\n        this._defineConverters();\n        this._defineCommands();\n        this.listenTo(this.state, 'change:highlightedResult', (eventInfo, name, newValue, oldValue) => {\n            const { model } = this.editor;\n            model.change(writer => {\n                if (oldValue) {\n                    const oldMatchId = oldValue.marker.name.split(':')[1];\n                    const oldMarker = model.markers.get(`findResultHighlighted:${oldMatchId}`);\n                    if (oldMarker) {\n                        writer.removeMarker(oldMarker);\n                    }\n                }\n                if (newValue) {\n                    const newMatchId = newValue.marker.name.split(':')[1];\n                    writer.addMarker(`findResultHighlighted:${newMatchId}`, {\n                        usingOperation: false,\n                        affectsData: false,\n                        range: newValue.marker.getRange()\n                    });\n                }\n            });\n        });\n        /* istanbul ignore next -- @preserve */\n        const scrollToHighlightedResult = (eventInfo, name, newValue) => {\n            if (newValue) {\n                const domConverter = this.editor.editing.view.domConverter;\n                const viewRange = this.editor.editing.mapper.toViewRange(newValue.marker.getRange());\n                scrollViewportToShowTarget({\n                    target: domConverter.viewRangeToDom(viewRange),\n                    viewportOffset: 40\n                });\n            }\n        };\n        const debouncedScrollListener = debounce(scrollToHighlightedResult.bind(this), 32);\n        // Debounce scroll as highlight might be changed very frequently, e.g. when there's a replace all command.\n        this.listenTo(this.state, 'change:highlightedResult', debouncedScrollListener, { priority: 'low' });\n        // It's possible that the editor will get destroyed before debounced call kicks in.\n        // This would result with accessing a view three that is no longer in DOM.\n        this.listenTo(this.editor, 'destroy', debouncedScrollListener.cancel);\n        this.on('change:_isSearchActive', (evt, name, isSearchActive) => {\n            if (isSearchActive) {\n                this.listenTo(this.editor.model.document, 'change:data', this._onDocumentChange);\n            }\n            else {\n                this.stopListening(this.editor.model.document, 'change:data', this._onDocumentChange);\n            }\n        });\n    }\n    /**\n     * Initiate a search.\n     */\n    find(callbackOrText, findAttributes) {\n        this._isSearchActive = true;\n        this.editor.execute('find', callbackOrText, findAttributes);\n        return this.state.results;\n    }\n    /**\n     * Stops active results from updating, and clears out the results.\n     */\n    stop() {\n        this.state.clear(this.editor.model);\n        this._isSearchActive = false;\n    }\n    /**\n     * Sets up the commands.\n     */\n    _defineCommands() {\n        this.editor.commands.add('find', new FindCommand(this.editor, this.state));\n        this.editor.commands.add('findNext', new FindNextCommand(this.editor, this.state));\n        this.editor.commands.add('findPrevious', new FindPreviousCommand(this.editor, this.state));\n        this.editor.commands.add('replace', new ReplaceCommand(this.editor, this.state));\n        this.editor.commands.add('replaceAll', new ReplaceAllCommand(this.editor, this.state));\n    }\n    /**\n     * Sets up the marker downcast converters for search results highlighting.\n     */\n    _defineConverters() {\n        const { editor } = this;\n        // Setup the marker highlighting conversion.\n        editor.conversion.for('editingDowncast').markerToHighlight({\n            model: 'findResult',\n            view: ({ markerName }) => {\n                const [, id] = markerName.split(':');\n                // Marker removal from the view has a bug: https://github.com/ckeditor/ckeditor5/issues/7499\n                // A minimal option is to return a new object for each converted marker...\n                return {\n                    name: 'span',\n                    classes: ['ck-find-result'],\n                    attributes: {\n                        // ...however, adding a unique attribute should be future-proof..\n                        'data-find-result': id\n                    }\n                };\n            }\n        });\n        editor.conversion.for('editingDowncast').markerToHighlight({\n            model: 'findResultHighlighted',\n            view: ({ markerName }) => {\n                const [, id] = markerName.split(':');\n                // Marker removal from the view has a bug: https://github.com/ckeditor/ckeditor5/issues/7499\n                // A minimal option is to return a new object for each converted marker...\n                return {\n                    name: 'span',\n                    classes: [HIGHLIGHT_CLASS],\n                    attributes: {\n                        // ...however, adding a unique attribute should be future-proof..\n                        'data-find-result': id\n                    }\n                };\n            }\n        });\n    }\n    /**\n     * Reacts to document changes in order to update search list.\n     */\n    _onDocumentChange = () => {\n        const changedNodes = new Set();\n        const removedMarkers = new Set();\n        const model = this.editor.model;\n        const { results } = this.state;\n        const changes = model.document.differ.getChanges();\n        const changedMarkers = model.document.differ.getChangedMarkers();\n        // Get nodes in which changes happened to re-run a search callback on them.\n        changes.forEach(change => {\n            if (!change.position) {\n                return;\n            }\n            if (change.name === '$text' || (change.position.nodeAfter && model.schema.isInline(change.position.nodeAfter))) {\n                changedNodes.add(change.position.parent);\n                [...model.markers.getMarkersAtPosition(change.position)].forEach(markerAtChange => {\n                    removedMarkers.add(markerAtChange.name);\n                });\n            }\n            else if (change.type === 'insert' && change.position.nodeAfter) {\n                changedNodes.add(change.position.nodeAfter);\n            }\n        });\n        // Get markers from removed nodes also.\n        changedMarkers.forEach(({ name, data: { newRange } }) => {\n            if (newRange && newRange.start.root.rootName === '$graveyard') {\n                removedMarkers.add(name);\n            }\n        });\n        // Get markers from the updated nodes and remove all (search will be re-run on these nodes).\n        changedNodes.forEach(node => {\n            const markersInNode = [...model.markers.getMarkersIntersectingRange(model.createRangeIn(node))];\n            markersInNode.forEach(marker => removedMarkers.add(marker.name));\n        });\n        // Remove results from the changed part of content.\n        removedMarkers.forEach(markerName => {\n            if (!results.has(markerName)) {\n                return;\n            }\n            if (results.get(markerName) === this.state.highlightedResult) {\n                this.state.highlightedResult = null;\n            }\n            results.remove(markerName);\n        });\n        // Run search callback again on updated nodes.\n        const changedSearchResults = [];\n        const findAndReplaceUtils = this.editor.plugins.get('FindAndReplaceUtils');\n        changedNodes.forEach(nodeToCheck => {\n            const changedNodeSearchResults = findAndReplaceUtils.updateFindResultFromRange(model.createRangeOn(nodeToCheck), model, this.state.lastSearchCallback, results);\n            changedSearchResults.push(...changedNodeSearchResults);\n        });\n        changedMarkers.forEach(markerToCheck => {\n            // Handle search result highlight update when T&C plugin is active.\n            // Lookup is performed only on newly inserted markers.\n            if (markerToCheck.data.newRange) {\n                const changedNodeSearchResults = findAndReplaceUtils.updateFindResultFromRange(markerToCheck.data.newRange, model, this.state.lastSearchCallback, results);\n                changedSearchResults.push(...changedNodeSearchResults);\n            }\n        });\n        if (!this.state.highlightedResult && changedSearchResults.length) {\n            // If there are found phrases but none is selected, select the first one.\n            this.state.highlightedResult = changedSearchResults[0];\n        }\n        else {\n            // If there is already highlight item then refresh highlight offset after appending new items.\n            this.state.refreshHighlightOffset(model);\n        }\n    };\n}\n","import { ClassicEditor as ClassicEditorBase } from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';\nimport { Essentials } from '@ckeditor/ckeditor5-essentials/src/essentials';\nimport { CKFinderUploadAdapter } from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter';\nimport { Autoformat } from '@ckeditor/ckeditor5-autoformat/src/autoformat';\nimport { Bold } from '@ckeditor/ckeditor5-basic-styles/src/bold';\nimport { Italic } from '@ckeditor/ckeditor5-basic-styles/src/italic';\nimport { Underline } from '@ckeditor/ckeditor5-basic-styles/src/underline';\nimport { Strikethrough } from '@ckeditor/ckeditor5-basic-styles/src/strikethrough';\nimport { Code } from '@ckeditor/ckeditor5-basic-styles/src/code';\nimport { Subscript } from '@ckeditor/ckeditor5-basic-styles/src/subscript';\nimport { Superscript } from '@ckeditor/ckeditor5-basic-styles/src/superscript';\nimport { BlockQuote } from '@ckeditor/ckeditor5-block-quote/src/blockquote';\nimport { Heading } from '@ckeditor/ckeditor5-heading/src/heading';\nimport { Image } from '@ckeditor/ckeditor5-image/src/image';\nimport { ImageCaption } from '@ckeditor/ckeditor5-image/src/imagecaption';\nimport { ImageStyle } from '@ckeditor/ckeditor5-image/src/imagestyle';\nimport { ImageToolbar } from '@ckeditor/ckeditor5-image/src/imagetoolbar';\nimport { Link } from '@ckeditor/ckeditor5-link/src/link';\nimport { List } from '@ckeditor/ckeditor5-list/src/list';\nimport { Paragraph } from '@ckeditor/ckeditor5-paragraph/src/paragraph';\nimport { ImageResize } from '@ckeditor/ckeditor5-image/src/imageresize';\nimport { SimpleUploadAdapter } from '@ckeditor/ckeditor5-upload/src/adapters/simpleuploadadapter';\nimport { Alignment } from '@ckeditor/ckeditor5-alignment/src/alignment';\nimport { Autosave } from '@ckeditor/ckeditor5-autosave/src/autosave';\nimport { PasteFromOffice } from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';\nimport { Font } from '@ckeditor/ckeditor5-font/src/font';\nimport { MediaEmbed } from '@ckeditor/ckeditor5-media-embed/src/mediaembed';\nimport { RemoveFormat } from '@ckeditor/ckeditor5-remove-format/src/removeformat';\nimport { Table } from '@ckeditor/ckeditor5-table/src/table';\nimport { TableToolbar } from '@ckeditor/ckeditor5-table/src/tabletoolbar';\nimport { TableProperties } from '@ckeditor/ckeditor5-table/src/tableproperties';\nimport { TableCellProperties } from '@ckeditor/ckeditor5-table/src/tablecellproperties';\nimport { Indent } from '@ckeditor/ckeditor5-indent/src/indent';\nimport { IndentBlock } from '@ckeditor/ckeditor5-indent/src/indentblock';\nimport { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight';\nimport { TodoList } from '@ckeditor/ckeditor5-list/src/todolist';\nimport { CodeBlock } from '@ckeditor/ckeditor5-code-block/src/codeblock';\nimport { ListProperties } from '@ckeditor/ckeditor5-list/src/listproperties';\nimport { SourceEditing } from '@ckeditor/ckeditor5-source-editing/src/sourceediting';\nimport { GeneralHtmlSupport } from '@ckeditor/ckeditor5-html-support/src/generalhtmlsupport';\nimport { ImageInsert } from '@ckeditor/ckeditor5-image/src/imageinsert';\nimport { TableCaption } from '@ckeditor/ckeditor5-table';\nimport { WordCount } from '@ckeditor/ckeditor5-word-count/src/wordcount';\nimport { Mention } from '@ckeditor/ckeditor5-mention/src/mention';\nimport { Markdown } from '@ckeditor/ckeditor5-markdown-gfm/src/markdown';\nimport { PageBreak } from '@ckeditor/ckeditor5-page-break/src/pagebreak';\nimport { Style } from '@ckeditor/ckeditor5-style';\nimport { HorizontalLine } from '@ckeditor/ckeditor5-horizontal-line';\nimport {LinkImage} from \"@ckeditor/ckeditor5-link\";\nimport {HtmlEmbed} from \"@ckeditor/ckeditor5-html-embed\";\nimport { FullPage } from '@ckeditor/ckeditor5-html-support';\nimport { SpecialCharacters } from '@ckeditor/ckeditor5-special-characters';\nimport { SpecialCharactersEssentials } from '@ckeditor/ckeditor5-special-characters';\nimport { ShowBlocks } from '@ckeditor/ckeditor5-show-blocks';\nimport { SelectAll } from '@ckeditor/ckeditor5-select-all';\nimport { FindAndReplace } from '@ckeditor/ckeditor5-find-and-replace';\n\nexport default class ClassicEditor extends ClassicEditorBase {\n}\n\nClassicEditor.builtinPlugins = [\n    Essentials,\n    CKFinderUploadAdapter,\n    CodeBlock,\n    Autoformat,\n    Bold,\n    Italic,\n    Underline,\n    Strikethrough,\n    Code,\n    Subscript,\n    Superscript,\n    BlockQuote,\n    Heading,\n    Image,\n    ImageCaption,\n    ImageStyle,\n    ImageToolbar,\n    ImageResize,\n    Link,\n    List,\n    Paragraph,\n    Alignment,\n    Autosave,\n    Font,\n    PasteFromOffice,\n    SimpleUploadAdapter,\n    MediaEmbed,\n    RemoveFormat,\n    Table, TableToolbar,\n    TableCaption,\n    TableProperties,\n    TableCellProperties,\n    Indent,\n    IndentBlock,\n    Highlight,\n    TodoList,\n    ListProperties,\n    SourceEditing,\n    GeneralHtmlSupport,\n    ImageInsert,\n    WordCount,\n    Mention,\n    Markdown,\n    PageBreak,\n    Style,\n    HorizontalLine,\n    LinkImage,\n    HtmlEmbed,\n    FullPage,\n    SpecialCharacters,\n    SpecialCharactersEssentials,\n    ShowBlocks,\n    SelectAll,\n    FindAndReplace\n];\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module essentials/essentials\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Clipboard } from 'ckeditor5/src/clipboard.js';\nimport { Enter, ShiftEnter } from 'ckeditor5/src/enter.js';\nimport { SelectAll } from 'ckeditor5/src/select-all.js';\nimport { Typing } from 'ckeditor5/src/typing.js';\nimport { Undo } from 'ckeditor5/src/undo.js';\nimport { AccessibilityHelp } from 'ckeditor5/src/ui.js';\n/**\n * A plugin including all essential editing features. It represents a set of features that enables similar functionalities\n * to a `<textarea>` element.\n *\n * It includes:\n *\n * * {@link module:ui/editorui/accessibilityhelp/accessibilityhelp~AccessibilityHelp},\n * * {@link module:clipboard/clipboard~Clipboard},\n * * {@link module:enter/enter~Enter},\n * * {@link module:select-all/selectall~SelectAll},\n * * {@link module:enter/shiftenter~ShiftEnter},\n * * {@link module:typing/typing~Typing},\n * * {@link module:undo/undo~Undo}.\n *\n * This plugin set does not define any block-level containers (such as {@link module:paragraph/paragraph~Paragraph}).\n * If your editor is supposed to handle block content, make sure to include it.\n */\nexport class Essentials extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [AccessibilityHelp, Clipboard, Enter, SelectAll, ShiftEnter, Typing, Undo];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Essentials';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module code-block/codeblock\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { CodeBlockEditing } from './codeblockediting.js';\nimport { CodeBlockUI } from './codeblockui.js';\n/**\n * The code block plugin.\n *\n * For more information about this feature check the {@glink api/code-block package page} and the\n * {@glink features/code-blocks code block} feature guide.\n *\n * This is a \"glue\" plugin that loads the {@link module:code-block/codeblockediting~CodeBlockEditing code block editing feature}\n * and the {@link module:code-block/codeblockui~CodeBlockUI code block UI feature}.\n */\nexport class CodeBlock extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [CodeBlockEditing, CodeBlockUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'CodeBlock';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/bold\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { BoldEditing } from './bold/boldediting.js';\nimport { BoldUI } from './bold/boldui.js';\n/**\n * The bold feature.\n *\n * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide\n * and the {@glink api/basic-styles package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:basic-styles/bold/boldediting~BoldEditing bold editing feature}\n * and {@link module:basic-styles/bold/boldui~BoldUI bold UI feature}.\n */\nexport class Bold extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [BoldEditing, BoldUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Bold';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/italic\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ItalicEditing } from './italic/italicediting.js';\nimport { ItalicUI } from './italic/italicui.js';\n/**\n * The italic feature.\n *\n * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide\n * and the {@glink api/basic-styles package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:basic-styles/italic/italicediting~ItalicEditing} and\n * {@link module:basic-styles/italic/italicui~ItalicUI} plugins.\n */\nexport class Italic extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ItalicEditing, ItalicUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Italic';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/underline\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { UnderlineEditing } from './underline/underlineediting.js';\nimport { UnderlineUI } from './underline/underlineui.js';\n/**\n * The underline feature.\n *\n * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide\n * and the {@glink api/basic-styles package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:basic-styles/underline/underlineediting~UnderlineEditing} and\n * {@link module:basic-styles/underline/underlineui~UnderlineUI} plugins.\n */\nexport class Underline extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [UnderlineEditing, UnderlineUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Underline';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/strikethrough\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { StrikethroughEditing } from './strikethrough/strikethroughediting.js';\nimport { StrikethroughUI } from './strikethrough/strikethroughui.js';\n/**\n * The strikethrough feature.\n *\n * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide\n * and the {@glink api/basic-styles package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:basic-styles/strikethrough/strikethroughediting~StrikethroughEditing} and\n * {@link module:basic-styles/strikethrough/strikethroughui~StrikethroughUI} plugins.\n */\nexport class Strikethrough extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [StrikethroughEditing, StrikethroughUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Strikethrough';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/code\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { CodeEditing } from './code/codeediting.js';\nimport { CodeUI } from './code/codeui.js';\nimport '../theme/code.css';\n/**\n * The code feature.\n *\n * For a detailed overview check the {@glink features/basic-styles Basic styles feature} guide\n * and the {@glink api/basic-styles package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:basic-styles/code/codeediting~CodeEditing code editing feature}\n * and {@link module:basic-styles/code/codeui~CodeUI code UI feature}.\n */\nexport class Code extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [CodeEditing, CodeUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Code';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/subscript\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { SubscriptEditing } from './subscript/subscriptediting.js';\nimport { SubscriptUI } from './subscript/subscriptui.js';\n/**\n * The subscript feature.\n *\n * It loads the {@link module:basic-styles/subscript/subscriptediting~SubscriptEditing} and\n * {@link module:basic-styles/subscript/subscriptui~SubscriptUI} plugins.\n */\nexport class Subscript extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [SubscriptEditing, SubscriptUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Subscript';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module basic-styles/superscript\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { SuperscriptEditing } from './superscript/superscriptediting.js';\nimport { SuperscriptUI } from './superscript/superscriptui.js';\n/**\n * The superscript feature.\n *\n * It loads the {@link module:basic-styles/superscript/superscriptediting~SuperscriptEditing} and\n * {@link module:basic-styles/superscript/superscriptui~SuperscriptUI} plugins.\n */\nexport class Superscript extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [SuperscriptEditing, SuperscriptUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Superscript';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module block-quote/blockquote\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { BlockQuoteEditing } from './blockquoteediting.js';\nimport { BlockQuoteUI } from './blockquoteui.js';\n/**\n * The block quote plugin.\n *\n * For more information about this feature check the {@glink api/block-quote package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:block-quote/blockquoteediting~BlockQuoteEditing block quote editing feature}\n * and {@link module:block-quote/blockquoteui~BlockQuoteUI block quote UI feature}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport class BlockQuote extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [BlockQuoteEditing, BlockQuoteUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'BlockQuote';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module heading/heading\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { HeadingEditing } from './headingediting.js';\nimport { HeadingUI } from './headingui.js';\nimport '../theme/heading.css';\n/**\n * The headings feature.\n *\n * For a detailed overview, check the {@glink features/headings Headings feature} guide\n * and the {@glink api/heading package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:heading/headingediting~HeadingEditing heading editing feature}\n * and {@link module:heading/headingui~HeadingUI heading UI feature}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport class Heading extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [HeadingEditing, HeadingUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Heading';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/image\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageBlock } from './imageblock.js';\nimport { ImageInline } from './imageinline.js';\nimport '../theme/image.css';\n/**\n * The image plugin.\n *\n * For a detailed overview, check the {@glink features/images/images-overview image feature} documentation.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n *\n * * {@link module:image/imageblock~ImageBlock},\n * * {@link module:image/imageinline~ImageInline},\n *\n * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}\n * for more information.\n */\nexport class Image extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageBlock, ImageInline];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Image';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagecaption\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageCaptionEditing } from './imagecaption/imagecaptionediting.js';\nimport { ImageCaptionUI } from './imagecaption/imagecaptionui.js';\nimport '../theme/imagecaption.css';\n/**\n * The image caption plugin.\n *\n * For a detailed overview, check the {@glink features/images/images-captions image caption} documentation.\n */\nexport class ImageCaption extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageCaptionEditing, ImageCaptionUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageCaption';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagestyle\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageStyleEditing } from './imagestyle/imagestyleediting.js';\nimport { ImageStyleUI } from './imagestyle/imagestyleui.js';\n/**\n * The image style plugin.\n *\n * For a detailed overview of the image styles feature, check the {@glink features/images/images-styles documentation}.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n * * {@link module:image/imagestyle/imagestyleediting~ImageStyleEditing},\n * * {@link module:image/imagestyle/imagestyleui~ImageStyleUI}\n *\n * It provides a default configuration, which can be extended or overwritten.\n * Read more about the {@link module:image/imageconfig~ImageConfig#styles image styles configuration}.\n */\nexport class ImageStyle extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageStyleEditing, ImageStyleUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageStyle';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imagetoolbar\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';\nimport { ImageUtils } from './imageutils.js';\nimport { isObject } from 'es-toolkit/compat';\n/**\n * The image toolbar plugin. It creates and manages the image toolbar (the toolbar displayed when an image is selected).\n *\n * For an overview, check the {@glink features/images/images-overview#image-contextual-toolbar image contextual toolbar} documentation.\n *\n * Instances of toolbar components (e.g. buttons) are created using the editor's\n * {@link module:ui/componentfactory~ComponentFactory component factory}\n * based on the {@link module:image/imageconfig~ImageConfig#toolbar `image.toolbar` configuration option}.\n *\n * The toolbar uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.\n */\nexport class ImageToolbar extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [WidgetToolbarRepository, ImageUtils];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageToolbar';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const t = editor.t;\n        const widgetToolbarRepository = editor.plugins.get(WidgetToolbarRepository);\n        const imageUtils = editor.plugins.get('ImageUtils');\n        widgetToolbarRepository.register('image', {\n            ariaLabel: t('Image toolbar'),\n            items: normalizeDeclarativeConfig(editor.config.get('image.toolbar') || []),\n            getRelatedElement: selection => imageUtils.getClosestSelectedImageWidget(selection)\n        });\n    }\n}\n/**\n * Convert the dropdown definitions to their keys registered in the ComponentFactory.\n * The registration precess should be handled by the plugin which handles the UI of a particular feature.\n */\nfunction normalizeDeclarativeConfig(config) {\n    return config.map(item => isObject(item) ? item.name : item);\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageresize\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageResizeButtons } from './imageresize/imageresizebuttons.js';\nimport { ImageResizeEditing } from './imageresize/imageresizeediting.js';\nimport { ImageResizeHandles } from './imageresize/imageresizehandles.js';\nimport { ImageCustomResizeUI } from './imageresize/imagecustomresizeui.js';\nimport '../theme/imageresize.css';\n/**\n * The image resize plugin.\n *\n * It adds a possibility to resize each image using handles.\n */\nexport class ImageResize extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageResizeEditing, ImageResizeHandles, ImageCustomResizeUI, ImageResizeButtons];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageResize';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/link\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { LinkEditing } from './linkediting.js';\nimport { LinkUI } from './linkui.js';\nimport { AutoLink } from './autolink.js';\n/**\n * The link plugin.\n *\n * This is a \"glue\" plugin that loads the {@link module:link/linkediting~LinkEditing link editing feature}\n * and {@link module:link/linkui~LinkUI link UI feature}.\n */\nexport class Link extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [LinkEditing, LinkUI, AutoLink];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Link';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/list\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ListEditing } from './list/listediting.js';\nimport { ListUI } from './list/listui.js';\n/**\n * The list feature.\n *\n * This is a \"glue\" plugin that loads the {@link module:list/list/listediting~ListEditing  list\n * editing feature} and {@link module:list/list/listui~ListUI list UI feature}.\n */\nexport class List extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListEditing, ListUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'List';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module alignment/alignment\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { AlignmentEditing } from './alignmentediting.js';\nimport { AlignmentUI } from './alignmentui.js';\n/**\n * The text alignment plugin.\n *\n * For a detailed overview, check the {@glink features/text-alignment Text alignment} feature guide\n * and the {@glink api/alignment package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:alignment/alignmentediting~AlignmentEditing} and\n * {@link module:alignment/alignmentui~AlignmentUI} plugins.\n */\nexport class Alignment extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [AlignmentEditing, AlignmentUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Alignment';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module autosave/autosave\n */\nimport { Plugin, PendingActions } from 'ckeditor5/src/core.js';\nimport { DomEmitterMixin } from 'ckeditor5/src/utils.js';\nimport { debounce } from 'es-toolkit/compat';\n/**\n * The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)\n * when needed (when the user changed the content).\n *\n * It listens to the {@link module:engine/model/document~ModelDocument#event:change:data `editor.model.document#change:data`}\n * and `window#beforeunload` events and calls the\n * {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.\n *\n * ```ts\n * ClassicEditor\n * \t.create( document.querySelector( '#editor' ), {\n * \t\tplugins: [ ArticlePluginSet, Autosave ],\n * \t\ttoolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],\n * \t\timage: {\n * \t\t\ttoolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],\n * \t\t},\n * \t\tautosave: {\n * \t\t\tsave( editor: Editor ) {\n * \t\t\t\t// The saveData() function must return a promise\n * \t\t\t\t// which should be resolved when the data is successfully saved.\n * \t\t\t\treturn saveData( editor.getData() );\n * \t\t\t}\n * \t\t}\n * \t} );\n * ```\n *\n * Read more about this feature in the {@glink features/autosave Autosave} feature guide.\n */\nexport class Autosave extends Plugin {\n    /**\n     * The adapter is an object with a `save()` method. That method will be called whenever\n     * the data changes. It might be called some time after the change,\n     * since the event is throttled for performance reasons.\n     */\n    adapter;\n    /**\n     * Debounced save method. The `save()` method is called the specified `waitingTime` after `debouncedSave()` is called,\n     * unless a new action happens in the meantime.\n     */\n    _debouncedSave;\n    /**\n     * The last saved document version.\n     */\n    _lastDocumentVersion;\n    /**\n     * Promise used for asynchronous save calls.\n     *\n     * Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if\n     * save is called before the promise has been resolved. It is set to `null` if there is no call in progress.\n     */\n    _savePromise;\n    /**\n     * DOM emitter.\n     */\n    _domEmitter;\n    /**\n     * The configuration of this plugins.\n     */\n    _config;\n    /**\n     * Editor's pending actions manager.\n     */\n    _pendingActions;\n    /**\n     * Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.\n     *\n     * This is set to `true` when there is a save request while autosave callback is already being processed\n     * and the model has changed since the last save.\n     */\n    _makeImmediateSave;\n    /**\n     * An action that will be added to the pending action manager for actions happening in that plugin.\n     */\n    _action = null;\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Autosave';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [PendingActions];\n    }\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        const config = editor.config.get('autosave') || {};\n        // A minimum amount of time that needs to pass after the last action.\n        // After that time the provided save callbacks are being called.\n        const waitingTime = config.waitingTime || 1000;\n        this.set('state', 'synchronized');\n        this._debouncedSave = debounce(this._save.bind(this), waitingTime);\n        this._lastDocumentVersion = editor.model.document.version;\n        this._savePromise = null;\n        this._domEmitter = new (DomEmitterMixin())();\n        this._config = config;\n        this._pendingActions = editor.plugins.get(PendingActions);\n        this._makeImmediateSave = false;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const doc = editor.model.document;\n        // Add the listener only after the editor is initialized to prevent firing save callback on data init.\n        this.listenTo(editor, 'ready', () => {\n            this.listenTo(doc, 'change:data', (evt, batch) => {\n                if (!this._saveCallbacks.length) {\n                    return;\n                }\n                if (!batch.isLocal) {\n                    return;\n                }\n                if (this.state === 'synchronized') {\n                    this.state = 'waiting';\n                    // Set pending action already when we are waiting for the autosave callback.\n                    this._setPendingAction();\n                }\n                if (this.state === 'waiting') {\n                    this._debouncedSave();\n                }\n                // If the plugin is in `saving` state, it will change its state later basing on the `document.version`.\n                // If the `document.version` will be higher than stored `#_lastDocumentVersion`, then it means, that some `change:data`\n                // event has fired in the meantime.\n            });\n        });\n        // Flush on the editor's destroy listener with the highest priority to ensure that\n        // `editor.getData()` will be called before plugins are destroyed.\n        this.listenTo(editor, 'destroy', () => this._flush(), { priority: 'highest' });\n        // It's not possible to easy test it because karma uses `beforeunload` event\n        // to warn before full page reload and this event cannot be dispatched manually.\n        /* istanbul ignore next -- @preserve */\n        this._domEmitter.listenTo(window, 'beforeunload', (evtInfo, domEvt) => {\n            if (this._pendingActions.hasAny) {\n                domEvt.returnValue = this._pendingActions.first.message;\n            }\n        });\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        // There's no need for canceling or flushing the throttled save, as\n        // it's done on the editor's destroy event with the highest priority.\n        this._domEmitter.stopListening();\n        super.destroy();\n    }\n    /**\n     * Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave\n     * callback in progress, then the requested save will be performed immediately after the current callback finishes.\n     *\n     * @returns A promise that will be resolved when the autosave callback is finished.\n     */\n    save() {\n        this._debouncedSave.cancel();\n        return this._save();\n    }\n    /**\n     * Invokes the remaining `_save()` method call.\n     */\n    _flush() {\n        this._debouncedSave.flush();\n    }\n    /**\n     * If the adapter is set and a new document version exists,\n     * the `_save()` method creates a pending action and calls the `adapter.save()` method.\n     * It waits for the result and then removes the created pending action.\n     *\n     * @returns A promise that will be resolved when the autosave callback is finished.\n     */\n    _save() {\n        if (this._savePromise) {\n            this._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;\n            return this._savePromise;\n        }\n        // Make sure there is a pending action (in case if `_save()` was called through manual `save()` call).\n        this._setPendingAction();\n        this.state = 'saving';\n        this._lastDocumentVersion = this.editor.model.document.version;\n        // Wait one promise cycle to be sure that save callbacks are not called inside a conversion or when the editor's state changes.\n        this._savePromise = Promise.resolve()\n            // Make autosave callback.\n            .then(() => Promise.all(this._saveCallbacks.map(cb => cb(this.editor))))\n            // When the autosave callback is finished, always clear `this._savePromise`, no matter if it was successful or not.\n            .finally(() => {\n            this._savePromise = null;\n        })\n            // If the save was successful, we have three scenarios:\n            //\n            // 1. If a save was requested when an autosave callback was already processed, we need to immediately call\n            // another autosave callback. In this case, `this._savePromise` will not be resolved until the next callback is done.\n            // 2. Otherwise, if changes happened to the model, make a delayed autosave callback (like the change just happened).\n            // 3. If no changes happened to the model, return to the `synchronized` state.\n            .then(() => {\n            if (this._makeImmediateSave) {\n                this._makeImmediateSave = false;\n                // Start another autosave callback. Return a promise that will be resolved after the new autosave callback.\n                // This way promises returned by `_save()` will not be resolved until all changes are saved.\n                //\n                // If `save()` was called when another (most often automatic) autosave callback was already processed,\n                // the promise returned by `save()` call will be resolved only after new changes have been saved.\n                //\n                // Note that it would not work correctly if `this._savePromise` is not cleared.\n                return this._save();\n            }\n            else {\n                if (this.editor.model.document.version > this._lastDocumentVersion) {\n                    this.state = 'waiting';\n                    this._debouncedSave();\n                }\n                else {\n                    this.state = 'synchronized';\n                    this._pendingActions.remove(this._action);\n                    this._action = null;\n                }\n            }\n        })\n            // In case of an error, retry the autosave callback after a delay (and also throw the original error).\n            .catch(err => {\n            // Change state to `error` so that listeners handling autosave error can be called.\n            this.state = 'error';\n            // Then, immediately change to the `saving` state as described above.\n            // Being in the `saving` state ensures that the autosave callback won't be delayed further by the `change:data` listener.\n            this.state = 'saving';\n            this._debouncedSave();\n            throw err;\n        });\n        return this._savePromise;\n    }\n    /**\n     * Creates a pending action if it is not set already.\n     */\n    _setPendingAction() {\n        const t = this.editor.t;\n        if (!this._action) {\n            this._action = this._pendingActions.add(t('Saving changes'));\n        }\n    }\n    /**\n     * Saves callbacks.\n     */\n    get _saveCallbacks() {\n        const saveCallbacks = [];\n        if (this.adapter && this.adapter.save) {\n            saveCallbacks.push(this.adapter.save);\n        }\n        if (this._config.save) {\n            saveCallbacks.push(this._config.save);\n        }\n        return saveCallbacks;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module font/font\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FontFamily } from './fontfamily.js';\nimport { FontSize } from './fontsize.js';\nimport { FontColor } from './fontcolor.js';\nimport { FontBackgroundColor } from './fontbackgroundcolor.js';\n/**\n * A plugin that enables a set of text styling features:\n *\n * * {@link module:font/fontsize~FontSize},\n * * {@link module:font/fontfamily~FontFamily}.\n * * {@link module:font/fontcolor~FontColor},\n * * {@link module:font/fontbackgroundcolor~FontBackgroundColor}.\n *\n * For a detailed overview, check the {@glink features/font Font feature} documentation\n * and the {@glink api/font package page}.\n */\nexport class Font extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FontFamily, FontSize, FontColor, FontBackgroundColor];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Font';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/pastefromoffice\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';\nimport { PasteFromOfficeMSWordNormalizer } from './normalizers/mswordnormalizer.js';\nimport { GoogleDocsNormalizer } from './normalizers/googledocsnormalizer.js';\nimport { GoogleSheetsNormalizer } from './normalizers/googlesheetsnormalizer.js';\nimport { parsePasteOfficeHtml } from './filters/parse.js';\n/**\n * The Paste from Office plugin.\n *\n * This plugin handles content pasted from Office apps and transforms it (if necessary)\n * to a valid structure which can then be understood by the editor features.\n *\n * Transformation is made by a set of predefined {@link module:paste-from-office/normalizer~PasteFromOfficeNormalizer normalizers}.\n * This plugin includes following normalizers:\n * * {@link module:paste-from-office/normalizers/mswordnormalizer~PasteFromOfficeMSWordNormalizer Microsoft Word normalizer}\n * * {@link module:paste-from-office/normalizers/googledocsnormalizer~GoogleDocsNormalizer Google Docs normalizer}\n *\n * For more information about this feature check the {@glink api/paste-from-office package page}.\n */\nexport class PasteFromOffice extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'PasteFromOffice';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'PFO';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ClipboardPipeline];\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        const clipboardPipeline = editor.plugins.get('ClipboardPipeline');\n        const viewDocument = editor.editing.view.document;\n        const normalizers = [];\n        const hasMultiLevelListPlugin = this.editor.plugins.has('MultiLevelList');\n        const hasTablePropertiesPlugin = this.editor.plugins.has('TableProperties');\n        const hasExtendedTableBlockAlignment = !!this.editor.config.get('experimentalFlags.useExtendedTableBlockAlignment');\n        normalizers.push(new PasteFromOfficeMSWordNormalizer(viewDocument, hasMultiLevelListPlugin, hasTablePropertiesPlugin, hasExtendedTableBlockAlignment));\n        normalizers.push(new GoogleDocsNormalizer(viewDocument));\n        normalizers.push(new GoogleSheetsNormalizer(viewDocument));\n        clipboardPipeline.on('inputTransformation', (evt, data) => {\n            if (data._isTransformedWithPasteFromOffice) {\n                return;\n            }\n            const codeBlock = editor.model.document.selection.getFirstPosition().parent;\n            if (codeBlock.is('element', 'codeBlock')) {\n                return;\n            }\n            const htmlString = data.dataTransfer.getData('text/html');\n            const activeNormalizer = normalizers.find(normalizer => normalizer.isActive(htmlString));\n            if (activeNormalizer) {\n                if (!data._parsedData) {\n                    data._parsedData = parsePasteOfficeHtml(htmlString, viewDocument.stylesProcessor);\n                }\n                activeNormalizer.execute(data);\n                data._isTransformedWithPasteFromOffice = true;\n            }\n        }, { priority: 'high' });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module paste-from-office/filters/parse\n */\nimport { ViewDomConverter, ViewDocument } from 'ckeditor5/src/engine.js';\nimport { normalizeSpacing, normalizeSpacerunSpans } from './space.js';\n/**\n * Parses the provided HTML extracting contents of `<body>` and `<style>` tags.\n *\n * @param htmlString HTML string to be parsed.\n */\nexport function parsePasteOfficeHtml(htmlString, stylesProcessor) {\n    const domParser = new DOMParser();\n    // Remove Word specific \"if comments\" so content inside is not omitted by the parser.\n    htmlString = htmlString.replace(/<!--\\[if gte vml 1]>/g, '');\n    // Clean the <head> section of MS Windows specific tags. See https://github.com/ckeditor/ckeditor5/issues/15333.\n    // The regular expression matches the <o:SmartTagType> tag with optional attributes (with or without values).\n    htmlString = htmlString.replace(/<o:SmartTagType(?:\\s+[^\\s>=]+(?:=\"[^\"]*\")?)*\\s*\\/?>/gi, '');\n    const normalizedHtml = normalizeSpacing(cleanContentAfterBody(htmlString));\n    // Parse htmlString as native Document object.\n    const htmlDocument = domParser.parseFromString(normalizedHtml, 'text/html');\n    normalizeSpacerunSpans(htmlDocument);\n    // Get `innerHTML` first as transforming to View modifies the source document.\n    const bodyString = htmlDocument.body.innerHTML;\n    // Transform document.body to View.\n    const bodyView = documentToView(htmlDocument, stylesProcessor);\n    // Extract stylesheets.\n    const stylesObject = extractStyles(htmlDocument);\n    return {\n        body: bodyView,\n        bodyString,\n        styles: stylesObject.styles,\n        stylesString: stylesObject.stylesString\n    };\n}\n/**\n * Transforms native `Document` object into {@link module:engine/view/documentfragment~ViewDocumentFragment}. Comments are skipped.\n *\n * @param htmlDocument Native `Document` object to be transformed.\n */\nfunction documentToView(htmlDocument, stylesProcessor) {\n    const viewDocument = new ViewDocument(stylesProcessor);\n    const domConverter = new ViewDomConverter(viewDocument, { renderingMode: 'data' });\n    const fragment = htmlDocument.createDocumentFragment();\n    const nodes = htmlDocument.body.childNodes;\n    while (nodes.length > 0) {\n        fragment.appendChild(nodes[0]);\n    }\n    return domConverter.domToView(fragment, { skipComments: true });\n}\n/**\n * Extracts both `CSSStyleSheet` and string representation from all `style` elements available in a provided `htmlDocument`.\n *\n * @param htmlDocument Native `Document` object from which styles will be extracted.\n */\nfunction extractStyles(htmlDocument) {\n    const styles = [];\n    const stylesString = [];\n    const styleTags = Array.from(htmlDocument.getElementsByTagName('style'));\n    for (const style of styleTags) {\n        if (style.sheet && style.sheet.cssRules && style.sheet.cssRules.length) {\n            styles.push(style.sheet);\n            stylesString.push(style.innerHTML);\n        }\n    }\n    return {\n        styles,\n        stylesString: stylesString.join(' ')\n    };\n}\n/**\n * Removes leftover content from between closing </body> and closing </html> tag:\n *\n * ```html\n * <html><body><p>Foo Bar</p></body><span>Fo</span></html> -> <html><body><p>Foo Bar</p></body></html>\n * ```\n *\n * This function is used as specific browsers (Edge) add some random content after `body` tag when pasting from Word.\n * @param htmlString The HTML string to be cleaned.\n * @returns The HTML string with leftover content removed.\n */\nfunction cleanContentAfterBody(htmlString) {\n    const bodyCloseTag = '</body>';\n    const htmlCloseTag = '</html>';\n    const bodyCloseIndex = htmlString.indexOf(bodyCloseTag);\n    if (bodyCloseIndex < 0) {\n        return htmlString;\n    }\n    const htmlCloseIndex = htmlString.indexOf(htmlCloseTag, bodyCloseIndex + bodyCloseTag.length);\n    return htmlString.substring(0, bodyCloseIndex + bodyCloseTag.length) +\n        (htmlCloseIndex >= 0 ? htmlString.substring(htmlCloseIndex) : '');\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module media-embed/mediaembed\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { MediaEmbedEditing } from './mediaembedediting.js';\nimport { AutoMediaEmbed } from './automediaembed.js';\nimport { MediaEmbedUI } from './mediaembedui.js';\nimport '../theme/mediaembed.css';\n/**\n * The media embed plugin.\n *\n * For a detailed overview, check the {@glink features/media-embed Media Embed feature documentation}.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n *\n * * The {@link module:media-embed/mediaembedediting~MediaEmbedEditing media embed editing feature},\n * * The {@link module:media-embed/mediaembedui~MediaEmbedUI media embed UI feature} and\n * * The {@link module:media-embed/automediaembed~AutoMediaEmbed auto-media embed feature}.\n */\nexport class MediaEmbed extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [MediaEmbedEditing, MediaEmbedUI, AutoMediaEmbed, Widget];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'MediaEmbed';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module remove-format/removeformat\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { RemoveFormatUI } from './removeformatui.js';\nimport { RemoveFormatEditing } from './removeformatediting.js';\n/**\n * The remove format plugin.\n *\n * This is a \"glue\" plugin which loads the {@link module:remove-format/removeformatediting~RemoveFormatEditing}\n * and {@link module:remove-format/removeformatui~RemoveFormatUI} plugins.\n *\n * For a detailed overview, check out the {@glink features/remove-format remove format} feature documentation.\n */\nexport class RemoveFormat extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [RemoveFormatEditing, RemoveFormatUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'RemoveFormat';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/table\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { TableEditing } from './tableediting.js';\nimport { TableUI } from './tableui.js';\nimport { TableSelection } from './tableselection.js';\nimport { TableClipboard } from './tableclipboard.js';\nimport { TableKeyboard } from './tablekeyboard.js';\nimport { TableMouse } from './tablemouse.js';\nimport '../theme/table.css';\n/**\n * The table plugin.\n *\n * For a detailed overview, check the {@glink features/tables/tables Table feature documentation}.\n *\n * This is a \"glue\" plugin that loads the following table features:\n *\n * * {@link module:table/tableediting~TableEditing editing feature},\n * * {@link module:table/tableselection~TableSelection selection feature},\n * * {@link module:table/tablekeyboard~TableKeyboard keyboard navigation feature},\n * * {@link module:table/tablemouse~TableMouse mouse selection feature},\n * * {@link module:table/tableclipboard~TableClipboard clipboard feature},\n * * {@link module:table/tableui~TableUI UI feature}.\n */\nexport class Table extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableEditing, TableUI, TableSelection, TableMouse, TableKeyboard, TableClipboard, Widget];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Table';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tabletoolbar\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';\nimport { getSelectedTableWidget, getTableWidgetAncestor } from './utils/ui/widget.js';\n/**\n * The table toolbar class. It creates toolbars for the table feature and its content (for now only for the table cell content).\n *\n * The table toolbar shows up when a table widget is selected. Its components (e.g. buttons) are created based on the\n * {@link module:table/tableconfig~TableConfig#tableToolbar `table.tableToolbar` configuration option}.\n *\n * Table content toolbar shows up when the selection is inside the content of a table. It creates its component based on the\n * {@link module:table/tableconfig~TableConfig#contentToolbar `table.contentToolbar` configuration option}.\n */\nexport class TableToolbar extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [WidgetToolbarRepository];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableToolbar';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    afterInit() {\n        const editor = this.editor;\n        const t = editor.t;\n        const widgetToolbarRepository = editor.plugins.get(WidgetToolbarRepository);\n        const tableContentToolbarItems = editor.config.get('table.contentToolbar');\n        const tableToolbarItems = editor.config.get('table.tableToolbar');\n        if (tableContentToolbarItems) {\n            widgetToolbarRepository.register('tableContent', {\n                ariaLabel: t('Table toolbar'),\n                items: tableContentToolbarItems,\n                getRelatedElement: getTableWidgetAncestor\n            });\n        }\n        if (tableToolbarItems) {\n            widgetToolbarRepository.register('table', {\n                ariaLabel: t('Table toolbar'),\n                items: tableToolbarItems,\n                getRelatedElement: getSelectedTableWidget\n            });\n        }\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecaption\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TableCaptionEditing } from './tablecaption/tablecaptionediting.js';\nimport { TableCaptionUI } from './tablecaption/tablecaptionui.js';\nimport '../theme/tablecaption.css';\n/**\n * The table caption plugin.\n */\nexport class TableCaption extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCaption';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableCaptionEditing, TableCaptionUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tableproperties\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TablePropertiesEditing } from './tableproperties/tablepropertiesediting.js';\nimport { TablePropertiesUI } from './tableproperties/tablepropertiesui.js';\n/**\n * The table properties feature. Enables support for setting properties of tables (size, border, background, etc.).\n *\n * Read more in the {@glink features/tables/tables-styling Table and cell styling tools} section.\n * See also the {@link module:table/tablecellproperties~TableCellProperties} plugin.\n *\n * This is a \"glue\" plugin that loads the\n * {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing table properties editing feature} and\n * the {@link module:table/tableproperties/tablepropertiesui~TablePropertiesUI table properties UI feature}.\n */\nexport class TableProperties extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableProperties';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TablePropertiesEditing, TablePropertiesUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module table/tablecellproperties\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui.js';\nimport { TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting.js';\n/**\n * The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).\n *\n * Read more in the {@glink features/tables/tables-styling Table and cell styling tools} section.\n * See also the {@link module:table/tableproperties~TableProperties} plugin.\n *\n * This is a \"glue\" plugin that loads the\n * {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and\n * the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.\n */\nexport class TableCellProperties extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TableCellProperties';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TableCellPropertiesEditing, TableCellPropertiesUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module indent/indent\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { IndentEditing } from './indentediting.js';\nimport { IndentUI } from './indentui.js';\n/**\n * The indent feature.\n *\n * This plugin acts as a single entry point plugin for other features that implement indentation of elements like lists or paragraphs.\n *\n * The compatible features are:\n *\n * * The {@link module:list/list~List} or {@link module:list/list/listediting~ListEditing} feature for list indentation.\n * * The {@link module:indent/indentblock~IndentBlock} feature for block indentation.\n *\n * This is a \"glue\" plugin that loads the following plugins:\n *\n * * The {@link module:indent/indentediting~IndentEditing indent editing feature}.\n * * The {@link module:indent/indentui~IndentUI indent UI feature}.\n *\n * The dependent plugins register the `'indent'` and `'outdent'` commands and introduce the `'indent'` and `'outdent'` buttons\n * that allow to increase or decrease text indentation of supported elements.\n *\n * **Note**: In order for the commands and buttons to work, at least one of compatible features is required.\n */\nexport class Indent extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Indent';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [IndentEditing, IndentUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module highlight/highlight\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { HighlightEditing } from './highlightediting.js';\nimport { HighlightUI } from './highlightui.js';\n/**\n * The highlight plugin.\n *\n * For a detailed overview, check the {@glink features/highlight Highlight feature} documentation.\n *\n * This is a \"glue\" plugin which loads the {@link module:highlight/highlightediting~HighlightEditing} and\n * {@link module:highlight/highlightui~HighlightUI} plugins.\n */\nexport class Highlight extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [HighlightEditing, HighlightUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Highlight';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/todolist\n */\nimport { TodoListEditing } from './todolist/todolistediting.js';\nimport { TodoListUI } from './todolist/todolistui.js';\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport '../theme/todolist.css';\n/**\n * The to-do list feature.\n *\n * This is a \"glue\" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list\n * editing feature} and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.\n */\nexport class TodoList extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [TodoListEditing, TodoListUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'TodoList';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module list/listproperties\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ListPropertiesEditing } from './listproperties/listpropertiesediting.js';\nimport { ListPropertiesUI } from './listproperties/listpropertiesui.js';\n/**\n * The list properties feature.\n *\n * This is a \"glue\" plugin that loads the\n * {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties\n * editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.\n */\nexport class ListProperties extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ListPropertiesEditing, ListPropertiesUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ListProperties';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module image/imageinsert\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ImageUpload } from './imageupload.js';\nimport { ImageInsertViaUrl } from './imageinsertviaurl.js';\nimport { ImageInsertUI } from './imageinsert/imageinsertui.js';\n/**\n * The image insert plugin.\n *\n * For a detailed overview, check the {@glink features/images/image-upload/image-upload Image upload feature}\n * and {@glink features/images/images-inserting Insert images via source URL} documentation.\n *\n * This plugin does not do anything directly, but it loads a set of specific plugins\n * to enable image uploading or inserting via implemented integrations:\n *\n * * {@link module:image/imageupload~ImageUpload}\n * * {@link module:image/imageinsert/imageinsertui~ImageInsertUI}\n */\nexport class ImageInsert extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ImageInsert';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ImageUpload, ImageInsertViaUrl, ImageInsertUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Template, View } from 'ckeditor5/src/ui.js';\nimport { env } from 'ckeditor5/src/utils.js';\nimport { modelElementToPlainText } from './utils.js';\nimport { throttle, isElement } from 'es-toolkit/compat';\n/**\n * The word count plugin.\n *\n * This plugin calculates all words and characters in all {@link module:engine/model/text~ModelText text nodes} available in the model.\n * It also provides an HTML element that updates its state whenever the editor content is changed.\n *\n * The model's data is first converted to plain text using {@link module:word-count/utils~modelElementToPlainText}.\n * The number of words and characters in your text are determined based on the created plain text. Please keep in mind\n * that every block in the editor is separated with a newline character, which is included in the calculation.\n *\n * Here are some examples of how the word and character calculations are made:\n *\n * ```html\n * <paragraph>foo</paragraph>\n * <paragraph>bar</paragraph>\n * // Words: 2, Characters: 7\n *\n * <paragraph><$text bold=\"true\">foo</$text>bar</paragraph>\n * // Words: 1, Characters: 6\n *\n * <paragraph>*&^%)</paragraph>\n * // Words: 0, Characters: 5\n *\n * <paragraph>foo(bar)</paragraph>\n * //Words: 1, Characters: 8\n *\n * <paragraph>12345</paragraph>\n * // Words: 1, Characters: 5\n * ```\n */\nexport class WordCount extends Plugin {\n    /**\n     * The configuration of this plugin.\n     */\n    _config;\n    /**\n     * The reference to a {@link module:ui/view~View view object} that contains the self-updating HTML container.\n     */\n    _outputView;\n    /**\n     * A regular expression used to recognize words in the editor's content.\n     */\n    _wordsMatchRegExp;\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        this.set('characters', 0);\n        this.set('words', 0);\n        // Don't wait for the #update event to set the value of the properties but obtain it right away.\n        // This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.\n        // If not accessed directly, the properties will be refreshed upon #update anyway.\n        Object.defineProperties(this, {\n            characters: {\n                get() {\n                    return (this.characters = this._getCharacters(this._getText()));\n                }\n            },\n            words: {\n                get() {\n                    return (this.words = this._getWords(this._getText()));\n                }\n            }\n        });\n        this.set('_wordsLabel', undefined);\n        this.set('_charactersLabel', undefined);\n        this._config = editor.config.get('wordCount') || {};\n        this._outputView = undefined;\n        this._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ?\n            // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n            // Groups:\n            // {L} - Any kind of letter from any language.\n            // {N} - Any kind of numeric character in any script.\n            new RegExp('([\\\\p{L}\\\\p{N}]+\\\\S?)+', 'gu') :\n            /([a-zA-Z0-9À-ž]+\\S?)+/gu;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'WordCount';\n    }\n    /**\n     * @inheritDoc\n     * @internal\n     */\n    static get licenseFeatureCode() {\n        return 'WC';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isPremiumPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const editor = this.editor;\n        editor.model.document.on('change:data', throttle(this._refreshStats.bind(this), 250));\n        if (typeof this._config.onUpdate == 'function') {\n            this.on('update', (evt, data) => {\n                this._config.onUpdate(data);\n            });\n        }\n        if (isElement(this._config.container)) {\n            this._config.container.appendChild(this.wordCountContainer);\n        }\n    }\n    /**\n     * @inheritDoc\n     */\n    destroy() {\n        if (this._outputView) {\n            this._outputView.element.remove();\n            this._outputView.destroy();\n        }\n        super.destroy();\n    }\n    /**\n     * Creates a self-updating HTML element. Repeated executions return the same element.\n     * The returned element has the following HTML structure:\n     *\n     * ```html\n     * <div class=\"ck ck-word-count\">\n     * \t<div class=\"ck-word-count__words\">Words: 4</div>\n     * \t<div class=\"ck-word-count__characters\">Characters: 28</div>\n     * </div>\n     * ```\n     */\n    get wordCountContainer() {\n        const editor = this.editor;\n        const t = editor.t;\n        const displayWords = editor.config.get('wordCount.displayWords');\n        const displayCharacters = editor.config.get('wordCount.displayCharacters');\n        const bind = Template.bind(this, this);\n        const children = [];\n        if (!this._outputView) {\n            this._outputView = new View();\n            if (displayWords || displayWords === undefined) {\n                this.bind('_wordsLabel').to(this, 'words', words => {\n                    return t('Words: %0', words);\n                });\n                children.push({\n                    tag: 'div',\n                    children: [\n                        {\n                            text: [bind.to('_wordsLabel')]\n                        }\n                    ],\n                    attributes: {\n                        class: 'ck-word-count__words'\n                    }\n                });\n            }\n            if (displayCharacters || displayCharacters === undefined) {\n                this.bind('_charactersLabel').to(this, 'characters', words => {\n                    return t('Characters: %0', words);\n                });\n                children.push({\n                    tag: 'div',\n                    children: [\n                        {\n                            text: [bind.to('_charactersLabel')]\n                        }\n                    ],\n                    attributes: {\n                        class: 'ck-word-count__characters'\n                    }\n                });\n            }\n            this._outputView.setTemplate({\n                tag: 'div',\n                attributes: {\n                    class: [\n                        'ck',\n                        'ck-word-count'\n                    ]\n                },\n                children\n            });\n            this._outputView.render();\n        }\n        return this._outputView.element;\n    }\n    _getText() {\n        let txt = '';\n        for (const root of this.editor.model.document.getRoots()) {\n            if (txt !== '') {\n                // Add a delimiter, so words from each root are treated independently.\n                txt += '\\n';\n            }\n            txt += modelElementToPlainText(root);\n        }\n        return txt;\n    }\n    /**\n     * Determines the number of characters in the current editor's model.\n     */\n    _getCharacters(txt) {\n        return txt.replace(/\\n/g, '').length;\n    }\n    /**\n     * Determines the number of words in the current editor's model.\n     */\n    _getWords(txt) {\n        const detectedWords = txt.match(this._wordsMatchRegExp) || [];\n        return detectedWords.length;\n    }\n    /**\n     * Determines the number of words and characters in the current editor's model and assigns it to {@link #characters} and {@link #words}.\n     * It also fires the {@link #event:update}.\n     *\n     * @fires update\n     */\n    _refreshStats() {\n        const txt = this._getText();\n        const words = this.words = this._getWords(txt);\n        const characters = this.characters = this._getCharacters(txt);\n        this.fire('update', {\n            words,\n            characters\n        });\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module mention/mention\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { MentionEditing, _toMentionAttribute } from './mentionediting.js';\nimport { MentionUI } from './mentionui.js';\nimport '../theme/mention.css';\n/**\n * The mention plugin.\n *\n * For a detailed overview, check the {@glink features/mentions Mention feature} guide.\n */\nexport class Mention extends Plugin {\n    toMentionAttribute(viewElement, data) {\n        return _toMentionAttribute(viewElement, data);\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Mention';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [MentionEditing, MentionUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module markdown-gfm/markdown\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { MarkdownGfmDataProcessor } from './gfmdataprocessor.js';\n/**\n * The GitHub Flavored Markdown (GFM) plugin.\n *\n * For a detailed overview, check the {@glink features/markdown Markdown feature} guide.\n */\nexport class Markdown extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    constructor(editor) {\n        super(editor);\n        editor.data.processor = new MarkdownGfmDataProcessor(editor.data.viewDocument);\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Markdown';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module page-break/pagebreak\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { PageBreakEditing } from './pagebreakediting.js';\nimport { PageBreakUI } from './pagebreakui.js';\n/**\n * The page break feature.\n *\n * It provides the possibility to insert a page break into the rich-text editor.\n *\n * For a detailed overview, check the {@glink features/page-break Page break feature} documentation.\n */\nexport class PageBreak extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [PageBreakEditing, PageBreakUI, Widget];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'PageBreak';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module style/style\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { StyleUI } from './styleui.js';\nimport { StyleEditing } from './styleediting.js';\n/**\n * The style plugin.\n *\n * This is a \"glue\" plugin that loads the {@link module:style/styleediting~StyleEditing style editing feature}\n * and {@link module:style/styleui~StyleUI style UI feature}.\n */\nexport class Style extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'Style';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [StyleEditing, StyleUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module horizontal-line/horizontalline\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { HorizontalLineEditing } from './horizontallineediting.js';\nimport { HorizontalLineUI } from './horizontallineui.js';\n/**\n * The horizontal line feature.\n *\n * It provides the possibility to insert a horizontal line into the rich-text editor.\n *\n * For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.\n */\nexport class HorizontalLine extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [HorizontalLineEditing, HorizontalLineUI, Widget];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HorizontalLine';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module link/linkimage\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { LinkImageEditing } from './linkimageediting.js';\nimport { LinkImageUI } from './linkimageui.js';\nimport '../theme/linkimage.css';\n/**\n * The `LinkImage` plugin.\n *\n * This is a \"glue\" plugin that loads the {@link module:link/linkimageediting~LinkImageEditing link image editing feature}\n * and {@link module:link/linkimageui~LinkImageUI link image UI feature}.\n */\nexport class LinkImage extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [LinkImageEditing, LinkImageUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'LinkImage';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module html-embed/htmlembed\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { Widget } from 'ckeditor5/src/widget.js';\nimport { HtmlEmbedEditing } from './htmlembedediting.js';\nimport { HtmlEmbedUI } from './htmlembedui.js';\n/**\n * The HTML embed feature.\n *\n * It allows inserting HTML snippets directly into the editor.\n *\n * For a detailed overview, check the {@glink features/html/html-embed HTML embed feature} documentation.\n */\nexport class HtmlEmbed extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [HtmlEmbedEditing, HtmlEmbedUI, Widget];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'HtmlEmbed';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n}\n","export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 20 20\\\"><path d=\\\"M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.27 7.27 0 0 1 2.703 3.454 7.13 7.13 0 0 1 .199 4.353c-.39 1.436-1.475 2.72-2.633 3.677h2.013c0-.226.092-.443.254-.603a.876.876 0 0 1 1.229 0c.163.16.254.377.254.603v.853c0 .209-.078.41-.22.567a.87.87 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.6 5.6 0 0 0 2.492-2.371 5.46 5.46 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.7 5.7 0 0 0 10 4.206 5.7 5.7 0 0 0 6.419 5.46 5.53 5.53 0 0 0 4.46 8.663a5.46 5.46 0 0 0 .554 3.695 5.6 5.6 0 0 0 2.497 2.37.55.55 0 0 1 .317.49v1.264c0 .286-.23.518-.516.518H2.618a.88.88 0 0 1-.614-.25.85.85 0 0 1-.254-.603v-.853c0-.226.091-.443.254-.603a.876.876 0 0 1 1.228 0c.163.16.255.377.255.603h1.925c-1.158-.958-2.155-2.241-2.545-3.678a7.13 7.13 0 0 1 .199-4.352 7.27 7.27 0 0 1 2.703-3.455A7.5 7.5 0 0 1 10 2.5\\\"/></svg>\";","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module special-characters/specialcharactersessentials\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { SpecialCharactersCurrency } from './specialcharacterscurrency.js';\nimport { SpecialCharactersMathematical } from './specialcharactersmathematical.js';\nimport { SpecialCharactersArrows } from './specialcharactersarrows.js';\nimport { SpecialCharactersLatin } from './specialcharacterslatin.js';\nimport { SpecialCharactersText } from './specialcharacterstext.js';\n/**\n * A plugin combining a basic set of characters for the special characters plugin.\n *\n * ```ts\n * ClassicEditor\n *   .create( {\n *     plugins: [ ..., SpecialCharacters, SpecialCharactersEssentials ],\n *   } )\n *   .then( ... )\n *   .catch( ... );\n * ```\n */\nexport class SpecialCharactersEssentials extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'SpecialCharactersEssentials';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [\n            SpecialCharactersCurrency,\n            SpecialCharactersText,\n            SpecialCharactersMathematical,\n            SpecialCharactersArrows,\n            SpecialCharactersLatin\n        ];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module show-blocks/showblocks\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { ShowBlocksEditing } from './showblocksediting.js';\nimport { ShowBlocksUI } from './showblocksui.js';\n/**\n * The show blocks feature.\n *\n * For a detailed overview, check the {@glink features/show-blocks Show blocks} feature guide.\n */\nexport class ShowBlocks extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'ShowBlocks';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [ShowBlocksEditing, ShowBlocksUI];\n    }\n}\n","/**\n * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options\n */\n/**\n * @module find-and-replace/findandreplace\n */\nimport { Plugin } from 'ckeditor5/src/core.js';\nimport { FindAndReplaceUI } from './findandreplaceui.js';\nimport { FindAndReplaceEditing } from './findandreplaceediting.js';\n/**\n * The find and replace plugin.\n *\n * For a detailed overview, check the {@glink features/find-and-replace Find and replace feature documentation}.\n *\n * This is a \"glue\" plugin which loads the following plugins:\n *\n * * The {@link module:find-and-replace/findandreplaceediting~FindAndReplaceEditing find and replace editing feature},\n * * The {@link module:find-and-replace/findandreplaceui~FindAndReplaceUI find and replace UI feature}\n */\nexport class FindAndReplace extends Plugin {\n    /**\n     * @inheritDoc\n     */\n    static get requires() {\n        return [FindAndReplaceEditing, FindAndReplaceUI];\n    }\n    /**\n     * @inheritDoc\n     */\n    static get pluginName() {\n        return 'FindAndReplace';\n    }\n    /**\n     * @inheritDoc\n     */\n    static get isOfficialPlugin() {\n        return true;\n    }\n    /**\n     * @inheritDoc\n     */\n    init() {\n        const ui = this.editor.plugins.get('FindAndReplaceUI');\n        const findAndReplaceEditing = this.editor.plugins.get('FindAndReplaceEditing');\n        const state = findAndReplaceEditing.state;\n        ui.on('findNext', (event, data) => {\n            // Data is contained only for the \"find\" button.\n            if (data) {\n                state.searchText = data.searchText;\n                findAndReplaceEditing.find(data.searchText, data);\n            }\n            else {\n                // Find next arrow button press.\n                this.editor.execute('findNext');\n            }\n        });\n        ui.on('findPrevious', (event, data) => {\n            if (data && state.searchText !== data.searchText) {\n                findAndReplaceEditing.find(data.searchText);\n            }\n            else {\n                // Subsequent calls.\n                this.editor.execute('findPrevious');\n            }\n        });\n        ui.on('replace', (event, data) => {\n            if (state.searchText !== data.searchText) {\n                findAndReplaceEditing.find(data.searchText);\n            }\n            const highlightedResult = state.highlightedResult;\n            if (highlightedResult) {\n                this.editor.execute('replace', data.replaceText, highlightedResult);\n            }\n        });\n        ui.on('replaceAll', (event, data) => {\n            // The state hadn't been yet built for this search text.\n            if (state.searchText !== data.searchText) {\n                findAndReplaceEditing.find(data.searchText);\n            }\n            this.editor.execute('replaceAll', data.replaceText, state.results);\n        });\n        // Reset the state when the user invalidated last search results, for instance,\n        // by starting typing another search query or changing options.\n        ui.on('searchReseted', () => {\n            state.clear(this.editor.model);\n            findAndReplaceEditing.stop();\n        });\n    }\n}\n","import ClassicEditor from './src/ckeditor';\nimport './src/override-django.css';\n\nwindow.ClassicEditor = ClassicEditor;\nwindow.ckeditorRegisterCallback = registerCallback;\nwindow.ckeditorUnregisterCallback = unregisterCallback;\nwindow.editors = {};\nlet editors = {};\nlet callbacks = {};\n\nfunction getCookie(name) {\n    let cookieValue = null;\n    if (document.cookie && document.cookie !== '') {\n        let cookies = document.cookie.split(';');\n        for (let i = 0; i < cookies.length; i++) {\n            let cookie = cookies[i].trim();\n            if (cookie.substring(0, name.length + 1) === (name + '=')) {\n                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n                break;\n            }\n        }\n    }\n    return cookieValue;\n}\n\n/**\n * Checks whether the element or its children match the query and returns\n * an array with the matches.\n * \n * @param {!HTMLElement} element\n * @param {!string} query\n * \n * @returns {array.<HTMLElement>}\n */\nfunction resolveElementArray(element, query) {\n    return element.matches(query) ? [element] : [...element.querySelectorAll(query)];\n}\n\n/**\n * This function initializes the CKEditor inputs within an optional element and\n * assigns properties necessary for the correct operation\n * \n * @param {HTMLElement} [element=document.body] - The element to search for elements\n * \n * @returns {void}\n */\nfunction createEditors(element = document.body) {\n    const allEditors = resolveElementArray(element, '.django_ckeditor_5');\n\n    allEditors.forEach(editorEl => {\n        if (\n            editorEl.id.indexOf('__prefix__') !== -1 ||\n            editorEl.getAttribute('data-processed') === '1'\n        ) {\n            return;\n        }\n        const script_id = `${editorEl.id}_script`;\n        // remove next sibling if it is an empty text node\n        if (editorEl.nextSibling.nodeType == Node.TEXT_NODE && editorEl.nextSibling.textContent.trim() === '') {\n          editorEl.nextSibling.remove();\n        }\n        const upload_url = element.querySelector(\n            `#${script_id}-ck-editor-5-upload-url`\n        ).getAttribute('data-upload-url');\n        const upload_file_types = JSON.parse(element.querySelector(\n            `#${script_id}-ck-editor-5-upload-url`\n        ).getAttribute('data-upload-file-types'));\n        const csrf_cookie_name = element.querySelector(\n            `#${script_id}-ck-editor-5-upload-url`\n        ).getAttribute('data-csrf_cookie_name');\n        const labelElement = element.querySelector(`[for$=\"${editorEl.id}\"]`);\n        if (labelElement) {\n            labelElement.style.float = 'none';\n        }\n\n        const config = JSON.parse(\n            element.querySelector(`#${script_id}-span`).textContent,\n            (key, value) => {\n                var match = value.toString().match(new RegExp('^/(.*?)/([gimy]*)$'));\n                if (match) {\n                   var regex = new RegExp(match[1], match[2]);\n                   return regex;\n                }\n                return value;\n            }\n        );\n        config.simpleUpload = {\n            'uploadUrl': upload_url,\n            'headers': {\n                'X-CSRFToken': getCookie(csrf_cookie_name),\n            },\n        };\n\n        config.fileUploader = {\n            'fileTypes': upload_file_types\n        };\n        config.licenseKey = 'GPL';\n\n        // Configure autosave if enabled\n        if (config.autosave) {\n            config.autosave.save = function(editor) {\n                return new Promise((resolve, reject) => {\n                    const textarea = document.querySelector(`#${editorEl.id}`);\n                    const data = editor.getData();\n                    textarea.value = data;\n\n                    // If save URL is provided, send to server\n                    if (config.autosave.saveUrl) {\n                        fetch(config.autosave.saveUrl, {\n                            method: 'POST',\n                            headers: {\n                                'Content-Type': 'application/json',\n                                'X-CSRFToken': getCookie(csrf_cookie_name),\n                            },\n                            body: JSON.stringify({\n                                id: editorEl.id,\n                                content: data\n                            })\n                        })\n                        .then(response => response.json())\n                        .then(result => resolve(result))\n                        .catch(error => reject(error));\n                    } else {\n                        // Just update textarea\n                        resolve();\n                    }\n                });\n            };\n        }\n\n        ClassicEditor.create(\n            editorEl,\n            config\n        ).then(editor => {\n\n            const textarea = document.querySelector(`#${editorEl.id}`);\n            editor.model.document.on('change:data', () => {\n                textarea.value = editor.getData();\n            });\n            if (editor.plugins.has('WordCount')) {\n                const wordCountPlugin = editor.plugins.get('WordCount');\n                const wordCountWrapper = element.querySelector(`#${script_id}-word-count`);\n                wordCountWrapper.innerHTML = '';\n                wordCountWrapper.appendChild(wordCountPlugin.wordCountContainer);\n            }\n            editors[editorEl.id] = editor;\n            if (callbacks[editorEl.id]) {\n                    callbacks[editorEl.id](editor);\n                }\n        }).catch(error => {\n            console.error((error));\n        });\n        editorEl.setAttribute('data-processed', '1');\n    });\n    window.editors = editors;\n}\n\n/**\n * This function filters the list of mutations only by added elements, thus\n * eliminates the occurrence of text nodes and tags where it does not make sense\n * to try to use with `QuerySelectorAll()` and `matches()` functions.\n * \n * @param {MutationRecord} recordList - It is the object inside the array\n * passed to the callback of a MutationObserver.\n * \n * @returns {Array} Array containing filtered nodes.\n */\nfunction getAddedNodes(recordList) {\n    return recordList\n        .flatMap(({ addedNodes }) => Array.from(addedNodes))\n        .filter(node => node.nodeType === 1);\n}\n\n/**\n * Register a callback for when an editor with `id` is created.\n *\n * @param {!string} id - the id of the ckeditor element.\n * @callback callback - the callback function to be invoked.\n */\nfunction registerCallback(id, callback) {\n    callbacks[id] = callback;\n}\n\n/**\n * Unregister a previously registered callback.\n *\n * @param {!string} id - the id of the ckeditor element.\n */\nfunction unregisterCallback(id) {\n    callbacks[id] = null;\n}\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n    createEditors();\n\n    if (typeof django === \"object\" && django.jQuery) {\n        django.jQuery(document).on(\"formset:added\", () => {createEditors();});\n    }\n\n    const observer = new MutationObserver((mutations) => {\n        let addedNodes = getAddedNodes(mutations);\n\n        addedNodes.forEach(node => {\n          // Initializes editors\n          createEditors(node);\n        });\n    });\n\n    // Configure MutationObserver options\n    const observerOptions = {\n        childList: true,\n        subtree: true,\n    };\n\n    // Selects the parent element where the events occur\n    const mainContent = document.body;\n\n    // Starts to observe the selected father element with the configured options\n    observer.observe(mainContent, observerOptions);\n});\n"],"names":["hasOwn","Object","prototype","hasOwnProperty","toStr","toString","defineProperty","gOPD","getOwnPropertyDescriptor","isArray","arr","Array","call","isPlainObject","obj","key","hasOwnConstructor","hasIsPrototypeOf","constructor","setProperty","target","options","name","enumerable","configurable","value","newValue","writable","getProperty","module","exports","extend","src","copy","copyIsArray","clone","arguments","i","length","deep","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","o","get","prop","r","Symbol","toStringTag","globalVar","window","document","getUserAgent","navigator","userAgent","toLowerCase","env","isMac","isWindows","isGecko","isSafari","isiOS","isAndroid","isBlink","isMediaForcedColors","matchMedia","matches","isMotionReduced","features","isRegExpUnicodePropertySupported","indexOf","match","maxTouchPoints","isSupported","search","RegExp","fastDiff","a","b","cmp","atomicChanges","arrayA","slice","arrayB","changeIndexes","arr1","arr2","firstIndex","findFirstDifferenceIndex","lastIndexOld","lastIndexNew","lastIndex","cutAndReverse","findChangeBoundaryIndexes","result","newLength","fill","concat","changeIndexesToAtomicChanges","newArray","push","index","type","values","howMany","changeIndexesToChanges","Math","max","reverse","diff","aLength","bLength","_insert","_delete","tmp","m","n","delta","es","fp","snake","k","y1","y2","dir","y","x","p","EventInfo","source","path","stop","off","return","this","spy","called","HEX_NUMBERS","map","_","r1","r2","r3","r4","crypto","getRandomValues","Uint32Array","priorities","priority","normal","highest","high","low","lowest","insertToPriorityArray","objects","objectToInsert","left","right","mid","splice","Error","context","data","errorName","originalError","super","processedObjects","WeakSet","JSON","stringify","has","add","getLinkToDocumentationMessage","message","getErrorMessage","stack","is","rethrowUnexpectedError","error","logWarning","console","warn","formatConsoleArguments","documentationMessage","releaseDate","Date","globalThis","CKEDITOR_VERSION","_listeningTo","_emitterId","_delegations","defaultEmitterClass","EmitterMixin","base","on","event","callback","listenTo","once","wasFired","args","stopListening","emitter","emitterInfo","eventCallbacks","emitters","_getEmitterId","_setEmitterId","emitterId","callbacks","listener","_addEventListener","addEventListener","removeEventListener","pop","fire","eventOrInfo","eventInfo","eventName","_events","currentEventName","colonIndex","lastIndexOf","substring","getCallbacksForEvent","fn","_removeEventListener","delegations","destinations","passAllDestinations","fireDelegatedEvents","err","delegate","events","to","nameOrFunction","Map","forEach","set","stopDelegating","delete","clear","getEvents","childEventName","newEventNodes","childEvents","substr","node","createEventNamespace","lists","getCallbacksListsForNamespace","callbackDefinition","id","eventNode","callbacksLists","childCallbacksLists","fireArgs","delegatedInfo","isObject","observablePropertiesSymbol","boundObservablesSymbol","boundPropertiesSymbol","decoratedMethods","decoratedOriginal","defaultObservableClass","ObservableMixin","keys","property","initObservable","properties","oldValue","bind","bindProperties","isStringArray","Set","size","boundProperties","propertyName","bindings","binding","bindTo","toMany","bindToMany","_observable","_bindProperties","_to","_bindings","unbind","unbindProperties","boundObservables","toObservable","toProperty","toProperties","toPropertyBindings","boundObservable","decorate","methodName","originalMethod","object","evt","apply","observable","parsedArgs","parsed","lastObservable","parseBindToArgs","bindingsKeys","from","numberOfBindings","updateBoundObservableProperty","chain","toPropertyName","bindingsToObservable","updateBoundObservables","updateBindToBound","observables","attribute","observableAndAttributePairs","getBindingTargets","every","propertyValue","ElementReplacer","_replacedElements","replace","element","newElement","style","display","parentNode","insertBefore","nextSibling","restore","remove","count","iterable","compareArrays","minLen","min","isIterable","iterator","isString","String","createElement","doc","attributes","children","namespace","xmlns","createElementNS","setAttribute","child","createTextNode","appendChild","getPrototypeOf","tag","proto","getSymbols","getOwnPropertySymbols","filter","symbol","propertyIsEnumerable","getTag","regexpTag","stringTag","numberTag","booleanTag","argumentsTag","symbolTag","dateTag","mapTag","setTag","arrayTag","arrayBufferTag","objectTag","dataViewTag","uint8ArrayTag","uint8ClampedArrayTag","uint16ArrayTag","uint32ArrayTag","int8ArrayTag","int16ArrayTag","int32ArrayTag","float32ArrayTag","float64ArrayTag","isPrimitive","isTypedArray","ArrayBuffer","isView","DataView","cloneDeepWithImpl","valueToClone","keyToClone","objectToClone","cloneValue","cloned","input","getTime","flags","Buffer","isBuffer","subarray","SharedArrayBuffer","buffer","byteOffset","byteLength","copyProperties","File","Blob","cause","isCloneableObject","create","descriptor","customizer","cloneDeepWith","valueOf","isObjectLike","isElement","nodeType","Config","_config","configurations","defaultConfigurations","define","cloneConfig","_setObjectToTarget","_setToTarget","_getFromSource","names","isDefine","parts","split","part","configuration","leaveItemReferences","isNode","defaultView","Document","ownerDocument","Node","isWindow","stringifiedObject","DomEmitterMixin","EventTarget","proxyOptions","capture","useCapture","passive","usePassive","proxyEmitter","_getProxyEmitter","ProxyEmitter","proxyEmitters","_getAllProxyEmitters","proxy","listeningEmitter","listenedToEmitterId","listeningTo","_getEmitterListenedTo","getProxyEmitterId","_domNode","_options","_domListeners","attach","domListener","_createDomListener","detach","removeListener","domEvt","getNodeUID","option","sort","getRangeFromMouseEvent","domEvent","domDoc","clientX","clientY","domRange","caretRangeFromPoint","rangeParent","createRange","setStart","rangeOffset","collapse","getPositionedAncestor","offsetParent","body","isText","isRange","getBorderWidths","getComputedStyle","top","parseInt","borderTopWidth","borderRightWidth","bottom","borderBottomWidth","borderLeftWidth","rectProperties","width","height","_source","isSourceRange","isDomElement","rangeRects","getDomRangeRects","copyRectProperties","getBoundingRect","getBoundingClientRect","innerWidth","innerHeight","moveTo","moveBy","getIntersection","anotherRect","rect","newRect","getIntersectionArea","getArea","getVisible","visibleRect","isBody","absolutelyPositionedChildElement","parent","commonAncestorContainer","isParentOverflowVisible","HTMLElement","overflow","getElementPosition","parentElementPosition","parentRect","intersectionRect","isEqual","contains","intersectRect","toAbsoluteRect","scrollX","scrollY","absoluteRect","positionedAncestor","positionedElementAncestor","ancestorPosition","ancestorBorderWidths","moveX","moveY","scrollLeft","scrollTop","shiftRectToCompensatePositionedAncestor","excludeScrollbarsAndBorders","scrollBarWidth","scrollBarHeight","direction","documentElement","clientWidth","clientHeight","borderWidths","offsetWidth","offsetHeight","range","rects","clientRects","getClientRects","startContainer","boundingRectData","Number","POSITIVE_INFINITY","NEGATIVE_INFINITY","rectangleCount","position","ResizeObserver","_element","_callback","static","_observerInstance","_createObserver","_addElementCallback","observe","destroy","_deleteElementCallback","_elementCallbacks","_getElementCallbacks","unobserve","entries","entry","setDataInElement","el","HTMLTextAreaElement","innerHTML","toUnit","unit","previousSibling","insertAt","parentElement","nodeToInsert","childNodes","isComment","COMMENT_NODE","isValidAttributeName","createAttribute","isVisible","isFunction","getOptimalPosition","positions","limiter","fitInViewport","viewportOffsetConfig","constrainedViewportRect","getConstrainedViewportRect","elementRect","visibleTargetRect","getVisibleViewportIntersectionRect","bestPosition","positionOptions","targetRect","viewportRect","visibleLimiterRect","limiterRect","elementRectArea","positionInstances","positioningFunction","PositionObject","maxFitFactor","limiterIntersectionArea","viewportIntersectionArea","fitFactor","getBestPosition","visibleSourceRect","assign","config","_positioningFunctionCoordinates","_cachedRect","_cachedAbsoluteRect","positioningFunctionOutput","_absoluteRect","_rect","removeChild","getVisualViewportOffset","visualViewport","round","offsetLeft","offsetTop","scrollViewportToShowTarget","viewportOffset","ancestorOffset","alignToTop","forceScroll","targetWindow","getWindow","currentWindow","currentFrame","normalizeViewportOffset","firstAncestorToScroll","getParentElement","scrollAncestorsToShowRect","getRect","getRectRelativeToWindow","ancestorWindowRelativeRect","ancestorTargetIntersection","scrollWindowToShowRect","frameElement","targetShiftedDownRect","targetShiftedUpRect","forceScrollToTop","allRectsFitInViewport","initialScrollX","initialScrollY","isAbove","isBelow","isLeftOf","isRightOf","scrollTo","limiterElement","parentWindow","targetFitsInTarget","firstRect","secondRect","elementOrRange","relativeWindow","frame","frameRect","modifiersToGlyphsMac","ctrl","cmd","alt","shift","modifiersToGlyphsNonMac","keyCodesToGlyphs","keyCodes","generateKnownKeyCodes","keyCodeNames","fromEntries","code","prettyKeyName","charAt","toUpperCase","getCode","keyCode","altKey","ctrlKey","shiftKey","metaKey","parseKeystroke","keystroke","trim","splitKeystrokeText","endsWith","getEnvKeyCode","reduce","sum","getEnvKeystrokeText","forcedEnv","keystrokeCode","modifiers","glyph","getLocalizedArrowKeyCodeDirection","contentLanguageDirection","isLtrContent","arrowleft","arrowright","arrowup","arrowdown","pageup","pagedown","end","home","backspace","enter","space","esc","tab","fromCharCode","toArray","cloneDeep","isUnsafeProperty","isArguments","mergeWith","otherArgs","sources","merge","mergeWithDeep","Constructor","newRegExp","newError","lastModified","newObject","sourceKeys","sourceValue","targetValue","targetKeys","Reflect","ownKeys","targetKey","merged","noop","CKEDITOR_TRANSLATIONS","RTL_LANGUAGE_CODES","getLanguageDirection","languageCode","includes","Locale","uiLanguage","uiLanguageDirection","contentLanguage","t","translations","acc","translation","_unifyTranslations","_t","string","quantity","plural","interpolateString","language","normalizedTranslations","numberOfLanguages","getNumberOfLanguages","messageId","dictionary","hasTranslation","getPluralForm","_translate","_items","_itemMap","_idProperty","_bindToCollection","_bindToExternalToInternalMap","_bindToInternalToExternalMap","_skippedIndexesFromExternal","initialItemsOrOptions","hasInitialItems","idProperty","WeakMap","item","_getItemIdBeforeAdding","first","last","addMany","items","offset","itemId","currentItemIndex","added","removed","idOrIndex","itemOrId","getIndex","subject","_remove","ctx","find","removedItems","externalCollection","as","Class","_setUpBindToBinding","using","callbackOrProperty","factory","addItem","externalItem","isExternalBoundToThis","externalItemBound","finalIndex","skipped","itemDoesNotExist","iteratorItem","next","done","FocusTracker","_elements","_externalViews","_blurTimeout","elements","externalViews","elementOrView","_addElement","isViewWithFocusTracker","_addView","focusTracker","view","_removeElement","_removeView","externalFocusedViewInSubtree","subTreeRoot","isFocusedView","isExternalViewSubtreeFocused","_focus","_blur","focusedElement","isFocused","_clearBlurTimeout","activeElement","setTimeout","clearTimeout","KeystrokeHandler","_listener","keyEvtData","preventDefault","stopPropagation","press","toMap","objectToMap","spliceArray","targetArray","insertArray","originalLength","insertLength","delay","func","wait","timer","delayed","cancel","parseBase64EncodedObject","encoded","startsWith","decoded","atob","parse","indentLine","line","indentCount","indentChar","repeat","isInsideSurrogatePair","character","test","isLowSurrogateHalf","isInsideCombinedSymbol","EMOJI_PATTERN","buildEmojiRegexp","isInsideEmojiSequence","matchAll","some","flagSequence","emoji","join","decodeLicenseKey","licenseKey","encodedPayload","getLicenseKeyPayload","ComponentFactory","editor","_components","originalName","getNormalized","locale","ViewCollection","_parentElement","initialItems","_renderViewIntoCollectionParent","setParent","elementOrDocFragment","dest","evtName","isRendered","render","Template","ns","text","eventListeners","_isRendered","_revertData","def","normalize","_renderNode","intoFragment","isApplying","revertData","revert","_revertTemplateFromNode","getViews","isTemplate","eventNameOrFunctionOrAttribute","TemplateToBinding","eventNameOrFunction","if","valueIfTrue","TemplateIfBinding","template","extendTemplate","isInvalid","_renderText","_renderElement","_renderAttributes","_renderElementChildren","_setUpListeners","textContent","hasTemplateBinding","_bindToObservable","schema","updater","getTextUpdater","attrName","domAttrValue","getAttribute","attrValue","attrNs","isNamespaced","valueToBind","shouldExtend","unshift","getAttributeUpdater","_renderStyleAttribute","val","prev","arrayValueReducer","isFalsy","setAttributeNS","styles","styleName","styleValue","getStyleUpdater","isCssVariable","container","createDocumentFragment","childIndex","isViewCollection","childRevertData","revertBindings","schemaItem","domEvtName","domSelector","activateDomEventListener","syncValueSchemaValue","templateBinding","activateAttributeListener","revertBinding","removeAttribute","TemplateBinding","getValue","getValueSchemaValue","removeAttributeNS","removeProperty","normalizePlainTextDefinition","normalizeTextDefinition","listeners","l","arrayify","normalizeListeners","normalizeAttributes","cur","extendObjectValueArray","ext","childDef","View","_viewCollections","_unboundChildren","_bindTemplate","createCollection","collection","bindTemplate","views","registerChild","deregisterChild","setTemplate","c","toPx","POSITION_OFF_SCREEN","withArrow","BalloonPanelView","content","_pinWhenIsVisibleCallback","_resizeObserver","class","hide","show","attachTo","getDomElement","defaultPositions","southArrowNorth","southArrowNorthMiddleWest","southArrowNorthMiddleEast","southArrowNorthWest","southArrowNorthEast","northArrowSouth","northArrowSouthMiddleWest","northArrowSouthMiddleEast","northArrowSouthWest","northArrowSouthEast","viewportStickyNorth","optimalPosition","_getOptimalPosition","pin","unpin","_startPinning","_stopPinning","targetElement","scrollTarget","isWithinScrollTarget","isLimiterWithinScrollTarget","checkVisibility","generatePositions","sideOffset","arrowSideOffset","heightOffset","arrowHeightOffset","stickyVerticalOffset","northWestArrowSouthWest","balloonRect","getNorthTop","northWestArrowSouthMiddleWest","northWestArrowSouth","northWestArrowSouthMiddleEast","northWestArrowSouthEast","northEastArrowSouthWest","northEastArrowSouthMiddleWest","northEastArrowSouth","northEastArrowSouthMiddleEast","northEastArrowSouthEast","southWestArrowNorthWest","getSouthTop","southWestArrowNorthMiddleWest","southWestArrowNorth","southWestArrowNorthMiddleEast","southWestArrowNorthEast","southEastArrowNorthWest","southEastArrowNorthMiddleWest","southEastArrowNorth","southEastArrowNorthMiddleEast","southEastArrowNorthEast","westArrowEast","eastArrowWest","boundaryRect","visibleBoundaryRect","debounceMs","leading","trailing","maxWait","edges","pendingAt","_debounced","signal","pendingThis","pendingArgs","invoke","timeoutId","schedule","cancelTimer","debounced","aborted","isFirstCall","flush","debounce","now","BALLOON_CLASS","TooltipManager","tooltipTextView","balloonPanelView","_currentElementWithTooltip","_currentTooltipPosition","_mutationObserver","_pinTooltipDebounced","_unpinTooltipDebounced","_watchdogExcluded","_editors","_instance","mutationObserver","MutationObserver","attributeFilter","disconnect","createMutationObserver","_updateTooltipPosition","_pinTooltip","_unpinTooltip","_onKeyDown","_onEnterOrFocus","_onLeaveOrBlur","_onScroll","editorBodyViewCollection","ui","getPositioningFunctions","defaultBalloonPositions","s","e","w","sw","se","elementWithTooltipAttribute","getDescendantWithTooltip","getTooltipData","relatedTarget","balloonElement","isEnteringBalloon","isLeavingBalloon","descendantWithTooltip","relatedDescendantWithTooltip","targetDomElement","cssClass","bodyViewCollection","className","tooltipData","closest","dataset","ckeTooltipText","ckeTooltipPosition","ckeTooltipClass","throttle","throttleMs","Badge","_balloonView","_showBalloonThrottled","_showBalloon","_lastFocusedEditableElement","_balloonClass","balloonClass","_handleEditorReady","balloon","_isEnabled","_updateLastFocusedEditableElement","_hideBalloon","_getNormalizedConfig","side","verticalOffset","horizontalOffset","attachOptions","_getBalloonAttachOptions","_createBalloonView","_createBadgeContent","badgeConfig","getLowerCornerPosition","rootRect","focusedEditableElement","getLowerLeftCornerPosition","editableEditorElements","getEditableElementsNames","getEditableElement","getBalloonLeft","visibleEditableElementRect","editableElementRect","balloonTop","balloonLeft","newBalloonPositionVisibleRect","IconView","viewBox","_updateXMLContent","_colorFillPaths","svg","DOMParser","parseFromString","querySelector","presentationalAttributeNames","firstChild","fillColor","querySelectorAll","PoweredBy","licenseContent","whiteLabel","PoweredByView","label","userConfig","forceVisible","iconView","isColorInherited","href","tabindex","dragstart","EvaluationBadge","licenseTypeMessage","evaluation","trial","development","licenseType","getLicenseTypeFromLicenseKey","Boolean","EvaluationBadgeView","AriaLiveAnnouncerPoliteness","POLITE","ASSERTIVE","AriaLiveAnnouncer","politeness","announce","announcement","AriaLiveAnnouncerView","isUnsafeHTML","politenessRegionView","regionViews","AriaLiveAnnouncerRegionView","_domConverter","_pruneAnnouncementsInterval","clearInterval","htmlProcessor","domConverter","setInterval","_listElement","messageListItem","setContentOf","innerText","ListItemView","role","focus","MenuBarMenuListItemView","parentMenuView","clickOutsideHandler","activator","contextElements","listenerOptions","composedPath","contextElementsList","contextElement","MenuBarBehaviors","toggleMenusAndFocusItemsOnHover","menuBarView","isFocusBorderEnabled","isOpen","menuView","menus","pathLeaf","isListItemContainingMenu","isEnabled","focusCycleMenusOnArrows","isContentRTL","cycleTopLevelMenus","currentMenuView","step","currentIndex","isCurrentMenuViewOpen","menusCount","menuViewToOpen","buttonView","closeMenusWhenTheBarCloses","closeMenuWhenAnotherOnTheSameLevelOpens","closeOnClickOutside","close","enableFocusHighlightOnInteraction","isKeyPressed","MenuBarMenuBehaviors","openAndFocusPanelOnArrowDownKey","keystrokes","panelView","openOnArrowRightKey","openOnButtonClick","toggleOnButtonClick","openAndFocusOnEnterKeyPress","closeOnArrowLeftKey","closeOnEscKey","closeOnParentClose","MenuBarMenuViewPanelPositioningFunctions","southEast","buttonRect","southWest","panelRect","northEast","northWest","eastSouth","eastNorth","westSouth","westNorth","DefaultMenuBarItems","menuId","groups","groupId","processMenuBarConfig","normalizedConfig","componentFactory","extraItems","configClone","handleAdditions","originalConfig","itemsToBeRemoved","removeItems","successfullyRemovedItems","walkConfigMenus","menuDefinition","groupDefinition","getIdFromGroupItem","itemName","menuBarConfig","handleRemovals","addItems","isItemUnavailable","isUsingDefaultConfig","parentMenuConfig","componentName","purgeUnavailableComponents","purgeEmptyMenus","localizedCategoryLabels","localizeMenuLabels","successFullyAddedItems","itemToAdd","relation","getRelationFromPosition","relativeId","getRelativeIdFromPosition","topLevelMenuDefinitionIndex","findIndex","menu","addMenuOrItemToGroup","isMenuBarMenuGroupAddition","group","relativeGroupIndex","addedItemConfig","itemOrMenuToAdd","wasAdded","groupItems","relativeItemIndex","groupItem","wasSubMenuPurged","warnAboutEmptyMenu","isMenuDefinition","emptyMenuConfig","topLevelMenuDefinition","walk","EditorUI","tooltipManager","poweredBy","evaluationBadge","ariaLiveAnnouncer","isReady","_editableElementsMap","_focusableToolbarDefinitions","_extraMenuBarElements","_lastFocusedForeignElement","_domEmitter","editingView","editing","_initViewportOffset","_readViewportOffsetFromConfig","_bindBodyCollectionWithFocusTracker","update","_handleScrollToTheSelection","_initFocusTracking","_initVisualViewportSupport","domElement","ckeditorInstance","setEditableElement","rootName","setUpKeystrokeHandler","getDomRoot","removeEditableElement","addToolbar","toolbarView","extendMenuBar","initMenuBar","menuBarViewElement","normalizedMenuBarConfig","configObject","normalizeMenuBarConfig","fillFromConfig","_saveLastFocusedForeignElement","legacyOffsetConfig","candidateDefinitions","currentFocusedToolbarDefinition","_getCurrentFocusedToolbarDefinition","_getFocusableCandidateToolbarDefinitions","candidateDefinition","_focusFocusableCandidateToolbar","afterBlur","focusedToolbarDef","domRoots","definitions","toolbarDef","beforeFocus","defA","defB","getToolbarDefinitionWeight","candidateToolbarDefinition","configuredViewportOffset","visualTop","_getVisualViewportTopOffset","updateViewport","visualViewportOffsetTop","viewportTopOffset","weight","isContextual","normalizeToolbarConfig","predefinedConfigOptions","FormHeaderView","icon","ButtonLabelView","labelView","keystrokeView","_focusDelayed","ariaLabelUid","_setupLabelView","_createKeystrokeView","_getTooltipString","click","isOn","isToggleable","isCheckableRole","mousedown","mouseup","newIcon","oldIcon","withKeystroke","tooltip","Function","FocusCycler","focusables","keystrokeHandler","actions","keystrokeHandlerOptions","focusFirst","focusLast","isDomFocusable","_getDomFocusableItem","previous","current","viewIndex","focused","focusNext","focusPrevious","chainedFocusCycler","getCurrentFocusedView","oldCurrent","unchain","otherFocusCycler","collectionLength","focusableItem","focusableItemCandidate","isFocusable","DraggableViewMixin","_onDragBound","_onDrag","_onDragEndBound","_onDragEnd","_lastDraggingCoordinates","_attachListeners","_onDragStart","_attachDragListeners","_detachDragListeners","_isHandleElementPressed","MouseEvent","touches","isDragging","newX","newY","deltaX","deltaY","dragHandleElement","DialogActionsView","focusCycler","_focusTracker","_focusables","setButtons","button","onExecute","onCreate","_updateFocusCyclableItems","v","DialogContentView","reset","DialogViewPosition","DialogView","headerView","closeButtonView","actionsView","contentView","wasMoved","_getCurrentDomRoot","_getViewportOffset","_focusCycler","getCurrentDomRoot","getViewportOffset","isModal","visibility","defaultPrevented","_isVisible","updatePosition","_isTransparent","setupParts","title","hasCloseButton","actionButtons","_createCloseButton","ariaLabel","_getViewportRect","dialogRect","_getDialogRect","_moveTo","_left","_top","_moveOffScreen","domRootRect","configuredPosition","_getVisibleDomRootRect","defaultOffset","coords","leftCoordinate","visibleDomRootRect","firstElementChild","focusable","documentPlaceholders","hasDisplayedPlaceholderDeprecationWarning","enableViewPlaceholder","isDirectHost","keepOnFocus","setPlaceholder","hostElement","change","writer","updateDocumentPlaceholders","registerPostFixer","evtInfo","placeholder","hideViewPlaceholder","hasClass","removeClass","placeholders","directHostElements","wasViewModified","updatePlaceholder","getChildPlaceholderHostSubstitute","childCount","isAttached","getChildren","hasContent","selectionAnchor","selection","anchor","isComposing","needsViewPlaceholder","addClass","showViewPlaceholder","getChild","ViewTypeCheckable","ViewNode","pos","getChildIndex","root","getPath","getAncestors","ancestors","includeSelf","parentFirst","getCommonAncestor","ancestorsA","ancestorsB","isBefore","thisPath","nodePath","isAfter","_removeChildren","_fireChange","toJSON","json","ViewText","_textData","_data","isSimilar","otherNode","_clone","ViewTextProxy","textNode","offsetInText","offsetSize","isPartial","ViewConsumable","_consumables","consumables","elementConsumables","ViewElementConsumables","normalizeConsumables","_getConsumables","consume","createFrom","instance","_canConsumeName","_attributes","token","attributeTokens","tokenValue","toConsume","normalizeConsumablePart","classes","prefix","Matcher","_patterns","pattern","singleElement","_isElementMatching","results","getElementName","matchName","attributesMatch","patterns","excludeAttributes","_collectAttributesMatch","normalizePatterns","matchAttributes","matchClasses","matchStyles","isPatternMatched","normalizedPatterns","isDeepKey","toKey","toPath","deepKey","quoteChar","bracket","charCodeAt","char","defaultValue","getWithPath","eq","other","isNaN","assignValue","objValue","IS_UNSIGNED_INTEGER","isIndex","MAX_SAFE_INTEGER","isInteger","isSymbol","regexIsDeepProp","regexIsPlainProp","resolvedPath","customizerResult","updateWith","StylesMap","_styles","_cachedStyleNames","_cachedExpandedStyleNames","_styleProcessor","styleProcessor","isEmpty","getStyleNames","setTo","inlineStyle","parsedStyles","stylesString","quoteType","propertyNameStart","propertyValueStart","stylesMap","parseInlineStyles","toNormalizedForm","propertyDescriptor","getReducedForm","nameOrObject","valueOrObject","normalizedStylesToRemove","pathValue","appendStyleValue","getAsString","removeStyles","getStylesEntries","expand","_getTokensMatch","tokenPattern","valuePattern","relatedName","getRelatedStyles","_canMergeFrom","_mergeFrom","_isMatching","StylesProcessor","_normalizers","_extractors","_reducers","normalizer","extractor","normalizedValue","reducer","styleNamesKeysSet","setNormalizer","setExtractor","callbackOrPath","setReducer","setStyleRelation","shorthandName","styleNames","_mapStyleNames","alsoName","stylesObject","nameOrPath","valueToSet","toRemove","ViewTokenList","_set","tokens","ViewElement","_unsafeAttributesToRender","_attrs","_children","_customProperties","_classes","attrs","_parseAttributes","_insertChild","getAttributeKeys","getAttributes","hasAttribute","usesStylesMap","usesTokenList","otherElement","otherValue","getClassNames","array","getStyle","getNormalizedStyle","hasStyle","findAncestor","matcher","getCustomProperty","getCustomProperties","getIdentity","shouldRenderUnsafeAttribute","attributeName","childrenClone","getFillerOffset","_appendChild","nodes","normalizedNodes","_setAttribute","overwrite","currentValue","stylesProcessor","_removeAttribute","_addClass","_removeClass","_setStyle","_removeStyle","exclude","keyPattern","hasKey","hasValue","tokenMatch","tokenMatchItem","_canMergeAttributesFrom","_mergeAttributesFrom","_canSubtractAttributesOf","_subtractAttributesOf","_setCustomProperty","_removeCustomProperty","attrsMap","elementName","ViewContainerElement","getViewFillerOffset","lastChild","ViewEditableElement","editableElement","isReadOnly","rootNameSymbol","ViewRootEditableElement","_name","ViewTreeWalker","boundaries","singleCharacters","shallow","ignoreElementEnd","_position","_boundaryStartParent","_boundaryEndParent","startPosition","ViewPosition","_createAt","start","skip","nextResult","prevPosition","jumpTo","_next","_previous","previousPosition","isAtEnd","_createAfter","textLength","textProxy","_formatReturnValue","charactersCount","isAtStart","_createBefore","startOffset","nextPosition","nodeAfter","nodeBefore","endOffset","editable","getShiftedBy","shifted","getLastMatchingPosition","treeWalker","otherPosition","compareWith","otherPath","getWalker","itemOrPosition","ViewRange","isCollapsed","isFlat","getEnlarged","enlargeTrimSkip","getTrimmed","nodeAfterStart","nodeBeforeEnd","otherRange","containsPosition","containsRange","loose","containsStart","containsEnd","getDifference","ranges","isIntersecting","commonRangeStart","commonRangeEnd","getContainedElement","getItems","getPositions","_createFromParentsAndOffsets","startElement","endElement","_createFromPositionAndShift","_createIn","_createOn","ViewSelection","_ranges","_lastRangeBackward","_isFake","_fakeSelectionLabel","isFake","fakeSelectionLabel","rangeCount","isBackward","getRanges","getFirstRange","getLastRange","getFirstPosition","firstRange","getLastPosition","lastRange","otherSelection","thisRange","found","numOfRangesA","rangeA","rangeB","getSelectedElement","selectable","placeOrOffset","_setRanges","_setFakeOptions","ViewDocumentSelection","fake","backward","setFocus","newFocus","_addRange","newRanges","isLastBackward","_pushRange","storedRange","addedRange","intersectingRange","_selection","_setTo","_setFocus","BubblingEventInfo","startRange","_eventPhase","_currentTarget","eventPhase","currentTarget","bubblingEmitterSymbol","callbackMapSymbol","contextsSymbol","BubblingEmitterMixin","eventArgs","bubblingEmitter","getBubblingEmitter","customContexts","getCustomContexts","updateEventInfo","fireListenerFor","selectedElement","isCustomContext","hasMatchingCustomContext","startParent","endParent","startPath","endPath","getDeeperRangeParent","contexts","callbacksMap","getCallbackMap","wrappedCallback","wrapCallback","ViewDocument","roots","_postFixers","getRoot","postFixer","_callPostFixers","wasFixed","ViewAttributeElement","_priority","_id","_clonesGroup","getElementsWithSameId","nonUiChildrenCount","ViewEmptyElement","ViewUIElement","domDocument","toDomElement","ViewRawElement","ViewDocumentFragment","ViewDowncastWriter","_cloneGroups","_slotFactory","setSelection","setSelectionFocus","createText","createAttributeElement","attributeElement","renderUnsafeAttributes","createContainerElement","childrenOrOptions","isContainerOptions","containerElement","createEditableElement","createEmptyElement","emptyElement","createUIElement","renderFunction","uiElement","createRawElement","rawElement","elementOrOverwrite","elementOrTokens","setStyle","removeStyle","setCustomProperty","removeCustomProperty","breakAttributes","positionOrRange","_breakAttributes","_breakAttributesRange","breakContainer","insert","sourceRange","targetPosition","move","mergeAttributes","positionOffset","positionParent","_removeFromClonedElementsGroup","mergeTextNodes","mergeContainers","newPosition","validateNodesToInsert","nodeGroups","lastGroup","_insertNodes","rangeOrItem","validateRangeContainer","breakStart","breakEnd","parentContainer","mergePosition","walker","rangeToRemove","ancestor","countBefore","wrap","_wrapPosition","viewSelection","_wrapRange","unwrap","newRange","_unwrapChildren","rename","newName","viewElement","clearClonedElementsGroup","groupName","createPositionAt","createPositionAfter","createPositionBefore","createRangeOn","createRangeIn","createSelection","createSlot","modeOrFilter","_registerSlotFactory","slotFactory","_clearSlotFactory","insertionPosition","getParentContainer","breakTextNode","_addToClonedElementsGroup","endPosition","_wrapChildren","wrapElement","wrapPositions","isAttribute","newAttribute","offsetChange","unwrapElement","unwrapPositions","unwrapped","movePositionToTextNode","fakeElement","wrapRange","forceSplitText","rangeStart","rangeEnd","isContainerOrFragment","offsetAfter","clonedNode","nodesToMove","textToMove","t1","t2","nodeBeforeLength","validNodesToInsert","errorContext","validNode","endContainer","NBSP_FILLER","MARKED_NBSP_FILLER","span","ckeFiller","BR_FILLER","fillerBr","INLINE_FILLER","startsWithFiller","domNode","isInlineFiller","domText","getDataWithoutFiller","jumpOverInlineFiller","domSelection","domTarget","getSelection","getRangeAt","collapsed","domParent","domOffset","ViewRenderer","domDocuments","markedAttributes","markedChildren","markedTexts","_inlineFiller","_fakeSelectionContainer","isSelecting","markToSync","mapViewToDom","inlineFillerPosition","isInlineFillerRenderingPossible","_updateChildrenMappings","_isSelectionInInlineFiller","_removeInlineFiller","_getInlineFillerPosition","_needsInlineFillerAtSelection","domPositionToView","_updateAttrs","_updateChildren","_updateText","fillerDomPosition","viewPositionToDom","addInlineFiller","_updateFocus","_updateSelection","_clearTemporaryCustomProperties","actualDomChildren","expectedDomChildren","viewChildrenToDom","withChildren","_diffNodeLists","_findUpdateActions","areSimilarElements","counter","equal","action","insertIndex","deleteIndex","viewChild","_updateElementMappings","unbindDomElement","bindElements","firstPos","selectionPosition","domFillerNode","selectionParent","selectionOffset","isEditable","viewText","findCorrespondingDomText","expectedText","viewToDom","filler","_updateTextNode","domAttr","removeDomElementAttribute","setDomElementAttribute","previousDomNode","areTextNodes","nodesToUnbind","_markDescendantTextToSync","domToView","domChildList","fakeSelectionContainer","childList","filterOutFakeSelectionContainer","sameNodes","actualDom","expectedDom","comparator","newActions","actualSlice","expectedSlice","actualText","_updateTextNodeInternal","insertData","deleteData","viewNode","_removeDomSelection","_removeFakeSelection","domEditable","_updateFakeSelection","isConnected","_updateDomSelection","createFakeSelectionContainer","bindFakeSelection","_fakeSelectionNeedsUpdate","removeAllRanges","selectNodeContents","addRange","_domSelectionNeedsUpdate","setBaseAndExtent","ELEMENT_NODE","childAtOffset","tagName","fixGeckoSelectionAfterBr","isDomSelectionCorrect","oldViewSelection","domSelectionToView","anchorNode","activeDomElement","mapDomToView","domParentOrArray","nodeAfterFiller","fillerNode","node1","node2","actualDomChild","expectedDomChild","isBlockFiller","BR_FILLER_REF","NBSP_FILLER_REF","MARKED_NBSP_FILLER_REF","UNSAFE_ATTRIBUTE_NAME_PREFIX","UNSAFE_ELEMENT_REPLACEMENT_ATTRIBUTE","ViewDomConverter","renderingMode","blockFillerMode","preElements","blockElements","inlineObjectElements","unsafeElements","_domDocument","_domToViewMapping","_viewToDomMapping","_fakeSelectionMapping","_rawContentElementMatcher","_inlineObjectElementMatcher","_elementsWithTemporaryCustomProperties","implementation","createHTMLDocument","viewDocumentSelection","fakeSelectionToView","bindDocumentFragments","domFragment","viewFragment","shouldRenderAttribute","attributeKey","attributeValue","html","fragment","bodyChildNodes","createTreeWalker","NodeFilter","SHOW_ELEMENT","currentNode","nextNode","getAttributeNames","_shouldRenameElement","_logUnsafeElement","replaceWith","_createReplacementDomElement","append","textData","_processDataFromViewText","viewElementOrFragment","createComment","HTMLTemplateElement","relatedViewElement","fillerPositionOffset","childView","_getBlockFiller","transparentRendering","tempElement","viewRangeToDom","viewRange","domStart","domEnd","setEnd","viewPosition","viewParent","domBefore","domAfter","inlineNodes","generator","_domToView","_processDomInlineNodes","isViewBrFiller","domChildrenToView","domChild","_isBlockViewElement","isGeckoRestrictedDomSelection","isDomSelectionBackward","viewRanges","domRangeToView","viewStart","viewEnd","findCorrespondingViewText","viewBefore","domElementOrDocumentFragment","getHostViewElement","documentFragmentOrElement","viewEditable","scrollPositions","forEachDomElementAncestor","preventScroll","_clearDomSelection","newViewSelection","isDocumentFragment","DOCUMENT_FRAGMENT_NODE","isEqualNode","isOnlyBrInBlock","hasBlockParent","isNbspBlockFiller","anchorOffset","focusNode","focusOffset","DOCUMENT_NODE","_isDomSelectionPositionCorrect","registerRawContentMatcher","registerInlineObjectMatcher","skipComments","_isInlineObjectElement","_createViewElement","_isViewElementWithRawContent","nestedInlineNodes","inlineNode","_isBlockDomElement","prevNodeEndsWithSpace","nodeEndsWithSpace","_isPreFormatted","prevNode","shouldLeftTrim","shouldRightTrim","isViewMarkedNbspFiller","isViewNbspFiller","isNextNodeInlineObjectElement","isNextNodeStartingWithSpace","_getTouchingInlineViewNode","_nodeEndsWithSpace","nextStartsWithSpace","types","_hasViewParentOfType","getNext","viewName","keepOriginalCase","originalDomElement","newDomElement","Observer","enable","disable","checkShouldIgnoreEventFromTarget","times","finite","NaN","toNumber","Infinity","MAX_VALUE","toFinite","remainder","toInteger","isSafeInteger","keysIn","isLength","indices","filteredKeys","keysInImpl","arrayLikeKeysIn","isPrototype","prototypeKeysIn","assignIn","assignInImpl","ViewDocumentDomEventData","additionalData","DomEventObserver","domEventType","onDomEvent","stopObserving","eventType","KeyObserver","FakeSelectionObserver","_fireSelectionChangeDoneDebounced","_handleSelectionMove","newSelection","oldSelection","isEqualWith","areValuesEqual","isEqualWithImpl","aParent","bParent","areObjectsEqual","aTag","bTag","aStack","bStack","aValues","bValues","aValue","bValue","Uint8Array","aKeys","bKeys","propKey","aProp","after","_domElements","characterData","subtree","_onMutations","takeRecords","domMutations","mutatedTextNodes","elementsWithMutatedChildren","mutation","_isBogusBrMutation","mutations","addedNode","removedNodes","addedNodes","child1","child2","FocusObserver","_renderTimeoutId","_isFocusChanging","_handleFocus","_handleBlur","_clearTimeout","selectedEditable","SelectionObserver","focusObserver","_documents","_clearInfiniteLoopInterval","_documentIsSelectingInactivityTimeoutDebounced","_loopbackCounter","_pendingSelectionChange","getObserver","_clearInfiniteLoop","_handleSelectionChange","endDocumentIsSelecting","_reportInfiniteLoop","hasDomSelection","flatMap","forceRender","CompositionObserver","ViewDataTransfer","_files","_native","nativeDataTransfer","cacheFiles","getFiles","files","getData","setData","effectAllowed","dropEffect","setDragImage","image","isCanceled","mozUserCancelled","kind","getAsFile","InputObserver","domTargetRanges","getTargetRanges","viewDocument","dataTransfer","targetRanges","isFollowedByInlineFiller","inputType","partTargetRanges","dataPart","ArrowKeysObserver","TabObserver","EditingView","_renderer","_initialDomRootAttributes","_observers","_writer","_ongoingChange","_postFixersInProgress","_renderingDisabled","_hasChangedSinceTheLastRendering","addObserver","domSelectionCollapsed","jumpedOverAnyUiElement","nextViewPosition","newDomPosition","jumpOverUiElement","_render","attachDomRoot","domRoot","viewRoot","initialDomRootAttributes","updateContenteditableAttribute","observer","detachDomRoot","ObserverConstructor","disableObservers","enableObservers","scrollToTheSelection","originalArgs","isRenderingInProgress","callbackResult","_disableRendering","flag","ModelTypeCheckable","ModelTextProxy","ModelTreeWalker","_visitedParent","ModelPosition","stickiness","prevVisitedParent","maxOffset","textNodeAtPosition","getTextNodeAtPosition","getNodeAfterPosition","formatReturnValue","offsetInTextNode","getNodeBeforePosition","newOffset","getChildAtOffset","offsetToIndex","isValid","getParentPath","parentName","getCommonPath","diffAt","isTouching","commonLevel","level","checkTouchingBranch","checkOnlyZeroes","hasSameParentAs","getTransformedByOperation","operation","_getTransformedByInsertOperation","_getTransformedByMoveOperation","_getTransformedBySplitOperation","_getTransformedByMergeOperation","_getTransformedByInsertion","_getTransformedByMove","sourcePosition","movedRange","_getCombined","splitPosition","moveTargetPosition","graveyardPosition","_getTransformedByDeletion","deletionPosition","deletePosition","transformed","insertPosition","combined","fromJSON","graveyard","idx","checkOnlyMaxOffset","ModelRange","containsItem","getJoined","shouldJoin","getMinimalFlatRanges","posParent","getTransformedByOperations","operations","j","spread","newPos","moveRange","differenceSet","difference","common","transformedCommon","newStart","newEnd","_createFromRanges","ref","refIndex","Mapper","_modelToViewMapping","_viewToModelMapping","_viewToModelLengthCallbacks","_markerNameToElements","_elementToMarkerNames","_deferredBindingRemovals","_unboundMarkerNames","_cache","MapperCache","viewContainer","modelPosition","findPositionIn","viewBlock","findMappedViewAncestor","modelParent","modelOffset","_toModelOffset","modelElement","unbindViewElement","toModelElement","markerName","defer","stopTracking","unbindModelElement","toViewElement","bindElementToMarker","unbindElementFromMarkerName","nameToElements","elementToNames","flushUnboundMarkerNames","markerNames","flushDeferredBindings","clearBindings","toModelRange","toModelPosition","toViewRange","modelRange","toViewPosition","mapper","isPhantom","markerNameToElements","boundElements","registerViewToModelLength","viewElementName","lengthCallback","viewOffset","getModelLength","len","_moveViewPositionToTextNode","cacheItem","getClosest","_findPositionStartingFrom","startViewPosition","startModelOffset","targetModelOffset","useCache","traversedModelOffset","lastLength","_getModelLengthAndCache","save","cacheViewParent","cacheViewOffset","_cachedMapping","_nodeToCacheListIndex","_invalidateOnChildrenChangeCallback","_clearCacheInsideParent","_invalidateOnTextChangeCallback","_clearCacheAfter","cache","cacheMap","newCacheItem","maxModelOffset","cacheList","_findInCacheList","startTracking","initialCacheItem","initialCache","_clearCacheAll","lastValidNode","cacheListIndex","_clearCacheFromCacheIndex","clearedItems","ModelConsumable","_consumable","_textProxyRegistry","_normalizeConsumableType","_getSymbolForTextProxy","itemConsumables","verifyAllConsumed","eventGroup","canConsume","eventPrefix","description","startMap","endMap","_addSymbolForTextProxy","DowncastDispatcher","_conversionApi","_firedEventsMap","conversionApi","dispatcher","convertChanges","differ","markers","refreshedItems","getRefreshedItems","_createConversionApi","getMarkersToRemove","_convertMarkerRemove","changes","_reduceChanges","getChanges","_convertInsert","_convertReinsert","_convertRemove","_convertAttribute","attributeOldValue","attributeNewValue","markerRange","getRange","_convertMarkerAdd","getMarkersToAdd","consumable","convert","convertSelection","modelRoot","markersAtSelection","getMarkersAtPosition","_addConsumablesForSelection","marker","shouldMarkerChangeBeConverted","doNotAddConsumables","_addConsumablesForInsert","_testAndFire","walkerValueToEventData","_addConsumablesForRange","walkerValues","reconversion","getEventName","itemKey","eventsFiredForConversion","eventsFiredForItem","_testAndFireAddAttributes","convertItem","convertChildren","convertAttributes","canReuseView","ModelNode","_index","_startOffset","attr","_deep","_setAttributesTo","_clearAttributes","ModelSelection","anyNewRange","oldRange","_replaceAllRanges","directChange","_popRange","attributeKeys","getSelectedBlocks","visited","startBlock","getParentBlock","isStartBlockSelected","treewalker","block","isUnvisitedTopBlock","model","isBlock","endBlock","isEndBlockSelected","containsEntireContent","limitStartPosition","limitEndPosition","_checkRange","_removeAllRanges","isUnvisitedBlock","isTopBlockInRange","hasParentLimit","isLimit","parentBlock","findAncestorBlock","ModelLiveRange","bindWithDocument","toRange","fromRange","isDocumentOperation","transform","boundariesChanged","contentChanged","doesOperationChangeRangeContent","ModelText","storePrefix","ModelDocumentSelection","LiveSelection","hasOwnRange","isGravityOverridden","refresh","updateMarkers","_updateAttributes","observeMarkers","prefixOrName","_getStoredAttributes","getStoredAttributes","_overrideGravity","overrideGravity","_restoreGravity","uid","restoreGravity","_getStoreAttributeKey","_isStoreAttributeKey","_model","_document","_attributePriority","_selectionRestorePosition","_hasChangedRange","_overriddenGravityRegister","_observedMarkers","_fixGraveyardSelection","_validateSelectionRanges","_updateMarker","batch","changeParent","enqueueChange","storedAttributes","clearAttributesStoredInElement","_getDefaultRange","overrideUid","liveRange","_prepareRange","_validateSelectionRange","changed","markerGroup","selectionRange","oldMarkers","hasMarker","contained","clearAll","newAttributes","_getSurroundingAttributes","oldAttributes","newKey","oldKey","realKey","getTextAttributes","getNearestSelectionRange","isInline","checkAttribute","getAttributeProperties","copyFromObject","ModelNodeList","_nodes","_offsetToNode","getNode","getNodeAtOffset","getNodeIndex","getNodeStartOffset","indexToOffset","nodeList","nodesArray","offsets","makeOffsetsArray","_removeNodes","indexStart","lastNode","removedOffsetSum","_removeNodesArray","ModelElement","getChildStartOffset","getNodeByPath","relativePath","clonedNodes","cloneNodes","_removeChildrenArray","ConversionHelpers","_dispatchers","dispatchers","conversionHelper","DowncastHelpers","elementToElement","normalizeModelElementConfig","normalizeToElementConfig","elementCreator","consumer","defaultConsumer","preflight","removeElementAndUnbind","reinsertOrConvertNodes","insertElement","createConsumer","converterPriority","createChangeReducer","downcastElementToElement","elementToStructure","checkChild","slotsMap","slot","createSlotFactory","childrenInSlots","flat","uniqueChildrenInSlots","validateSlotsChildren","toViewPositionMapping","currentSlot","currentSlotNodes","fillSlots","downcastElementToStructure","attributeToElement","modelValue","getFromAttributeCreator","oldViewElement","newViewElement","viewWriter","downcastAttributeToElement","attributeToAttribute","normalizeToAttributeConfig","attributeCreator","oldAttribute","downcastAttributeToAttribute","markerToElement","isOpening","viewStartElement","viewEndElement","downcastMarkerToElement","markerToHighlight","highlightDescriptor","prepareDescriptor","createViewElementFromDowncastHighlightDescriptor","rangeAfterWrap","addHighlightCallback","highlightElement","viewHighlightElement","removeHighlightCallback","removeHighlight","downcastMarkerToHighlight","markerToData","viewCreator","viewMarkerData","handleMarkerBoundary","viewData","removeMarkerFromAttribute","removeMarkerData","downcastMarkerToData","removeRangeAndUnbind","isStart","elementAfter","elementBefore","insertMarkerAsAttribute","insertMarkerAsElement","viewElementType","modelData","viewElementDefinition","DEFAULT_PRIORITY","createViewElementFromDefinition","modelAttributeValue","shouldReplace","createChangeReducerCallback","reducedChanges","reconvertedElements","changeIndex","positionRelation","modelNodes","modelChildNode","reinsertNode","modelNode","viewChildNode","autoParagraphEmptyRoots","getRoots","isParagraphable","nodeOrType","createContext","wrapInParagraph","paragraph","UpcastHelpers","upcastElementToElement","elementToAttribute","normalizeModelAttributeConfig","converter","prepareToAttributeConverter","getViewElementNameFromConfig","upcastElementToAttribute","viewKey","normalized","keyName","normalizeViewAttributeKeyValueConfig","upcastAttributeToAttribute","elementToMarker","normalizeElementToMarkerModelConfig","upcastElementToMarker","dataToMarker","converterStart","prepareToElementConverter","normalizeDataToMarkerConfig","converterEnd","basePriority","maxPriority","priorityFactor","addMarkerElements","markerViewNames","markerViewName","modelCursor","viewItem","upcastAttributeToMarker","upcastDataToMarker","viewConfig","matcherResult","getModelElement","safeInsert","updateConversionResult","viewAttributeKeyToCopy","defaultModelValue","configToTest","onlyViewNameIsDefined","modelKey","attributeWasSet","modelAttribute","setAttributeOn","EditingController","downcastDispatcher","modelSelection","convertSelectionChange","modelEnd","brokenPosition","reconvertMarker","markerOrName","currentMarker","_refresh","reconvertItem","_refreshItem","ModelSchema","_sourceDefinitions","_attributeProperties","_customChildChecks","_customAttributeChecks","_genericCheckSymbol","_compiledDefinitions","ModelSchemaContext","getDefinition","register","_clearCache","getDefinitions","_compile","isRegistered","isSelectable","isContent","_checkContextMatch","isAllowed","_evaluateAttributeChecks","allowAttributes","checkMerge","positionOrBaseElement","elementToMerge","addChildCheck","checks","addAttributeCheck","setAttributeProperties","getLimitElement","selectionOrRangeOrPosition","rangeCommonAncestor","checkAttributeInSelection","getValidRanges","convertToMinimalFlatRanges","_getValidRangesForRange","backwardWalker","forwardWalker","limitElement","forward","combineWalkers","findAllowedParent","setAllowedAttributes","removeDisallowedAttributes","removeDisallowedAttributeFromNode","positionsInRange","getAttributesWithProperty","attributeProperties","sourceRules","itemNames","compileBaseItemRule","propagateAllowIn","propagateAllowChildren","propagateDisallowIn","propagateDisallowChildren","resolveDisallows","compileAllowContentOf","compileAllowWhere","compileAllowAttributesOf","compileInheritPropertiesFrom","finalDefinitions","allowIn","allowChildren","compileDefinitions","parentItem","_evaluateChildChecks","parentItemDefinition","parentContext","trimLast","genericChecks","childChecks","check","findOptimalInsertionRange","place","firstBlock","positionAfter","mapContextItem","getItem","getNames","query","sourceItemRules","itemRule","disallowIn","disallowChildren","allowContentOf","allowWhere","disallowAttributes","allowAttributesOf","inheritTypesFrom","sourceItemRule","typeNames","copyTypes","copyProperty","inheritFrom","inheritAllFrom","resolveInheritAll","childName","childItem","allowContentOfItemName","baseItem","allowWhereItemName","allowAttributeOfItemName","inheritPropertiesOfItemName","singleValue","ctxItem","UpcastDispatcher","_splitParts","_cursorParents","_modelCursor","_emptyElementsToKeep","store","_convertItem","positionOrElement","_convertChildren","_safeInsert","_updateConversionResult","splitToAllowedParent","_splitToAllowedParent","getSplitParts","_getSplitParts","keepEmptyElement","_keepEmptyElement","contextDefinition","createContextTree","documentFragment","_removeEmptyElements","modelItem","markerElements","markerElement","currentPosition","extractMarkersFromModelFragment","elementOrModelCursor","nextModelCursor","splitResult","savedCursorParent","allowedParent","treeWalkerValue","originalPart","splitPart","_registerSplitPair","cursorParent","list","BasicHtmlWriter","getHtml","HtmlDataProcessor","domParser","htmlWriter","toData","toView","_toDom","useFillerType","DataController","upcastDispatcher","processor","_viewWriter","isUndoable","_checkIfRootsExists","ignoreWhitespaces","modelElementOrFragment","viewDocumentFragment","elementRange","isMarkerCollapsed","isMarkerAtElementBoundary","updatedMarkerRange","n1","n2","localeCompare","_getMarkersRelativeToElement","init","version","initialData","main","Promise","resolve","newData","batchType","removeSelectionAttribute","toModel","addStyleProcessorRules","rootNames","Conversion","_helpers","_downcast","_upcast","downcastDispatchers","upcastDispatchers","_createConversionHelpers","isDowncast","addAlias","alias","for","_getAllUpcastDefinitions","helpers","upcastAlso","_getUpcastDefinition","upcastAlsoItem","Operation","baseVersion","_validate","__className","_normalizeNodes","_splitNodeAtPosition","_mergeNodesAtIndex","_move","_haveSameAttributes","mergedNode","offsetDiff","firstPart","secondPart","nodeA","nodeB","iteratorA","iteratorB","MoveOperation","affectedSelectable","getMovedRangeStart","getReversed","newTargetPosition","sourceElement","sourceOffset","targetOffset","_execute","InsertOperation","shouldReceiveAttributes","gyPosition","originalNodes","SplitOperation","MergeOperation","splitElement","getInsertionPosition","mergedElement","MarkerOperation","affectsData","_markers","AttributeOperation","NoOperation","RenameOperation","oldName","RootAttributeOperation","RootOperation","isAdd","createRoot","_isAttached","transformations","setTransformation","OperationA","OperationB","transformationFunction","aGroup","noUpdateTransformation","getTransformation","transformOperationSets","operationsA","operationsB","contextFactory","ContextFactory","useRelations","forceWeakRemove","setOriginalOperations","originalOperations","nextTransformIndex","op","nextBaseVersionA","nextBaseVersionB","originalOperationsACount","originalOperationsBCount","opA","indexB","opB","newOpsA","getContext","newOpsB","updateRelation","newOpA","handlePartialMarkerOperations","padWithNoOps","brokenOperationsACount","brokenOperationsBCount","updateBaseVersions","_history","_useRelations","_forceWeakRemove","_relations","history","takeFrom","originalOperation","_setRelation","wasInLeftElement","wasStartBeforeMergedElement","wasEndBeforeMergedElement","wasInRightElement","aIsStrong","aWasUndone","_wasUndone","bWasUndone","abRelation","_getRelation","baRelation","originalOp","wasUndone","isUndoneOperation","origB","undoneB","getUndoneOperation","origA","relationsA","markerOps","_getComplementaryAttributeOperations","insertOperation","insertValue","_moveTargetIntoMovedRange","_makeMoveOperationsFromRanges","moveOp","diffs","_breakRangeByMoveOperation","aNewRange","aToGraveyard","bToGraveyard","removedRange","aCompB","shouldSpread","rightRange","movesGraveyardElement","gyMoveSource","splitNodesMoveSource","aTarget","gyMoveTarget","gyMove","splitNodesMoveTargetPath","splitNodesMoveTarget","splitNodesMove","extraRename","splitPath","additionalSplit","rangeToMove","gyElementMoved","newParentPosition","newTargetPath","splitAtTarget","howManyRemoved","aInGraveyard","bInGraveyard","newPositionPath","ModelLivePosition","toPosition","fromPosition","oldPosition","Batch","isLocal","isUndo","isTyping","addOperation","Differ","_markerCollection","_changesInElement","_elementsSnapshots","_elementChildrenSnapshots","_elementState","_changedMarkers","_changedRoots","_changeCount","_cachedChanges","_cachedChangesWithGraveyard","_refreshedItems","markerCollection","bufferOperation","operationToBuffer","_isInInsertedElement","_markInsert","_markAttribute","sourceParentInserted","targetParentInserted","_markRemove","_setElementState","getMarkersIntersectingRange","markerData","bufferMarkerChange","graveyardParent","mergedIntoElement","_isLoaded","_bufferRootStateChange","_bufferRootAttributeChange","oldMarkerData","newMarkerData","buffered","getChangedMarkers","hasDataChanges","markerAdded","markerRemoved","markerChanged","includeChangesInGraveyard","diffSet","childrenBefore","childrenAfter","_getChildrenSnapshots","diffInstructions","_generateDiffInstructionsFromChanges","instruction","_getDiffActionForNode","childSnapshotBefore","diffItem","_getInsertDiff","_getRemoveDiff","beforeAttributes","afterAttributes","diffItems","_getAttributesDiff","changeCount","prevIndex","prevDiff","thisDiff","isConsecutiveTextRemove","isConsecutiveTextAdd","isConsecutiveAttributeChange","_changesInGraveyardFilter","getChangedRoots","state","_bufferRootLoad","attrEntry","changeItem","_markChange","_removeAllNestedChanges","_makeSnapshots","_getChangesForElement","_handleChange","currentStatePriority","_statesPriority","diffItemType","childrenSnapshots","snapshot","inc","nodesToHandle","old","incEnd","oldEnd","intersectionLength","howManyAfter","attributePart","elementSnapshot","elementSnapshotBefore","before","_getSingleNodeSnapshot","snapshots","oldChildrenLength","oldChildrenHandled","posInGy","rangeInGy","History","_operations","_undoPairs","_undoneOperations","_baseVersionToOperationIndex","_version","_gaps","lastOperation","historyVersion","getOperations","fromBaseVersion","toBaseVersion","firstOperation","inclusiveTo","gapFrom","gapTo","fromIndex","toIndex","getOperation","operationIndex","setOperationAsUndone","undoneOperation","undoingOperation","isUndoingOperation","ModelRootElement","copyOwnProperties","graveyardName","ModelDocument","_hasSelectionChangedFromTheLastChangeBlock","removeMarker","getRootNames","includeDetached","typedArray","Ctor","dataView","clonedBuffer","srcView","stringLength","cloneStringObjectProperties","regExp","setPrototypeOf","copyPrototype","symbols","copySymbolProperties","_handleChangeBlock","_hasDocumentChangedFromTheLastChangeBlock","_getDefaultRoot","defaultRoot","createPositionFromPath","validateTextNodePosition","rangeBoundary","MarkerCollection","Marker","managedUsingOperations","oldMarker","hasChanged","_attachLiveRange","_managedUsingOperations","_affectsData","_destroyMarker","getMarkersGroup","_detachLiveRange","_liveRange","getStart","getEnd","usingOperations","DetachOperation","ModelDocumentFragment","ModelWriter","cloneElement","_assertWriterUsedCorrectly","isSameTree","applyOperation","rangeRootPosition","usingOperation","updateMarker","addMarker","insertText","itemOrPositionOrOffset","appendText","appendElement","itemOrRange","setAttributeOnRange","setAttributeOnItem","setAttributes","clearAttributes","removeAttributesFromItem","_addOperationForAffectedMarkers","applyRemoveOperation","_merge","_mergeDetached","renameOperation","firstSplitElement","firstCopyElement","elementOrString","shiftedRange","applyMarkerOperation","hasUsingOperationDefined","affectsDataDefined","currentRange","updatedRange","addRoot","detachRoot","rootOrName","setSelectionAttribute","keyOrObjectOrIterable","_setSelectionAttribute","keyOrIterableOfKeys","_removeSelectionAttribute","overrideSelectionGravity","restoreSelectionGravity","storeKey","_currentWriter","isAffected","affectedInLeftElement","affectedInRightElement","affectedAfterLeftElement","affectedBeforeRightElement","valueBefore","valueAfter","lastSplitPosition","previousValue","rootA","rootB","tryFixingRange","originalPosition","nearestSelectionRange","ancestorObject","fixedPosition","tryFixingCollapsedRange","isTextAllowedOnStart","isTextAllowedOnEnd","startLimitElement","endLimitElement","startIsOnBlock","endIsOnBlock","checkSelectionOnNonLimitElements","fixedStart","fixedEnd","isStartInLimit","isEndInLimit","bothInSameParent","expandStart","expandEnd","findOutermostLimitAncestor","tryFixingNonCollapsedRage","startingNode","isLimitNode","deleteContent","selRange","doNotResetEntireContent","shouldEntireContentBeReplacedWithParagraph","insertParagraph","replaceEntireContentWithParagraph","attributesForAutoparagraph","doNotAutoparagraph","doNotFixSelection","ignoreMarkers","modifySelection","newEndPosition","skippedRange","getLivePositionsForSelectedBlocks","leaveUnmerged","checkShouldMerge","startAncestor","endAncestor","positionA","positionB","getAncestorsJustBelowCommonAncestor","mergeBranchesRight","mergeBranchesLeft","mergeBranches","collapseSelectionAt","isTextAllowed","isParagraphAllowed","shouldAutoparagraph","commonAncestor","parentToRemove","mergeRight","leftPos","rightPos","rangeToCheck","isCrossingLimitElement","removeRangeContent","parentsToCheck","itemRange","parentToCheck","removeRange","Insertion","canMergeWith","_documentFragment","_documentFragmentPosition","_firstNode","_lastNode","_lastAutoParagraph","_filterAttributesAndChildrenOf","_affectedStart","_affectedEnd","_nodeToSelect","handleNodes","_handleNode","_insertPartialFragment","_updateLastNodeFromAutoParagraph","_mergeOnRight","_removeDisallowedChildren","itemParent","positionAfterLastNode","positionAfterNode","_setAffectedBoundaries","getSelectionRange","getAffectedRange","_checkAndSplitToAllowedPosition","_appendToFragment","_handleDisallowedNode","livePosition","_mergeOnLeft","_canMergeLeft","mergePosLeft","_canMergeRight","mergePosRight","_insertAutoParagraph","allowedIn","_getAllowedIn","tempPos","childNode","tryExtendingTo","isForward","treatEmojiAsSingleUnit","isAtNodeBoundary","isAtWordBoundary","getCorrectWordBreakPosition","getCorrectPosition","getSearchRange","searchEnd","offsetToCheck","Model","_pendingChanges","correctedRange","rangesToMerge","rangeIndexesToRemove","currentRangeIndex","previousRanges","previousRangeIndex","previousRange","mergedRange","nonIntersectingRanges","mergeIntersectingRanges","selectionPostFixer","insertion","fakeMarkerElements","nodesToInsert","markersPosition","posA","posB","isAtBeginning","selectionLiveRange","markersData","isStartBoundary","elementPosition","rangeOnInsertion","affectedRange","insertContent","originalSelection","insertionSelection","findOptimalPosition","firstSelectedBlock","attributesToCopy","elementToInsert","insertionPositionParent","paragraphAttributes","nextElement","updateSelection","insertObject","canEditAt","_runPendingChanges","batchOrType","rest","normalizeSelectable","getSelectedContent","frag","commonPath","commonParent","flatSubtreeRange","leftExcessRange","rangeOrElement","intersectingMarker","createBatch","createOperationFromJSON","ret","currentBatch","callbackReturnValue","ClickObserver","MouseObserver","TouchObserver","PointerObserver","ViewUpcastWriter","insertChild","removeChildren","oldElement","valueOrElement","HEX_COLOR_REGEXP","RGB_COLOR_REGEXP","RGBA_COLOR_REGEXP","HSL_COLOR_REGEXP","HSLA_COLOR_REGEXP","CSS_SHORTHAND_VALUE_REGEXP","COLOR_NAMES","lineStyleValues","isLineStyleValue","lengthRegExp","PERCENTAGE_VALUE_REGEXP","repeatValues","isRepeatStyleValue","positionValues","isPositionStyleValue","attachmentValues","isAttachmentStyleValue","urlRegExp","isURLStyleValue","getBoxSidesStyleValues","getShorthandStylesValues","getBoxSidesStyleValueReducer","styleShorthand","reduced","getBoxSidesStyleShorthandValue","out","getPositionStyleShorthandNormalizer","shorthand","addBackgroundStylesRules","background","attachment","color","addBorderStylesRules","normalizeBorderShorthand","getBorderPositionNormalizer","getBorderPropertyNormalizer","getBorderPropertyPositionNormalizer","getBorderPositionExtractor","getBorderPositionReducer","topStyles","extractBorderPosition","rightStyles","bottomStyles","leftStyles","borderStyles","borderStylesByType","getReducedStyleValueForType","reducedBorderStyle","reduceBorderPosition","reducedStyleTypes","getBorderReducer","border","toBorderPropertyShorthand","which","borderTypes","borderValue","addMarginStylesRules","addPaddingStylesRules","ClassicEditorUI","_toolbarConfig","_elementReplacer","_handleScrollToTheSelectionWithStickyPanel","replacementElement","editingRoot","_initPlaceholder","_initToolbar","_initDialogPluginIntegration","_initContextualBalloonIntegration","stickyPanel","toolbar","placeholderText","plugins","contextualBalloon","isSticky","stickyPanelHeight","newTopViewportOffset","updateBalloonPosition","visibleView","scrollViewportOnPanelGettingSticky","dialogPlugin","dialogView","stickyPanelContentRect","contentPanelElement","BodyCollection","_bodyCollectionContainer","bodyCollectionContainer","attachToDom","_bodyWrapper","detachFromDom","childElementCount","EditorUIView","LabelView","BoxedEditorUIView","_voiceLabelView","_createVoiceLabel","lang","voiceLabel","StickyPanelView","_contentPanelPlaceholder","_contentPanelRect","marginLeft","checkIfShouldBeSticky","isActive","_unstick","windowRect","visualViewportOffsetLeft","limiterBottomOffset","stickyBottomOffset","_stickToBottomOfLimiter","_stickToTopOfAncestors","topOffset","_isStickyToTheBottomOfLimiter","_stickyTopOffset","_stickyBottomOffset","_marginLeft","ToolbarSeparatorView","ToolbarLineBreakView","DropdownPanelView","selectstart","toLocaleLowerCase","dropdownPanel","DropdownView","listView","panelPosition","optimalPanelPosition","_panelPositions","_defaultPanelPositionName","closeDropdown","south","north","southMiddleEast","southMiddleWest","northMiddleEast","northMiddleWest","defaultPanelPositions","arrowView","_createArrowView","ListSeparatorView","ListItemGroupView","nestedList","ListView","ariaLabelledBy","firstListItem","_listItemGroupToChangeListeners","_registerFocusableItemsGroup","_registerFocusableListItem","_deregisterFocusableItemsGroup","_deregisterFocusableListItem","_getOnGroupItemsChangeCallback","groupView","groupIndex","registeredChildIndex","groupItemsChangeCallback","actionView","actionButton","_createActionView","SwitchButtonView","toggleSwitchView","_createToggleView","ListItemButtonView","_checkIconHolderView","CheckIconHolderView","hasCheckSpace","_hasCheck","_watchCheckIconHolderMount","hasCheck","_checkIconView","_createCheckIconView","_watchCheckIconMount","ButtonClassOrInstance","dropdownView","getFocusTrackerTreeElements","closeDropdownOnClickOutside","closeDropdownOnExecute","closeDropdownOnBlur","focusDropdownContentsOnArrows","focusDropdownButtonOnClose","focusDropdownPanelOnOpen","addDefaultBehaviors","addToolbarToDropdown","buttonsOrCallback","addToolbarToOpenDropdown","enableActiveItemFocusOnDropdownOpen","focusChildOnDropdownOpen","ToolbarView","buttons","maxWidth","isCompact","isVertical","itemsOrCallback","addListToOpenDropdown","bindViewCollectionItemsToDefinitions","childSelectorCallback","childToFocus","listItems","toggleableButtonsCount","pickListItemButtonIfPresent","pickListItemToggleableButtonIfPresent","listItemButtonView","prevToggleable","currentToggleable","hasSpace","listItem","listItemButton","updateAllButtonsCheckSpace","bindDropdownToggleableButtonsAlignment","listItemView","NESTED_TOOLBAR_ICONS","alignLeft","bold","importExport","plus","threeVerticalDots","pilcrow","dragIndicator","itemsView","_behavior","shouldGroupWhenFull","ItemsView","isRtl","isFloating","DynamicGrouping","StaticLayout","itemsOrConfig","_buildItemsFromConfig","switchBehavior","newBehaviorType","refreshItems","normalizedRemoveItems","_cleanItemsConfiguration","_createNestedToolbarDropdown","filteredItems","_cleanSeparatorsAndLineBreaks","nonSeparatorPredicate","firstCommandItemIndex","lastCommandItemIndex","withText","isGrouping","viewChildren","viewFocusables","viewItemsView","viewFocusTracker","viewLocale","ungroupedItems","groupedItems","groupedItemsDropdown","resizeObserver","cachedPadding","shouldUpdateGroupingOnNextResize","_createGroupedItemsDropdown","changeData","removedItem","addedItem","_updateGrouping","_enableGroupingOnResize","_enableGroupingOnMaxWidthChange","initialGroupedItemsCount","wereItemsGrouped","_areItemsOverflowing","_groupLastItem","_ungroupFirstItem","lastChildRect","toolbarRect","computedStyle","paddingProperty","previousWidth","contentRect","dropdown","tooltipPosition","MenuBarMenuButtonView","MenuBarMenuPanelView","_repositionPanelOnOpen","_attachBehaviors","_propagateArrowKeystrokeEvents","_defaultMenuPositionName","MenuBarMenuListView","_setItemsCheckSpace","hasAnyToggleableItem","listButtonView","pickListButtonMenuViewIfPresent","isNestedMenuLikeView","MenuBarMenuListItemButtonView","FileDialogButtonView","FileDialogViewMixin","FileDialogListItemButtonView","_fileInputView","FileInputView","open","accept","multiple","MenuBarMenuListItemFileDialogButtonView","EVENT_NAME_DELEGATES","MenuBarView","_setupIsOpenUpdater","topLevelCategoryMenuViews","_createMenu","topLevelCategoryMenuView","registerMenu","_createMenuItems","menuGroupDefinition","itemDefinition","menuItemView","componentView","_createMenuItemContentFromFactory","_registerMenuTree","menuBarItemsList","nonSeparatorItems","closeTimeout","EditableUIView","_editingView","_editableElement","_hasExternalElement","_updateIsFocusedClasses","hasExternalElement","updateAfterRender","InlineEditableUIView","getEditableAriaLabel","editableName","existingLabel","ClassicEditorUIView","shouldToolbarGroupWhenFull","useMenuBar","_disableStack","forceDisabled","forceDisable","clearForceDisabled","isContextPlugin","isOfficialPlugin","isPremiumPlugin","_isEnabledBasedOnSelection","canEditAtSelection","execute","MultiCommand","_childCommandsDefinitions","command","_getFirstEnabledCommand","registerChildCommand","_checkEnabled","commandDefinition","CommandCollection","_commands","commandName","commandParams","commands","PluginCollection","_context","_plugins","_availablePlugins","_contextPlugins","availablePlugins","contextPlugins","PluginConstructor","pluginName","pluginInstance","plugin","pluginsToRemove","pluginsSubstitutions","that","findAvailablePluginConstructors","processed","isPluginConstructor","requires","validatePlugins","pluginConstructors","getPluginConstructors","isPluginRemoved","pluginItem","pluginToReplace","indexInPluginConstructors","substitutePlugins","pluginInstances","_add","loadPlugins","initPlugins","then","removedPlugin","getPluginName","parentPluginConstructor","missingPlugin","requiredBy","checkMissingPlugin","checkContextPlugin","checkRemovedPlugin","method","promise","promises","all","plugin1","plugin2","Context","editors","_contextOwner","defaultConfig","builtinPlugins","languageConfig","Plugin","_addEditor","isContextOwner","_removeEditor","_getEditorConfig","ContextPlugin","EditingKeystrokeHandler","evtData","Watchdog","crashes","_crashNumberLimit","_now","_minimumNonErrorTimePeriod","_boundErrorHandler","_listeners","crashNumberLimit","minimumNonErrorTimePeriod","reason","_handleError","_restart","_stopErrorHandling","cb","_fire","_startErrorHandling","_shouldReactToError","filename","ErrorEvent","lineno","colno","date","causesRestart","_shouldRestart","_isErrorComingFromThisItem","head","excludedProperties","subNodes","nodeIndex","shouldNodeBeIncluded","typeOfNode","Event","areConnectedThroughProperties","target1","target2","excludedNodes","structure","subNodes1","subNodes2","EditorWatchdog","_editor","_lifecyclePromise","_throttledSave","_lastDocumentVersion","_elementOrData","_initUsingData","_editables","_excludedProps","Editor","watchdogConfig","_save","saveInterval","_creator","elementOrData","_destructor","_item","setCreator","creator","setDestructor","destructor","_destroy","catch","existingRoots","lazyRoots","oldRootsAttributes","rootsAttributes","rootData","isLoaded","updatedConfig","extraPlugins","_watchdogInitialData","EditorWatchdogInitPlugin","_cloneEditorConfiguration","_getData","_getEditables","finally","_setExcludedProperties","props","commentsRepository","trackChanges","commentThreads","suggestions","rangeJSON","getCommentThreads","skipNotAttached","getSuggestions","editables","_restoreCollaborationData","_restoreEditorData","_createNode","jsonNode","parsedNodes","parsedAttributes","rootElement","markerOptions","parsedCommentThreads","parsedSuggestions","commentThread","_removeCommentThread","threadId","commentThreadData","channelId","addCommentThread","trackChangesEditing","suggestion","_removeSuggestion","suggestionData","addSuggestionData","mainQueueId","ContextWatchdog","_watchdogs","_watchdogConfig","_contextProps","_actionQueues","ActionQueues","_contextConfig","contextConfig","onEmpty","enqueue","_create","_getWatchdog","getItemState","itemConfigurationOrItemConfigurations","itemConfigurations","watchdog","res","rethrowRestartEventOnce","sourceElementOrData","itemIdOrItemIds","itemIds","_onEmptyCallbacks","_queues","_activeActions","onEmptyCallback","queueId","isMainAction","queueWithAction","nonErrorQueue","elementOrArray","DEFAULT_CATEGORY_ID","DEFAULT_GROUP_ID","Accessibility","keystrokeInfos","isMenuBarVisible","addKeystrokeInfoCategory","navigationKeystrokes","mayRequireFn","addKeystrokeInfoGroup","categoryId","category","addKeystrokeInfos","getEditorType","editorName","getToolbarUsageData","toolbarConfig","normalizedToolbar","flattenToolbarConfigNames","extractToolbarConfigItemsNames","isMultiline","shouldNotGroupWhenFull","getEnvUsageData","os","browser","accessibility","conversion","_readOnlyLocks","defaultTranslations","CKEDITOR_GLOBAL_LICENSE_KEY","checkLicenseKeyIsDefined","distributionChannel","blockEditor","enableReadOnlyMode","_showLicenseError","licensePayload","field","hasAllRequiredFields","inputData","dataArray","crcTable","makeCrcTable","crc","dataString","padStart","crc32","filteredValues","getOwnPropertyNames","getCrcInputData","vc","exp","licensedHosts","hostname","URL","location","segments","host","octets","segment","checkLicensedHosts","CKEDITOR_WARNING_SUPPRESSIONS","capitalizedLicenseType","article","info","warnAboutNonProductionLicenseKey","timerId","usageEndpoint","request","requestId","requestTime","license","collectUsageData","_sendUsageRequest","response","status","url","verifyLicenseKey","lockId","disableReadOnlyMode","removePlugins","decodedPayload","disallowedPlugin","pluginConstructor","licenseFeatureCode","removeFeatures","checkPluginsAllowedByLicenseKey","readyPromise","gluePluginName","containsGluePlugin","featureName","endpoint","headers","Headers","fetch","ok","collectedData","sessionId","localStorage","setItem","pageSessionId","CKEDITOR_PAGE_SESSION_ID","isContext","isOfficial","isPremium","distribution","channel","integration","menuBar","getEditorUsageData","setUsageData","ElementApiMixin","updateSourceElement","shouldUpdateSourceElement","isSourceElementTextArea","dataToSet","PendingActions","_actions","hasAny","getInitialData","isTextArea","form","originalSubmit","onSubmit","submit","attachToForm","ClipboardObserver","handleInput","dropRange","clipboardData","smallPaddingElements","listElements","viewToPlainText","newLinePadding","domElementToPlainText","TEXT_NODE","identity","isMatchWithInternal","compare","isArrayMatch","isMapMatch","isSetMatch","isObjectMatch","countedIndex","sourceItem","isMatch","doesMatch","srcValue","isMatchWith","iteratee","matchesProperty","ClipboardMarkersUtils","_markersToCopy","_registerMarkerToCopy","_copySelectedFragmentWithMarkers","getCopiedFragment","sourceSelectionInsertedMarkers","_insertFakeMarkersIntoSelection","fakeMarkersRangesInsideRange","_removeFakeMarkersInsideElement","_pasteMarkersIntoTransformedElement","getPastedDocumentElement","pasteMarkers","_getPasteMarkersFromRangeMap","sourceFragmentFakeMarkers","_insertFakeMarkersElements","transformedElement","removedFakeMarkers","_pasteFragmentWithMarkers","copyableMarker","_forceMarkersCopy","executor","allowedActions","copyPartiallySelected","duplicateOnPaste","_isMarkerCopyable","_getMarkerClipboardConfig","_hasMarkerConfiguration","markerNamePrefix","copyableMarkers","_getCopyableMarkersFromSelection","selectionRanges","markersInRanges","_getUniqueMarkerName","copyMarkerConfig","isInGraveyard","mappedMarkers","sortedMarkers","fakeMarker","fakeMarkersRanges","_getAllFakeMarkersFromElement","prevFakeMarker","skipAssign","getNewValue","mapValues","foundFakeMarkers","prependFakeMarkers","appendFakeMarkers","otherFakeMarker","newId","ClipboardPipeline","_setupPasteDrop","_setupCopyCut","_fireOutputTransformationEvent","clipboardMarkersUtils","contentData","fullMatch","spaces","normalizeClipboardData","sourceEditorId","modelFragment","resultRange","modelDocument","onCopyCut","isClipboardPipeline","TypingChangeBuffer","limit","_isLocked","_size","_batch","_changeCallback","_selectionChangeCallback","_reset","isLocked","lock","unlock","ignoreLock","InsertTextCommand","_buffer","undoStepSize","textInsertions","selectionAttributes","TYPING_INPUT_TYPES","TYPING_INPUT_TYPES_ANDROID","InsertTextObserver","typingInputTypes","Input","_typingQueue","TypingQueue","insertTextCommand","modelRanges","selectedText","rangeText","commandData","deleteSelectionContent","hasAffectedElements","isElementAffected","flushAffectedElements","flushDebounced","_queue","_isComposing","_affectedElements","commandLiveData","detachLiveRange","DeleteCommand","sequence","_shouldEntireContentBeReplacedWithParagraph","_replaceEntireContentWithParagraph","_shouldReplaceFirstBlockWithParagraph","limitElementFirstChild","DELETE_WORD","DELETE_SELECTION","DELETE_BACKWARD","DELETE_FORWARD","DELETE_EVENT_TYPES","deleteContentBackward","deleteWordBackward","deleteHardLineBackward","deleteSoftLineBackward","deleteContentForward","deleteWordForward","deleteHardLineForward","deleteSoftLineForward","DeleteObserver","deleteEventSpec","selectionToRemove","shouldUseTargetRanges","pressedKeyCode","beforeInputReceived","isDeleteKeyCode","getDeleteDirection","shouldFireDeleteEvent","targetRange","enableChromeWorkaround","Delete","_undoOnBackspace","deleteForwardCommand","ancestorLimit","requestUndoOnBackspace","Typing","getLastTextLine","TextWatcher","testCallback","_hasMatch","_startListening","hasMatch","_evaluateTextBeforeSelection","suffix","rangeBeforeSelection","testResult","eventData","TwoStepCaretMovement","_overrideUid","_isNextGravityRestorationSkipped","arrowRightPressed","arrowLeftPressed","contentDirection","isMovementHandled","_handleForwardMovement","_handleBackwardMovement","_isGravityOverridden","isBetweenDifferentAttributes","_enableClickingAfterNode","_enableInsertContentSelectionAttributesFixer","_handleDeleteContentAfterNode","registerAttribute","hasAnyAttribute","preventCaretMovement","clearSelectionAttributes","setSelectionAttributesFromTheNodeBefore","isStepAfterAnyAttributeBoundary","touched","clicked","isBackspace","shouldPreserveAttributes","observedAttribute","isInlineObject","isStrict","attrBefore","attrAfter","buildQuotesRegExp","quoteCharacter","findAttributeRange","findAttributeRangeBound","lookBack","inlineHighlight","highlightedElements","getCopyOnEnterAttributes","allAttributes","copyOnEnter","EnterCommand","enterBlock","isSelectionEmpty","splitBlock","isContainedWithinOneElement","splitPos","ENTER_EVENT_TYPES","isSoft","insertLineBreak","EnterObserver","shiftPressed","enterEventSpec","Enter","ShiftEnterCommand","insertBreak","softBreakAction","anchorPos","isInsideLimitElement","breakLineElement","ShiftEnter","WidgetHighlightStack","_stack","oldTop","_insertDescriptor","newTop","compareDescriptors","oldDescriptor","newDescriptor","_removeDescriptor","classesToString","WIDGET_SELECTED_CLASS_NAME","toWidget","labelOrCreator","setLabel","hasSelectionHandle","widgetElement","selectionHandle","addSelectionHandle","setHighlightHandling","addHighlight","toWidgetEditable","withAriaRole","isReadonly","typeAroundFakeCaretPosition","getTypeAroundFakeCaretPosition","calculateResizeHostAncestorWidth","domResizeHost","getElementComputedWidth","paddingLeft","paddingRight","parseFloat","domResizeHostParent","parentWidth","currentLevel","checkedElement","TYPE_AROUND_SELECTION_ATTRIBUTE","isTypeAroundWidget","POSSIBLE_INSERTION_POSITIONS","RETURN_ARROW_ICON_ELEMENT","PLUGIN_DISABLED_EDITING_ROOT_CLASS","WidgetTypeAround","_currentFakeCaretModelElement","_enableTypeAroundUIInjection","_enableInsertingParagraphsOnButtonClick","_enableInsertingParagraphsOnEnterKeypress","_enableInsertingParagraphsOnTypingKeystroke","_enableTypeAroundFakeCaretActivationUsingKeyboardArrows","_enableDeleteIntegration","_enableInsertContentIntegration","_enableInsertObjectIntegration","_enableDeleteContentIntegration","_insertParagraph","widgetModelElement","_listenToIfEnabled","_insertParagraphAccordingToFakeCaretPosition","selectedModelElement","buttonTitles","widgetViewElement","typeAroundWrapper","wrapperDomElement","buttonTemplate","importNode","injectButtons","caretTemplate","injectFakeCaret","injectUIIntoWidget","positionToWidgetCssClass","domEventData","_handleArrowKeyPress","selectedViewElement","localizedKeyCodeDirection","isForwardArrowKeyCode","shouldStopAndPreventDefault","_handleArrowKeyPressOnSelectedWidget","_handleArrowKeyPressWhenSelectionNextToAWidget","_handleArrowKeyPressWhenNonCollapsedSelection","widgetPlugin","modelElementNextToSelection","_getObjectElementNextToSelection","_setSelectionOverElement","selectedModelNode","buttonPosition","classList","widgetDomElement","getClosestWidgetViewElement","wasHandled","selectedModelWidget","isDeleteForward","probe","deepestEmptyRangeAncestor","deepestEmptyAncestor","getDeepestEmptyElementAncestor","documentSelection","getNearestNonInlineLimit","walkerValueType","getNearestTextPosition","Widget","_previouslySelected","_clearPreviouslySelectedWidgets","lastMarked","_onMousedown","_onPointerdown","_handleSelectionChangeOnArrowKeyPress","_preventDefaultOnArrowKeyPress","arrowUpPressed","arrowDownPressed","expandSelection","lastRangePosition","firstRangePosition","findTextRangeFromSelection","boundaryVerticalPosition","isSingleLineRange","verticalWidgetNavigationHandler","_handleDelete","_selectNextEditable","_selectAncestorWidget","detail","_selectBlockContent","isPrimary","editableOrWidgetElement","currentElement","findClosestEditableOrWidgetAncestor","clickTargetFromPoint","getElementFromMouseEvent","findTextBlockAncestor","nextTextBlock","findNextTextBlock","isVerticalNavigation","firstPosition","lastPosition","firstSelectedNode","lastSelectedNode","hasObjectAtEdge","getModelSelectionAdjusted","nodeBeforeProbe","nodeAfterProbe","lastProbeNode","objectElement","previousNode","nodeToRemove","widget","_findNextFocusRange","editablePath","ContextualBalloon","positionLimiter","visibleStack","_viewToStack","_idToStack","_view","_rotatorView","_fakePanelsView","_createPanelView","hasView","stackId","_numberOfStacks","_visibleStack","singleViewMode","showStack","_showView","_singleViewMode","_showNextStack","hideView","_getStackId","getPositionOptions","_createRotatorView","_createFakePanelsView","stacks","nextIndex","_showPrevStack","RotatorView","isSingleViewMode","numberOfStacks","buttonNextView","buttonPrevView","FakePanelsView","number","balloonClassName","showView","_createButtonView","_balloonPanelView","_addPanels","_removePanels","numberOfPanels","WidgetToolbarRepository","_toolbarDefinitions","_balloon","balloonToolbar","isWidgetSelected","_updateToolbarsVisibility","toolbarId","getRelatedElement","toolbarDefinition","itemsConfig","initialized","relatedElement","_showToolbar","_hideToolbar","maxRelatedElementDepth","deepestRelatedElement","deepestToolbarDefinition","relatedElementDepth","_isToolbarVisible","_isToolbarInBalloon","repositionContextualBalloon","getBalloonPositionData","WidgetResizeState","_referenceCoordinates","_originalWidth","_originalHeight","_originalWidthPercents","_aspectRatio","originalWidth","originalHeight","originalWidthPercents","aspectRatio","begin","domResizeHandle","domHandleHost","clientRect","activeHandlePosition","domHandle","resizerPositions","getHandlePosition","resizerPosition","positionParts","getAbsoluteBoundaryPoint","replacements","getOppositePosition","widthStyle","resizeHostRect","calculateResizeHostPercentageWidth","newSize","proposedWidth","proposedHeight","proposedWidthPercents","widthPercents","proposedHandleHostWidth","handleHostWidth","proposedHandleHostHeight","handleHostHeight","SizeView","visible","_bindToState","resizeState","_dismiss","WidgetResizer","_state","_sizeView","_viewResizerWrapper","_initialViewWidth","isSelected","_cleanup","viewResizerWrapper","_appendHandles","_appendSizeUI","redraw","_getHandleHost","_getResizeHost","updateSize","_proposeNewSize","newWidth","domHandleHostRect","domResizeHostRect","commit","onCommit","handleHostRect","domWrapper","_domResizerWrapper","widgetWrapper","handleHost","resizerWrapper","currentDimensions","newDimensions","isSameNode","containsHandle","isResizeHandle","currentCoordinates","pageX","pageY","isCentered","enlargement","abs","getResizeHost","getHandleHost","WidgetResize","_resizers","_observer","_redrawSelectedResizerThrottled","_mouseDownListener","_mouseMoveListener","_mouseUpListener","redrawSelectedResizer","resizer","getResizerByViewElement","select","deselect","selectedResizer","widgetToolbarRepository","_getResizerByHandle","resizeHandle","_activeResizer","LineView","DragDropTarget","removeDropMarkerDelayed","removeDropMarker","_updateDropMarkerThrottled","_updateDropMarker","_reconvertMarkerThrottled","_dropTargetLineView","_scrollables","_setupDropMarker","updateDropMarker","targetViewElement","targetViewRanges","blockMode","draggedRange","findDropTargetRange","getFinalDropRange","_createDropTargetPosition","_updateDropTargetLine","nodeParent","viewElementBefore","domElementBefore","viewElementAfter","domElementAfter","viewElementParent","domElementParent","domScrollableRect","_getScrollableRect","rectBefore","rectAfter","rectParent","above","below","parentStyle","leftClamped","rightClamped","domScrollable","overflowY","findScrollableElement","getClosestMappedModelElement","targetViewPosition","targetModelPosition","findDropTargetRangeForElement","shouldIgnoreElement","startIndex","endIndex","middleIndex","floor","findElementSide","float","targetModelElement","DragDropBlockToolbar","_isBlockDragging","_handleBlockDragStart","_handleBlockDragging","_handleBlockDragEnd","blocks","elementFromPoint","DragDrop","_draggedRange","_draggingUid","_draggableElement","_clearDraggableAttributesDelayed","_clearDraggableAttributes","_blockMode","_previewContainer","_setupDragging","_setupContentInsertionIntegration","_setupClipboardInputIntegration","_setupDraggableAttributeHandling","_finalizeDragging","dragDropTarget","_prepareDraggedRange","canEditAtDraggedRange","draggedSelection","_updatePreview","getFinalDropEffect","clipboardPipeline","isMove","isSuccess","draggableElement","findDraggableWidget","moved","draggableWidget","blockRange","getRangeIncludingFullySelectedParents","touchesBlockEdges","preview","domRect","domEditablePaddingLeft","domEditablePaddingRight","editableWidth","padding","minWidth","minHeight","boxSizing","backgroundColor","firstElement","lastElement","parentRange","touchesStart","touchesEnd","PastePlainText","isFormatting","isUnformattedInlineContent","textAttributes","Clipboard","SelectAllCommand","scopeElement","isSelectAllScope","SELECT_ALL_KEYSTROKE","SelectAllEditing","SelectAllUI","_createButton","ButtonClass","SelectAll","UndoRedoBaseCommand","_createdBatches","clearStack","createdBatches","addBatch","docSelection","_restoreSelection","transformedRangeGroups","allRanges","rangeGroup","isRangeContainedByAnyOtherRange","normalizeRanges","_undo","batchToUndo","undoingBatch","operationsToUndo","operationToUndo","nextBaseVersion","historyOperations","reversedOperations","joinedRange","UndoCommand","batchIndex","RedoCommand","redoingBatch","UndoEditing","_undoCommand","_redoCommand","_batchRegistry","isRedoBatch","isUndoBatch","undoneBatch","UndoUI","localizedUndoIcon","localizedRedoIcon","_addButtonsToFactory","Icon","Undo","Dialog","_onHide","_initShowHideListeners","_initFocusToggler","_initMultiRootIntegration","_visibleDialogPlugin","_unlockBodyScroll","_show","onShow","_hide","changedRoots","dialogDefinition","onHide","_lockBodyScroll","AccessibilityHelpContentView","helpLabel","_createCategories","categories","categoryDefinition","_createGroup","definitionAndDescriptionElements","keystrokeDefinition","_createGroupRow","dt","dd","normalizedKeystrokeDefinition","keystrokeAlternativeHTMLs","keystrokeAlternative","keystrokeToEnvKbd","AccessibilityHelp","_toggleDialog","_setupRootLabels","dialog","addAriaLabelTextToRoot","newAriaLabel","FileReader","total","_reader","reader","onprogress","loaded","read","file","reject","onload","onerror","onabort","readAsDataURL","abort","loaders","_loadersMap","_pendingAction","_updatePendingAction","uploaded","getLoader","fileOrPromise","createLoader","createUploadAdapter","loader","FileLoader","aggregatedUploaded","aggregatedTotal","uploadTotal","destroyLoader","fileOrPromiseOrLoader","pendingActions","getMessage","uploadedPercent","_filePromiseWrapper","_adapter","filePromise","uploadAdapterCreator","_createFilePromiseWrapper","upload","uploadResponse","isFulfilled","rejecter","wrapper","xhr","_initRequest","_initListeners","_sendRequest","XMLHttpRequest","uploadUrl","responseType","genericErrorText","urls","default","lengthComputable","withCredentials","headerName","setRequestHeader","FormData","send","TOKEN_COOKIE_NAME","UploadAdapter","genericError","cookie","pair","decodeURIComponent","getCookie","randValues","tokenCharset","random","generateToken","encodeURIComponent","getCsrfToken","blockAutoformatEditing","callbackOrCommand","blockToFormat","firstNode","firstNodeRange","exec","selectionSchemaContext","restoreSelectionAttributes","inlineAutoformatEditing","testRegexpOrCallback","formatCallback","format","leftDel","rightDel","delStart","delEnd","getTextAfterCode","testOutput","rangesToFormat","testOutputToRanges","rangesToRemove","arrays","getCallbackFunctionForInlineAutoformat","validRanges","AttributeCommand","_getValueFromFirstAllowedNode","forceValue","BOLD","BoldEditing","fontWeight","getButtonCreator","BoldUI","createButton","ITALIC","ItalicEditing","ItalicUI","UNDERLINE","UnderlineEditing","UnderlineUI","STRIKETHROUGH","StrikethroughEditing","StrikethroughUI","CODE","CodeEditing","CodeUI","SUBSCRIPT","SubscriptEditing","SubscriptUI","SUPERSCRIPT","SuperscriptEditing","SuperscriptUI","BlockQuoteCommand","_getValue","blocksToQuote","findQuote","checkCanBeQuoted","_applyQuote","_removeQuote","getRangesOfBlockGroups","groupRange","positionBefore","quotesToMerge","quote","currentQuote","nextQuote","elementOrPosition","nextBlock","isBQAllowed","isBlockAllowedInBQ","BlockQuoteEditing","blockQuoteCommand","BlockQuoteUI","ParagraphCommand","checkCanBecomeParagraph","InsertParagraphCommand","_findPositionToInsertParagraph","paragraphLikeElements","HeadingCommand","modelElements","heading","checkCanBecomeHeading","defaultModelElement","HeadingEditing","_addDefaultH1Conversion","afterInit","enterCommand","HeadingUI","localizedTitles","getLocalizedOptions","defaultTitle","accessibleLabel","titles","itemDefinitions","headingCommand","paragraphCommand","commandValue","areEnabled","whichModel","ImageTextAlternativeCommand","getClosestSelectedImageElement","imageUtils","imageElement","createBlockImageViewElement","getImgViewElementMatcher","matchImageType","areBothImagePluginsLoaded","isInlineImageView","isBlockImageView","getPositiveMatchPattern","determineImageTypeForInsertionAtSelection","getSizeValueIfInPx","widthAndHeightStylesAreBothSet","heightStyle","IMAGE_WIDGETS_CLASSES_MATCH_REGEXP","ImageUtils","isImage","isInlineImage","isBlockImage","insertImage","imageType","determinedImageType","determineImageTypeForInsertion","setImageSizes","setImageNaturalSizeAttributes","img","Image","naturalWidth","naturalHeight","getClosestSelectedImageWidget","isImageWidget","getImageWidgetFromImageView","imageView","isImageAllowed","getInsertImageParent","isImageAllowedInParent","isNotInsideImage","toImageWidget","altText","findViewImgElement","figureView","configImageInsertType","ImageTextAlternativeEditing","CssTransitionDisablerMixin","disableCssTransitions","_isCssTransitionsDisabled","enableCssTransitions","initializeCssTransitionDisablerMixin","FormRowView","_role","_ariaLabelledBy","submitHandler","LabeledFieldView","fieldView","statusView","fieldWrapperChildren","viewUid","statusUid","_createLabelView","_createStatusView","errorText","infoText","InputBase","readonly","_updateIsEmpty","_setDomElementValue","InputView","inputmode","InputTextView","InputNumberView","createLabeledInputText","labeledFieldView","inputView","ariaDescribedById","createLabeledInputNumber","inputMode","createLabeledDropdown","TextAlternativeFormView","labeledInput","backButtonView","saveButtonView","_createBackButton","_createSaveButton","_createLabeledInputView","_createHeaderView","backButton","saveButton","header","ImageTextAlternativeUI","_form","_showForm","_createForm","_hideForm","_isInBalloon","focusEditable","ImageTextAlternative","downcastSrcsetAttribute","downcastImageAttribute","ImageLoadObserver","_fireEvents","InsertImageCommand","sourceDefinitions","sourceDefinition","breakBlock","ReplaceImageSourceCommand","cleanupImage","ImageEditing","insertImageCommand","replaceImageSourceCommand","ImageSizeAttributes","_registerSchema","_registerConverters","attachDowncastConverter","modelAttributeName","viewAttributeName","setRatioForInlineImage","isEditingDowncast","hasSizes","isResized","ImageTypeCommand","_modelElementName","modelElementName","uploadId","newElementRange","ImagePlaceholder","_setupSchema","_setupConversion","_setupLoadListener","imgViewElement","ImageBlockEditing","_setupClipboardIntegration","viewImage","modelImage","upcastImageFigure","docFragmentChildren","blockViewImages","inlineViewImage","CollapsibleView","childViews","hidden","_collapsibleAriaLabelUid","ImageInsertFormView","integrations","ImageInsertUI","_integrations","isImageSelected","componentCreator","_createToolbarComponent","_createMenuBarComponent","registerIntegration","buttonViewCreator","formViewCreator","menuBarButtonViewCreator","requiresForm","override","_prepareIntegrations","dropdownButton","firstIntegration","integrationViews","imageInsertFormView","resultView","integrationView","ImageBlock","ImageInlineEditing","createInlineImageViewElement","inlineViewImages","blockViewImage","ImageInline","ToggleImageCaptionCommand","imageCaptionUtils","ancestorCaptionElement","getCaptionFromModelSelection","getCaptionFromImageModelElement","focusCaptionOnShow","_hideImageCaption","_showImageCaption","imageCaptionEditing","selectedImage","savedCaption","_getSavedCaption","newCaptionElement","captionElement","_saveCaption","ImageCaptionUtils","imageModelElement","matchImageCaptionViewElement","ImageCaptionEditing","_savedCaptionsMap","_setupImageTypeCommandsIntegration","_registerCaptionReconversion","figcaptionElement","imageAlt","imageTypeInlineCommand","imageTypeBlockCommand","handleImageTypeChange","oldCaptionElement","savedOldElementCaption","jsonObject","caption","ImageCaptionUI","modelCaptionElement","ImageStyleCommand","_defaultStyles","imageBlock","imageInline","isDefault","requestedStyle","shouldConvertImageType","DEFAULT_OPTIONS","inline","alignBlockLeft","alignCenter","alignRight","alignBlockRight","DEFAULT_ICONS","full","center","inlineLeft","inlineRight","DEFAULT_DROPDOWN_DEFINITIONS","defaultItem","warnInvalidStyle","utils","normalizeStyles","configuredStyles","arrangement","normalizeDefinition","extendedStyle","extendStyle","isBlockPluginLoaded","isInlinePluginLoaded","supportedElements","missingPlugins","isValidOption","getDefaultStylesConfiguration","getDefaultDropdownDefinitions","pluginCollection","getStyleDefinitionByName","ImageStyleEditing","normalizedStyles","_setupPostFixer","modelToViewConverter","newStyle","oldStyle","viewToModelConverter","nonDefaultStyles","modelImageElement","viewToModelStyleAttribute","imageStyle","imageStyleDefinition","ImageStyleUI","localizedDefaultStylesTitles","definedStyles","translateStyles","styleConfig","definedDropdowns","dropdownConfig","_createDropdown","defaultButton","buttonViews","getUIComponentName","buttonName","splitButtonView","splitButtonViewArrow","getDropdownButtonTitle","areOn","buttonConfig","_executeCommand","dropdownTitle","buttonTitle","AutomaticLinkDecorators","_definitions","getDispatcher","getDispatcherForLinkedImage","viewFigure","linkInImage","ATTRIBUTE_WHITESPACES","EMAIL_REG_EXP","PROTOCOL_REG_EXP","DEFAULT_LINK_PROTOCOLS","LINK_KEYSTROKE","createLinkElement","linkElement","ensureSafeUrl","allowedProtocols","urlString","protocolsList","customRegexp","isSafeUrl","isLinkableElement","addLinkProtocolIfApplicable","link","defaultProtocol","protocol","isProtocolNeeded","linkHasProtocol","extractTextFromLinkRange","LinkCommand","manualDecorators","automaticDecorators","restoreManualDecoratorStates","manualDecorator","_getDecoratorStateFromModel","manualDecoratorIds","displayedText","truthyManualDecorators","falsyManualDecorators","updateLinkAttributes","updateLinkTextIfNeeded","linkHref","linkText","newText","fragRange","oldText","actual","expected","findChanges","insertsLength","updatedOffset","subRange","getLinkPartTextNode","formattingAttributes","newTextNode","collapseSelectionAtLinkEnd","linkRange","newLinkRange","allowedRanges","rangesToUpdate","_isRangeToUpdate","stickyPseudoRanges","pseudoRange","decoratorName","allowedRange","UnlinkCommand","linkCommand","rangesToUnlink","LinkManualDecorator","_createPattern","DECORATOR_AUTOMATIC","EXTERNAL_LINKS_REGEXP","LinkEditing","_linkOpeners","allowCreatingEmptyLinks","addTargetToExternalLinks","linkDecorators","decorators","localizedDecoratorsLabels","decorator","getLocalizedDecorators","retArray","str","upperFirst","normalizeDecorators","_enableAutomaticDecorators","mode","_enableManualDecorators","_enableLinkOpen","_enableSelectionAttributesFixer","_enableClipboardIntegration","_registerLinkOpener","linkOpener","automaticDecoratorDefinitions","rel","manualDecoratorDefinitions","decoratorDefinition","manualDecoratorValue","handleLinkOpening","opener","clickedElement","linkAttributes","removeLinkAttributesFromSelection","newLink","LinkPreviewButtonView","LinkFormView","displayedTextInputView","urlInputView","providersListChildren","_validators","validators","_createDisplayedTextInput","_createUrlInput","_createFormChildren","_createProvidersListView","resetFormStatus","validator","providersListView","LinkProviderItemsView","listChildren","emptyListInformation","_createListView","_createEmptyLinksListItemView","hasItems","propName","LinkPropertiesView","LinkButtonView","VISUAL_SELECTION_MARKER_NAME","LinkUI","formView","linkProviderItemsView","propertiesView","_linksProviders","_registerComponents","_registerEditingOpeners","_enableBalloonActivators","registerLinksListProvider","provider","existing","order","_createViews","_createToolbarView","_createFormView","_createPropertiesView","_enableUserBalloonInteractions","toolbarItems","_hideUI","_addFormView","_getSelectedLinkElement","_showUI","getFormValidators","parsedUrl","_getDecoratorSwitchesState","selectedLinkableText","_closeFormView","_createLinksListProviderButton","_createLinkProviderListView","getListItems","_removeLinksProviderView","_createLinkProviderItemsView","emptyListPlaceholder","_removePropertiesView","decoratorValue","accumulator","_getLinkProviderLinkByHref","navigate","setHref","selectedLinksProviderLink","unlinkCommand","_addPropertiesView","linkProvider","linksButton","_showLinksProviderView","_isUIVisible","_isUIInPanel","_addToolbarView","_isToolbarInPanel","_getBalloonPositionData","_isFormInPanel","_getSelectedLinkableText","_arePropertiesInPanel","_addLinkProviderItemsView","_removeFormView","_isLinksListInPanel","updateFocus","_hideFakeVisualSelection","_showFakeVisualSelection","_startUpdatingUI","prevSelectedLink","prevSelectionParent","getSelectionParent","selectedLink","_isPropertiesVisible","_isFormVisible","markerViewElements","markerViewElementsArray","targetLink","findLinkElementAncestor","startLink","endLink","viewLinkRange","isLinkElement","URL_REG_EXP","AutoLink","_enableTypingHandling","_enableEnterHandling","_enableShiftEnterHandling","_enablePasteLinking","_expandLinkRange","_selectEntireLinks","selectedRange","selStart","selEnd","updatedSelection","watcher","mappedText","isSingleSpaceAtTheEnd","getUrlAtTextEnd","removedTrailingCharacters","linkEnd","linkStart","_applyAutoLink","_checkAndApplyAutoLinkOnRange","shiftEnterCommand","fullUrl","isLinkAllowedOnRange","linkIsAlreadySet","_persistAutoLink","deletePlugin","ListWalker","_startElement","_referenceIndent","_isForward","_includeSelf","_sameAttributes","_sameIndent","_lowerIndent","_higherIndent","sameAttributes","sameIndent","lowerIndent","higherIndent","nestedItems","SiblingListBlocksIterator","_getStartNode","indent","_node","_previousNodesByIndent","_previousNodeIndent","isListItemBlock","nodeIndent","previousNodeInList","previousNodeIndent","ListBlocksIterable","_listHead","listHead","ListItemUid","getAllListItemBlocks","getListItemBlocks","backwardBlocks","forwardBlocks","isFirstBlockOfListItem","listBlock","isLastBlockOfListItem","expandListBlocksToCompleteItems","withNested","allBlocks","itemBlock","sortBlocks","expandListBlocksToCompleteList","splitListItemBefore","mergeListItemBefore","indentBlocks","indentBy","blockIndent","removeListAttributes","isSingleListItem","firstItemId","getSelectedBlockObject","canBecomeSimpleListItem","isNumberedListType","listType","mergeListItemIfNotLast","ListIndentCommand","_direction","indentDirection","getSelectedListBlocks","changedBlocks","referenceIndent","parentBlocks","mergedBlocks","mergedBlock","outdentBlocksWithMerge","previousItemBlock","_fireAfterExecute","siblingItem","firstNonListBlockIndex","ListCommand","_listWalkerOptions","multiLevel","selectedBlockObject","turnOff","lastBlock","itemBlocks","currentIndent","newIndent","outdentFollowingItems","additionalAttributes","listIndent","listItemId","ListMergeCommand","shouldMergeOnBlocksContentLevel","_getMergeSubjectElements","firstIndent","lastIndent","lastElementId","nestedLastElementBlocks","sel","lastElementAfterDelete","siblingNode","isFirstBlock","ListSplitCommand","_getStartBlock","ListItemBoldIntegration","ListEditing","ListFormatting","listEditing","registerFormatAttribute","registerDowncastStrategy","scope","setAttributeOnDowncast","dataPipeline","ListItemItalicIntegration","FontCommand","updateAttribute","ColorTileView","addKeyboardHandlingForGrid","gridItems","numberOfColumns","getNumberOfColumns","getGridItemFocuser","getIndexToFocus","focusedElementIndex","nextIndexToFocus","getRightElementIndex","elementIndex","getLeftElementIndex","ColorGridView","columns","colorDefinitions","viewStyleAttribute","gridTemplateColumns","colorTile","selectedColor","hasBorder","DocumentColorCollection","hasColor","ColorGridsFragmentView","documentColors","documentColorsCount","staticColorsGrid","documentColorsGrid","colorPickerButtonView","removeColorButtonView","_documentColorsLabel","_removeButtonLabel","_colorPickerLabel","colors","removeButtonLabel","documentColorsLabel","colorPickerLabel","_createRemoveColorButton","updateDocumentColors","maxCount","_addColorToDocumentColors","updateSelectedColors","_createStaticColorsGrid","_createDocumentColorsGrid","_createColorPickerButton","_addColorSelectorElementsToFocusTracker","addColorPickerButton","colorGrid","colorObj","predefinedColor","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","freeze","cstr","alpha","dims","baseHues","PI","reverseKeywords","rgb","channels","labels","hsl","hsv","hwb","cmyk","xyz","lab","oklab","lch","oklch","hex","keyword","ansi16","ansi256","hcg","apple","LAB_FT","srgbNonlinearTransform","cc","srgbNonlinearTransformInv","wrapConversion","graph","conversions","g","h","rdif","gdif","bdif","diffc","lp","cbrt","mp","sp","reversed","currentClosestKeyword","currentClosestDistance","distance","z","t3","smin","lmin","hi","f","q","vmin","sl","wh","bl","ratio","ll","aa","bb","x2","z2","atan2","sqrt","hr","cos","sin","saturation","ansi","mult","trunc","rem","colorString","integer","chroma","hue","pure","mg","fromModel","models","buildGraph","queue","adjacents","adjacent","deriveBFS","wrapRaw","wrappedFn","arg0","wrapRounded","routes","routeModels","raw","convertColor","outputFormat","colorObject","parseColorString","parsedColor","toColorSpace","formatColorOutput","hexValue","parsedHex","clamp","digits","pow","hexToRgba","hsvaToHslString","hsva","hh","hsvaToHsla","equalColorObjects","second","tpl","dispatchEvent","CustomEvent","bubbles","hasTouched","isTouch","pointerMove","pointer","getMove","pageXOffset","pageYOffset","Slider","aria","xy","cloneNode","dragging","toggleEvent","handleEvent","keyMove","Hue","Saturation","$isSame","$color","$hsva","$update","$parts","$css","$sliders","ColorPicker","observedAttributes","newColor","newHsva","colorModel","toHsva","attachShadow","slider","connectedCallback","defaultColor","attributeChangedCallback","_attr","_oldVal","newVal","fromAttr","oldHsva","fromHsva","rgbaToHsva","alphaHex","rgbaToHex","hsvaToRgba","HexBase","ColorPickerView","hexInputRow","_debounceColorPickerEvent","_hexColor","_createInputRow","hideInput","convertColorToCommonHexFormat","picker","customElements","_createSlidersView","styleSheetForFocusedColorPicker","shadowRoot","slidersView","SliderView","colorInput","_createColorInput","ColorPickerInputRowView","pickerColor","inputValue","maybeHexColor","tryParseHexColor","resetValidationStatus","getParsedColor","inputColor","convertToHex","HashView","hashLessColor","ColorPickerFragmentView","colorPickerView","cancelButtonView","actionBarView","_colorPickerViewConfig","colorPickerViewConfig","_createActionButtons","_createActionBarView","_addColorPickersElementsToFocusTracker","_stopPropagationOnArrowsKeys","_executeOnEnterPress","_executeUponColorChange","actionBarRow","ColorSelectorView","colorGridsFragmentView","colorPickerFragmentView","appendUI","_appendColorGridsFragment","_appendColorPickerFragment","showColorPickerFragment","_isColorPickerFragmentVisible","_isColorGridsFragmentVisible","showColorGridsFragment","FONT_SIZE","FONT_FAMILY","FONT_COLOR","FONT_BACKGROUND_COLOR","buildDefinition","modelAttributeKey","renderUpcastAttribute","styleAttr","renderDowncastElement","FontFamilyCommand","normalizeOptions","configuredOptions","getOptionDefinition","normalizeFontFamilies","fontDefinition","fontNames","firstFontName","cssFontNames","normalizeFontNameForCSS","generateFontPreset","fontName","FontFamilyEditing","supportAllValues","_prepareAnyValueConverters","_prepareCompatibilityConverter","FontFamilyUI","_getLocalizedOptions","listOptions","commandParam","_prepareListOptions","FontFamily","FontSizeCommand","attachPriority","preset","namedPresets","findPreset","numberValue","isNumericalDefinition","generatePixelPreset","tiny","small","big","huge","styleFontSize","FontSizeEditing","presets","isRelative","maxSize","clampedSize","FontSizeUI","Default","Tiny","Small","Big","Huge","FontSize","normalizeSizeOptions","FontColorCommand","FontColorEditing","getLocalizedColorOptions","localizedColorNames","Black","Grey","White","Red","Orange","Yellow","Green","Aquamarine","Turquoise","Blue","Purple","colorOption","normalizeColorOptions","normalizeSingleColorDefinition","FontColorUIBase","dropdownLabel","componentConfig","localizedColors","hasColorPicker","colorPicker","dropdownContentRendered","colorSelectorView","addColorSelectorToDropdown","_undoStepBatch","contentRendered","FontColorUI","FontColor","FontBackgroundColorCommand","FontBackgroundColorEditing","FontBackgroundColorUI","FontBackgroundColor","ListItemFontSizeIntegration","normalizedFontSizeOptions","fontSizeOption","fontSizeOptions","ListItemFontColorIntegration","ListItemFontFamilyIntegration","_loadedFormatting","_registerPostfixerForListItemFormatting","modifiedListItems","returnValue","_isInlineOrSelectionFormatting","formats","getListItemConsistentFormat","formatAttributeName","formatValue","listItemFormatAttributeName","setFormattingToListItem","removeFormattingFromListItem","formatAttribute","listItemFormatAttribute","getSingleListItemConsistentFormat","isNumberedOrBulletedList","attributesToCheck","valuesMap","listItemBlocks","wasChanged","ListUtils","isListView","isListItemView","createListElement","getViewElementIdForListType","getViewElementNameForListType","createListItemElement","findAndAddListHeadToMap","itemToListHead","listItemDowncastConverter","attributeNames","strategies","nonConsumingAttributes","strategy","createAttributesConsumer","viewWalker","findMappedViewElement","removeCustomMarkerElements","unwrapListItemBlock","canInjectMarkerIntoElement","createWrapperElement","canWrapElement","insertCustomMarkerElements","listItemIndent","currentListItem","listItemViewElement","listViewElement","wrapListItemBlock","bogusParagraphCreator","shouldUseBogusParagraph","markersToRemove","collectMarkersToRemove","LIST_BASE_ATTRIBUTES","_downcastStrategies","multiBlock","conflictPlugin","copyOnReplace","_setupDeleteIntegration","_setupEnterIntegration","_setupTabIntegration","_setupAccessibilityIntegration","_setupListItemIdConversionStrategy","outdent","_setupModelPostFixing","getListAttributeNames","mergeBackwardCommand","mergeForwardCommand","isLastBlock","splitCommand","getIndent","firstItemListType","modelToViewPositionMapper","positionAfterLastMarker","itemsToRefresh","changedItems","doesItemBlockRequiresRefresh","collectListItemsToRefresh","itemIndent","modelAttributes","doesItemWrappingRequiresRefresh","isItemBlockInsideStructureSlot","useBogus","isListItemElement","isListElement","modelReferenceElement","reconvertItemsOnDataChange","applied","innerItem","seenIds","listNodes","modelChangePostFixer","maxIndent","prevIndent","fixBy","fixListIndents","fixListItemIds","refItem","refType","refIndent","firstElementIndent","indentDiff","isListItem","createModelIndentPasteFixer","allContentChildren","lastItem","allChildren","skipListItemIds","createUIComponents","ListUI","ResizeImageCommand","ImageResizeEditing","resizeUnit","resizeOptions","resizeImageCommand","viewImg","RESIZE_ICONS","medium","large","custom","original","ImageResizeButtons","_resizeUnit","_registerImageResizeButton","_registerImageResizeDropdown","labelText","_getOptionLabelValue","isCustomImageResizeOption","customResizeUI","optionValueWithUnit","getIsOnButtonCallback","originalSizeOption","_getResizeDropdownListItemDefinitions","onClick","forTooltip","optionsWithSerializedValues","valueWithUnits","allDropdownValues","getIsOnCustomButtonCallback","dropdownValue","RESIZED_IMAGE_CLASS","ImageResizeHandles","_setupResizerCreator","widgetView","imageModel","domWidgetElement","tryParseDimensionWithUnit","dimension","rawValue","parsedValue","tryCastDimensionsToUnit","parentDimensionPx","targetUnit","getSelectedImageEditorNodes","imageViewElement","dom","ImageCustomResizeFormView","rawSize","parsedSize","sizeWithUnits","ImageCustomResizeUI","currentParsedWidth","imageNodes","parsedResizedWidth","getSelectedImageWidthInUnits","initialInputValue","toFixed","possibleRange","imageParentWidthPx","minimumImageWidth","lower","upper","getSelectedImagePossibleResizeRange","ceil","supportedOptions","alignment","normalizeAlignmentOptions","normalizedOptions","isNameValid","classNameCount","allOptions","succeedingOptions","ALIGNMENT","AlignmentCommand","_canBeAligned","currentAlignment","removeAlignmentFromSelection","setAlignmentOnSelection","AlignmentEditing","optionsToConvert","shouldUseClasses","buildClassDefinition","buildDowncastInlineDefinition","upcastInlineDefinitions","buildUpcastInlineDefinitions","upcastCompatibilityDefinitions","buildUpcastCompatibilityDefinitions","iconsMap","AlignmentUI","localizedOptionTitles","_addButton","_addToolbarDropdown","_addMenuBarMenu","buttonAttrs","defaultIcon","convertCssLengthToPx","numericValue","isPx","isListContinuation","currentItem","isList","detectListStyle","listLikeItem","listStyleRegexp","listStyleTypeRegex","listStartIndexRegex","legalStyleListRegex","multiLevelNumberFormatTypeRegex","legalStyleListMatch","multiLevelNumberFormatMatch","islegalStyleList","listStyleMatch","listStyleType","listStyleTypeMatch","bulletedStyle","listMarkerElement","textNodeOrElement","findListMarkerNode","listMarker","findBulletedListStyle","listStartIndexMatch","mapListStyleDefinition","isLegalStyleList","createNewEmptyList","listStyle","hasMultiLevelListPlugin","getListItemData","idMatch","orderMatch","indentMatch","removeBulletElement","bulletMatcher","getMarginLeftNormalized","removeInvalidTableWidth","removeMSReferences","elementsToRemove","textNodesToTrim","trimmedData","createFootnoteRefViewElement","footnoteId","sup","createFootnoteDefViewElement","backLink","msWordMatch1","msWordMatch2","PasteFromOfficeMSWordNormalizer","hasTablePropertiesPlugin","hasExtendedTableBlockAlignment","htmlString","_parsedData","elementsToChange","transformBookmarks","itemLikeElements","foundMargins","itemData","findAllItemLikeElements","encounteredLists","itemLikeElement","originalListId","listElement","parentListItems","listItemElements","stackItem","transformListItemLikeElementsIntoLists","rtfData","upcastWriter","shapesIds","shapeElementsMatcher","prevSiblingName","exceptionIds","isElementAShape","hasElementGfxdataAttribute","isPreviousSiblingAShapeType","isElementIdInExceptionsArray","findAllShapesIds","imageElementsMatcher","imgs","shapes","shape","removeAllImgElementsRepresentingShapes","shapeIds","containsMatchingImg","findSrc","insertMissingImgs","removeAllShapeElements","images","currentImageIndex","imageIndex","findAllImageElementsWithLocalSource","imageElements","imagesHexSources","rtfHexSource","newSrc","hexString","btoa","replaceImagesFileSourceWithInlineRepresentation","regexPictureHeader","regexPicture","extractImageDataFromRtf","replaceImagesSourceWithBase64","directParent","grandParent","divParent","sides","transformTables","msFootnotesRefs","msFootnotesDefs","msFootnotesDefinitionsList","msFootnoteDef","msFootnoteDefId","msFootnoteRefId","footnotesDefinitionsList","createFootnotesListViewElement","msFootnoteRef","defElements","clonedChild","replaceMSFootnotes","elementsToUnwrap","removeMSAttributes","findSibling","isBlockViewElement","hasPreWrapParent","whiteSpace","replaceTabsInTextNode","tabWidth","replacedData","replaceAll","googleDocsMatch","GoogleDocsNormalizer","removeBoldWrapper","unwrapParagraphInListItem","elementsToReplace","nextSiblingIsBlock","transformBlockBrsToParagraphs","textNodesToReplace","replaceTabsWithinPreWithSpaces","googleSheetsMatch","GoogleSheetsNormalizer","removeGoogleSheetsTag","removeXmlns","removeStyleBlock","normalizeSafariSpaceSpans","modelToViewUrlAttributeConverter","registry","figure","mediaContentElement","mediaViewElement","getMediaViewElement","createMediaFigureElement","getSelectedMediaModelWidget","insertMedia","mediaElement","MediaEmbedCommand","selectedMedia","isMediaSelected","isAllowedInParent","MediaRegistry","providerDefinitions","providers","extraProviders","removedProviders","removeProviders","hasMedia","_getMedia","getViewElement","Media","previewRenderer","subPattern","_getUrlMatches","rawUrl","_locale","_match","_previewRenderer","_getValidUrl","renderForEditingView","renderMediaPreview","mediaHtml","_getPreviewHtml","_getPlaceholderHtml","outerHTML","MediaEmbedEditing","time","toMediaWidget","viewMedia","URL_REGEXP","AutoMediaEmbed","_timeoutId","_positionToInsert","leftLivePosition","rightLivePosition","_embedMediaBetweenPositions","leftPosition","rightPosition","mediaRegistry","urlRange","MediaFormView","_urlInputViewInfoDefault","_urlInputViewInfoTip","inputField","mediaURLInputValue","MediaEmbedUI","_formView","_createDialogButton","_showDialog","_handleSubmitForm","REMOVE_FORMAT","RemoveFormatUI","RemoveFormatCommand","_customAttributesHandlers","_getFormattingItems","_getFormattingAttributes","_removeFormatting","registerCustomAttribute","removeFormatting","customHandled","itemHasRemovableFormatting","curRange","RemoveFormatEditing","upcastStyleToAttribute","attributeType","shouldUpcast","reduceBoxSides","localDefaultValue","getDefaultValueAdjusted","reduceBoxSidesValue","upcastBorderStyles","defaultBorder","stylesToConsume","matcherPattern","tableElement","localDefaultBorder","normalizedBorder","reducedBorder","viewTable","downcastAttributeToStyle","downcastTableAttribute","table","layoutTableDefault","topSideStyle","DEFAULT_TABLE_ALIGNMENT_OPTIONS","upcastTableAlignmentConfig","getAlign","align","getConsumables","downcastTableAlignmentConfig","blockLeft","blockRight","updateNumericAttribute","tableCell","isHeadingColumnCell","tableUtils","headingColumns","column","getCellLocation","enableProperty","TableWalker","_table","_startRow","_endRow","_startColumn","_endColumn","_includeAllSlots","_skipRows","_row","_rowIndex","_column","_cellIndex","_spannedCells","_nextCellAtColumn","_jumpedToStartRow","row","startRow","endRow","startColumn","endColumn","includeAllSlots","_canJumpToStartRow","_jumpToNonSpannedRowClosestToStartRow","_isOverEndRow","_isOverEndColumn","_advanceToNextRow","outValue","spanData","_getSpanned","_shouldSkipSlot","_formatOutValue","cell","colspan","rowspan","_recordSpans","skipRow","anchorRow","anchorColumn","TableSlot","rowIsMarkedAsSkipped","rowIsBeforeStartRow","columnIsBeforeStartColumn","columnIsAfterEndColumn","rowMap","rowToUpdate","columnToUpdate","_markSpannedCell","firstRowLength","_getRowLength","rowIndex","cols","cellAnchorRow","cellAnchorColumn","tableWalker","isAnchor","cellWidth","cellHeight","getPositionBefore","cropTableToDimensions","sourceTable","cropDimensions","croppedTable","sourceTableType","cropHeight","tableMap","sourceRow","sourceColumn","rowInCroppedTable","tableCellCopy","trimTableCellIfNeeded","headingRows","addHeadingsToCroppedTable","getVerticallyOverlappingCells","overlapRow","cells","slotInfo","splitHorizontally","splitRow","tableRow","newRowspan","newCellAttributes","newCellRowSpan","columnIndex","newCell","tableSlot","getHorizontallyOverlappingCells","overlapColumn","cellsToSplit","splitVertically","splitColumn","newColspan","newCellColSpan","cellRow","cellColumn","limitRow","limitColumn","removeEmptyColumns","getColumns","columnsMap","emptyColumns","cellsCount","emptyColumn","removeColumns","at","removeEmptyRows","emptyRows","tableRowCount","getRows","emptyRow","removeRows","removeEmptyRowsColumns","adjustLastRowIndex","dimensions","lastRowMap","firstColumn","lastColumn","lastRow","rowspanAdjustment","adjustLastColumnIndex","lastColumnMap","firstRow","colspanAdjustment","getViewTableFromWrapper","wrapperView","wrapperChild","ensureParagraphInTableCell","getSingleValue","objectOrString","addDefaultUnitToNumericValue","defaultUnit","getNormalizedDefaultProperties","borderStyle","borderWidth","borderColor","includeAlignmentProperty","includePaddingProperty","includeVerticalAlignmentProperty","verticalAlignment","includeHorizontalAlignmentProperty","horizontalAlignment","isRightToLeftContent","getNormalizedDefaultTableProperties","getNormalizedDefaultCellProperties","downcastTable","figureElement","additionalSlots","asWidget","toTableWidget","downcastCell","cellElementName","convertParagraphInTableCell","isSingleParagraphWithoutAttributes","convertPlainTable","hasPlainTableOutput","useExtendedAlignment","headRowsSlot","bodyRowsSlot","childrenSlot","theadElement","tbodyElement","tableContentElements","tableAttributes","defaultTableProperties","tableAlignment","tableAlignmentValue","downcastPlainTable","convertPlainTableCaption","InsertTableCommand","validParent","defaultRows","defaultColumns","createTable","InsertRowCommand","isAnyCellSelected","getSelectionAffectedTableCells","insertAbove","affectedTableCells","rowIndexes","getRowIndexes","insertRows","copyStructureFromAbove","InsertColumnCommand","columnIndexes","getColumnIndexes","insertColumns","SplitCellCommand","selectedCells","splitCellHorizontally","splitCellVertically","MergeCellCommand","isHorizontal","cellToMerge","_getMergeableCell","getTableCellsContainingSelection","isMergeNext","cellToExpand","cellToRemove","removedTableCellRow","mergeTableCells","spanAttribute","cellSpan","cellToMergeSpan","horizontalCell","hasHeadingColumns","cellOnLeft","cellOnRight","leftCellColumn","rightCellColumn","leftCellSpan","isCellOnLeftInHeadingColumn","isCellOnRightInHeadingColumn","getHorizontalCell","currentCellRowSpan","rowOfCellToMerge","mergeColumn","cellToMergeData","getVerticalCell","firstTableChild","RemoveRowCommand","firstCell","lastRowIndex","selectedRowIndexes","areAllRowsSelected","referenceCells","removedRowIndexes","columnIndexToFocus","rowsToRemove","rows","cellToFocus","removedRowIndex","columnToFocus","getCellToFocus","RemoveColumnCommand","tableColumnCount","lastCell","getBoundaryCells","removedColumnIndexes","columnsToRemove","SetHeaderRowCommand","_isInHeading","headingRowsToSet","currentHeadingRows","overlappingCells","SetHeaderColumnCommand","headingColumnsToSet","getTableColumnElements","columnGroupElement","getColumnGroupElement","TableUtils","createEmptyRows","rowsToInsert","isCopyStructure","copyStructureFrom","walkerEndRow","tableIterator","rowColSpansMap","lastCellRow","isReferenceRow","cellIndex","columnsToInsert","tableColumns","createCells","rowCount","indexesObject","cellsToMove","cellsToTrim","lastRowOfCell","rowSpanToSet","getCellsToMoveAndTrimOnRemoveRow","targetRowIndex","tableRowMap","previousCell","cellToMove","moveCellsToRow","updateHeadingRows","headingsRemoved","adjustHeadingColumns","removedColumnIndex","adjacentColumn","removedColumnWidth","adjacentColumnWidth","numberOfCells","newCellsSpan","updatedSpan","breakSpanEvenly","newCellsAttributes","cellsToInsert","splitCellColumn","cellsToUpdate","splitCellRow","distanceFromLastCellSpan","isOnSameColumn","rowspanToSet","createTableWalker","getSelectedTableCells","sortRanges","cellWithSelection","tableCells","indexes","_getFirstLastIndexesObject","isSelectionRectangular","selectedTableCells","_areCellInTheSameTableSection","areaOfSelectedCells","areaOfValidSelection","rowsIndexes","getBiggestRectangleArea","compareRangeOrder","allIndexesSorted","indexA","_areIndexesInSameSection","headingSectionSize","tableCellToInsert","MergeCellsCommand","firstTableCell","mergeWidth","mergeHeight","maxWidthOffset","maxHeightOffset","getMaxOffset","firstCellRow","firstCellColumn","getMergeDimensions","cellBeingMerged","targetCell","currentMaxOffset","dimensionValue","SelectRowCommand","rangesToSelect","SelectColumnCommand","startLocation","endLocation","cellInfo","fixTableCellsRowspan","maxRows","rowLimit","findCellsToTrim","fixTableRowsSizes","childrenLengths","lengths","getChildrenLengths","rowsLengths","tableSize","maxColumns","isTableAttributeEntry","fixTable","fixTableRow","fixTableCellContent","textNodes","checkTableCellChange","shouldRefresh","TableEditing","_additionalSlots","conversionResult","modelTable","headRows","bodyRows","firstTheadElement","tableChild","trs","maxPrevColumns","tr","trColumns","bodyMatrix","prevRowspans","slots","curSlots","curRowspans","rowSpan","remaining","rowSlots","generateCellMatrix","scanTable","upcastCellSpan","_addPlainTableOutputConverters","analyzedTables","tableLayoutPostFixer","injectTableLayoutPostFixer","tableCellContentsPostFixer","injectTableCellParagraphPostFixer","isRowChange","expectedElementName","tableHeadingsRefreshHandler","cellsToCheck","paragraphsToRefresh","tableCellRefreshHandler","registerAdditionalSlot","slotHandler","downcastTableBorderAndBackgroundAttributes","_createGridCollection","_highlightGridBoxes","boxView","_createGridButton","boxes","TableUI","isContentLtr","insertTableView","bindIsOn","_prepareDropdown","_prepareMergeSplitButtonDropdown","_fillDropdownWithListOptions","mergeCommandName","mergeCommand","addListOption","TableSelection","_handleDeleteContent","_handleInsertTextEvent","_defineSelectionConverter","_enablePluginDisabling","getSelectionAsFragment","adjustedLastRow","adjustedLastColumn","setCellSelection","anchorCell","cellsToSelect","_getCellsToSelect","getFocusCell","getAnchorCell","highlighted","previouslyHighlighted","clearHighlightedTableCells","lastViewCell","tableCellToSelect","rangeToSelect","endColumnExtraColspan","selectionMap","walkerOptions","flipVertically","flipHorizontally","TableClipboard","_onCopyCut","_listenToContentInsertion","tableSelection","isPaste","_onInsertContent","pastedTable","getTableIfOnlyTableInContent","_replaceSelectedCells","pastedDimensions","selectedTable","shouldExpandSelection","expectedHeight","expectedWidth","tableWidth","tableHeight","expandTableSize","doVerticalSplit","doHorizontalSplit","splitCellsToRectangularSelection","prepareTableForPasting","selectionHeight","selectionWidth","_replaceSelectedCellsWithPasted","pastedWidth","pastedHeight","pastedTableLocationMap","createLocationMap","selectedTableMap","pastedRow","pastedColumn","pastedCell","cellToInsert","newTableCell","_replaceTableSlotCell","areHeadingRowsIntersectingSelection","areHeadingColumnsIntersectingSelection","newCells","contentRange","rangeBefore","rangeAfter","limitColumns","isAffectedBySelection","limitRows","TableKeyboard","_onArrowKey","_handleTabOnSelectedTable","_handleTab","bubblingEventInfo","currentRowIndex","isLastCellInRow","isLastRow","_handleArrowKeys","focusCell","_navigateFromCellInDirection","_isSelectionAtCellEdge","currentCellInfo","cellToSelect","positionToSelect","MouseEventsObserver","TableMouse","_enableShiftClickSelection","_enableMouseDragSelection","blockSelectionChange","_getModelTableCellFromDomEvent","haveSameTableParent","beganCellSelection","newTargetCell","viewTargetElement","cellA","cellB","getSelectionAffectedTableWidget","getSelectedTableWidget","getTableWidgetAncestor","isTableWidget","TablePropertyCommand","_defaultValue","_defaultContentTableValue","_defaultLayoutTableValue","_getValueToSet","TableBackgroundColorCommand","TableBorderColorCommand","TableBorderStyleCommand","TableBorderWidthCommand","TableWidthCommand","TableHeightCommand","TableAlignmentCommand","TablePropertiesEditing","useInlineStyles","enableBorderProperties","isNonTableFigureElement","divAlign","tableAlign","convertToTableAlignment","upcastTableAlignedDiv","enableExtendedAlignmentProperty","enableAlignmentProperty","enableTableToFigureProperty","viewDoc","wrapInDivIfNeeded","alignAttribute","floatAttribute","marginRight","insertWrapperWithAlignment","ColorInputView","_stillTyping","_createDropdownView","_createInputTextView","_setInputValue","colorSelector","_createColorSelector","colorPreview","blur","mappedColor","defaultColorValue","removeColorButtonLabel","colorPickerConfig","backupColor","normalizedInputValue","normalizeColor","getBorderStyleLabels","none","solid","dotted","dashed","double","groove","ridge","inset","outset","getLocalizedColorErrorText","getLocalizedLengthErrorText","colorFieldValidator","lengthFieldValidator","isNumberString","lineWidthFieldValidator","getBorderStyleDefinitions","defaultStyle","styleLabels","_borderStyleValue","fillToolbar","icons","nameToValue","buttonValue","valueToCompare","defaultColors","getLabeledColorInputCreator","colorInputView","colorConfig","TablePropertiesView","borderStyleDropdown","borderWidthInput","borderColorInput","backgroundInput","widthInput","heightInput","alignmentToolbar","borderRowLabel","_createBorderFields","backgroundRowLabel","_createBackgroundFields","operatorLabel","dimensionsLabel","_createDimensionFields","alignmentLabel","_createAlignmentFields","colorInputCreator","borderColors","isBorderStyleSet","backgroundInputCreator","backgroundColors","_alignmentLabels","fieldsThatShouldValidateToSave","errorTexts","BALLOON_POSITIONS","getBalloonCellPositionData","getBalloonTablePositionData","modelTableCell","getTableCellAtPosition","viewTableCell","createBoundingRect","propertyToCommandMap","TablePropertiesUI","_defaultContentTableProperties","_defaultLayoutTableProperties","_viewWithContentTableDefaults","_viewWithLayoutTableDefaults","_isReady","_createTablePropertiesButton","isCommandEnabled","borderColorsConfig","localizedBorderColors","backgroundColorsConfig","localizedBackgroundColors","_hideView","_isViewInBalloon","colorErrorText","lengthErrorText","_getPropertyChangeCallback","_getValidatedPropertyChangeCallback","viewField","_fillViewFormFromCommandValues","borderStyleCommand","propertyKey","useDefaults","_updateView","_isViewVisible","setErrorTextDebounced","TableCellPropertiesView","paddingInput","horizontalAlignmentToolbar","verticalAlignmentToolbar","_createPaddingField","defaultTableCellProperties","ALIGNMENT_ICONS","justify","middle","_horizontalAlignmentLabels","_verticalAlignmentLabels","TableCellPropertiesUI","_defaultContentTableCellProperties","_defaultLayoutTableCellProperties","TableCellPropertyCommand","_getSingleValue","_getAttribute","firstCellValue","TableCellWidthCommand","TableCellPaddingCommand","TableCellHeightCommand","TableCellBackgroundColorCommand","TableCellVerticalAlignmentCommand","TableCellHorizontalAlignmentCommand","TableCellBorderStyleCommand","TableCellBorderColorCommand","TableCellBorderWidthCommand","VALIGN_VALUES_REG_EXP","TableCellPropertiesEditing","enableHorizontalAlignmentProperty","valign","enableVerticalAlignmentProperty","IndentEditing","IndentUI","localizedIndentIcon","localizedOutdentIcon","_defineButton","IndentBlockCommand","_indentBehavior","indentBehavior","_isIndentationChangeAllowed","checkEnabled","blocksToChange","_getBlocksToChange","nextIndent","getNextIndent","IndentUsingOffset","indentAttributeValue","currentOffset","offsetToSet","IndentUsingClasses","indexStep","DEFAULT_ELEMENTS","HighlightCommand","highlighter","isSameHighlight","highlightStart","highlightEnd","highlightRange","HighlightEditing","_buildDefinition","HighlightUI","_addHighlighterButton","_addRemoveHighlightButton","_addDropdown","_addMenuBarButton","getIconForType","decorateButton","localized","startingHighlighter","optionsMap","retVal","getActiveOption","whichHighlighter","lastExecuted","bindToolbarIconStyleToActiveColor","CheckTodoListCommand","selectedElements","_getSelectedItems","TodoCheckboxChangeObserver","viewTarget","ITEM_TOGGLE_KEYSTROKE","TodoListEditing","elementUpcastConsumingConverter","attributeUpcastConsumingConverter","isDescriptionBlock","checked","disabled","contenteditable","isFirstTodoModelParagraphBlock","isFirstTodoModelItemBlock","hasViewItemMarker","previousHasAttribute","nodeHasAttribute","viewPositionAfter","_handleCheckmarkChange","newRangeParent","jumpOverCheckmarkOnSideArrowKeyPress","isStartOfListItem","isStartOfListLabel","isLabelElement","isInInputWrapper","_initAriaAnnouncements","previousSelectionRanges","lastFocusedCodeBlock","focusParent","lastElementIsTodoList","isTodoListItemElement","currentElementIsTodoList","listAttributeNames","hasOnlyListAttributes","TodoListUI","getNormalizedAndLocalizedLanguageDefinitions","languageDefs","getPropertyAssociation","association","getLeadingWhiteSpaces","getIndentOutdentPositions","isModelSelectionInCodeBlock","canBeCodeBlock","getCodeBlockAriaAnnouncement","languagesToLabels","codeBlockLanguage","getTextNodeAtLineStart","nodeAtStart","CodeBlockCommand","_lastLanguage","firstLanguageInConfig","lastLanguage","defaultLanguage","usePreviousLanguageChoice","getLanguage","_applyCodeBlock","_removeCodeBlock","allowedBlocks","currentBlock","codeBlocks","IndentCodeBlockCommand","_indentSequence","indentSequenceTextElement","OutdentCodeBlockCommand","getLastOutdentableSequenceRange","nodeAtPosition","leadingWhiteSpaces","lastIndexOfSequence","modelToViewCodeBlockInsertion","useLabels","languagesToClasses","preAttributes","spellcheck","codeAttributes","pre","DEFAULT_ELEMENT","CodeBlockEditing","languages","indentSequence","normalizedLanguagesDefs","modelToDataViewSoftBreakInsertion","classesToLanguages","defaultLanguageName","viewCodeElement","viewPreElement","codeBlock","viewChildClasses","dataViewToModelCodeBlockInsertion","textLines","lastLine","softBreak","preElement","preChildren","childCodeElement","insertionRange","lineIndex","rawSnippetTextToViewDocumentFragment","docFragment","newDocumentFragment","isSoftEnter","modelDoc","lastSelectionPosition","isSoftBreakNode","newBlock","leaveBlockStartOnEnter","emptyLineRangeToRemoveOnEnter","isEmptyishTextNode","leaveBlockEndOnEnter","breakLineOnEnter","CodeBlockUI","normalizedLanguageDefs","_getLanguageListItemDefinitions","_codeBlockLanguage","languageDef","ListStartCommand","LIST_STYLE_TO_LIST_TYPE","LIST_STYLE_TO_TYPE_ATTRIBUTE","TYPE_ATTRIBUTE_TO_LIST_STYLE","LIST_STYLE_TYPES","typeAttribute","getAllSupportedStyleTypes","getListTypeFromListStyleType","getListStyleTypeFromTypeAttribute","getTypeAttributeFromListStyleType","ListStyleCommand","defaultType","_supportedTypes","supportedTypes","_tryToConvertItemsToList","isStyleTypeSupported","numberedList","bulletedList","ListReversedCommand","listPropertiesUpcastConverter","viewConsumables","appliesToListItem","getAttributeOnUpcast","ListPropertiesUtils","getNormalizedConfig","getNormalizedStylesConfig","listTypes","useAttribute","listStyleTypes","DEFAULT_LIST_TYPE","ListPropertiesEditing","enabledProperties","addCommand","styleType","hasValidAttribute","listParent","normalizeListStyle","listReversed","listStart","startAttributeValue","createAttributeStrategies","ListPropertiesView","stylesView","additionalPropertiesCollapsibleView","startIndexFieldView","reversedSwitchButtonView","styleButtonViews","styleGridAriaLabel","elementCssClasses","_createStylesView","_addNumberedListPropertyViews","getPropertyValue","styleButtons","numberedPropertyViews","_createStartIndexField","_createReversedSwitchButton","inputElement","valueAsNumber","checkValidity","reversedButtonView","ListPropertiesUI","propertiesConfig","stylesListTypes","styleDefinitions","buttonLabel","getDropdownViewCreator","parentCommandName","buttonIcon","getMenuBarStylesMenuCreator","parentCommand","mainButtonView","listPropertiesView","listStyleCommand","styleButtonCreator","getStyleButtonCreator","configuredListStylesTypes","filteredDefinitions","allowedTypes","getStyleTypeSupportChecker","listStartCommand","listReversedCommand","isReversed","createListPropertiesView","listCommand","styleDefinition","COMMAND_FORCE_DISABLE_ID","formatSource","isHtml","elementsToFormat","isVoid","elementNamesToFormat","lines","isPreformattedLine","isPreviousLinePreFormatted","isPreOpen","isPreClose","isPreformattedBlockLine","isNonVoidOpeningTag","isClosingTag","trimEnd","formatHtml","CASE_SPLIT_PATTERN","updateViewAttributes","oldViewAttributes","newViewAttributes","viewAttributes","removeViewAttributes","setViewAttributes","modifyGhsAttribute","ghsAttributeName","getHtmlAttributeName","words$1","words","normalizeForCase","word","startCase","viewToModelObjectConverter","modelName","htmlContent","toObjectWidgetConverter","widgetLabel","createObjectView","emptyInlineModelElementToViewConverter","attributeToViewInlineConverter","viewToModelBlockAttributeConverter","dataFilter","processViewAttributes","modelToViewBlockAttributeConverter","modelSchema","paragraphLikeModel","appliesToBlock","coupledAttribute","DataSchema","registerBlockElement","registerInlineElement","extendBlockElement","_extendDefinition","extendInlineElement","getDefinitionsForView","includeReferences","_getMatchingViewDefinitions","reference","_getReferences","getDefinitionsForModel","testViewName","inheritProperties","referenceName","currentDefinitions","currentDefinition","DataFilter","_dataSchema","_allowedAttributes","_disallowedAttributes","_allowedElements","_disallowedElements","_dataInitialized","_coupledAttributes","_registerElementsAfterInit","_registerElementHandlers","_registerCoupledAttributesPostFixer","_registerAssociatedHtmlAttributesPostFixer","loadAllowedConfig","rules","splitRules","allowElement","loadDisallowedConfig","disallowElement","loadAllowedEmptyElementsConfig","allowEmptyElement","_addAllowedElement","allowEmpty","matchAndConsumeAttributes","getReducedStyles","prepareGHSAttribute","relatedDefinition","_fireRegisterEvent","_registerObjectElement","_registerBlockElement","_registerInlineElement","coupledAttributes","_getCoupledAttributesMap","removeAttributes","coupledAttributeKeys","coupledAttributeKey","attributesToAdd","mergeViewElementAttributes","viewToAttributeInlineConverter","hasHtmlAttributes","insertedElement","sortedRelatedStyles","relatedStyle","attributesObject","splitPattern","CodeBlockElementSupport","preserveElementAttributes","viewToModelCodeBlockAttributeConverter","DualContentModelElementSupport","blockDefinition","paragraphLikeModelDefinition","_hasBlockContent","_addAttributeConversion","HeadingElementSupport","registerHeadingElements","dataSchema","headerModels","getDescendantElement","ImageElementSupport","viewFigureElement","viewToModelFigureAttributeConverter","viewImageElement","viewToModelImageAttributeConverter","addBlockAttributeConversion","viewLink","viewToModelLinkImageAttributeConverter","MediaEmbedElementSupport","mediaElementName","viewToModelFigureAttributesConverter","upcastMedia","viewToModelMediaAttributesConverter","addAttributeConversionDispatcherHandler","modelToViewMediaAttributeConverter","ScriptElementSupport","STYLE_ATTRIBUTES_TO_PROPAGATE","TableElementSupport","viewTableElement","viewToModelTableAttributeConverter","splitAttributesForFigureAndTable","figureAttributes","hasTHeadAttributes","hasTBodyAttributes","createHeadingRowsPostFixer","StyleElementSupport","ListElementSupport","listUtils","viewElements","viewToModelListAttributeConverter","getAttributeFromListType","indentList","HorizontalLineElementSupport","CustomElementSupport","preLikeElements","isValidElementName","htmlElementName","htmlAttributes","getItemsToUpdateGhsAttribute","getValidRangesForSelectable","createImageTypeRegExp","regExpSafeNames","getImageMimeType","blob","ImageUploadUI","_createToolbarButton","_createMenuBarButton","_createDropdownButton","isOnly","imageTypes","imageTypesRegExp","acceptedType","allowMultipleFiles","imagesToUpload","imageInsertUI","uploadImageCommand","isAccessAllowed","ImageUploadProgress","uploadStatusChange","fileRepository","_startAppearEffect","_showPlaceholder","_hidePlaceholder","progressBar","_createProgressBar","_showProgressBar","_displayLocalImage","completeIcon","_showCompleteIcon","_removeUIElement","_hideProgressBar","_stopAppearEffect","_getUIElement","_createPlaceholder","imageFigure","uniqueProperty","Notification","alert","showSuccess","_showNotification","showInfo","showWarning","UploadImageCommand","_uploadImage","ImageUploadEditing","_uploadImageElements","_uploadedImages","notification","fetchableImages","isLocalImage","imageSrc","resource","mimeType","canvas","drawImage","toBlob","getBlobFromCanvas","convertLocalImageOnCanvas","fetchableImage","insertedImagesIds","isInsertedInGraveyard","getImagesFromChangeItem","uploadStatus","_readAndUpload","_parseAndSetSrcsetAttributeOnImage","imageUploadElements","domFigure","originalDisplay","_ckHack","clean","srcsetAttribute","srcset","ImageUpload","ImageInsertUrlView","_createUrlInputView","imageURLInputValue","ImageInsertViaUrlUI","_imageInsertUI","_createInsertUrlButton","_showModal","_createInsertUrlView","imageInsertUrlView","_handleSave","ImageInsertViaUrl","isTable","getCaptionFromTableModelElement","tableModelElement","matchTableCaptionViewElement","ToggleTableCaptionCommand","_hideTableCaption","_showTableCaption","tableCaptionEditing","TableCaptionEditing","useCaptionElement","captionsToMerge","firstCaption","tableCaptionPostFixer","TableCaptionUI","modelElementToPlainText","childText","BRACKET_PAIRS","MentionCommand","mentionData","mention","mentionID","mentionText","_addMentionAttributes","_text","currentAttributes","attributesWithMention","isFollowedByWhiteSpace","isInsertedInBrackets","precedingCharacter","isPrecededByOpeningBracket","isFollowedByBracketClosure","MentionEditing","_toMentionAttribute","createViewMentionElement","preventPartialMentionDowncast","nodeAfterInsertedTextNode","checkAndFix","insertedNode","nodeAfterInserted","removePartialMentionPostFixer","isBrokenMentionNode","extendAttributeOnMentionPostFixer","shouldNotTypeWithMentionAt","selectionMentionAttributePostFixer","baseMentionData","viewElementOrMention","dataMention","MentionsView","selected","selectFirst","selectNext","selectPrevious","indexToGet","highlight","_isItemVisibleInScrolledArea","executeSelected","MentionDomWrapperView","MentionListItemView","defaultHandledKeyCodes","defaultCommitKeyCodes","MentionUI","_mentionsView","_mentionsConfigurations","_lastRequested","_requestFeedDebounced","_createMentionView","_requestFeed","feeds","commitKeys","handledKeyCodes","_hideUIAndRemoveMarker","mentionDescription","feed","dropdownLimit","isValidMentionMarker","feedCallback","createFeedCallback","itemRenderer","_setupTextWatcher","_handleFeedResponse","mentionsView","markerDropdownLimit","_renderItem","mentionMarker","_getItemRenderer","feedText","feedResponse","feedsWithPattern","createRegExp","minimumCharacters","markerDefinition","getLastValidMarkerInText","splitStringFrom","textToTest","createTestCallback","markerPosition","hasMention","isPositionInExistingMention","isMarkerInExistingMention","requestFeedText","matchedTextLength","checkIfStillInCompletionMode","mentionCommand","feedItem","_showOrUpdateUI","markerMarker","_getBalloonPanelPositionData","renderer","renderResult","preferredPosition","getBalloonPanelPositions","caret_se","caret_sw","caret_ne","caret_nw","lastValidMarker","currentMarkerLastIndex","numberOfCharacters","openAfterCharacters","feedItems","bail","stringifyPosition","point","VFileMessage","causeOrReason","optionsOrParentOrPlace","origin","legacyCause","ruleId","fatal","note","minpath","extname","TypeError","assertPath","seenNonSlash","codePointAt","firstNonSlashEnd","extnameIndex","unmatchedSlash","startPart","startDot","preDotState","joined","absolute","allowAboveRoot","lastSlashIndex","lastSegmentLength","lastSlash","dots","normalizeString","minproc","isUrl","fileUrlOrPath","auth","VFile","isUint8Array","cwd","messages","stored","basename","assertNonEmpty","assertPart","dirname","stem","pathname","third","getPathFromURLPosix","urlToPath","fail","encoding","TextDecoder","decode","CallableInstance","own","Processor","Compiler","Parser","attachers","compiler","freezeIndex","frozen","parser","transformers","fns","pipeline","run","middlewareIndex","output","middleware","parameters","fnExpectsCallback","use","middelware","trough","destination","attacher","assertUnfrozen","self","transformer","realFile","vfile","assertParser","process","assertCompiler","parseTree","realDone","tree","compileTree","compileResult","processSync","complete","assertDone","assertNode","outputTree","resultingTree","runSync","addPlugin","addList","addPreset","settings","entryIndex","primary","currentPrimary","unified","asyncName","looksLikeAVFile","ccount","asciiAlpha","regexCheck","asciiAlphanumeric","asciiAtext","asciiControl","asciiDigit","asciiHexDigit","asciiPunctuation","markdownLineEnding","markdownLineEndingOrSpace","markdownSpace","unicodePunctuation","unicodeWhitespace","regex","castFactory","tests","anyFactory","checkAsRecord","nodeAsRecord","propertiesFactory","typeFactory","testFunction","looksLikeANode","empty","EXIT","SKIP","visitParents","visitor","parents","visit","subresult","grandparents","toResult","nodeAsParent","findAndReplace","ignored","ignore","pairs","tupleOrList","tuple","toExpression","toFunction","toPairs","pairIndex","grandparent","siblings","matchObject","global","handler","inConstruct","notInConstruct","enterLiteralAutolink","enterLiteralAutolinkValue","autolinkProtocol","exitLiteralAutolinkHttp","exit","exitLiteralAutolinkWww","sliceSerialize","exitLiteralAutolinkEmail","autolinkEmail","exitLiteralAutolink","transformGfmAutolinkLiterals","findUrl","findEmail","domain","isCorrectDomain","trailExec","trail","closingParenIndex","openingParens","closingParens","splitUrl","atext","email","normalizeIdentifier","enterFootnoteCallString","enterFootnoteCall","identifier","enterFootnoteDefinitionLabelString","enterFootnoteDefinition","exitFootnoteCallString","resume","exitFootnoteCall","exitFootnoteDefinitionLabelString","exitFootnoteDefinition","footnoteReference","tracker","createTracker","subexit","safe","associationId","gfmFootnoteToMarkdown","firstLineBlank","handlers","footnoteDefinition","indentLines","containerFlow","mapAll","mapExceptFirst","unsafe","blank","peek","constructsWithoutStrikethrough","enterStrikethrough","exitStrikethrough","handleDelete","containerPhrasing","defaultStringLength","toAlignment","patternInScope","listInScope","hardBreak","_1","formatCodeAsIndented","fences","checkQuote","encodeCharacterReference","classifyCharacter","encodeInfo","outside","inside","outsideKind","insideKind","emphasis","checkEmphasis","between","betweenHead","betweenTail","attentionEncodeSurroundingInfo","testOrVisitor","visitorOrReverse","maybeReverse","emptyOptions","one","includeImageAlt","includeHtml","formatHeadingAsSetext","literalWithBreak","depth","setext","imageReference","referenceType","inlineCode","expression","compilePattern","atBreak","formatLinkAsAutolink","resourceLink","linkReference","checkBullet","bullet","checkRule","rule","phrasing","strong","checkStrong","handle","blockquote","break","fence","checkFence","longestStreak","encode","meta","rank","closeAtx","bulletCurrent","ordered","bulletOrdered","checkBulletOrdered","bulletOther","checkBulletOther","useDifferentMarker","bulletLastUsed","indexStack","checkListItemIndent","incrementListMarker","thematicBreak","ruleSpaces","repetition","ruleRepetition","checkRuleRepetition","enterTable","_align","inTable","exitTable","enterRow","enterCell","exitCodeText","$0","$1","gfmTableToMarkdown","tableCellPadding","alignDelimiters","tablePipeAlign","around","serializeData","handleTableRowAsData","handleTableAsData","handleTableCell","matrix","alignments","cellMatrix","sizeMatrix","longestCellByColumn","mostCellsPerRow","sizes","delimiterStart","delimiterEnd","markdownTable","exitCheck","exitParagraphWithTaskListItem","firstParaghraph","sibling","listItemWithTaskListItem","checkable","checkbox","chunkStart","combineExtensions","extensions","syntaxExtension","extension","hook","constructs","wwwPrefix","tokenize","effects","nok","wwwPrefixInside","wwwPrefixAfter","partial","underscoreInLastSegment","underscoreInLastLastSegment","seen","domainInside","domainAfter","domainAtPunctuation","sizeOpen","sizeClose","pathInside","pathAtPunctuation","trailCharacterReferenceStart","trailBracketAfter","trailCharacterReferenceInside","emailDomainDotTrail","wwwAutolink","previousWww","previousUnbalanced","attempt","wwwAfter","protocolAutolink","previousProtocol","fromCodePoint","protocolPrefixInside","protocolSlashesInside","afterProtocol","protocolAfter","emailAutolink","dot","gfmAtext","previousEmail","emailDomain","emailDomainAfter","emailDomainDot","_balanced","_gfmAutolinkLiteralWalkedInto","factorySpace","blankLine","tail","tokenizePotentialGfmFootnoteCall","defined","gfmFootnotes","labelStart","resolveToPotentialGfmFootnoteCall","_bufferIndex","chunk","contentType","replacement","tokenizeGfmFootnoteCall","callStart","callData","callEscape","tokenizeDefinitionStart","_container","labelAtMarker","labelInside","labelAfter","labelEscape","whitespaceAfter","tokenizeDefinitionContinuation","gfmFootnoteDefinitionEnd","resolveAll","gfmStrikethrough","single","singleTilde","tokenizer","more","_open","_close","strikethrough","nextEvents","insideSpan","null","attentionMarkers","EditMap","editMap","addImplementation","vecs","gfmTableAlign","inDelimiterRow","alignIndex","tokenizeTable","sizeB","bodyRowStart","headRowBefore","lazy","headRowBreak","headRowStart","interrupt","headDelimiterStart","headRowData","headRowEscape","headDelimiterBefore","headDelimiterValueBefore","headDelimiterCellBefore","headDelimiterNok","headDelimiterLeftAlignmentAfter","headDelimiterCellAfter","headDelimiterFiller","headDelimiterRightAlignmentAfter","bodyRowBreak","bodyRowData","bodyRowEscape","resolveTable","currentTable","currentBody","currentCell","inFirstCellAwaitingPipe","rowKind","afterHeadAwaitingFirstBodyRow","lastTableEnd","flushTableEnd","flushCell","rowEnd","getPoint","relatedStart","relatedEnd","valueToken","tableBody","exits","related","tasklistCheck","_gfmTasklistFirstContentOfListItem","spaceThenNonSpace","remarkGfm","micromarkExtensions","fromMarkdownExtensions","toMarkdownExtensions","continuation","resolveTo","flow","gfm","transforms","literalAutolink","literalAutolinkEmail","literalAutolinkHttp","literalAutolinkWww","gfmFootnoteCallString","gfmFootnoteCall","gfmFootnoteDefinitionLabelString","gfmFootnoteDefinition","canContainEols","tableData","tableHeader","codeText","taskListCheckValueChecked","taskListCheckValueUnchecked","gfmToMarkdown","SpliceBuffer","initial","RangeError","setCursor","deleteCount","chunkedPush","pushMany","unshiftMany","subtokenize","eventsArray","jumps","otherIndex","otherEvent","subevents","_tokenizer","_isInFirstContentOfListItem","subcontent","eventIndex","startPositions","_contentTypeTextTrailing","gaps","stream","adjust","breaks","sliceStream","defineSkip","write","contentStart","contentInitial","lineStart","childFlow","childToken","lineStartOffset","continued","containerState","documentContinue","checkNewContainers","_closeFlow","closeFlow","indexBeforeExits","indexBeforeFlow","exitContainers","documentContinued","currentConstruct","concrete","flowStart","_gfmTableDynamicInterruptHack","containerConstruct","thereIsANewContainer","thereIsNoNewContainer","containerContinue","flowContinue","writeToChild","endOfFile","chunkInside","contentEnd","continuationConstruct","contentContinue","prefixed","flowInitial","afterConstruct","resolver","createResolver","initializeFactory","resolveAllLineSuffixes","notText","extraResolver","chunks","tabs","bufferIndex","furtherBlankLines","initialBlankLine","notInCurrentItem","indentConstruct","initialSize","atMarker","onBlank","listItemPrefixWhitespaceConstruct","endOfPrefix","otherPrefix","blockQuote","contBefore","factoryDestination","literalType","literalMarkerType","rawType","stringType","balance","enclosedBefore","enclosed","enclosedEscape","rawEscape","factoryLabel","markerType","factoryTitle","escape","factoryWhitespace","markerAfter","destinationBefore","destinationAfter","titleBefore","afterWhitespace","beforeMarker","titleAfter","titleAfterOptionalWhitespace","codeIndented","afterPrefix","furtherStart","headingAtx","sequenceOpen","sequenceFurther","setextUnderline","htmlBlockNames","htmlRawNames","htmlFlow","closingTag","markerB","declarationOpen","tagCloseStart","continuationDeclarationInside","commentOpenInside","cdataOpenInside","slash","basicSelfClosing","completeClosingTagAfter","completeAttributeNameBefore","completeEnd","completeAttributeName","completeAttributeNameAfter","completeAttributeValueBefore","completeAttributeValueQuoted","completeAttributeValueUnquoted","completeAttributeValueQuotedAfter","completeAfter","continuationCommentInside","continuationRawTagOpen","continuationClose","continuationCdataInside","continuationStart","blankLineBefore","continuationAfter","nonLazyContinuationStart","continuationStartNonLazy","continuationBefore","continuationRawEndTag","nonLazyContinuation","codeFenced","closeStart","beforeSequenceClose","sequenceClose","sequenceCloseAfter","initialPrefix","beforeSequenceOpen","infoBefore","atNonLazyBreak","metaBefore","contentBefore","beforeContentChunk","contentChunk","decodeNamedCharacterReference","characterReference","numeric","characterEscape","lineEnding","labelEnd","newEvents","media","_inactive","labelEndNok","resourceConstruct","labelEndOk","referenceFullConstruct","referenceNotFull","referenceCollapsedConstruct","resourceBefore","resourceOpen","resourceEnd","resourceDestinationAfter","resourceDestinationMissing","resourceBetween","resourceTitleAfter","referenceFullAfter","referenceFullMissing","referenceCollapsedOpen","labelStartImage","attention","openingSequence","closingSequence","movePoint","autolink","schemeOrEmailAtext","emailAtext","schemeInsideOrEmailAtext","urlInside","emailAtSignOrDot","emailLabel","emailValue","htmlText","returnState","tagOpen","declaration","commentEnd","comment","commentClose","lineEndingBefore","cdata","cdataClose","cdataEnd","instructionClose","tagClose","tagCloseBetween","tagOpenBetween","tagOpenAttributeName","tagOpenAttributeNameAfter","tagOpenAttributeValueBefore","tagOpenAttributeValueQuoted","tagOpenAttributeValueUnquoted","tagOpenAttributeValueQuotedAfter","lineEndingAfter","lineEndingAfterPrefix","labelStartLink","hardBreakEscape","tailExitIndex","headEnterIndex","createTokenizer","initialize","columnStart","resolveAllConstructs","consumed","constructFactory","construct","addResult","onsuccessfulcheck","accountForPotentialSkip","fields","expandTabs","atTab","serializeChunks","chunkIndex","go","expectedCode","startBufferIndex","endBufferIndex","sliceChunks","onreturn","bogusState","listOfConstructs","constructIndex","handleListOfConstructs","handleMapOfConstructs","handleConstruct","startPoint","startPrevious","startCurrentConstruct","startEventsIndex","startStack","decodeNumericCharacterReference","characterEscapeOrReference","decodeString","$2","fromMarkdown","onenterdata","atxHeading","codeFlow","codeFencedFenceInfo","codeFencedFenceMeta","codeTextData","codeFlowValue","definitionDestinationString","definitionLabelString","definitionTitleString","hardBreakTrailing","htmlFlowData","htmlTextData","_spread","listItemValue","expectingFirstListItemValue","listOrdered","listUnordered","referenceString","resourceDestinationString","resourceTitleString","setextHeading","closer","atxHeadingSequence","onexitdata","characterEscapeValue","characterReferenceMarkerHexadecimal","onexitcharacterreferencemarker","characterReferenceMarkerNumeric","characterReferenceValue","characterReferenceType","flowCodeInside","codeFencedFence","onexithardbreak","inReference","atHardBreak","setextHeadingSlurpLineEnding","setextHeadingLineSequence","setextHeadingText","configure","mdastExtensions","tokenStack","listStack","prepareList","defaultOnError","firstBlankLineIndex","containerBalance","listSpread","tailIndex","tailEvent","and","errorHandler","onExitError","postprocess","atCarriageReturn","preprocess","remarkParse","deserialize","serialized","$","unpair","BigInt","deserializer","EMPTY","typeOf","asString","shouldSkip","TYPE","lossy","strict","toISOString","serializer","structuredClone","any","normalizeUri","defaultFootnoteBackContent","rereferenceIndex","defaultFootnoteBackLabel","referenceIndex","pointEnd","pointStart","subtype","contents","listItemLoose","trimLines","trimLine","patch","applyData","clobberPrefix","safeId","footnoteOrder","reuseCounter","footnoteCounts","dataFootnoteRef","ariaDescribedBy","allowDangerousHtml","definitionById","listLoose","tableContent","alignValue","toml","yaml","hName","hChildren","hProperties","defaultUnknownHandler","trimMarkdownSpaceStart","toHast","footnoteById","passThrough","unknownHandler","createState","foot","footnoteBackContent","footnoteBackLabel","footnoteLabel","footnoteLabelTagName","footnoteLabelProperties","backReferences","counts","dataFootnoteBackref","tailTail","dataFootnotes","footer","remarkRehype","async","hastTree","remarkBreaks","newlineToBreak","Schema","Info","booleanish","boolean","commaOrSpaceSeparated","commaSeparated","mustUseProperty","overloadedBoolean","spaceSeparated","powers","increment","DefinedInfo","mask","mark","normals","ariaActiveDescendant","ariaAtomic","ariaAutoComplete","ariaBusy","ariaChecked","ariaColCount","ariaColIndex","ariaColSpan","ariaControls","ariaCurrent","ariaDetails","ariaDisabled","ariaDropEffect","ariaErrorMessage","ariaExpanded","ariaFlowTo","ariaGrabbed","ariaHasPopup","ariaHidden","ariaInvalid","ariaKeyShortcuts","ariaLevel","ariaLive","ariaModal","ariaMultiLine","ariaMultiSelectable","ariaOrientation","ariaOwns","ariaPlaceholder","ariaPosInSet","ariaPressed","ariaReadOnly","ariaRelevant","ariaRequired","ariaRoleDescription","ariaRowCount","ariaRowIndex","ariaRowSpan","ariaSelected","ariaSetSize","ariaSort","ariaValueMax","ariaValueMin","ariaValueNow","ariaValueText","caseSensitiveTransform","caseInsensitiveTransform","acceptcharset","classname","htmlfor","httpequiv","abbr","acceptCharset","accessKey","allow","allowFullScreen","allowPaymentRequest","allowUserMedia","autoCapitalize","autoComplete","autoFocus","autoPlay","blocking","charSet","cite","colSpan","contentEditable","controls","controlsList","crossOrigin","dateTime","decoding","dirName","download","draggable","encType","enterKeyHint","fetchPriority","formAction","formEncType","formMethod","formNoValidate","formTarget","hrefLang","htmlFor","httpEquiv","imageSizes","imageSrcSet","inert","integrity","isMap","itemProp","itemRef","itemScope","itemType","loading","loop","manifest","maxLength","minLength","muted","nonce","noModule","noValidate","onAbort","onAfterPrint","onAuxClick","onBeforeMatch","onBeforePrint","onBeforeToggle","onBeforeUnload","onBlur","onCancel","onCanPlay","onCanPlayThrough","onChange","onClose","onContextLost","onContextMenu","onContextRestored","onCopy","onCueChange","onCut","onDblClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onDurationChange","onEmptied","onEnded","onError","onFocus","onFormData","onHashChange","onInput","onInvalid","onKeyDown","onKeyPress","onKeyUp","onLanguageChange","onLoad","onLoadedData","onLoadedMetadata","onLoadEnd","onLoadStart","onMessage","onMessageError","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onOffline","onOnline","onPageHide","onPageShow","onPaste","onPause","onPlay","onPlaying","onPopState","onProgress","onRateChange","onRejectionHandled","onReset","onResize","onScroll","onScrollEnd","onSecurityPolicyViolation","onSeeked","onSeeking","onSelect","onSlotChange","onStalled","onStorage","onSuspend","onTimeUpdate","onToggle","onUnhandledRejection","onUnload","onVolumeChange","onWaiting","onWheel","optimum","ping","playsInline","popover","popoverTarget","popoverTargetAction","poster","preload","readOnly","referrerPolicy","required","sandbox","scoped","seamless","shadowRootClonable","shadowRootDelegatesFocus","shadowRootMode","spellCheck","srcDoc","srcLang","srcSet","tabIndex","translate","typeMustMatch","useMap","writingSuggestions","aLink","archive","axis","bgColor","bottomMargin","cellPadding","cellSpacing","charOff","classId","codeBase","codeType","compact","declare","face","frameBorder","hSpace","leftMargin","longDesc","lowSrc","marginHeight","marginWidth","noResize","noHref","noShade","noWrap","profile","prompt","rev","rightMargin","scheme","scrolling","standby","summary","topMargin","valueType","vAlign","vLink","vSpace","allowTransparency","autoCorrect","autoSave","disablePictureInPicture","disableRemotePlayback","security","unselectable","accentHeight","alignmentBaseline","arabicForm","baselineShift","capHeight","clipPath","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","dataType","dominantBaseline","enableBackground","fillOpacity","fillRule","floodColor","floodOpacity","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","horizAdvX","horizOriginX","horizOriginY","imageRendering","letterSpacing","lightingColor","markerEnd","markerMid","markerStart","navDown","navDownLeft","navDownRight","navLeft","navNext","navPrev","navRight","navUp","navUpLeft","navUpRight","onActivate","onBegin","onEnd","onFocusIn","onFocusOut","onMouseWheel","onRepeat","onZoom","overlinePosition","overlineThickness","paintOrder","panose1","pointerEvents","renderingIntent","shapeRendering","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","strokeDashArray","strokeDashOffset","strokeLineCap","strokeLineJoin","strokeMiterLimit","strokeOpacity","strokeWidth","textAnchor","textDecoration","textRendering","transformOrigin","underlinePosition","underlineThickness","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","vHanging","vIdeographic","vMathematical","vectorEffect","vertAdvY","vertOriginX","vertOriginY","wordSpacing","writingMode","xHeight","playbackOrder","timelineBegin","about","accumulate","additive","alphabetic","amplitude","ascent","azimuth","bandwidth","baseFrequency","baseProfile","bbox","bias","by","calcMode","clip","clipPathUnits","contentScriptType","contentStyleType","cursor","cx","cy","defaultAction","descent","diffuseConstant","dur","divisor","dx","dy","edgeMode","elevation","exponent","externalResourcesRequired","filterRes","filterUnits","focusHighlight","fr","fx","fy","g1","g2","glyphRef","gradientTransform","gradientUnits","hanging","hatchContentUnits","hatchUnits","ideographic","initialVisibility","in","in2","intercept","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","kerning","lengthAdjust","limitingConeAngle","local","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","mathematical","mediaCharacterEncoding","mediaContentEncodings","mediaSize","mediaTime","numOctaves","opacity","operator","orient","orientation","overlay","pathLength","patternContentUnits","patternTransform","patternUnits","phase","pitch","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","propagate","radius","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","requiredFonts","requiredFormats","restart","rotate","rx","ry","scale","seed","slope","snapshotTime","specularConstant","specularExponent","spreadMethod","spacing","stdDeviation","stemh","stemv","stitchTiles","stroke","surfaceScale","syncBehavior","syncBehaviorDefault","syncMaster","syncTolerance","syncToleranceDefault","systemLanguage","tableValues","targetX","targetY","transformBehavior","u1","u2","unicode","widths","x1","xChannelSelector","yChannelSelector","zoomAndPan","xlink","xLinkActuate","xLinkArcRole","xLinkHref","xLinkRole","xLinkShow","xLinkTitle","xLinkType","xmlnsxlink","xmlnsXLink","xml","xmlBase","xmlLang","xmlSpace","cap","dash","valid","Type","camelcase","dashes","kebab","webNamespaces","foundNamespace","rootIsDocument","createDocument","appendAll","impliedNamespace","createDocumentType","doctype","addProperties","currentImpliedNamespace","afterTransform","toDom","htmlVoidElements","zwitch","invalid","unknown","defaultSubsetRegex","surrogatePairsRegex","controlCharactersRegex","regexEscapeRegex","subsetToRegexCache","hexadecimalRegex","decimalRegex","characterEntitiesLegacy","characterEntitiesHtml4","nbsp","iexcl","cent","pound","curren","yen","brvbar","sect","uml","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","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","beta","gamma","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","real","trade","alefsym","larr","uarr","rarr","darr","harr","crarr","lArr","uArr","rArr","dArr","hArr","forall","exist","nabla","isin","notin","ni","prod","minus","lowast","radic","infin","ang","or","cup","int","there4","sim","cong","asymp","ne","equiv","le","ge","sub","nsub","sube","supe","oplus","otimes","perp","sdot","lceil","rceil","lfloor","rfloor","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","dangerous","characters","notAlphanumericRegex","formatSmart","named","omit","toHexadecimal","omitOptionalSemicolons","useNamedReferences","useShortestReferences","toNamed","decimal","toDecimal","stringifyEntities","subset","cached","charactersToExpression","charactersToExpressionCached","basic","escapeOnly","htmlCommentRegex","bogusCommentEntitySubset","commentEntitySubset","padRight","padLeft","re","whitespace","thing","siblingAfter","siblingBefore","emptyChildren","includeWhitespace","omission","closing","headOrColgroupOrCaption","colgroup","li","optgroup","rp","rubyElement","rt","tbody","td","tfoot","th","thead","opening","constants","unquoted","serializeAttribute","allowParseErrors","allowDangerousCharacters","characterReferences","tightCommaSeparatedLists","collapseEmptyAttributes","preferUnquoted","quoteSmart","alternative","textEntitySubset","node_","_2","bogusComments","_3","upperDoctype","tightDoctype","omitOptionalTags","selfClosing","closeEmptyElements","voids","tightAttributes","serializeAttributes","closeSelfClosing","tightSelfClosing","emptyCharacterReferences","toHtml","options_","createH","defaultTagName","caseSensitive","createAdjustMap","selector","subvalue","parseSelector","adjusted","record","addProperty","addChild","parsePrimitive","finalResult","fromDom","namespaceURI","nodeValue","MarkdownGfmMdToHtml","_processor","rehypeDomRaw","deleteClassesFromToDoLists","markdown","isNodeRootOrElement","parseDocument","parseFragment","convertElement","looksLikeAnElement","tagNameFactory","embedded","skippable","ignorableNode","minify","blocklike","inferWhiteSpace","collapsableAfter","stripAtStart","removable","minifyText","inferBoundary","replaceNewlines","replaceWhitespace","collapseFactory","rehypeMinifyWhitespace","newlines","minifyWhitespace","findAfter","searchLineFeeds","searchTabOrSpaces","notRendered","blockOrCaption","toText","inferWhitespace","breakBefore","breakAfter","collectText","renderedTextCollection","collectElement","collectPreText","trimAndCollapseSpacesAndTabs","trimTrailingLines","del","listItemsSpread","toSpecificContent","em","dropSurroundingBreaks","findSelectedOptions","explicitProperties","selectedOptions","findOptions","isBodyOkLink","hasProperty","extractLeadingCheckbox","spreadout","toFlow","seenFlow","restHead","wrapNeeded","runs","newParent","cloneWithoutChildren","newChild","onphrasing","onnonphrasing","flattened","flatten","linkInFallbackContent","defaultQuotes","hastUtilToMdastTemporaryRowSpan","hastUtilToMdastTemporaryColSpan","createCell","createRow","nodeHandlers","applet","area","basefont","bgsound","col","datalist","embed","frameset","isindex","keygen","math","menuitem","nextid","noembed","noframes","param","script","shadow","spacer","track","acronym","bdi","bdo","blink","details","dfn","font","ins","marquee","meter","nobr","noscript","progress","rb","rbc","rtc","ruby","address","aside","div","fieldset","figcaption","hgroup","legend","multicol","nav","picture","section","audio","baseFound","frozenBaseUrl","br","dl","h1","h2","h3","h4","h5","h6","iframe","unchecked","elementById","texts","kbd","listing","ol","plaintext","quotes","qNesting","samp","strike","headless","inspect","otherRowIndex","colIndex","textarea","tt","u","ul","var","video","wbr","xmp","dataMdast","build","expectedParent","toMdast","cleanTree","transformWhitespace","mdast","defaults","rehypeRemark","mdastTree","fullPhrasingSpans","_compiled","eol","numerical","escapeBackslashes","whole","lineShift","toMarkdown","containerPhrasingBound","containerFlowBound","safeBound","tightDefinitions","joinDefinition","encodeAfter","encodingInfo","infos","remarkStringify","MarkdownGfmHtmlToMd","_keepRawTags","_buildProcessor","keep","_getRawTagsHandlers","endOfOpeningTagIndex","openingTag","removeLabelFromCheckboxes","MarkdownGfmDataProcessor","_htmlDP","_markdown2html","_html2markdown","keepHtml","PageBreakCommand","getInsertPageBreakParent","isPageBreakAllowedInParent","pageBreakElement","PageBreakEditing","viewWrapper","viewLabelElement","toPageBreakWidget","hasPageBreakBefore","hasPageBreakAfter","viewSpan","PageBreakUI","StyleGridButtonView","previewView","_createPreview","previewTemplate","StyleGridView","gridTileView","activeStyles","enabledStyles","StyleGroupView","gridView","StylePanelView","blockStylesGroupView","inlineStylesGroupView","NON_PREVIEWABLE_ELEMENT_NAMES","StyleUtils","_htmlSupport","normalizeConfig","normalizedDefinitions","ghsAttributes","ghsDefinition","ghsBlockDefinition","getStylePreview","isStyleEnabledForBlock","getGhsAttributeNameForElement","isStyleActiveForBlock","ghsAttributeValue","hasAllClasses","getAffectedBlocks","isStyleEnabledForInlineSelection","isStyleActiveForInlineSelection","getAffectedInlineSelectable","configureGHSDataFilter","ghsDataFilter","normalizedStyleDefinitionToMatcherPattern","StyleUI","styleUtils","normalizedStyleDefinitions","styleCommand","StyleCommand","_styleDefinitions","_styleUtils","ancestorBlocks","htmlSupport","allDefinitions","activeDefinitions","shouldAddStyle","selectables","isBlockStyleDefinition","_findAffectedBlocks","getBlocksFromSelection","addModelHtmlClass","removeModelHtmlClass","getDefinitionExclusiveClasses","selectedBlocks","selectedBlock","affectedBlocks","affectedBlock","ListStyleSupport","_listUtils","_isStyleEnabledForBlock","_isStyleActiveForBlock","_getAffectedBlocks","templateDefinition","_getStylePreview","TableStyleSupport","_tableUtils","_isApplicable","isHeadingCell","LinkStyleSupport","_isStyleEnabled","_isStyleActive","_getAffectedSelectable","expandedRange","expandAttributePosition","referenceNode","StyleEditing","HorizontalLineCommand","getInsertHorizontalLineParent","isHorizontalLineAllowedInParent","horizontalElement","HorizontalLineEditing","toHorizontalLineWidget","HorizontalLineUI","LinkImageEditing","isImageInlinePluginLoaded","imageInLink","blockImageView","upcastLink","viewImgOrPicture","downcastImageLink","downcastImageLinkManualDecorator","upcastImageLinkManualDecorator","LinkImageUI","_isSelectedLinkedImage","_createToolbarLinkImageButton","HtmlEmbedCommand","selectedRawHtmlElement","getSelectedRawHtmlModelWidget","getInsertHtmlEmbedParent","isHtmlEmbedAllowedInParent","htmlEmbedElement","HtmlEmbedEditing","_widgetButtonViewReferences","showPreviews","sanitizeHtml","rawHtml","widgetButtonViewReferences","htmlEmbedConfig","renderContent","domTextarea","textareaProps","isDisabled","textareaPlaceholder","createDomTextarea","previewContainerProps","sanitizedOutput","getRawHtmlValue","domPreviewPlaceholder","domPreviewContent","domDocumentFragment","createContextualFragment","createPreviewContainer","buttonsWrapperProps","onEditClick","onSaveClick","onCancelClick","prepend","domButtonsWrapper","createUIButton","editButtonView","createDomButtonsWrapper","domContentWrapper","viewContentWrapper","rawHtmlApi","makeEditable","HtmlEmbedUI","HtmlPageDataProcessor","docType","xmlDeclaration","headStylesElements","page","isAllowedRenderStylesFromHead","CharacterGridView","tiles","createTile","tile","mouseover","CharacterInfoView","characterToUnicodeString","SpecialCharactersView","categoriesView","infoView","SpecialCharactersCategoriesView","_groupNames","_dropdownView","groupNames","_setupDropdown","currentGroupName","ALL_SPECIAL_CHARACTERS_GROUP","SpecialCharactersArrows","SpecialCharactersText","SpecialCharactersMathematical","SpecialCharactersLatin","SpecialCharactersCurrency","ShowBlocksCommand","CLASS_NAME","ShowBlocksEditing","ShowBlocksUI","FindAndReplaceFormView","_findInputView","_replaceInputView","_findButtonView","_findPrevButtonView","_findNextButtonView","_advancedOptionsCollapsibleView","_matchCaseSwitchView","_wholeWordsOnlySwitchView","_replaceButtonView","_replaceAllButtonView","_inputsDivView","_actionButtonsDivView","_keystrokes","matchCount","isDirty","_createInputField","_createInputsDiv","_createMatchCaseSwitch","_createWholeWordsOnlySwitch","_createAdvancedOptionsCollapsible","_createActionButtonsDiv","_initFocusCycling","_initKeystrokeHandling","_textToFind","_textToReplace","inputsDivView","findPrevious","findNext","_injectFindResultsCounter","resultsFound","_onFindButtonExecute","searchText","matchCase","_matchCase","wholeWords","_wholeWordsOnly","resultsCounterView","highlightOffset","updateFindInputPadding","counterWidth","paddingPropertyName","collapsible","actionsDivView","replaceText","matchCaseSwitchButton","wholeWordsOnlySwitchButton","stopPropagationAndPreventDefault","_areCommandsEnabled","FindAndReplaceUI","isUiUsingDropdown","findCommand","_createDialogButtonForToolbar","cancelEvent","dropdownButtonView","_createDialogButtonForMenuBar","_setupFormView","editingState","findNextCommand","findPreviousCommand","replaceCommand","replaceAllCommand","FindCommand","callbackOrText","findAndReplaceUtils","findCallback","callbackSearchText","findByTextCallback","oldCallback","currentResults","updateFindResultFromRange","highlightedResult","lastSearchCallback","matchWholeWords","FindAndReplaceState","highlightedResultRemoved","removedResult","nextHighlightedIndex","refreshHighlightOffset","oldMatchId","highlightedOffset","sortSearchResultsByMarkerPositions","sortMapping","same","different","FindReplaceCommandBase","_replace","replacementText","ReplaceCommand","oldHighlightOffset","sortedResults","ReplaceAllCommand","textToReplace","searchResult","FindNextCommand","FindPreviousCommand","previousIndex","FindAndReplaceUtils","startResults","foundItems","rangeToText","foundItem","resultId","resultsList","markerToInsert","findInsertIndex","markerItem","resultsMarker","checkIfResultAlreadyOnList","searchTerm","regExpQuery","escapeRegExp","nonLetterGroup","regexpMatchToFindResult","matchResult","lastGroupIndex","FindAndReplaceEditing","_defineConverters","_defineCommands","newMatchId","debouncedScrollListener","isSearchActive","_onDocumentChange","findAttributes","_isSearchActive","changedNodes","removedMarkers","changedMarkers","markerAtChange","changedSearchResults","nodeToCheck","changedNodeSearchResults","markerToCheck","ClassicEditor","_addListAutoformats","_addBasicStylesAutoformats","_addHeadingAutoformats","_addBlockQuoteAutoformats","_addCodeBlockAutoformats","_addHorizontalLineAutoformats","boldCallback","italicCallback","codeCallback","strikethroughCallback","adapter","_debouncedSave","_savePromise","_pendingActions","_makeImmediateSave","_action","waitingTime","_saveCallbacks","_setPendingAction","_flush","saveCallbacks","normalizers","_isTransformedWithPasteFromOffice","activeNormalizer","normalizedHtml","normalizeSpacing","bodyCloseTag","bodyCloseIndex","htmlCloseIndex","cleanContentAfterBody","htmlDocument","htmlElement","innerTextLength","normalizeSpacerunSpans","bodyString","bodyView","documentToView","styleTags","getElementsByTagName","sheet","cssRules","extractStyles","parsePasteOfficeHtml","tableContentToolbarItems","tableToolbarItems","_setupConversionUsingClasses","_setupConversionUsingOffset","indentCommand","outdentCommand","marginProperty","_replacedRoots","_dataFromRoots","_checkCompatibility","_isAllowedToHandleSourceEditingMode","isSourceEditingMode","_hideVisibleDialog","_showSourceEditing","_disableCommands","_hideSourceEditing","_enableCommands","_handleReadOnlyMode","updateEditorData","domSourceEditingElementWrapper","oldData","suppressErrorInCollaboration","allowCollaboration","domRootElement","domSourceEditingElementTextarea","setSelectionRange","_hideDocumentOutline","_refreshAnnotationsVisibility","_focusSourceEditing","_showDocumentOutline","refreshVisibility","isEditorReadOnly","hasAnyPendingActions","removeFormatCommand","inlineDefinition","setModelHtmlAttributes","attributesMap","removeModelHtmlAttributes","setModelHtmlStyles","removeModelHtmlStyles","_outputView","_wordsMatchRegExp","defineProperties","_getCharacters","_getText","_getWords","_refreshStats","onUpdate","wordCountContainer","displayWords","displayCharacters","txt","toMentionAttribute","allowRenderStylesFromHead","sanitizeCss","rawCss","css","_renderStylesFromHead","_removeStyleElementsFromDom","existingStyleElements","_renderStyleElementsInDom","styleElements","sanitizedCss","_characters","_groups","_allSpecialCharactersGroupLabel","_getGroup","getGroups","invalidGroup","getCharactersForGroup","getCharacter","_updateGrid","characterTitles","_createDropdownPanelContent","groupEntries","specialCharsGroups","findAndReplaceEditing","ckeditorRegisterCallback","ckeditorUnregisterCallback","cookieValue","cookies","createEditors","allEditors","resolveElementArray","editorEl","script_id","upload_url","upload_file_types","csrf_cookie_name","labelElement","simpleUpload","fileUploader","autosave","saveUrl","wordCountPlugin","wordCountWrapper","django","jQuery","mainContent"],"ignoreList":[],"sourceRoot":""}